{"version":3,"file":"ProgressBar.mjs","names":[],"sources":["../../../src/progress-bar/ProgressBar.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 {\n  type HtmlAttributes,\n  type PolymorphicCommonProps,\n} from '../_common/types';\n\ntype ProgressBarProps = {\n  /** The heading displayed above the progress bar */\n  heading?: string;\n  /** The current progress value, should be between 0 and 100 */\n  value: number;\n  /** Size of the progress bar */\n  size: 'small' | 'large';\n  /** Additional class names */\n  className?: string;\n  /** Additional HTML attributes */\n  htmlAttributes?: HtmlAttributes<'div'>;\n};\n\nexport const ProgressBar = <T extends React.ElementType = 'div'>({\n  as,\n  heading,\n  value,\n  size = 'small',\n  className,\n  style,\n  htmlAttributes,\n  ref,\n  ...restProps\n}: PolymorphicCommonProps<T, ProgressBarProps>) => {\n  const classes = classNames('ndl-progress-bar-wrapper', className, {\n    'ndl-large': size === 'large',\n    'ndl-small': size === 'small',\n  });\n  const Component: React.ElementType = as ?? 'div';\n\n  return (\n    <Component\n      className={classes}\n      style={style}\n      ref={ref}\n      {...restProps}\n      {...htmlAttributes}\n    >\n      {heading && (\n        <div className=\"ndl-header\">\n          <span className=\"ndl-heading\">{heading}</span>\n          <span className=\"ndl-progress-number\">{`${value}%`}</span>\n        </div>\n      )}\n      <div className=\"ndl-progress-bar-wrapper-inner\">\n        <div\n          className=\"ndl-progress-bar-container\"\n          role=\"progressbar\"\n          title=\"progress bar\"\n          aria-valuemin={0}\n          aria-valuemax={100}\n          aria-valuenow={value}\n        >\n          <div className=\"ndl-progress-bar\" style={{ width: `${value}%` }} />\n        </div>\n      </div>\n    </Component>\n  );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;CA0CE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;AARF,MAAa,eAAoD,SAUd;CAVc,IAAA,EAC/D,IACA,SACA,OACA,OAAO,SACP,WACA,OACA,gBACA,QAAA,MACG,YAAA,yBAAA,MAAA,SAAA;CAEH,MAAM,UAAU,WAAW,4BAA4B,WAAW;EAChE,aAAa,SAAS;EACtB,aAAa,SAAS;CACxB,CAAC;CAGD,OACE,qBAHmC,OAAA,QAAA,OAAA,KAAA,IAAA,KAAM,OAAA,eAAA,eAAA,eAAA;EAIvC,WAAW;EACJ;EACF;CACD,GAAA,SAAA,GACA,cAAA,GAAA,CAAA,GAAA,EAAA,UALN,CAOG,WACC,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,oBAAC,QAAD;GAAM,WAAU;GAAe,UAAA;EAAc,CAAA,GAC7C,oBAAC,QAAD;GAAM,WAAU;GAAuB,UAAA,GAAG,MAAM;EAAS,CAAA,CACtD;CAEP,CAAA,GAAA,oBAAC,OAAD;EAAK,WAAU;EACb,UAAA,oBAAC,OAAD;GACE,WAAU;GACV,MAAK;GACL,OAAM;GACN,iBAAe;GACf,iBAAe;GACf,iBAAe;GAEf,UAAA,oBAAC,OAAD;IAAK,WAAU;IAAmB,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG;GAAI,CAAA;EAC/D,CAAA;CACF,CAAA,CACI,EAAA,CAAA,CAAA;AAEf"}