import React, { memo } from 'react';
import MuiChip from '@mui/material/Chip';
import type { ChipProps as MuiChipProps } from '@mui/material/Chip';
import clsx from 'clsx';
import createClasses from './styles';

export interface ChipsProps extends MuiChipProps {
  /**
   * Indicate whether the chip is being displayed in an error state.
   */
  error?: boolean;
}

const Chips = (props: ChipsProps) => {
  const classes = createClasses();
  const { error } = props;

  return <MuiChip role="none" className={clsx(error && classes.chipsError)} {...props} />;
};

const m = memo(Chips);
export { m as Chips };
