@bento-core/table 1.0.1-CDS.1 → 1.0.1-CDS.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.
@@ -61,7 +61,9 @@ const ViewCell = _ref2 => {
61
61
  column: column
62
62
  });
63
63
  default:
64
- return /*#__PURE__*/_react.default.createElement(_core.Typography, null, row[column.dataField]);
64
+ return /*#__PURE__*/_react.default.createElement(_core.Typography, null, typeof row[column.dataField] === 'number' ? Intl.NumberFormat('en-US', {
65
+ maximumFractionDigits: 0
66
+ }).format(row[column.dataField]) : row[column.dataField]);
65
67
  }
66
68
  };
67
69
  const DisplayCell = _ref3 => {
@@ -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;
@@ -23,6 +23,7 @@ const DeleteCellView = _ref => {
23
23
  }, customCellRender ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, customCellRender(row, onDeleteRow)) : /*#__PURE__*/_react.default.createElement(_core.IconButton, {
24
24
  disableRipple: true,
25
25
  className: "del_row_btn",
26
+ "aria-label": "Delete row",
26
27
  onClick: () => column.cellEventHandler(row)
27
28
  }, /*#__PURE__*/_react.default.createElement(_icons.DeleteOutline, {
28
29
  className: "del_row_btn_icon",
@@ -69,7 +69,7 @@ const defaultTheme = () => ({
69
69
  width: '133px',
70
70
  height: '45px',
71
71
  cursor: 'pointer',
72
- background: '#98a19e'
72
+ background: '#6E7776'
73
73
  },
74
74
  '&.cancelBtn': {
75
75
  width: '133px',
@@ -16,12 +16,19 @@ const CheckboxView = _ref => {
16
16
  return /*#__PURE__*/_react.default.createElement(_core.TableCell, {
17
17
  padding: "checkbox"
18
18
  }, /*#__PURE__*/_react.default.createElement(_core.FormControlLabel, {
19
- control: /*#__PURE__*/_react.default.createElement(_core.Checkbox, {
19
+ control: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
20
+ style: {
21
+ display: 'none'
22
+ }
23
+ }, "select all checkbox"), /*#__PURE__*/_react.default.createElement(_core.Checkbox, {
20
24
  color: "primary",
21
25
  indeterminate: includeSelectedIds,
22
26
  checked: includeSelectedIds,
23
- onChange: event => toggleSelectAll(event, Ids, includeSelectedIds)
24
- })
27
+ onChange: event => toggleSelectAll(event, Ids, includeSelectedIds),
28
+ inputProps: {
29
+ 'aria-label': 'select all checkbox'
30
+ }
31
+ }))
25
32
  }));
26
33
  };
27
34
  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;
@@ -22,10 +22,12 @@ function RemoveAllDialogView(props) {
22
22
  };
23
23
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.Dialog, {
24
24
  open: open,
25
- "aria-labelledby": "alert-dialog-title",
26
25
  "aria-describedby": "alert-dialog-description"
27
26
  }, /*#__PURE__*/_react.default.createElement(_core.DialogContent, null, /*#__PURE__*/_react.default.createElement(_core.DialogContentText, {
28
- id: "alert-dialog-description"
27
+ id: "alert-dialog-description",
28
+ style: {
29
+ color: 'black'
30
+ }
29
31
  }, "Remove", ' ', /*#__PURE__*/_react.default.createElement("b", null, "All files", ' (', count, ') '), "From Cart")), /*#__PURE__*/_react.default.createElement(_core.DialogActions, null, /*#__PURE__*/_react.default.createElement(_core.Button, {
30
32
  className: "okBtn",
31
33
  onClick: deleteAllFiles
@@ -59,7 +59,29 @@ const CustomPagination = _ref => {
59
59
  rowsPerPage: rowsPerPage,
60
60
  page: page,
61
61
  onPageChange: onPageChange,
62
- onRowsPerPageChange: onRowsPerPageChange
62
+ onRowsPerPageChange: onRowsPerPageChange,
63
+ labelRowsPerPage: /*#__PURE__*/_react.default.createElement("span", {
64
+ id: "rows-per-page-label"
65
+ }, "Rows per page:"),
66
+ labelDisplayedRows: _ref2 => {
67
+ let {
68
+ from,
69
+ to,
70
+ count: muiCount
71
+ } = _ref2;
72
+ return "".concat(from, "\u2013").concat(to, " OF ").concat(muiCount !== -1 ? Intl.NumberFormat('en-US', {
73
+ maximumFractionDigits: 0
74
+ }).format(muiCount || 0) : "more than ".concat(to));
75
+ },
76
+ SelectProps: {
77
+ inputProps: {
78
+ 'aria-label': 'rows per page dropdown selector',
79
+ 'aria-labelledby': 'rows-per-page-label',
80
+ style: {
81
+ visibility: 'hidden'
82
+ }
83
+ }
84
+ }
63
85
  }));
64
86
  };
65
87
  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.10",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -13,7 +13,7 @@
13
13
  "access": "public"
14
14
  },
15
15
  "dependencies": {
16
- "@bento-core/util": "^1.0.0"
16
+ "@bento-core/util": "^1.0.1-CDS.0"
17
17
  },
18
18
  "peerDependencies": {
19
19
  "@apollo/client": "^3.6.9",
@@ -27,5 +27,5 @@
27
27
  },
28
28
  "author": "CTOS Bento Team",
29
29
  "license": "ISC",
30
- "gitHead": "7da350e271a629e43c5cecf1b7c5db44d2270f40"
30
+ "gitHead": "2f8251eb1f659f347dcb60824e9d986b91a6be7e"
31
31
  }
