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

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 (48) hide show
  1. package/AlertDialog/index.d.ts +2 -3
  2. package/AlertDialog/index.js +2 -1
  3. package/BasicModal/index.d.ts +2 -3
  4. package/BasicModal/index.js +3 -2
  5. package/DigitInput/index.d.ts +2 -5
  6. package/DigitInput/index.js +3 -2
  7. package/DynamicHeaderBar/HeaderBar.d.ts +2 -2
  8. package/DynamicHeaderBar/HeaderBar.js +2 -1
  9. package/DynamicHeaderBar/HeaderButtons.d.ts +2 -2
  10. package/DynamicHeaderBar/HeaderButtons.js +2 -1
  11. package/DynamicHeaderBar/HeaderLine.d.ts +3 -6
  12. package/DynamicHeaderBar/HeaderLine.js +3 -2
  13. package/FormRadioGroup/index.d.ts +2 -3
  14. package/FormRadioGroup/index.js +4 -3
  15. package/FormSelector/MultipleSelector.d.ts +2 -3
  16. package/FormSelector/MultipleSelector.js +3 -2
  17. package/FormSelector/SimpleSelector.d.ts +2 -3
  18. package/FormSelector/SimpleSelector.js +3 -2
  19. package/HelpCaption/index.d.ts +2 -2
  20. package/HelpCaption/index.js +4 -3
  21. package/LoadingModal/index.d.ts +2 -3
  22. package/LoadingModal/index.js +2 -1
  23. package/MenuButtonGroup/MenuItem.d.ts +1 -2
  24. package/MenuButtonGroup/MenuItem.js +2 -2
  25. package/MenuButtonGroup/index.d.ts +2 -2
  26. package/MenuButtonGroup/index.js +4 -3
  27. package/NumberInput/index.d.ts +2 -4
  28. package/NumberInput/index.js +2 -1
  29. package/PasswordInput/ConfirmPassword.d.ts +2 -4
  30. package/PasswordInput/ConfirmPassword.js +5 -4
  31. package/PasswordInput/Password.d.ts +2 -4
  32. package/PasswordInput/Password.js +10 -4
  33. package/PhoneNumberInput/index.d.ts +3 -4
  34. package/PhoneNumberInput/index.js +20 -4
  35. package/PhoneNumberInput/useInteractions.d.ts +0 -1
  36. package/PhoneNumberInput/useInteractions.js +1 -14
  37. package/README.md +31 -30
  38. package/TabGroup/index.d.ts +2 -3
  39. package/TabGroup/index.js +4 -3
  40. package/TextInput/index.d.ts +2 -3
  41. package/TextInput/index.js +2 -1
  42. package/ToastPrompt/Presentation.d.ts +3 -16
  43. package/ToastPrompt/Presentation.js +12 -11
  44. package/VideoPlayerModal/index.d.ts +2 -4
  45. package/VideoPlayerModal/index.js +2 -1
  46. package/package.json +1 -1
  47. package/withTheme.d.ts +3 -0
  48. package/withTheme.js +35 -0
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- import { AlertDialogProps } from "./types";
3
- declare const AlertDialog: (props: AlertDialogProps) => JSX.Element;
4
- export default AlertDialog;
2
+ declare const _default: (props: any) => JSX.Element;
3
+ export default _default;
5
4
  export * from "./types";
@@ -30,6 +30,7 @@ import DialogActions from "@mui/material/DialogActions";
30
30
  import DialogContent from "@mui/material/DialogContent";
31
31
  import useMediaQuery from "@mui/material/useMediaQuery";
32
32
  import Slide from "@mui/material/Slide";
33
+ import withTheme from "../withTheme";
33
34
  var Transition = forwardRef(function Transition(props, ref) {
34
35
  return _jsx(Slide, __assign({ direction: "up" }, props, { ref: ref }), void 0);
35
36
  });
@@ -43,5 +44,5 @@ var AlertDialog = function (props) {
43
44
  }
44
45
  }, "aria-labelledby": "alert-dialog-title", "aria-describedby": "alert-dialog-description" }, rest, { children: [_jsx(DialogTitle, __assign({ id: "alert-dialog-title" }, { children: title }), void 0), _jsx(DialogContent, { children: children }, void 0), _jsx(DialogActions, { children: DialogButtons ? (cloneElement(DialogButtons)) : (_jsx(Button, __assign({ onClick: onClose, color: "primary" }, { children: "OK" }), void 0)) }, void 0)] }), void 0));
45
46
  };
46
- export default AlertDialog;
47
+ export default withTheme(AlertDialog);
47
48
  export * from "./types";
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- import { BasicModalProps } from "./types";
3
- declare function BasicModal(props: BasicModalProps): JSX.Element;
4
- export default BasicModal;
2
+ declare const _default: (props: any) => JSX.Element;
3
+ export default _default;
5
4
  export * from "./types";
@@ -28,6 +28,7 @@ import Slide from "@mui/material/Slide";
28
28
  import useMediaQuery from "@mui/material/useMediaQuery";
29
29
  import useTheme from "@mui/material/styles/useTheme";
30
30
  import Content from "./Content";
31
+ import withTheme from "../withTheme";
31
32
  var Transition = forwardRef(function Transition(props, ref) {
32
33
  return _jsx(Slide, __assign({ direction: "up" }, props, { ref: ref }), void 0);
33
34
  });
@@ -41,7 +42,7 @@ function BasicModal(props) {
41
42
  }
42
43
  }, maxWidth: maxWidth, fullWidth: true, TransitionComponent: Transition, "aria-labelledby": "form-dialog-title", fullScreen: fullScreen, disableEscapeKeyDown: true }, { children: _jsx(Grid, __assign({ container: true, direction: "column", sx: {
43
44
  height: "100%",
44
- overflowY: "hidden",
45
+ overflowY: "hidden"
45
46
  }, component: noForm ? "div" : "form", onSubmit: noForm
46
47
  ? undefined
47
48
  : function (e) {
@@ -50,5 +51,5 @@ function BasicModal(props) {
50
51
  onSubmit();
51
52
  } }, { children: _jsx(Content, __assign({}, rest, { noForm: noForm, onClose: onClose, onSubmit: onSubmit }), void 0) }), void 0) }), void 0));
52
53
  }
53
- export default BasicModal;
54
+ export default withTheme(BasicModal);
54
55
  export * from "./types";
@@ -1,7 +1,4 @@
1
1
  /// <reference types="react" />
2
- import { TextFieldProps } from "@mui/material/TextField";
3
- import { DigitInputProps } from "./types";
4
- declare type TextProps = Omit<TextFieldProps, "onChange">;
5
- declare function DigitInput(props: DigitInputProps & TextProps): JSX.Element;
6
- export default DigitInput;
2
+ declare const _default: (props: any) => JSX.Element;
3
+ export default _default;
7
4
  export * from "./types";
