@symply.io/basic-components 1.0.0-alpha.15 → 1.0.0-alpha.17

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.
Files changed (82) hide show
  1. package/AlertDialog/index.d.ts +0 -1
  2. package/AlertDialog/index.js +2 -2
  3. package/Autocomplete/index.d.ts +4 -0
  4. package/Autocomplete/index.js +38 -0
  5. package/Autocomplete/types.d.ts +15 -0
  6. package/Autocomplete/types.js +1 -0
  7. package/Autocomplete/useInteractions.d.ts +5 -0
  8. package/Autocomplete/useInteractions.js +9 -0
  9. package/AutocompleteWithFilter/index.d.ts +4 -0
  10. package/AutocompleteWithFilter/index.js +54 -0
  11. package/AutocompleteWithFilter/types.d.ts +16 -0
  12. package/AutocompleteWithFilter/types.js +1 -0
  13. package/BasicModal/Content.d.ts +0 -1
  14. package/BasicModal/Content.js +1 -1
  15. package/BasicModal/index.d.ts +0 -1
  16. package/BasicModal/index.js +2 -2
  17. package/BreadCrumbs/index.d.ts +4 -0
  18. package/BreadCrumbs/index.js +37 -0
  19. package/BreadCrumbs/types.d.ts +9 -0
  20. package/BreadCrumbs/types.js +1 -0
  21. package/CheckBox/CheckBox.d.ts +3 -0
  22. package/CheckBox/CheckBox.js +36 -0
  23. package/CheckBox/CheckBoxGroup.d.ts +3 -0
  24. package/CheckBox/CheckBoxGroup.js +30 -0
  25. package/CheckBox/index.d.ts +3 -0
  26. package/CheckBox/index.js +3 -0
  27. package/CheckBox/types.d.ts +12 -0
  28. package/CheckBox/types.js +1 -0
  29. package/Copyright/index.d.ts +4 -0
  30. package/Copyright/index.js +25 -0
  31. package/Copyright/types.d.ts +5 -0
  32. package/Copyright/types.js +1 -0
  33. package/DigitInput/index.d.ts +1 -4
  34. package/DigitInput/index.js +1 -1
  35. package/DigitInput/types.d.ts +2 -1
  36. package/DynamicHeaderBar/HeaderBar.js +1 -1
  37. package/DynamicHeaderBar/HeaderButtons.d.ts +0 -1
  38. package/DynamicHeaderBar/HeaderButtons.js +5 -5
  39. package/DynamicHeaderBar/HeaderLine.js +1 -1
  40. package/DynamicHeaderBar/index.js +2 -2
  41. package/FormRadioGroup/index.d.ts +0 -1
  42. package/FormRadioGroup/index.js +3 -3
  43. package/FormSelector/MultipleSelector.d.ts +1 -3
  44. package/FormSelector/MultipleSelector.js +2 -2
  45. package/FormSelector/SimpleSelector.d.ts +1 -3
  46. package/FormSelector/SimpleSelector.js +2 -2
  47. package/FormSelector/types.d.ts +2 -1
  48. package/HelpCaption/index.js +2 -2
  49. package/LoadingModal/index.d.ts +0 -1
  50. package/LoadingModal/index.js +1 -1
  51. package/MenuButtonGroup/MenuItem.d.ts +0 -1
  52. package/MenuButtonGroup/MenuItem.js +1 -1
  53. package/MenuButtonGroup/index.js +2 -2
  54. package/NumberInput/index.d.ts +2 -3
  55. package/NumberInput/index.js +1 -1
  56. package/PasswordInput/ConfirmPassword.d.ts +2 -3
  57. package/PasswordInput/ConfirmPassword.js +1 -1
  58. package/PasswordInput/Password.d.ts +2 -3
  59. package/PasswordInput/Password.js +2 -2
  60. package/PhoneNumberInput/index.d.ts +2 -3
  61. package/PhoneNumberInput/index.js +2 -2
  62. package/README.md +191 -1
  63. package/TabGroup/index.js +2 -2
  64. package/TablePagination/Actions.d.ts +3 -0
  65. package/TablePagination/Actions.js +27 -0
  66. package/TablePagination/index.d.ts +4 -0
  67. package/TablePagination/index.js +30 -0
  68. package/TablePagination/types.d.ts +14 -0
  69. package/TablePagination/types.js +1 -0
  70. package/TablePagination/useInteractions.d.ts +14 -0
  71. package/TablePagination/useInteractions.js +23 -0
  72. package/TextInput/index.d.ts +2 -3
  73. package/TextInput/index.js +1 -1
  74. package/ToastPrompt/Presentation.js +3 -3
  75. package/ToastPrompt/index.d.ts +0 -2
  76. package/ToastPrompt/index.js +1 -2
  77. package/VideoPlayerModal/index.d.ts +1 -3
  78. package/VideoPlayerModal/index.js +2 -2
  79. package/VideoPlayerModal/types.d.ts +2 -1
  80. package/index.d.ts +11 -0
  81. package/index.js +11 -0
  82. package/package.json +4 -2
@@ -1,5 +1,3 @@
1
- /// <reference types="react" />
2
- import { FormControlProps } from "@mui/material/FormControl";
3
1
  import { SimpleSelectorProps } from "./types";
4
- declare function SimpleSelector(props: SimpleSelectorProps & FormControlProps): JSX.Element;
2
+ declare function SimpleSelector(props: SimpleSelectorProps): JSX.Element;
5
3
  export default SimpleSelector;
