@symply.io/basic-components 1.2.5 → 1.2.7-beta.1

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.
@@ -25,12 +25,14 @@ function Crumbs(props) {
25
25
  }, []);
26
26
  return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsxs(Breadcrumbs, __assign({ "aria-label": "breadcrumb", separator: _jsx(NavigateNextIcon, { fontSize: "small" }) }, { children: [_jsx(Typography, {}), routes.map(function (route) {
27
27
  var href = route.href, label = route.label;
28
- return href ? (_jsx(Typography, __assign({ variant: "body2", color: "inherit", sx: {
28
+ return href ? (_jsx(Typography, __assign({ color: "inherit", sx: {
29
+ fontSize: 16,
30
+ fontWeight: 500,
29
31
  "&:hover": {
30
32
  cursor: "pointer",
31
- color: theme.palette.primary.light,
32
- },
33
- }, onClick: function () { return onNavigateTo(href); } }, { children: label }), label)) : (_jsx(Typography, __assign({ variant: "body2", color: "primary" }, { children: label }), label));
33
+ color: theme.palette.primary.light
34
+ }
35
+ }, onClick: function () { return onNavigateTo(href); } }, { children: label }), label)) : (_jsx(Typography, __assign({ sx: { fontSize: 16, fontWeight: 500 }, color: "primary" }, { children: label }), label));
34
36
  })] })) })));
35
37
  }
36
38
  export default Crumbs;
@@ -17,7 +17,7 @@ import useCustomTheme from "../useCustomTheme";
17
17
  function Copyright(props) {
18
18
  var primaryColor = props.primaryColor, secondaryColor = props.secondaryColor;
19
19
  var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
20
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsxs(Typography, __assign({ variant: "body2", color: "textSecondary", align: "center" }, { children: ["Copyright © ", _jsx(Link, __assign({ color: "inherit", href: "https://symply.io/" }, { children: "Symply Software Inc" })), "\u00A0", new Date().getFullYear() > 2020
20
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsxs(Typography, __assign({ sx: { fontSize: 16, fontWeight: 400 }, color: "textSecondary", align: "center" }, { children: ["Copyright © ", _jsx(Link, __assign({ color: "inherit", href: "https://symply.io/" }, { children: "Symply Software Inc" })), "\u00A0", new Date().getFullYear() > 2020
21
21
  ? "2020-".concat(new Date().getFullYear())
22
22
  : new Date().getFullYear(), "."] })) })));
23
23
  }
@@ -27,6 +27,6 @@ function HeaderBar(props) {
27
27
  var hasButtons = useMemo(function () { return buttons.length > 0; }, [buttons.length]);
28
28
  return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsxs(Grid, __assign({ sx: { mb: 1 } }, { children: [_jsxs(Grid, __assign({ container: true, direction: "row", justifyContent: "flex-start", alignItems: "center" }, { children: [_jsx(Grid, __assign({ item: true, xs: 12, sm: hasButtons ? 6 : 12, md: hasButtons ? 5 : 12, lg: hasButtons ? 4 : 12, xl: hasButtons ? 3 : 12 }, { children: _jsxs(Grid, __assign({ container: true, direction: "row", justifyContent: "flex-start", alignItems: "center" }, { children: [showBackButton && (_jsx(IconButton, __assign({ onClick: function () {
29
29
  onBack ? onBack() : window.history.back();
30
- } }, { children: _jsx(ArrowBackIcon, { fontSize: "small" }) }))), _jsx(Typography, __assign({ align: "left", variant: isLessThanSm ? "h6" : "h3", sx: { fontWeight: 600 } }, { children: title }))] })) })), hasButtons ? (_jsx(Grid, __assign({ item: true, xs: 12, sm: 6, md: 7, lg: 8, xl: 9 }, { children: _jsx(HeaderButtons, { buttons: buttons }) }))) : (_jsx(_Fragment, {}))] })), _jsx(Grid, __assign({ container: true, direction: "row" }, { children: _jsx(Grid, __assign({ item: true, xs: 12, sx: { mt: 1 } }, { children: _jsx(HeaderLine, { color: color }) })) })), 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 })) : (cloneElement(subtitle)) })) }))), bottomEl && (_jsx(Grid, __assign({ container: true, direction: "row" }, { children: _jsx(Grid, __assign({ item: true, xs: 12, sx: { mt: 1 } }, { children: cloneElement(bottomEl) })) })))] })) })));
30
+ } }, { children: _jsx(ArrowBackIcon, { fontSize: "small" }) }))), _jsx(Typography, __assign({ align: "left", sx: { fontWeight: 600, fontSize: isLessThanSm ? 21 : 24 } }, { children: title }))] })) })), hasButtons ? (_jsx(Grid, __assign({ item: true, xs: 12, sm: 6, md: 7, lg: 8, xl: 9 }, { children: _jsx(HeaderButtons, { buttons: buttons }) }))) : (_jsx(_Fragment, {}))] })), _jsx(Grid, __assign({ container: true, direction: "row" }, { children: _jsx(Grid, __assign({ item: true, xs: 12, sx: { mt: 1 } }, { children: _jsx(HeaderLine, { color: color }) })) })), 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 })) : (cloneElement(subtitle)) })) }))), bottomEl && (_jsx(Grid, __assign({ container: true, direction: "row" }, { children: _jsx(Grid, __assign({ item: true, xs: 12, sx: { mt: 1 } }, { children: cloneElement(bottomEl) })) })))] })) })));
31
31
  }