@@ -32,33 +32,35 @@ const ViewCell = ({
32
32
  }) => {
33
33
  const { cellType } = column;
34
34
  switch (cellType) {
35
- case cellTypes.FORMAT_DATA:
36
- return (
37
- <DataFormatView
38
- row={row}
39
- column={column}
40
- />
41
- );
42
- case cellTypes.LINK:
43
- return (
44
- <CustomLinkView
45
- row={row}
46
- column={column}
47
- />
48
- );
49
- case cellTypes.CUSTOM_ELEM:
50
- return (
51
- <CustomComponent
52
- row={row}
53
- column={column}
54
- />
55
- );
56
- default:
57
- return (
58
- <Typography>
59
- {row[column.dataField]}
60
- </Typography>
61
- );
35
+ case cellTypes.FORMAT_DATA:
36
+ return (
37
+ <DataFormatView
38
+ row={row}
39
+ column={column}
40
+ />
41
+ );
42
+ case cellTypes.LINK:
43
+ return (
44
+ <CustomLinkView
45
+ row={row}
46
+ column={column}
47
+ />
48
+ );
49
+ case cellTypes.CUSTOM_ELEM:
50
+ return (
51
+ <CustomComponent
52
+ row={row}
53
+ column={column}
54
+ />
55
+ );
56
+ default:
57
+ return (
58
+ <Typography>
59
+ {typeof row[column.dataField] === 'number'
60
+ ? Intl.NumberFormat('en-US', { maximumFractionDigits: 0 }).format(row[column.dataField])
61
+ : row[column.dataField]}
62
+ </Typography>
63
+ );
62
64
  }
63
65
  };
64
66
 
@@ -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
  )
@@ -14,18 +14,18 @@ const CellView = ({
14
14
  const { dataFormatType } = column;
15
15
  const value = row[column?.dataField];
16
16
  switch (dataFormatType) {
17
- case dataFormatTypes.FORMAT_BYTES:
18
- return (
19
- <Typography>
20
- {formatBytes(value)}
21
- </Typography>
22
- );
23
- default:
24
- return (
25
- <Typography>
26
- {value}
27
- </Typography>
28
- );
17
+ case dataFormatTypes.FORMAT_BYTES:
18
+ return (
19
+ <Typography>
20
+ {formatBytes(value)}
21
+ </Typography>
22
+ );
23
+ default:
24
+ return (
25
+ <Typography>
26
+ {value}
27
+ </Typography>
28
+ );
29
29
  }
30
30
  };
31
31
 
@@ -27,6 +27,7 @@ const DeleteCellView = ({
27
27
  <IconButton
28
28
  disableRipple
29
29
  className="del_row_btn"
30
+ aria-label="Delete row"
30
31
  onClick={() => column.cellEventHandler(row)}
31
32
  >
32
33
  <DeleteOutlineIcon
@@ -63,7 +63,7 @@ const defaultTheme = () => ({
63
63
  width: '133px',
64
64
  height: '45px',
65
65
  cursor: 'pointer',
66
- background: '#98a19e',
66
+ background: '#6E7776',
67
67
  },
68
68
  '&.cancelBtn': {
69
69
  width: '133px',
@@ -13,12 +13,16 @@ const CheckboxView = ({
13
13
  <TableCell padding="checkbox">
14
14
  <FormControlLabel
15
15
  control={(
16
- <Checkbox
17
- color="primary"
18
- indeterminate={includeSelectedIds}
19
- checked={includeSelectedIds}
20
- onChange={(event) => toggleSelectAll(event, Ids, includeSelectedIds)}
21
- />
16
+ <>
17
+ <span style={{ display: 'none' }}>select all checkbox</span>
18
+ <Checkbox
19
+ color="primary"
20
+ indeterminate={includeSelectedIds}
21
+ checked={includeSelectedIds}
22
+ onChange={(event) => toggleSelectAll(event, Ids, includeSelectedIds)}
23
+ inputProps={{ 'aria-label': 'select all checkbox' }}
24
+ />
25
+ </>
22
26
  )}
23
27
  />
24
28
  </TableCell>
@@ -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);
@@ -24,11 +24,10 @@ function RemoveAllDialogView(props) {
24
24
  <>
25
25
  <Dialog
26
26
  open={open}
27
- aria-labelledby="alert-dialog-title"
28
27
  aria-describedby="alert-dialog-description"
29
28
  >
30
29
  <DialogContent>
31
- <DialogContentText id="alert-dialog-description">
30
+ <DialogContentText id="alert-dialog-description" style={{ color: 'black' }}>
32
31
  Remove
33
32
  {' '}
34
33
  <b>
@@ -50,6 +50,21 @@ const CustomPagination = ({
50
50
  page={page}
51
51
  onPageChange={onPageChange}
52
52
  onRowsPerPageChange={onRowsPerPageChange}
53
+ labelRowsPerPage={<span id="rows-per-page-label">Rows per page:</span>}
54
+ labelDisplayedRows={({ from, to, count: muiCount }) => `${from}–${to} OF ${
55
+ muiCount !== -1
56
+ ? Intl.NumberFormat('en-US', { maximumFractionDigits: 0 }).format(muiCount || 0)
57
+ : `more than ${to}`
58
+ }`}
59
+ SelectProps={{
60
+ inputProps: {
61
+ 'aria-label': 'rows per page dropdown selector',
62
+ 'aria-labelledby': 'rows-per-page-label',
63
+ style: {
64
+ visibility: 'hidden',
65
+ },
66
+ },
67
+ }}
53
68
  />
54
69
  </ThemeProvider>
55
70
  );
@@ -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} />