@@ -24,12 +24,13 @@ import { jsx as _jsx } from "react/jsx-runtime";
24
24
  import Tooltip from "@mui/material/Tooltip";
25
25
  import Field from "@mui/material/TextField";
26
26
  import useInteractions from "./useInteractions";
27
+ import withTheme from "../withTheme";
27
28
  function DigitInput(props) {
28
29
  var onChange = props.onChange, value = props.value, _a = props.size, size = _a === void 0 ? "small" : _a, tooltip = props.tooltip, error = props.error, helperText = props.helperText, _b = props.maxLength, maxLength = _b === void 0 ? 999 : _b, _c = props.minLength, minLength = _c === void 0 ? 0 : _c, endAdornment = props.endAdornment, rest = __rest(props, ["onChange", "value", "size", "tooltip", "error", "helperText", "maxLength", "minLength", "endAdornment"]);
29
30
  var _d = useInteractions({ onChange: onChange }), tooltipOpen = _d.tooltipOpen, handleChange = _d.handleChange, onOpenTooltip = _d.onOpenTooltip, onCloseTooltip = _d.onCloseTooltip;
30
31
  return (_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: onCloseTooltip, inputProps: { maxLength: maxLength, minLength: minLength }, InputProps: {
31
- endAdornment: endAdornment,
32
+ endAdornment: endAdornment
32
33
  }, onChange: handleChange }, rest), void 0) }), void 0));
33
34
  }
34
- export default DigitInput;
35
+ export default withTheme(DigitInput);
35
36
  export * from "./types";
@@ -9,5 +9,5 @@ export interface HeaderBarProps {
9
9
  showBackButton?: boolean;
10
10
  onBack?: () => void;
11
11
  }
12
- declare function HeaderBar(props: HeaderBarProps): JSX.Element;
13
- export default HeaderBar;
12
+ declare const _default: (props: any) => JSX.Element;
13
+ export default _default;
@@ -19,6 +19,7 @@ import IconButton from "@mui/material/IconButton";
19
19
  import ArrowBackIcon from "@mui/icons-material/ArrowBack";
20
20
  import HeaderLine from "./HeaderLine";
21
21
  import HeaderButtons from "./HeaderButtons";
22
+ import withTheme from "../withTheme";
22
23
  function HeaderBar(props) {
23
24
  var title = props.title, color = props.color, subtitle = props.subtitle, bottomEl = props.bottomEl, _a = props.buttons, buttons = _a === void 0 ? [] : _a, showBackButton = props.showBackButton, onBack = props.onBack;
24
25
  var theme = useTheme();
@@ -28,4 +29,4 @@ function HeaderBar(props) {
28
29
  onBack ? onBack() : window.history.back();
29
30
  } }, { children: _jsx(ArrowBackIcon, { fontSize: "small" }, void 0) }), void 0)), _jsx(Typography, __assign({ align: "left", variant: isLessThanSm ? "h6" : "h3", sx: { fontWeight: 600 } }, { children: title }), void 0)] }), void 0) }), void 0), hasButtons ? (_jsx(Grid, __assign({ item: true, xs: 12, sm: 6, md: 7, lg: 8, xl: 9 }, { children: _jsx(HeaderButtons, { buttons: buttons }, void 0) }), void 0)) : (_jsx(_Fragment, {}, void 0))] }), void 0), _jsx(Grid, __assign({ container: true, direction: "row" }, { children: _jsx(Grid, __assign({ item: true, xs: 12, sx: { mt: 1 } }, { children: _jsx(HeaderLine, { color: color }, void 0) }), void 0) }), void 0), subtitle && (_jsx(Grid, __assign({ container: true, direction: "row" }, { children: _jsx(Grid, __assign({ item: true, xs: 12, sx: { mt: 1 } }, { children: typeof subtitle === "string" ? (_jsx(Typography, { children: subtitle }, void 0)) : (cloneElement(subtitle)) }), void 0) }), void 0)), bottomEl && (_jsx(Grid, __assign({ container: true, direction: "row" }, { children: _jsx(Grid, __assign({ item: true, xs: 12, sx: { mt: 1 } }, { children: cloneElement(bottomEl) }), void 0) }), void 0))] }), void 0));
30
31
  }
31
- export default HeaderBar;
32
+ export default withTheme(HeaderBar);
@@ -3,5 +3,5 @@ import { HeaderButtonProps } from "./types";
3
3
  export interface HeaderButtonsProps {
4
4
  buttons: Array<HeaderButtonProps>;
5
5
  }
6
- declare function HeaderButtons(props: HeaderButtonsProps): JSX.Element;
7
- export default HeaderButtons;
6
+ declare const _default: (props: any) => JSX.Element;
7
+ export default _default;
@@ -17,6 +17,7 @@ import useMediaQuery from "@mui/material/useMediaQuery";
17
17
  import useTheme from "@mui/material/styles/useTheme";
18
18
  import MenuButtonGroup from "../MenuButtonGroup";
19
19
  import { HeaderButtonCategory } from "./types";
20
+ import withTheme from "../withTheme";
20
21
  function HeaderButtons(props) {
21
22
  var buttons = props.buttons;
22
23
  var theme = useTheme();
@@ -40,4 +41,4 @@ function HeaderButtons(props) {
40
41
  }
41
42
  }) }), void 0));
42
43
  }
43
- export default HeaderButtons;
44
+ export default withTheme(HeaderButtons);
@@ -1,6 +1,3 @@
1
- import { CSSProperties } from "react";
2
- interface HeaderLineProps {
3
- color?: CSSProperties["color"];
4
- }
5
- declare function HeaderLine(props: HeaderLineProps): JSX.Element;
6
- export default HeaderLine;
1
+ /// <reference types="react" />
2
+ declare const _default: (props: any) => JSX.Element;
3
+ export default _default;
@@ -1,12 +1,13 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import Divider from "@mui/material/Divider";
3
3
  import useTheme from "@mui/material/styles/useTheme";
4
+ import withTheme from "../withTheme";
4
5
  function HeaderLine(props) {
5
6
  var color = props.color;
6
7
  var theme = useTheme();
7
8
  return (_jsx(Divider, { sx: {
8
9
  height: "3px",
9
- backgroundColor: color || theme.palette.primary.main,
10
+ backgroundColor: color || theme.palette.primary.main
10
11
  } }, void 0));
11
12
  }
12
- export default HeaderLine;
13
+ export default withTheme(HeaderLine);
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- import { FormRadioGroupProps } from "./types";
3
- declare function FormRadioGroup(props: FormRadioGroupProps): JSX.Element;
4
- export default FormRadioGroup;
2
+ declare const _default: (props: any) => JSX.Element;
3
+ export default _default;
5
4
  export * from "./types";
@@ -17,6 +17,7 @@ import Typography from "@mui/material/Typography";
17
17
  import RadioGroup from "@mui/material/RadioGroup";
