@bento-core/table 1.0.0-c3dc.17 → 1.0.0-c3dc.19

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.
package/dist/TableView.js CHANGED
@@ -35,7 +35,6 @@ const CustomTableContainer = props => {
35
35
  const downloadAreaStyle = {
36
36
  display: 'flex',
37
37
  borderTop: '1px solid #8A7F7C',
38
- borderBottom: '1px solid #8A7F7C',
39
38
  paddingRight: '41px'
40
39
  };
41
40
  const cartDownloadAreaStyle = {
@@ -0,0 +1,3 @@
1
+ <svg width="13" height="6" viewBox="0 0 13 6" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M0.404297 0.937988L6.45817 5.93799L12.5121 0.937988H0.404297Z" fill="#CFCFCF"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="30" height="25" viewBox="0 0 30 25" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M19.4141 17.278L13.8687 12.688L19.4141 8.09799L17.7069 6.68799L10.4422 12.688L17.7069 18.688L19.4141 17.278Z" fill="#000"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="30" height="25" viewBox="0 0 30 25" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M11.323 17.278L16.8683 12.688L11.323 8.09799L13.0302 6.68799L20.2948 12.688L13.0302 18.688L11.323 17.278Z" fill="#323232"/>
3
+ </svg>
@@ -7,38 +7,58 @@ exports.default = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _core = require("@material-ui/core");
10
- var _KeyboardArrowDownOutlined = _interopRequireDefault(require("@material-ui/icons/KeyboardArrowDownOutlined"));
10
+ var _icons = require("@material-ui/icons");
11
+ var _rightArrow = _interopRequireDefault(require("../assets/rightArrow.svg"));
12
+ var _leftArrow = _interopRequireDefault(require("../assets/leftArrow.svg"));
11
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
14
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
13
15
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
14
16
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
15
17
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
16
18
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
17
- const defaultTheme = {
18
- MuiTablePagination: {
19
- root: {
20
- paddingRight: '50px',
21
- borderTop: '3px solid #42779a'
22
- },
23
- toolbar: {
24
- minHeight: '45px'
25
- }
19
+ const useStyles = (0, _core.makeStyles)(() => ({
20
+ paginationRoot: {
21
+ display: 'flex',
22
+ justifyContent: 'flex-end',
23
+ // Moves pagination to the right
24
+ paddingRight: '10px' // Optional spacing
26
25
  },
27
- MuiTypography: {
28
- body2: {
29
- fontSize: '14px',
30
- textTransform: 'uppercase'
26
+
27
+ actionsContainer: {
28
+ display: 'flex',
29
+ justifyContent: 'flex-end' // Align pagination buttons to the right
30
+ }
31
+ }));
32
+
33
+ const defaultTheme = (0, _core.createMuiTheme)({
34
+ overrides: {
35
+ MuiTablePagination: {
36
+ root: {
37
+ paddingRight: '50px',
38
+ width: '100%'
39
+ },
40
+ toolbar: {
41
+ minHeight: '45px',
42
+ display: 'flex',
43
+ alignItems: 'center'
44
+ }
31
45
  },
32
- root: {
33
- fontSize: '14px'
34
- }
35
- },
36
- MuiIconButton: {
37
- root: {
38
- padding: '2px'
46
+ MuiTypography: {
47
+ body2: {
48
+ fontSize: '14px',
49
+ textTransform: 'uppercase'
50
+ },
51
+ root: {
52
+ fontSize: '14px'
53
+ }
54
+ },
55
+ MuiIconButton: {
56
+ root: {
57
+ padding: '2px'
58
+ }
39
59
  }
40
60
  }
41
- };
61
+ });
42
62
  const CustomPagination = _ref => {
43
63
  let {
44
64
  rowsPerPageOptions,
@@ -46,12 +66,12 @@ const CustomPagination = _ref => {
46
66
  rowsPerPage,
47
67
  page,
48
68
  onPageChange,
49
- onRowsPerPageChange,
50
- customTheme = {}
69
+ onRowsPerPageChange
51
70
  } = _ref;
71
+ const classes = useStyles();
52
72
  return /*#__PURE__*/_react.default.createElement(_core.ThemeProvider, {
53
- theme: (0, _core.createTheme)({
54
- overrides: _objectSpread(_objectSpread({}, defaultTheme), customTheme)
73
+ theme: (0, _core.createMuiTheme)({
74
+ overrides: _objectSpread({}, defaultTheme.overrides)
55
75
  })
56
76
  }, /*#__PURE__*/_react.default.createElement(_core.TablePagination, {
57
77
  labelRowsPerPage: "Results per Page:",
@@ -63,11 +83,40 @@ const CustomPagination = _ref => {
63
83
  onPageChange: onPageChange,
64
84
  onRowsPerPageChange: onRowsPerPageChange,
65
85
  SelectProps: {
66
- IconComponent: _KeyboardArrowDownOutlined.default,
86
+ IconComponent: _icons.ArrowDropDown,
67
87
  inputProps: {
68
88
  'aria-label': 'Selection dropdown for displaying the number of results per page'
69
89
  }
70
- }
90
+ },
91
+ nextIconButtonProps: {
92
+ 'aria-label': 'Next page'
93
+ },
94
+ backIconButtonProps: {
95
+ 'aria-label': 'Previous page'
96
+ },
97
+ ActionsComponent: () => /*#__PURE__*/_react.default.createElement("div", {
98
+ className: classes.actionsContainer
99
+ }, /*#__PURE__*/_react.default.createElement(_core.IconButton, {
100
+ onClick: event => onPageChange(event, page - 1),
101
+ disabled: page === 0,
102
+ "aria-label": "Previous page"
103
+ }, /*#__PURE__*/_react.default.createElement("img", {
104
+ src: _leftArrow.default,
105
+ style: {
106
+ opacity: page === 0 ? 0.2 : 1
107
+ },
108
+ alt: "Left Arrow"
109
+ })), /*#__PURE__*/_react.default.createElement(_core.IconButton, {
110
+ onClick: event => onPageChange(event, page + 1),
111
+ disabled: page >= Math.ceil(count / rowsPerPage) - 1,
112
+ "aria-label": "Next page"
113
+ }, /*#__PURE__*/_react.default.createElement("img", {
114
+ src: _rightArrow.default,
115
+ style: {
116
+ opacity: page >= Math.ceil(count / rowsPerPage) - 1 ? 0.2 : 1
117
+ },
118
+ alt: "Right Arrow"
119
+ })))
71
120
  }));
72
121
  };
73
122
  CustomPagination.propTypes = {
@@ -135,7 +135,8 @@ const DownloadButton = _ref => {
135
135
  border: '0.75px solid #606060',
136
136
  borderRadius: '5px',
137
137
  display: 'inline-block',
138
- position: 'relative'
138
+ position: 'relative',
139
+ alignSelf: 'center'
139
140
  },
140
141
  dropdownList: {
141
142
  display: 'block',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bento-core/table",
3
- "version": "1.0.0-c3dc.17",
3
+ "version": "1.0.0-c3dc.19",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "build": "npm run lint && cross-env-shell rm -rf dist && NODE_ENV=production BABEL_ENV=es babel src --out-dir dist --copy-files",
package/src/TableView.js CHANGED
@@ -28,7 +28,6 @@ const CustomTableContainer = (props) => {
28
28
  const downloadAreaStyle = {
29
29
  display: 'flex',
30
30
  borderTop: '1px solid #8A7F7C',
31
- borderBottom: '1px solid #8A7F7C',
32
31
  paddingRight: '41px',
33
32
  };
34
33
 
@@ -0,0 +1,3 @@
1
+ <svg width="13" height="6" viewBox="0 0 13 6" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M0.404297 0.937988L6.45817 5.93799L12.5121 0.937988H0.404297Z" fill="#CFCFCF"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="30" height="25" viewBox="0 0 30 25" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M19.4141 17.278L13.8687 12.688L19.4141 8.09799L17.7069 6.68799L10.4422 12.688L17.7069 18.688L19.4141 17.278Z" fill="#000"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="30" height="25" viewBox="0 0 30 25" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M11.323 17.278L16.8683 12.688L11.323 8.09799L13.0302 6.68799L20.2948 12.688L13.0302 18.688L11.323 17.278Z" fill="#323232"/>
3
+ </svg>
@@ -1,37 +1,59 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import {
4
- createTheme,
4
+ createMuiTheme,
5
5
  TablePagination,
6
6
  ThemeProvider,
7
+ IconButton,
8
+ makeStyles,
7
9
  } from '@material-ui/core';
8
- import KeyboardArrowDownOutlinedIcon from '@material-ui/icons/KeyboardArrowDownOutlined';
10
+ import {
11
+ ArrowDropDown,
12
+ } from '@material-ui/icons';
13
+ import rightArrow from '../assets/rightArrow.svg';
14
+ import leftArrow from '../assets/leftArrow.svg';
9
15
 
10
- const defaultTheme = {
11
- MuiTablePagination: {
12
- root: {
13
- paddingRight: '50px',
14
- borderTop: '3px solid #42779a',
15
- },
16
- toolbar: {
17
- minHeight: '45px',
18
- },
16
+ const useStyles = makeStyles(() => ({
17
+ paginationRoot: {
18
+ display: 'flex',
19
+ justifyContent: 'flex-end', // Moves pagination to the right
20
+ paddingRight: '10px', // Optional spacing
21
+ },
22
+ actionsContainer: {
23
+ display: 'flex',
24
+ justifyContent: 'flex-end', // Align pagination buttons to the right
19
25
  },
20
- MuiTypography: {
21
- body2: {
22
- fontSize: '14px',
23
- textTransform: 'uppercase',
26
+ }));
27
+
28
+ const defaultTheme = createMuiTheme({
29
+ overrides: {
30
+ MuiTablePagination: {
31
+ root: {
32
+ paddingRight: '50px',
33
+ width: '100%',
34
+ },
35
+ toolbar: {
36
+ minHeight: '45px',
37
+ display: 'flex',
38
+ alignItems: 'center',
39
+ },
24
40
  },
25
- root: {
26
- fontSize: '14px',
41
+ MuiTypography: {
42
+ body2: {
43
+ fontSize: '14px',
44
+ textTransform: 'uppercase',
45
+ },
46
+ root: {
47
+ fontSize: '14px',
48
+ },
27
49
  },
28
- },
29
- MuiIconButton: {
30
- root: {
31
- padding: '2px',
50
+ MuiIconButton: {
51
+ root: {
52
+ padding: '2px',
53
+ },
32
54
  },
33
55
  },
34
- };
56
+ });
35
57
 
36
58
  const CustomPagination = ({
37
59
  rowsPerPageOptions,
@@ -40,25 +62,53 @@ const CustomPagination = ({
40
62
  page,
41
63
  onPageChange,
42
64
  onRowsPerPageChange,
43
- customTheme = {},
44
- }) => (
45
- <ThemeProvider theme={createTheme({ overrides: { ...defaultTheme, ...customTheme } })}>
46
- <TablePagination
47
- labelRowsPerPage="Results per Page:"
48
- rowsPerPageOptions={rowsPerPageOptions}
49
- component="div"
50
- count={count}
51
- rowsPerPage={rowsPerPage}
52
- page={page}
53
- onPageChange={onPageChange}
54
- onRowsPerPageChange={onRowsPerPageChange}
55
- SelectProps={{
56
- IconComponent: KeyboardArrowDownOutlinedIcon,
57
- inputProps: { 'aria-label': 'Selection dropdown for displaying the number of results per page' },
58
- }}
59
- />
60
- </ThemeProvider>
61
- );
65
+ }) => {
66
+ const classes = useStyles();
67
+ return (
68
+ <ThemeProvider
69
+ theme={createMuiTheme({ overrides: { ...defaultTheme.overrides } })}
70
+ >
71
+ <TablePagination
72
+ labelRowsPerPage="Results per Page:"
73
+ rowsPerPageOptions={rowsPerPageOptions}
74
+ component="div"
75
+ count={count}
76
+ rowsPerPage={rowsPerPage}
77
+ page={page}
78
+ onPageChange={onPageChange}
79
+ onRowsPerPageChange={onRowsPerPageChange}
80
+ SelectProps={{
81
+ IconComponent: ArrowDropDown,
82
+ inputProps: { 'aria-label': 'Selection dropdown for displaying the number of results per page' },
83
+ }}
84
+ nextIconButtonProps={{
85
+ 'aria-label': 'Next page',
86
+ }}
87
+ backIconButtonProps={{
88
+ 'aria-label': 'Previous page',
89
+ }}
90
+ ActionsComponent={() => (
91
+ <div className={classes.actionsContainer}>
92
+ <IconButton
93
+ onClick={(event) => onPageChange(event, page - 1)}
94
+ disabled={page === 0}
95
+ aria-label="Previous page"
96
+ >
97
+ <img src={leftArrow} style={{ opacity: page === 0 ? 0.2 : 1 }} alt="Left Arrow" />
98
+ </IconButton>
99
+ <IconButton
100
+ onClick={(event) => onPageChange(event, page + 1)}
101
+ disabled={page >= Math.ceil(count / rowsPerPage) - 1}
102
+ aria-label="Next page"
103
+ >
104
+ <img src={rightArrow} style={{ opacity: page >= Math.ceil(count / rowsPerPage) - 1 ? 0.2 : 1 }} alt="Right Arrow" />
105
+ </IconButton>
106
+ </div>
107
+ )}
108
+ />
109
+ </ThemeProvider>
110
+ );
111
+ };
62
112
 
63
113
  CustomPagination.propTypes = {
64
114
  rowsPerPageOptions: PropTypes.arrayOf(PropTypes.number).isRequired,
@@ -147,6 +147,7 @@ const DownloadButton = ({
147
147
  borderRadius: '5px',
148
148
  display: 'inline-block',
149
149
  position: 'relative',
150
+ alignSelf: 'center',
150
151
  },
151
152
  dropdownList: {
152
153
  display: 'block',