@chakra-ui/hooks
Advanced tools
Comparing version 1.0.0-rc.0 to 1.0.0-rc.1
@@ -6,2 +6,19 @@ # Change Log | ||
# [1.0.0-rc.1](https://github.com/chakra-ui/chakra-ui/compare/@chakra-ui/hooks@1.0.0-rc.0...@chakra-ui/hooks@1.0.0-rc.1) (2020-08-06) | ||
### Features | ||
- update popper hook and use-clipboard | ||
([2659f60](https://github.com/chakra-ui/chakra-ui/commit/2659f60b7d44815c7638d2bc03eb6a97ad7bc581)) | ||
### Performance Improvements | ||
- improve popper hook | ||
([d7ecb04](https://github.com/chakra-ui/chakra-ui/commit/d7ecb04baed8b6e6488321f7f2b28bed10a3a0d3)) | ||
# Change Log | ||
All notable changes to this project will be documented in this file. See | ||
[Conventional Commits](https://conventionalcommits.org) for commit guidelines. | ||
# [1.0.0-rc.0](https://github.com/chakra-ui/chakra-ui/compare/@chakra-ui/hooks@1.0.0-next.7...@chakra-ui/hooks@1.0.0-rc.0) (2020-07-26) | ||
@@ -8,0 +25,0 @@ |
@@ -137,2 +137,9 @@ "use strict"; | ||
}); | ||
var _useWhyUpdate = require("./use-why-update"); | ||
Object.keys(_useWhyUpdate).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
exports[key] = _useWhyUpdate[key]; | ||
}); | ||
//# sourceMappingURL=index.js.map |
@@ -6,3 +6,3 @@ "use strict"; | ||
var React = _interopRequireWildcard(require("react")); | ||
var _react = require("react"); | ||
@@ -13,6 +13,2 @@ var _copyToClipboard = _interopRequireDefault(require("copy-to-clipboard")); | ||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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; } | ||
/** | ||
@@ -29,11 +25,11 @@ * React hook to copy content to clipboard | ||
var _React$useState = React.useState(false), | ||
hasCopied = _React$useState[0], | ||
setHasCopied = _React$useState[1]; | ||
var _useState = (0, _react.useState)(false), | ||
hasCopied = _useState[0], | ||
setHasCopied = _useState[1]; | ||
var onCopy = React.useCallback(function () { | ||
var onCopy = (0, _react.useCallback)(function () { | ||
var didCopy = (0, _copyToClipboard["default"])(text); | ||
setHasCopied(didCopy); | ||
}, [text]); | ||
React.useEffect(function () { | ||
(0, _react.useEffect)(function () { | ||
if (hasCopied) { | ||
@@ -48,4 +44,8 @@ var id = setTimeout(function () { | ||
}, [timeout, hasCopied]); | ||
return [hasCopied, onCopy]; | ||
return { | ||
value: text, | ||
onCopy: onCopy, | ||
hasCopied: hasCopied | ||
}; | ||
} | ||
//# sourceMappingURL=use-clipboard.js.map |
@@ -6,21 +6,14 @@ "use strict"; | ||
var React = _interopRequireWildcard(require("react")); | ||
var _react = require("react"); | ||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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; } | ||
/** | ||
* React hook that returns a constant value. | ||
* It always returns the very first value passed to `initialState`, | ||
* React custom hook that returns the very first value passed to `initialState`, | ||
* even if it changes between re-renders. | ||
* | ||
* @param initialValue the initial value | ||
*/ | ||
function useConst(initialValue) { | ||
var _React$useState = React.useState(initialValue), | ||
value = _React$useState[0]; | ||
function useConst(initialState) { | ||
var _useState = (0, _react.useState)(initialState), | ||
sealed = _useState[0]; | ||
return value; | ||
return sealed; | ||
} | ||
//# sourceMappingURL=use-const.js.map |
@@ -20,2 +20,3 @@ export * from "./use-clipboard"; | ||
export * from "./use-event-callback"; | ||
export * from "./use-why-update"; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import * as React from "react"; | ||
import { useState, useCallback, useEffect } from "react"; | ||
import copy from "copy-to-clipboard"; | ||
@@ -15,8 +15,8 @@ /** | ||
var [hasCopied, setHasCopied] = React.useState(false); | ||
var onCopy = React.useCallback(() => { | ||
var [hasCopied, setHasCopied] = useState(false); | ||
var onCopy = useCallback(() => { | ||
var didCopy = copy(text); | ||
setHasCopied(didCopy); | ||
}, [text]); | ||
React.useEffect(() => { | ||
useEffect(() => { | ||
if (hasCopied) { | ||
@@ -29,4 +29,8 @@ var id = setTimeout(() => { | ||
}, [timeout, hasCopied]); | ||
return [hasCopied, onCopy]; | ||
return { | ||
value: text, | ||
onCopy, | ||
hasCopied | ||
}; | ||
} | ||
//# sourceMappingURL=use-clipboard.js.map |
@@ -1,14 +0,11 @@ | ||
import * as React from "react"; | ||
import { useState } from "react"; | ||
/** | ||
* React hook that returns a constant value. | ||
* It always returns the very first value passed to `initialState`, | ||
* React custom hook that returns the very first value passed to `initialState`, | ||
* even if it changes between re-renders. | ||
* | ||
* @param initialValue the initial value | ||
*/ | ||
export function useConst(initialValue) { | ||
var [value] = React.useState(initialValue); | ||
return value; | ||
export function useConst(initialState) { | ||
var [sealed] = useState(initialState); | ||
return sealed; | ||
} | ||
//# sourceMappingURL=use-const.js.map |
@@ -20,1 +20,2 @@ export * from "./use-clipboard"; | ||
export * from "./use-event-callback"; | ||
export * from "./use-why-update"; |
@@ -7,2 +7,6 @@ /** | ||
*/ | ||
export declare function useClipboard(text: string, timeout?: number): readonly [boolean, () => void]; | ||
export declare function useClipboard(text: string, timeout?: number): { | ||
value: string; | ||
onCopy: () => void; | ||
hasCopied: boolean; | ||
}; |
@@ -1,10 +0,6 @@ | ||
declare type InitialValue<T> = T | (() => T); | ||
export declare type SealedInitialState<T> = T | (() => T); | ||
/** | ||
* React hook that returns a constant value. | ||
* It always returns the very first value passed to `initialState`, | ||
* React custom hook that returns the very first value passed to `initialState`, | ||
* even if it changes between re-renders. | ||
* | ||
* @param initialValue the initial value | ||
*/ | ||
export declare function useConst<T>(initialValue: InitialValue<T>): T; | ||
export {}; | ||
export declare function useConst<T>(initialState: SealedInitialState<T>): T; |
{ | ||
"name": "@chakra-ui/hooks", | ||
"version": "1.0.0-rc.0", | ||
"version": "1.0.0-rc.1", | ||
"description": "React hooks for Chakra components", | ||
@@ -47,3 +47,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@chakra-ui/utils": "1.0.0-rc.0", | ||
"@chakra-ui/utils": "1.0.0-rc.1", | ||
"@reach/auto-id": "0.10.5", | ||
@@ -56,3 +56,3 @@ "compute-scroll-into-view": "1.0.14", | ||
}, | ||
"gitHead": "60392008d42867da38211687e2491f02da9975a9" | ||
"gitHead": "e0470c73a9f6be24525dc5458d6fb157096b5ae3" | ||
} |
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
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
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
159991
109
1707
1
+ Added@chakra-ui/utils@1.0.0-rc.1(transitive)
- Removed@chakra-ui/utils@1.0.0-rc.0(transitive)
Updated@chakra-ui/utils@1.0.0-rc.1