UNPKG

@yamada-ui/react

Version:

React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion

31 lines (27 loc) 953 B
"use client"; const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs'); const require_effect = require('../../utils/effect.cjs'); let react = require("react"); react = require_rolldown_runtime.__toESM(react); //#region src/hooks/use-eye-dropper/index.ts /** * `useEyeDropper` is a custom hook that opens the eye dropper tool and returns the color value. * * @see https://yamada-ui.com/docs/hooks/use-eye-dropper */ const useEyeDropper = () => { const [supported, setSupported] = (0, react.useState)(false); require_effect.useSafeLayoutEffect(() => { setSupported(typeof window !== "undefined" && "EyeDropper" in window); }, []); return { supported, onOpen: (0, react.useCallback)(async (options = {}) => { if (supported) return new window.EyeDropper().open(options); return Promise.resolve(void 0); }, [supported]) }; }; //#endregion exports.useEyeDropper = useEyeDropper; //# sourceMappingURL=index.cjs.map