react-eyedrop
Advanced tools
Comparing version 5.3.2 to 5.4.0
@@ -8,3 +8,3 @@ "use strict"; | ||
const elementToCanvas_1 = require("./elementToCanvas"); | ||
const html2canvas = _html2canvas; | ||
const html2canvas = _html2canvas.default; | ||
const targetToCanvas = (target) => { | ||
@@ -11,0 +11,0 @@ if (!(target instanceof HTMLElement)) { |
@@ -16,2 +16,5 @@ export declare type RgbObj = { | ||
cursorInactive?: string; | ||
onPickStart?: () => void; | ||
onPickEnd?: () => void; | ||
onPickCancel?: () => void; | ||
}; | ||
@@ -18,0 +21,0 @@ export declare type PickingMode = { |
@@ -7,3 +7,3 @@ import { HookOptions } from './types'; | ||
declare type ReturnValue = [typeof initialStateColors, () => void, () => void]; | ||
export declare const useEyeDrop: ({ once, pickRadius, cursorActive, cursorInactive, }?: HookOptions) => ReturnValue; | ||
export declare const useEyeDrop: ({ once, pickRadius, cursorActive, cursorInactive, onPickStart, onPickEnd, onPickCancel, }?: HookOptions) => ReturnValue; | ||
export {}; |
@@ -21,9 +21,15 @@ "use strict"; | ||
const initialStateColors = { rgb: '', hex: '' }; | ||
const useEyeDrop = ({ once, pickRadius, cursorActive = 'copy', cursorInactive = 'auto', } = {}) => { | ||
const useEyeDrop = ({ once, pickRadius, cursorActive = 'copy', cursorInactive = 'auto', onPickStart, onPickEnd, onPickCancel, } = {}) => { | ||
const [colors, setColors] = useState(initialStateColors); | ||
const [pickingColorFromDocument, setPickingColorFromDocument] = useState(false); | ||
const pickColor = () => { | ||
if (onPickStart) { | ||
onPickStart(); | ||
} | ||
setPickingColorFromDocument(true); | ||
}; | ||
const cancelPickColor = () => { | ||
if (onPickCancel) { | ||
onPickCancel(); | ||
} | ||
setPickingColorFromDocument(false); | ||
@@ -47,2 +53,5 @@ }; | ||
once && setPickingColorFromDocument(false); | ||
if (onPickEnd) { | ||
onPickEnd(); | ||
} | ||
}), [once, setPickingColorFromDocument]); | ||
@@ -49,0 +58,0 @@ useEffect(() => { |
{ | ||
"name": "react-eyedrop", | ||
"version": "5.3.2", | ||
"version": "5.4.0", | ||
"description": "A reusable ColorPick EyeDropper written in React & TypeScript.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -262,3 +262,6 @@ # React EyeDrop | ||
cursorActive: CSS Cursors, | ||
cursorInactive: CSS Cursors | ||
cursorInactive: CSS Cursors, | ||
onPickStart?: () => void | ||
onPickEnd?: () => void | ||
onPickCancel?: () => void | ||
}) | ||
@@ -265,0 +268,0 @@ ``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35878
585
346