@bento-core/table 1.0.1-CDS.1 → 1.0.1-CDS.3

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.
@@ -21,7 +21,10 @@ const CheckboxView = _ref => {
21
21
  }, /*#__PURE__*/_react.default.createElement(_core.Checkbox, {
22
22
  disableRipple: true,
23
23
  onClick: event => onRowSelectChange(event, row),
24
- checked: row.isChecked
24
+ checked: row.isChecked,
25
+ inputProps: {
26
+ 'aria-label': 'checkbox'
27
+ }
25
28
  })));
26
29
  };
27
30
  var _default = CheckboxView;
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _core = require("@material-ui/core");
9
+ var _Tooltip = _interopRequireDefault(require("@material-ui/core/Tooltip"));
9
10
  var _icons = require("@material-ui/icons");
10
11
  var _RemoveAllDialog = _interopRequireDefault(require("./RemoveAllDialog"));
11
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -16,6 +17,7 @@ const TooltipContent = () => /*#__PURE__*/_react.default.createElement(_core.Typ
16
17
  }, ' ', "Remove", ' ', /*#__PURE__*/_react.default.createElement("b", null, "All"), ' ', "items in cart.", ' ');
17
18
  const DeleteCellView = _ref => {
18
19
  let {
20
+ classes,
19
21
  column,
20
22
  count,
21
23
  onDeleteAllFiles
@@ -25,12 +27,34 @@ const DeleteCellView = _ref => {
25
27
  const {
26
28
  customColHeaderRender
27
29
  } = column;
30
+ const CustomTooltip = (0, _react.useCallback)(_ref2 => {
31
+ let {
32
+ children
33
+ } = _ref2;
34
+ // return custom tooltips
35
+ if (column && column.Tooltip) {
36
+ const CustomToolTip = column.Tooltip;
37
+ return /*#__PURE__*/_react.default.createElement(CustomToolTip, null, children);
38
+ }
39
+ // return default tooltip
40
+ if (column && column.tooltipText) {
41
+ return /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
42
+ id: "header-tooltip",
43
+ title: column.tooltipText
44
+ }, children);
45
+ }
46
+ // return default view
47
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children);
48
+ }, [column]);
28
49
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.TableCell, {
29
50
  scope: "col",
30
51
  className: "del_all_row"
31
- }, customColHeaderRender ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, customColHeaderRender(toggleDialogDisplay)) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.Typography, {
32
- className: "del_all_row_text"
33
- }, "Remove"), /*#__PURE__*/_react.default.createElement(_core.Tooltip, {
52
+ }, customColHeaderRender ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, customColHeaderRender(toggleDialogDisplay)) : /*#__PURE__*/_react.default.createElement("span", {
53
+ className: classes.cellContentWrapper
54
+ }, /*#__PURE__*/_react.default.createElement(CustomTooltip, null, /*#__PURE__*/_react.default.createElement(_core.Typography, {
55
+ component: "span",
56
+ className: "del_all_row_text ".concat(classes.delAllRowText)
57
+ }, "Remove")), /*#__PURE__*/_react.default.createElement(_core.Tooltip, {
34
58
  id: "del_all_row_tooltip",
35
59
  className: "del_all_row_tooltip",
36
60
  title: TooltipContent(),
@@ -49,5 +73,17 @@ const DeleteCellView = _ref => {
49
73
  onDeleteAllFiles: onDeleteAllFiles
50
74
  })));
51
75
  };
52
- var _default = DeleteCellView;
76
+ const styles = () => ({
77
+ cellContentWrapper: {
78
+ display: 'inline-flex',
79
+ width: '100%',
80
+ height: '100%',
81
+ justifyContent: 'flex-start',
82
+ alignItems: 'center'
83
+ },
84
+ delAllRowText: {
85
+ lineHeight: '24px'
86
+ }
87
+ });
88
+ var _default = (0, _core.withStyles)(styles)(DeleteCellView);
53
89
  exports.default = _default;
@@ -59,7 +59,12 @@ const CustomPagination = _ref => {
59
59
  rowsPerPage: rowsPerPage,
60
60
  page: page,
61
61
  onPageChange: onPageChange,
62
- onRowsPerPageChange: onRowsPerPageChange
62
+ onRowsPerPageChange: onRowsPerPageChange,
63
+ SelectProps: {
64
+ inputProps: {
65
+ 'aria-label': 'rows per page dropdown selector'
66
+ }
67
+ }
63
68
  }));
64
69
  };
65
70
  CustomPagination.propTypes = {
@@ -65,7 +65,10 @@ const ManageColumnView = _ref => {
65
65
  }),
66
66
  disableRipple: true,
67
67
  color: "secondary",
