UNPKG

@atlaskit/modal-dialog

Version:

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

60 lines (58 loc) 2.19 kB
/* positioner.tsx generated by @compiled/babel-plugin v0.39.1 */ import "./positioner.compiled.css"; import * as React from 'react'; import { ax, ix } from "@compiled/react/runtime"; import { easeInOut } from '@atlaskit/motion/curves'; import { durations } from '@atlaskit/motion/durations'; import { layers } from '@atlaskit/theme/constants'; // Flex and min-content are set to constrain the height of the body and support multi-column scrolling experiences const positionerStyles = null; const stackStyles = { stackTransition: "_k8m01e03 _1bumglyw _sedtglyw", stackTransform: "_t9ec1b95", stackIdle: "_t9ecglyw" }; // Hardcoded pixels are based off a 60px base gutter const scrollStyles = { viewport: "_4t3i1wug _kqswh2mm _1f6n1wqb _1eot1wug _eoawglyw", body: "_we1i18uh _e8uozwhf _y1k5stnw _5ee41nf8 _1urridpf _1juqidpf _yakv1wug _4lht1wug _eoawglyw", fullScreen: "" }; function getScrollBehavior({ isFullScreen, shouldScrollInViewport }) { if (isFullScreen) { return 'fullScreen'; } if (shouldScrollInViewport) { return 'viewport'; } return 'body'; } const Positioner = props => { const { children, stackIndex, shouldScrollInViewport, testId, isFullScreen } = props; const scrollBehavior = getScrollBehavior({ isFullScreen, shouldScrollInViewport }); return /*#__PURE__*/React.createElement("div", { style: { '--modal-dialog-translate-y': `calc(${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: `${durations.medium}ms`, // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop transitionTimingFunction: easeInOut }, "data-testid": testId && `${testId}--positioner`, className: 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 export default Positioner;