@bento-core/table 1.0.1-ins.19 → 1.0.1-ins.20

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.
@@ -9,9 +9,12 @@ var _TableCell = _interopRequireDefault(require("@material-ui/core/TableCell"));
9
9
  var _TableSortLabel = _interopRequireDefault(require("@material-ui/core/TableSortLabel"));
10
10
  var _Tooltip = _interopRequireDefault(require("@material-ui/core/Tooltip"));
11
11
  var _Types = require("../util/Types");
12
+ require("./CustomHeaderCell.css");
12
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
14
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
14
15
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
16
+ // Import the CSS file
17
+
15
18
  /**
16
19
  *
17
20
  * @returns default/Link/Custom view
@@ -27,6 +30,7 @@ const CustomHeaderCell = _ref => {
27
30
  const {
28
31
  dataField,
29
32
  tooltipText,
33
+ // tooltipDefinition,
30
34
  header,
31
35
  headerType,
32
36
  customColHeaderRender
@@ -60,11 +64,14 @@ const CustomHeaderCell = _ref => {
60
64
  hideSortIcon: sortBy !== dataField,
61
65
  direction: sortBy === dataField ? sortOrder : 'asc',
62
66
  onClick: toggleSort
63
- }, headerType === _Types.headerTypes.CUSTOM_ELEM && customColHeaderRender ? customColHeaderRender(column) : header)), /*#__PURE__*/_react.default.createElement("img", {
67
+ }, headerType === _Types.headerTypes.CUSTOM_ELEM && customColHeaderRender ? customColHeaderRender(column) : header)), /*#__PURE__*/_react.default.createElement("div", {
68
+ className: "tooltip-icon"
69
+ }, /*#__PURE__*/_react.default.createElement("img", {
64
70
  src: "https://raw.githubusercontent.com/google/material-design-icons/master/src/action/help/materialicons/24px.svg",
65
- alt: "tooltipIcon",
66
- title: "TEST"
67
- }));
71
+ alt: "tooltipIcon"
72
+ }), /*#__PURE__*/_react.default.createElement("div", {
73
+ className: "tooltip-text"
74
+ }, "TEST")));
68
75
  };
69
76
  var _default = CustomHeaderCell;
70
77
  exports.default = _default;
@@ -0,0 +1,42 @@
1
+ .tooltip-icon {
2
+ position: relative;
3
+ display: inline-block;
4
+ }
5
+
6
+ .tooltip-text {
7
+ visibility: hidden;
8
+ width: 80px;
9
+ background-color: black;
10
+ color: #fff;
11
+ text-align: center;
12
+ border-radius: 6px;
13
+ padding: 5px 0;
14
+ position: absolute;
15
+ z-index: 1;
16
+ bottom: 125%;
17
+ /* Position the tooltip above the icon */
18
+ left: 50%;
19
+ margin-left: -40px;
20
+ /* Use half of the width to center it */
21
+ opacity: 0;
22
+ transition: opacity 0.3s;
23
+ }
24
+
25
+ .tooltip-text::after {
26
+ content: '';
27
+ position: absolute;
28
+ top: 100%;
29
+ /* At the bottom of the tooltip */
30
+ left: 50%;
31
+ margin-left: -5px;
32
+ border-width: 5px;
33
+ border-style: solid;
34
+ border-color: black transparent transparent transparent;
35
+ }
36
+
37
+ .tooltip-icon:hover .tooltip-text,
38
+ .tooltip-icon:focus .tooltip-text,
39
+ .tooltip-icon:active .tooltip-text {
40
+ visibility: visible;
41
+ opacity: 1;
42
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bento-core/table",
3
- "version": "1.0.1-ins.19",
3
+ "version": "1.0.1-ins.20",
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",
@@ -3,6 +3,7 @@ import TableCell from '@material-ui/core/TableCell';
3
3
  import TableSortLabel from '@material-ui/core/TableSortLabel';
4
4
  import MuiTooltip from '@material-ui/core/Tooltip';
5
5
  import { headerTypes } from '../util/Types';
6
+ import './CustomHeaderCell.css'; // Import the CSS file
6
7
 
7
8
  /**
8
9
  *
@@ -18,6 +19,7 @@ const CustomHeaderCell = ({
18
19
  const {
19
20
  dataField,
20
21
  tooltipText,
22
+ // tooltipDefinition,
21
23
  header,
22
24
  headerType,
23
25
  customColHeaderRender,
@@ -27,11 +29,7 @@ const CustomHeaderCell = ({
27
29
  // return custom tooltips
28
30
  if (components.Tooltip) {
29
31
  const CustomToolTip = components.Tooltip;
30
- return (
31
- <CustomToolTip>
32
- {children}
33
- </CustomToolTip>
34
- );
32
+ return <CustomToolTip>{children}</CustomToolTip>;
35
33
  }
36
34
  // return default tooltip
37
35
  if (tooltipText) {
@@ -63,7 +61,11 @@ const CustomHeaderCell = ({
63
61
  ? customColHeaderRender(column) : header}
64
62
  </TableSortLabel>
65
63
  </Tooltip>
66
- <img src="https://raw.githubusercontent.com/google/material-design-icons/master/src/action/help/materialicons/24px.svg" alt="tooltipIcon" title="TEST" />
64
+ <div className="tooltip-icon">
65
+ <img src="https://raw.githubusercontent.com/google/material-design-icons/master/src/action/help/materialicons/24px.svg" alt="tooltipIcon" />
66
+ {/* <div className="tooltip-text">{{ tooltipDefinition }}</div> */}
67
+ <div className="tooltip-text">TEST</div>
68
+ </div>
67
69
  </TableCell>
68
70
  );
69
71
  };
@@ -0,0 +1,42 @@
1
+ .tooltip-icon {
2
+ position: relative;
3
+ display: inline-block;
4
+ }
5
+
6
+ .tooltip-text {
7
+ visibility: hidden;
8
+ width: 80px;
9
+ background-color: black;
10
+ color: #fff;
11
+ text-align: center;
12
+ border-radius: 6px;
13
+ padding: 5px 0;
14
+ position: absolute;
15
+ z-index: 1;
16
+ bottom: 125%;
17
+ /* Position the tooltip above the icon */
18
+ left: 50%;
19
+ margin-left: -40px;
20
+ /* Use half of the width to center it */
21
+ opacity: 0;
22
+ transition: opacity 0.3s;
23
+ }
24
+
25
+ .tooltip-text::after {
26
+ content: '';
27
+ position: absolute;
28
+ top: 100%;
29
+ /* At the bottom of the tooltip */
30
+ left: 50%;
31
+ margin-left: -5px;
32
+ border-width: 5px;
33
+ border-style: solid;
34
+ border-color: black transparent transparent transparent;
35
+ }
36
+
37
+ .tooltip-icon:hover .tooltip-text,
38
+ .tooltip-icon:focus .tooltip-text,
39
+ .tooltip-icon:active .tooltip-text {
40
+ visibility: visible;
41
+ opacity: 1;
42
+ }