@symply.io/basic-components 1.4.0-alpha.9 → 1.4.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { FileUploaderProps } from "./types";
1
+ import type { FileUploaderProps } from "./types";
2
2
  declare function FileUploader(props: FileUploaderProps): JSX.Element;
3
3
  export default FileUploader;
4
- export * from "./types";
4
+ export type { FileUploaderProps };
@@ -60,4 +60,3 @@ function FileUploader(props) {
60
60
  }, disabled: disabled }, { children: _jsx(Typography, { children: chooseFileText || "Choose a file" }) }))] })) }))), _jsx(AlertDialog, __assign({ open: alertArgs.open, primaryColor: primaryColor, secondaryColor: secondaryColor, onClose: onCloseAlert }, { children: alertArgs.message }))] })));
61
61
  }
62
62
  export default FileUploader;
63
- export * from "./types";
@@ -1,4 +1,4 @@
1
- import { FormRadioGroupProps } from "./types";
1
+ import type { RadioOption, FormRadioGroupProps } from "./types";
2
2
  declare function FormRadioGroup(props: FormRadioGroupProps): JSX.Element;
3
3
  export default FormRadioGroup;
4
- export * from "./types";
4
+ export type { RadioOption, FormRadioGroupProps };
@@ -41,4 +41,3 @@ function FormRadioGroup(props) {
41
41
  }) }))] })) })));
42
42
  }
43
43
  export default FormRadioGroup;
44
- export * from "./types";
@@ -1,14 +1,14 @@
1
1
  import { CSSProperties } from "react";
2
2
  import { FormControlProps } from "@mui/material/FormControl";
3
3
  import { FormControlLabelProps } from "@mui/material/FormControlLabel";
4
- interface IRadioOption {
4
+ export declare type RadioOption = {
5
5
  label: string;
6
6
  value: string | boolean | number;
7
7
  disabled?: boolean;
8
- }
8
+ };
9
9
  export interface FormRadioGroupProps extends Omit<FormControlProps, "onChange"> {
10
10
  formLabel: string;
11
- options: Array<IRadioOption>;
11
+ options: Array<RadioOption>;
12
12
  value: string | boolean | number;
13
13
  tooltip?: string;
14
14
  primaryColor?: CSSProperties["color"];
@@ -16,4 +16,3 @@ export interface FormRadioGroupProps extends Omit<FormControlProps, "onChange">
16
16
  radioLabelPlacement?: FormControlLabelProps["labelPlacement"];
17
17
  onChange: (value: string | boolean | number) => void;
18
18
  }
19
- export {};
@@ -1,5 +1,5 @@
1
1
  import { CSSProperties } from "react";
