{"version":3,"file":"Tag.mjs","names":[],"sources":["../../../src/tag/Tag.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 classNames from 'classnames';\nimport type React from 'react';\n\nimport { type CommonProps } from '../_common/types';\nimport { ConditionalWrap } from '../conditional-wrap';\nimport { XMarkIconOutline } from '../icons/generated/heroIcons/XMarkIconOutline';\n\ninterface TagProps {\n  /** The content of the tag */\n  children: React.ReactNode;\n  /** Type of the tag */\n  type?: 'destructive' | 'default';\n  /** Size of the tag */\n  size?: 'small' | 'medium' | 'large';\n  /** Callback function triggered when tag should be removed */\n  onClick?: React.MouseEventHandler<HTMLButtonElement>;\n}\n\n/**\n * @deprecated Use `ReadOnlyTag`, `DismissibleTag`, or `SelectableTag` instead. This component will be removed in v5.\n *\n * Tag component is a small visual element that represents a tag.\n * A tag is always removable. If you want a non removable tag, use the StatusLabel component instead.\n */\nexport const Tag = ({\n  children,\n  type = 'default',\n  size = 'medium',\n  onClick,\n  className,\n  style,\n  htmlAttributes,\n  ref,\n  ...restProps\n}: CommonProps<'div', TagProps>) => {\n  const classes = classNames(`ndl-tag`, className, {\n    'ndl-destructive': type === 'destructive',\n    'ndl-large': size === 'large',\n    'ndl-medium': size === 'medium',\n    'ndl-small': size === 'small',\n  });\n\n  return (\n    <div\n      className={classes}\n      ref={ref}\n      style={style}\n      {...restProps}\n      {...htmlAttributes}\n    >\n      <ConditionalWrap\n        shouldWrap={type === 'destructive'}\n        wrap={(children) => (\n          <button type=\"button\" onClick={onClick}>\n            {children}\n          </button>\n        )}\n      >\n        <span className=\"ndl-tag-content\">{children}</span>\n      </ConditionalWrap>\n      {type !== 'destructive' && (\n        <button\n          type=\"button\"\n          className=\"ndl-remove-icon\"\n          onClick={onClick}\n          aria-label=\"Remove tag\"\n        >\n          <XMarkIconOutline />\n        </button>\n      )}\n    </div>\n  );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6CE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;;;;;;AARF,MAAa,OAAO,SAUgB;CAVhB,IAAA,EAClB,UACA,OAAO,WACP,OAAO,UACP,SACA,WACA,OACA,gBACA,QAAA,MACG,YAAA,yBAAA,MAAA,SAAA;CAEH,MAAM,UAAU,WAAW,WAAW,WAAW;EAC/C,mBAAmB,SAAS;EAC5B,aAAa,SAAS;EACtB,cAAc,SAAS;EACvB,aAAa,SAAS;CACxB,CAAC;CAED,OACE,qBAAC,OAAA,eAAA,eAAA,eAAA;EACC,WAAW;EACN;EACE;CACH,GAAA,SAAA,GACA,cAAA,GAAA,CAAA,GAAA,EAAA,UALN,CAOE,oBAAC,iBAAD;EACE,YAAY,SAAS;EACrB,OAAO,aACL,oBAAC,UAAD;GAAQ,MAAK;GAAkB;GAC5B;EACK,CAAA;EAGV,UAAA,oBAAC,QAAD;GAAM,WAAU;GAAmB;EAAe,CAAA;CACnC,CAAA,GAChB,SAAS,iBACR,oBAAC,UAAD;EACE,MAAK;EACL,WAAU;EACD;EACT,cAAW;EAEX,UAAA,oBAAC,kBAAD,CAAmB,CAAA;CACb,CAAA,CAEP,EAAA,CAAA,CAAA;AAET"}