18
18
  import FormControl from "@mui/material/FormControl";
19
19
  import FormControlLabel from "@mui/material/FormControlLabel";
20
+ import withTheme from "../withTheme";
20
21
  function FormRadioGroup(props) {
21
22
  var formLabel = props.formLabel, color = props.color, value = props.value, options = props.options, disabled = props.disabled, tooltip = props.tooltip, onChange = props.onChange;
22
23
  return (_jsxs(FormControl, __assign({ sx: { mt: 3 }, component: "fieldset", disabled: disabled }, { children: [tooltip ? (_jsx(Tooltip, __assign({ title: tooltip, placement: "right", disableTouchListener: true }, { children: _jsx(FormLabel, __assign({ sx: { lineHeight: "24px" }, component: "legend" }, { children: formLabel }), void 0) }), void 0)) : (_jsx(FormLabel, __assign({ sx: { lineHeight: "24px" }, component: "legend" }, { children: formLabel }), void 0)), _jsx(RadioGroup, __assign({ value: value, onChange: function (event) {
@@ -24,12 +25,12 @@ function FormRadioGroup(props) {
24
25
  }, sx: {
25
26
  my: 1,
26
27
  "& label span:first-child span:first-child": {
27
- margin: "-5px 0 -5px 0",
28
- },
28
+ margin: "-5px 0 -5px 0"
29
+ }
29
30
  } }, { children: options.map(function (opt) {
30
31
  var _a;
31
32
  return (_jsx(FormControlLabel, { value: opt.value, control: _jsx(Radio, { color: color || "primary" }, void 0), label: _jsx(Typography, { children: opt.label }, void 0), disabled: ((_a = opt.disabled) !== null && _a !== void 0 ? _a : false) || disabled }, String(opt.value)));
32
33
  }) }), void 0)] }), void 0));
33
34
  }
34
- export default FormRadioGroup;
35
+ export default withTheme(FormRadioGroup);
35
36
  export * from "./types";
@@ -1,4 +1,3 @@
1
1
  /// <reference types="react" />
2
- import { MultipleSelectorProps } from "./types";
3
- declare function MultipleSelector(props: MultipleSelectorProps): JSX.Element;
4
- export default MultipleSelector;
2
+ declare const _default: (props: any) => JSX.Element;
3
+ export default _default;
@@ -17,6 +17,7 @@ import InputLabel from "@mui/material/InputLabel";
17
17
  import FormControl from "@mui/material/FormControl";
18
18
  import FormHelperText from "@mui/material/FormHelperText";
19
19
  import useInteractions from "./useInteractions";
20
+ import withTheme from "../withTheme";
20
21
  function MultipleSelector(props) {
21
22
  var name = props.name, 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.multiple, multiple = _c === void 0 ? false : _c, _d = props.showHelperText, showHelperText = _d === void 0 ? false : _d, helperText = props.helperText, _e = props.error, error = _e === void 0 ? false : _e, _f = props.options, options = _f === void 0 ? [] : _f, onChange = props.onChange;
22
23
  var _g = useInteractions(), tooltipOpen = _g.tooltipOpen, onOpenTooltip = _g.onOpenTooltip, onCloseTooltip = _g.onCloseTooltip;
@@ -25,10 +26,10 @@ function MultipleSelector(props) {
25
26
  onChange((_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.value);
26
27
  }, inputProps: {
27
28
  onFocus: onOpenTooltip,
28
- onBlur: onCloseTooltip,
29
+ onBlur: onCloseTooltip
29
30
  }, label: label, renderValue: multiple ? function (selected) { return selected.join("; "); } : undefined }, { children: (options === null || options === void 0 ? void 0 : options.length) > 0 ? (options.map(function (option) {
30
31
  var _a = option, label = _a.label, value = _a.value;
31
32
  return (_jsx(MenuItem, __assign({ value: value }, { children: label }), value));
32
33
  })) : (_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));
33
34
  }
34
- export default MultipleSelector;
35
+ export default withTheme(MultipleSelector);
@@ -1,4 +1,3 @@
1
1
  /// <reference types="react" />
2
- import { SimpleSelectorProps } from "./types";
3
- declare function SimpleSelector(props: SimpleSelectorProps): JSX.Element;
4
- export default SimpleSelector;
2
+ declare const _default: (props: any) => JSX.Element;
3
+ export default _default;
@@ -17,6 +17,7 @@ import InputLabel from "@mui/material/InputLabel";
17
17
  import FormControl from "@mui/material/FormControl";
18
18
  import FormHelperText from "@mui/material/FormHelperText";
19
19
  import useInteractions from "./useInteractions";
20
+ import withTheme from "../withTheme";
20
21
  function SimpleSelector(props) {
21
22
  var name = props.name, 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.showHelperText, showHelperText = _c === void 0 ? false : _c, helperText = props.helperText, _d = props.error, error = _d === void 0 ? false : _d, _e = props.options, options = _e === void 0 ? [] : _e, onChange = props.onChange;
22
23
  var _f = useInteractions(), tooltipOpen = _f.tooltipOpen, onOpenTooltip = _f.onOpenTooltip, onCloseTooltip = _f.onCloseTooltip;
@@ -25,10 +26,10 @@ function SimpleSelector(props) {
25
26
  onChange((_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.value);
26
27
  }, inputProps: {
27
28
  onFocus: onOpenTooltip,
28
- onBlur: onCloseTooltip,
29
+ onBlur: onCloseTooltip
29
30
  }, label: label }, { children: (options === null || options === void 0 ? void 0 : options.length) > 0 ? (options.map(function (option) {
30
31
  var label = option.label, value = option.value, disabled = option.disabled;
31
32
  return (_jsx(MenuItem, __assign({ value: value, disabled: disabled }, { children: label }), value));
32
33
  })) : (_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));
33
34
  }
34
- export default SimpleSelector;
35
+ export default withTheme(SimpleSelector);
@@ -6,5 +6,5 @@ export interface HelpCaptionProps {
6
6
  linkText?: string;
7
7
  linkType?: "WEBPAGE" | "VIDEO";
8
8
  }
9
- declare function HelpCaption(props: HelpCaptionProps): JSX.Element;
10
- export default HelpCaption;
9
+ declare const _default: (props: any) => JSX.Element;
10
+ export default _default;
@@ -15,6 +15,7 @@ import Typography from "@mui/material/Typography";
15
15
  import useTheme from "@mui/material/styles/useTheme";
16
16
  import VideoPlayerModal from "../VideoPlayerModal";
17
17
  import useInteractions from "./useInteractions";
18
+ import withTheme from "../withTheme";
18
19
  function HelpCaption(props) {
19
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;
20
21
  var theme = useTheme();
@@ -27,8 +28,8 @@ function HelpCaption(props) {
27
28
  cursor: "pointer",
28
29
  "&:hover": {
29
30
  color: theme.palette.primary.dark,
30
- textDecoration: "underline",
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));
33
34
  }