2
- export interface HelpCaptionProps {
2
+ export declare type HelpCaptionProps = {
3
3
  mainCaption: string;
4
4
  subCaption?: string;
5
5
  linkUrl?: string;
@@ -7,6 +7,6 @@ export interface HelpCaptionProps {
7
7
  linkType?: "WEBPAGE" | "VIDEO";
8
8
  primaryColor?: CSSProperties["color"];
9
9
  secondaryColor?: CSSProperties["color"];
10
- }
10
+ };
11
11
  declare function HelpCaption(props: HelpCaptionProps): JSX.Element;
12
12
  export default HelpCaption;
package/README.md CHANGED
@@ -237,9 +237,7 @@ It is extended from `@mui/material/Checkbox`, so it includes all properties of `
237
237
  ```typescript
238
238
  import { CheckBox } from '@symply.io/basic-components/';
239
239
  // or
240
- import { CheckBox } from '@symply.io/basic-components/CheckBox';
241
- // or
242
- import CheckBox from '@symply.io/basic-components/CheckBox/CheckBox';
240
+ import CheckBox from '@symply.io/basic-components/CheckBox';
243
241
  ```
244
242
 
245
243
  <h5>Props</h5>
@@ -262,9 +260,7 @@ It is extended from `@mui/material/FormGroup`, so it includes all properties of
262
260
  ```typescript
263
261
  import { CheckBoxGroup } from '@symply.io/basic-components/';
264
262
  // or
265
- import { CheckBoxGroup } from '@symply.io/basic-components/CheckBox';
266
- // or
267
- import CheckBoxGroup from '@symply.io/basic-components/CheckBox/CheckBoxGroup';
263
+ import CheckBoxGroup from '@symply.io/basic-components/CheckBoxGroup';
268
264
  ```
269
265
 
270
266
  <h5>Props</h5>
@@ -701,9 +697,9 @@ It is extended from `@mui/material/TextField`, so it includes all properties of
701
697
 
702
698
  ```typescript
703
699
  // Password
704
- import { Password } from '@symply.io/basic-components/PasswordInput';
700
+ import Password from '@symply.io/basic-components/PasswordInput';
705
701
  // Confirm Password
706
- import { ConfirmPassword } from '@symply.io/basic-components/PasswordInput';
702
+ import ConfirmPassword from '@symply.io/basic-components/ConfirmPasswordInput';
707
703
  ```
708
704
 
709
705
  <h5>Password Props</h5>
@@ -1,6 +1,6 @@
1
- import { SocialInputProps } from "./types";
1
+ import type { SocialInputProps } from "./types";
2
2
  export declare function SocialInputFormat(str: string): string;
3
3
  export declare function onValidateSocial(socialString: string): boolean;
4
4
  declare function SocialInput(props: SocialInputProps): JSX.Element;
5
5
  export default SocialInput;
6
- export * from "./types";
6
+ export type { SocialInputProps };
@@ -74,4 +74,3 @@ function SocialInput(props) {
74
74
  } }, rest)) })));
75
75
  }
76
76
  export default SocialInput;
77
- export * from "./types";
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { TabGroupProps } from "./types";
2
+ import type { TabGroupProps } from "./types";
3
3
  declare const TabGroup: import("react").ForwardRefExoticComponent<TabGroupProps & import("react").RefAttributes<unknown>>;
4
4
  export default TabGroup;
5
- export * from "./types";
5
+ export type { TabGroupProps };
package/TabGroup/index.js CHANGED
@@ -48,4 +48,3 @@ var TabGroup = forwardRef(function (props, ref) {
48
48
  }) })) })));
49
49
  });
50
50
  export default TabGroup;
51
- export * from "./types";
@@ -1,4 +1,4 @@
1
- import { TablePaginationProps } from "./types";
1
+ import type { TablePaginationProps } from "./types";
2
2
  declare function Pagination(props: TablePaginationProps): JSX.Element;
3
3
  export default Pagination;
4
- export * from "./types";
4
+ export type { TablePaginationProps };
@@ -20,4 +20,3 @@ function Pagination(props) {
20
20
  return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: count ? (_jsx(TablePagination, { component: "div", colSpan: colSpan, count: count, rowsPerPage: rowsPerPage, page: page, SelectProps: { native: true }, rowsPerPageOptions: rowsPerPageOptions, onPageChange: onPageChange, onRowsPerPageChange: onRowsPerPageChange, ActionsComponent: TablePaginationActions })) : (_jsx(_Fragment, {})) })));
21
21
  }
22
22
  export default Pagination;
23
- export * from "./types";
@@ -9,5 +9,5 @@ export interface TextInputProps extends Omit<TextFieldProps, "onChange"> {
9
9
  primaryColor?: CSSProperties["color"];
10
10
  secondaryColor?: CSSProperties["color"];
11
11
  }
12
- declare const TextInput: (props: TextInputProps) => JSX.Element;
12
+ declare function TextInput(props: TextInputProps): JSX.Element;
13
13
  export default TextInput;
@@ -26,7 +26,7 @@ import Field from "@mui/material/TextField";
26
26
  import ThemeProvider from "@mui/material/styles/ThemeProvider";
27
27
  import useInteractions from "./useInteractions";
28
28
  import useCustomTheme from "../useCustomTheme";
29
- var TextInput = function (props) {
29
+ function TextInput(props) {
30
30
  var _a = props.type, type = _a === void 0 ? "text" : _a, onChange = props.onChange, value = props.value, _b = props.size, size = _b === void 0 ? "small" : _b, tooltip = props.tooltip, _c = props.maxLength, maxLength = _c === void 0 ? 999 : _c, _d = props.minLength, minLength = _d === void 0 ? 0 : _d, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, onBlur = props.onBlur, onFocus = props.onFocus, rest = __rest(props, ["type", "onChange", "value", "size", "tooltip", "maxLength", "minLength", "primaryColor", "secondaryColor", "onBlur", "onFocus"]);
31
31
  var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
32
32
  var _e = useInteractions(), tooltipOpen = _e.tooltipOpen, onOpenTooltip = _e.onOpenTooltip, onCloseTooltip = _e.onCloseTooltip;
@@ -42,5 +42,5 @@ var TextInput = function (props) {
42
42
  event.preventDefault();
43
43
  onChange(event.target.value);
44
44
  }, inputProps: { maxLength: maxLength, minLength: minLength } }, rest)) })) })));
45
- };
45
+ }
46
46
  export default TextInput;
@@ -1,3 +1,4 @@
1
- import type { PromptProps } from "./types";
2
- declare function Prompt(props: PromptProps): JSX.Element;
1
+ /// <reference types="react" />
2
+ import { RefProps } from "./types";
3
+ declare const Prompt: import("react").ForwardRefExoticComponent<import("react").RefAttributes<RefProps | null>>;
3
4
  export default Prompt;
@@ -9,19 +9,22 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { forwardRef, useImperativeHandle } from "react";
13
14
  import Alert from "@mui/material/Alert";
14
15
  import Slide from "@mui/material/Slide";
15
- import AlertTitle from "@mui/material/AlertTitle";
16
16
  import Snackbar from "@mui/material/Snackbar";
17
+ import Typography from "@mui/material/Typography";
17
18
  import ThemeProvider from "@mui/material/styles/ThemeProvider";
18
19
  import useCustomTheme from "../useCustomTheme";
20
+ import useInteractions from "./useInteractions";
19
21
  function Transition(args) {
20
22
  return _jsx(Slide, __assign({}, args, { direction: "up" }));
21
23
  }
22
- function Prompt(props) {
23
- var open = props.open, type = props.type, message = props.message, timeout = props.timeout, onClose = props.onClose;
24
+ var Prompt = forwardRef(function (_, ref) {
24
25
  var theme = useCustomTheme();
25
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Snackbar, __assign({ anchorOrigin: { vertical: "bottom", horizontal: "left" }, open: open, onClose: onClose, autoHideDuration: timeout, TransitionComponent: Transition, sx: { zIndex: 99999 } }, { children: _jsxs(Alert, __assign({ variant: "filled", severity: type, sx: { width: "100%", fontSize: 14, fontWeight: 700 }, onClose: onClose }, { children: [_jsx(AlertTitle, __assign({ sx: { textTransform: "capitalize", fontSize: 14, fontWeight: 700 } }, { children: type })), message] })) }), "".concat(Date.now() * Math.round(Math.random()))) })));
26
- }
26
+ var _a = useInteractions(), open = _a.open, type = _a.type, message = _a.message, timeout = _a.timeout, onShow = _a.onShow, onHide = _a.onHide;
27
+ useImperativeHandle(ref, function () { return ({ onShow: onShow }); });
28
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Snackbar, __assign({ anchorOrigin: { vertical: "bottom", horizontal: "left" }, open: open, onClose: onHide, autoHideDuration: timeout, TransitionComponent: Transition, sx: { zIndex: 99999 } }, { children: _jsx(Alert, __assign({ variant: "filled", severity: type, sx: { width: "100%", fontSize: 14, fontWeight: 700 }, onClose: onHide }, { children: _jsx(Typography, __assign({ sx: { fontWeight: 800, fontSize: 14 } }, { children: message })) })) }), "".concat(Date.now() * Math.round(Math.random()))) })));
29
+ });
27
30
  export default Prompt;
@@ -10,16 +10,19 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { createContext, useContext, cloneElement } from "react";
13
+ import { createContext, useContext, useRef, useCallback, cloneElement } from "react";
14
14
  import Prompt from "./Prompt";
15
- import useInteractions from "./useInteractions";
16
15
  var PromptContext = createContext({
17
16
  showPrompt: function () { }
18
17
  });
19
18
  export function PromptProvider(props) {
20
19
  var children = props.children;
21
- var _a = useInteractions(), promptArgs = _a.promptArgs, onShow = _a.onShow, onHide = _a.onHide;
22
- return (_jsxs(PromptContext.Provider, __assign({ value: { showPrompt: onShow } }, { children: [children, cloneElement(_jsx(Prompt, __assign({}, promptArgs, { onClose: onHide })))] })));
20
+ var ref = useRef(null);
21
+ var showPrompt = useCallback(function (args) {
22
+ var _a;
23
+ (_a = ref.current) === null || _a === void 0 ? void 0 : _a.onShow(args);
24
+ }, []);
25
+ return (_jsxs(PromptContext.Provider, __assign({ value: { showPrompt: showPrompt } }, { children: [children, cloneElement(_jsx(Prompt, { ref: ref }))] })));
23
26
  }
24
27
  export function usePrompt() {
25
28
  return useContext(PromptContext);
@@ -16,14 +16,13 @@ export interface InterfaceStates {
16
16
  onHide: (event: SyntheticEvent | Event, reason?: SnackbarCloseReason) => void;
17
17
  onShow: (args: PromptArgs) => void;
18
18
  }
19
- export interface PromptProps extends PromptArgs {
20
- open: boolean;
21
- onClose: InterfaceStates["onHide"];
22
- }
23
19
  export interface PromptProviderProps {
24
20
  children: ReactNode;
25
21
  }
26
22
  export interface PromptContextProps {
27
23
  showPrompt: InterfaceStates["onShow"];
28
24
  }
25
+ export interface RefProps {
26
+ onShow: InterfaceStates["onShow"];
27
+ }
29
28
  export {};
@@ -1,15 +1,14 @@
1
1
  /// <reference types="react" />
2
2
  declare function useInteractions(): {
3
- promptArgs: {
4
- message: string | 400;
5
- type: import("./types").Severity;
6
- timeout?: number | undefined;
7
- } & Record<"open", boolean>;
8
3
  onShow: (args: {
9
4
  message: string | 400;
10
5
  type: import("./types").Severity;
11
6
  timeout?: number | undefined;
12
7
  }) => void;
13
8
  onHide: (event: Event | import("react").SyntheticEvent<Element, Event>, reason?: import("@mui/material").SnackbarCloseReason | undefined) => void;
9
+ message: string | 400;
10
+ type: import("./types").Severity;
11
+ timeout?: number | undefined;
12
+ open: boolean;
14
13
  };
15
14
  export default useInteractions;
@@ -27,13 +27,8 @@ function useInteractions() {
27
27
  }, []);
28
28
  var onShow = useCallback(function (args) {
29
29
  var _a = args.message, message = _a === void 0 ? UNKNOWN_MESSAGE : _a, _b = args.type, type = _b === void 0 ? "error" : _b, _c = args.timeout, timeout = _c === void 0 ? 3500 : _c;
30
- setPromptArgs({
31
- message: message === 400 ? ERROR_MESSAGE : message,
32
- type: type,
33
- timeout: timeout,
34
- open: true
35
- });
30
+ setPromptArgs(function (args) { return (__assign(__assign({}, args), { message: message === 400 ? ERROR_MESSAGE : message, type: type, timeout: timeout, open: true })); });
36
31
  }, []);
37
- return { promptArgs: promptArgs, onShow: onShow, onHide: onHide };
32
+ return __assign(__assign({}, promptArgs), { onShow: onShow, onHide: onHide });
38
33
  }
39
34
  export default useInteractions;
@@ -1,4 +1,4 @@
1
- import { VideoPlayerModalProps } from "./types";
1
+ import type { VideoPlayerModalProps } from "./types";
2
2
  declare function VideoPlayerModal(props: VideoPlayerModalProps): JSX.Element;
3
3
  export default VideoPlayerModal;
4
- export * from "./types";
4
+ export type { VideoPlayerModalProps };
@@ -40,4 +40,3 @@ function VideoPlayerModal(props) {
40
40
  } }, playerProps)) }), _jsx(DialogActions, { children: _jsxs(Grid, __assign({ container: true, direction: "row", justifyContent: "flex-end", alignItems: "center", spacing: 1 }, { children: [extraButtons.map(function (buttonProps, index) { return (_jsx(Grid, __assign({ item: true, xs: 12, md: 3, lg: 2 }, { children: _jsx(Button, __assign({}, buttonProps)) }), "extraButton_".concat(index))); }), _jsx(Grid, __assign({ item: true, xs: 12, md: 2, lg: 1 }, { children: _jsx(Button, __assign({ variant: "outlined", fullWidth: true, color: "secondary", onClick: onClose }, { children: "Close" })) }))] })) })] })) })));
41
41
  }
42
42
  export default VideoPlayerModal;
43
- export * from "./types";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symply.io/basic-components",
3
- "version": "1.4.0-alpha.9",
3
+ "version": "1.4.0-beta.10",
4
4
  "description": "Basic and reusable components for all frontend of Symply apps",
5
5
  "keywords": [
6
6
  "react",