{
  "version": 3,
  "sources": ["../../src/z-stack/component.tsx"],
  "sourcesContent": ["/**\n * External dependencies\n */\n\n/**\n * WordPress dependencies\n */\nimport { isValidElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { getValidChildren } from '../utils/get-valid-children';\nimport { contextConnect, useContextSystem } from '../context';\nimport { ZStackView, ZStackChildView } from './styles';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nfunction UnconnectedZStack(props, forwardedRef) {\n  const {\n    children,\n    className,\n    isLayered = true,\n    isReversed = false,\n    offset = 0,\n    ...otherProps\n  } = useContextSystem(props, 'ZStack');\n  const validChildren = getValidChildren(children);\n  const childrenLastIndex = validChildren.length - 1;\n  const clonedChildren = validChildren.map((child, index) => {\n    const zIndex = isReversed ? childrenLastIndex - index : index;\n    // Only when the component is layered, the offset needs to be multiplied by\n    // the item's index, so that items can correctly stack at the right distance\n    const offsetAmount = isLayered ? offset * index : offset;\n    const key = isValidElement(child) ? child.key : index;\n    return /*#__PURE__*/_jsx(ZStackChildView, {\n      offsetAmount: offsetAmount,\n      zIndex: zIndex,\n      children: child\n    }, key);\n  });\n  return /*#__PURE__*/_jsx(ZStackView, {\n    ...otherProps,\n    className: className,\n    isLayered: isLayered,\n    ref: forwardedRef,\n    children: clonedChildren\n  });\n}\n\n/**\n * `ZStack` allows you to stack things along the Z-axis.\n *\n * ```jsx\n * import { __experimentalZStack as ZStack } from '@wordpress/components';\n *\n * function Example() {\n *   return (\n *     <ZStack offset={ 20 } isLayered>\n *       <ExampleImage />\n *       <ExampleImage />\n *       <ExampleImage />\n *     </ZStack>\n *   );\n * }\n * ```\n */\nexport const ZStack = contextConnect(UnconnectedZStack, 'ZStack');\nexport default ZStack;"],
  "mappings": ";AAOA,SAAS,sBAAsB;AAK/B,SAAS,wBAAwB;AACjC,SAAS,gBAAgB,wBAAwB;AACjD,SAAS,YAAY,uBAAuB;AAC5C,SAAS,OAAO,YAAY;AAC5B,SAAS,kBAAkB,OAAO,cAAc;AAC9C,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,SAAS;AAAA,IACT,GAAG;AAAA,EACL,IAAI,iBAAiB,OAAO,QAAQ;AACpC,QAAM,gBAAgB,iBAAiB,QAAQ;AAC/C,QAAM,oBAAoB,cAAc,SAAS;AACjD,QAAM,iBAAiB,cAAc,IAAI,CAAC,OAAO,UAAU;AACzD,UAAM,SAAS,aAAa,oBAAoB,QAAQ;AAGxD,UAAM,eAAe,YAAY,SAAS,QAAQ;AAClD,UAAM,MAAM,eAAe,KAAK,IAAI,MAAM,MAAM;AAChD,WAAoB,qBAAK,iBAAiB;AAAA,MACxC;AAAA,MACA;AAAA,MACA,UAAU;AAAA,IACZ,GAAG,GAAG;AAAA,EACR,CAAC;AACD,SAAoB,qBAAK,YAAY;AAAA,IACnC,GAAG;AAAA,IACH;AAAA,IACA;AAAA,IACA,KAAK;AAAA,IACL,UAAU;AAAA,EACZ,CAAC;AACH;AAmBO,IAAM,SAAS,eAAe,mBAAmB,QAAQ;AAChE,IAAO,oBAAQ;",
  "names": []
}