32
32
  export default HeaderBar;
@@ -9,6 +9,17 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
12
23
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
24
  import Radio from "@mui/material/Radio";
14
25
  import Tooltip from "@mui/material/Tooltip";
@@ -20,18 +31,13 @@ import FormControlLabel from "@mui/material/FormControlLabel";
20
31
  import ThemeProvider from "@mui/material/styles/ThemeProvider";
21
32
  import useCustomTheme from "../useCustomTheme";
22
33
  function FormRadioGroup(props) {
23
- var formLabel = props.formLabel, color = props.color, value = props.value, options = props.options, disabled = props.disabled, tooltip = props.tooltip, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, onChange = props.onChange;
34
+ var formLabel = props.formLabel, value = props.value, options = props.options, disabled = props.disabled, tooltip = props.tooltip, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, radioLabelPlacement = props.radioLabelPlacement, onChange = props.onChange, rest = __rest(props, ["formLabel", "value", "options", "disabled", "tooltip", "primaryColor", "secondaryColor", "radioLabelPlacement", "onChange"]);
24
35
  var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
25
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _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 })) }))) : (_jsx(FormLabel, __assign({ sx: { lineHeight: "24px" }, component: "legend" }, { children: formLabel }))), _jsx(RadioGroup, __assign({ value: value, onChange: function (event) {
36
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsxs(FormControl, __assign({ disabled: disabled }, rest, { children: [tooltip ? (_jsx(Tooltip, __assign({ title: tooltip, placement: "right", disableTouchListener: true }, { children: _jsx(FormLabel, { children: formLabel }) }))) : (_jsx(FormLabel, { children: formLabel })), _jsx(RadioGroup, __assign({ value: value, onChange: function (event) {
26
37
  onChange(event.target.value);
27
- }, sx: {
28
- my: 1,
29
- "& label span:first-of-type span:first-of-type": {
30
- margin: "-5px 0 -5px 0"
31
- }
32
38
  } }, { children: options.map(function (opt) {
33
39
  var _a;
34
- return (_jsx(FormControlLabel, { value: opt.value, control: _jsx(Radio, { color: color || "primary" }), label: _jsx(Typography, { children: opt.label }), disabled: ((_a = opt.disabled) !== null && _a !== void 0 ? _a : false) || disabled }, String(opt.value)));
40
+ return (_jsx(FormControlLabel, { value: opt.value, control: _jsx(Radio, {}), label: _jsx(Typography, { children: opt.label }), labelPlacement: radioLabelPlacement || "end", disabled: ((_a = opt.disabled) !== null && _a !== void 0 ? _a : false) || disabled }, String(opt.value)));
35
41
  }) }))] })) })));
36
42
  }
37
43
  export default FormRadioGroup;
@@ -1,19 +1,19 @@
1
1
  import { CSSProperties } from "react";
2
- import { RadioProps } from "@mui/material/Radio";
2
+ import { FormControlProps } from "@mui/material/FormControl";
3
+ import { FormControlLabelProps } from "@mui/material/FormControlLabel";
3
4
  interface IRadioOption {
4
5
  label: string;
5
6
  value: string | boolean | number;
6
7
  disabled?: boolean;
7
8
  }
