pcm-shared-components 0.0.127 → 0.0.130
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.
|
@@ -2,12 +2,13 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
2
2
|
|
|
3
3
|
import React, { memo } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
-
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
|
5
|
+
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
|
6
|
+
import { ThemeProvider } from '@mui/system';
|
|
7
|
+
import { createTheme, useTheme } from '@mui/material/styles'; // import { CustomFab } from '../CustomFab';
|
|
6
8
|
|
|
7
|
-
import { createTheme, useTheme } from '@mui/material/styles';
|
|
8
|
-
import { CustomFab } from '../CustomFab';
|
|
9
9
|
import { ReusablePopupMenu } from '../../Menus/ReusablePopupMenu';
|
|
10
10
|
import i18n from '../../../locals/i18n';
|
|
11
|
+
import Button from '@mui/material/Button';
|
|
11
12
|
/**
|
|
12
13
|
* Creates a till button from other PCM components to simplify the component.
|
|
13
14
|
* Uses:
|
|
@@ -33,29 +34,20 @@ export const TillButton = props => {
|
|
|
33
34
|
defaultText,
|
|
34
35
|
menuData,
|
|
35
36
|
size,
|
|
36
|
-
|
|
37
|
+
className,
|
|
37
38
|
theme
|
|
38
39
|
} = props;
|
|
39
40
|
const compTheme = theme ? theme : useTheme();
|
|
40
41
|
const defaultTheme = createTheme(compTheme);
|
|
41
42
|
const isTillInuse = name ? true : inUse ? true : false;
|
|
42
|
-
return (
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
size: size,
|
|
51
|
-
boxShadow: false,
|
|
52
|
-
buttonText: `${defaultText} ${name ? ':' : ''} ${name}`,
|
|
53
|
-
iconLocation: 'right',
|
|
54
|
-
borderRadius: borderRadius,
|
|
55
|
-
theme: defaultTheme
|
|
56
|
-
})) // </ThemeProvider>
|
|
57
|
-
|
|
58
|
-
);
|
|
43
|
+
return /*#__PURE__*/React.createElement(ReusablePopupMenu, _extends({}, menuData, {
|
|
44
|
+
theme: defaultTheme
|
|
45
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
46
|
+
className: className,
|
|
47
|
+
endIcon: /*#__PURE__*/React.createElement(KeyboardArrowDownIcon, null),
|
|
48
|
+
color: isTillInuse ? 'primary' : 'secondary',
|
|
49
|
+
size: className ? undefined : size
|
|
50
|
+
}, `${defaultText} ${name ? ':' : ''} ${name}`));
|
|
59
51
|
};
|
|
60
52
|
export default /*#__PURE__*/memo(TillButton);
|
|
61
53
|
TillButton.defaultProps = {
|
|
@@ -63,8 +55,8 @@ TillButton.defaultProps = {
|
|
|
63
55
|
name: '',
|
|
64
56
|
defaultText: i18n.t('common.app.till'),
|
|
65
57
|
menuData: [],
|
|
66
|
-
|
|
67
|
-
|
|
58
|
+
className: undefined,
|
|
59
|
+
size: 'large',
|
|
68
60
|
theme: {}
|
|
69
61
|
};
|
|
70
62
|
TillButton.propTypes = {
|
|
@@ -80,11 +72,11 @@ TillButton.propTypes = {
|
|
|
80
72
|
/** Menu items for the dropdown, see the ReusablePopupMenu component for a better understanding of the props parameters */
|
|
81
73
|
menuData: PropTypes.array,
|
|
82
74
|
|
|
83
|
-
/**
|
|
84
|
-
|
|
75
|
+
/** Classes applied to the button */
|
|
76
|
+
className: PropTypes.string,
|
|
85
77
|
|
|
86
78
|
/** Supported size of the button ['x-small', 'small','medium'] */
|
|
87
|
-
size: PropTypes.oneOf(['
|
|
79
|
+
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
88
80
|
|
|
89
81
|
/** Theme object to use on this component, if none provided then the MUI5 theme provider theme is used*/
|
|
90
82
|
theme: PropTypes.object
|
|
@@ -5,6 +5,7 @@ import { makeStyles } from '@mui/styles';
|
|
|
5
5
|
import ListItemIcon from "@mui/material/ListItemIcon";
|
|
6
6
|
import ListItemText from "@mui/material/ListItemText";
|
|
7
7
|
import Switch from "@mui/material/Switch";
|
|
8
|
+
import withStyles from "@mui/styles/withStyles";
|
|
8
9
|
|
|
9
10
|
const GenericSubMenu = ({
|
|
10
11
|
menu,
|
|
@@ -71,8 +72,8 @@ const GenericSubMenu = ({
|
|
|
71
72
|
setSubMenuOpen(Boolean(anchorSubMenu));
|
|
72
73
|
}, [anchorSubMenu]);
|
|
73
74
|
return /*#__PURE__*/React.createElement("div", {
|
|
74
|
-
key: `main_sub_menu_items_${menu.
|
|
75
|
-
className: !full_menu ? "flex flex-row" : 'flex flex-col w-full'
|
|
75
|
+
key: `main_sub_menu_items_${menu.name}`,
|
|
76
|
+
className: !full_menu ? "flex flex-row w-full" : 'flex flex-col w-full'
|
|
76
77
|
}, full_menu ? /*#__PURE__*/React.createElement(MenuItem, {
|
|
77
78
|
onClick: openSubMenu
|
|
78
79
|
}, menu.icon && /*#__PURE__*/React.createElement(ListItemIcon, null, menu.icon), /*#__PURE__*/React.createElement("div", {
|
|
@@ -11,7 +11,9 @@ import PropTypes from "prop-types";
|
|
|
11
11
|
import GenericSubMenu from './GenericSubMenu';
|
|
12
12
|
const StyledMenu = withStyles({
|
|
13
13
|
paper: {
|
|
14
|
-
border: "1px solid #d3d4d5"
|
|
14
|
+
border: "1px solid #d3d4d5",
|
|
15
|
+
paddingTop: 4,
|
|
16
|
+
paddingBottom: 4
|
|
15
17
|
}
|
|
16
18
|
})(props => /*#__PURE__*/React.createElement(Menu, _extends({
|
|
17
19
|
elevation: 0,
|
|
@@ -26,6 +28,10 @@ const StyledMenu = withStyles({
|
|
|
26
28
|
}, props)));
|
|
27
29
|
const StyledMenuItem = withStyles(() => ({
|
|
28
30
|
root: {
|
|
31
|
+
minHeight: 50,
|
|
32
|
+
paddingLeft: 12,
|
|
33
|
+
paddingRight: 12,
|
|
34
|
+
minWidth: '100% !important',
|
|
29
35
|
"&:focus": {
|
|
30
36
|
backgroundColor: "primary",
|
|
31
37
|
"& .MuiListItemIcon-root, & .MuiListItemText-primary": {
|
|
@@ -50,9 +56,10 @@ const ReusableMenu = props => {
|
|
|
50
56
|
open: Boolean(menuAnchor),
|
|
51
57
|
onClose: handleClose
|
|
52
58
|
}, menuData.filter(mn => !(mn.hideMenu && mn.hideMenu === true)).map((menu, idx) => /*#__PURE__*/React.createElement("div", {
|
|
59
|
+
className: "w-full",
|
|
53
60
|
key: `ReusableMenu_${idx}`
|
|
54
61
|
}, menu.name && /*#__PURE__*/React.createElement(React.Fragment, null, menu.subMenu ? /*#__PURE__*/React.createElement("div", {
|
|
55
|
-
className: "flex flex-row",
|
|
62
|
+
className: "flex flex-row w-full",
|
|
56
63
|
key: `main_sub_items_${new Date()}`
|
|
57
64
|
}, /*#__PURE__*/React.createElement(GenericSubMenu, {
|
|
58
65
|
key: `common_grid_app_bar_sub_desktop_${idx}`,
|
|
@@ -61,6 +68,7 @@ const ReusableMenu = props => {
|
|
|
61
68
|
classes: classes,
|
|
62
69
|
onClose: handleClose
|
|
63
70
|
})) : /*#__PURE__*/React.createElement(StyledMenuItem, {
|
|
71
|
+
className: "w-full m-12",
|
|
64
72
|
onClick: menu.onClick,
|
|
65
73
|
key: `reusable_menu_item_${idx}`
|
|
66
74
|
}, menu.icon && /*#__PURE__*/React.createElement(ListItemIcon, null, menu.icon), /*#__PURE__*/React.createElement(ListItemText, {
|