{"version":3,"file":"OperationalTag.mjs","names":[],"sources":["../../../src/operational-tag/OperationalTag.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 type { TagSize } from '../tag-base';\n\nexport interface OperationalTagProps {\n  /** The content of the tag */\n  children?: React.ReactNode;\n  /** Whether the tag is in an active (pressed) state */\n  isActive?: boolean;\n  /** Whether the tag is disabled */\n  isDisabled?: boolean;\n  /** Icon to display before the content */\n  leadingVisual?: React.ReactNode;\n  /** Decorative color shown before the content to help users recognize the item. It carries no meaning of its own and is hidden from assistive technology, so the tag text must identify the item. Accepts a CSS variable or a hex color. */\n  leadingColor?: React.CSSProperties['color'];\n  /** Size of the tag */\n  size?: TagSize;\n  /** Callback fired when the tag is clicked */\n  onClick?: React.MouseEventHandler<HTMLButtonElement>;\n}\n\n/**\n * @remarks\n * Clickable tag for actions and for identifying an item with a color or icon.\n * For choosing from a set of options, use `SelectableTag`.\n */\nexport const OperationalTag = ({\n  children,\n  className,\n  htmlAttributes,\n  isActive,\n  leadingVisual,\n  leadingColor,\n  onClick,\n  ref,\n  isDisabled = false,\n  size = 'medium',\n  style,\n  ...restProps\n}: CommonProps<'button', OperationalTagProps>) => {\n  const classes = classNames('ndl-tag-operational', className, {\n    'ndl-active': isActive,\n    'ndl-disabled': isDisabled,\n    'ndl-large': size === 'large',\n    'ndl-medium': size === 'medium',\n    'ndl-small': size === 'small',\n    'ndl-x-small': size === 'x-small',\n  });\n\n  return (\n    <button\n      aria-pressed={isActive}\n      type=\"button\"\n      className={classes}\n      disabled={isDisabled}\n      onClick={onClick}\n      ref={ref}\n      style={style}\n      {...htmlAttributes}\n      {...restProps}\n    >\n      {Boolean(leadingColor) && (\n        <span\n          aria-hidden=\"true\"\n          className=\"ndl-operational-tag-leading-color\"\n          style={{ backgroundColor: leadingColor }}\n        />\n      )}\n      {Boolean(leadingVisual) && (\n        <span className=\"ndl-operational-tag-leading-visual\">\n          {leadingVisual}\n        </span>\n      )}\n      <span className=\"ndl-operational-tag-content\">{children}</span>\n    </button>\n  );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;CAiDE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;;;;;AAXF,MAAa,kBAAkB,SAamB;CAbnB,IAAA,EAC7B,UACA,WACA,gBACA,UACA,eACA,cACA,SACA,KACA,aAAa,OACb,OAAO,UACP,UAAA,MACG,YAAA,yBAAA,MAAA,SAAA;CAEH,MAAM,UAAU,WAAW,uBAAuB,WAAW;EAC3D,cAAc;EACd,gBAAgB;EAChB,aAAa,SAAS;EACtB,cAAc,SAAS;EACvB,aAAa,SAAS;EACtB,eAAe,SAAS;CAC1B,CAAC;CAED,OACE,qBAAC,UAAA,eAAA,eAAA,eAAA;EACC,gBAAc;EACd,MAAK;EACL,WAAW;EACX,UAAU;EACD;EACJ;EACE;CACH,GAAA,cAAA,GACA,SAAA,GAAA,CAAA,GAAA,EAAA,UATN;EAWG,QAAQ,YAAY,KACnB,oBAAC,QAAD;GACE,eAAY;GACZ,WAAU;GACV,OAAO,EAAE,iBAAiB,aAAa;EACxC,CAAA;EAEF,QAAQ,aAAa,KACpB,oBAAC,QAAD;GAAM,WAAU;GACb,UAAA;EACG,CAAA;EAER,oBAAC,QAAD;GAAM,WAAU;GAA+B;EAAe,CAAA;CACxD,EAAA,CAAA,CAAA;AAEZ"}