{"version":3,"file":"DismissibleTag.mjs","names":[],"sources":["../../../src/dismissible-tag/DismissibleTag.tsx"],"sourcesContent":["/*!\n *\n *  Copyright (c) \"Neo4j\"\n *  Neo4j Sweden AB [http://neo4j.com]\n *\n *  This file is part of Neo4j.\n *\n *  Neo4j is free software: you can redistribute it and/or modify\n *  it under the terms of the GNU General Public License as published by\n *  the Free Software Foundation, either version 3 of the License, or\n *  (at your option) any later version.\n *\n *  This program is distributed in the hope that it will be useful,\n *  but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\nimport type React from 'react';\nimport { useId } from 'react';\n\nimport { type CommonProps } from '../_common/types';\nimport { XMarkIconOutline } from '../icons/generated/heroIcons/XMarkIconOutline';\nimport type { TagColor, TagSize } from '../tag-base';\nimport { TagBase } from '../tag-base';\n\ninterface DismissibleTagProps {\n  /** Categorical color for the background */\n  color?: TagColor;\n  /** The content of the tag */\n  children?: React.ReactNode;\n  /** Icon to display before the content */\n  leadingVisual?: React.ReactNode;\n  /** Size of the tag */\n  size?: TagSize;\n  /** Callback function triggered when tag should be removed. */\n  onRemove: React.MouseEventHandler<HTMLButtonElement>;\n}\n\nexport const DismissibleTag = ({\n  size = 'medium',\n  color,\n  children,\n  htmlAttributes,\n  leadingVisual,\n  onRemove,\n  ...restProps\n}: CommonProps<'div', DismissibleTagProps>) => {\n  const contentId = useId();\n\n  return (\n    <TagBase\n      color={color}\n      contentId={contentId}\n      htmlAttributes={htmlAttributes}\n      leadingVisual={leadingVisual}\n      size={size}\n      trailingContent={\n        <button\n          type=\"button\"\n          className=\"ndl-remove-icon\"\n          data-ndl-dismissible-tag-remove\n          onClick={onRemove}\n          aria-describedby={contentId}\n          aria-label=\"Remove\"\n        >\n          <XMarkIconOutline />\n        </button>\n      }\n      {...restProps}\n    >\n      {children}\n    </TagBase>\n  );\n};\n"],"mappings":";;;;;;;;CA0CE;CACA;CACA;CACA;CACA;CACA;;;;;;;;;;;;;;;;;;;;;;AANF,MAAa,kBAAkB,SAQgB;CARhB,IAAA,EAC7B,OAAO,UACP,OACA,UACA,gBACA,eACA,aAAA,MACG,YAAA,yBAAA,MAAA,SAAA;CAEH,MAAM,YAAY,MAAM;CAExB,OACE,oBAAC,SAAA,eAAA,eAAA;EACQ;EACI;EACK;EACD;EACT;EACN,iBACE,oBAAC,UAAD;GACE,MAAK;GACL,WAAU;GACV,mCAAA;GACA,SAAS;GACT,oBAAkB;GAClB,cAAW;GAEX,UAAA,oBAAC,kBAAD,CAAmB,CAAA;EACb,CAAA;CAEN,GAAA,SAAA,GAAA,CAAA,GAAA,EAEH,SAAA,CACM,CAAA;AAEb"}