{"version":3,"file":"ConfirmModal.mjs","sources":["../../../../src/components/ConfirmModal/ConfirmModal.tsx"],"sourcesContent":["'use client'\nimport { forwardRef } from 'react'\nimport * as React from 'react'\n\nimport {\n  Modal,\n  ModalBody,\n  ModalClose,\n  ModalContent,\n  ModalFooter,\n  ModalHeader,\n  ModalTrigger,\n} from '~/src/components/Modal'\n\nimport {\n  type ConfirmModalBodyProps,\n  type ConfirmModalCloseProps,\n  type ConfirmModalContentProps,\n  type ConfirmModalFooterProps,\n  type ConfirmModalHeaderProps,\n  type ConfirmModalProps,\n  type ConfirmModalTriggerProps,\n} from './ConfirmModal.types'\n\n/**\n * `ConfirmModal` is a modal dialog that interrupts the user with important content and expects a response.\n *\n * `ConfirmModal` is a context of the ConfirmModal-related components. It doesn't render any DOM node.\n * It controls the visibility of the entire component and provides\n * handlers and accessibility properties to ConfirmModal-related components.\n * @example\n *\n * ```tsx\n * // Anatomy of the ConfirmModal\n * <ConfirmModal>\n *  <ConfirmModalModalTrigger />\n *  <ConfirmModalModalContent>\n *    <ConfirmModalModalHeader />\n *    <ConfirmModalModalBody />\n *    <ConfirmModalModalFooter />\n *  </ConfirmModalModalContent>\n * </ConfirmModal>\n * ```\n */\nexport function ConfirmModal({ children, ...rest }: ConfirmModalProps) {\n  return <Modal {...rest}>{children}</Modal>\n}\n\n/**\n * `ConfirmModalContent` is a container of the modal content.\n * It creates a portal to render the modal content outside of the DOM tree\n * and renders overlay behind the modal content too.\n */\nexport const ConfirmModalContent = forwardRef(function ConfirmModalContent(\n  { children, ...rest }: ConfirmModalContentProps,\n  forwardedRef: React.Ref<HTMLDivElement>\n) {\n  return (\n    <ModalContent\n      role=\"alertdialog\"\n      ref={forwardedRef}\n      showCloseIcon={false}\n      {...rest}\n    >\n      {children}\n    </ModalContent>\n  )\n})\n\n/**\n * `ConfirmModalHeader` is a header of the modal content.\n * It renders the accessible title and description of the modal.\n */\nexport const ConfirmModalHeader = forwardRef(function ConfirmModalHeader(\n  props: ConfirmModalHeaderProps,\n  forwardedRef: React.Ref<HTMLElement>\n) {\n  return (\n    <ModalHeader\n      ref={forwardedRef}\n      subtitle={null}\n      titleSize=\"m\"\n      {...props}\n    />\n  )\n})\n\n/**\n * `ConfirmModalBody` is a simple wrapper of the main modal content.\n */\nexport const ConfirmModalBody = forwardRef(function ConfirmModalBody(\n  { children, ...rest }: ConfirmModalBodyProps,\n  forwardedRef: React.Ref<HTMLDivElement>\n) {\n  return (\n    <ModalBody\n      ref={forwardedRef}\n      {...rest}\n    >\n      {children}\n    </ModalBody>\n  )\n})\n\n/**\n * `ConfirmModalFooter` is a simple wrapper of the footer of the modal content.\n * Usually, it contains the action buttons of the modal.\n */\nexport const ConfirmModalFooter = forwardRef(function ConfirmModalFooter(\n  props: ConfirmModalFooterProps,\n  forwardedRef: React.Ref<HTMLDivElement>\n) {\n  return (\n    <ModalFooter\n      ref={forwardedRef}\n      {...props}\n    />\n  )\n})\n\n/**\n * `ConfirmModalTrigger` is a button that opens the modal. **It doesn't render any DOM node.**\n * It passes the handler that opens the modal and accessibility properties to the children.\n *\n * It **must** be placed outside of the `ConfirmModalContent`.\n */\nexport function ConfirmModalTrigger({ children }: ConfirmModalTriggerProps) {\n  return <ModalTrigger>{children}</ModalTrigger>\n}\n\n/**\n * `ConfirmModalClose` is a button that closes the modal. **It doesn't render any DOM node.**\n * It passes the handler that closes the modal to the children.\n */\nexport function ConfirmModalClose({ children }: ConfirmModalCloseProps) {\n  return <ModalClose>{children}</ModalClose>\n}\n"],"names":["ConfirmModal","children","rest","_jsx","Modal","ConfirmModalContent","forwardRef","forwardedRef","ModalContent","role","ref","showCloseIcon","ConfirmModalHeader","props","ModalHeader","subtitle","titleSize","ConfirmModalBody","ModalBody","ConfirmModalFooter","ModalFooter","ConfirmModalTrigger","ModalTrigger","ConfirmModalClose","ModalClose"],"mappings":";;;;AAwBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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