{"version":3,"file":"ButtonSpinner.mjs","names":[],"sources":["../../../src/_common/ButtonSpinner.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';\n\nimport { type CommonProps } from './types';\n\nconst RADIUS = 7;\nconst CIRCUMFERENCE = 2 * Math.PI * RADIUS;\nconst ARC_FRACTION = 0.25;\n\ntype ButtonSpinnerProps = {\n  loadingMessage: string;\n  size?: 'small' | 'medium' | 'large';\n};\n\nexport const ButtonSpinner = ({\n  loadingMessage,\n  size = 'small',\n  htmlAttributes,\n  ...restProps\n}: CommonProps<'div', ButtonSpinnerProps>) => {\n  const classes = classNames('ndl-btn-spin', {\n    'ndl-large': size === 'large',\n    'ndl-medium': size === 'medium',\n    'ndl-small': size === 'small',\n  });\n\n  return (\n    <div className=\"ndl-btn-spinner-wrapper\" {...restProps} {...htmlAttributes}>\n      <svg\n        className={classes}\n        viewBox=\"0 0 16 16\"\n        fill=\"none\"\n        aria-hidden=\"true\"\n      >\n        <circle\n          cx=\"8\"\n          cy=\"8\"\n          r={RADIUS}\n          stroke=\"currentColor\"\n          strokeWidth=\"2\"\n          strokeLinecap=\"round\"\n          strokeDasharray={`${CIRCUMFERENCE * ARC_FRACTION} ${CIRCUMFERENCE * (1 - ARC_FRACTION)}`}\n        />\n      </svg>\n      <span className=\"ndl-btn-spinner-text\" role=\"status\">\n        {loadingMessage}\n      </span>\n    </div>\n  );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;CAkCE;CACA;CACA;;AAZF,MAAM,SAAS;AACf,MAAM,gBAAgB,IAAI,KAAK,KAAK;AACpC,MAAM,eAAe;AAOrB,MAAa,iBAAiB,SAKgB;CALhB,IAAA,EAC5B,gBACA,OAAO,SACP,mBAAA,MACG,YAAA,yBAAA,MAAA,SAAA;CAEH,MAAM,UAAU,WAAW,gBAAgB;EACzC,aAAa,SAAS;EACtB,cAAc,SAAS;EACvB,aAAa,SAAS;CACxB,CAAC;CAED,OACE,qBAAC,OAAA,eAAA,eAAA,eAAA,EAAI,WAAU,0BAAA,GAA8B,SAAA,GAAe,cAAA,GAAA,CAAA,GAAA,EAAA,UAA5D,CACE,oBAAC,OAAD;EACE,WAAW;EACX,SAAQ;EACR,MAAK;EACL,eAAY;EAEZ,UAAA,oBAAC,UAAD;GACE,IAAG;GACH,IAAG;GACH,GAAG;GACH,QAAO;GACP,aAAY;GACZ,eAAc;GACd,iBAAiB,GAAG,gBAAgB,aAAa,GAAG,gBAAiB;EACtE,CAAA;CACE,CAAA,GACL,oBAAC,QAAD;EAAM,WAAU;EAAuB,MAAK;EACzC,UAAA;CACG,CAAA,CACH,EAAA,CAAA,CAAA;AAET"}