@atlaskit/modal-dialog
Version:
A modal dialog displays content that requires user interaction, in a layer above the page.
60 lines (58 loc) • 2.25 kB
JavaScript
/* positioner.tsx generated by @compiled/babel-plugin v0.36.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';
const gutter = 60;
const maxWidthDimensions = `calc(100vw - ${gutter * 2}px)`;
const maxHeightDimensions = `calc(100vh - ${gutter * 2 - 1}px)`;
// Flex and min-content are set to constrain the height of the body and support multi-column scrolling experiences
const positionerStyles = null;
const scrollStyles = {
viewport: "_4t3i1wug _kqswh2mm _1sg41wqb _maxs1wug _1jvh1wqb _1uca1wug _eoawglyw",
body: "_we1i18uh _e8uozwhf _y1k5stnw _5ee41wqb _1urridpf _1juqidpf _yakv1wug _4lht1wug _eoawglyw",
fullScreen: ""
};
const stackTransitionStyles = null;
const stackTransformStyles = null;
const stackIdleStyles = null;
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", "_k8m01e03 _1bumglyw _sedtglyw", stackIndex > 0 ? "_t9ec1b95" : "_t9ecglyw", scrollStyles[scrollBehavior]])
}, children);
};
// eslint-disable-next-line @repo/internal/react/require-jsdoc
export default Positioner;