@symply.io/basic-components 1.0.0-alpha.6 → 1.0.0-alpha.9

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 (56) hide show
  1. package/AlertDialog/index.d.ts +3 -2
  2. package/AlertDialog/index.js +10 -10
  3. package/AlertDialog/types.d.ts +3 -1
  4. package/BasicModal/index.d.ts +3 -2
  5. package/BasicModal/index.js +19 -19
  6. package/BasicModal/types.d.ts +3 -1
  7. package/DigitInput/index.d.ts +5 -2
  8. package/DigitInput/index.js +8 -6
  9. package/DigitInput/types.d.ts +3 -0
  10. package/DynamicHeaderBar/HeaderBar.d.ts +4 -2
  11. package/DynamicHeaderBar/HeaderBar.js +8 -8
  12. package/DynamicHeaderBar/HeaderButtons.d.ts +2 -2
  13. package/DynamicHeaderBar/HeaderButtons.js +21 -21
  14. package/DynamicHeaderBar/HeaderLine.d.ts +6 -3
  15. package/DynamicHeaderBar/HeaderLine.js +3 -4
  16. package/FormRadioGroup/index.d.ts +3 -2
  17. package/FormRadioGroup/index.js +16 -14
  18. package/FormRadioGroup/types.d.ts +3 -0
  19. package/FormSelector/MultipleSelector.d.ts +4 -2
  20. package/FormSelector/MultipleSelector.js +26 -13
  21. package/FormSelector/SimpleSelector.d.ts +4 -2
  22. package/FormSelector/SimpleSelector.js +26 -13
  23. package/FormSelector/types.d.ts +5 -7
  24. package/HelpCaption/index.d.ts +5 -3
  25. package/HelpCaption/index.js +16 -16
  26. package/LoadingModal/index.d.ts +3 -2
  27. package/LoadingModal/index.js +9 -7
  28. package/LoadingModal/types.d.ts +3 -0
  29. package/MenuButtonGroup/MenuItem.d.ts +2 -2
  30. package/MenuButtonGroup/MenuItem.js +5 -3
  31. package/MenuButtonGroup/index.d.ts +5 -3
  32. package/MenuButtonGroup/index.js +8 -6
  33. package/NumberInput/index.d.ts +7 -3
  34. package/NumberInput/index.js +9 -7
  35. package/PasswordInput/ConfirmPassword.d.ts +7 -3
  36. package/PasswordInput/ConfirmPassword.js +8 -6
  37. package/PasswordInput/Password.d.ts +6 -2
  38. package/PasswordInput/Password.js +10 -8
  39. package/PhoneNumberInput/index.d.ts +7 -3
  40. package/PhoneNumberInput/index.js +9 -7
  41. package/README.md +10 -12
  42. package/TabGroup/index.d.ts +3 -2
  43. package/TabGroup/index.js +19 -19
  44. package/TabGroup/types.d.ts +3 -0
  45. package/TextInput/index.d.ts +6 -3
  46. package/TextInput/index.js +9 -7
  47. package/ToastPrompt/Presentation.d.ts +16 -3
  48. package/ToastPrompt/Presentation.js +21 -21
  49. package/VideoPlayerModal/index.d.ts +4 -2
  50. package/VideoPlayerModal/index.js +9 -9
  51. package/VideoPlayerModal/types.d.ts +3 -0
  52. package/package.json +2 -1
  53. package/useCustomTheme.d.ts +6 -0
  54. package/useCustomTheme.js +51 -0
  55. package/withTheme.d.ts +0 -3
  56. package/withTheme.js +0 -35
@@ -22,7 +22,7 @@ var __rest = (this && this.__rest) || function (s, e) {
22
22
  };
23
23
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
24
  import Typography from "@mui/material/Typography";
25
- import useTheme from "@mui/material/styles/useTheme";
25
+ import ThemeProvider from "@mui/material/styles/ThemeProvider";
26
26
  import Slide from "@mui/material/Slide";
27
27
  import SnackbarContent from "@mui/material/SnackbarContent";
28
28
  import Snackbar from "@mui/material/Snackbar";
@@ -31,11 +31,11 @@ import ErrorIcon from "@mui/icons-material/Error";
31
31
  import WarningIcon from "@mui/icons-material/Warning";
