UNPKG

@atlaskit/flag

Version:

A flag is used for confirmations, alerts, and acknowledgments that require minimal user interaction, often displayed using a flag group.

49 lines (46 loc) 2.08 kB
/* expander.tsx generated by @compiled/babel-plugin v3.0.2 */ import _extends from "@babel/runtime/helpers/extends"; import "./expander.compiled.css"; import * as React from 'react'; import { ax, ix } from "@compiled/react/runtime"; import { cx } from '@atlaskit/css'; import ExitingPersistence from '@atlaskit/motion/exiting-persistence'; import FadeIn from '@atlaskit/motion/fade-in'; import { fg } from '@atlaskit/platform-feature-flags/fg'; import { Box, Stack } from '@atlaskit/primitives/compiled'; const styles = { expander: "_1bsb1osq", expanderTransition: "_k8m0wor5 _1oec1mzy _156yru3m", expanderCollapsed: "_1reo15vq _18m915vq", container: "_v5641xzp" }; const Expander = ({ children, isExpanded, testId }) => { const isCollapseAnimationEnabled = fg('platform-dst-flag-collapse-animation-fix'); // Need to always render the ExpanderInternal otherwise the // reveal transition doesn't happen. We can't use CSS animation for // the the reveal because we don't know the height of the content. return /*#__PURE__*/React.createElement(Box, { xcss: cx(styles.expander, isCollapseAnimationEnabled && styles.expanderTransition, isCollapseAnimationEnabled && !isExpanded && styles.expanderCollapsed), style: { maxHeight: isExpanded ? 150 : 0, // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766 flex: '1 1 100%', // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766 minWidth: 0 }, "aria-hidden": !isExpanded, testId: testId && `${testId}-expander` }, /*#__PURE__*/React.createElement(ExitingPersistence, { appear: true }, isExpanded && /*#__PURE__*/React.createElement(FadeIn, null, props => /*#__PURE__*/React.createElement(Box, _extends({ xcss: cx(!isCollapseAnimationEnabled && styles.container) }, props), /*#__PURE__*/React.createElement(Stack, { space: "space.100" }, children))))); }; // eslint-disable-next-line @repo/internal/react/require-jsdoc export default Expander;