@@ -34,7 +34,7 @@ function SimpleSelector(props) {
34
34
  var label = props.label, _a = props.variant, variant = _a === void 0 ? "outlined" : _a, value = props.value, tooltip = props.tooltip, _b = props.disabled, disabled = _b === void 0 ? false : _b, _c = props.required, required = _c === void 0 ? false : _c, _d = props.showHelperText, showHelperText = _d === void 0 ? false : _d, helperText = props.helperText, _e = props.options, options = _e === void 0 ? [] : _e, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, onChange = props.onChange, rest = __rest(props, ["label", "variant", "value", "tooltip", "disabled", "required", "showHelperText", "helperText", "options", "primaryColor", "secondaryColor", "onChange"]);
35
35
  var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
36
36
  var _f = useInteractions(), tooltipOpen = _f.tooltipOpen, onOpenTooltip = _f.onOpenTooltip, onCloseTooltip = _f.onCloseTooltip;
37
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Tooltip, __assign({ title: tooltip !== null && tooltip !== void 0 ? tooltip : "", open: !!tooltip && tooltipOpen }, { children: _jsxs(FormControl, __assign({ variant: variant, disabled: disabled, required: required }, rest, { children: [label && (_jsx(InputLabel, __assign({ id: "symply-simple-selector" }, { children: label }), void 0)), _jsx(Select, __assign({ value: value, required: required, disabled: disabled, onChange: function (event) {
37
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Tooltip, __assign({ title: tooltip !== null && tooltip !== void 0 ? tooltip : "", open: !!tooltip && tooltipOpen }, { children: _jsxs(FormControl, __assign({ variant: variant, disabled: disabled, required: required }, rest, { children: [label && (_jsx(InputLabel, __assign({ id: "symply-simple-selector" }, { children: label }))), _jsx(Select, __assign({ value: value, required: required, disabled: disabled, onChange: function (event) {
38
38
  var _a;
39
39
  onChange((_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.value);
40
40
  }, inputProps: {
@@ -43,6 +43,6 @@ function SimpleSelector(props) {
43
43
  }, label: label }, { children: (options === null || options === void 0 ? void 0 : options.length) > 0 ? (options.map(function (option) {
44
44
  var label = option.label, value = option.value, disabled = option.disabled;
45
45
  return (_jsx(MenuItem, __assign({ value: value, disabled: disabled }, { children: label }), value));
46
- })) : (_jsx(MenuItem, __assign({ value: "", disabled: true }, { children: "No Options" }), void 0)) }), void 0), !!helperText && showHelperText && (_jsx(FormHelperText, { children: showHelperText }, void 0))] }), void 0) }), void 0) }), void 0));
46
+ })) : (_jsx(MenuItem, __assign({ value: "", disabled: true }, { children: "No Options" }))) })), !!helperText && showHelperText && (_jsx(FormHelperText, { children: showHelperText }))] })) })) })));
47
47
  }
48
48
  export default SimpleSelector;
@@ -1,6 +1,7 @@
1
1
  import { ReactNode, CSSProperties } from "react";
2
2
  import { SelectProps } from "@mui/material/Select";
3
- interface SelectorBaseProps {
3
+ import { FormControlProps } from "@mui/material/FormControl";
4
+ interface SelectorBaseProps extends Omit<FormControlProps, "onChange"> {
4
5
  label?: string;
5
6
  tooltip?: ReactNode;
6
7
  showHelperText?: boolean;
@@ -20,7 +20,7 @@ function HelpCaption(props) {
20
20
  var mainCaption = props.mainCaption, subCaption = props.subCaption, linkUrl = props.linkUrl, _a = props.linkText, linkText = _a === void 0 ? "Watch Demo" : _a, _b = props.linkType, linkType = _b === void 0 ? "WEBPAGE" : _b, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor;
21
21
  var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
22
22
  var _c = useInteractions(), videoModalOpen = _c.videoModalOpen, onOpenVideoModal = _c.onOpenVideoModal, onCloseVideoModal = _c.onCloseVideoModal;
23
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsxs(Grid, __assign({ container: true, spacing: 1, direction: subCaption ? "column" : "row" }, { children: [_jsx(Grid, __assign({ item: true }, { children: _jsx(Typography, __assign({ align: "left", component: "span" }, { children: mainCaption }), void 0) }), void 0), _jsxs(Grid, __assign({ item: true }, { children: [subCaption && (_jsxs(_Fragment, { children: [_jsx(Typography, __assign({ align: "left", component: "span" }, { children: subCaption }), void 0), "\u00A0"] }, void 0)), linkUrl && (_jsx(Typography, __assign({ onClick: linkType === "WEBPAGE"
23
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsxs(Grid, __assign({ container: true, spacing: 1, direction: subCaption ? "column" : "row" }, { children: [_jsx(Grid, __assign({ item: true }, { children: _jsx(Typography, __assign({ align: "left", component: "span" }, { children: mainCaption })) })), _jsxs(Grid, __assign({ item: true }, { children: [subCaption && (_jsxs(_Fragment, { children: [_jsx(Typography, __assign({ align: "left", component: "span" }, { children: subCaption })), "\u00A0"] })), linkUrl && (_jsx(Typography, __assign({ onClick: linkType === "WEBPAGE"
24
24
  ? function () {
25
25
  window.open(linkUrl);
26
26
  }
@@ -30,6 +30,6 @@ function HelpCaption(props) {
30
30
  color: theme.palette.primary.dark,
31
31
  textDecoration: "underline"
32
32
  }
33
- } }, { children: _jsx("b", { children: linkText }, void 0) }), void 0))] }), void 0), linkUrl && (_jsx(VideoPlayerModal, { open: videoModalOpen, url: linkUrl, onClose: onCloseVideoModal }, void 0))] }), void 0) }), void 0));
33
+ } }, { children: _jsx("b", { children: linkText }) })))] })), linkUrl && (_jsx(VideoPlayerModal, { open: videoModalOpen, url: linkUrl, onClose: onCloseVideoModal }))] })) })));
34
34
  }