34
- export default HelpCaption;
35
+ export default withTheme(HelpCaption);
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- import { LoadingModalProps } from "./types";
3
- declare function LoadingModal(props: LoadingModalProps): JSX.Element;
4
- export default LoadingModal;
2
+ declare const _default: (props: any) => JSX.Element;
3
+ export default _default;
5
4
  export * from "./types";
@@ -16,6 +16,7 @@ import Dialog from "@mui/material/Dialog";
16
16
  import DialogContent from "@mui/material/DialogContent";
17
17
  import Typography from "@mui/material/Typography";
18
18
  import CircularProgress from "@mui/material/CircularProgress";
19
+ import withTheme from "../withTheme";
19
20
  function LoadingModal(props) {
20
21
  var open = props.open, _a = props.text, text = _a === void 0 ? "Loading..." : _a, _b = props.direction, direction = _b === void 0 ? "column" : _b, _c = props.showProgess, showProgess = _c === void 0 ? false : _c, _d = props.percent, percent = _d === void 0 ? 0 : _d;
21
22
  return (_jsx(Dialog, __assign({ maxWidth: "xs", open: open, sx: { backgroundColor: "#7A7A7A97" }, PaperProps: { sx: { backgroundColor: "#F2F2F2CF" } }, onClose: function (_, reason) {
@@ -23,5 +24,5 @@ function LoadingModal(props) {
23
24
  return;
24
25
  }, 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));
25
26
  }
26
- export default LoadingModal;
27
+ export default withTheme(LoadingModal);
27
28
  export * from "./types";
@@ -7,6 +7,5 @@ export interface ButtonItemProps {
7
7
  disabled?: boolean;
8
8
  onClick: MenuItemProps["onClick"];
9
9
  }
10
- declare function ButtonMenuItem(props: ButtonItemProps): JSX.Element;
11
- declare const _default: import("react").MemoExoticComponent<typeof ButtonMenuItem>;
10
+ declare const _default: (props: any) => JSX.Element;
12
11
  export default _default;
@@ -10,12 +10,12 @@ 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 { memo } from "react";
14
13
  import MenuItem from "@mui/material/MenuItem";
15
14
  import ListItemIcon from "@mui/material/ListItemIcon";
16
15
  import ListItemText from "@mui/material/ListItemText";
16
+ import withTheme from "../withTheme";
17
17
  function ButtonMenuItem(props) {
18
18
  var buttonText = props.buttonText, buttonIcon = props.buttonIcon, _a = props.disabled, disabled = _a === void 0 ? false : _a, onClick = props.onClick;
19
19
  return (_jsxs(MenuItem, __assign({ onClick: onClick, disabled: disabled }, { children: [buttonIcon && _jsx(ListItemIcon, { children: buttonIcon }, void 0), _jsx(ListItemText, { primary: buttonText }, void 0)] }), void 0));
20
20
  }
21
- export default memo(ButtonMenuItem);
21
+ export default withTheme(ButtonMenuItem);
@@ -9,5 +9,5 @@ export interface MenuButtonGroupProps {
9
9
  color?: ButtonProps["color"];
10
10
  buttons: Array<ButtonItemProps>;
11
11
  }
12
- declare function MenuButtonGroup(props: MenuButtonGroupProps): JSX.Element;
13
- export default MenuButtonGroup;
12
+ declare const _default: (props: any) => JSX.Element;
13
+ export default _default;
@@ -62,6 +62,7 @@ import Menu from "@mui/material/Menu";
62
62
  import Button from "@mui/material/Button";
63
63
  import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";
64
64
  import ButtonItem from "./MenuItem";
65
+ import withTheme from "../withTheme";
65
66
  function MenuButtonGroup(props) {
66
67
  var _this = this;
67
68
  var buttonText = props.buttonText, buttons = props.buttons, size = props.size, _a = props.color, color = _a === void 0 ? "primary" : _a, _b = props.disabled, disabled = _b === void 0 ? false : _b, _c = props.variant, variant = _c === void 0 ? "outlined" : _c;
@@ -74,10 +75,10 @@ function MenuButtonGroup(props) {
74
75
  };
75
76
  return (_jsxs(_Fragment, { 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: {
76
77
  vertical: "bottom",
77
- horizontal: "center",
78
+ horizontal: "center"
78
79
  }, transformOrigin: {
79
80
  vertical: "top",
80
- horizontal: "center",
81
+ horizontal: "center"
81
82
  }, open: Boolean(anchorEl), onClose: onClose }, { children: buttons.map(function (button) {
82
83
  var onClick = button.onClick, buttonText = button.buttonText, rest = __rest(button, ["onClick", "buttonText"]);
83
84
  return (_jsx(ButtonItem, __assign({ buttonText: buttonText }, rest, { onClick: function (event) { return __awaiter(_this, void 0, void 0, function () {
@@ -97,4 +98,4 @@ function MenuButtonGroup(props) {
97
98
  }); } }), buttonText));
98
99
  }) }), void 0)] }, void 0));
99
100
  }
100
- export default MenuButtonGroup;
101
+ export default withTheme(MenuButtonGroup);
@@ -1,6 +1,4 @@
1
1
  /// <reference types="react" />
2
- import { TextFieldProps } from "@mui/material/TextField";
3
- declare type TextProps = Omit<TextFieldProps, "onChange">;
4
2
  export interface NumberInputProps {
5
3
  onChange: (value: string) => void;
6
4
  value: string;
@@ -9,5 +7,5 @@ export interface NumberInputProps {
9
7
  maxValue?: number;
10
8
  minValue?: number;
11
9
  }
12
- declare function NumberInput(props: NumberInputProps & TextProps): JSX.Element;
13
- export default NumberInput;
10
+ declare const _default: (props: any) => JSX.Element;
11
+ export default _default;
@@ -24,6 +24,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
24
24
  import Tooltip from "@mui/material/Tooltip";
25
25
  import Field from "@mui/material/TextField";
26
26
  import useInteractions from "./useInteractions";
27
+ import withTheme from "../withTheme";
27
28
  function NumberInput(props) {
28
29
  var onChange = props.onChange, value = props.value, _a = props.size, size = _a === void 0 ? "small" : _a, tooltip = props.tooltip, _b = props.integerOnly, integerOnly = _b === void 0 ? false : _b, _c = props.minValue, minValue = _c === void 0 ? Number.MIN_SAFE_INTEGER : _c, _d = props.maxValue, maxValue = _d === void 0 ? Number.MAX_SAFE_INTEGER : _d, error = props.error, helperText = props.helperText, rest = __rest(props, ["onChange", "value", "size", "tooltip", "integerOnly", "minValue", "maxValue", "error", "helperText"]);
29
30
  var EXCEED_ERROR = "Your value exceeds the exceptable input range";
@@ -35,4 +36,4 @@ function NumberInput(props) {
35
36
  handleBlur();
36
37
  }, onChange: handleChange, error: error || exceedError, helperText: helperText || (exceedError ? EXCEED_ERROR : "") }, rest), void 0) }), void 0));
