UNPKG

@atlaskit/modal-dialog

Version:

A modal dialog displays content that requires user interaction, in a layer above the page.

65 lines (62 loc) 3.29 kB
/* positioner.tsx generated by @compiled/babel-plugin v0.39.1 */ "use strict"; var _typeof = require("@babel/runtime/helpers/typeof"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; require("./positioner.compiled.css"); var React = _interopRequireWildcard(require("react")); var _runtime = require("@compiled/react/runtime"); var _curves = require("@atlaskit/motion/curves"); var _durations = require("@atlaskit/motion/durations"); var _constants = require("@atlaskit/theme/constants"); function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); } // Flex and min-content are set to constrain the height of the body and support multi-column scrolling experiences var positionerStyles = null; var stackStyles = { stackTransition: "_k8m01e03 _1bumglyw _sedtglyw", stackTransform: "_t9ec1b95", stackIdle: "_t9ecglyw" }; // Hardcoded pixels are based off a 60px base gutter var scrollStyles = { viewport: "_4t3i1wug _kqswh2mm _1f6n1wqb _1eot1wug _eoawglyw", body: "_we1i18uh _e8uozwhf _y1k5stnw _5ee41nf8 _1urridpf _1juqidpf _yakv1wug _4lht1wug _eoawglyw", fullScreen: "" }; function getScrollBehavior(_ref) { var isFullScreen = _ref.isFullScreen, shouldScrollInViewport = _ref.shouldScrollInViewport; if (isFullScreen) { return 'fullScreen'; } if (shouldScrollInViewport) { return 'viewport'; } return 'body'; } var Positioner = function Positioner(props) { var children = props.children, stackIndex = props.stackIndex, shouldScrollInViewport = props.shouldScrollInViewport, testId = props.testId, isFullScreen = props.isFullScreen; var scrollBehavior = getScrollBehavior({ isFullScreen: isFullScreen, shouldScrollInViewport: shouldScrollInViewport }); return /*#__PURE__*/React.createElement("div", { style: { '--modal-dialog-translate-y': "calc(".concat(stackIndex, "px * ", "var(--ds-space-100, 8px)", ")"), // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766 transitionDuration: "".concat(_durations.durations.medium, "ms"), // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop transitionTimingFunction: _curves.easeInOut }, "data-testid": testId && "".concat(testId, "--positioner"), className: (0, _runtime.ax)(["_1e0c1txw _1bsb1osq _p12f1osq _4t3i1osq _kqsw1n9t _1pby16oo _2lx21bp4 _152tidpf _1e02idpf", stackStyles.stackTransition, stackIndex > 0 ? stackStyles.stackTransform : stackStyles.stackIdle, scrollStyles[scrollBehavior]]) }, children); }; // eslint-disable-next-line @repo/internal/react/require-jsdoc var _default = exports.default = Positioner;