35
35
  export default HelpCaption;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { LoadingModalProps } from "./types";
3
2
  declare function LoadingModal(props: LoadingModalProps): JSX.Element;
4
3
  export default LoadingModal;
@@ -24,7 +24,7 @@ function LoadingModal(props) {
24
24
  return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Dialog, __assign({ maxWidth: "xs", open: open, sx: { backgroundColor: "#7A7A7A97" }, PaperProps: { sx: { backgroundColor: "#F2F2F2CF" } }, onClose: function (_, reason) {
25
25
  if (reason === "backdropClick")
26
26
  return;
27
- }, disableEscapeKeyDown: true }, { children: _jsx(DialogContent, { children: _jsxs(Grid, __assign({ container: true, direction: direction, justifyContent: "space-between", alignItems: "center", "data-testid": "loading-grid" }, { children: [_jsxs(Box, __assign({ position: "relative", display: "inline-flex", sx: { mt: 1.25 } }, { children: [_jsx(CircularProgress, { size: showProgess ? 56 : 40, value: percent, variant: showProgess ? "determinate" : "indeterminate" }, void 0), showProgess && percent >= 0 && (_jsx(Box, __assign({ top: 0, left: 0, bottom: 0, right: 0, position: "absolute", display: "flex", alignItems: "center", justifyContent: "center" }, { children: _jsxs(Typography, __assign({ variant: "caption" }, { children: [Math.round(percent), "%"] }), void 0) }), void 0))] }), void 0), _jsx(Typography, __assign({ variant: "subtitle1", component: "span", sx: { mt: 1 } }, { children: text }), void 0)] }), void 0) }, void 0) }), void 0) }), void 0));
27
+ }, disableEscapeKeyDown: true }, { children: _jsx(DialogContent, { children: _jsxs(Grid, __assign({ container: true, direction: direction, justifyContent: "space-between", alignItems: "center", "data-testid": "loading-grid" }, { children: [_jsxs(Box, __assign({ position: "relative", display: "inline-flex", sx: { mt: 1.25 } }, { children: [_jsx(CircularProgress, { size: showProgess ? 56 : 40, value: percent, variant: showProgess ? "determinate" : "indeterminate" }), showProgess && percent >= 0 && (_jsx(Box, __assign({ top: 0, left: 0, bottom: 0, right: 0, position: "absolute", display: "flex", alignItems: "center", justifyContent: "center" }, { children: _jsxs(Typography, __assign({ variant: "caption" }, { children: [Math.round(percent), "%"] })) })))] })), _jsx(Typography, __assign({ variant: "subtitle1", component: "span", sx: { mt: 1 } }, { children: text }))] })) }) })) })));
28
28
  }
29
29
  export default LoadingModal;
30
30
  export * from "./types";
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { MenuItemProps } from "@mui/material/MenuItem";
3
2
  import { ListItemIconProps } from "@mui/material/ListItemIcon";
4
3
  export interface ButtonItemProps {
@@ -18,6 +18,6 @@ import useCustomTheme from "../useCustomTheme";
18
18
  function ButtonMenuItem(props) {
19
19
  var buttonText = props.buttonText, buttonIcon = props.buttonIcon, _a = props.disabled, disabled = _a === void 0 ? false : _a, onClick = props.onClick;
20
20
  var theme = useCustomTheme();
21
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsxs(MenuItem, __assign({ onClick: onClick, disabled: disabled }, { children: [buttonIcon && _jsx(ListItemIcon, { children: buttonIcon }, void 0), _jsx(ListItemText, { primary: buttonText }, void 0)] }), void 0) }), void 0));
21
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsxs(MenuItem, __assign({ onClick: onClick, disabled: disabled }, { children: [buttonIcon && _jsx(ListItemIcon, { children: buttonIcon }), _jsx(ListItemText, { primary: buttonText })] })) })));
22
22
  }
23
23
  export default ButtonMenuItem;
@@ -75,7 +75,7 @@ function MenuButtonGroup(props) {
75
75
  var onClose = function () {
76
76
  setAnchorEl(null);
77
77
  };
78
- return (_jsxs(ThemeProvider, __assign({ theme: theme }, { children: [_jsx(Button, __assign({ "aria-controls": "customized-menu", "data-nw": "download-button", "aria-haspopup": "true", variant: variant, color: color, onClick: onClick, fullWidth: true, size: size, endIcon: _jsx(ArrowDropDownIcon, { fontSize: "small" }, void 0), disabled: disabled }, { children: buttonText }), void 0), _jsx(Menu, __assign({ id: "button-menu", anchorEl: anchorEl, keepMounted: true, elevation: 2, anchorOrigin: {
78
+ return (_jsxs(ThemeProvider, __assign({ theme: theme }, { children: [_jsx(Button, __assign({ "aria-controls": "customized-menu", "data-nw": "download-button", "aria-haspopup": "true", variant: variant, color: color, onClick: onClick, fullWidth: true, size: size, endIcon: _jsx(ArrowDropDownIcon, { fontSize: "small" }), disabled: disabled }, { children: buttonText })), _jsx(Menu, __assign({ id: "button-menu", anchorEl: anchorEl, keepMounted: true, elevation: 2, anchorOrigin: {
79
79
  vertical: "bottom",
80
80
  horizontal: "center"
81
81
  }, transformOrigin: {
@@ -98,6 +98,6 @@ function MenuButtonGroup(props) {
98
98
  }
99
99
  });
100
100
  }); } }), buttonText));
101
- }) }), void 0)] }), void 0));
101
+ }) }))] })));
102
102
  }
