import { CheckCircleFill, CrossCircleFill } from '@transferwise/icons';
import { clsx } from 'clsx';
import Body from '../body/Body.mjs';
import '../common/theme.mjs';
import '../common/direction.mjs';
import '@transferwise/neptune-tokens';
import '../common/propsValues/control.mjs';
import '../common/propsValues/size.mjs';
import { Typography } from '../common/propsValues/typography.mjs';
import '../common/propsValues/width.mjs';
import '../common/propsValues/type.mjs';
import '../common/propsValues/dateMode.mjs';
import '../common/propsValues/monthFormat.mjs';
import '../common/propsValues/position.mjs';
import '../common/propsValues/layouts.mjs';
import '../common/propsValues/status.mjs';
import '../common/propsValues/sentiment.mjs';
import '../common/propsValues/profileType.mjs';
import '../common/propsValues/variant.mjs';
import '../common/propsValues/scroll.mjs';
import '../common/propsValues/markdownNodeType.mjs';
import '../common/fileType.mjs';
import '@transferwise/formatting';
import 'react';
import 'react-intl';
import '../common/closeButton/CloseButton.messages.mjs';
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';

const InstructionsList = ({
  className,
  dos,
  donts,
  sort = 'dosFirst'
}) => {
  const dosInstructions = dos?.map((doThis, index) =>
  /*#__PURE__*/
  // eslint-disable-next-line react/no-array-index-key
  jsx(Instruction, {
    item: doThis,
    type: "do"
  }, index)) ?? null;
  const dontsInstructions = donts?.map((dont, index) =>
  /*#__PURE__*/
  // eslint-disable-next-line react/no-array-index-key
  jsx(Instruction, {
    item: dont,
    type: "dont"
  }, index)) ?? null;
  const orderedInstructions = sort === 'dosFirst' ? /*#__PURE__*/jsxs(Fragment, {
    children: [dosInstructions, dontsInstructions]
  }) : /*#__PURE__*/jsxs(Fragment, {
    children: [dontsInstructions, dosInstructions]
  });
  return /*#__PURE__*/jsx("ul", {
    className: clsx('tw-instructions', className),
    children: orderedInstructions
  });
};
function Instruction({
  item,
  type
}) {
  const isInstructionNode = typeof item === 'object' && item !== null && 'content' in item && 'aria-label' in item;
  return /*#__PURE__*/jsxs("li", {
    className: "instruction",
    children: [type === 'do' ? /*#__PURE__*/jsx(CheckCircleFill, {
      size: 24,
      className: type,
      title: isInstructionNode ? item['aria-label'] : undefined
    }) : /*#__PURE__*/jsx(CrossCircleFill, {
      size: 24,
      className: type,
      title: isInstructionNode ? item['aria-label'] : undefined
    }), /*#__PURE__*/jsx(Body, {
      className: "text-primary",
      type: Typography.BODY_LARGE,
      preserveNewlines: true,
      children: isInstructionNode ? item.content : item
    })]
  });
}

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