@atlaskit/layer
Advanced tools
Comparing version 9.0.4 to 9.0.5
# @atlaskit/layer | ||
## 9.0.5 | ||
### Patch Changes | ||
- [`e0460d5d989`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e0460d5d989) - Usages of `process` are now guarded by a `typeof` check. | ||
## 9.0.4 | ||
@@ -4,0 +10,0 @@ |
@@ -64,17 +64,14 @@ "use strict"; | ||
exports.POSITION_ATTRIBUTE_ENUM = POSITION_ATTRIBUTE_ENUM; | ||
function positionToPopper(position) { | ||
return position && positionMap[position] ? positionMap[position].position : null; | ||
} | ||
/* Convert the autoFlip property into the array format that Popper expects. | ||
* The first item must not include the edge-position variation, or Popper will not understand it. | ||
*/ | ||
function getFlipBehavior(props) { | ||
return props.position && Array.isArray(props.autoFlip) ? [props.position.split(' ')[0]].concat(props.autoFlip) : null; | ||
} | ||
function positionPropToPopperPosition(position) { | ||
return positionToPopper(position) || positionMap[POSITION_ATTRIBUTE_ENUM.default].position; | ||
} |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -9,9 +8,5 @@ value: true | ||
exports.default = ScrollBlock; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _styledComponents = _interopRequireDefault(require("styled-components")); | ||
var _reactScrolllock = _interopRequireDefault(require("react-scrolllock")); | ||
var Blanket = _styledComponents.default.div.withConfig({ | ||
@@ -21,5 +16,4 @@ displayName: "ScrollBlock__Blanket", | ||
})(["\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: transparent;\n"]); | ||
function ScrollBlock() { | ||
return /*#__PURE__*/_react.default.createElement(Blanket, null, /*#__PURE__*/_react.default.createElement(_reactScrolllock.default, null)); | ||
} |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
var _typeof3 = require("@babel/runtime/helpers/typeof"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -11,45 +9,23 @@ value: true | ||
exports.default = void 0; | ||
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")); | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")); | ||
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")); | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _styledComponents = _interopRequireDefault(require("styled-components")); | ||
var _rafSchd = _interopRequireDefault(require("raf-schd")); | ||
var _popper = _interopRequireDefault(require("popper.js")); | ||
var _ScrollBlock = _interopRequireDefault(require("./internal/ScrollBlock")); | ||
var _helpers = require("./internal/helpers"); | ||
var _styledContentContainer = _interopRequireDefault(require("../styledContentContainer")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && 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; } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /* eslint-disable react/prop-types */ // eslint-disable-line import/extensions | ||
// We create a dummy target when making the menu fixed so that we can force popper.js to use fixed positioning | ||
@@ -63,4 +39,3 @@ // without affecting child layout of the actual target since children of fixed position elements can't use percentage | ||
var fixedOffset = _ref.fixedOffset, | ||
targetRef = _ref.targetRef; | ||
targetRef = _ref.targetRef; | ||
if (fixedOffset && targetRef) { | ||
@@ -71,20 +46,15 @@ var actualTarget = targetRef.firstChild; | ||
} | ||
return 'display: none;'; | ||
}); | ||
if (process.env.NODE_ENV !== 'production' && !process.env.CI) { | ||
if (typeof process !== 'undefined' && process.env.NODE_ENV !== 'production' && !process.env.CI) { | ||
// eslint-disable-next-line no-console | ||
console.warn('@atlaskit/layer has been deprecated. It is an internal component and should not be used directly.'); | ||
} | ||
var Layer = /*#__PURE__*/function (_Component) { | ||
(0, _inherits2.default)(Layer, _Component); | ||
var _super = _createSuper(Layer); | ||
// working with extract-react-types | ||
// working with extract-react-types | ||
function Layer(props) { | ||
var _this; | ||
(0, _classCallCheck2.default)(this, Layer); | ||
@@ -99,12 +69,8 @@ _this = _super.call(this, props); | ||
var popperHeight = state.offsets.popper.height; | ||
var left = Math.round(state.offsets.popper.left); // The offset position is sometimes an object and sometimes just a string... | ||
var left = Math.round(state.offsets.popper.left); | ||
// The offset position is sometimes an object and sometimes just a string... | ||
var cssPosition = (0, _typeof2.default)(state.offsets.popper.position) === 'object' ? state.offsets.popper.position.position : state.offsets.popper.position; | ||
var top = _this.fixPositionTopUnderflow(state.offsets.popper.top, cssPosition); | ||
var originalHeight = _this.state.originalHeight || popperHeight; | ||
var maxHeight = _this.calculateMaxHeight(originalHeight, popperHeight, top, cssPosition); | ||
_this.setState({ | ||
@@ -148,3 +114,2 @@ // position: fixed or absolute | ||
} | ||
(0, _createClass2.default)(Layer, [{ | ||
@@ -166,10 +131,9 @@ key: "componentDidMount", | ||
var _this$props = this.props, | ||
onFlippedChange = _this$props.onFlippedChange, | ||
onPositioned = _this$props.onPositioned; | ||
onFlippedChange = _this$props.onFlippedChange, | ||
onPositioned = _this$props.onPositioned; | ||
var _this$state = this.state, | ||
flipped = _this$state.flipped, | ||
actualPosition = _this$state.actualPosition, | ||
originalPosition = _this$state.originalPosition, | ||
hasExtractedStyles = _this$state.hasExtractedStyles; | ||
flipped = _this$state.flipped, | ||
actualPosition = _this$state.actualPosition, | ||
originalPosition = _this$state.originalPosition, | ||
hasExtractedStyles = _this$state.hasExtractedStyles; | ||
if (prevState.flipped !== flipped && onFlippedChange) { | ||
@@ -181,5 +145,5 @@ onFlippedChange({ | ||
}); | ||
} // This flag is set the first time the position is calculated from Popper and applied to the content | ||
} | ||
// This flag is set the first time the position is calculated from Popper and applied to the content | ||
if (!prevState.hasExtractedStyles && hasExtractedStyles && onPositioned) { | ||
@@ -193,3 +157,2 @@ onPositioned(); | ||
this.extractStyles.cancel(); | ||
if (this.popper) { | ||
@@ -199,2 +162,3 @@ this.popper.destroy(); | ||
} | ||
/* Calculate the max height of the popper if it's height is greater than the viewport to prevent | ||
@@ -204,3 +168,2 @@ * the bottom of the popper not being viewable. | ||
*/ | ||
}, { | ||
@@ -210,15 +173,14 @@ key: "calculateMaxHeight", | ||
var DocumentElementClientHeight = 0; | ||
if (document.documentElement) { | ||
DocumentElementClientHeight = document.documentElement.clientHeight; | ||
} | ||
if (cssPosition !== 'fixed' || this.props.boundariesElement !== 'viewport') { | ||
return null; | ||
} | ||
var viewportHeight = Math.max(DocumentElementClientHeight, window.innerHeight || 0); | ||
return viewportHeight < originalHeight && currentHeight + positionTop >= viewportHeight - 50 ? // allow some spacing either side of viewport height | ||
return viewportHeight < originalHeight && currentHeight + positionTop >= viewportHeight - 50 ? | ||
// allow some spacing either side of viewport height | ||
viewportHeight - 12 : null; | ||
} | ||
/* Popper may return either a fixed or absolute position which would be applied to the | ||
@@ -228,3 +190,2 @@ * content style. In order to overcome clipping issues for overflow containing blocks when | ||
*/ | ||
}, { | ||
@@ -234,3 +195,2 @@ key: "calculateFixedOffset", | ||
var isAlwaysFixed = props.isAlwaysFixed; | ||
if (isAlwaysFixed && this.targetRef) { | ||
@@ -250,2 +210,3 @@ var actualTarget = this.targetRef.firstChild; | ||
} | ||
/* Clamp fixed position to the window for fixed position poppers that flow off the top of the | ||
@@ -259,3 +220,2 @@ * window. | ||
// eslint-disable-next-line class-methods-use-this | ||
}, { | ||
@@ -272,16 +232,15 @@ key: "fixPositionTopUnderflow", | ||
} | ||
if (this.popper) { | ||
this.popper.destroy(); | ||
} // "new Popper(...)" operation is very expensive when called on virtual DOM. | ||
} | ||
// "new Popper(...)" operation is very expensive when called on virtual DOM. | ||
// This condition reduces the number of calls so we can run our tests faster | ||
// (time was reduced from 100s to 13s). | ||
if (!props.content) { | ||
return; | ||
} // we wrap our target in a div so that we can safely get a reference to it, but we pass the | ||
} | ||
// we wrap our target in a div so that we can safely get a reference to it, but we pass the | ||
// actual target to popper | ||
var actualTarget = props.isAlwaysFixed ? this.fixedRef : this.targetRef.firstChild; | ||
@@ -308,4 +267,4 @@ var popperOpts = { | ||
padding: 0 // leave 0 pixels between popper and the boundariesElement | ||
}, | ||
}, | ||
preventOverflow: { | ||
@@ -319,7 +278,5 @@ enabled: !!this.props.autoFlip, | ||
var flipBehavior = (0, _helpers.getFlipBehavior)(props); | ||
if (flipBehavior) { | ||
popperOpts.modifiers.flip.behavior = flipBehavior; | ||
} | ||
this.popper = new _popper.default(actualTarget, this.contentRef, popperOpts); | ||
@@ -331,12 +288,11 @@ } | ||
var _this2 = this; | ||
var _this$props2 = this.props, | ||
zIndex = _this$props2.zIndex, | ||
lockScroll = _this$props2.lockScroll; | ||
zIndex = _this$props2.zIndex, | ||
lockScroll = _this$props2.lockScroll; | ||
var _this$state2 = this.state, | ||
cssPosition = _this$state2.cssPosition, | ||
transform = _this$state2.transform, | ||
hasExtractedStyles = _this$state2.hasExtractedStyles, | ||
maxHeight = _this$state2.maxHeight, | ||
fixedOffset = _this$state2.fixedOffset; | ||
cssPosition = _this$state2.cssPosition, | ||
transform = _this$state2.transform, | ||
hasExtractedStyles = _this$state2.hasExtractedStyles, | ||
maxHeight = _this$state2.maxHeight, | ||
fixedOffset = _this$state2.fixedOffset; | ||
var opacity = hasExtractedStyles ? {} : { | ||
@@ -378,3 +334,2 @@ opacity: 0 | ||
}(_react.Component); | ||
exports.default = Layer; | ||
@@ -381,0 +336,0 @@ (0, _defineProperty2.default)(Layer, "defaultProps", { |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -14,3 +13,2 @@ value: true | ||
}); | ||
var _Layer = _interopRequireDefault(require("./components/Layer")); |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -9,5 +8,3 @@ value: true | ||
exports.default = void 0; | ||
var _styledComponents = _interopRequireDefault(require("styled-components")); | ||
var _default = _styledComponents.default.div.withConfig({ | ||
@@ -20,3 +17,2 @@ displayName: "styledContentContainer", | ||
}); | ||
exports.default = _default; |
{ | ||
"name": "@atlaskit/layer", | ||
"version": "9.0.4", | ||
"version": "9.0.5", | ||
"sideEffects": false | ||
} |
{ | ||
"name": "@atlaskit/layer", | ||
"version": "9.0.4", | ||
"version": "9.0.5", | ||
"sideEffects": false | ||
} |
@@ -55,11 +55,9 @@ var positionMap = { | ||
}; | ||
function positionToPopper(position) { | ||
return position && positionMap[position] ? positionMap[position].position : null; | ||
} | ||
/* Convert the autoFlip property into the array format that Popper expects. | ||
* The first item must not include the edge-position variation, or Popper will not understand it. | ||
*/ | ||
export function getFlipBehavior(props) { | ||
@@ -66,0 +64,0 @@ return props.position && Array.isArray(props.autoFlip) ? [props.position.split(' ')[0]].concat(props.autoFlip) : null; |
@@ -9,11 +9,6 @@ import _typeof from "@babel/runtime/helpers/typeof"; | ||
import _defineProperty from "@babel/runtime/helpers/defineProperty"; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
/* eslint-disable react/prop-types */ | ||
@@ -24,9 +19,9 @@ import React, { Component } from 'react'; | ||
import Popper from 'popper.js'; // eslint-disable-line import/extensions | ||
import ScrollBlock from './internal/ScrollBlock'; | ||
import { getFlipBehavior, positionPropToPopperPosition } from './internal/helpers'; | ||
import ContentContainer from '../styledContentContainer'; // We create a dummy target when making the menu fixed so that we can force popper.js to use fixed positioning | ||
import ContentContainer from '../styledContentContainer'; | ||
// We create a dummy target when making the menu fixed so that we can force popper.js to use fixed positioning | ||
// without affecting child layout of the actual target since children of fixed position elements can't use percentage | ||
// heights/widths. | ||
var FixedTarget = styled.div.withConfig({ | ||
@@ -37,4 +32,3 @@ displayName: "Layer__FixedTarget", | ||
var fixedOffset = _ref.fixedOffset, | ||
targetRef = _ref.targetRef; | ||
targetRef = _ref.targetRef; | ||
if (fixedOffset && targetRef) { | ||
@@ -45,45 +39,30 @@ var actualTarget = targetRef.firstChild; | ||
} | ||
return 'display: none;'; | ||
}); | ||
if (process.env.NODE_ENV !== 'production' && !process.env.CI) { | ||
if (typeof process !== 'undefined' && process.env.NODE_ENV !== 'production' && !process.env.CI) { | ||
// eslint-disable-next-line no-console | ||
console.warn('@atlaskit/layer has been deprecated. It is an internal component and should not be used directly.'); | ||
} | ||
var Layer = /*#__PURE__*/function (_Component) { | ||
_inherits(Layer, _Component); | ||
var _super = _createSuper(Layer); | ||
// working with extract-react-types | ||
// working with extract-react-types | ||
function Layer(props) { | ||
var _this; | ||
_classCallCheck(this, Layer); | ||
_this = _super.call(this, props); | ||
_defineProperty(_assertThisInitialized(_this), "popper", void 0); | ||
_defineProperty(_assertThisInitialized(_this), "targetRef", void 0); | ||
_defineProperty(_assertThisInitialized(_this), "contentRef", void 0); | ||
_defineProperty(_assertThisInitialized(_this), "fixedRef", void 0); | ||
_defineProperty(_assertThisInitialized(_this), "extractStyles", function (state) { | ||
if (state) { | ||
var popperHeight = state.offsets.popper.height; | ||
var left = Math.round(state.offsets.popper.left); // The offset position is sometimes an object and sometimes just a string... | ||
var left = Math.round(state.offsets.popper.left); | ||
// The offset position is sometimes an object and sometimes just a string... | ||
var cssPosition = _typeof(state.offsets.popper.position) === 'object' ? state.offsets.popper.position.position : state.offsets.popper.position; | ||
var top = _this.fixPositionTopUnderflow(state.offsets.popper.top, cssPosition); | ||
var originalHeight = _this.state.originalHeight || popperHeight; | ||
var maxHeight = _this.calculateMaxHeight(originalHeight, popperHeight, top, cssPosition); | ||
_this.setState({ | ||
@@ -103,3 +82,2 @@ // position: fixed or absolute | ||
}); | ||
_this.state = { | ||
@@ -129,3 +107,2 @@ hasExtractedStyles: false, | ||
} | ||
_createClass(Layer, [{ | ||
@@ -147,10 +124,9 @@ key: "componentDidMount", | ||
var _this$props = this.props, | ||
onFlippedChange = _this$props.onFlippedChange, | ||
onPositioned = _this$props.onPositioned; | ||
onFlippedChange = _this$props.onFlippedChange, | ||
onPositioned = _this$props.onPositioned; | ||
var _this$state = this.state, | ||
flipped = _this$state.flipped, | ||
actualPosition = _this$state.actualPosition, | ||
originalPosition = _this$state.originalPosition, | ||
hasExtractedStyles = _this$state.hasExtractedStyles; | ||
flipped = _this$state.flipped, | ||
actualPosition = _this$state.actualPosition, | ||
originalPosition = _this$state.originalPosition, | ||
hasExtractedStyles = _this$state.hasExtractedStyles; | ||
if (prevState.flipped !== flipped && onFlippedChange) { | ||
@@ -162,5 +138,5 @@ onFlippedChange({ | ||
}); | ||
} // This flag is set the first time the position is calculated from Popper and applied to the content | ||
} | ||
// This flag is set the first time the position is calculated from Popper and applied to the content | ||
if (!prevState.hasExtractedStyles && hasExtractedStyles && onPositioned) { | ||
@@ -174,3 +150,2 @@ onPositioned(); | ||
this.extractStyles.cancel(); | ||
if (this.popper) { | ||
@@ -180,2 +155,3 @@ this.popper.destroy(); | ||
} | ||
/* Calculate the max height of the popper if it's height is greater than the viewport to prevent | ||
@@ -185,3 +161,2 @@ * the bottom of the popper not being viewable. | ||
*/ | ||
}, { | ||
@@ -191,15 +166,14 @@ key: "calculateMaxHeight", | ||
var DocumentElementClientHeight = 0; | ||
if (document.documentElement) { | ||
DocumentElementClientHeight = document.documentElement.clientHeight; | ||
} | ||
if (cssPosition !== 'fixed' || this.props.boundariesElement !== 'viewport') { | ||
return null; | ||
} | ||
var viewportHeight = Math.max(DocumentElementClientHeight, window.innerHeight || 0); | ||
return viewportHeight < originalHeight && currentHeight + positionTop >= viewportHeight - 50 ? // allow some spacing either side of viewport height | ||
return viewportHeight < originalHeight && currentHeight + positionTop >= viewportHeight - 50 ? | ||
// allow some spacing either side of viewport height | ||
viewportHeight - 12 : null; | ||
} | ||
/* Popper may return either a fixed or absolute position which would be applied to the | ||
@@ -209,3 +183,2 @@ * content style. In order to overcome clipping issues for overflow containing blocks when | ||
*/ | ||
}, { | ||
@@ -215,3 +188,2 @@ key: "calculateFixedOffset", | ||
var isAlwaysFixed = props.isAlwaysFixed; | ||
if (isAlwaysFixed && this.targetRef) { | ||
@@ -231,2 +203,3 @@ var actualTarget = this.targetRef.firstChild; | ||
} | ||
/* Clamp fixed position to the window for fixed position poppers that flow off the top of the | ||
@@ -240,3 +213,2 @@ * window. | ||
// eslint-disable-next-line class-methods-use-this | ||
}, { | ||
@@ -253,16 +225,15 @@ key: "fixPositionTopUnderflow", | ||
} | ||
if (this.popper) { | ||
this.popper.destroy(); | ||
} // "new Popper(...)" operation is very expensive when called on virtual DOM. | ||
} | ||
// "new Popper(...)" operation is very expensive when called on virtual DOM. | ||
// This condition reduces the number of calls so we can run our tests faster | ||
// (time was reduced from 100s to 13s). | ||
if (!props.content) { | ||
return; | ||
} // we wrap our target in a div so that we can safely get a reference to it, but we pass the | ||
} | ||
// we wrap our target in a div so that we can safely get a reference to it, but we pass the | ||
// actual target to popper | ||
var actualTarget = props.isAlwaysFixed ? this.fixedRef : this.targetRef.firstChild; | ||
@@ -289,4 +260,4 @@ var popperOpts = { | ||
padding: 0 // leave 0 pixels between popper and the boundariesElement | ||
}, | ||
}, | ||
preventOverflow: { | ||
@@ -300,7 +271,5 @@ enabled: !!this.props.autoFlip, | ||
var flipBehavior = getFlipBehavior(props); | ||
if (flipBehavior) { | ||
popperOpts.modifiers.flip.behavior = flipBehavior; | ||
} | ||
this.popper = new Popper(actualTarget, this.contentRef, popperOpts); | ||
@@ -312,12 +281,11 @@ } | ||
var _this2 = this; | ||
var _this$props2 = this.props, | ||
zIndex = _this$props2.zIndex, | ||
lockScroll = _this$props2.lockScroll; | ||
zIndex = _this$props2.zIndex, | ||
lockScroll = _this$props2.lockScroll; | ||
var _this$state2 = this.state, | ||
cssPosition = _this$state2.cssPosition, | ||
transform = _this$state2.transform, | ||
hasExtractedStyles = _this$state2.hasExtractedStyles, | ||
maxHeight = _this$state2.maxHeight, | ||
fixedOffset = _this$state2.fixedOffset; | ||
cssPosition = _this$state2.cssPosition, | ||
transform = _this$state2.transform, | ||
hasExtractedStyles = _this$state2.hasExtractedStyles, | ||
maxHeight = _this$state2.maxHeight, | ||
fixedOffset = _this$state2.fixedOffset; | ||
var opacity = hasExtractedStyles ? {} : { | ||
@@ -357,6 +325,4 @@ opacity: 0 | ||
}]); | ||
return Layer; | ||
}(Component); | ||
_defineProperty(Layer, "defaultProps", { | ||
@@ -375,3 +341,2 @@ autoFlip: true, | ||
}); | ||
export { Layer as default }; |
{ | ||
"name": "@atlaskit/layer", | ||
"version": "9.0.4", | ||
"version": "9.0.5", | ||
"sideEffects": false | ||
} |
{ | ||
"name": "@atlaskit/layer", | ||
"version": "9.0.4", | ||
"version": "9.0.5", | ||
"description": "A React layer component responsible for the position of an element on a page", | ||
@@ -21,3 +21,4 @@ "publishConfig": { | ||
"deprecated": "This is an internal component and should not be used directly.", | ||
"name": "Layer" | ||
"name": "Layer", | ||
"category": "Components" | ||
} | ||
@@ -37,3 +38,3 @@ }, | ||
"@atlaskit/docs": "^9.0.0", | ||
"@atlaskit/section-message": "^6.0.0", | ||
"@atlaskit/section-message": "^6.3.0", | ||
"@atlaskit/ssr": "*", | ||
@@ -40,0 +41,0 @@ "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1", |
@@ -5,3 +5,4 @@ { | ||
"module": "../dist/esm/styledContentContainer.js", | ||
"module:es2019": "../dist/es2019/styledContentContainer.js" | ||
"module:es2019": "../dist/es2019/styledContentContainer.js", | ||
"sideEffects": false | ||
} |
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
58758
848