37
38
  }
38
- export default NumberInput;
39
+ export default withTheme(NumberInput);
@@ -1,10 +1,8 @@
1
1
  /// <reference types="react" />
2
- import { TextFieldProps } from "@mui/material/TextField";
3
- declare type TextInputProps = Omit<TextFieldProps, "onChange">;
4
2
  export interface ConfirmPasswordProps {
5
3
  password: string;
6
4
  value: string;
7
5
  onChange: (value: string) => void;
8
6
  }
9
- declare function ConfirmPassword(props: ConfirmPasswordProps & TextInputProps): JSX.Element;
10
- export default ConfirmPassword;
7
+ declare const _default: (props: any) => JSX.Element;
8
+ export default _default;
@@ -23,16 +23,17 @@ var __rest = (this && this.__rest) || function (s, e) {
23
23
  import { jsx as _jsx } from "react/jsx-runtime";
24
24
  import { useMemo } from "react";
25
25
  import TextField from "@mui/material/TextField";
26
+ import withTheme from "../withTheme";
26
27
  function ConfirmPassword(props) {
27
28
  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, onChange = props.onChange, rest = __rest(props, ["password", "helperText", "value", "label", "name", "variant", "margin", "disabled", "onChange"]);
28
29
  var isMatched = useMemo(function () {
29
- if ((value === null || value === void 0 ? void 0 : value.length) > 0 && password === value) {
30
- return true;
30
+ if ((value === null || value === void 0 ? void 0 : value.length) > 0) {
31
+ return password === value;
31
32
  }
32
- return false;
33
+ return true;
33
34
  }, [value, password]);
34
35
  return (_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) {
35
36
  onChange(event.target.value);
36
37
  }, fullWidth: true, required: true }, rest), void 0));
37
38
  }
38
- export default ConfirmPassword;
39
+ export default withTheme(ConfirmPassword);
@@ -1,6 +1,4 @@
1
1
  import { CSSProperties } from "react";
