"use strict";var $=Object.create;var i=Object.defineProperty;var z=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var E=Object.getPrototypeOf;var R=Object.prototype.hasOwnProperty;var u=(t,o)=>i(t,"name",{value:o,configurable:true});var A=(t,o)=>{for(var n in o)i(t,n,{get:o[n],enumerable:true})};var x=(t,o,n,s)=>{if(o&&typeof o==="object"||typeof o==="function"){for(let r of W(o))if(!R.call(t,r)&&r!==n)i(t,r,{get:()=>o[r],enumerable:!(s=z(o,r))||s.enumerable})}return t};var a=(t,o,n)=>(n=t!=null?$(E(t)):{},x(o||!t||!t.__esModule?i(n,"default",{value:t,enumerable:true}):n,t));var M=t=>x(i({},"__esModule",{value:true}),t);var _={};A(_,{default:()=>H});module.exports=M(_);var e=require("react/jsx-runtime");var S=a(require("@mdi/react"));var d=a(require("classnames"));var w=require("lodash");var B=require("react");var F=a(require("react-jss"));var h=require("../../../config");var D=a(require("../loader/index"));let P="none";let I="none";if(typeof window!=="undefined"&&window&&window.matchMedia("(prefers-reduced-motion: no-preference)")){P="background .5s, opacity 0.3s";I="all 0.3s"}const O=u(t=>({button:{borderRadius:t.borderRadiusSmall,border:"none",display:"inline-flex",position:"relative",transition:P,textAlign:"center",outline:"none",alignItems:"center",padding:0,width:"auto",fontSize:t.uiFontSize,textDecoration:"none","&:hover":{opacity:.8},"&:active":{opacity:.5,transition:"none"}},label:{margin:"10px 20px",width:"100%",display:"flex",alignItems:"center",justifyContent:"center"},primary:{background:t.buttonPrimaryBackground,color:t.buttonPrimaryTextColor,"& svg":{fill:t.buttonPrimaryTextColor}},secondary:{background:t.buttonSecondaryBackground,color:t.buttonSecondaryTextColor,"& svg":{fill:t.buttonSecondaryTextColor}},success:{background:t.buttonSuccessBackground,color:t.buttonSuccessTextColor,"& svg":{fill:t.buttonSuccessTextColor}},danger:{background:t.buttonDangerBackground,color:t.buttonDangerTextColor,"& svg":{fill:t.buttonDangerTextColor}},warning:{background:t.buttonWarningBackground,color:t.buttonWarningTextColor,"& svg":{fill:t.buttonWarningTextColor}},inverted:{background:t.buttonInvertedBackground,color:t.buttonInvertedTextColor,border:t.buttonInvertedBorder,"& svg":{fill:t.buttonInvertedTextColor}},disabled:{opacity:t.inputDisabledOpacity},loaderContainer:{height:20,transition:I,marginLeft:o=>o.busy?20:10,marginRight:o=>o.busy?-20:-10,position:()=>"inherit"},icon:{margin:[1,10,0,-5]}}),"styles");class k extends B.Component{constructor(o){super(o);this.state={busy:this.props.busy||false}}static getDerivedStateFromProps(o){return{busy:o.busy||false}}render(){const{classes:o,className:n,id:s,label:r,loaded:c,icon:p,href:b,target:y,htmlForm:g,type:L="button",disabled:f=false,onClick:m=w.noop,buttonType:T="primary"}=this.props;const{busy:C}=this.state;let l=false;if(c){l=!c;console.warn("Ferdium Button prop `loaded` will be deprecated in the future. Please use `busy` instead")}if(C){l=C}const v=(0,e.jsxs)(e.Fragment,{children:[l&&(0,e.jsx)("div",{className:o.loaderContainer,children:(0,e.jsx)(D.default,{size:18,color:h.DEFAULT_LOADER_COLOR})}),(0,e.jsxs)("div",{className:o.label,children:[p&&(0,e.jsx)(S.default,{path:p,size:.8,className:o.icon}),r]})]});const N=b?(0,e.jsx)("a",{href:b,target:y,onClick:m,className:(0,d.default)({[`${o.button}`]:true,[`${o[T]}`]:true,[`${n}`]:n}),rel:y==="_blank"?"noopener":"","data-type":"franz-button",children:v}):(0,e.jsx)("button",{id:s,type:L,onClick:m,className:(0,d.default)({[`${o.button}`]:true,[`${o[T]}`]:true,[`${o.disabled}`]:f,[`${n}`]:n}),disabled:f,"data-type":"franz-button",...g&&{form:g},children:v});return N}}u(k,"ButtonComponent");var H=(0,F.default)(O,{injectTheme:true})(k);
