UNPKG

@atlaskit/primitives

Version:

Primitives are token-backed low-level building blocks.

52 lines (51 loc) 1.23 kB
/* stack.tsx generated by @compiled/babel-plugin v0.36.1 */ import "./stack.compiled.css"; import * as React from 'react'; import { ax, ix } from "@compiled/react/runtime"; import { forwardRef, memo } from 'react'; import { cx } from '@atlaskit/css'; import Flex from './flex'; const styles = { hug: "_16jlidpf", fill: "_1bsb1osq _16jlkb7n" }; /** * __Stack__ * * Stack is a primitive component based on flexbox that manages the block layout of direct children. * * @example * ```tsx * <Stack> * <Box padding="space.100" backgroundColor="neutral"></Box> * <Box padding="space.100" backgroundColor="neutral"></Box> * </Stack> * ``` * */ const Stack = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({ as, alignInline: alignItems, alignBlock = 'stretch', spread, grow, space, children, testId, xcss, role }, ref) => { return /*#__PURE__*/React.createElement(Flex, { as: as, role: role, gap: space, direction: "column", alignItems: alignItems, justifyContent: spread || alignBlock, xcss: cx(grow === 'hug' && styles.hug, grow === 'fill' && styles.fill, xcss), testId: testId, ref: ref }, children); })); Stack.displayName = 'Stack'; export default Stack;