{"version":3,"file":"ListItem.mjs","sources":["../../../../src/beta/components/ListItem.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport { PolymorphicComponentProps } from '@entur/utils';\nimport { TypographySpacing } from '../types';\nimport { getSpacingClasses } from '../utils/utils';\n\nimport './text.scss';\n\n/**\n * @beta Experimental component - may have breaking changes in future releases\n */\ntype ListItemBaseProps = {\n  /** Ekstra klassenavn */\n  className?: string;\n  /** Innholdet */\n  children: React.ReactNode;\n  /** Tittel */\n  title?: React.ReactNode;\n  /** Spacing around the component (same as Text and Heading components) */\n  spacing?: TypographySpacing;\n};\n\nexport type ListItemProps<C extends React.ElementType> =\n  PolymorphicComponentProps<C, ListItemBaseProps>;\n\n/**\n * @beta Experimental component - may have breaking changes in future releases\n */\nexport const ListItem = <C extends React.ElementType = 'li'>({\n  children,\n  className,\n  title,\n  spacing,\n  as,\n  ...rest\n}: ListItemProps<C>): JSX.Element => {\n  const ItemElement: React.ElementType = as || 'li';\n\n  return (\n    <ItemElement\n      className={classNames(\n        'eds-text--list-item',\n        getSpacingClasses(spacing, 'eds-text--list-item'),\n        className,\n      )}\n      {...rest}\n    >\n      {title && (\n        <span className=\"eds-text--list-item__title eds-text--weight-bold\">\n          {title}\n        </span>\n      )}\n      {children}\n    </ItemElement>\n  );\n};\n"],"names":[],"mappings":";;;;AA4BO,MAAM,WAAW,CAAqC;AAAA,EAC3D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAqC;AACnC,QAAM,cAAiC,MAAM;AAE7C,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA,kBAAkB,SAAS,qBAAqB;AAAA,QAChD;AAAA,MAAA;AAAA,MAED,GAAG;AAAA,MAEH,UAAA;AAAA,QAAA,SACC,oBAAC,QAAA,EAAK,WAAU,oDACb,UAAA,OACH;AAAA,QAED;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGP;"}