{"version":3,"file":"button_with_spinner-C897WIws.js","sources":["../../app/javascript/components/button_with_spinner.jsx"],"sourcesContent":["// Third-party imports.\nimport React from \"react\";\nimport PropTypes from \"prop-types\";\n\nclass ButtonWithSpinner extends React.Component {\n  static propTypes = {\n    // Text on the button.\n    text: PropTypes.string.isRequired,\n    dataAnalyticsId: PropTypes.string,\n\n    // Optional: This is used if you want to explicitly pass a function to call.\n    // This is not necessary if you are using this is as a button to a form.\n    onClick: PropTypes.func,\n\n    // When this is true, hide the text and display the spinning animation. When it is false,\n    // display the text and hide the animation.\n    isSpinning: PropTypes.bool.isRequired,\n\n    // Optional. If true, disable clicking on the button.\n    isDisabled: PropTypes.bool,\n  };\n\n  constructor(props) {\n    super(props);\n    this.state = {};\n  }\n\n  render() {\n    // TODO: Make sure this is not breaking anything\n    let inputElement = null;\n\n    if (this.props.onClick !== null) {\n      inputElement = (\n        <input\n          type=\"submit\"\n          data-analytics-id={this.props.dataAnalyticsId}\n          className={`primary-button ${this.props.isSpinning ? \"spin-hidden-text\" : \"\"}`}\n          value={this.props.text}\n          disabled={this.props.isDisabled}\n          onClick={this.props.onClick}\n          style={{ width: `${this.widthInRems}rem` }}\n        />\n      );\n    } else {\n      inputElement = (\n        <input\n          type=\"submit\"\n          data-analytics-id={this.props.dataAnalyticsId}\n          className={`primary-button ${this.props.isSpinning ? \"spin-hidden-text\" : \"\"}`}\n          value={this.props.text}\n          disabled={this.props.isDisabled}\n          style={{ width: `${this.widthInRems}rem` }}\n        />\n      );\n    }\n\n    const spinElement = this.props.isSpinning ? <div className=\"spin-element\" /> : null;\n\n    return (\n      <div className=\"button-with-spinner\">\n        {inputElement}\n\n        <div className=\"spin-container\">{spinElement}</div>\n      </div>\n    );\n  }\n}\n\nexport default ButtonWithSpinner;\n"],"names":["ButtonWithSpinner","React","props","inputElement","jsx","spinElement","jsxs","__publicField","PropTypes"],"mappings":"moBAIA,MAAMA,UAA0BC,EAAM,SAAU,CAkB9C,YAAYC,EAAO,CACjB,MAAMA,CAAK,EACX,KAAK,MAAQ,CAAC,CAAA,CAGhB,QAAS,CAEP,IAAIC,EAAe,KAEf,KAAK,MAAM,UAAY,KAEvBA,EAAAC,EAAA,IAAC,QAAA,CACC,KAAK,SACL,oBAAmB,KAAK,MAAM,gBAC9B,UAAW,kBAAkB,KAAK,MAAM,WAAa,mBAAqB,EAAE,GAC5E,MAAO,KAAK,MAAM,KAClB,SAAU,KAAK,MAAM,WACrB,QAAS,KAAK,MAAM,QACpB,MAAO,CAAE,MAAO,GAAG,KAAK,WAAW,KAAM,CAAA,CAC3C,EAIAD,EAAAC,EAAA,IAAC,QAAA,CACC,KAAK,SACL,oBAAmB,KAAK,MAAM,gBAC9B,UAAW,kBAAkB,KAAK,MAAM,WAAa,mBAAqB,EAAE,GAC5E,MAAO,KAAK,MAAM,KAClB,SAAU,KAAK,MAAM,WACrB,MAAO,CAAE,MAAO,GAAG,KAAK,WAAW,KAAM,CAAA,CAC3C,EAIE,MAAAC,EAAc,KAAK,MAAM,iBAAc,MAAI,CAAA,UAAU,cAAe,CAAA,EAAK,KAG7E,OAAAC,EAAA,KAAC,MAAI,CAAA,UAAU,sBACZ,SAAA,CAAAH,EAEAC,EAAA,IAAA,MAAA,CAAI,UAAU,iBAAkB,SAAYC,CAAA,CAAA,CAAA,EAC/C,CAAA,CAGN,CA7DEE,EADIP,EACG,YAAY,CAEjB,KAAMQ,EAAU,OAAO,WACvB,gBAAiBA,EAAU,OAI3B,QAASA,EAAU,KAInB,WAAYA,EAAU,KAAK,WAG3B,WAAYA,EAAU,IACxB"}