UNPKG

1.78 kBJavaScriptView Raw
1"use strict";
2
3var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4var _typeof = require("@babel/runtime/helpers/typeof");
5Object.defineProperty(exports, "__esModule", {
6 value: true
7});
8exports.default = useHover;
9var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10var React = _interopRequireWildcard(require("react"));
11function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
12function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
13function useHover() {
14 var _React$useState = React.useState(-1),
15 _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
16 startRow = _React$useState2[0],
17 setStartRow = _React$useState2[1];
18 var _React$useState3 = React.useState(-1),
19 _React$useState4 = (0, _slicedToArray2.default)(_React$useState3, 2),
20 endRow = _React$useState4[0],
21 setEndRow = _React$useState4[1];
22 var onHover = React.useCallback(function (start, end) {
23 setStartRow(start);
24 setEndRow(end);
25 }, []);
26 return [startRow, endRow, onHover];
27}
\No newline at end of file