32
32
  import SuccessIcon from "@mui/icons-material/CheckCircle";
33
33
  import { green, amber, red, blue } from "@mui/material/colors";
34
- import withTheme from "../withTheme";
34
+ import useCustomTheme from "../useCustomTheme";
35
35
  var ToastPrompt = function (props) {
36
36
  var _a;
37
37
  var _b = props.open, open = _b === void 0 ? false : _b, _c = props.vertical, vertical = _c === void 0 ? "top" : _c, _d = props.horizontal, horizontal = _d === void 0 ? "center" : _d, _e = props.timeout, timeout = _e === void 0 ? 3000 : _e, onClose = props.onClose, _f = props.transitionDirection, transitionDirection = _f === void 0 ? "down" : _f, _g = props.message, message = _g === void 0 ? "Unknown message" : _g, _h = props.icon, icon = _h === void 0 ? _jsx(_Fragment, {}, void 0) : _h, _j = props.variant, variant = _j === void 0 ? "info" : _j, other = __rest(props, ["open", "vertical", "horizontal", "timeout", "onClose", "transitionDirection", "message", "icon", "variant"]);
38
- var theme = useTheme();
38
+ var theme = useCustomTheme();
39
39
  var styles = {
40
40
  success: {
41
41
  backgroundColor: green[600]
@@ -60,22 +60,22 @@ var ToastPrompt = function (props) {
60
60
  info: InfoIcon
61
61
  };
62
62
  var Icon = VariantIcon[variant];
63
- return (_jsx(Snackbar, __assign({ anchorOrigin: { vertical: vertical, horizontal: horizontal }, open: open, onClose: onClose, autoHideDuration: timeout, TransitionComponent: Transition, sx: {
64
- zIndex: 99999,
65
- marginTop: "3vh"
66
- } }, { children: _jsx(SnackbarContent, __assign({ sx: __assign(__assign({}, styles[variant]), { root: (_a = {},
67
- _a[theme.breakpoints.down("sm")] = {
68
- maxWidth: "320px",
69
- borderRadius: "4px"
70
- },
71
- _a) }), "aria-describedby": "Toast", message: _jsxs(Typography, __assign({ id: "Toast", component: "span", sx: {
72
- fontSize: 14,
73
- display: "flex",
74
- alignItems: "center"
75
- } }, { children: [variant ? (_jsx(Icon, { sx: {
76
- fontSize: 20,
77
- opacity: 0.9,
78
- marginRight: theme.spacing(1)
79
- } }, void 0)) : (_jsx(_Fragment, { children: icon }, void 0)), message] }), void 0) }, other), void 0) }), "".concat(Date.now() * Math.round(Math.random()))));
63
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Snackbar, __assign({ anchorOrigin: { vertical: vertical, horizontal: horizontal }, open: open, onClose: onClose, autoHideDuration: timeout, TransitionComponent: Transition, sx: {
64
+ zIndex: 99999,
65
+ marginTop: "3vh"
66
+ } }, { children: _jsx(SnackbarContent, __assign({ sx: __assign(__assign({}, styles[variant]), { root: (_a = {},
67
+ _a[theme.breakpoints.down("sm")] = {
68
+ maxWidth: "320px",
69
+ borderRadius: "4px"
70
+ },
71
+ _a) }), "aria-describedby": "Toast", message: _jsxs(Typography, __assign({ id: "Toast", component: "span", sx: {
72
+ fontSize: 14,
73
+ display: "flex",
74
+ alignItems: "center"
75
+ } }, { children: [variant ? (_jsx(Icon, { sx: {
76
+ fontSize: 20,
77
+ opacity: 0.9,
78
+ marginRight: theme.spacing(1)
79
+ } }, void 0)) : (_jsx(_Fragment, { children: icon }, void 0)), message] }), void 0) }, other), void 0) }), "".concat(Date.now() * Math.round(Math.random()))) }), void 0));
80
80
  };
81
- export default withTheme(ToastPrompt);
81
+ export default ToastPrompt;
@@ -1,4 +1,6 @@
1
1
  /// <reference types="react" />
