@chakra-ui/popper
Advanced tools
Comparing version 1.0.0-rc.8 to 1.0.0
@@ -6,13 +6,23 @@ # Change Log | ||
# 1.0.0-rc.8 (2020-10-29) | ||
# 1.0.0 (2020-11-13) | ||
**Note:** Version bump only for package @chakra-ui/popper | ||
### Bug Fixes | ||
* **toast:** allow custom render in update ([eb8bff9](https://github.com/chakra-ui/chakra-ui/commit/eb8bff911e6ec9de0165ab1e8f5ca10d5e022459)), closes [#2362](https://github.com/chakra-ui/chakra-ui/issues/2362) | ||
# 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.8 (2020-10-29) | ||
### Bug Fixes | ||
- **toast:** allow custom render in update | ||
([eb8bff9](https://github.com/chakra-ui/chakra-ui/commit/eb8bff911e6ec9de0165ab1e8f5ca10d5e022459)), | ||
closes [#2362](https://github.com/chakra-ui/chakra-ui/issues/2362) | ||
# Change Log | ||
@@ -19,0 +29,0 @@ |
@@ -12,6 +12,6 @@ "use strict"; | ||
var _dequal = require("dequal"); | ||
var React = _interopRequireWildcard(require("react")); | ||
var _dequal = require("dequal"); | ||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } | ||
@@ -101,3 +101,6 @@ | ||
(0, _hooks.useSafeLayoutEffect)(function () { | ||
if (referenceElement == null && popperElement == null) return; | ||
if (referenceElement == null || popperElement == null) { | ||
return; | ||
} | ||
var createPopper = options.createPopper || _core.createPopper; | ||
@@ -104,0 +107,0 @@ var popperInstance = createPopper(referenceElement, popperElement, popperOptions); |
@@ -10,6 +10,6 @@ "use strict"; | ||
var _popper = require("./popper.utils"); | ||
var _reactPopper = require("./react-popper"); | ||
var _popper = require("./popper.utils"); | ||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } | ||
@@ -44,3 +44,3 @@ | ||
arrowPadding = _props$arrowPadding === void 0 ? 4 : _props$arrowPadding, | ||
offset = _props.offset, | ||
offsetProp = _props.offset, | ||
matchWidth = _props.matchWidth, | ||
@@ -61,2 +61,4 @@ _props$modifiers = _props.modifiers, | ||
setArrowNode = _React$useState3[1]; | ||
var offset = offsetProp != null ? offsetProp : [0, gutter]; | ||
/** | ||
@@ -67,4 +69,3 @@ * recommended via popper docs | ||
var customMofidiers = React.useMemo(function () { | ||
var customModifiers = React.useMemo(function () { | ||
return [// @see https://popper.js.org/docs/v2/modifiers/offset/ | ||
@@ -138,3 +139,3 @@ { | ||
strategy: fixed ? "fixed" : "absolute", | ||
modifiers: customMofidiers.concat(modifiers) | ||
modifiers: customModifiers.concat(modifiers) | ||
}); | ||
@@ -146,9 +147,4 @@ /** | ||
React.useEffect(function () { | ||
var id = requestAnimationFrame(function () { | ||
popperJS.forceUpdate == null ? void 0 : popperJS.forceUpdate(); | ||
}); | ||
return function () { | ||
cancelAnimationFrame(id); | ||
}; | ||
}, []); | ||
popperJS.forceUpdate == null ? void 0 : popperJS.forceUpdate(); | ||
}); | ||
var finalPlacement = (_popperJS$state$place = (_popperJS$state = popperJS.state) == null ? void 0 : _popperJS$state.placement) != null ? _popperJS$state$place : placement; | ||
@@ -160,4 +156,3 @@ var arrowStyles = (0, _popper.getArrowStyles)({ | ||
}); | ||
var getReferenceProps = function getReferenceProps(props, _ref) { | ||
var getReferenceProps = React.useCallback(function (props, _ref) { | ||
if (props === void 0) { | ||
@@ -174,5 +169,4 @@ props = {}; | ||
}); | ||
}; | ||
var getPopperProps = function getPopperProps(props, _ref) { | ||
}, []); | ||
var getPopperProps = React.useCallback(function (props, _ref) { | ||
var _popperJS$styles; | ||
@@ -192,5 +186,4 @@ | ||
}); | ||
}; | ||
var getArrowWrapperProps = function getArrowWrapperProps(props, _ref) { | ||
}, [popperJS.attributes, popperJS.styles]); | ||
var getArrowWrapperProps = React.useCallback(function (props, _ref) { | ||
if (props === void 0) { | ||
@@ -208,5 +201,4 @@ props = {}; | ||
}); | ||
}; | ||
var getArrowProps = function getArrowProps(props, _ref) { | ||
}, [popperJS.attributes, arrowStyles]); | ||
var getArrowProps = React.useCallback(function (props, _ref) { | ||
if (props === void 0) { | ||
@@ -232,4 +224,3 @@ props = {}; | ||
}); | ||
}; | ||
}, [finalPlacement, arrowShadowColor]); | ||
return { | ||
@@ -236,0 +227,0 @@ transformOrigin: (0, _popper.toTransformOrigin)(finalPlacement), |
import { useSafeLayoutEffect } from "@chakra-ui/hooks"; | ||
import { fromEntries } from "@chakra-ui/utils"; | ||
import { createPopper as defaultCreatePopper } from "@popperjs/core"; | ||
import { dequal } from "dequal"; | ||
import * as React from "react"; | ||
import { dequal } from "dequal"; | ||
@@ -77,3 +77,6 @@ function resolve(obj, elements) { | ||
useSafeLayoutEffect(() => { | ||
if (referenceElement == null && popperElement == null) return; | ||
if (referenceElement == null || popperElement == null) { | ||
return; | ||
} | ||
var createPopper = options.createPopper || defaultCreatePopper; | ||
@@ -80,0 +83,0 @@ var popperInstance = createPopper(referenceElement, popperElement, popperOptions); |
@@ -5,4 +5,4 @@ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
import * as React from "react"; | ||
import { getArrowStyles, getBoxShadow, toTransformOrigin } from "./popper.utils"; | ||
import { usePopper as useBasePopper } from "./react-popper"; | ||
import { getArrowStyles, getBoxShadow, toTransformOrigin } from "./popper.utils"; | ||
export function usePopper(props) { | ||
@@ -24,3 +24,3 @@ var _popperJS$state$place, _popperJS$state; | ||
arrowPadding = 4, | ||
offset, | ||
offset: offsetProp, | ||
matchWidth, | ||
@@ -32,2 +32,3 @@ modifiers = [] | ||
var [arrowNode, setArrowNode] = React.useState(null); | ||
var offset = offsetProp != null ? offsetProp : [0, gutter]; | ||
/** | ||
@@ -38,3 +39,3 @@ * recommended via popper docs | ||
var customMofidiers = React.useMemo(() => [// @see https://popper.js.org/docs/v2/modifiers/offset/ | ||
var customModifiers = React.useMemo(() => [// @see https://popper.js.org/docs/v2/modifiers/offset/ | ||
{ | ||
@@ -116,3 +117,3 @@ name: "offset", | ||
strategy: fixed ? "fixed" : "absolute", | ||
modifiers: customMofidiers.concat(modifiers) | ||
modifiers: customModifiers.concat(modifiers) | ||
}); | ||
@@ -124,9 +125,4 @@ /** | ||
React.useEffect(() => { | ||
var id = requestAnimationFrame(() => { | ||
popperJS.forceUpdate == null ? void 0 : popperJS.forceUpdate(); | ||
}); | ||
return () => { | ||
cancelAnimationFrame(id); | ||
}; | ||
}, []); | ||
popperJS.forceUpdate == null ? void 0 : popperJS.forceUpdate(); | ||
}); | ||
var finalPlacement = (_popperJS$state$place = (_popperJS$state = popperJS.state) == null ? void 0 : _popperJS$state.placement) != null ? _popperJS$state$place : placement; | ||
@@ -138,4 +134,3 @@ var arrowStyles = getArrowStyles({ | ||
}); | ||
var getReferenceProps = function getReferenceProps(props, _ref) { | ||
var getReferenceProps = React.useCallback(function (props, _ref) { | ||
if (props === void 0) { | ||
@@ -152,5 +147,4 @@ props = {}; | ||
}); | ||
}; | ||
var getPopperProps = function getPopperProps(props, _ref) { | ||
}, []); | ||
var getPopperProps = React.useCallback(function (props, _ref) { | ||
var _popperJS$styles; | ||
@@ -170,5 +164,4 @@ | ||
}); | ||
}; | ||
var getArrowWrapperProps = function getArrowWrapperProps(props, _ref) { | ||
}, [popperJS.attributes, popperJS.styles]); | ||
var getArrowWrapperProps = React.useCallback(function (props, _ref) { | ||
if (props === void 0) { | ||
@@ -186,5 +179,4 @@ props = {}; | ||
}); | ||
}; | ||
var getArrowProps = function getArrowProps(props, _ref) { | ||
}, [popperJS.attributes, arrowStyles]); | ||
var getArrowProps = React.useCallback(function (props, _ref) { | ||
if (props === void 0) { | ||
@@ -210,4 +202,3 @@ props = {}; | ||
}); | ||
}; | ||
}, [finalPlacement, arrowShadowColor]); | ||
return { | ||
@@ -214,0 +205,0 @@ transformOrigin: toTransformOrigin(finalPlacement), |
import { PropGetter } from "@chakra-ui/utils"; | ||
import type { Modifier, Placement } from "@popperjs/core"; | ||
import { Modifier, Placement } from "@popperjs/core"; | ||
export type { Placement }; | ||
@@ -4,0 +4,0 @@ export interface UsePopperProps { |
{ | ||
"name": "@chakra-ui/popper", | ||
"version": "1.0.0-rc.8", | ||
"version": "1.0.0", | ||
"description": "A React component and hooks wrapper for popper.js", | ||
@@ -59,4 +59,4 @@ "keywords": [ | ||
"dependencies": { | ||
"@chakra-ui/hooks": "1.0.0-rc.8", | ||
"@chakra-ui/utils": "1.0.0-rc.8", | ||
"@chakra-ui/hooks": "1.0.0", | ||
"@chakra-ui/utils": "1.0.0", | ||
"@popperjs/core": "2.4.4", | ||
@@ -68,3 +68,3 @@ "dequal": "2.0.2" | ||
}, | ||
"gitHead": "de4cffb1638e8d10cd74515b0289d70eb94931be" | ||
"gitHead": "c98ca366cec7151fe7ea4e0b6f893088797c5398" | ||
} |
@@ -48,4 +48,4 @@ # Popper | ||
When add transitions to a popper component, it's usually advised to apply popper | ||
and transition to different elements. | ||
When add transitions to a popper component, it is usually advised to apply | ||
popper and transition to different elements. | ||
@@ -52,0 +52,0 @@ ```jsx |
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
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
90637
0
789
+ Added@chakra-ui/hooks@1.0.0(transitive)
+ Added@chakra-ui/utils@1.0.0(transitive)
- Removed@chakra-ui/hooks@1.0.0-rc.8(transitive)
- Removed@chakra-ui/utils@1.0.0-rc.8(transitive)
Updated@chakra-ui/hooks@1.0.0
Updated@chakra-ui/utils@1.0.0