103
103
  export default MenuButtonGroup;
@@ -1,7 +1,6 @@
1
1
  import { CSSProperties } from "react";
2
2
  import { TextFieldProps } from "@mui/material/TextField";
3
- declare type TextProps = Omit<TextFieldProps, "onChange">;
4
- export interface NumberInputProps {
3
+ export interface NumberInputProps extends Omit<TextFieldProps, "onChange"> {
5
4
  onChange: (value: string) => void;
6
5
  value: string;
7
6
  integerOnly?: boolean;
@@ -11,5 +10,5 @@ export interface NumberInputProps {
11
10
  primaryColor?: CSSProperties["color"];
12
11
  secondaryColor?: CSSProperties["color"];
13
12
  }
14
- declare function NumberInput(props: NumberInputProps & TextProps): JSX.Element;
13
+ declare function NumberInput(props: NumberInputProps): JSX.Element;
15
14
  export default NumberInput;
@@ -36,6 +36,6 @@ function NumberInput(props) {
36
36
  return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Tooltip, __assign({ title: tooltip !== null && tooltip !== void 0 ? tooltip : "", open: !!tooltip && tooltipOpen }, { children: _jsx(Field, __assign({ size: size, margin: "dense", type: "number", value: value === undefined || value === null ? "" : value, onFocus: onOpenTooltip, onBlur: function () {
37
37
  onCloseTooltip();
38
38
  handleBlur();
39
- }, onChange: handleChange, error: error || exceedError, helperText: helperText || (exceedError ? EXCEED_ERROR : "") }, rest), void 0) }), void 0) }), void 0));
39
+ }, onChange: handleChange, error: error || exceedError, helperText: helperText || (exceedError ? EXCEED_ERROR : "") }, rest)) })) })));
40
40
  }
41
41
  export default NumberInput;
@@ -1,12 +1,11 @@
1
1
  import { CSSProperties } from "react";
2
2
  import { TextFieldProps } from "@mui/material/TextField";
3
- declare type TextInputProps = Omit<TextFieldProps, "onChange">;
4
- export interface ConfirmPasswordProps {
3
+ export interface ConfirmPasswordProps extends Omit<TextFieldProps, "onChange"> {
5
4
  password: string;
6
5
  value: string;
7
6
  primaryColor?: CSSProperties["color"];
8
7
  secondaryColor?: CSSProperties["color"];
9
8
  onChange: (value: string) => void;
10
9
  }
11
- declare function ConfirmPassword(props: ConfirmPasswordProps & TextInputProps): JSX.Element;
10
+ declare function ConfirmPassword(props: ConfirmPasswordProps): JSX.Element;
12
11
  export default ConfirmPassword;
@@ -36,6 +36,6 @@ function ConfirmPassword(props) {
36
36
  }, [value, password]);
37
37
  return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(TextField, __assign({ error: !isMatched, label: label, value: value, variant: variant, margin: margin, disabled: disabled, type: "password", size: "small", helperText: !isMatched && helperText, onChange: function (event) {
38
38
  onChange(event.target.value);
39
- }, fullWidth: true, required: true }, rest), void 0) }), void 0));
39
+ }, fullWidth: true, required: true }, rest)) })));
40
40
  }
41
41
  export default ConfirmPassword;
@@ -1,13 +1,12 @@
1
1
  import { CSSProperties } from "react";
2
2
  import { TextFieldProps } from "@mui/material/TextField";
3
- declare type TextInputProps = Omit<TextFieldProps, "onChange">;
4
3
  export interface PasswordStrategyProps {
5
4
  [key: string]: {
6
5
  label: string;
7
6
  regex: RegExp;
8
7
  };
9
8
  }
10
- export interface PasswordProps {
9
+ export interface PasswordProps extends Omit<TextFieldProps, "onChange"> {
11
10
  strategies: PasswordStrategyProps;
12
11
  value: string;
13
12
  successColor?: CSSProperties["color"];
@@ -16,5 +15,5 @@ export interface PasswordProps {
16
15
  onChange: (value: string) => void;
17
16
  onVerify?: (value: string) => boolean;
18
17
  }
19
- declare function Password(props: PasswordProps & TextInputProps): JSX.Element;
18
+ declare function Password(props: PasswordProps): JSX.Element;
20
19
  export default Password;
@@ -67,10 +67,10 @@ function Password(props) {
67
67
  return (_jsx(_Fragment, { children: Object.keys(strategies).map(function (key) {
68
68
  var label = strategies[key].label;
69
69
  return (_jsx(Typography, __assign({ component: "li", variant: "caption", style: { color: helperTextColor[key] } }, { children: label }), key));
70
- }) }, void 0));
70
+ }) }));
71
71
  }, [helperTextColor, strategies]);