8
- export interface FormRadioGroupProps {
9
- color?: RadioProps["color"];
9
+ export interface FormRadioGroupProps extends Omit<FormControlProps, "onChange"> {
10
10
  formLabel: string;
11
11
  options: Array<IRadioOption>;
12
12
  value: string | boolean | number;
13
- disabled?: boolean;
14
13
  tooltip?: string;
15
14
  primaryColor?: CSSProperties["color"];
16
15
  secondaryColor?: CSSProperties["color"];
16
+ radioLabelPlacement?: FormControlLabelProps["labelPlacement"];
17
17
  onChange: (value: string | boolean | number) => void;
18
18
  }
19
19
  export {};
@@ -24,6 +24,6 @@ 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
- }, disableScrollLock: true, disableAutoFocus: true, disableEnforceFocus: true, 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 }))] })) }) })) })));
27
+ }, disableScrollLock: true, disableAutoFocus: true, disableEnforceFocus: true, 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({ component: "span", sx: { mt: 1, fontSize: 16, fontWeight: 400 } }, { children: text }))] })) }) })) })));
28
28
  }
29
29
  export default LoadingModal;
@@ -59,7 +59,7 @@ function PhoneInput(props) {
59
59
  format: phoneFormat
60
60
  });
61
61
  return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(TextField, __assign({ value: rifm.value, InputProps: {
62
- startAdornment: (_jsx(InputAdornment, __assign({ position: "start" }, { children: _jsx(Typography, __assign({ variant: "body2" }, { children: "+1" })) }))),
62
+ startAdornment: (_jsx(InputAdornment, __assign({ position: "start" }, { children: _jsx(Typography, __assign({ sx: { fontSize: 16, fontWeight: 500 } }, { children: "+1" })) }))),
63
63
  endAdornment: endAdornment
64
64
  }, onChange: rifm.onChange, helperText: valLength > 0 &&
65
65
  (onValidate ? !onValidate(rifm.value) : !onValidatePhone(rifm.value))
package/README.md CHANGED
@@ -516,15 +516,16 @@ import FormRadioGroup from '@symply.io/basic-components/FormRadioGroup';
516
516
 
517
517
  <h5>Props</h5>
518
518
 
519
- | Name | Type | Default | Required | Description |
520
- | --------- | ------------------------------------------------------------ | --------- | -------- | ------------------------------------------------------------ |
521
- | color | 'primary' \| 'secondary' \| 'success' \| 'error' \| 'info' \| 'warning' | 'primary' | false | The main color of the component. |
522
- | disabled | bool | false | false | If `true`, the component is disabled. |
523
- | formLabel | string | | false | The label of the `Radio` element. |
524
- | 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. |
525
- | options | Array\<IRadioOption\> | | true | The radio options. See the **Radio Option Props** above. |
526
- | value | string \| number \| bool | | true | The value of the `Radio` element. |
527
- | tooltip | string | | false | A tooltip for the `Radio` element. |
519
+ It is extended from `@mui/material/FormControl`, so it includes all properties of `@mui/material/FormControl`.
520
+
521
+ | Name | Type | Default | Required | Description |
522
+ | ------------------- | ------------------------------------- | ------- | -------- | ------------------------------------------------------------ |
523
+ | formLabel | string | | false | The label of the `Radio` element. |
524
+ | 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. |
525
+ | options | Array\<IRadioOption\> | | true | The radio options. See the **Radio Option Props** above. |
526
+ | radioLabelPlacement | 'top' \| 'bottom' \| 'start' \| 'end' | 'end' | false | The placement of the radio labe . |
527
+ | tooltip | string | | false | A tooltip for the `Radio` element. |
528
+ | value | string \| number \| bool | | true | The value of the `Radio` element. |
528
529
 
529
530
 
530
531
 
package/TabGroup/index.js CHANGED
@@ -39,7 +39,7 @@ 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 })), disabled: disabled, sx: {
42
+ return (_jsx(Tab, { disableFocusRipple: true, disableRipple: true, label: _jsx(Typography, __assign({ sx: { fontSize: 16, fontWeight: 500 } }, { 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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symply.io/basic-components",
3
- "version": "1.2.5",
3
+ "version": "1.2.7-beta.1",
4
4
  "description": "Basic and reusable components for all frontend of Symply apps",
5
5
  "keywords": [
6
6
  "react",