"use strict";var I=Object.create;var r=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var k=Object.getPrototypeOf;var P=Object.prototype.hasOwnProperty;var a=(t,s)=>r(t,"name",{value:s,configurable:true});var C=(t,s)=>{for(var i in s)r(t,i,{get:s[i],enumerable:true})};var b=(t,s,i,n)=>{if(s&&typeof s==="object"||typeof s==="function"){for(let e of R(s))if(!P.call(t,e)&&e!==i)r(t,e,{get:()=>s[e],enumerable:!(n=N(s,e))||n.enumerable})}return t};var c=(t,s,i)=>(i=t!=null?I(k(t)):{},b(s||!t||!t.__esModule?r(i,"default",{value:t,enumerable:true}):i,t));var D=t=>b(r({},"__esModule",{value:true}),t);var U={};C(U,{default:()=>L});module.exports=D(U);var o=require("react/jsx-runtime");var f=require("@mdi/js");var l=c(require("classnames"));var p=require("lodash");var g=require("react");var h=c(require("react-jss"));var d=c(require("../icon"));const w=a(t=>{const s={};for(const i of Object.keys(t.styleTypes)){Object.assign(s,{[i]:{background:t.styleTypes[i].accent,color:t.styleTypes[i].contrast,border:t.styleTypes[i].border,"& svg":{fill:t.styleTypes[i].contrast}}})}return s},"buttonStyles");const O="none";const W="none";const z=a(t=>({wrapper:{position:"relative",overflow:"hidden",height:"auto"},infobox:{alignItems:"center",borderRadius:t.borderRadiusSmall,display:"flex",height:"auto",padding:"15px 20px",top:0,transition:O,opacity:1,marginBottom:30},dismissing:{marginTop:-100,opacity:0},content:{flex:1},icon:{marginRight:10},close:{color:s=>t.styleTypes[s.type||"primary"].contrast,marginRight:-5,border:0,background:"none"},cta:{borderColor:s=>t.styleTypes[s.type||"primary"].contrast,borderRadius:t.borderRadiusSmall,borderStyle:"solid",borderWidth:1,background:"none",color:s=>t.styleTypes[s.type||"primary"].contrast,marginLeft:15,padding:[4,10],fontSize:t.uiFontSize,transition:W,"&:hover":{opacity:.6}},...w(t)}),"styles");class u extends g.Component{constructor(s){super(s);this.state={isDismissing:false,dismissed:false}}dismiss(){const{onDismiss:s=p.noop}=this.props;this.setState({isDismissing:true});if(s){s()}setTimeout(()=>{this.setState({dismissed:true})},3e3)}componentWillUnmount(){const{onUnmount:s}=this.props;if(s)s()}render(){const{classes:s,children:i,icon:n,type:e="primary",dismissible:T=false,ctaOnClick:v=p.noop,ctaLabel:m="",className:y=""}=this.props;const{isDismissing:S,dismissed:x}=this.state;if(x){return null}return(0,o.jsx)("div",{className:(0,l.default)({[s.wrapper]:true,[`${y}`]:y}),children:(0,o.jsxs)("div",{className:(0,l.default)({[s.infobox]:true,[s[`${e}`]]:e,[s.dismissing]:S}),"data-type":"franz-infobox",children:[n&&(0,o.jsx)(d.default,{icon:n,className:s.icon}),(0,o.jsx)("div",{className:s.content,children:i}),m&&(0,o.jsx)("button",{className:s.cta,onClick:v,type:"button",children:m}),T&&(0,o.jsx)("button",{type:"button",onClick:this.dismiss.bind(this),className:s.close,children:(0,o.jsx)(d.default,{icon:f.mdiClose})})]})})}}a(u,"InfoboxComponent");var L=(0,h.default)(z,{injectTheme:true})(u);