72
72
  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) {
73
73
  onChange(event.target.value);
74
- }, fullWidth: true, required: true }, rest), void 0) }), void 0));
74
+ }, fullWidth: true, required: true }, rest)) })));
75
75
  }
76
76
  export default Password;
@@ -1,8 +1,7 @@
1
1
  import { CSSProperties } from "react";
2
2
  import { InputProps } from "@mui/material/Input";
3
3
  import { TextFieldProps } from "@mui/material/TextField";
4
- declare type TextInputProps = Omit<TextFieldProps, "onChange">;
5
- export interface PhoneInputProps {
4
+ export interface PhoneInputProps extends Omit<TextFieldProps, "onChange"> {
6
5
  value: string;
7
6
  endAdornment?: InputProps["endAdornment"];
8
7
  primaryColor?: CSSProperties["color"];
@@ -10,5 +9,5 @@ export interface PhoneInputProps {
10
9
  onChange: (val: string) => void;
11
10
  }
12
11
  export declare function phoneFormat(str: string): string;
13
- declare function PhoneInput(props: TextInputProps & PhoneInputProps): JSX.Element;
12
+ declare function PhoneInput(props: PhoneInputProps): JSX.Element;
14
13
  export default PhoneInput;
@@ -55,8 +55,8 @@ function PhoneInput(props) {
55
55
  format: phoneFormat
56
56
  });
57
57
  return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(TextField, __assign({ value: rifm.value, InputProps: {
58
- startAdornment: (_jsx(InputAdornment, __assign({ position: "start" }, { children: _jsx(Typography, __assign({ variant: "body2" }, { children: "+1" }), void 0) }), void 0)),
58
+ startAdornment: (_jsx(InputAdornment, __assign({ position: "start" }, { children: _jsx(Typography, __assign({ variant: "body2" }, { children: "+1" })) }))),
59
59
  endAdornment: endAdornment
60
- }, onChange: rifm.onChange }, rest), void 0) }), void 0));
60
+ }, onChange: rifm.onChange }, rest)) })));
61
61
  }
62
62
  export default PhoneInput;