2
- import { TextFieldProps } from "@mui/material/TextField";
3
- declare type TextInputProps = Omit<TextFieldProps, "onChange">;
4
2
  export interface PasswordStrategyProps {
5
3
  [key: string]: {
6
4
  label: string;
@@ -14,5 +12,5 @@ export interface PasswordProps {
14
12
  onChange: (value: string) => void;
15
13
  onVerify?: (value: string) => boolean;
16
14
  }
17
- declare function Password(props: PasswordProps & TextInputProps): JSX.Element;
18
- export default Password;
15
+ declare const _default: (props: any) => JSX.Element;
16
+ export default _default;
@@ -24,21 +24,27 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
24
24
  import { useMemo } from "react";
25
25
  import TextField from "@mui/material/TextField";
26
26
  import Typography from "@mui/material/Typography";
27
+ import withTheme from "../withTheme";
27
28
  function Password(props) {
28
29
  var _a = props.strategies, strategies = _a === void 0 ? {
29
30
  uppercaseLetter: { label: "1 Uppercase Letter", regex: /[A-Z]+/ },
30
31
  lowercaseLetter: { label: "1 Lowercase Letter", regex: /[a-z]+/ },
31
32
  specialCharacter: {
32
33
  label: "1 Special Character",
33
- regex: /[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~]/,
34
+ regex: /[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~]/
34
35
  },
35
36
  number: { label: "1 Number", regex: /\d+/ },
36
- minimum8: { label: "Minimum 8 characters", regex: /.{8,}/ },
37
+ minimum8: { label: "Minimum 8 characters", regex: /.{8,}/ }
37
38
  } : _a, _b = props.successColor, successColor = _b === void 0 ? "green" : _b, value = props.value, error = props.error, _c = props.onVerify, onVerify = _c === void 0 ? function (password) {
38
39
  var reg = /^(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~])([!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~a-zA-z0-9]{8,})$/;
39
40
  return reg.test(password);
40
41
  } : _c, onChange = props.onChange, rest = __rest(props, ["strategies", "successColor", "value", "error", "onVerify", "onChange"]);
41
- var isValidPassword = useMemo(function () { return !!value && onVerify(value); }, [value, onVerify]);
42
+ var isValidPassword = useMemo(function () {
43
+ if ((value === null || value === void 0 ? void 0 : value.length) > 0) {
44
+ return onVerify(value);
45
+ }
46
+ return true;
47
+ }, [value, onVerify]);
42
48
  var helperTextColor = useMemo(function () {
43
49
  var textColors = Object.keys(strategies).reduce(function (temp, key) {
44
50
  var regex = strategies[key].regex;
@@ -65,4 +71,4 @@ function Password(props) {
65
71
  onChange(event.target.value);
66
72
  }, fullWidth: true, required: true }, rest), void 0));
67
73
  }
68
- export default Password;
74
+ export default withTheme(Password);
@@ -1,11 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  import { InputProps } from "@mui/material/Input";
3
- import { TextFieldProps } from "@mui/material/TextField";
4
- declare type TextInputProps = Omit<TextFieldProps, "onChange">;
5
3
  export interface PhoneInputProps {
6
4
  value: string;
7
5
  endAdornment?: InputProps["endAdornment"];
8
6
  onChange: (val: string) => void;
9
7
  }
10
- declare function PhoneInput(props: TextInputProps & PhoneInputProps): JSX.Element;
11
- export default PhoneInput;
8
+ export declare function phoneFormat(str: string): string;
9
+ declare const _default: (props: any) => JSX.Element;
10
+ export default _default;
@@ -26,19 +26,35 @@ import Typography from "@mui/material/Typography";
26
26
  import InputAdornment from "@mui/material/InputAdornment";
27
27
  import TextField from "@mui/material/TextField";
28
28
  import useInteractions from "./useInteractions";
29
+ import withTheme from "../withTheme";
30
+ export function phoneFormat(str) {
31
+ var digits = (str.match(/\d+/g) || []).join("");
32
+ var chars = digits.split("");
33
+ return chars.reduce(function (prev, curr, index) {
34
+ if (index === 3) {
35
+ return "".concat(prev, ") ").concat(curr);
36
+ }
37
+ else if (index === 6) {
38
+ return "".concat(prev, "-").concat(curr);
39
+ }
40
+ else {
41
+ return "".concat(prev).concat(curr);
42
+ }
43
+ }, "(");
44
+ }
29
45
  function PhoneInput(props) {
30
46
  var value = props.value, endAdornment = props.endAdornment, onChange = props.onChange, rest = __rest(props, ["value", "endAdornment", "onChange"]);
31
- var _a = useInteractions({ value: value }), addMask = _a.addMask, phoneFormat = _a.phoneFormat;
47
+ var addMask = useInteractions({ value: value }).addMask;
32
48
  var rifm = useRifm({
33
49
  mask: true,
34
50
  value: String(value),
35
51
  onChange: onChange,
36
52
  replace: addMask,
37
- format: phoneFormat,
53
+ format: phoneFormat
38
54
  });
39
55
  return (_jsx(TextField, __assign({ value: rifm.value, InputProps: {
40
56
  startAdornment: (_jsx(InputAdornment, __assign({ position: "start" }, { children: _jsx(Typography, __assign({ variant: "body2" }, { children: "+1" }), void 0) }), void 0)),
41
- endAdornment: endAdornment,
57
+ endAdornment: endAdornment
42
58
  }, onChange: rifm.onChange }, rest), void 0));
43
59
  }
44
- export default PhoneInput;
60
+ export default withTheme(PhoneInput);
@@ -4,6 +4,5 @@ interface InteractionProps {
4
4
  declare function useInteractions(props: InteractionProps): {
5
5
  valLength: number;
6
6
  addMask: (str: string) => string;
7
- phoneFormat: (str: string) => string;
8
7
  };
9
8
  export default useInteractions;
@@ -1,19 +1,6 @@
1
1
  import { useCallback, useMemo } from "react";
2
2
  function useInteractions(props) {
3
3
  var value = props.value;
4
- var phoneFormat = useCallback(function (str) {
5
- var digits = (str.match(/\d+/g) || []).join("");
6
- var chars = digits.split("");
7
- return chars.reduce(function (prev, curr, index) {
8
- if (index === 3) {
9
- return "".concat(prev, ") ").concat(curr);
10
- }
11
- if (index === 6) {
12
- return "".concat(prev, "-").concat(curr);
13
- }
14
- return "".concat(prev).concat(curr);
15
- }, "(");
16
- }, []);
17
4
  var addMask = useCallback(function (str) {
18
5
  var digits = (str.match(/\d+/g) || []).join("");
19
6
  var areaCode = digits.slice(0, 3).padEnd(3, "_");
@@ -25,6 +12,6 @@ function useInteractions(props) {
25
12
  var digitsArr = String(value).match(/\d/g);
26
13
  return digitsArr ? digitsArr.length : 0;
27
14
  }, [value]);
28
- return { valLength: valLength, addMask: addMask, phoneFormat: phoneFormat };
15
+ return { valLength: valLength, addMask: addMask };
29
16
  }
30
17
  export default useInteractions;
package/README.md CHANGED
@@ -23,6 +23,7 @@
23
23
  - [PasswordInput](#passwordinput)
24
24
  - [PhoneNumberInput](#phonenumberinput)
25
25
  - [TabGroup](#tabgroup)
26
+ - [TextInput](#textinput)
26
27
  - [ToastPrompt](#toastprompt)
27
28
  - [VideoPlayerModal](#videoplayermodal)
28
29
  - [Changelog](#changelog)
@@ -33,7 +34,7 @@
33
34
 
34
35
  It is available as an [npm package](https://www.npmjs.com/package/@symply.io/basic-components).
35
36
 
36
- ```bash
37
+ ```shell
37
38
  // with npm
38
39
  npm install @symply.io/basic-components
39
40
 
@@ -58,9 +59,9 @@ Diglog component for alerts or confirmations.
58
59
  <h5>Import</h5>
59
60
 
60
61
  ```typescript
61
- import { AlertDialog } from '@symply.io/symply-basic-components';
62
+ import { AlertDialog } from '@symply.io/basic-components/';
62
63
  // or
63
- import AlertDialog from '@symply.io/symply-basic-components/AlertDialog';
64
+ import AlertDialog from '@symply.io/basic-components/AlertDialog';
64
65
  ```
65
66
 
66
67
  <h5>Props</h5>
@@ -83,9 +84,9 @@ Reusable modal component.
83
84
  <h5>Import</h5>
84
85
 
85
86
  ```typescript
86
- import { BasicModal } from '@symply.io/symply-basic-components';
87
+ import { BasicModal } from '@symply.io/basic-components/';
87
88
  // or
88
- import BasicModal from '@symply.io/symply-basic-components/BasicModal';
89
+ import BasicModal from '@symply.io/basic-components/BasicModal';
89
90
  ```
90
91
 
91
92
  <h5>Props</h5>
@@ -119,9 +120,9 @@ It is extended from `@mui/material/TextField`, so it includes all properties of
119
120
  <h5>Import</h5>
120
121
 
121
122
  ```typescript
122
- import { DigitInput } from '@symply.io/symply-basic-components';
123
+ import { DigitInput } from '@symply.io/basic-components/';
123
124
  // or
124
- import DigitInput from '@symply.io/symply-basic-components/DigitInput';
125
+ import DigitInput from '@symply.io/basic-components/DigitInput';
125
126
  ```
126
127
 
127
128
  <h5>Props</h5>
@@ -144,9 +145,9 @@ Radio Group allow the user to select one option from a set.
144
145
  <h5>Import</h5>
145
146
 
146
147
  ```typescript
147
- import { FormRadioGroup } from '@symply.io/symply-basic-components';
148
+ import { FormRadioGroup } from '@symply.io/basic-components/';
148
149
  // or
149
- import FormRadioGroup from '@symply.io/symply-basic-components/FormRadioGroup';
150
+ import FormRadioGroup from '@symply.io/basic-components/FormRadioGroup';
150
151
  ```
151
152
 
152
153
  <h5>Radio Option Props</h5>
@@ -179,9 +180,9 @@ Selector components are used for collecting user provided information from a lis
179
180
 
180
181
  ```typescript
181
182
  // Simple Selector
182
- import { SimpleSelector } from '@symply.io/symply-basic-components/FormSelector';
183
+ import { SimpleSelector } from '@symply.io/basic-components/FormSelector';
183
184
  // Multiple Selector
184
- import { MultipleSelector } from '@symply.io/symply-basic-components/FormRadioGroup';
185
+ import { MultipleSelector } from '@symply.io/basic-components/FormRadioGroup';
185
186
  ```
186
187
 
187
188
  <h5>Selector Option Props</h5>
@@ -230,9 +231,9 @@ You can use it to add a hint/help paragraph.
230
231
  <h5>Import</h5>
231
232
 
232
233
  ```typescript
233
- import { HelpCaption } from '@symply.io/symply-basic-components';
234
+ import { HelpCaption } from '@symply.io/basic-components/';
234
235
  // or
235
- import HelpCaption from '@symply.io/symply-basic-components/HelpCaption';
236
+ import HelpCaption from '@symply.io/basic-components/HelpCaption';
236
237
  ```
237
238
 
238
239
  <h5>Props</h5>
@@ -254,9 +255,9 @@ A modal for loading.
254
255
  <h5>Import</h5>
255
256
 
256
257
  ```typescript
257
- import { LoadingModal } from '@symply.io/symply-basic-components';
258
+ import { LoadingModal } from '@symply.io/basic-components/';
258
259
  // or
259
- import LoadingModal from '@symply.io/symply-basic-components/LoadingModal';
260
+ import LoadingModal from '@symply.io/basic-components/LoadingModal';
260
261
  ```
261
262
 
262
263
  <h5>Props</h5>
@@ -278,9 +279,9 @@ A button with menu options.
278
279
  <h5>Import</h5>
279
280
 
280
281
  ```typescript
281
- import { MenuButtonGroup } from '@symply.io/symply-basic-components';
282
+ import { MenuButtonGroup } from '@symply.io/basic-components/';
282
283
  // or
283
- import MenuButtonGroup from '@symply.io/symply-basic-components/MenuButtonGroup';
284
+ import MenuButtonGroup from '@symply.io/basic-components/MenuButtonGroup';
284
285
  ```
285
286
 
286
287
  <h5>Menu Button Props</h5>
@@ -315,9 +316,9 @@ It is extended from `@mui/material/TextField`, so it includes all properties of
315
316
  <h5>Import</h5>
316
317
 
317
318
  ```typescript
318
- import { NumberInput } from '@symply.io/symply-basic-components';
319
+ import { NumberInput } from '@symply.io/basic-components/';
319
320
  // or
320
- import NumberInput from '@symply.io/symply-basic-components/NumberInput';
321
+ import NumberInput from '@symply.io/basic-components/NumberInput';
321
322
  ```
322
323
 
323
324
  <h5>Props</h5>
@@ -343,9 +344,9 @@ It is extended from `@mui/material/TextField`, so it includes all properties of
343
344
 
344
345
  ```typescript
345
346
  // Password
346
- import { Password } from '@symply.io/symply-basic-components/PasswordInput';
347
+ import { Password } from '@symply.io/basic-components/PasswordInput';
347
348
  // Confirm Password
348
- import { ConfirmPassword } from '@symply.io/symply-basic-components/PasswordInput';
349
+ import { ConfirmPassword } from '@symply.io/basic-components/PasswordInput';
349
350
  ```
350
351
 
351
352
  <h5>Password Props</h5>
@@ -377,9 +378,9 @@ It is extended from `@mui/material/TextField`, so it includes all properties of
377
378
  <h5>Import</h5>
378
379
 
379
380
  ```typescript
380
- import { PhoneNumberInput } from '@symply.io/symply-basic-components';
381
+ import { PhoneNumberInput } from '@symply.io/basic-components/';
381
382
  // or
382
- import PhoneNumberInput from '@symply.io/symply-basic-components/PhoneNumberInput';
383
+ import PhoneNumberInput from '@symply.io/basic-components/PhoneNumberInput';
383
384
  ```
384
385
 
385
386
  <h5>Props</h5>
@@ -399,9 +400,9 @@ Tabs group.
399
400
  <h5>Import</h5>
400
401
 
401
402
  ```typescript
402
- import { TabGroup } from '@symply.io/symply-basic-components';
403
+ import { TabGroup } from '@symply.io/basic-components/';
403
404
  // or
404
- import TabGroup from '@symply.io/symply-basic-components/TabGroup';
405
+ import TabGroup from '@symply.io/basic-components/TabGroup';
405
406
  ```
406
407
 
407
408
  <h5>Props</h5>
@@ -425,9 +426,9 @@ It is extended from `@mui/material/TextField`, so it includes all properties of
425
426
  <h5>Import</h5>
426
427
 
427
428
  ```typescript
428
- import { TextInput } from '@symply.io/symply-basic-components';
429
+ import { TextInput } from '@symply.io/basic-components/';
429
430
  // or
430
- import TextInput from '@symply.io/symply-basic-components/TextInput';
431
+ import TextInput from '@symply.io/basic-components/TextInput';
431
432
  ```
432
433
 
433
434
  <h5>Props</h5>
@@ -449,7 +450,7 @@ Global prompt component.
449
450
  <h5>Import</h5>
450
451
 
451
452
  ```typescript
452
- import { usePrompt } from '@symply.io/symply-basic-components';
453
+ import { usePrompt } from '@symply.io/basic-components';
453
454
  ```
454
455
 
455
456
  <h5>Usage</h5>
@@ -474,9 +475,9 @@ A modal for playing videos.
474
475
  <h5>Import</h5>
475
476
 
476
477
  ```typescript
477
- import { VideoPlayerModal } from '@symply.io/symply-basic-components';
478
+ import { VideoPlayerModal } from '@symply.io/basic-components/';
478
479
  // or
479
- import VideoPlayerModal from '@symply.io/symply-basic-components/VideoPlayerModal';
480
+ import VideoPlayerModal from '@symply.io/basic-components/VideoPlayerModal';
480
481
  ```
481
482
 
482
483
  <h5>Props</h5>
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- import { TabGroupProps } from "./types";
3
- declare const TabGroup: import("react").ForwardRefExoticComponent<TabGroupProps & import("react").RefAttributes<unknown>>;
4
- export default TabGroup;
2
+ declare const _default: (props: any) => JSX.Element;
3
+ export default _default;
5
4
  export * from "./types";
package/TabGroup/index.js CHANGED
@@ -16,6 +16,7 @@ import Tabs from "@mui/material/Tabs";
16
16
  import Typography from "@mui/material/Typography";
17
17
  import useMediaQuery from "@mui/material/useMediaQuery";
18
18
  import useTheme from "@mui/material/styles/useTheme";
19
+ import withTheme from "../withTheme";
19
20
  var TabGroup = forwardRef(function (props, ref) {
20
21
  var theme = useTheme();
21
22
  var mobileViewport = useMediaQuery(theme.breakpoints.down("md"));
@@ -25,7 +26,7 @@ var TabGroup = forwardRef(function (props, ref) {
25
26
  setCurrentTabIndex(index);
26
27
  };
27
28
  useImperativeHandle(ref, function () { return ({
28
- tabIndex: currentTabIndex,
29
+ tabIndex: currentTabIndex
29
30
  }); });
30
31
  return (_jsx(Tabs, __assign({ value: currentTabIndex, TabIndicatorProps: { hidden: true }, variant: mobileViewport ? "scrollable" : variant, textColor: textColor, onChange: function (_, val) {
31
32
  onClick(val);
@@ -38,9 +39,9 @@ var TabGroup = forwardRef(function (props, ref) {
38
39
  margin: theme.spacing(0.75, 0.25),
39
40
  background: active ? "#fff" : undefined,
40
41
  borderRadius: active ? theme.spacing(0.5) : undefined,
41
- boxShadow: active ? "0px 4px 6px #acc1c2" : undefined,
42
+ boxShadow: active ? "0px 4px 6px #acc1c2" : undefined
42
43
  } }, index));
43
44
  }) }), void 0));
44
45
  });
45
- export default TabGroup;
46
+ export default withTheme(TabGroup);
46
47
  export * from "./types";
@@ -1,6 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { TextFieldProps } from "@mui/material/TextField";
3
- declare type TextProps = Omit<TextFieldProps, "onChange">;
4
3
  export interface TextInputProps {
5
4
  onChange: (value: string) => void;
6
5
  value: string;
@@ -8,5 +7,5 @@ export interface TextInputProps {
8
7
  maxLength?: number;
9
8
  minLength?: number;
10
9
  }
11
- declare const TextInput: (props: TextInputProps & TextProps) => JSX.Element;
12
- export default TextInput;
10
+ declare const _default: (props: any) => JSX.Element;
11
+ export default _default;
@@ -24,6 +24,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
24
24
  import Tooltip from "@mui/material/Tooltip";
25
25
  import Field from "@mui/material/TextField";
26
26
  import useInteractions from "./useInteractions";
27
+ import withTheme from "../withTheme";
27
28
  var TextInput = function (props) {
28
29
  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, rest = __rest(props, ["type", "onChange", "value", "size", "tooltip", "maxLength", "minLength"]);
29
30
  var _e = useInteractions(), tooltipOpen = _e.tooltipOpen, onOpenTooltip = _e.onOpenTooltip, onCloseTooltip = _e.onCloseTooltip;
@@ -32,4 +33,4 @@ var TextInput = function (props) {
32
33
  onChange(event.target.value);
33
34
  }, inputProps: { maxLength: maxLength, minLength: minLength } }, rest), void 0) }), void 0));
34
35
  };
35
- export default TextInput;
36
+ export default withTheme(TextInput);
@@ -1,16 +1,3 @@
1
- import { ElementType } from "react";
2
- import { SlideProps } from "@mui/material/Slide";
3
- import { SnackbarOrigin } from "@mui/material/Snackbar";
4
- interface ToastPromptProps {
5
- open?: boolean;
6
- vertical?: SnackbarOrigin["vertical"];
7
- horizontal?: SnackbarOrigin["horizontal"];
8
- timeout?: number;
9
- onClose?: () => void;
10
- transitionDirection?: SlideProps["direction"];
11
- message?: string;
12
- icon?: ElementType;
13
- variant?: "success" | "warning" | "info" | "error";
14
- }
15
- declare const ToastPrompt: (props: ToastPromptProps) => JSX.Element;
16
- export default ToastPrompt;
1
+ /// <reference types="react" />
2
+ declare const _default: (props: any) => JSX.Element;
3
+ export default _default;
@@ -31,23 +31,24 @@ 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
35
  var ToastPrompt = function (props) {
35
36
  var _a;
36
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"]);
37
38
  var theme = useTheme();
38
39
  var styles = {
39
40
  success: {
40
- backgroundColor: green[600],
41
+ backgroundColor: green[600]
41
42
  },
42
43
  error: {
43
- backgroundColor: red[700],
44
+ backgroundColor: red[700]
44
45
  },
45
46
  info: {
46
- backgroundColor: blue[600],
47
+ backgroundColor: blue[600]
47
48
  },
48
49
  warning: {
49
- backgroundColor: amber[900],
50
- },
50
+ backgroundColor: amber[900]
51
+ }
51
52
  };
52
53
  var Transition = function (args) {
53
54
  return _jsx(Slide, __assign({}, args, { direction: transitionDirection }), void 0);
@@ -56,25 +57,25 @@ var ToastPrompt = function (props) {
56
57
  success: SuccessIcon,
57
58
  warning: WarningIcon,
58
59
  error: ErrorIcon,
59
- info: InfoIcon,
60
+ info: InfoIcon
60
61
  };
61
62
  var Icon = VariantIcon[variant];
62
63
  return (_jsx(Snackbar, __assign({ anchorOrigin: { vertical: vertical, horizontal: horizontal }, open: open, onClose: onClose, autoHideDuration: timeout, TransitionComponent: Transition, sx: {
63
64
  zIndex: 99999,
64
- marginTop: "3vh",
65
+ marginTop: "3vh"
65
66
  } }, { children: _jsx(SnackbarContent, __assign({ sx: __assign(__assign({}, styles[variant]), { root: (_a = {},
66
67
  _a[theme.breakpoints.down("sm")] = {
67
68
  maxWidth: "320px",
68
- borderRadius: "4px",
69
+ borderRadius: "4px"
69
70
  },
70
71
  _a) }), "aria-describedby": "Toast", message: _jsxs(Typography, __assign({ id: "Toast", component: "span", sx: {
71
72
  fontSize: 14,
72
73
  display: "flex",
73
- alignItems: "center",
74
+ alignItems: "center"
74
75
  } }, { children: [variant ? (_jsx(Icon, { sx: {
75
76
  fontSize: 20,
76
77
  opacity: 0.9,
77
- marginRight: theme.spacing(1),
78
+ marginRight: theme.spacing(1)
78
79
  } }, void 0)) : (_jsx(_Fragment, { children: icon }, void 0)), message] }), void 0) }, other), void 0) }), "".concat(Date.now() * Math.round(Math.random()))));
79
80
  };
80
- export default ToastPrompt;
81
+ export default withTheme(ToastPrompt);
@@ -1,6 +1,4 @@
1
1
  /// <reference types="react" />
2
- import { ReactPlayerProps } from "react-player";
3
- import { VideoPlayerModalProps } from "./types";
4
- declare function VideoPlayerModal(props: VideoPlayerModalProps & ReactPlayerProps): JSX.Element;
5
- export default VideoPlayerModal;
2
+ declare const _default: (props: any) => JSX.Element;
3
+ export default _default;
6
4
  export * from "./types";
@@ -30,6 +30,7 @@ import DialogActions from "@mui/material/DialogActions";
30
30
  import Button from "@mui/material/Button";
31
31
  import useTheme from "@mui/material/styles/useTheme";
32
32
  import useMediaQuery from "@mui/material/useMediaQuery";
33
+ import withTheme from '../withTheme';
33
34
  function VideoPlayerModal(props) {
34
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"]);
35
36
  var theme = useTheme();
@@ -38,5 +39,5 @@ function VideoPlayerModal(props) {
38
39
  file: { attributes: { disablePictureInPicture: !pip } },
39
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));
40
41
  }
41
- export default VideoPlayerModal;
42
+ export default withTheme(VideoPlayerModal);
42
43
  export * from "./types";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symply.io/basic-components",
3
- "version": "1.0.0-alpha.3",
3
+ "version": "1.0.0-alpha.6",
4
4
  "description": "Basic and reusable components for all frontend of Symply apps",
5
5
  "keywords": [
6
6
  "react",
package/withTheme.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const withTheme: (Component: React.ElementType) => (props: any) => JSX.Element;
3
+ export default withTheme;
package/withTheme.js ADDED
@@ -0,0 +1,35 @@
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;