{
  "version": 3,
  "sources": ["../../src/snackbar/list.tsx"],
  "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useReducedMotion } from '@wordpress/compose';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Snackbar from '.';\nimport { __unstableMotion as motion, __unstableAnimatePresence as AnimatePresence } from '../animation';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst SNACKBAR_VARIANTS = {\n  init: {\n    height: 0,\n    opacity: 0\n  },\n  open: {\n    height: 'auto',\n    opacity: 1,\n    transition: {\n      height: {\n        type: 'tween',\n        duration: 0.3,\n        ease: [0, 0, 0.2, 1]\n      },\n      opacity: {\n        type: 'tween',\n        duration: 0.25,\n        delay: 0.05,\n        ease: [0, 0, 0.2, 1]\n      }\n    }\n  },\n  exit: {\n    opacity: 0,\n    transition: {\n      type: 'tween',\n      duration: 0.1,\n      ease: [0, 0, 0.2, 1]\n    }\n  }\n};\n\n/**\n * Renders a list of notices.\n *\n * ```jsx\n * const MySnackbarListNotice = () => (\n *   <SnackbarList\n *     notices={ notices }\n *     onRemove={ removeNotice }\n *   />\n * );\n * ```\n */\nexport function SnackbarList({\n  notices,\n  className,\n  children,\n  onRemove\n}) {\n  const listRef = useRef(null);\n  const isReducedMotion = useReducedMotion();\n  className = clsx('components-snackbar-list', className);\n  const removeNotice = notice => () => onRemove?.(notice.id);\n  return /*#__PURE__*/_jsxs(\"div\", {\n    className: className,\n    tabIndex: -1,\n    ref: listRef,\n    \"data-testid\": \"snackbar-list\",\n    children: [children, /*#__PURE__*/_jsx(AnimatePresence, {\n      children: notices.map(notice => {\n        const {\n          content,\n          ...restNotice\n        } = notice;\n        return /*#__PURE__*/_jsx(motion.div, {\n          layout: isReducedMotion ? false : 'position' // See https://www.framer.com/docs/animation/#layout-animations\n          // Ensures a stable full-width bounding box so that\n          // `layout=\"position\"` only ever detects vertical\n          // shifts, preventing horizontal animation when\n          // notice text changes in place.\n          ,\n          style: {\n            width: '100%'\n          },\n          initial: \"init\",\n          animate: \"open\",\n          exit: \"exit\",\n          variants: isReducedMotion ? undefined : SNACKBAR_VARIANTS,\n          children: /*#__PURE__*/_jsx(\"div\", {\n            className: \"components-snackbar-list__notice-container\",\n            children: /*#__PURE__*/_jsx(Snackbar, {\n              ...restNotice,\n              onRemove: removeNotice(notice),\n              listRef: listRef,\n              children: notice.content\n            })\n          })\n        }, notice.id);\n      })\n    })]\n  });\n}\nexport default SnackbarList;"],
  "mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,wBAAwB;AACjC,SAAS,cAAc;AAKvB,OAAO,cAAc;AACrB,SAAS,oBAAoB,QAAQ,6BAA6B,uBAAuB;AACzF,SAAS,OAAO,MAAM,QAAQ,aAAa;AAC3C,IAAM,oBAAoB;AAAA,EACxB,MAAM;AAAA,IACJ,QAAQ;AAAA,IACR,SAAS;AAAA,EACX;AAAA,EACA,MAAM;AAAA,IACJ,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,YAAY;AAAA,MACV,QAAQ;AAAA,QACN,MAAM;AAAA,QACN,UAAU;AAAA,QACV,MAAM,CAAC,GAAG,GAAG,KAAK,CAAC;AAAA,MACrB;AAAA,MACA,SAAS;AAAA,QACP,MAAM;AAAA,QACN,UAAU;AAAA,QACV,OAAO;AAAA,QACP,MAAM,CAAC,GAAG,GAAG,KAAK,CAAC;AAAA,MACrB;AAAA,IACF;AAAA,EACF;AAAA,EACA,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,YAAY;AAAA,MACV,MAAM;AAAA,MACN,UAAU;AAAA,MACV,MAAM,CAAC,GAAG,GAAG,KAAK,CAAC;AAAA,IACrB;AAAA,EACF;AACF;AAcO,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAG;AACD,QAAM,UAAU,OAAO,IAAI;AAC3B,QAAM,kBAAkB,iBAAiB;AACzC,cAAY,KAAK,4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