Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-konva-grid

Package Overview
Dependencies
Maintainers
1
Versions
146
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-konva-grid - npm Package Compare versions

Comparing version 2.7.0 to 2.7.1

6

dist/hooks/useTooltip.d.ts
import React from "react";
import { CellInterface, GridRef } from "../Grid";
export interface TooltipOptions {
getTooltipComponent?: (cell?: CellInterface | null) => React.ElementType;
component?: React.FC<TooltipProps> | React.ComponentClass<TooltipProps>;
gridRef: React.MutableRefObject<GridRef>;

@@ -9,3 +9,3 @@ getValue: (cell: CellInterface) => any;

export interface TooltipResults {
tooltipComponent: React.ReactNode;
tooltipComponent: React.ReactElement | null;
onMouseMove: (e: React.MouseEvent<HTMLInputElement>) => void;

@@ -19,3 +19,3 @@ onMouseLeave: (e: React.MouseEvent<HTMLInputElement>) => void;

}
declare const useTooltip: ({ getValue, gridRef, getTooltipComponent, }: TooltipOptions) => TooltipResults;
declare const useTooltip: ({ getValue, gridRef, component: Component, }: TooltipOptions) => TooltipResults;
export default useTooltip;

@@ -23,3 +23,3 @@ "use strict";

const react_1 = __importStar(require("react"));
const defaultTooltipComponent = ({ content, x, y }) => {
const DefaultTooltipComponent = ({ content, x, y }) => {
const offset = 10;

@@ -38,4 +38,3 @@ return (react_1.default.createElement("div", { style: {

};
const getDefaultTooltipComponent = () => defaultTooltipComponent;
const useTooltip = ({ getValue, gridRef, getTooltipComponent = getDefaultTooltipComponent, }) => {
const useTooltip = ({ getValue, gridRef, component: Component = DefaultTooltipComponent, }) => {
const [activeCell, setActiveCell] = react_1.useState(null);

@@ -45,4 +44,8 @@ const [tooltipPosition, setTooltipPosition] = react_1.useState({ x: 0, y: 0 });

const showTooltip = activeCell && content !== null;
const Tooltip = react_1.useMemo(() => getTooltipComponent(activeCell), [activeCell]);
const tooltipComponent = showTooltip ? (react_1.default.createElement(Tooltip, { content: content, x: tooltipPosition.x, y: tooltipPosition.y })) : null;
const tooltipProps = {
content,
x: tooltipPosition.x,
y: tooltipPosition.y,
};
const tooltipComponent = showTooltip ? react_1.default.createElement(Component, Object.assign({}, tooltipProps)) : null;
const handleMouseMove = react_1.useCallback((e) => {

@@ -49,0 +52,0 @@ const { rowIndex, columnIndex } = gridRef.current.getCellCoordsFromOffset(e.clientX, e.clientY);

{
"name": "react-konva-grid",
"description": "Declarative React Canvas Grid primitive for Data table, Pivot table, Excel Worksheets",
"version": "2.7.0",
"version": "2.7.1",
"main": "dist/index.js",

@@ -6,0 +6,0 @@ "license": "MIT",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc