import { clsx } from 'clsx';
import { forwardRef, useRef } from 'react';
import { CloseButton } from '../closeButton/CloseButton.mjs';
import { stopPropagation } from '../domHelpers/documentIosClick.mjs';
import { jsxs, jsx } from 'react/jsx-runtime';

const Card = /*#__PURE__*/forwardRef(({
  className,
  children = null,
  id,
  isDisabled = false,
  isSmall = false,
  onDismiss,
  testId,
  ...props
}, ref) => {
  const closeButtonReference = useRef(null);
  return /*#__PURE__*/jsxs("div", {
    ref: ref,
    className: clsx('np-Card', {
      'np-Card--small': !!isSmall,
      'is-disabled': !!isDisabled
    }, className),
    id: id,
    "data-testid": testId,
    ...props,
    children: [onDismiss && /*#__PURE__*/jsx(CloseButton, {
      ref: closeButtonReference,
      className: "np-Card-closeButton",
      size: isSmall ? 'sm' : 'md',
      isDisabled: isDisabled,
      testId: "close-button",
      onClick: e => {
        stopPropagation(e);
        onDismiss();
      }
    }), children]
  });
});
Card.displayName = 'Card';

export { Card as default };
//# sourceMappingURL=Card.mjs.map