package/README.md CHANGED
@@ -12,7 +12,13 @@
12
12
  - [License](#license)
13
13
  - [Components](#components)
14
14
  - [AlertDialog](#alertdialog)
15
+ - [Autocomplete](#autocomplete)
16
+ - [AutocompleteWithFilter](#autocompletewithfilter)
15
17
  - [BasicModal](#basicmodal)
18
+ - [BreadCrumbs](#breadcrumbs)
19
+ - [CheckBox](#checkbox)
20
+ - [CheckBoxGroup](#checkboxgroup)
21
+ - [Copyright](#copyright)
16
22
  - [DigitInput](#digitinput)
17
23
  - [FormRadioGroup](#formradiogroup)
18
24
  - [FormSelector](#formselector)
@@ -23,6 +29,7 @@
23
29
  - [PasswordInput](#passwordinput)
24
30
  - [PhoneNumberInput](#phonenumberinput)
25
31
  - [TabGroup](#tabgroup)
32
+ - [TablePagination](#tablepagination)
26
33
  - [TextInput](#textinput)
27
34
  - [ToastPrompt](#toastprompt)
28
35
  - [VideoPlayerModal](#videoplayermodal)
@@ -50,6 +57,17 @@ This project is licensed under the terms of the [MIT license](https://github.com
50
57
 
51
58
 
52
59
 
60
+ <h2>Common Properties</h2>
61
+
62
+ All components include these 2 properties to customize the theme
63
+
64
+ | Name | Type | Default | Required | Description |
65
+ | -------------- | ---------------------- | ------- | -------- | ----------------------------- |
66
+ | primaryColor | CSSProperties["color"] | | false | Primary color for the theme |
67
+ | secondaryColor | CSSProperties["color"] | | false | Secondary color for the theme |
68
+
69
+
70
+
53
71
  <h2>Components</h2>
54
72
 
55
73
  <h3>AlertDialog</h3>
@@ -77,6 +95,71 @@ import AlertDialog from '@symply.io/basic-components/AlertDialog';
77
95
 
78
96
 
79
97
 
98
+ <h3>Autocomplete</h3>
99
+
100
+ A normal text input enhanced by a panel of suggested options.
101
+
102
+ It is extended from `@mui/material/TextField`, so it includes all properties of `@mui/material/TextField`.
103
+
104
+ <h5>Import</h5>
105
+
106
+ ```typescript
107
+ import { Autocomplete } from '@symply.io/basic-components/';
108
+ // or
109
+ import Autocomplete from '@symply.io/basic-components/Autocomplete';
110
+ ```
111
+
112
+ <h5>Option Props (IOption)</h5>
113
+
114
+ | Name | Type | Default | Required | Description |
115
+ | ------ | ------- | ------- | -------- | -------------------------- |
116
+ | label | string | | true | Option label. |
117
+ | [name] | Unknown | | false | Customized option property |
118
+
119
+ <h5>Props</h5>
120
+
121
+ | Name | Type | Default | Required | Description |
122
+ | -------- | ---------------------- | ------- | -------- | ------------------------------------------------------------ |
123
+ | multiple | bool | false | false | If `true`, `value` must be an array and the menu will support multiple selections. |
124
+ | onChange | func | | true | Callback fired when the `Input` value is changed.<br />**Signature:**<br/>`function(value: Array<IOption|string>|IOption|string|null) => void`<br/>*value:* The value of the `Input` element. |
125
+ | options | Array<IOption\|string> | | true | Array of suggestion options. |
126
+ | value | string | | true | The value of the `Input` element. |
127
+
128
+
129
+
130
+ <h3>AutocompleteWithFilter</h3>
131
+
132
+ A normal text input enhanced by a panel of suggested options and filter.
133
+
134
+ It is extended from `@mui/material/TextField`, so it includes all properties of `@mui/material/TextField`.
135
+
136
+ <h5>Import</h5>
137
+
138
+ ```typescript
139
+ import { AutocompleteWithFilter } from '@symply.io/basic-components/';
140
+ // or
141
+ import AutocompleteWithFilter from '@symply.io/basic-components/AutocompleteWithFilter';
142
+ ```
143
+
144
+ <h5>Option Props (IOption)</h5>
145
+
146
+ | Name | Type | Default | Required | Description |
147
+ | ------ | ------- | ------- | -------- | -------------------------- |
148
+ | label | string | | true | Option label. |
149
+ | [name] | Unknown | | false | Customized option property |
150
+
151
+ <h5>Props</h5>
152
+
153
+ | Name | Type | Default | Required | Description |
154
+ | -------------------- | ---------------------- | ------- | -------- | ------------------------------------------------------------ |
155
+ | disableCloseOnSelect | bool | false | false | If `true`, the popup won't close when a value is selected. |
156
+ | multiple | bool | false | false | If `true`, `value` must be an array and the menu will support multiple selections. |
157
+ | onChange | func | | true | Callback fired when the `Input` value is changed.<br />**Signature:**<br/>`function(value: Array<IOption|string>|IOption|string|null) => void`<br/>*value:* The value of the `Input` element. |
158
+ | options | Array<IOption\|string> | | true | Array of suggestion options. |
159
+ | value | string | | true | The value of the `Input` element. |
160
+
161
+
162
+
80
163
  <h3>BasicModal</h3>
81
164
 
82
165
  Reusable modal component.
@@ -111,6 +194,87 @@ import BasicModal from '@symply.io/basic-components/BasicModal';
111
194
 
112
195
 
113
196
 
197
+ <h3>BreadCrumbs</h3>
198
+
199
+ A list of links that help a user visualize a page's location within the hierarchical structure of a website, and allow navigation up to any of its "ancestors".
200
+
201
+ <h5>Import</h5>
202
+
203
+ ```typescript
204
+ import { BreadCrumbs } from '@symply.io/basic-components/';
205
+ // or
206
+ import BreadCrumbs from '@symply.io/basic-components/BreadCrumbs';
207
+ ```
208
+
209
+ <h5>Props</h5>
210
+
211
+ | Name | Type | Default | Required | Description |
212
+ | ------ | --------------------------------------- | ------- | -------- | ------------------------- |
213
+ | routes | Array<{ href?: string; label: string }> | | true | All routes of "ancestors" |
214
+
215
+
216
+
217
+ <h3>CheckBox</h3>
218
+
219
+ Checkboxes allow the user to select one or more items from a set.
220
+
221
+ It is extended from `@mui/material/Checkbox`, so it includes all properties of `@mui/material/Checkbox`.
222
+
223
+ <h5>Import</h5>
224
+
225
+ ```typescript
226
+ import { CheckBox } from '@symply.io/basic-components/';
227
+ // or
228
+ import { CheckBox } from '@symply.io/basic-components/CheckBox';
229
+ ```
230
+
231
+ <h5>Props</h5>
232
+
233
+ | Name | Type | Default | Required | Description |
234
+ | -------- | ------ | ------- | -------- | ------------------------------------------------------------ |
235
+ | label | string | | true | The label of the checkbox. |
236
+ | onChange | func | | true | Callback fired when the `checkbox` value is changed.<br />**Signature:**<br/>`function(value: boolean) => void`<br/>*value:* The value of the `checkbox` element. |
237
+
238
+
239
+
240
+
241
+
242
+ <h3>CheckBoxGroup</h3>
243
+
244
+ Checkboxes allow the user to select one or more items from a set for a group.
245
+
246
+ It is extended from `@mui/material/FormGroup`, so it includes all properties of `@mui/material/FormGroup`.
247
+
248
+ <h5>Import</h5>
249
+
250
+ ```typescript
251
+ import { CheckBoxGroup } from '@symply.io/basic-components/';
252
+ // or
253
+ import { CheckBoxGroup } from '@symply.io/basic-components/CheckBox';
254
+ ```
255
+
256
+ <h5>Props</h5>
257
+
258
+ | Name | Type | Default | Required | Description |
259
+ | ---------- | ---------------------- | ------- | -------- | ------------------------------------------------------------ |
260
+ | Checkboxes | Array\<CheckBoxProps\> | | true | The array of checkboxes.<br />See the property of [CheckBox](#checkbox) |
261
+
262
+
263
+
264
+ <h3>Copyright</h3>
265
+
266
+ A common component for rendering the copyright
267
+
268
+ <h5>Import</h5>
269
+
270
+ ```typescript
271
+ import { Copyright } from '@symply.io/basic-components/';
272
+ // or
273
+ import Copyright from '@symply.io/basic-components/Copyright';
274
+ ```
275
+
276
+
277
+
114
278
  <h3>DigitInput</h3>
115
279
 
116
280
  Input component for digits.
@@ -165,7 +329,7 @@ import FormRadioGroup from '@symply.io/basic-components/FormRadioGroup';
165
329
  | color | 'primary' \| 'secondary' \| 'success' \| 'error' \| 'info' \| 'warning' | 'primary' | false | The main color of the component. |
166
330
  | disabled | bool | false | false | If `true`, the component is disabled. |
167
331
  | formLabel | string | | false | The label of the `Radio` element. |
168
- | onChange | func | | true | Callback fired when the `Radio` value is changed.<br />**Signature:**<br/>`function(value: string) => void`<br/>*value:* The value of the `Radio` element. |
332
+ | onChange | func | | true | Callback fired when the `Radio` value is changed.<br />**Signature:**<br/>`function(value: string|number|boolean) => void`<br/>*value:* The value of the `Radio` element. |
169
333
  | options | Array\<IRadioOption\> | | true | The radio options. See the **Radio Option Props** above. |
170
334
  | value | string \| number \| bool | | true | The value of the `Radio` element. |
171
335
  | tooltip | string | | false | A tooltip for the `Radio` element. |
@@ -415,6 +579,32 @@ import TabGroup from '@symply.io/basic-components/TabGroup';
415
579
 
416
580
 
417
581
 
582
+ <h3>TablePagination</h3>
583
+
584
+ Reusable pagination component for the material table
585
+
586
+ <h5>Import</h5>
587
+
588
+ ```typescript
589
+ import { TablePagination } from '@symply.io/basic-components/';
590
+ // or
591
+ import TablePagination from '@symply.io/basic-components/TablePagination';
592
+ ```
593
+
594
+ <h5>Props</h5>
595
+
596
+ | Name | Type | Default | Required | Description |
597
+ | ------------------- | --------------- | ------- | -------- | ------------------------------------------------------------ |
598
+ | colSpan | number | | true | The number of columns a cell should span. |
599
+ | count | number | | true | The total count of all data. |
600
+ | onPageChange | func | | true | Callback fired when the `page` value is changed.<br />**Signature:**<br/>`function(event: MouseEvent<HTMLButtonElement> ) => void,value: number`<br/>*value:* The value of the `page` . |
601
+ | onRowsPerPageChange | func | | true | Callback fired when the `Select` value is changed.<br />**Signature:**<br/>`function(event: ChangeEvent<HTMLInputElement ` |
602
+ | page | number | | true | The current page index. |
603
+ | rowsPerPage | number | | true | How many rows per page. |
604
+ | rowsPerPageOptions | Array\<number\> | | true | The options for setting how many rows per page. |
605
+
606
+
607
+
418
608
  <h3>TextInput</h3>
419
609
 
420
610
  Regular Input component.
package/TabGroup/index.js CHANGED
@@ -39,14 +39,14 @@ var TabGroup = forwardRef(function (props, ref) {
39
39
  } }, { children: tabs.map(function (tab, index) {
40
40
  var text = tab.text, _a = tab.disabled, disabled = _a === void 0 ? false : _a;
41
41
  var active = currentTabIndex === index;
42
- return (_jsx(Tab, { disableFocusRipple: true, disableRipple: true, label: _jsx(Typography, __assign({ variant: "body2" }, { children: text }), void 0), disabled: disabled, sx: {
42
+ return (_jsx(Tab, { disableFocusRipple: true, disableRipple: true, label: _jsx(Typography, __assign({ variant: "body2" }, { children: text })), disabled: disabled, sx: {
43
43
  cursor: disabled ? "not-allowed" : "pointer",
44
44
  margin: theme.spacing(0.75, 0.25),
45
45
  background: active ? "#fff" : undefined,
46
46
  borderRadius: active ? theme.spacing(0.5) : undefined,
47
47
  boxShadow: active ? "0px 4px 6px #acc1c2" : undefined
48
48
  } }, index));
49
- }) }), void 0) }), void 0));
49
+ }) })) })));
50
50
  });
51
51
  export default TabGroup;
52
52
  export * from "./types";
@@ -0,0 +1,3 @@
1
+ import { TablePaginationActionsProps } from "./types";
2
+ declare function TablePaginationActions(props: TablePaginationActionsProps): JSX.Element;
3
+ export default TablePaginationActions;
@@ -0,0 +1,27 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import Box from "@mui/material/Box";
14
+ import IconButton from "@mui/material/IconButton";
15
+ import FirstPageIcon from "@mui/icons-material/FirstPage";
16
+ import KeyboardArrowLeft from "@mui/icons-material/KeyboardArrowLeft";
17
+ import KeyboardArrowRight from "@mui/icons-material/KeyboardArrowRight";
18
+ import LastPageIcon from "@mui/icons-material/LastPage";
19
+ import useInteractions from "./useInteractions";
20
+ import useCustomTheme from "../useCustomTheme";
21
+ function TablePaginationActions(props) {
22
+ var count = props.count, page = props.page, rowsPerPage = props.rowsPerPage, onPageChange = props.onPageChange;
23
+ var theme = useCustomTheme();
24
+ var _a = useInteractions({ count: count, page: page, rowsPerPage: rowsPerPage, onPageChange: onPageChange }), onBackButtonClick = _a.onBackButtonClick, onNextButtonClick = _a.onNextButtonClick, onLastPageButtonClick = _a.onLastPageButtonClick, onFirstPageButtonClick = _a.onFirstPageButtonClick;
25
+ return (_jsxs(Box, __assign({ sx: { flexShrink: 0, ml: 2.5 } }, { children: [_jsx(IconButton, __assign({ onClick: onFirstPageButtonClick, disabled: page === 0, "aria-label": "first page" }, { children: theme.direction === "rtl" ? _jsx(LastPageIcon, {}) : _jsx(FirstPageIcon, {}) })), _jsx(IconButton, __assign({ onClick: onBackButtonClick, disabled: page === 0, "aria-label": "previous page" }, { children: theme.direction === "rtl" ? (_jsx(KeyboardArrowRight, {})) : (_jsx(KeyboardArrowLeft, {})) })), _jsx(IconButton, __assign({ onClick: onNextButtonClick, disabled: page >= Math.ceil(count / rowsPerPage) - 1, "aria-label": "next page" }, { children: theme.direction === "rtl" ? (_jsx(KeyboardArrowLeft, {})) : (_jsx(KeyboardArrowRight, {})) })), _jsx(IconButton, __assign({ onClick: onLastPageButtonClick, disabled: page >= Math.ceil(count / rowsPerPage) - 1, "aria-label": "last page" }, { children: theme.direction === "rtl" ? _jsx(FirstPageIcon, {}) : _jsx(LastPageIcon, {}) }))] })));
26
+ }
27
+ export default TablePaginationActions;
@@ -0,0 +1,4 @@
1
+ import { TablePaginationProps } from "./types";
2
+ declare function Pagination(props: TablePaginationProps): JSX.Element;
3
+ export default Pagination;
4
+ export * from "./types";
@@ -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
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import TableRow from "@mui/material/TableRow";
14
+ import TableFooter from "@mui/material/TableFooter";
15
+ import TablePagination from "@mui/material/TablePagination";
16
+ import ThemeProvider from "@mui/material/styles/ThemeProvider";
17
+ import TablePaginationActions from "./Actions";
18
+ import useCustomTheme from "../useCustomTheme";
19
+ function Pagination(props) {
20
+ var colSpan = props.colSpan, count = props.count, page = props.page, rowsPerPage = props.rowsPerPage, _a = props.rowsPerPageOptions, rowsPerPageOptions = _a === void 0 ? [5, 10, 20, 30] : _a, onPageChange = props.onPageChange, onRowsPerPageChange = props.onRowsPerPageChange, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor;
21
+ var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
22
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: count && (_jsx(TableFooter, { children: _jsx(TableRow, { children: _jsx(TablePagination, { colSpan: colSpan, count: count, rowsPerPage: rowsPerPage, page: page, SelectProps: {
23
+ inputProps: {
24
+ "aria-label": "rows per page",
25
+ },
26
+ native: true,
27
+ }, rowsPerPageOptions: rowsPerPageOptions, onPageChange: onPageChange, onRowsPerPageChange: onRowsPerPageChange, ActionsComponent: TablePaginationActions }) }) })) })));
28
+ }
29
+ export default Pagination;
30
+ export * from "./types";
@@ -0,0 +1,14 @@
1
+ import { MouseEvent, ChangeEvent, CSSProperties } from "react";
2
+ export interface TablePaginationActionsProps {
3
+ count: number;
4
+ page: number;
5
+ rowsPerPage: number;
6
+ onPageChange: (event: MouseEvent<HTMLButtonElement> | null, newPage: number) => void;
7
+ }
8
+ export interface TablePaginationProps extends TablePaginationActionsProps {
9
+ colSpan: number;
10
+ rowsPerPageOptions?: Array<number>;
11
+ onRowsPerPageChange: (event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
12
+ primaryColor?: CSSProperties["color"];
13
+ secondaryColor?: CSSProperties["color"];
14
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ import { MouseEvent } from "react";
2
+ interface InteractionProps {
3
+ count: number;
4
+ page: number;
5
+ rowsPerPage: number;
6
+ onPageChange: (event: MouseEvent<HTMLButtonElement> | null, newPage: number) => void;
7
+ }
8
+ declare function useInteractions(props: InteractionProps): {
9
+ onBackButtonClick: (event: MouseEvent<HTMLButtonElement>) => void;
10
+ onNextButtonClick: (event: MouseEvent<HTMLButtonElement>) => void;
11
+ onLastPageButtonClick: (event: MouseEvent<HTMLButtonElement>) => void;
12
+ onFirstPageButtonClick: (event: MouseEvent<HTMLButtonElement>) => void;
13
+ };
14
+ export default useInteractions;
@@ -0,0 +1,23 @@
1
+ import { useCallback } from "react";
2
+ function useInteractions(props) {
3
+ var count = props.count, page = props.page, rowsPerPage = props.rowsPerPage, onPageChange = props.onPageChange;
4
+ var onFirstPageButtonClick = useCallback(function (event) {
5
+ onPageChange(event, 0);
6
+ }, [onPageChange]);
7
+ var onBackButtonClick = useCallback(function (event) {
8
+ onPageChange(event, page - 1);
9
+ }, [onPageChange, page]);
10
+ var onNextButtonClick = useCallback(function (event) {
11
+ onPageChange(event, page + 1);
12
+ }, [onPageChange, page]);
13
+ var onLastPageButtonClick = useCallback(function (event) {
14
+ onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1));
15
+ }, [count, onPageChange, rowsPerPage]);
16
+ return {
17
+ onBackButtonClick: onBackButtonClick,
18
+ onNextButtonClick: onNextButtonClick,
19
+ onLastPageButtonClick: onLastPageButtonClick,
20
+ onFirstPageButtonClick: onFirstPageButtonClick,
21
+ };
22
+ }
23
+ export default useInteractions;