2
- declare const _default: (props: any) => JSX.Element;
3
- export default _default;
2
+ import { ReactPlayerProps } from "react-player";
3
+ import { VideoPlayerModalProps } from "./types";
4
+ declare function VideoPlayerModal(props: VideoPlayerModalProps & ReactPlayerProps): JSX.Element;
5
+ export default VideoPlayerModal;
4
6
  export * from "./types";
@@ -20,7 +20,7 @@ var __rest = (this && this.__rest) || function (s, e) {
20
20
  }
21
21
  return t;
22
22
  };
23
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
23
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
24
  import ReactPlayer from "react-player";
25
25
  import Grid from "@mui/material/Grid";
26
26
  import Dialog from "@mui/material/Dialog";
@@ -28,16 +28,16 @@ import DialogTitle from "@mui/material/DialogTitle";
28
28
  import DialogContent from "@mui/material/DialogContent";
29
29
  import DialogActions from "@mui/material/DialogActions";
30
30
  import Button from "@mui/material/Button";
31
- import useTheme from "@mui/material/styles/useTheme";
32
31
  import useMediaQuery from "@mui/material/useMediaQuery";
33
- import withTheme from '../withTheme';
32
+ import ThemeProvider from "@mui/material/styles/ThemeProvider";
33
+ import useCustomTheme from "../useCustomTheme";
34
34
  function VideoPlayerModal(props) {
35
- var url = props.url, _a = props.pip, pip = _a === void 0 ? false : _a, _b = props.open, open = _b === void 0 ? false : _b, title = props.title, onClose = props.onClose, _c = props.extraButtons, extraButtons = _c === void 0 ? [] : _c, playerProps = __rest(props, ["url", "pip", "open", "title", "onClose", "extraButtons"]);
36
- var theme = useTheme();
35
+ var url = props.url, _a = props.pip, pip = _a === void 0 ? false : _a, _b = props.open, open = _b === void 0 ? false : _b, title = props.title, onClose = props.onClose, _c = props.extraButtons, extraButtons = _c === void 0 ? [] : _c, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, playerProps = __rest(props, ["url", "pip", "open", "title", "onClose", "extraButtons", "primaryColor", "secondaryColor"]);
36
+ var theme = useCustomTheme();
37
37
  var fullScreen = useMediaQuery(theme.breakpoints.down("sm"));
38
- return (_jsx(_Fragment, { children: _jsxs(Dialog, __assign({ open: open, fullScreen: fullScreen, onClose: onClose, fullWidth: true, maxWidth: "lg", "aria-labelledby": "react-video-dialog" }, { children: [title && _jsx(DialogTitle, { children: title }, void 0), _jsx(DialogContent, { children: _jsx(ReactPlayer, __assign({ controls: true, url: url, style: { minHeight: "480px" }, width: "100%", config: {
39
- file: { attributes: { disablePictureInPicture: !pip } },
40
- } }, playerProps), void 0) }, void 0), _jsxs(DialogActions, { children: [extraButtons.map(function (buttonProps, index) { return (_jsx(Grid, __assign({ item: true, xs: 12, md: 3, lg: 2 }, { children: _jsx(Button, __assign({}, buttonProps), void 0) }), "extraButton_".concat(index))); }), _jsx(Button, __assign({ variant: "outlined", color: "secondary", onClick: onClose }, { children: "Close" }), void 0)] }, void 0)] }), void 0) }, void 0));
38
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsxs(Dialog, __assign({ open: open, fullScreen: fullScreen, onClose: onClose, fullWidth: true, maxWidth: "lg", "aria-labelledby": "react-video-dialog" }, { children: [title && _jsx(DialogTitle, { children: title }, void 0), _jsx(DialogContent, { children: _jsx(ReactPlayer, __assign({ controls: true, url: url, style: { minHeight: "480px" }, width: "100%", config: {
39
+ file: { attributes: { disablePictureInPicture: !pip } }
40
+ } }, playerProps), void 0) }, void 0), _jsxs(DialogActions, { children: [extraButtons.map(function (buttonProps, index) { return (_jsx(Grid, __assign({ item: true, xs: 12, md: 3, lg: 2 }, { children: _jsx(Button, __assign({}, buttonProps), void 0) }), "extraButton_".concat(index))); }), _jsx(Button, __assign({ variant: "outlined", color: "secondary", onClick: onClose }, { children: "Close" }), void 0)] }, void 0)] }), void 0) }), void 0));
41
41
  }