68
- className: "checkBox"
68
+ className: "checkBox",
69
+ inputProps: {
70
+ 'aria-label': 'checkbox'
71
+ }
69
72
  }), column.icon && /*#__PURE__*/_react.default.createElement("img", {
70
73
  src: column.icon,
71
74
  alt: column.header,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bento-core/table",
3
- "version": "1.0.1-CDS.1",
3
+ "version": "1.0.1-CDS.3",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -27,5 +27,5 @@
27
27
  },
28
28
  "author": "CTOS Bento Team",
29
29
  "license": "ISC",
30
- "gitHead": "7da350e271a629e43c5cecf1b7c5db44d2270f40"
30
+ "gitHead": "ee71f939cd2c6122cd70064016b80e984ee8db37"
31
31
  }
@@ -23,6 +23,7 @@ const CheckboxView = ({
23
23
  disableRipple
24
24
  onClick={(event) => onRowSelectChange(event, row)}
25
25
  checked={row.isChecked}
26
+ inputProps={{ 'aria-label': 'checkbox' }}
26
27
  />
27
28
  </TableCell>
28
29
  )
@@ -1,10 +1,12 @@
1
- import React, { useState } from 'react';
1
+ import React, { useCallback, useState } from 'react';
2
2
  import {
3
3
  TableCell,
4
4
  Typography,
5
5
  IconButton,
6
6
  Tooltip,
7
+ withStyles,
7
8
  } from '@material-ui/core';
9
+ import MuiTooltip from '@material-ui/core/Tooltip';
8
10
  import {
9
11
  ArrowDropDown as ArrowDropDownIcon,
10
12
  } from '@material-ui/icons';
@@ -23,6 +25,7 @@ const TooltipContent = () => (
23
25
  );
24
26
 
25
27
  const DeleteCellView = ({
28
+ classes,
26
29
  column,
27
30
  count,
28
31
  onDeleteAllFiles,
@@ -30,6 +33,29 @@ const DeleteCellView = ({
30
33
  const [displayDialog, setDisplay] = useState(false);
31
34
  const toggleDialogDisplay = () => setDisplay(!displayDialog);
32
35
  const { customColHeaderRender } = column;
36
+
37
+ const CustomTooltip = useCallback(({ children }) => {
38
+ // return custom tooltips
39
+ if (column && column.Tooltip) {
40
+ const CustomToolTip = column.Tooltip;
41
+ return (
42
+ <CustomToolTip>
43
+ {children}
44
+ </CustomToolTip>
45
+ );
46
+ }
47
+ // return default tooltip
48
+ if (column && column.tooltipText) {
49
+ return (
50
+ <MuiTooltip id="header-tooltip" title={column.tooltipText}>
51
+ {children}
52
+ </MuiTooltip>
53
+ );
54
+ }
55
+ // return default view
56
+ return <>{children}</>;
57
+ }, [column]);
58
+
33
59
  return (
34
60
  <>
35
61
  <TableCell
@@ -42,10 +68,12 @@ const DeleteCellView = ({
42
68
  {customColHeaderRender(toggleDialogDisplay)}
43
69
  </>
44
70
  ) : (
45
- <>
46
- <Typography className="del_all_row_text">
47
- Remove
48
- </Typography>
71
+ <span className={classes.cellContentWrapper}>
72
+ <CustomTooltip>
73
+ <Typography component="span" className={`del_all_row_text ${classes.delAllRowText}`}>
74
+ Remove
75
+ </Typography>
76
+ </CustomTooltip>
49
77
  <Tooltip
50
78
  id="del_all_row_tooltip"
51
79
  className="del_all_row_tooltip"
@@ -59,7 +87,7 @@ const DeleteCellView = ({
59
87
  />
60
88
  </IconButton>
61
89
  </Tooltip>
62
- </>
90
+ </span>
63
91
  )
64
92
  }
65
93
  <RemoveAllDialogView
@@ -74,4 +102,17 @@ const DeleteCellView = ({
74
102
  );
75
103
  };
76
104
 
77
- export default DeleteCellView;
105
+ const styles = () => ({
106
+ cellContentWrapper: {
107
+ display: 'inline-flex',
108
+ width: '100%',
109
+ height: '100%',
110
+ justifyContent: 'flex-start',
111
+ alignItems: 'center',
112
+ },
113
+ delAllRowText: {
114
+ lineHeight: '24px',
115
+ },
116
+ });
117
+
118
+ export default withStyles(styles)(DeleteCellView);
@@ -50,6 +50,7 @@ const CustomPagination = ({
50
50
  page={page}
51
51
  onPageChange={onPageChange}
52
52
  onRowsPerPageChange={onRowsPerPageChange}
53
+ SelectProps={{ inputProps: { 'aria-label': 'rows per page dropdown selector' } }}
53
54
  />
54
55
  </ThemeProvider>
55
56
  );
@@ -87,6 +87,7 @@ const ManageColumnView = ({
87
87
  disableRipple
88
88
  color="secondary"
89
89
  className="checkBox"
90
+ inputProps={{ 'aria-label': 'checkbox' }}
90
91
  />
91
92
  {column.icon && (
92
93
  <img src={column.icon} alt={column.header} className={column.dataField} />