42
- export default withTheme(VideoPlayerModal);
42
+ export default VideoPlayerModal;
43
43
  export * from "./types";
@@ -1,8 +1,11 @@
1
+ import { CSSProperties } from "react";
1
2
  import { ButtonProps } from "@mui/material/Button";
2
3
  export interface VideoPlayerModalProps {
3
4
  title?: string;
4
5
  open: boolean;
5
6
  pip?: boolean;
6
7
  extraButtons?: Array<ButtonProps>;
8
+ primaryColor?: CSSProperties["color"];
9
+ secondaryColor?: CSSProperties["color"];
7
10
  onClose: () => void;
8
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symply.io/basic-components",
3
- "version": "1.0.0-alpha.6",
3
+ "version": "1.0.0-alpha.9",
4
4
  "description": "Basic and reusable components for all frontend of Symply apps",
5
5
  "keywords": [
6
6
  "react",
@@ -55,6 +55,7 @@
55
55
  "@mui/icons-material": "^5.4.2",
56
56
  "@mui/material": "^5.4.2",
57
57
  "@mui/system": "^5.4.2",
58
+ "color-alpha": "^1.1.3",
58
59
  "react-player": "^2.9.0",
59
60
  "rifm": "^0.12.1"
60
61
  },
@@ -0,0 +1,6 @@
1
+ import { CSSProperties } from "react";
2
+ declare function useCustomTheme(props?: {
3
+ primaryColor?: CSSProperties["color"];
4
+ secondaryColor?: CSSProperties["color"];
5
+ }): import("@mui/material/styles").Theme;
6
+ export default useCustomTheme;
@@ -0,0 +1,51 @@
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 colorAlpha from "color-alpha";
13
+ import { createTheme } from "@mui/material/styles";
14
+ function useCustomTheme(props) {
15
+ var _a = props || {}, primaryColor = _a.primaryColor, secondaryColor = _a.secondaryColor;
16
+ var themeOptions = {
17
+ components: {
18
+ MuiButton: {
19
+ styleOverrides: {
20
+ root: {
21
+ whiteSpace: "nowrap",
22
+ fontWeight: 600,
23
+ fontFamily: "Dinpro"
24
+ }
25
+ }
26
+ }
27
+ },
28
+ typography: {
29
+ fontFamily: "Dinpro"
30
+ }
31
+ };
32
+ if (primaryColor) {
33
+ themeOptions = __assign(__assign({}, themeOptions), { palette: {
34
+ primary: {
35
+ main: primaryColor,
36
+ light: colorAlpha(primaryColor, 0.08)
37
+ }
38
+ } });
39
+ }
40
+ if (secondaryColor) {
41
+ themeOptions = __assign(__assign({}, themeOptions), { palette: {
42
+ secondary: {
43
+ main: secondaryColor,
44
+ light: colorAlpha(secondaryColor, 0.08)
45
+ }
46
+ } });
47
+ }
48
+ var theme = createTheme(themeOptions);
49
+ return theme;
50
+ }
51
+ export default useCustomTheme;
package/withTheme.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- declare const withTheme: (Component: React.ElementType) => (props: any) => JSX.Element;
3
- export default withTheme;
package/withTheme.js DELETED
@@ -1,35 +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
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { createTheme, ThemeProvider } from '@mui/material/styles';
14
- import CssBaseline from '@mui/material/CssBaseline';
15
- var theme = createTheme({
16
- components: {
17
- MuiButton: {
18
- styleOverrides: {
19
- root: {
20
- whiteSpace: 'nowrap',
21
- fontWeight: 600,
22
- fontFamily: 'Dinpro'
23
- }
24
- }
25
- }
26
- },
27
- typography: {
28
- fontFamily: 'Dinpro'
29
- }
30
- });
31
- var withTheme = function (Component) {
32
- var CustomComponent = function (props) { return (_jsxs(ThemeProvider, __assign({ theme: theme }, { children: [_jsx(CssBaseline, {}, void 0), _jsx(Component, __assign({}, props), void 0)] }), void 0)); };
33
- return CustomComponent;
34
- };
35
- export default withTheme;