Comparing version 0.2.0 to 0.2.1
@@ -1,1 +0,1 @@ | ||
var rt=Object.defineProperty;var st=(t,e,o)=>e in t?rt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var h=(t,e,o)=>(st(t,typeof e!="symbol"?e+"":e,o),o);import G from"react";import v from"prop-types";import nt from"classnames";var D=(t,e)=>{let o={};t.block||(o.display=t.inlineDisplay),o={...o,...t.style};let r={...t};return"block"in r&&delete r.block,"inlineDisplay"in r&&delete r.inlineDisplay,G.createElement("div",{...r,ref:e,style:o,className:nt(t.className,{block:t.block})},t.children)};D=G.forwardRef(D);D.propTypes={style:v.object,children:v.node,block:v.bool,className:v.string,inlineDisplay:v.string};D.defaultProps={inlineDisplay:"inline-block"};var W=D;import n from"react";import S from"prop-types";import ct from"classnames";import{getYear as Q,getMonth as F,startOfISOWeek as ut,endOfMonth as dt,format as w,addWeeks as ft,addDays as ht,parse as $}from"date-fns";var m="yyyy-MM-dd";import{isValid as it,parse as at}from"date-fns";function lt(t){return it(at(t,m,new Date))}var J=(t,e,o)=>{let r=t[e];return r===null||typeof r=="undefined"?new TypeError(`Missing required ISO 8601 date prop: ${r} for ${e} in ${o}`):typeof r!="string"?new TypeError(`Invalid type for ISO 8601 date: ${r} for ${e} in ${o}`):lt(r)?null:new TypeError(`Invalid value of ISO 8601 date: ${r} for ${e} in ${o}`)},pt=(t,e,o)=>t[e]==null||typeof t[e]=="undefined"?null:J(t,e,o);pt.isRequired=J;var mt=n.createElement("svg",{width:"24",height:"24",viewBox:"0 0 6.35 6.35"},n.createElement("g",{transform:"translate(0,-290.65)"},n.createElement("path",{style:{fill:"none",stroke:"#333",strokeWidth:"0.5291667",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"},d:"M 3.96875,292.2375 2.3812499,293.825 3.96875,295.4125"}))),yt=n.createElement("svg",{width:"24",height:"24",viewBox:"0 0 6.35 6.35"},n.createElement("g",{transform:"translate(0,-290.65)"},n.createElement("path",{style:{fill:"none",stroke:"#333",strokeWidth:"0.5291667",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"},d:"M 2.38125,292.2375 3.9687501,293.825 2.38125,295.4125",id:"path817"}))),C=class extends n.Component{constructor(e){super(e);this.state={...this.state,...this.splitDateValue(this.props.current)}}shouldComponentUpdate(e,o){return e.selectDay!==this.props.selectDay||e.current!==this.props.current||o!==this.state}splitDateValue(e){let o=Q(new Date),r=F(new Date);if(typeof e=="string"){let u=$(e,m,new Date);o=Q(u),r=F(u)}return{year:o,month:r}}componentDidUpdate(e){this.props.current!==e.current&&typeof this.props.current=="string"&&this.setState(this.splitDateValue(this.props.current))}selectDay=e=>{typeof this.props.selectDay=="function"&&this.props.selectDay(e)};prevMonth=()=>{this.setState(e=>{let o={month:e.month-1};return o.month<0&&(o.month=11,o.year=e.year-1),o})};nextMonth=()=>{this.setState(e=>{let o={month:e.month+1};return o.month>=12&&(o.month=0,o.year=e.year+1),o})};render(){let e=w(new Date,m),o=[],r=ut(new Date(this.state.year,this.state.month)),u=dt(new Date(this.state.year,this.state.month)),d=r;for(;+d<+u;){let a=[];for(var y=0;y<7;y++)a.push(w(ht(d,y),m));o.push(a),d=ft(d,1)}return n.createElement("div",{className:"MIRECO-calendar"},n.createElement("div",{className:"calendar-header"},n.createElement("h5",null,w(new Date(this.state.year,this.state.month),"MMMM yyyy")),n.createElement("button",{type:"button",tabIndex:-1,alt:"Prev Month",onClick:this.prevMonth},mt),n.createElement("button",{type:"button",tabIndex:-1,alt:"Next Month",onClick:this.nextMonth},yt)),n.createElement("table",null,n.createElement("tbody",null,n.createElement("tr",null,o[0].map((a,f)=>{let l=$(a,m,new Date);return n.createElement("th",{key:`header-${f}`},w(l,"EEEEEE"))})),o.map((a,f)=>n.createElement("tr",{key:`week-${f}`},a.map((l,p)=>{let T=$(l,m,new Date);return n.createElement("td",{key:`day-${p}`,className:ct({"outside-month":F(T)!=this.state.month,current:this.props.showCurrent&&this.props.current===l,highlight:typeof this.props.highlight=="function"&&this.props.highlight(l,e)})},n.createElement("button",{type:"button",tabIndex:-1,onClick:()=>{this.selectDay(l)}},w(T,"d")))}))))))}};h(C,"propTypes",{selectDay:S.func,current:mirecoPropTypes.date,showCurrent:S.bool,highlight:S.func}),h(C,"defaultProps",{showCurrent:!0,highlight:(e,o)=>e===o});import k from"react";var kt=k.createElement("svg",{version:"1.1",viewBox:"0 0 6.3499998 6.3499998",height:"24",width:"24"},k.createElement("g",{transform:"translate(0,-290.65)"},k.createElement("rect",{style:{fill:"none",fillOpacity:.271255,stroke:"#333333",strokeWidth:.396875,strokeLinecap:"round",strokeLinejoin:"round",strokeDashoffset:5.39717},width:"3.7041667",height:"3.1750121",x:"1.3229166",y:"292.23749",rx:"0.52916664"}),k.createElement("path",{style:{fill:"none",stroke:"#333333",strokeWidth:.396875,strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:4,strokeDasharray:"none",strokeOpacity:1},d:"M 1.3229167,293.29583 H 5.0270833"}),k.createElement("path",{style:{fill:"none",stroke:"#333333",strokeWidth:.1984375,strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:4,strokeDasharray:"none",strokeOpacity:1},d:"m 2.5135417,293.29583 v 2.11667"}),k.createElement("path",{style:{fill:"none",stroke:"#333333",strokeWidth:.1984375,strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:4,strokeDasharray:"none",strokeOpacity:1},d:"m 3.8364583,293.29583 v 2.11667"}),k.createElement("path",{style:{fill:"none",stroke:"#333333",strokeWidth:.1984375,strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:4,strokeDasharray:"none",strokeOpacity:1},d:"M 1.3229167,294.35417 H 5.0270833"})));import O from"react";import I from"prop-types";import xt from"classnames";import bt from"react";import c from"prop-types";import gt from"classnames";function V(t){return bt.createElement("button",{onClick:t.onClick,type:t.type,name:t.name,value:t.value,disabled:t.disabled,autoFocus:t.autoFocus,tabIndex:t.tabIndex,className:gt("MIRECO-button",{block:t.block},t.className),style:t.style},t.children)}V.propTypes={onClick:c.func,type:c.oneOf(["button","submit"]),name:c.string,value:c.string,disabled:c.bool,autoFocus:c.bool,tabIndex:c.number,children:c.node,block:c.bool,className:c.string,style:c.object};V.defaultProps={type:"button",tabIndex:0,disabled:!1};var X=V;import L from"react";var q=L.createElement("svg",{width:"24",height:"24",viewBox:"0 0 6.35 6.35"},L.createElement("g",{transform:"translate(0,-290.65)"},L.createElement("path",{style:{fill:"none",stroke:"#333333",strokeWidth:"0.66145833",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"},d:"m 1.0583333,291.70833 4.2333334,4.23334"}),L.createElement("path",{style:{fill:"none",stroke:"#333333",strokeWidth:"0.66145833",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"},d:"m 1.0583333,295.94167 4.2333334,-4.23334"})));function _(t){return O.createElement(X,{tabIndex:-1,onClick:t.onClick,className:xt("MIRECO-clear-button content outline",t.className),disabled:t.disabled},t.spaced&&O.createElement(O.Fragment,null,"\xA0"),q,t.spaced&&O.createElement(O.Fragment,null,"\xA0"))}_.propTypes={onClick:I.func,disabled:I.bool,className:I.string,spaced:I.bool};_.defaultProps={disabled:!1,spaced:!0};var z=_;import b from"react";var vt=b.createElement("svg",{width:"24",height:"24",viewBox:"0 0 6.3499998 6.3499998",version:"1.1"},b.createElement("g",{transform:"translate(0,-290.65)"},b.createElement("circle",{r:"1.8520833",cy:"293.82501",cx:"3.175",style:{fill:"none",fillOpacity:.271255,stroke:"#333333",strokeWidth:.396875,strokeLinecap:"round",strokeLinejoin:"round",strokeDashoffset:5.39717,strokeMiterlimit:4,strokeDasharray:"none"}}),b.createElement("path",{d:"m 3.175,293.825 0,-1.19063",style:{fill:"none",stroke:"#333333",strokeWidth:.396875,strokeLinecap:"round",strokeLinejoin:"miter",strokeMiterlimit:4,strokeDasharray:"none",strokeOpacity:1}}),b.createElement("path",{d:"m 3.175,293.825 0.79375,0.52917",style:{fill:"none",stroke:"#333333",strokeWidth:.396875,strokeLinecap:"round",strokeLinejoin:"miter",strokeMiterlimit:4,strokeDasharray:"none",strokeOpacity:1}}),b.createElement("circle",{r:"0.26458332",cy:"293.82501",cx:"3.175",style:{fill:"#333333",fillOpacity:1,stroke:"none",strokeWidth:.132292,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:4,strokeDasharray:"none",strokeDashoffset:5.39717,strokeOpacity:1}})));import A from"react";var K=A.createElement("svg",{viewBox:"0 0 6.3499998 6.3499998",height:"24",width:"24"},A.createElement("g",{transform:"translate(0,-290.65)"},A.createElement("path",{d:"m 4.7624938,293.03124 -1.5875,1.5875 -1.5875,-1.5875",style:{fill:"none",stroke:"#333333",strokeWidth:.529167,strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:4,strokeDasharray:"none",strokeOpacity:1}})));import g,{useRef as R,useEffect as tt}from"react";import i from"prop-types";import et from"classnames";import{useRef as Dt,useEffect as wt}from"react";function Z(t){let e=Dt();return wt(()=>{e.current=t},[t]),e.current}var P=(t,e)=>{let o=()=>{t.onSelect(t.option.value)};return g.createElement("li",{className:et({current:t.current}),ref:e},g.createElement("button",{type:"button",tabIndex:-1,disabled:t.disabled,onClick:o},t.option.label))};P=g.forwardRef(P);P.propTypes={current:i.bool,disabled:i.bool,option:i.shape({value:i.any,label:i.string.isRequired}),onSelect:i.func.isRequired};function U(t){let e=R(null),o=R(null),r=()=>{if(e.current&&o.current){let a=o.current,f=a.offsetTop,l=f+a.getBoundingClientRect().height,p=e.current,T=p.scrollTop+p.getBoundingClientRect().height;p.scrollTop>f&&(p.scrollTop=f),l>T&&(p.scrollTop=l-p.getBoundingClientRect().height)}};tt(()=>{r()},[]);let u=Z(t);tt(()=>{!u||typeof t.value!="undefined"&&t.value!==null&&t.value!==u.value&&r()});let d=a=>{typeof t.onSelect=="function"&&t.onSelect(a)},y;return t.options&&t.options.length?y=t.options.map((a,f)=>{let l={},p=a.value===t.value;return p&&(l={ref:o}),g.createElement(P,{...l,key:`option-${f}`,option:a,current:p,disabled:t.disabled,onSelect:d})}):y=g.createElement("li",{className:"none"},t.noOptionsPrompt),g.createElement("ul",{className:et("MIRECO-dropdown",{disabled:t.disabled}),tabIndex:-1,ref:e},t.beforeOptions,y,t.afterOptions)}U.propTypes={options:i.arrayOf(i.shape({value:i.any,label:i.string.isRequired})),value:i.any,disabled:i.bool,onSelect:i.func,block:i.bool,noOptionsPrompt:i.string,beforeOptions:i.node,afterOptions:i.node};U.defaultProps={noOptionsPrompt:"No options"};var Ct=U;import B from"react";var Ot=B.createElement("svg",{version:"1.1",viewBox:"0 0 6.3499998 6.3499998",height:"24",width:"24"},B.createElement("g",{transform:"translate(0,-290.65)"},B.createElement("path",{d:"m 1.984375,291.97292 h 2.38125 c 0,1.05833 -0.5291667,1.32291 -0.9260417,1.85208 0.396875,0.52917 0.9260417,0.79375 0.9260417,1.85208 h -2.38125 c 0,-1.05833 0.5291667,-1.32291 0.9260417,-1.85208 -0.396875,-0.52917 -0.9260417,-0.79375 -0.9260417,-1.85208 z",style:{fill:"none",stroke:"#333333",strokeWidth:.396875,strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:4,strokeDasharray:"none",strokeOpacity:1}}),B.createElement("path",{d:"M 2.5135417,295.14792 H 3.8364583 C 3.571875,294.75104 3.4395833,294.35417 3.175,294.48646 c 0,0.26458 -0.396875,0.26458 -0.6614583,0.66146 z",style:{fill:"#333333",fillOpacity:1,stroke:"none",strokeWidth:"0.264583px",strokeLinecap:"butt",strokeLinejoin:"miter",strokeOpacity:1}})));import ot from"react";import M from"prop-types";import Mt from"classnames";var N=class extends ot.PureComponent{render(){return ot.createElement("label",{className:Mt("MIRECO-label",{block:this.props.block},this.props.className),tabIndex:this.props.tabIndex,style:this.props.style},this.props.children)}};h(N,"propTypes",{block:M.bool,className:M.string,tabIndex:M.number,children:M.node,style:M.object});import E from"react";import Y from"prop-types";import Tt from"classnames";import H from"react";import s from"prop-types";import jt from"classnames";var x=class extends H.PureComponent{constructor(e){super(e);this.inputRef=H.createRef()}componentDidUpdate=(e,o)=>{this.props.disabled&&!e.disabled&&this.inputRef.current===document.activeElement&&typeof this.props.onBlur=="function"&&this.props.onBlur(),!this.props.disabled&&e.disabled&&this.inputRef.current===document.activeElement&&typeof this.props.onFocus=="function"&&this.props.onFocus()};handleChange=e=>{typeof this.props.onChange=="function"&&this.props.onChange(this.inputRef.current.value)};focus(){this.inputRef.current&&this.inputRef.current.focus()}blur(){this.inputRef.current&&this.inputRef.current.blur()}render(){return H.createElement("input",{ref:this.inputRef,value:this.props.value,onChange:this.handleChange,type:this.props.type,name:this.props.name,required:this.props.required,placeholder:this.props.placeholder||"",disabled:this.props.disabled,autoFocus:this.props.autoFocus,tabIndex:this.props.tabIndex,maxLength:this.props.maxLength,id:this.props.id,className:jt("MIRECO-text",{block:this.props.block,sized:!!this.props.size},this.props.className),style:this.props.style,size:this.props.size,onFocus:this.props.onFocus,onBlur:this.props.onBlur,onKeyDown:this.props.onKeyDown,onKeyUp:this.props.onKeyUp,onClick:this.props.onClick})}};h(x,"propTypes",{value:s.string,onChange:s.func,type:s.oneOf(["text","password","email"]),name:s.string,required:s.bool,placeholder:s.string,disabled:s.bool,autoFocus:s.bool,tabIndex:s.number,maxLength:s.number,id:s.string,block:s.bool,className:s.string,style:s.object,size:s.number,onFocus:s.func,onBlur:s.func,onKeyDown:s.func,onKeyUp:s.func,onClick:s.func}),h(x,"defaultProps",{type:"text"});var j=(t,e)=>{let{onClear:o,icon:r,...u}=t,d=typeof o=="function";return E.createElement(W,{block:t.block,className:Tt("MIRECO-widget-text",{clearable:d})},E.createElement(x,{...u,ref:e}),d&&E.createElement(z,{onClick:t.onClear}),r)};j=E.forwardRef(j);j.propTypes={block:Y.bool,icon:Y.node,onClear:Y.func};j.deafultProps={icon:K};var Lt=j;export{W as BlockDiv,C as Calendar,kt as CalendarVector,K as ChevronDownVector,z as ClearButton,vt as ClockVector,q as CrossVector,Ct as Dropdown,Ot as HourglassVector,N as Label,Lt as WidgetText}; | ||
var st=Object.defineProperty;var nt=(t,e,o)=>e in t?st(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var h=(t,e,o)=>(nt(t,typeof e!="symbol"?e+"":e,o),o);import J from"react";import v from"prop-types";import it from"classnames";var D=(t,e)=>{let o={};t.block||(o.display=t.inlineDisplay),o={...o,...t.style};let r={...t};return"block"in r&&delete r.block,"inlineDisplay"in r&&delete r.inlineDisplay,J.createElement("div",{...r,ref:e,style:o,className:it(t.className,{block:t.block})},t.children)};D=J.forwardRef(D);D.propTypes={style:v.object,children:v.node,block:v.bool,className:v.string,inlineDisplay:v.string};D.defaultProps={inlineDisplay:"inline-block"};var W=D;import n from"react";import F from"prop-types";import ut from"classnames";import{getYear as X,getMonth as $,startOfISOWeek as ct,endOfMonth as dt,format as w,addWeeks as ft,addDays as ht,parse as V}from"date-fns";var m="yyyy-MM-dd";import{isValid as at,parse as lt}from"date-fns";function pt(t){return at(lt(t,m,new Date))}var Q=(t,e,o)=>{let r=t[e];return r===null||typeof r=="undefined"?new TypeError(`Missing required ISO 8601 date prop: ${r} for ${e} in ${o}`):typeof r!="string"?new TypeError(`Invalid type for ISO 8601 date: ${r} for ${e} in ${o}`):pt(r)?null:new TypeError(`Invalid value of ISO 8601 date: ${r} for ${e} in ${o}`)},S=(t,e,o)=>t[e]==null||typeof t[e]=="undefined"?null:Q(t,e,o);S.isRequired=Q;var mt=n.createElement("svg",{width:"24",height:"24",viewBox:"0 0 6.35 6.35"},n.createElement("g",{transform:"translate(0,-290.65)"},n.createElement("path",{style:{fill:"none",stroke:"#333",strokeWidth:"0.5291667",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"},d:"M 3.96875,292.2375 2.3812499,293.825 3.96875,295.4125"}))),yt=n.createElement("svg",{width:"24",height:"24",viewBox:"0 0 6.35 6.35"},n.createElement("g",{transform:"translate(0,-290.65)"},n.createElement("path",{style:{fill:"none",stroke:"#333",strokeWidth:"0.5291667",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"},d:"M 2.38125,292.2375 3.9687501,293.825 2.38125,295.4125",id:"path817"}))),C=class extends n.Component{constructor(e){super(e);this.state={...this.state,...this.splitDateValue(this.props.current)}}shouldComponentUpdate(e,o){return e.selectDay!==this.props.selectDay||e.current!==this.props.current||o!==this.state}splitDateValue(e){let o=X(new Date),r=$(new Date);if(typeof e=="string"){let c=V(e,m,new Date);o=X(c),r=$(c)}return{year:o,month:r}}componentDidUpdate(e){this.props.current!==e.current&&typeof this.props.current=="string"&&this.setState(this.splitDateValue(this.props.current))}selectDay=e=>{typeof this.props.selectDay=="function"&&this.props.selectDay(e)};prevMonth=()=>{this.setState(e=>{let o={month:e.month-1};return o.month<0&&(o.month=11,o.year=e.year-1),o})};nextMonth=()=>{this.setState(e=>{let o={month:e.month+1};return o.month>=12&&(o.month=0,o.year=e.year+1),o})};render(){let e=w(new Date,m),o=[],r=ct(new Date(this.state.year,this.state.month)),c=dt(new Date(this.state.year,this.state.month)),d=r;for(;+d<+c;){let a=[];for(var y=0;y<7;y++)a.push(w(ht(d,y),m));o.push(a),d=ft(d,1)}return n.createElement("div",{className:"MIRECO-calendar"},n.createElement("div",{className:"calendar-header"},n.createElement("h5",null,w(new Date(this.state.year,this.state.month),"MMMM yyyy")),n.createElement("button",{type:"button",tabIndex:-1,alt:"Prev Month",onClick:this.prevMonth},mt),n.createElement("button",{type:"button",tabIndex:-1,alt:"Next Month",onClick:this.nextMonth},yt)),n.createElement("table",null,n.createElement("tbody",null,n.createElement("tr",null,o[0].map((a,f)=>{let l=V(a,m,new Date);return n.createElement("th",{key:`header-${f}`},w(l,"EEEEEE"))})),o.map((a,f)=>n.createElement("tr",{key:`week-${f}`},a.map((l,p)=>{let L=V(l,m,new Date);return n.createElement("td",{key:`day-${p}`,className:ut({"outside-month":$(L)!=this.state.month,current:this.props.showCurrent&&this.props.current===l,highlight:typeof this.props.highlight=="function"&&this.props.highlight(l,e)})},n.createElement("button",{type:"button",tabIndex:-1,onClick:()=>{this.selectDay(l)}},w(L,"d")))}))))))}};h(C,"propTypes",{selectDay:F.func,current:S,showCurrent:F.bool,highlight:F.func}),h(C,"defaultProps",{showCurrent:!0,highlight:(e,o)=>e===o});import k from"react";var kt=k.createElement("svg",{version:"1.1",viewBox:"0 0 6.3499998 6.3499998",height:"24",width:"24"},k.createElement("g",{transform:"translate(0,-290.65)"},k.createElement("rect",{style:{fill:"none",fillOpacity:.271255,stroke:"#333333",strokeWidth:.396875,strokeLinecap:"round",strokeLinejoin:"round",strokeDashoffset:5.39717},width:"3.7041667",height:"3.1750121",x:"1.3229166",y:"292.23749",rx:"0.52916664"}),k.createElement("path",{style:{fill:"none",stroke:"#333333",strokeWidth:.396875,strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:4,strokeDasharray:"none",strokeOpacity:1},d:"M 1.3229167,293.29583 H 5.0270833"}),k.createElement("path",{style:{fill:"none",stroke:"#333333",strokeWidth:.1984375,strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:4,strokeDasharray:"none",strokeOpacity:1},d:"m 2.5135417,293.29583 v 2.11667"}),k.createElement("path",{style:{fill:"none",stroke:"#333333",strokeWidth:.1984375,strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:4,strokeDasharray:"none",strokeOpacity:1},d:"m 3.8364583,293.29583 v 2.11667"}),k.createElement("path",{style:{fill:"none",stroke:"#333333",strokeWidth:.1984375,strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:4,strokeDasharray:"none",strokeOpacity:1},d:"M 1.3229167,294.35417 H 5.0270833"})));import O from"react";import I from"prop-types";import xt from"classnames";import bt from"react";import u from"prop-types";import gt from"classnames";function q(t){return bt.createElement("button",{onClick:t.onClick,type:t.type,name:t.name,value:t.value,disabled:t.disabled,autoFocus:t.autoFocus,tabIndex:t.tabIndex,className:gt("MIRECO-button",{block:t.block},t.className),style:t.style},t.children)}q.propTypes={onClick:u.func,type:u.oneOf(["button","submit"]),name:u.string,value:u.string,disabled:u.bool,autoFocus:u.bool,tabIndex:u.number,children:u.node,block:u.bool,className:u.string,style:u.object};q.defaultProps={type:"button",tabIndex:0,disabled:!1};var Z=q;import T from"react";var _=T.createElement("svg",{width:"24",height:"24",viewBox:"0 0 6.35 6.35"},T.createElement("g",{transform:"translate(0,-290.65)"},T.createElement("path",{style:{fill:"none",stroke:"#333333",strokeWidth:"0.66145833",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"},d:"m 1.0583333,291.70833 4.2333334,4.23334"}),T.createElement("path",{style:{fill:"none",stroke:"#333333",strokeWidth:"0.66145833",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"},d:"m 1.0583333,295.94167 4.2333334,-4.23334"})));function z(t){return O.createElement(Z,{tabIndex:-1,onClick:t.onClick,className:xt("MIRECO-clear-button content outline",t.className),disabled:t.disabled},t.spaced&&O.createElement(O.Fragment,null,"\xA0"),_,t.spaced&&O.createElement(O.Fragment,null,"\xA0"))}z.propTypes={onClick:I.func,disabled:I.bool,className:I.string,spaced:I.bool};z.defaultProps={disabled:!1,spaced:!0};var A=z;import b from"react";var vt=b.createElement("svg",{width:"24",height:"24",viewBox:"0 0 6.3499998 6.3499998",version:"1.1"},b.createElement("g",{transform:"translate(0,-290.65)"},b.createElement("circle",{r:"1.8520833",cy:"293.82501",cx:"3.175",style:{fill:"none",fillOpacity:.271255,stroke:"#333333",strokeWidth:.396875,strokeLinecap:"round",strokeLinejoin:"round",strokeDashoffset:5.39717,strokeMiterlimit:4,strokeDasharray:"none"}}),b.createElement("path",{d:"m 3.175,293.825 0,-1.19063",style:{fill:"none",stroke:"#333333",strokeWidth:.396875,strokeLinecap:"round",strokeLinejoin:"miter",strokeMiterlimit:4,strokeDasharray:"none",strokeOpacity:1}}),b.createElement("path",{d:"m 3.175,293.825 0.79375,0.52917",style:{fill:"none",stroke:"#333333",strokeWidth:.396875,strokeLinecap:"round",strokeLinejoin:"miter",strokeMiterlimit:4,strokeDasharray:"none",strokeOpacity:1}}),b.createElement("circle",{r:"0.26458332",cy:"293.82501",cx:"3.175",style:{fill:"#333333",fillOpacity:1,stroke:"none",strokeWidth:.132292,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:4,strokeDasharray:"none",strokeDashoffset:5.39717,strokeOpacity:1}})));import K from"react";var U=K.createElement("svg",{viewBox:"0 0 6.3499998 6.3499998",height:"24",width:"24"},K.createElement("g",{transform:"translate(0,-290.65)"},K.createElement("path",{d:"m 4.7624938,293.03124 -1.5875,1.5875 -1.5875,-1.5875",style:{fill:"none",stroke:"#333333",strokeWidth:.529167,strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:4,strokeDasharray:"none",strokeOpacity:1}})));import g,{useRef as tt,useEffect as et}from"react";import i from"prop-types";import ot from"classnames";import{useRef as Dt,useEffect as wt}from"react";function R(t){let e=Dt();return wt(()=>{e.current=t},[t]),e.current}var P=(t,e)=>{let o=()=>{t.onSelect(t.option.value)};return g.createElement("li",{className:ot({current:t.current}),ref:e},g.createElement("button",{type:"button",tabIndex:-1,disabled:t.disabled,onClick:o},t.option.label))};P=g.forwardRef(P);P.propTypes={current:i.bool,disabled:i.bool,option:i.shape({value:i.any,label:i.string.isRequired}),onSelect:i.func.isRequired};function H(t){let e=tt(null),o=tt(null),r=()=>{if(e.current&&o.current){let a=o.current,f=a.offsetTop,l=f+a.getBoundingClientRect().height,p=e.current,L=p.scrollTop+p.getBoundingClientRect().height;p.scrollTop>f&&(p.scrollTop=f),l>L&&(p.scrollTop=l-p.getBoundingClientRect().height)}};et(()=>{r()},[]);let c=R(t);et(()=>{!c||typeof t.value!="undefined"&&t.value!==null&&t.value!==c.value&&r()});let d=a=>{typeof t.onSelect=="function"&&t.onSelect(a)},y;return t.options&&t.options.length?y=t.options.map((a,f)=>{let l={},p=a.value===t.value;return p&&(l={ref:o}),g.createElement(P,{...l,key:`option-${f}`,option:a,current:p,disabled:t.disabled,onSelect:d})}):y=g.createElement("li",{className:"none"},t.noOptionsPrompt),g.createElement("ul",{className:ot("MIRECO-dropdown",{disabled:t.disabled}),tabIndex:-1,ref:e},t.beforeOptions,y,t.afterOptions)}H.propTypes={options:i.arrayOf(i.shape({value:i.any,label:i.string.isRequired})),value:i.any,disabled:i.bool,onSelect:i.func,block:i.bool,noOptionsPrompt:i.string,beforeOptions:i.node,afterOptions:i.node};H.defaultProps={noOptionsPrompt:"No options"};var Ct=H;import B from"react";var Ot=B.createElement("svg",{version:"1.1",viewBox:"0 0 6.3499998 6.3499998",height:"24",width:"24"},B.createElement("g",{transform:"translate(0,-290.65)"},B.createElement("path",{d:"m 1.984375,291.97292 h 2.38125 c 0,1.05833 -0.5291667,1.32291 -0.9260417,1.85208 0.396875,0.52917 0.9260417,0.79375 0.9260417,1.85208 h -2.38125 c 0,-1.05833 0.5291667,-1.32291 0.9260417,-1.85208 -0.396875,-0.52917 -0.9260417,-0.79375 -0.9260417,-1.85208 z",style:{fill:"none",stroke:"#333333",strokeWidth:.396875,strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:4,strokeDasharray:"none",strokeOpacity:1}}),B.createElement("path",{d:"M 2.5135417,295.14792 H 3.8364583 C 3.571875,294.75104 3.4395833,294.35417 3.175,294.48646 c 0,0.26458 -0.396875,0.26458 -0.6614583,0.66146 z",style:{fill:"#333333",fillOpacity:1,stroke:"none",strokeWidth:"0.264583px",strokeLinecap:"butt",strokeLinejoin:"miter",strokeOpacity:1}})));import rt from"react";import M from"prop-types";import Mt from"classnames";var N=class extends rt.PureComponent{render(){return rt.createElement("label",{className:Mt("MIRECO-label",{block:this.props.block},this.props.className),tabIndex:this.props.tabIndex,style:this.props.style},this.props.children)}};h(N,"propTypes",{block:M.bool,className:M.string,tabIndex:M.number,children:M.node,style:M.object});import E from"react";import G from"prop-types";import Lt from"classnames";import Y from"react";import s from"prop-types";import jt from"classnames";var x=class extends Y.PureComponent{constructor(e){super(e);this.inputRef=Y.createRef()}componentDidUpdate=(e,o)=>{this.props.disabled&&!e.disabled&&this.inputRef.current===document.activeElement&&typeof this.props.onBlur=="function"&&this.props.onBlur(),!this.props.disabled&&e.disabled&&this.inputRef.current===document.activeElement&&typeof this.props.onFocus=="function"&&this.props.onFocus()};handleChange=e=>{typeof this.props.onChange=="function"&&this.props.onChange(this.inputRef.current.value)};focus(){this.inputRef.current&&this.inputRef.current.focus()}blur(){this.inputRef.current&&this.inputRef.current.blur()}render(){return Y.createElement("input",{ref:this.inputRef,value:this.props.value,onChange:this.handleChange,type:this.props.type,name:this.props.name,required:this.props.required,placeholder:this.props.placeholder||"",disabled:this.props.disabled,autoFocus:this.props.autoFocus,tabIndex:this.props.tabIndex,maxLength:this.props.maxLength,id:this.props.id,className:jt("MIRECO-text",{block:this.props.block,sized:!!this.props.size},this.props.className),style:this.props.style,size:this.props.size,onFocus:this.props.onFocus,onBlur:this.props.onBlur,onKeyDown:this.props.onKeyDown,onKeyUp:this.props.onKeyUp,onClick:this.props.onClick})}};h(x,"propTypes",{value:s.string,onChange:s.func,type:s.oneOf(["text","password","email"]),name:s.string,required:s.bool,placeholder:s.string,disabled:s.bool,autoFocus:s.bool,tabIndex:s.number,maxLength:s.number,id:s.string,block:s.bool,className:s.string,style:s.object,size:s.number,onFocus:s.func,onBlur:s.func,onKeyDown:s.func,onKeyUp:s.func,onClick:s.func}),h(x,"defaultProps",{type:"text"});var j=(t,e)=>{let{onClear:o,icon:r,...c}=t,d=typeof o=="function";return E.createElement(W,{block:t.block,className:Lt("MIRECO-widget-text",{clearable:d})},E.createElement(x,{...c,ref:e}),d&&E.createElement(A,{onClick:t.onClear}),r)};j=E.forwardRef(j);j.propTypes={block:G.bool,icon:G.node,onClear:G.func};j.deafultProps={icon:U};var Tt=j;export{W as BlockDiv,C as Calendar,kt as CalendarVector,U as ChevronDownVector,A as ClearButton,vt as ClockVector,_ as CrossVector,Ct as Dropdown,Ot as HourglassVector,N as Label,Tt as WidgetText}; |
@@ -1,1 +0,1 @@ | ||
var Gt=Object.defineProperty;var Jt=(e,t,n)=>t in e?Gt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var C=(e,t,n)=>(Jt(e,typeof t!="symbol"?t+"":t,n),n);import Qt from"react";import A from"prop-types";import Xt from"classnames";function Ie(e){return Qt.createElement("button",{onClick:e.onClick,type:e.type,name:e.name,value:e.value,disabled:e.disabled,autoFocus:e.autoFocus,tabIndex:e.tabIndex,className:Xt("MIRECO-button",{block:e.block},e.className),style:e.style},e.children)}Ie.propTypes={onClick:A.func,type:A.oneOf(["button","submit"]),name:A.string,value:A.string,disabled:A.bool,autoFocus:A.bool,tabIndex:A.number,children:A.node,block:A.bool,className:A.string,style:A.object};Ie.defaultProps={type:"button",tabIndex:0,disabled:!1};var Le=Ie;import oe from"react";import $ from"prop-types";import sn from"classnames";import bt from"react";import pe from"prop-types";import Zt from"classnames";var ne=class extends bt.PureComponent{render(){return bt.createElement("label",{className:Zt("MIRECO-label",{block:this.props.block},this.props.className),tabIndex:this.props.tabIndex,style:this.props.style},this.props.children)}};C(ne,"propTypes",{block:pe.bool,className:pe.string,tabIndex:pe.number,children:pe.node,style:pe.object});import en,{useRef as tn}from"react";import se from"prop-types";import nn from"classnames";function yt(e){let t=tn(),n=()=>{typeof e.onChange=="function"&&t.current&&e.onChange(t.current.checked)};return en.createElement("input",{ref:t,type:"checkbox",checked:!!e.value,onChange:n,className:nn("MIRECO-checkbox-input",e.className),disabled:e.disabled,id:e.id,name:e.name})}yt.propTypes={value:se.bool,onChange:se.func,disabled:se.bool,className:se.string,name:se.string,id:se.string};var Ve=yt;var on=oe.createElement("svg",{width:"24",height:"24",viewBox:"0 0 6.35 6.35",style:{display:"none"}},oe.createElement("g",{transform:"translate(0,-290.65)"},oe.createElement("path",{style:{fill:"none",strokeWidth:"1.0583",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"4",strokeDasharray:"none"},d:"M 1.588,294.090 2.646,295.148 4.763,292.237"})));function gt(e){return oe.createElement(ne,{className:sn("MIRECO-checkbox",{disabled:e.disabled},e.className),style:e.style,block:e.block},oe.createElement(Ve,{value:e.value,onChange:e.onChange,disabled:e.disabled,id:e.id}),on,!!e.label&&" ",!!e.label&&oe.createElement("span",null,e.label))}gt.propTypes={value:$.bool,onChange:$.func,disabled:$.bool,block:$.bool,label:$.string,id:$.string,name:$.string,style:$.object,className:$.string};var rn=gt;import ae from"react";import P from"prop-types";import wn from"classnames";import{parse as Xe,format as Se,isValid as Tn,addDays as Dn,subDays as On}from"date-fns";import xt from"react";import me from"prop-types";import an from"classnames";var be=(e,t)=>{let n={};e.block||(n.display=e.inlineDisplay),n={...n,...e.style};let s={...e};return"block"in s&&delete s.block,"inlineDisplay"in s&&delete s.inlineDisplay,xt.createElement("div",{...s,ref:t,style:n,className:an(e.className,{block:e.block})},e.children)};be=xt.forwardRef(be);be.propTypes={style:me.object,children:me.node,block:me.bool,className:me.string,inlineDisplay:me.string};be.defaultProps={inlineDisplay:"inline-block"};var O=be;import k from"react";import _e from"prop-types";import fn from"classnames";import{getYear as vt,getMonth as We,startOfISOWeek as dn,endOfMonth as hn,format as ye,addWeeks as pn,addDays as mn,parse as qe}from"date-fns";var N="yyyy-MM-dd";import{isValid as ln,parse as un}from"date-fns";function cn(e){return ln(un(e,N,new Date))}var Ct=(e,t,n)=>{let s=e[t];return s===null||typeof s=="undefined"?new TypeError(`Missing required ISO 8601 date prop: ${s} for ${t} in ${n}`):typeof s!="string"?new TypeError(`Invalid type for ISO 8601 date: ${s} for ${t} in ${n}`):cn(s)?null:new TypeError(`Invalid value of ISO 8601 date: ${s} for ${t} in ${n}`)},Ae=(e,t,n)=>e[t]==null||typeof e[t]=="undefined"?null:Ct(e,t,n);Ae.isRequired=Ct;var bn=k.createElement("svg",{width:"24",height:"24",viewBox:"0 0 6.35 6.35"},k.createElement("g",{transform:"translate(0,-290.65)"},k.createElement("path",{style:{fill:"none",stroke:"#333",strokeWidth:"0.5291667",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"},d:"M 3.96875,292.2375 2.3812499,293.825 3.96875,295.4125"}))),yn=k.createElement("svg",{width:"24",height:"24",viewBox:"0 0 6.35 6.35"},k.createElement("g",{transform:"translate(0,-290.65)"},k.createElement("path",{style:{fill:"none",stroke:"#333",strokeWidth:"0.5291667",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"},d:"M 2.38125,292.2375 3.9687501,293.825 2.38125,295.4125",id:"path817"}))),Q=class extends k.Component{constructor(t){super(t);this.state={...this.state,...this.splitDateValue(this.props.current)}}shouldComponentUpdate(t,n){return t.selectDay!==this.props.selectDay||t.current!==this.props.current||n!==this.state}splitDateValue(t){let n=vt(new Date),s=We(new Date);if(typeof t=="string"){let r=qe(t,N,new Date);n=vt(r),s=We(r)}return{year:n,month:s}}componentDidUpdate(t){this.props.current!==t.current&&typeof this.props.current=="string"&&this.setState(this.splitDateValue(this.props.current))}selectDay=t=>{typeof this.props.selectDay=="function"&&this.props.selectDay(t)};prevMonth=()=>{this.setState(t=>{let n={month:t.month-1};return n.month<0&&(n.month=11,n.year=t.year-1),n})};nextMonth=()=>{this.setState(t=>{let n={month:t.month+1};return n.month>=12&&(n.month=0,n.year=t.year+1),n})};render(){let t=ye(new Date,N),n=[],s=dn(new Date(this.state.year,this.state.month)),r=hn(new Date(this.state.year,this.state.month)),a=s;for(;+a<+r;){let c=[];for(var l=0;l<7;l++)c.push(ye(mn(a,l),N));n.push(c),a=pn(a,1)}return k.createElement("div",{className:"MIRECO-calendar"},k.createElement("div",{className:"calendar-header"},k.createElement("h5",null,ye(new Date(this.state.year,this.state.month),"MMMM yyyy")),k.createElement("button",{type:"button",tabIndex:-1,alt:"Prev Month",onClick:this.prevMonth},bn),k.createElement("button",{type:"button",tabIndex:-1,alt:"Next Month",onClick:this.nextMonth},yn)),k.createElement("table",null,k.createElement("tbody",null,k.createElement("tr",null,n[0].map((c,m)=>{let h=qe(c,N,new Date);return k.createElement("th",{key:`header-${m}`},ye(h,"EEEEEE"))})),n.map((c,m)=>k.createElement("tr",{key:`week-${m}`},c.map((h,d)=>{let y=qe(h,N,new Date);return k.createElement("td",{key:`day-${d}`,className:fn({"outside-month":We(y)!=this.state.month,current:this.props.showCurrent&&this.props.current===h,highlight:typeof this.props.highlight=="function"&&this.props.highlight(h,t)})},k.createElement("button",{type:"button",tabIndex:-1,onClick:()=>{this.selectDay(h)}},ye(y,"d")))}))))))}};C(Q,"propTypes",{selectDay:_e.func,current:mirecoPropTypes.date,showCurrent:_e.bool,highlight:_e.func}),C(Q,"defaultProps",{showCurrent:!0,highlight:(t,n)=>t===n});import X from"react";var Ue=X.createElement("svg",{version:"1.1",viewBox:"0 0 6.3499998 6.3499998",height:"24",width:"24"},X.createElement("g",{transform:"translate(0,-290.65)"},X.createElement("rect",{style:{fill:"none",fillOpacity:.271255,stroke:"#333333",strokeWidth:.396875,strokeLinecap:"round",strokeLinejoin:"round",strokeDashoffset:5.39717},width:"3.7041667",height:"3.1750121",x:"1.3229166",y:"292.23749",rx:"0.52916664"}),X.createElement("path",{style:{fill:"none",stroke:"#333333",strokeWidth:.396875,strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:4,strokeDasharray:"none",strokeOpacity:1},d:"M 1.3229167,293.29583 H 5.0270833"}),X.createElement("path",{style:{fill:"none",stroke:"#333333",strokeWidth:.1984375,strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:4,strokeDasharray:"none",strokeOpacity:1},d:"m 2.5135417,293.29583 v 2.11667"}),X.createElement("path",{style:{fill:"none",stroke:"#333333",strokeWidth:.1984375,strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:4,strokeDasharray:"none",strokeOpacity:1},d:"m 3.8364583,293.29583 v 2.11667"}),X.createElement("path",{style:{fill:"none",stroke:"#333333",strokeWidth:.1984375,strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:4,strokeDasharray:"none",strokeOpacity:1},d:"M 1.3229167,294.35417 H 5.0270833"})));import ge from"react";import De from"prop-types";import gn from"classnames";import Te from"react";var $e=Te.createElement("svg",{width:"24",height:"24",viewBox:"0 0 6.35 6.35"},Te.createElement("g",{transform:"translate(0,-290.65)"},Te.createElement("path",{style:{fill:"none",stroke:"#333333",strokeWidth:"0.66145833",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"},d:"m 1.0583333,291.70833 4.2333334,4.23334"}),Te.createElement("path",{style:{fill:"none",stroke:"#333333",strokeWidth:"0.66145833",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"},d:"m 1.0583333,295.94167 4.2333334,-4.23334"})));function Ke(e){return ge.createElement(Le,{tabIndex:-1,onClick:e.onClick,className:gn("MIRECO-clear-button content outline",e.className),disabled:e.disabled},e.spaced&&ge.createElement(ge.Fragment,null,"\xA0"),$e,e.spaced&&ge.createElement(ge.Fragment,null,"\xA0"))}Ke.propTypes={onClick:De.func,disabled:De.bool,className:De.string,spaced:De.bool};Ke.defaultProps={disabled:!1,spaced:!0};var U=Ke;import re from"react";var ze=re.createElement("svg",{width:"24",height:"24",viewBox:"0 0 6.3499998 6.3499998",version:"1.1"},re.createElement("g",{transform:"translate(0,-290.65)"},re.createElement("circle",{r:"1.8520833",cy:"293.82501",cx:"3.175",style:{fill:"none",fillOpacity:.271255,stroke:"#333333",strokeWidth:.396875,strokeLinecap:"round",strokeLinejoin:"round",strokeDashoffset:5.39717,strokeMiterlimit:4,strokeDasharray:"none"}}),re.createElement("path",{d:"m 3.175,293.825 0,-1.19063",style:{fill:"none",stroke:"#333333",strokeWidth:.396875,strokeLinecap:"round",strokeLinejoin:"miter",strokeMiterlimit:4,strokeDasharray:"none",strokeOpacity:1}}),re.createElement("path",{d:"m 3.175,293.825 0.79375,0.52917",style:{fill:"none",stroke:"#333333",strokeWidth:.396875,strokeLinecap:"round",strokeLinejoin:"miter",strokeMiterlimit:4,strokeDasharray:"none",strokeOpacity:1}}),re.createElement("circle",{r:"0.26458332",cy:"293.82501",cx:"3.175",style:{fill:"#333333",fillOpacity:1,stroke:"none",strokeWidth:.132292,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:4,strokeDasharray:"none",strokeDashoffset:5.39717,strokeOpacity:1}})));import He from"react";var K=He.createElement("svg",{viewBox:"0 0 6.3499998 6.3499998",height:"24",width:"24"},He.createElement("g",{transform:"translate(0,-290.65)"},He.createElement("path",{d:"m 4.7624938,293.03124 -1.5875,1.5875 -1.5875,-1.5875",style:{fill:"none",stroke:"#333333",strokeWidth:.529167,strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:4,strokeDasharray:"none",strokeOpacity:1}})));import ie,{useRef as kt,useEffect as wt}from"react";import R from"prop-types";import Tt from"classnames";import{useRef as xn,useEffect as Cn}from"react";function Y(e){let t=xn();return Cn(()=>{t.current=e},[e]),t.current}var Oe=(e,t)=>{let n=()=>{e.onSelect(e.option.value)};return ie.createElement("li",{className:Tt({current:e.current}),ref:t},ie.createElement("button",{type:"button",tabIndex:-1,disabled:e.disabled,onClick:n},e.option.label))};Oe=ie.forwardRef(Oe);Oe.propTypes={current:R.bool,disabled:R.bool,option:R.shape({value:R.any,label:R.string.isRequired}),onSelect:R.func.isRequired};function Ye(e){let t=kt(null),n=kt(null),s=()=>{if(t.current&&n.current){let c=n.current,m=c.offsetTop,h=m+c.getBoundingClientRect().height,d=t.current,y=d.scrollTop+d.getBoundingClientRect().height;d.scrollTop>m&&(d.scrollTop=m),h>y&&(d.scrollTop=h-d.getBoundingClientRect().height)}};wt(()=>{s()},[]);let r=Y(e);wt(()=>{!r||typeof e.value!="undefined"&&e.value!==null&&e.value!==r.value&&s()});let a=c=>{typeof e.onSelect=="function"&&e.onSelect(c)},l;return e.options&&e.options.length?l=e.options.map((c,m)=>{let h={},d=c.value===e.value;return d&&(h={ref:n}),ie.createElement(Oe,{...h,key:`option-${m}`,option:c,current:d,disabled:e.disabled,onSelect:a})}):l=ie.createElement("li",{className:"none"},e.noOptionsPrompt),ie.createElement("ul",{className:Tt("MIRECO-dropdown",{disabled:e.disabled}),tabIndex:-1,ref:t},e.beforeOptions,l,e.afterOptions)}Ye.propTypes={options:R.arrayOf(R.shape({value:R.any,label:R.string.isRequired})),value:R.any,disabled:R.bool,onSelect:R.func,block:R.bool,noOptionsPrompt:R.string,beforeOptions:R.node,afterOptions:R.node};Ye.defaultProps={noOptionsPrompt:"No options"};var Z=Ye;import Ne from"react";var Ge=Ne.createElement("svg",{version:"1.1",viewBox:"0 0 6.3499998 6.3499998",height:"24",width:"24"},Ne.createElement("g",{transform:"translate(0,-290.65)"},Ne.createElement("path",{d:"m 1.984375,291.97292 h 2.38125 c 0,1.05833 -0.5291667,1.32291 -0.9260417,1.85208 0.396875,0.52917 0.9260417,0.79375 0.9260417,1.85208 h -2.38125 c 0,-1.05833 0.5291667,-1.32291 0.9260417,-1.85208 -0.396875,-0.52917 -0.9260417,-0.79375 -0.9260417,-1.85208 z",style:{fill:"none",stroke:"#333333",strokeWidth:.396875,strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:4,strokeDasharray:"none",strokeOpacity:1}}),Ne.createElement("path",{d:"M 2.5135417,295.14792 H 3.8364583 C 3.571875,294.75104 3.4395833,294.35417 3.175,294.48646 c 0,0.26458 -0.396875,0.26458 -0.6614583,0.66146 z",style:{fill:"#333333",fillOpacity:1,stroke:"none",strokeWidth:"0.264583px",strokeLinecap:"butt",strokeLinejoin:"miter",strokeOpacity:1}})));import Re from"react";import Qe from"prop-types";import kn from"classnames";import Je from"react";import v from"prop-types";import vn from"classnames";var _=class extends Je.PureComponent{constructor(t){super(t);this.inputRef=Je.createRef()}componentDidUpdate=(t,n)=>{this.props.disabled&&!t.disabled&&this.inputRef.current===document.activeElement&&typeof this.props.onBlur=="function"&&this.props.onBlur(),!this.props.disabled&&t.disabled&&this.inputRef.current===document.activeElement&&typeof this.props.onFocus=="function"&&this.props.onFocus()};handleChange=t=>{typeof this.props.onChange=="function"&&this.props.onChange(this.inputRef.current.value)};focus(){this.inputRef.current&&this.inputRef.current.focus()}blur(){this.inputRef.current&&this.inputRef.current.blur()}render(){return Je.createElement("input",{ref:this.inputRef,value:this.props.value,onChange:this.handleChange,type:this.props.type,name:this.props.name,required:this.props.required,placeholder:this.props.placeholder||"",disabled:this.props.disabled,autoFocus:this.props.autoFocus,tabIndex:this.props.tabIndex,maxLength:this.props.maxLength,id:this.props.id,className:vn("MIRECO-text",{block:this.props.block,sized:!!this.props.size},this.props.className),style:this.props.style,size:this.props.size,onFocus:this.props.onFocus,onBlur:this.props.onBlur,onKeyDown:this.props.onKeyDown,onKeyUp:this.props.onKeyUp,onClick:this.props.onClick})}};C(_,"propTypes",{value:v.string,onChange:v.func,type:v.oneOf(["text","password","email"]),name:v.string,required:v.bool,placeholder:v.string,disabled:v.bool,autoFocus:v.bool,tabIndex:v.number,maxLength:v.number,id:v.string,block:v.bool,className:v.string,style:v.object,size:v.number,onFocus:v.func,onBlur:v.func,onKeyDown:v.func,onKeyUp:v.func,onClick:v.func}),C(_,"defaultProps",{type:"text"});var xe=(e,t)=>{let{onClear:n,icon:s,...r}=e,a=typeof n=="function";return Re.createElement(O,{block:e.block,className:kn("MIRECO-widget-text",{clearable:a})},Re.createElement(_,{...r,ref:t}),a&&Re.createElement(U,{onClick:e.onClear}),s)};xe=Re.forwardRef(xe);xe.propTypes={block:Qe.bool,icon:Qe.node,onClear:Qe.func};xe.deafultProps={icon:K};var z=xe;var Nn=40,Rn=38,Sn=13,Bn=27,ee=class extends ae.PureComponent{constructor(t){super(t);this.state={...this.state,textValue:this.format(t,t.value),inFocus:!1,calendarOpen:!1},this.containerRef=ae.createRef(),this.textRef=ae.createRef()}componentDidUpdate=(t,n)=>{t.value!==this.props.value&&(this.props.value===null?this.setState({textValue:""}):typeof this.props.value=="string"&&this.props.value!==this.parseText(this.state.textValue)&&this.setState({textValue:this.format(this.props,this.props.value)})),this.props.disabled&&!t.disabled&&this.onBlur()};format(t,n){return n===null||typeof n=="undefined"?"":Se(Xe(n,N,new Date),t.displayFormat)}parseText=t=>{let n=t.trim();if(n.length===0)return null;let s;return this.props.inputFormats.map(r=>{if(typeof s!="undefined")return;let a=Xe(n,r,new Date);Tn(a)&&(s=Se(a,N))}),s};handleFocus=t=>{this.setState({inFocus:!0,calendarOpen:!0})};handleContainerBlur=t=>{this.containerRef.current&&(this.containerRef.current.contains(t.relatedTarget)||this.containerRef.current===t.relatedTarget)||this.onBlur()};handleTextKeyDown=t=>{if(t&&(t.which===Sn||t.which===Bn)){if(this.state.calendarOpen){let n=this.format(this.props,this.props.value);this.setState({textValue:n,calendarOpen:!1}),t.preventDefault()}return}if(this.setState({inFocus:!0,calendarOpen:!0}),t){let n=new Date;typeof this.props.value=="string"&&(n=Xe(this.props.value,N,new Date)),t.which===Nn&&(t.preventDefault(),typeof this.props.onChange=="function"&&this.props.onChange(Se(Dn(n,1),N),!1),this.setState({calendarOpen:!0})),t.which===Rn&&(t.preventDefault(),typeof this.props.onChange=="function"&&this.props.onChange(Se(On(n,1),N),!1),this.setState({calendarOpen:!0}))}};handleTextChange=t=>{this.setState({textValue:t},()=>{typeof this.props.onChange=="function"&&this.props.onChange(this.parseText(t),!1),this.setState({calendarOpen:!0})})};handleTextClick=()=>{this.setState({calendarOpen:!0})};onSelectDay=t=>{typeof this.props.onChange=="function"&&this.props.onChange(t,!1),this.textRef.current&&this.textRef.current.focus(),this.setState({calendarOpen:!1})};onBlur=()=>{if(typeof this.props.value=="string"){let t=this.format(this.props,this.props.value);this.setState({textValue:t,inFocus:!1,calendarOpen:!1},()=>{typeof this.props.onChange=="function"&&this.props.onChange(this.props.value,!0)})}else this.setState(t=>{let n={inFocus:!1,calendarOpen:!1};return this.props.autoErase&&(n.textValue=""),n},()=>{typeof this.props.onChange=="function"&&(this.props.autoErase?this.props.onChange(null,!0):this.props.onChange(this.props.value,!0))})};focus=()=>{this.textRef.current&&this.textRef.current.focus()};onClear=()=>{this.props.disabled||typeof this.props.onChange=="function"&&(this.props.onChange(null,!1),this.textRef.current&&this.textRef.current.focus())};render(){let t=typeof this.props.value=="string"&&this.props.showClearButton&&!this.props.disabled;return ae.createElement(O,{ref:this.containerRef,block:this.props.block,className:wn("MIRECO-date",{"right-hang":this.props.rightHang,clearable:t},this.props.className),tabIndex:-1,onBlur:this.handleContainerBlur},ae.createElement(z,{id:this.props.id,ref:this.textRef,placeholder:this.props.placeholder,value:this.state.textValue,onChange:this.handleTextChange,onClick:this.handleTextClick,onFocus:this.handleFocus,disabled:this.props.disabled,onKeyDown:this.handleTextKeyDown,block:this.props.block,style:{marginBottom:"0"},required:this.props.required,className:this.props.textClassName,icon:this.props.icon,onClear:t?this.onClear:void 0}),this.state.inFocus&&this.state.calendarOpen&&!this.props.disabled&&ae.createElement(Q,{selectDay:this.onSelectDay,current:this.props.value}))}};C(ee,"propTypes",{id:P.string,inputFormats:P.arrayOf(P.string).isRequired,displayFormat:P.string.isRequired,placeholder:P.string,value:mirecoPropTypes.date,onChange:P.func,disabled:P.bool,block:P.bool,autoErase:P.bool,rightHang:P.bool,className:P.string,textClassName:P.string,required:P.bool,icon:P.node,showClearButton:P.bool}),C(ee,"defaultProps",{block:!1,inputFormats:["d","do","d/MM","do MMM","do MMMM","d/MM/yy","d/MM/yyyy","do MMM yy","do MMM yyyy","do MMMM yy","do MMMM yyyy"],displayFormat:"do MMM yyyy",placeholder:"dd/mm/yyyy",autoErase:!0,rightHang:!1,required:!1,icon:Ue,showClearButton:!0});import Mn,{useState as Fn,useEffect as Pn}from"react";import L from"prop-types";import jn from"classnames";import En from"humanize-duration";import Ce from"parse-duration";Ce.month=Ce.week*4;Ce.year=Ce.week*52;var In=40,Ln=38;function Ze(e){let t=d=>{let y="";return typeof d=="number"&&(y=En(d,{units:e.humanizeUnits})),y},n=d=>{let y=d.trim();if(y.length===0)return null;y.replace(/[^\d.,-]/g)===y&&(y+=` ${e.defaultTimeUnit}`);let M=Ce(y);if(!(M===0&&y[0]!=="0"))return Math.floor(M)},[s,r]=Fn(t(e.value)),a=Y(e);Pn(()=>{!a||a.value!==e.value&&(e.value===null?r(""):typeof e.value=="number"&&e.value!==n(s)&&r(t(e.value)))});let l=(d,y)=>{let M=0;if(typeof d=="number")for(;(y&&e.value>=e.incrementUnits[M+1]||!y&&e.value>e.incrementUnits[M+1])&&M<e.incrementUnits.length;)M+=1;return e.incrementUnits[M]},c=d=>{r(d),typeof e.onChange=="function"&&e.onChange(n(d),!1)},m=d=>{d&&(d.which===In&&(d.preventDefault(),typeof e.onChange=="function"&&(typeof e.value=="number"?e.onChange(Math.max(e.value-l(e.value,!1),0)):e.onChange(0))),d.which===Ln&&(d.preventDefault(),typeof e.onChange=="function"&&(typeof e.value=="number"?e.onChange(e.value+l(e.value,!0)):e.onChange(n(`1 ${e.defaultTimeUnit}`)))))},h=()=>{r(t(e.value)),typeof e.onChange=="function"&&e.onChange(e.value,!0)};return Mn.createElement(z,{id:e.id,value:s,onChange:c,onBlur:h,block:e.block,placeholder:e.placeholder,onKeyDown:m,disabled:e.disabled,className:jn("MIRECO-duration",e.className),icon:Ge})}Ze.propTypes={block:L.bool,onChange:L.func,defaultTimeUnit:L.string,placeholder:L.string,incrementUnits:L.arrayOf(L.number),humanizeUnits:L.arrayOf(L.string),disabled:L.bool,className:L.string,value:L.number,id:L.string};Ze.defaultProps={block:!1,defaultTimeUnit:"hours",placeholder:"Duration",incrementUnits:[60*1e3,60*60*1e3,24*60*60*1e3],humanizeUnits:["w","d","h","m","s"],disabled:!1};var Vn=Ze;import An,{useRef as _n,useState as Wn,useEffect as qn}from"react";import G from"prop-types";import Un from"classnames";var Dt=40,Ot=38;function et(e){let t=b=>typeof b=="number"?`${b}`:"",{step:n,min:s,max:r,...a}=e,l=_n(),[c,m]=Wn(t(e.value)),h=b=>{let g=b.trim();if(g.length===0)return null;let x=parseFloat(g);if(!isNaN(x)&&!(typeof n=="number"&&x%n!=0)&&!(typeof s=="number"&&x<s)&&!(typeof r=="number"&&x>r))return x};qn(()=>{typeof e.value!="undefined"&&h(c)!=e.value&&m(t(e.value))},[e.value]),l.current=e.value;let d=b=>{if(b&&(b.which===Dt||b.which===Ot)){if(b.preventDefault(),typeof e.onChange!="function")return;let g=typeof e.value=="number"?e.value:0,x=typeof n=="number"?n:1;if(b.which===Ot){let I=g+x;(typeof r!="number"||I<=r)&&e.onChange(I)}if(b.which===Dt){let I=g-x;(typeof s!="number"||I>=s)&&e.onChange(I)}}typeof e.onKeyDown=="function"&&e.onKeyDown(b)},y=b=>{typeof e.onChange=="function"&&(m(b),e.onChange(h(b)))},M=b=>{let g=t(e.value);m(g),typeof e.onBlur=="function"&&e.onBlur(b)};return An.createElement(_,{...a,value:c,onChange:y,className:Un("MIRECO-number",e.className),onBlur:M,onKeyDown:d})}et.propTypes={value:G.number,onChange:G.func,step:G.number,min:G.number,max:G.number,className:G.string,onBlur:G.func,onKeyDown:G.func};et.defaultProps={type:"text"};var $n=et;import H,{useRef as Nt,useReducer as Kn,useEffect as zn}from"react";import T from"prop-types";import Hn from"classnames";import le from"prop-types";var ve=le.oneOfType([le.string,le.number,le.bool]),ue=le.shape({value:ve.isRequired,label:le.string});var Rt=40,St=38,Yn=13,Bt=27,Gn=8,Jn=9,Qn=16,Xn=20;function Zn(e,t){switch(t.type){case"close":return{...e,dropdownOpen:!1,text:"",selected:null};case"open":return{...e,dropdownOpen:!0};case"textFilter":return{...e,text:t.text};case"select":return{...e,selected:t.value};case"focus":return{...e,inFocus:!0,dropdownOpen:!0};case"blur":return{...e,inFocus:!1,dropdownOpen:!1,text:"",selected:null}}}function Mt(e){return H.createElement("li",{className:"option"},e.label,H.createElement(U,{onClick:e.remove,spaced:!1,disabled:e.disabled}))}Mt.propTypes={label:T.string,remove:T.func,disabled:T.bool};function tt(e){let t=Nt(null),n=Nt(null),[s,r]=Kn(Zn,{text:"",dropdownOpen:!1,selected:null}),a=()=>{r({type:"blur"})},l=Y(e);zn(()=>{!l||e.disabled&&!l.disabled&&a()});let c=o=>{typeof e.onChange=="function"&&e.onChange([...new Set([...e.value,o])],!0)},m=o=>{if(!e.disabled&&typeof e.onChange=="function"){let f=[...e.value];f.splice(o,1),e.onChange(f,!1),n.current&&n.current.focus()}},h=()=>{e.disabled||typeof e.onChange=="function"&&(e.onChange([],!1),r({type:"textFilter",text:""}),n.current&&n.current.focus())},d=o=>{let f=o.split(" ").map(i=>i.trim().toLowerCase()).filter(i=>i.length>0);return e.options.filter(i=>{if(e.value.indexOf(i.value)!==-1)return!1;if(f.length===0||!e.filter)return!0;let u=`${i.label}${i.value}`.toLowerCase(),p=!1;return f.map(D=>{u.indexOf(D)!==-1&&(p=!0)}),p})},y=o=>{t.current&&(t.current.contains(o.relatedTarget)||t.current===o.relatedTarget)||a()},M=o=>{r({type:"focus"})},b=o=>{if(!(!o||o.which===Qn||o.which===Xn)){if(o.which===Yn||o.which===Jn&&s.selected!==null){s.dropdownOpen&&(s.selected!==null&&c(s.selected),r({type:"close"}),o.preventDefault());return}if(!s.dropdownOpen&&o.which!==Bt&&r({type:"open"}),o.which===Gn&&s.text===""&&typeof e.onChange=="function"&&e.onChange(e.value.splice(0,e.value.length-1),!1),o.which===Rt||o.which===St){if(o.preventDefault(),typeof e.onChange!="function")return;let f=-1,i=d(s.text);if(!i.length)return;i.map((p,D)=>{p.value===s.selected&&(f=D)});let u=f;o.which===Rt&&(u++,u>=i.length&&(u=0)),o.which===St&&(u--,u<0&&(u=i.length-1)),i[u]?r({type:"select",value:i[u].value}):r({type:"select",value:i[u].value})}o.which===Bt&&s.dropdownOpen&&r({type:"close"})}},g=o=>{if(r({type:"textFilter",text:o}),typeof e.onTextChange=="function"&&e.onTextChange(o),typeof e.onChange!="function")return;let f=o.trim().toLowerCase();if(f.length<=0)r({type:"select",value:null});else{let i=null;if(e.options.map(u=>{let p=`${u.value}`.trim().toLowerCase();i===null&&p===f&&(i=u.value)}),i!==null)r({type:"select",value:i});else{let u=null;if(e.options.map(p=>{let D=`${p.label}`.trim().toLowerCase();u===null&&D===f&&(u=p.value)}),u!==null)r({type:"select",value:u});else{let p=d(o),D=p.find(Ee=>Ee.value===s.selected),je=p.length>0?p[0].value:void 0;r({type:"select",value:D?D.value:je||null})}}}},x=o=>{e.disabled||s.dropdownOpen||n.current&&n.current.inputRef.current&&(n.current.inputRef.current===document.activeElement?r({type:"open"}):n.current&&n.current.focus())},I=o=>{if(!e.options.find(i=>i.value===o)){console.warn("Could not find selected value in options",o);return}c(o),n.current&&n.current.focus(),r({type:"close"})},Pe=d(s.text),de=e.value.length>0,he=de&&!e.disabled;return H.createElement(O,{ref:t,block:e.block,className:Hn("MIRECO-multi-select",{"has-value":de,"in-focus":s.inFocus,disabled:e.disabled,clearable:he},e.className),onBlur:y,onClick:x,tabIndex:-1},H.createElement("ul",{className:"selected"},e.value.map((o,f)=>{let i=e.options.find(p=>p.value===o),u=()=>{m(f)};return H.createElement(Mt,{key:`selected-${o}`,value:o,label:i?i.label:o,remove:u,disabled:e.disabled})}),H.createElement("li",{className:"text"},H.createElement(_,{ref:n,placeholder:e.placeholder,value:s.text,onFocus:M,onKeyDown:b,onChange:g,disabled:e.disabled,block:e.block,style:e.style,autoFocus:e.autoFocus,className:e.textClassName,id:e.id,icon:e.icon}))),he&&H.createElement(U,{onClick:h}),e.icon,s.dropdownOpen&&!e.disabled&&H.createElement(Z,{options:Pe,value:s.selected,onSelect:I,...e.dropdownProps}))}tt.propTypes={value:T.arrayOf(ve).isRequired,options:T.arrayOf(ue).isRequired,placeholder:T.string,block:T.bool,disabled:T.bool,onChange:T.func,onTextChange:T.func,style:T.object,dropdownProps:T.object,filter:T.bool,autoFocus:T.bool,className:T.string,textClassName:T.string,id:T.string,icon:T.node};tt.defaultProps={options:[],filter:!0,icon:K};var es=tt;import ts,{useRef as ns}from"react";import F from"prop-types";import ss from"classnames";function nt(e){let t=ns(),n=s=>{!t.current||typeof e.onChange=="function"&&e.onChange(+t.current.value)};return ts.createElement("input",{ref:t,type:"range",value:e.value,onChange:n,min:e.min,max:e.max,step:e.step,name:e.name,required:e.required,disabled:e.disabled,autoFocus:e.autoFocus,tabIndex:e.tabIndex,className:ss("MIRECO-range",{block:e.block},e.className),style:e.style,onFocus:e.onFocus,onBlur:e.onBlur,onClick:e.onClick})}nt.propTypes={value:F.number.isRequired,onChange:F.func,min:F.number.isRequired,max:F.number.isRequired,step:F.number,name:F.string,required:F.bool,disabled:F.bool,autoFocus:F.bool,tabIndex:F.number,block:F.bool,className:F.string,style:F.object,onFocus:F.func,onBlur:F.func,onClick:F.func};nt.defaultProps={min:0,max:100};var os=nt;import st,{useRef as ot,useReducer as rs,useEffect as Ft}from"react";import j from"prop-types";import is from"classnames";var Pt=40,jt=38,as=13,Et=27;function Be(e,t){return typeof t.value=="string"||typeof t.value=="number"||typeof t.value=="boolean"}function ls(e,t){switch(t.type){case"close":return{...e,dropdownOpen:!1,text:t.formatted,filtering:!1};case"open":return{...e,dropdownOpen:!0,filtering:!1};case"textFilter":return{...e,text:t.text,filtering:t.text.length>0};case"textOverride":return{...e,text:t.text,filtering:!1}}}function rt(e){let t=ot(null),n=ot(null),s=ot(e.value?e.value:null);Ft(()=>{e.value&&(s.current=e.value)},[e.value]);let r="";if(Be(e.value,e)){let o=e.options.find(f=>f.value===e.value);r=o?o.label:`${e.value}`}let[a,l]=rs(ls,{text:r,dropdownOpen:!1,filtering:!1}),c=o=>{let f=o.split(" ").map(i=>i.trim().toLowerCase()).filter(i=>i.length>0);return e.options.filter(i=>{if(f.length===0||!e.filter)return!0;let u=`${i.label}${i.value}`.toLowerCase(),p=!1;return f.map(D=>{u.indexOf(D)!==-1&&(p=!0)}),p})},m=()=>{if(Be(e.value,e)){let o=e.options.find(i=>i.value===e.value),f=o?o.label:`${e.value}`;l({type:"close",formatted:f}),typeof e.onChange=="function"&&e.onChange(e.value,!0)}else l({type:"close",formatted:""}),typeof e.onChange=="function"&&e.onChange(e.nullable?null:s.current,!0)},h=o=>{t.current&&(t.current.contains(o.relatedTarget)||t.current===o.relatedTarget)||m()},d=o=>{l({type:"open"})},y=o=>{if(!!o){if(o.which===as){if(a.dropdownOpen){let f=e.options.find(i=>i.value===e.value);l({type:"close",formatted:f?f.label:""}),o.preventDefault()}return}if(!a.dropdownOpen&&o.which!==Et&&l({type:"open"}),o.which===Pt||o.which===jt){if(o.preventDefault(),typeof e.onChange!="function")return;let f=-1,i=a.filtering?c(a.text):e.options;if(!i.length)return;i.map((p,D)=>{p.value===e.value&&(f=D)});let u=f;o.which===Pt&&(u++,u>=i.length&&(u=0)),o.which===jt&&(u--,u<0&&(u=i.length-1)),i[u]?e.onChange(i[u].value):e.onChange(e.nullable?null:void 0)}if(o.which===Et&&a.dropdownOpen){let f="";if(Be(e.value,e)){let i=e.options.find(u=>u.value===e.value);f=i?i.label:`${e.value}`}l({type:"close",formatted:f})}}},M=o=>{if(l({type:"textFilter",text:o}),typeof e.onTextChange=="function"&&e.onTextChange(o),typeof e.onChange!="function")return;let f=o.trim().toLowerCase();if(f.length<=0)e.onChange(e.nullable?null:void 0,!1);else{let i=null;if(e.options.map(u=>{let p=`${u.value}`.trim().toLowerCase();i===null&&p===f&&(i=u.value)}),i!==null)e.onChange(i,!1);else{let u=null;if(e.options.map(p=>{let D=`${p.label}`.trim().toLowerCase();u===null&&D===f&&(u=p.value)}),u!==null)e.onChange(u,!1);else{let p=c(o),D=p.find(Ee=>Ee.value===e.value),je=p.length>0?p[0].value:void 0;e.onChange(D?D.value:je,!1)}}}},b=o=>{let f=e.options.find(i=>i.value===o);if(!f){console.warn("Could not find selected value in options",o);return}typeof e.onChange=="function"&&e.onChange(o,!0),n.current&&n.current.focus(),l({type:"close",formatted:f.label})},g=()=>{let o=e.options.find(f=>f.value===e.value);l(o?{type:"textOverride",text:o.label}:{type:"textOverride",text:`${e.value}`})},x=Y(e);Ft(()=>{!x||(x.value!==e.value&&(e.value===null?l({type:"textOverride",text:""}):Be(e.value,e)&&(a.dropdownOpen&&c(a.text).find(i=>i.value===e.value)||g())),e.disabled&&!x.disabled&&m())});let I=()=>{e.disabled||typeof e.onChange=="function"&&(e.onChange(e.nullable?null:void 0,!1),l({type:"textFilter",text:""}),n.current&&n.current.focus())},Pe=a.filtering?c(a.text):e.options,de=!!e.value,he=de&&!e.disabled;return st.createElement(O,{ref:t,block:e.block,className:is("MIRECO-select",{"has-value":de,clearable:he},e.className),onBlur:h},st.createElement(z,{ref:n,placeholder:e.placeholder,value:a.text,onFocus:d,onKeyDown:y,onChange:M,disabled:e.disabled,block:e.block,style:e.style,autoFocus:e.autoFocus,className:e.textClassName,id:e.id,icon:e.icon,onClear:he?I:void 0}),a.dropdownOpen&&st.createElement(Z,{options:Pe,value:e.value,onSelect:b,...e.dropdownProps}))}rt.propTypes={value:ve,nullable:j.bool,options:j.arrayOf(ue).isRequired,placeholder:j.string,block:j.bool,disabled:j.bool,onChange:j.func,onTextChange:j.func,style:j.object,dropdownProps:j.object,filter:j.bool,autoFocus:j.bool,className:j.string,textClassName:j.string,id:j.string,icon:j.node};rt.defaultProps={nullable:!0,options:[],filter:!0,icon:K};var it=rt;import at from"react";import w from"prop-types";import us from"react-textarea-autosize";import cs from"classnames";var ke=class extends at.PureComponent{constructor(t){super(t);this.inputRef=at.createRef()}componentDidUpdate=(t,n)=>{this.props.disabled&&!t.disabled&&this.inputRef.current&&this.inputRef.current._ref===document.activeElement&&typeof this.props.onBlur=="function"&&this.props.onBlur(),!this.props.disabled&&t.disabled&&this.inputRef.current&&this.inputRef.current._ref===document.activeElement&&typeof this.props.onFocus=="function"&&this.props.onFocus()};handleChange=t=>{t&&typeof this.props.onChange=="function"&&this.props.onChange(t.target.value)};render(){return at.createElement(us,{ref:this.inputRef,value:this.props.value||"",onChange:this.handleChange,name:this.props.name,required:this.props.required,placeholder:this.props.placeholder,disabled:this.props.disabled,autoFocus:this.props.autoFocus,tabIndex:this.props.tabIndex,maxLength:this.props.maxLength,id:this.props.id,className:cs("MIRECO-textarea",{block:this.props.block},this.props.className),style:this.props.style,minRows:this.props.minRows||1,maxRows:this.props.maxRows,onFocus:this.props.onFocus,onBlur:this.props.onBlur,onKeyDown:this.props.onKeyDown,onKeyUp:this.props.onKeyUp})}};C(ke,"propTypes",{value:w.string,onChange:w.func,name:w.string,required:w.bool,placeholder:w.string,disabled:w.bool,autoFocus:w.bool,tabIndex:w.number,maxLength:w.number,id:w.string,block:w.bool,className:w.string,style:w.object,minRows:w.number,maxRows:w.number,onFocus:w.func,onBlur:w.func,onKeyDown:w.func,onKeyUp:w.func}),C(ke,"defaultProps",{minRows:2,maxRows:5});import ce from"react";import S from"prop-types";import fs from"humanize-duration";import ds from"classnames";import{format as lt,addMilliseconds as It,startOfDay as Me,isValid as hs,parse as ps}from"date-fns";var ms=40,bs=38,ys=13,gs=27;function ut(e){return typeof e=="number"&&!isNaN(e)}var xs=fs.humanizer({language:"shortEn",languages:{shortEn:{h:()=>"h",m:()=>"m"}}}),te=class extends ce.PureComponent{constructor(t){super(t);this.state={...this.state,textValue:this.format(t,t.value),inFocus:!1,dropdownOpen:!1},this.options=this.generateOptions(t),this.containerRef=ce.createRef(),this.textRef=ce.createRef()}componentDidUpdate(t,n){(t.step!==this.props.step||t.relativeTo!==this.props.relativeTo||t.relativeStart!==this.props.relativeStart)&&(this.options=this.generateOptions(this.props)),t.value!==this.props.value&&(this.props.value===null?this.setState({textValue:""}):typeof this.props.value=="number"&&this.props.value!==this.parseText(this.state.textValue)&&this.setState({textValue:this.format(this.props,this.props.value)})),this.props.disabled&&!t.disabled&&this.onBlur()}generateOptions=t=>{let n=[];for(var s=0;s<24*60;s+=t.step){let r=s*60*1e3,a={value:r,label:lt(It(Me(new Date),r),t.displayFormat)};if(typeof t.relativeTo=="number"&&typeof t.relativeStart=="number"){let l=t.relativeStart+a.value;if(l>t.relativeTo){let c=l-t.relativeTo;c<=24*60*60*1e3&&c%(5*60*1e3)==0&&(a.label+=` (${xs(c,{units:["h","m"],spacer:""})})`)}}n.push(a)}return n};format=(t,n)=>{if(typeof n!="number")return"";let s=n;s=It(Me(new Date),n);let r=lt(s,t.longFormat),a=lt(s,t.displayFormat),l=this.parseText(r),c=this.parseText(a);return l===c?a:r};parseText=t=>{let n=t.trim();if(n.length===0)return null;let s;return this.props.inputFormats.map(r=>{if(typeof s!="undefined")return;let a=ps(n,r,Me(new Date));hs(a)&&(s=+a,s-=+Me(new Date))}),s};handleTextChange=t=>{this.setState({textValue:t},()=>{typeof this.props.onChange=="function"&&this.props.onChange(this.parseText(t),!1),this.setState({dropdownOpen:!0})})};previousOption=()=>{if(!ut(this.props.value))return this.nextOption();if(this.props.value===this.options[0].value)return this.options[this.options.length-1].value;let t=0;return this.options.map((n,s)=>{n.value<this.props.value&&(t=s)}),this.options[t].value};nextOption=()=>{if(!ut(this.props.value))return this.options[0].value;let t=0;return this.options.map((n,s)=>{n.value<=this.props.value&&(t=s)}),t+=1,t>=this.options.length&&(t=0),this.options[t].value};handleTextKeyDown=t=>{if(t&&(t.which===ys||t.which===gs)){if(this.state.dropdownOpen){let n=this.format(this.props,this.props.value);this.setState({textValue:n,dropdownOpen:!1}),t.preventDefault()}return}this.setState({inFocus:!0,dropdownOpen:!0}),t&&(t.which===ms&&(t.preventDefault(),typeof this.props.onChange=="function"&&this.props.onChange(this.nextOption(),!1),this.setState({dropdownOpen:!0})),t.which===bs&&(t.preventDefault(),typeof this.props.onChange=="function"&&this.props.onChange(this.previousOption(),!1),this.setState({dropdownOpen:!0})))};handleFocus=t=>{this.setState({inFocus:!0,dropdownOpen:!0})};handleContainerBlur=t=>{this.containerRef.current&&(this.containerRef.current.contains(t.relatedTarget)||this.containerRef.current===t.relatedTarget)||this.onBlur()};handleTextClick=()=>{this.setState({dropdownOpen:!0})};onBlur=()=>{if(typeof this.props.value=="number"){let t=this.format(this.props,this.props.value);this.setState({textValue:t,inFocus:!1,dropdownOpen:!1},()=>{typeof this.props.onChange=="function"&&this.props.onChange(this.props.value,!0)})}else this.setState(t=>{let n={inFocus:!1,dropdownOpen:!1};return this.props.autoErase&&(n.textValue=""),n},()=>{typeof this.props.onChange=="function"&&(this.props.autoErase?this.props.onChange(null,!0):this.props.onChange(this.props.value,!0))})};handleSelect=t=>{typeof this.props.onChange=="function"&&this.props.onChange(t,!1),this.textRef.current&&this.textRef.current.focus(),this.setState({dropdownOpen:!1})};handleClear=()=>{typeof this.props.onChange=="function"&&(this.props.onChange(null,!1),this.textRef.current&&this.textRef.current.focus())};render(){let t=!this.props.disabled&&ut(this.props.value)&&this.props.showClearButton;return ce.createElement(O,{ref:this.containerRef,className:ds("MIRECO-time",{"right-hang":this.props.rightHang},this.props.className),tabIndex:-1,onBlur:this.handleContainerBlur,block:this.props.block},ce.createElement(z,{ref:this.textRef,placeholder:this.props.placeholder,onChange:this.handleTextChange,value:this.state.textValue,onFocus:this.handleFocus,disabled:this.props.disabled,onKeyDown:this.handleTextKeyDown,block:this.props.block,style:{marginBottom:"0"},onClick:this.handleTextClick,icon:ze,onClear:t?this.handleClear:void 0,className:this.props.textClassName,id:this.props.id}),this.state.inFocus&&this.state.dropdownOpen&&!this.props.disabled&&ce.createElement(Z,{options:this.options,value:this.props.value,disabled:this.props.disabled,onSelect:this.handleSelect,continuousOptions:!0}))}};C(te,"propTypes",{inputFormats:S.arrayOf(S.string).isRequired,displayFormat:S.string.isRequired,placeholder:S.string,onChange:S.func,value:S.number,disabled:S.bool,step:S.number.isRequired,block:S.bool,autoErase:S.bool,className:S.string,relativeTo:S.number,relativeStart:S.number,rightHang:S.bool,showClearButton:S.bool,textClassName:S.string,id:S.string}),C(te,"defaultProps",{inputFormats:["h:mm:ss a","h:mm:ssa","h:mm:ss","h:mm a","H:mm:ss","H:mm","h:mma","h:mm","h a","H:mm","H","ha","h"],longFormat:"h:mm:ss a",displayFormat:"h:mm a",placeholder:"hh:mm",step:30,autoErase:!0,relativeStart:0,rightHang:!1,showClearButton:!0});import Vt,{useState as ft,useRef as At,useEffect as Cs}from"react";import fe from"prop-types";import vs from"classnames";import ct from"react";var Lt=ct.createElement("svg",{width:"24",height:"24",viewBox:"0 0 6.3499998 6.3499998",className:"MIRECO-spinner"},ct.createElement("g",{transform:"translate(0,-290.65)"},ct.createElement("path",{d:"m 3.175,295.94168 a 2.1166666,2.1166666 0 0 1 -1.9555449,-1.30665 2.1166666,2.1166666 0 0 1 0.4588356,-2.30673 2.1166666,2.1166666 0 0 1 2.3067225,-0.45883 2.1166666,2.1166666 0 0 1 1.3066533,1.95554",style:{fill:"none",fillOpacity:.271255,stroke:"#333333",strokeWidth:.529167,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:4,strokeDasharray:"none",strokeDashoffset:5.39717,strokeOpacity:1}})));function dt(e){let[t,n]=ft([]),[s,r]=ft(!1),[a,l]=ft(""),c=At(),m=At();c.current=a,Cs(()=>{e.value===null&&(t.length>0||s)&&(n([]),r(!1))});let h=[];s||(h=[...t]);let d=e.value;e.value!==null&&typeof e.value!="undefined"&&(d=e.value.value,h.find(x=>x.value===d)||(h=[...h,e.value]));let y=g=>{let x=g.trim();l(x),x.length>0?typeof e.getOptions=="function"&&(r(!0),m.current&&window.clearTimeout(m.current),m.current=window.setTimeout(()=>{e.getOptions(x).then(I=>{x==c.current&&(n(I),r(!1))})},e.debounce)):(n([]),r(!1))},M=g=>{if(typeof e.onChange=="function"){if(g!==null&&typeof g!="undefined"){let x=h.find(I=>I.value===g);x?g=x:g={value:g,label:`${g}`}}e.onChange(g)}},b={noOptionsPrompt:"No options"};return s?h.length>0?b.afterOptions=Vt.createElement("li",{className:"none"},e.loadingPrompt):b.noOptionsPrompt=e.loadingPrompt:e.value===null&&(b.noOptionsPrompt=e.searchPrompt),Vt.createElement(it,{...e,className:vs(e.className,"MIRECO-async-select"),options:h,value:d,onTextChange:y,onChange:M,dropdownProps:b,filter:!1,icon:s?Lt:K})}dt.propTypes={value:ue,onChange:fe.func,getOptions:fe.func.isRequired,loadingPrompt:fe.string,searchPrompt:fe.string,debounce:fe.number,className:fe.string};dt.defaultProps={loadingPrompt:"Loading...",searchPrompt:"Type to search",debounce:500};var ks=dt;import W from"react";import V from"prop-types";import{startOfDay as _t,format as Wt,parse as qt}from"date-fns";import Ut from"classnames";function $t(e){return typeof e=="string"}function Fe(e){return typeof e=="number"&&!isNaN(e)}function Kt(e,t){return e===t}function ht(e){return e===null}function ws(e){return e===null}function Ts(e){return+qt(e,constants.ISO_8601_DATE_FORMAT,new Date)}function Ds(e,t){return+_t(qt(e,constants.ISO_8601_DATE_FORMAT,new Date))+t}function pt(e){if(e===null)return{date:null,time:null};if(Fe(e)){let t=Wt(e,constants.ISO_8601_DATE_FORMAT),n=e-Ts(t);return{date:t,time:n}}return{date:void 0,time:void 0}}var J=class extends W.PureComponent{constructor(t){super(t);this.state={...pt(t.value)},this.containerRef=W.createRef(),this.dateRef=W.createRef(),this.timeRef=W.createRef()}componentDidUpdate=(t,n)=>{Kt(t.value,this.props.value)||(ht(this.props.value)?this.setState({date:null,time:null}):Fe(this.props.value)&&(Kt(this.props.value,this.combinedStateValue())||this.setState({...pt(this.props.value)})))};getDefaultDate(){return this.props.defaultDate?this.props.defaultDate:Wt(new Date,constants.ISO_8601_DATE_FORMAT)}combinedStateValue(){return Ds(this.state.date||this.getDefaultDate(),this.state.time||0)}handleDateChange=(t,n)=>{this.setState({date:t},this.updateParentValue)};handleTimeChange=(t,n)=>{this.setState({time:t},this.updateParentValue)};updateParentValue=()=>{typeof this.props.onChange=="function"&&(ws(this.state.date)&&ht(this.state.time)?this.props.onChange(null,!1):$t(this.state.date)||Fe(this.state.time)?this.props.onChange(this.combinedStateValue(),!1):this.props.onChange(void 0,!1))};handleContainerBlur=t=>{if(t.relatedTarget){let n=this.dateRef.current&&this.dateRef.current.containerRef.current&&(this.dateRef.current.containerRef.current.contains(t.relatedTarget)||this.dateRef.current.containerRef.current==t.relatedTarget),s=this.timeRef.current&&this.timeRef.current.containerRef.current&&(this.timeRef.current.containerRef.current.contains(t.relatedTarget)||this.timeRef.current.containerRef.current==t.relatedTarget);if(n||s)return}this.onBlur()};handleClearClick=t=>{typeof this.props.onChange=="function"&&this.props.onChange(null,!0)};onBlur=()=>{window.setTimeout(()=>{if($t(this.state.date)||Fe(this.state.time)){let t=this.combinedStateValue();this.setState({...pt(t)},()=>{typeof this.props.onChange=="function"&&this.props.onChange(t,!0)})}else this.setState({date:null,time:null},()=>{this.props.onChange(null,!0)})},0)};render(){let t={};this.props.timeFirst||(t.id=this.props.id);let n=W.createElement(ee,{ref:this.dateRef,value:this.state.date,onChange:this.handleDateChange,disabled:this.props.disabled,block:this.props.block,rightHang:this.props.timeFirst,showClearButton:!1,textClassName:this.props.dateTextClassName,...t}),s,r=this.combinedStateValue();this.props.relativeTo&&!ht(r)&&(s=+_t(new Date(r)));let a={};this.props.timeFirst&&(a.id=this.props.id);let l=W.createElement(te,{ref:this.timeRef,value:this.state.time,onChange:this.handleTimeChange,disabled:this.props.disabled,relativeTo:this.props.relativeTo,relativeStart:s,block:this.props.block,showClearButton:!1,textClassName:this.props.timeTextClassName,...a}),c=n,m=l;return this.props.timeFirst&&(c=l,m=n),W.createElement(O,{ref:this.containerRef,block:this.props.block,className:Ut("MIRECO-datetime",this.props.className,{clearable:this.props.showClear}),tabIndex:-1,onBlur:this.handleContainerBlur},c,!this.props.block&&W.createElement("span",null," "),W.createElement(O,{block:this.props.block,className:Ut("second",{time:!this.props.timeFirst,date:this.props.timeFirst})},m,this.props.showClear&&W.createElement("span",null," "),this.props.showClear&&W.createElement(U,{onClick:this.handleClearClick,disabled:this.props.disabled,className:this.props.clearButtonClassName})))}};C(J,"propTypes",{value:V.number,onChange:V.func,disabled:V.bool,block:V.bool,timeFirst:V.bool,showClear:V.bool,className:V.string,relativeTo:V.number,defaultDate:Ae,dateTextClassName:V.string,timeTextClassName:V.string,clearButtonClassName:V.string,id:V.string}),C(J,"defaultProps",{block:!1,timeFirst:!1,showClear:!0});import q from"react";import E from"prop-types";import Os from"classnames";import{format as zt}from"date-fns";function Ht(e){return e===null}function B(e){return typeof e=="number"&&!isNaN(e)}function Ns(e){return e&&B(e.start)&&B(e.end)}function mt(e){return e?{start:e.start,end:e.end}:{start:void 0,end:void 0}}function Rs(e,t){if(B(e)&&B(t)&&e>t){let n=e;e=t,t=n}return{start:e,end:t}}function Ss(e){return e===null||e&&e.start===null&&e.end===null}function Yt(e,t){return!!(typeof e=="undefined"&&typeof t=="undefined"||e===null&&t===null||e&&t&&e.start===t.start&&e.end===t.end)}var we=class extends q.PureComponent{constructor(t){super(t);this.containerRef=q.createRef(),this.startRef=q.createRef(),this.endRef=q.createRef(),this.state={...this.state,...mt(t.value)}}componentDidUpdate=(t,n)=>{Yt(t.value,this.props.value)||(Ss(this.props.value)?this.setState({start:null,end:null}):Ns(this.props.value)&&(Yt(this.props.value,this.combinedStateValue())||this.setState({...mt(this.props.value)})))};combinedStateValue(){let t=this.state.start,n=this.state.end;return B(t)&&!B(n)&&(n=t+this.props.defaultDuration),B(n)&&!B(t)&&(t=n-this.props.defaultDuration),Rs(t,n)}handleStartChange=(t,n)=>{let s=this.state.end;if(B(t)&&B(this.state.start)&&B(s)){let r=s-this.state.start;s=t+r}this.setState({start:t,end:s},this.updateParentValue)};handleEndChange=(t,n)=>{this.setState({end:t},this.updateParentValue)};updateParentValue=()=>{typeof this.props.onChange=="function"&&(Ht(this.state.start)&&Ht(this.state.end)?this.props.onChange(null,!1):B(this.state.start)||B(this.state.end)?this.props.onChange(this.combinedStateValue(),!1):this.props.onChange(void 0,!1))};handleClearClick=()=>{typeof this.props.onChange=="function"&&this.props.onChange(null)};handleContainerBlur=t=>{if(t.relatedTarget){let n=this.startRef.current&&this.startRef.current.dateRef.current&&this.startRef.current.dateRef.current.containerRef.current,s=this.startRef.current&&this.startRef.current.timeRef.current&&this.startRef.current.timeRef.current.containerRef.current,r=n&&(n.contains(t.relatedTarget)||t.relatedTarget===n)||s&&(s.contains(t.relatedTarget)||t.relatedTarget===s),a=this.endRef.current&&this.endRef.current.dateRef.current&&this.endRef.current.dateRef.current.containerRef.current,l=this.endRef.current&&this.endRef.current.timeRef.current&&this.endRef.current.timeRef.current.containerRef.current,c=a&&(a.contains(t.relatedTarget)||t.relatedTarget===a)||l&&(l.contains(t.relatedTarget)||t.relatedTarget===l);if(r||c)return}this.onBlur()};onBlur=()=>{window.setTimeout(()=>{if(B(this.state.start)||B(this.state.end)){let t=this.combinedStateValue();this.setState({...mt(t)},()=>{typeof this.props.onChange=="function"&&this.props.onChange(t,!0)})}else this.setState({start:null,end:null},()=>{this.props.onChange(null,!0)})},1)};render(){let t;B(this.state.end)&&(t=zt(new Date(this.state.end),N));let n;return B(this.state.start)&&(n=zt(new Date(this.state.start),N)),q.createElement(O,{block:this.props.block,ref:this.containerRef,className:Os("MIRECO-datetime-range",this.props.className,{clearable:this.props.showClear}),onBlur:this.handleContainerBlur},q.createElement(J,{ref:this.startRef,value:this.state.start,onChange:this.handleStartChange,disabled:this.props.disabled,block:this.props.block,className:"start",showClear:!1,defaultDate:t,dateTextClassName:this.props.startDateTextClassName,timeTextClassName:this.props.startTimeTextClassName,id:this.props.id}),q.createElement(O,{className:"datetime-range-second",block:this.props.block},q.createElement("span",{className:"to"}," - "),q.createElement(J,{ref:this.endRef,value:this.state.end,onChange:this.handleEndChange,disabled:this.props.disabled,timeFirst:!0,block:this.props.block,className:"end",showClear:!1,relativeTo:this.state.start,defaultDate:n,dateTextClassName:this.props.endDateTextClassName,timeTextClassName:this.props.endTimeTextClassName}),!this.props.block&&this.props.showClear&&q.createElement("span",null," "),this.props.showClear&&q.createElement(U,{onClick:this.handleClearClick,disabled:this.props.disabled,className:this.props.clearButtonClassName})))}};C(we,"propTypes",{block:E.bool,onChange:E.func,value:E.shape({start:E.number,end:E.number}),disabled:E.bool,defaultDuration:E.number.isRequired,showClear:E.bool,className:E.string,startDateTextClassName:E.string,startTimeTextClassName:E.string,endDateTextClassName:E.string,endTimeTextClassName:E.string,clearButtonClassName:E.string,id:E.string}),C(we,"defaultProps",{block:!1,disabled:!1,defaultDuration:60*60*1e3,showClear:!0});export{ks as AsyncSelect,Le as Button,rn as Checkbox,Ve as CheckboxInput,ee as Date,J as Datetime,we as DatetimeRange,Vn as Duration,es as MultiSelect,$n as Number,os as Range,it as Select,_ as Text,ke as Textarea,te as Time}; | ||
var Gt=Object.defineProperty;var Jt=(e,t,n)=>t in e?Gt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var C=(e,t,n)=>(Jt(e,typeof t!="symbol"?t+"":t,n),n);import Qt from"react";import A from"prop-types";import Xt from"classnames";function Le(e){return Qt.createElement("button",{onClick:e.onClick,type:e.type,name:e.name,value:e.value,disabled:e.disabled,autoFocus:e.autoFocus,tabIndex:e.tabIndex,className:Xt("MIRECO-button",{block:e.block},e.className),style:e.style},e.children)}Le.propTypes={onClick:A.func,type:A.oneOf(["button","submit"]),name:A.string,value:A.string,disabled:A.bool,autoFocus:A.bool,tabIndex:A.number,children:A.node,block:A.bool,className:A.string,style:A.object};Le.defaultProps={type:"button",tabIndex:0,disabled:!1};var Ve=Le;import re from"react";import $ from"prop-types";import sn from"classnames";import bt from"react";import me from"prop-types";import Zt from"classnames";var se=class extends bt.PureComponent{render(){return bt.createElement("label",{className:Zt("MIRECO-label",{block:this.props.block},this.props.className),tabIndex:this.props.tabIndex,style:this.props.style},this.props.children)}};C(se,"propTypes",{block:me.bool,className:me.string,tabIndex:me.number,children:me.node,style:me.object});import en,{useRef as tn}from"react";import oe from"prop-types";import nn from"classnames";function yt(e){let t=tn(),n=()=>{typeof e.onChange=="function"&&t.current&&e.onChange(t.current.checked)};return en.createElement("input",{ref:t,type:"checkbox",checked:!!e.value,onChange:n,className:nn("MIRECO-checkbox-input",e.className),disabled:e.disabled,id:e.id,name:e.name})}yt.propTypes={value:oe.bool,onChange:oe.func,disabled:oe.bool,className:oe.string,name:oe.string,id:oe.string};var Ae=yt;var on=re.createElement("svg",{width:"24",height:"24",viewBox:"0 0 6.35 6.35",style:{display:"none"}},re.createElement("g",{transform:"translate(0,-290.65)"},re.createElement("path",{style:{fill:"none",strokeWidth:"1.0583",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"4",strokeDasharray:"none"},d:"M 1.588,294.090 2.646,295.148 4.763,292.237"})));function gt(e){return re.createElement(se,{className:sn("MIRECO-checkbox",{disabled:e.disabled},e.className),style:e.style,block:e.block},re.createElement(Ae,{value:e.value,onChange:e.onChange,disabled:e.disabled,id:e.id}),on,!!e.label&&" ",!!e.label&&re.createElement("span",null,e.label))}gt.propTypes={value:$.bool,onChange:$.func,disabled:$.bool,block:$.bool,label:$.string,id:$.string,name:$.string,style:$.object,className:$.string};var rn=gt;import le from"react";import P from"prop-types";import wn from"classnames";import{parse as Xe,format as Be,isValid as Tn,addDays as Dn,subDays as On}from"date-fns";import xt from"react";import be from"prop-types";import an from"classnames";var ye=(e,t)=>{let n={};e.block||(n.display=e.inlineDisplay),n={...n,...e.style};let s={...e};return"block"in s&&delete s.block,"inlineDisplay"in s&&delete s.inlineDisplay,xt.createElement("div",{...s,ref:t,style:n,className:an(e.className,{block:e.block})},e.children)};ye=xt.forwardRef(ye);ye.propTypes={style:be.object,children:be.node,block:be.bool,className:be.string,inlineDisplay:be.string};ye.defaultProps={inlineDisplay:"inline-block"};var O=ye;import k from"react";import _e from"prop-types";import fn from"classnames";import{getYear as vt,getMonth as We,startOfISOWeek as dn,endOfMonth as hn,format as ge,addWeeks as pn,addDays as mn,parse as qe}from"date-fns";var N="yyyy-MM-dd";import{isValid as ln,parse as un}from"date-fns";function cn(e){return ln(un(e,N,new Date))}var Ct=(e,t,n)=>{let s=e[t];return s===null||typeof s=="undefined"?new TypeError(`Missing required ISO 8601 date prop: ${s} for ${t} in ${n}`):typeof s!="string"?new TypeError(`Invalid type for ISO 8601 date: ${s} for ${t} in ${n}`):cn(s)?null:new TypeError(`Invalid value of ISO 8601 date: ${s} for ${t} in ${n}`)},Q=(e,t,n)=>e[t]==null||typeof e[t]=="undefined"?null:Ct(e,t,n);Q.isRequired=Ct;var bn=k.createElement("svg",{width:"24",height:"24",viewBox:"0 0 6.35 6.35"},k.createElement("g",{transform:"translate(0,-290.65)"},k.createElement("path",{style:{fill:"none",stroke:"#333",strokeWidth:"0.5291667",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"},d:"M 3.96875,292.2375 2.3812499,293.825 3.96875,295.4125"}))),yn=k.createElement("svg",{width:"24",height:"24",viewBox:"0 0 6.35 6.35"},k.createElement("g",{transform:"translate(0,-290.65)"},k.createElement("path",{style:{fill:"none",stroke:"#333",strokeWidth:"0.5291667",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"},d:"M 2.38125,292.2375 3.9687501,293.825 2.38125,295.4125",id:"path817"}))),X=class extends k.Component{constructor(t){super(t);this.state={...this.state,...this.splitDateValue(this.props.current)}}shouldComponentUpdate(t,n){return t.selectDay!==this.props.selectDay||t.current!==this.props.current||n!==this.state}splitDateValue(t){let n=vt(new Date),s=We(new Date);if(typeof t=="string"){let r=qe(t,N,new Date);n=vt(r),s=We(r)}return{year:n,month:s}}componentDidUpdate(t){this.props.current!==t.current&&typeof this.props.current=="string"&&this.setState(this.splitDateValue(this.props.current))}selectDay=t=>{typeof this.props.selectDay=="function"&&this.props.selectDay(t)};prevMonth=()=>{this.setState(t=>{let n={month:t.month-1};return n.month<0&&(n.month=11,n.year=t.year-1),n})};nextMonth=()=>{this.setState(t=>{let n={month:t.month+1};return n.month>=12&&(n.month=0,n.year=t.year+1),n})};render(){let t=ge(new Date,N),n=[],s=dn(new Date(this.state.year,this.state.month)),r=hn(new Date(this.state.year,this.state.month)),a=s;for(;+a<+r;){let c=[];for(var l=0;l<7;l++)c.push(ge(mn(a,l),N));n.push(c),a=pn(a,1)}return k.createElement("div",{className:"MIRECO-calendar"},k.createElement("div",{className:"calendar-header"},k.createElement("h5",null,ge(new Date(this.state.year,this.state.month),"MMMM yyyy")),k.createElement("button",{type:"button",tabIndex:-1,alt:"Prev Month",onClick:this.prevMonth},bn),k.createElement("button",{type:"button",tabIndex:-1,alt:"Next Month",onClick:this.nextMonth},yn)),k.createElement("table",null,k.createElement("tbody",null,k.createElement("tr",null,n[0].map((c,m)=>{let h=qe(c,N,new Date);return k.createElement("th",{key:`header-${m}`},ge(h,"EEEEEE"))})),n.map((c,m)=>k.createElement("tr",{key:`week-${m}`},c.map((h,d)=>{let y=qe(h,N,new Date);return k.createElement("td",{key:`day-${d}`,className:fn({"outside-month":We(y)!=this.state.month,current:this.props.showCurrent&&this.props.current===h,highlight:typeof this.props.highlight=="function"&&this.props.highlight(h,t)})},k.createElement("button",{type:"button",tabIndex:-1,onClick:()=>{this.selectDay(h)}},ge(y,"d")))}))))))}};C(X,"propTypes",{selectDay:_e.func,current:Q,showCurrent:_e.bool,highlight:_e.func}),C(X,"defaultProps",{showCurrent:!0,highlight:(t,n)=>t===n});import Z from"react";var Ue=Z.createElement("svg",{version:"1.1",viewBox:"0 0 6.3499998 6.3499998",height:"24",width:"24"},Z.createElement("g",{transform:"translate(0,-290.65)"},Z.createElement("rect",{style:{fill:"none",fillOpacity:.271255,stroke:"#333333",strokeWidth:.396875,strokeLinecap:"round",strokeLinejoin:"round",strokeDashoffset:5.39717},width:"3.7041667",height:"3.1750121",x:"1.3229166",y:"292.23749",rx:"0.52916664"}),Z.createElement("path",{style:{fill:"none",stroke:"#333333",strokeWidth:.396875,strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:4,strokeDasharray:"none",strokeOpacity:1},d:"M 1.3229167,293.29583 H 5.0270833"}),Z.createElement("path",{style:{fill:"none",stroke:"#333333",strokeWidth:.1984375,strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:4,strokeDasharray:"none",strokeOpacity:1},d:"m 2.5135417,293.29583 v 2.11667"}),Z.createElement("path",{style:{fill:"none",stroke:"#333333",strokeWidth:.1984375,strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:4,strokeDasharray:"none",strokeOpacity:1},d:"m 3.8364583,293.29583 v 2.11667"}),Z.createElement("path",{style:{fill:"none",stroke:"#333333",strokeWidth:.1984375,strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:4,strokeDasharray:"none",strokeOpacity:1},d:"M 1.3229167,294.35417 H 5.0270833"})));import xe from"react";import Oe from"prop-types";import gn from"classnames";import De from"react";var $e=De.createElement("svg",{width:"24",height:"24",viewBox:"0 0 6.35 6.35"},De.createElement("g",{transform:"translate(0,-290.65)"},De.createElement("path",{style:{fill:"none",stroke:"#333333",strokeWidth:"0.66145833",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"},d:"m 1.0583333,291.70833 4.2333334,4.23334"}),De.createElement("path",{style:{fill:"none",stroke:"#333333",strokeWidth:"0.66145833",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"},d:"m 1.0583333,295.94167 4.2333334,-4.23334"})));function Ke(e){return xe.createElement(Ve,{tabIndex:-1,onClick:e.onClick,className:gn("MIRECO-clear-button content outline",e.className),disabled:e.disabled},e.spaced&&xe.createElement(xe.Fragment,null,"\xA0"),$e,e.spaced&&xe.createElement(xe.Fragment,null,"\xA0"))}Ke.propTypes={onClick:Oe.func,disabled:Oe.bool,className:Oe.string,spaced:Oe.bool};Ke.defaultProps={disabled:!1,spaced:!0};var U=Ke;import ie from"react";var ze=ie.createElement("svg",{width:"24",height:"24",viewBox:"0 0 6.3499998 6.3499998",version:"1.1"},ie.createElement("g",{transform:"translate(0,-290.65)"},ie.createElement("circle",{r:"1.8520833",cy:"293.82501",cx:"3.175",style:{fill:"none",fillOpacity:.271255,stroke:"#333333",strokeWidth:.396875,strokeLinecap:"round",strokeLinejoin:"round",strokeDashoffset:5.39717,strokeMiterlimit:4,strokeDasharray:"none"}}),ie.createElement("path",{d:"m 3.175,293.825 0,-1.19063",style:{fill:"none",stroke:"#333333",strokeWidth:.396875,strokeLinecap:"round",strokeLinejoin:"miter",strokeMiterlimit:4,strokeDasharray:"none",strokeOpacity:1}}),ie.createElement("path",{d:"m 3.175,293.825 0.79375,0.52917",style:{fill:"none",stroke:"#333333",strokeWidth:.396875,strokeLinecap:"round",strokeLinejoin:"miter",strokeMiterlimit:4,strokeDasharray:"none",strokeOpacity:1}}),ie.createElement("circle",{r:"0.26458332",cy:"293.82501",cx:"3.175",style:{fill:"#333333",fillOpacity:1,stroke:"none",strokeWidth:.132292,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:4,strokeDasharray:"none",strokeDashoffset:5.39717,strokeOpacity:1}})));import He from"react";var K=He.createElement("svg",{viewBox:"0 0 6.3499998 6.3499998",height:"24",width:"24"},He.createElement("g",{transform:"translate(0,-290.65)"},He.createElement("path",{d:"m 4.7624938,293.03124 -1.5875,1.5875 -1.5875,-1.5875",style:{fill:"none",stroke:"#333333",strokeWidth:.529167,strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:4,strokeDasharray:"none",strokeOpacity:1}})));import ae,{useRef as kt,useEffect as wt}from"react";import R from"prop-types";import Tt from"classnames";import{useRef as xn,useEffect as Cn}from"react";function Y(e){let t=xn();return Cn(()=>{t.current=e},[e]),t.current}var Ne=(e,t)=>{let n=()=>{e.onSelect(e.option.value)};return ae.createElement("li",{className:Tt({current:e.current}),ref:t},ae.createElement("button",{type:"button",tabIndex:-1,disabled:e.disabled,onClick:n},e.option.label))};Ne=ae.forwardRef(Ne);Ne.propTypes={current:R.bool,disabled:R.bool,option:R.shape({value:R.any,label:R.string.isRequired}),onSelect:R.func.isRequired};function Ye(e){let t=kt(null),n=kt(null),s=()=>{if(t.current&&n.current){let c=n.current,m=c.offsetTop,h=m+c.getBoundingClientRect().height,d=t.current,y=d.scrollTop+d.getBoundingClientRect().height;d.scrollTop>m&&(d.scrollTop=m),h>y&&(d.scrollTop=h-d.getBoundingClientRect().height)}};wt(()=>{s()},[]);let r=Y(e);wt(()=>{!r||typeof e.value!="undefined"&&e.value!==null&&e.value!==r.value&&s()});let a=c=>{typeof e.onSelect=="function"&&e.onSelect(c)},l;return e.options&&e.options.length?l=e.options.map((c,m)=>{let h={},d=c.value===e.value;return d&&(h={ref:n}),ae.createElement(Ne,{...h,key:`option-${m}`,option:c,current:d,disabled:e.disabled,onSelect:a})}):l=ae.createElement("li",{className:"none"},e.noOptionsPrompt),ae.createElement("ul",{className:Tt("MIRECO-dropdown",{disabled:e.disabled}),tabIndex:-1,ref:t},e.beforeOptions,l,e.afterOptions)}Ye.propTypes={options:R.arrayOf(R.shape({value:R.any,label:R.string.isRequired})),value:R.any,disabled:R.bool,onSelect:R.func,block:R.bool,noOptionsPrompt:R.string,beforeOptions:R.node,afterOptions:R.node};Ye.defaultProps={noOptionsPrompt:"No options"};var ee=Ye;import Re from"react";var Ge=Re.createElement("svg",{version:"1.1",viewBox:"0 0 6.3499998 6.3499998",height:"24",width:"24"},Re.createElement("g",{transform:"translate(0,-290.65)"},Re.createElement("path",{d:"m 1.984375,291.97292 h 2.38125 c 0,1.05833 -0.5291667,1.32291 -0.9260417,1.85208 0.396875,0.52917 0.9260417,0.79375 0.9260417,1.85208 h -2.38125 c 0,-1.05833 0.5291667,-1.32291 0.9260417,-1.85208 -0.396875,-0.52917 -0.9260417,-0.79375 -0.9260417,-1.85208 z",style:{fill:"none",stroke:"#333333",strokeWidth:.396875,strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:4,strokeDasharray:"none",strokeOpacity:1}}),Re.createElement("path",{d:"M 2.5135417,295.14792 H 3.8364583 C 3.571875,294.75104 3.4395833,294.35417 3.175,294.48646 c 0,0.26458 -0.396875,0.26458 -0.6614583,0.66146 z",style:{fill:"#333333",fillOpacity:1,stroke:"none",strokeWidth:"0.264583px",strokeLinecap:"butt",strokeLinejoin:"miter",strokeOpacity:1}})));import Se from"react";import Qe from"prop-types";import kn from"classnames";import Je from"react";import v from"prop-types";import vn from"classnames";var _=class extends Je.PureComponent{constructor(t){super(t);this.inputRef=Je.createRef()}componentDidUpdate=(t,n)=>{this.props.disabled&&!t.disabled&&this.inputRef.current===document.activeElement&&typeof this.props.onBlur=="function"&&this.props.onBlur(),!this.props.disabled&&t.disabled&&this.inputRef.current===document.activeElement&&typeof this.props.onFocus=="function"&&this.props.onFocus()};handleChange=t=>{typeof this.props.onChange=="function"&&this.props.onChange(this.inputRef.current.value)};focus(){this.inputRef.current&&this.inputRef.current.focus()}blur(){this.inputRef.current&&this.inputRef.current.blur()}render(){return Je.createElement("input",{ref:this.inputRef,value:this.props.value,onChange:this.handleChange,type:this.props.type,name:this.props.name,required:this.props.required,placeholder:this.props.placeholder||"",disabled:this.props.disabled,autoFocus:this.props.autoFocus,tabIndex:this.props.tabIndex,maxLength:this.props.maxLength,id:this.props.id,className:vn("MIRECO-text",{block:this.props.block,sized:!!this.props.size},this.props.className),style:this.props.style,size:this.props.size,onFocus:this.props.onFocus,onBlur:this.props.onBlur,onKeyDown:this.props.onKeyDown,onKeyUp:this.props.onKeyUp,onClick:this.props.onClick})}};C(_,"propTypes",{value:v.string,onChange:v.func,type:v.oneOf(["text","password","email"]),name:v.string,required:v.bool,placeholder:v.string,disabled:v.bool,autoFocus:v.bool,tabIndex:v.number,maxLength:v.number,id:v.string,block:v.bool,className:v.string,style:v.object,size:v.number,onFocus:v.func,onBlur:v.func,onKeyDown:v.func,onKeyUp:v.func,onClick:v.func}),C(_,"defaultProps",{type:"text"});var Ce=(e,t)=>{let{onClear:n,icon:s,...r}=e,a=typeof n=="function";return Se.createElement(O,{block:e.block,className:kn("MIRECO-widget-text",{clearable:a})},Se.createElement(_,{...r,ref:t}),a&&Se.createElement(U,{onClick:e.onClear}),s)};Ce=Se.forwardRef(Ce);Ce.propTypes={block:Qe.bool,icon:Qe.node,onClear:Qe.func};Ce.deafultProps={icon:K};var z=Ce;var Nn=40,Rn=38,Sn=13,Bn=27,te=class extends le.PureComponent{constructor(t){super(t);this.state={...this.state,textValue:this.format(t,t.value),inFocus:!1,calendarOpen:!1},this.containerRef=le.createRef(),this.textRef=le.createRef()}componentDidUpdate=(t,n)=>{t.value!==this.props.value&&(this.props.value===null?this.setState({textValue:""}):typeof this.props.value=="string"&&this.props.value!==this.parseText(this.state.textValue)&&this.setState({textValue:this.format(this.props,this.props.value)})),this.props.disabled&&!t.disabled&&this.onBlur()};format(t,n){return n===null||typeof n=="undefined"?"":Be(Xe(n,N,new Date),t.displayFormat)}parseText=t=>{let n=t.trim();if(n.length===0)return null;let s;return this.props.inputFormats.map(r=>{if(typeof s!="undefined")return;let a=Xe(n,r,new Date);Tn(a)&&(s=Be(a,N))}),s};handleFocus=t=>{this.setState({inFocus:!0,calendarOpen:!0})};handleContainerBlur=t=>{this.containerRef.current&&(this.containerRef.current.contains(t.relatedTarget)||this.containerRef.current===t.relatedTarget)||this.onBlur()};handleTextKeyDown=t=>{if(t&&(t.which===Sn||t.which===Bn)){if(this.state.calendarOpen){let n=this.format(this.props,this.props.value);this.setState({textValue:n,calendarOpen:!1}),t.preventDefault()}return}if(this.setState({inFocus:!0,calendarOpen:!0}),t){let n=new Date;typeof this.props.value=="string"&&(n=Xe(this.props.value,N,new Date)),t.which===Nn&&(t.preventDefault(),typeof this.props.onChange=="function"&&this.props.onChange(Be(Dn(n,1),N),!1),this.setState({calendarOpen:!0})),t.which===Rn&&(t.preventDefault(),typeof this.props.onChange=="function"&&this.props.onChange(Be(On(n,1),N),!1),this.setState({calendarOpen:!0}))}};handleTextChange=t=>{this.setState({textValue:t},()=>{typeof this.props.onChange=="function"&&this.props.onChange(this.parseText(t),!1),this.setState({calendarOpen:!0})})};handleTextClick=()=>{this.setState({calendarOpen:!0})};onSelectDay=t=>{typeof this.props.onChange=="function"&&this.props.onChange(t,!1),this.textRef.current&&this.textRef.current.focus(),this.setState({calendarOpen:!1})};onBlur=()=>{if(typeof this.props.value=="string"){let t=this.format(this.props,this.props.value);this.setState({textValue:t,inFocus:!1,calendarOpen:!1},()=>{typeof this.props.onChange=="function"&&this.props.onChange(this.props.value,!0)})}else this.setState(t=>{let n={inFocus:!1,calendarOpen:!1};return this.props.autoErase&&(n.textValue=""),n},()=>{typeof this.props.onChange=="function"&&(this.props.autoErase?this.props.onChange(null,!0):this.props.onChange(this.props.value,!0))})};focus=()=>{this.textRef.current&&this.textRef.current.focus()};onClear=()=>{this.props.disabled||typeof this.props.onChange=="function"&&(this.props.onChange(null,!1),this.textRef.current&&this.textRef.current.focus())};render(){let t=typeof this.props.value=="string"&&this.props.showClearButton&&!this.props.disabled;return le.createElement(O,{ref:this.containerRef,block:this.props.block,className:wn("MIRECO-date",{"right-hang":this.props.rightHang,clearable:t},this.props.className),tabIndex:-1,onBlur:this.handleContainerBlur},le.createElement(z,{id:this.props.id,ref:this.textRef,placeholder:this.props.placeholder,value:this.state.textValue,onChange:this.handleTextChange,onClick:this.handleTextClick,onFocus:this.handleFocus,disabled:this.props.disabled,onKeyDown:this.handleTextKeyDown,block:this.props.block,style:{marginBottom:"0"},required:this.props.required,className:this.props.textClassName,icon:this.props.icon,onClear:t?this.onClear:void 0}),this.state.inFocus&&this.state.calendarOpen&&!this.props.disabled&&le.createElement(X,{selectDay:this.onSelectDay,current:this.props.value}))}};C(te,"propTypes",{id:P.string,inputFormats:P.arrayOf(P.string).isRequired,displayFormat:P.string.isRequired,placeholder:P.string,value:Q,onChange:P.func,disabled:P.bool,block:P.bool,autoErase:P.bool,rightHang:P.bool,className:P.string,textClassName:P.string,required:P.bool,icon:P.node,showClearButton:P.bool}),C(te,"defaultProps",{block:!1,inputFormats:["d","do","d/MM","do MMM","do MMMM","d/MM/yy","d/MM/yyyy","do MMM yy","do MMM yyyy","do MMMM yy","do MMMM yyyy"],displayFormat:"do MMM yyyy",placeholder:"dd/mm/yyyy",autoErase:!0,rightHang:!1,required:!1,icon:Ue,showClearButton:!0});import Mn,{useState as Fn,useEffect as Pn}from"react";import L from"prop-types";import jn from"classnames";import En from"humanize-duration";import ve from"parse-duration";ve.month=ve.week*4;ve.year=ve.week*52;var In=40,Ln=38;function Ze(e){let t=d=>{let y="";return typeof d=="number"&&(y=En(d,{units:e.humanizeUnits})),y},n=d=>{let y=d.trim();if(y.length===0)return null;y.replace(/[^\d.,-]/g)===y&&(y+=` ${e.defaultTimeUnit}`);let M=ve(y);if(!(M===0&&y[0]!=="0"))return Math.floor(M)},[s,r]=Fn(t(e.value)),a=Y(e);Pn(()=>{!a||a.value!==e.value&&(e.value===null?r(""):typeof e.value=="number"&&e.value!==n(s)&&r(t(e.value)))});let l=(d,y)=>{let M=0;if(typeof d=="number")for(;(y&&e.value>=e.incrementUnits[M+1]||!y&&e.value>e.incrementUnits[M+1])&&M<e.incrementUnits.length;)M+=1;return e.incrementUnits[M]},c=d=>{r(d),typeof e.onChange=="function"&&e.onChange(n(d),!1)},m=d=>{d&&(d.which===In&&(d.preventDefault(),typeof e.onChange=="function"&&(typeof e.value=="number"?e.onChange(Math.max(e.value-l(e.value,!1),0)):e.onChange(0))),d.which===Ln&&(d.preventDefault(),typeof e.onChange=="function"&&(typeof e.value=="number"?e.onChange(e.value+l(e.value,!0)):e.onChange(n(`1 ${e.defaultTimeUnit}`)))))},h=()=>{r(t(e.value)),typeof e.onChange=="function"&&e.onChange(e.value,!0)};return Mn.createElement(z,{id:e.id,value:s,onChange:c,onBlur:h,block:e.block,placeholder:e.placeholder,onKeyDown:m,disabled:e.disabled,className:jn("MIRECO-duration",e.className),icon:Ge})}Ze.propTypes={block:L.bool,onChange:L.func,defaultTimeUnit:L.string,placeholder:L.string,incrementUnits:L.arrayOf(L.number),humanizeUnits:L.arrayOf(L.string),disabled:L.bool,className:L.string,value:L.number,id:L.string};Ze.defaultProps={block:!1,defaultTimeUnit:"hours",placeholder:"Duration",incrementUnits:[60*1e3,60*60*1e3,24*60*60*1e3],humanizeUnits:["w","d","h","m","s"],disabled:!1};var Vn=Ze;import An,{useRef as _n,useState as Wn,useEffect as qn}from"react";import G from"prop-types";import Un from"classnames";var Dt=40,Ot=38;function et(e){let t=b=>typeof b=="number"?`${b}`:"",{step:n,min:s,max:r,...a}=e,l=_n(),[c,m]=Wn(t(e.value)),h=b=>{let g=b.trim();if(g.length===0)return null;let x=parseFloat(g);if(!isNaN(x)&&!(typeof n=="number"&&x%n!=0)&&!(typeof s=="number"&&x<s)&&!(typeof r=="number"&&x>r))return x};qn(()=>{typeof e.value!="undefined"&&h(c)!=e.value&&m(t(e.value))},[e.value]),l.current=e.value;let d=b=>{if(b&&(b.which===Dt||b.which===Ot)){if(b.preventDefault(),typeof e.onChange!="function")return;let g=typeof e.value=="number"?e.value:0,x=typeof n=="number"?n:1;if(b.which===Ot){let I=g+x;(typeof r!="number"||I<=r)&&e.onChange(I)}if(b.which===Dt){let I=g-x;(typeof s!="number"||I>=s)&&e.onChange(I)}}typeof e.onKeyDown=="function"&&e.onKeyDown(b)},y=b=>{typeof e.onChange=="function"&&(m(b),e.onChange(h(b)))},M=b=>{let g=t(e.value);m(g),typeof e.onBlur=="function"&&e.onBlur(b)};return An.createElement(_,{...a,value:c,onChange:y,className:Un("MIRECO-number",e.className),onBlur:M,onKeyDown:d})}et.propTypes={value:G.number,onChange:G.func,step:G.number,min:G.number,max:G.number,className:G.string,onBlur:G.func,onKeyDown:G.func};et.defaultProps={type:"text"};var $n=et;import H,{useRef as Nt,useReducer as Kn,useEffect as zn}from"react";import T from"prop-types";import Hn from"classnames";import ue from"prop-types";var ke=ue.oneOfType([ue.string,ue.number,ue.bool]),ce=ue.shape({value:ke.isRequired,label:ue.string});var Rt=40,St=38,Yn=13,Bt=27,Gn=8,Jn=9,Qn=16,Xn=20;function Zn(e,t){switch(t.type){case"close":return{...e,dropdownOpen:!1,text:"",selected:null};case"open":return{...e,dropdownOpen:!0};case"textFilter":return{...e,text:t.text};case"select":return{...e,selected:t.value};case"focus":return{...e,inFocus:!0,dropdownOpen:!0};case"blur":return{...e,inFocus:!1,dropdownOpen:!1,text:"",selected:null}}}function Mt(e){return H.createElement("li",{className:"option"},e.label,H.createElement(U,{onClick:e.remove,spaced:!1,disabled:e.disabled}))}Mt.propTypes={label:T.string,remove:T.func,disabled:T.bool};function tt(e){let t=Nt(null),n=Nt(null),[s,r]=Kn(Zn,{text:"",dropdownOpen:!1,selected:null}),a=()=>{r({type:"blur"})},l=Y(e);zn(()=>{!l||e.disabled&&!l.disabled&&a()});let c=o=>{typeof e.onChange=="function"&&e.onChange([...new Set([...e.value,o])],!0)},m=o=>{if(!e.disabled&&typeof e.onChange=="function"){let f=[...e.value];f.splice(o,1),e.onChange(f,!1),n.current&&n.current.focus()}},h=()=>{e.disabled||typeof e.onChange=="function"&&(e.onChange([],!1),r({type:"textFilter",text:""}),n.current&&n.current.focus())},d=o=>{let f=o.split(" ").map(i=>i.trim().toLowerCase()).filter(i=>i.length>0);return e.options.filter(i=>{if(e.value.indexOf(i.value)!==-1)return!1;if(f.length===0||!e.filter)return!0;let u=`${i.label}${i.value}`.toLowerCase(),p=!1;return f.map(D=>{u.indexOf(D)!==-1&&(p=!0)}),p})},y=o=>{t.current&&(t.current.contains(o.relatedTarget)||t.current===o.relatedTarget)||a()},M=o=>{r({type:"focus"})},b=o=>{if(!(!o||o.which===Qn||o.which===Xn)){if(o.which===Yn||o.which===Jn&&s.selected!==null){s.dropdownOpen&&(s.selected!==null&&c(s.selected),r({type:"close"}),o.preventDefault());return}if(!s.dropdownOpen&&o.which!==Bt&&r({type:"open"}),o.which===Gn&&s.text===""&&typeof e.onChange=="function"&&e.onChange(e.value.splice(0,e.value.length-1),!1),o.which===Rt||o.which===St){if(o.preventDefault(),typeof e.onChange!="function")return;let f=-1,i=d(s.text);if(!i.length)return;i.map((p,D)=>{p.value===s.selected&&(f=D)});let u=f;o.which===Rt&&(u++,u>=i.length&&(u=0)),o.which===St&&(u--,u<0&&(u=i.length-1)),i[u]?r({type:"select",value:i[u].value}):r({type:"select",value:i[u].value})}o.which===Bt&&s.dropdownOpen&&r({type:"close"})}},g=o=>{if(r({type:"textFilter",text:o}),typeof e.onTextChange=="function"&&e.onTextChange(o),typeof e.onChange!="function")return;let f=o.trim().toLowerCase();if(f.length<=0)r({type:"select",value:null});else{let i=null;if(e.options.map(u=>{let p=`${u.value}`.trim().toLowerCase();i===null&&p===f&&(i=u.value)}),i!==null)r({type:"select",value:i});else{let u=null;if(e.options.map(p=>{let D=`${p.label}`.trim().toLowerCase();u===null&&D===f&&(u=p.value)}),u!==null)r({type:"select",value:u});else{let p=d(o),D=p.find(Ie=>Ie.value===s.selected),Ee=p.length>0?p[0].value:void 0;r({type:"select",value:D?D.value:Ee||null})}}}},x=o=>{e.disabled||s.dropdownOpen||n.current&&n.current.inputRef.current&&(n.current.inputRef.current===document.activeElement?r({type:"open"}):n.current&&n.current.focus())},I=o=>{if(!e.options.find(i=>i.value===o)){console.warn("Could not find selected value in options",o);return}c(o),n.current&&n.current.focus(),r({type:"close"})},je=d(s.text),he=e.value.length>0,pe=he&&!e.disabled;return H.createElement(O,{ref:t,block:e.block,className:Hn("MIRECO-multi-select",{"has-value":he,"in-focus":s.inFocus,disabled:e.disabled,clearable:pe},e.className),onBlur:y,onClick:x,tabIndex:-1},H.createElement("ul",{className:"selected"},e.value.map((o,f)=>{let i=e.options.find(p=>p.value===o),u=()=>{m(f)};return H.createElement(Mt,{key:`selected-${o}`,value:o,label:i?i.label:o,remove:u,disabled:e.disabled})}),H.createElement("li",{className:"text"},H.createElement(_,{ref:n,placeholder:e.placeholder,value:s.text,onFocus:M,onKeyDown:b,onChange:g,disabled:e.disabled,block:e.block,style:e.style,autoFocus:e.autoFocus,className:e.textClassName,id:e.id,icon:e.icon}))),pe&&H.createElement(U,{onClick:h}),e.icon,s.dropdownOpen&&!e.disabled&&H.createElement(ee,{options:je,value:s.selected,onSelect:I,...e.dropdownProps}))}tt.propTypes={value:T.arrayOf(ke).isRequired,options:T.arrayOf(ce).isRequired,placeholder:T.string,block:T.bool,disabled:T.bool,onChange:T.func,onTextChange:T.func,style:T.object,dropdownProps:T.object,filter:T.bool,autoFocus:T.bool,className:T.string,textClassName:T.string,id:T.string,icon:T.node};tt.defaultProps={options:[],filter:!0,icon:K};var es=tt;import ts,{useRef as ns}from"react";import F from"prop-types";import ss from"classnames";function nt(e){let t=ns(),n=s=>{!t.current||typeof e.onChange=="function"&&e.onChange(+t.current.value)};return ts.createElement("input",{ref:t,type:"range",value:e.value,onChange:n,min:e.min,max:e.max,step:e.step,name:e.name,required:e.required,disabled:e.disabled,autoFocus:e.autoFocus,tabIndex:e.tabIndex,className:ss("MIRECO-range",{block:e.block},e.className),style:e.style,onFocus:e.onFocus,onBlur:e.onBlur,onClick:e.onClick})}nt.propTypes={value:F.number.isRequired,onChange:F.func,min:F.number.isRequired,max:F.number.isRequired,step:F.number,name:F.string,required:F.bool,disabled:F.bool,autoFocus:F.bool,tabIndex:F.number,block:F.bool,className:F.string,style:F.object,onFocus:F.func,onBlur:F.func,onClick:F.func};nt.defaultProps={min:0,max:100};var os=nt;import st,{useRef as ot,useReducer as rs,useEffect as Ft}from"react";import j from"prop-types";import is from"classnames";var Pt=40,jt=38,as=13,Et=27;function Me(e,t){return typeof t.value=="string"||typeof t.value=="number"||typeof t.value=="boolean"}function ls(e,t){switch(t.type){case"close":return{...e,dropdownOpen:!1,text:t.formatted,filtering:!1};case"open":return{...e,dropdownOpen:!0,filtering:!1};case"textFilter":return{...e,text:t.text,filtering:t.text.length>0};case"textOverride":return{...e,text:t.text,filtering:!1}}}function rt(e){let t=ot(null),n=ot(null),s=ot(e.value?e.value:null);Ft(()=>{e.value&&(s.current=e.value)},[e.value]);let r="";if(Me(e.value,e)){let o=e.options.find(f=>f.value===e.value);r=o?o.label:`${e.value}`}let[a,l]=rs(ls,{text:r,dropdownOpen:!1,filtering:!1}),c=o=>{let f=o.split(" ").map(i=>i.trim().toLowerCase()).filter(i=>i.length>0);return e.options.filter(i=>{if(f.length===0||!e.filter)return!0;let u=`${i.label}${i.value}`.toLowerCase(),p=!1;return f.map(D=>{u.indexOf(D)!==-1&&(p=!0)}),p})},m=()=>{if(Me(e.value,e)){let o=e.options.find(i=>i.value===e.value),f=o?o.label:`${e.value}`;l({type:"close",formatted:f}),typeof e.onChange=="function"&&e.onChange(e.value,!0)}else l({type:"close",formatted:""}),typeof e.onChange=="function"&&e.onChange(e.nullable?null:s.current,!0)},h=o=>{t.current&&(t.current.contains(o.relatedTarget)||t.current===o.relatedTarget)||m()},d=o=>{l({type:"open"})},y=o=>{if(!!o){if(o.which===as){if(a.dropdownOpen){let f=e.options.find(i=>i.value===e.value);l({type:"close",formatted:f?f.label:""}),o.preventDefault()}return}if(!a.dropdownOpen&&o.which!==Et&&l({type:"open"}),o.which===Pt||o.which===jt){if(o.preventDefault(),typeof e.onChange!="function")return;let f=-1,i=a.filtering?c(a.text):e.options;if(!i.length)return;i.map((p,D)=>{p.value===e.value&&(f=D)});let u=f;o.which===Pt&&(u++,u>=i.length&&(u=0)),o.which===jt&&(u--,u<0&&(u=i.length-1)),i[u]?e.onChange(i[u].value):e.onChange(e.nullable?null:void 0)}if(o.which===Et&&a.dropdownOpen){let f="";if(Me(e.value,e)){let i=e.options.find(u=>u.value===e.value);f=i?i.label:`${e.value}`}l({type:"close",formatted:f})}}},M=o=>{if(l({type:"textFilter",text:o}),typeof e.onTextChange=="function"&&e.onTextChange(o),typeof e.onChange!="function")return;let f=o.trim().toLowerCase();if(f.length<=0)e.onChange(e.nullable?null:void 0,!1);else{let i=null;if(e.options.map(u=>{let p=`${u.value}`.trim().toLowerCase();i===null&&p===f&&(i=u.value)}),i!==null)e.onChange(i,!1);else{let u=null;if(e.options.map(p=>{let D=`${p.label}`.trim().toLowerCase();u===null&&D===f&&(u=p.value)}),u!==null)e.onChange(u,!1);else{let p=c(o),D=p.find(Ie=>Ie.value===e.value),Ee=p.length>0?p[0].value:void 0;e.onChange(D?D.value:Ee,!1)}}}},b=o=>{let f=e.options.find(i=>i.value===o);if(!f){console.warn("Could not find selected value in options",o);return}typeof e.onChange=="function"&&e.onChange(o,!0),n.current&&n.current.focus(),l({type:"close",formatted:f.label})},g=()=>{let o=e.options.find(f=>f.value===e.value);l(o?{type:"textOverride",text:o.label}:{type:"textOverride",text:`${e.value}`})},x=Y(e);Ft(()=>{!x||(x.value!==e.value&&(e.value===null?l({type:"textOverride",text:""}):Me(e.value,e)&&(a.dropdownOpen&&c(a.text).find(i=>i.value===e.value)||g())),e.disabled&&!x.disabled&&m())});let I=()=>{e.disabled||typeof e.onChange=="function"&&(e.onChange(e.nullable?null:void 0,!1),l({type:"textFilter",text:""}),n.current&&n.current.focus())},je=a.filtering?c(a.text):e.options,he=!!e.value,pe=he&&!e.disabled;return st.createElement(O,{ref:t,block:e.block,className:is("MIRECO-select",{"has-value":he,clearable:pe},e.className),onBlur:h},st.createElement(z,{ref:n,placeholder:e.placeholder,value:a.text,onFocus:d,onKeyDown:y,onChange:M,disabled:e.disabled,block:e.block,style:e.style,autoFocus:e.autoFocus,className:e.textClassName,id:e.id,icon:e.icon,onClear:pe?I:void 0}),a.dropdownOpen&&st.createElement(ee,{options:je,value:e.value,onSelect:b,...e.dropdownProps}))}rt.propTypes={value:ke,nullable:j.bool,options:j.arrayOf(ce).isRequired,placeholder:j.string,block:j.bool,disabled:j.bool,onChange:j.func,onTextChange:j.func,style:j.object,dropdownProps:j.object,filter:j.bool,autoFocus:j.bool,className:j.string,textClassName:j.string,id:j.string,icon:j.node};rt.defaultProps={nullable:!0,options:[],filter:!0,icon:K};var it=rt;import at from"react";import w from"prop-types";import us from"react-textarea-autosize";import cs from"classnames";var we=class extends at.PureComponent{constructor(t){super(t);this.inputRef=at.createRef()}componentDidUpdate=(t,n)=>{this.props.disabled&&!t.disabled&&this.inputRef.current&&this.inputRef.current._ref===document.activeElement&&typeof this.props.onBlur=="function"&&this.props.onBlur(),!this.props.disabled&&t.disabled&&this.inputRef.current&&this.inputRef.current._ref===document.activeElement&&typeof this.props.onFocus=="function"&&this.props.onFocus()};handleChange=t=>{t&&typeof this.props.onChange=="function"&&this.props.onChange(t.target.value)};render(){return at.createElement(us,{ref:this.inputRef,value:this.props.value||"",onChange:this.handleChange,name:this.props.name,required:this.props.required,placeholder:this.props.placeholder,disabled:this.props.disabled,autoFocus:this.props.autoFocus,tabIndex:this.props.tabIndex,maxLength:this.props.maxLength,id:this.props.id,className:cs("MIRECO-textarea",{block:this.props.block},this.props.className),style:this.props.style,minRows:this.props.minRows||1,maxRows:this.props.maxRows,onFocus:this.props.onFocus,onBlur:this.props.onBlur,onKeyDown:this.props.onKeyDown,onKeyUp:this.props.onKeyUp})}};C(we,"propTypes",{value:w.string,onChange:w.func,name:w.string,required:w.bool,placeholder:w.string,disabled:w.bool,autoFocus:w.bool,tabIndex:w.number,maxLength:w.number,id:w.string,block:w.bool,className:w.string,style:w.object,minRows:w.number,maxRows:w.number,onFocus:w.func,onBlur:w.func,onKeyDown:w.func,onKeyUp:w.func}),C(we,"defaultProps",{minRows:2,maxRows:5});import fe from"react";import S from"prop-types";import fs from"humanize-duration";import ds from"classnames";import{format as lt,addMilliseconds as It,startOfDay as Fe,isValid as hs,parse as ps}from"date-fns";var ms=40,bs=38,ys=13,gs=27;function ut(e){return typeof e=="number"&&!isNaN(e)}var xs=fs.humanizer({language:"shortEn",languages:{shortEn:{h:()=>"h",m:()=>"m"}}}),ne=class extends fe.PureComponent{constructor(t){super(t);this.state={...this.state,textValue:this.format(t,t.value),inFocus:!1,dropdownOpen:!1},this.options=this.generateOptions(t),this.containerRef=fe.createRef(),this.textRef=fe.createRef()}componentDidUpdate(t,n){(t.step!==this.props.step||t.relativeTo!==this.props.relativeTo||t.relativeStart!==this.props.relativeStart)&&(this.options=this.generateOptions(this.props)),t.value!==this.props.value&&(this.props.value===null?this.setState({textValue:""}):typeof this.props.value=="number"&&this.props.value!==this.parseText(this.state.textValue)&&this.setState({textValue:this.format(this.props,this.props.value)})),this.props.disabled&&!t.disabled&&this.onBlur()}generateOptions=t=>{let n=[];for(var s=0;s<24*60;s+=t.step){let r=s*60*1e3,a={value:r,label:lt(It(Fe(new Date),r),t.displayFormat)};if(typeof t.relativeTo=="number"&&typeof t.relativeStart=="number"){let l=t.relativeStart+a.value;if(l>t.relativeTo){let c=l-t.relativeTo;c<=24*60*60*1e3&&c%(5*60*1e3)==0&&(a.label+=` (${xs(c,{units:["h","m"],spacer:""})})`)}}n.push(a)}return n};format=(t,n)=>{if(typeof n!="number")return"";let s=n;s=It(Fe(new Date),n);let r=lt(s,t.longFormat),a=lt(s,t.displayFormat),l=this.parseText(r),c=this.parseText(a);return l===c?a:r};parseText=t=>{let n=t.trim();if(n.length===0)return null;let s;return this.props.inputFormats.map(r=>{if(typeof s!="undefined")return;let a=ps(n,r,Fe(new Date));hs(a)&&(s=+a,s-=+Fe(new Date))}),s};handleTextChange=t=>{this.setState({textValue:t},()=>{typeof this.props.onChange=="function"&&this.props.onChange(this.parseText(t),!1),this.setState({dropdownOpen:!0})})};previousOption=()=>{if(!ut(this.props.value))return this.nextOption();if(this.props.value===this.options[0].value)return this.options[this.options.length-1].value;let t=0;return this.options.map((n,s)=>{n.value<this.props.value&&(t=s)}),this.options[t].value};nextOption=()=>{if(!ut(this.props.value))return this.options[0].value;let t=0;return this.options.map((n,s)=>{n.value<=this.props.value&&(t=s)}),t+=1,t>=this.options.length&&(t=0),this.options[t].value};handleTextKeyDown=t=>{if(t&&(t.which===ys||t.which===gs)){if(this.state.dropdownOpen){let n=this.format(this.props,this.props.value);this.setState({textValue:n,dropdownOpen:!1}),t.preventDefault()}return}this.setState({inFocus:!0,dropdownOpen:!0}),t&&(t.which===ms&&(t.preventDefault(),typeof this.props.onChange=="function"&&this.props.onChange(this.nextOption(),!1),this.setState({dropdownOpen:!0})),t.which===bs&&(t.preventDefault(),typeof this.props.onChange=="function"&&this.props.onChange(this.previousOption(),!1),this.setState({dropdownOpen:!0})))};handleFocus=t=>{this.setState({inFocus:!0,dropdownOpen:!0})};handleContainerBlur=t=>{this.containerRef.current&&(this.containerRef.current.contains(t.relatedTarget)||this.containerRef.current===t.relatedTarget)||this.onBlur()};handleTextClick=()=>{this.setState({dropdownOpen:!0})};onBlur=()=>{if(typeof this.props.value=="number"){let t=this.format(this.props,this.props.value);this.setState({textValue:t,inFocus:!1,dropdownOpen:!1},()=>{typeof this.props.onChange=="function"&&this.props.onChange(this.props.value,!0)})}else this.setState(t=>{let n={inFocus:!1,dropdownOpen:!1};return this.props.autoErase&&(n.textValue=""),n},()=>{typeof this.props.onChange=="function"&&(this.props.autoErase?this.props.onChange(null,!0):this.props.onChange(this.props.value,!0))})};handleSelect=t=>{typeof this.props.onChange=="function"&&this.props.onChange(t,!1),this.textRef.current&&this.textRef.current.focus(),this.setState({dropdownOpen:!1})};handleClear=()=>{typeof this.props.onChange=="function"&&(this.props.onChange(null,!1),this.textRef.current&&this.textRef.current.focus())};render(){let t=!this.props.disabled&&ut(this.props.value)&&this.props.showClearButton;return fe.createElement(O,{ref:this.containerRef,className:ds("MIRECO-time",{"right-hang":this.props.rightHang},this.props.className),tabIndex:-1,onBlur:this.handleContainerBlur,block:this.props.block},fe.createElement(z,{ref:this.textRef,placeholder:this.props.placeholder,onChange:this.handleTextChange,value:this.state.textValue,onFocus:this.handleFocus,disabled:this.props.disabled,onKeyDown:this.handleTextKeyDown,block:this.props.block,style:{marginBottom:"0"},onClick:this.handleTextClick,icon:ze,onClear:t?this.handleClear:void 0,className:this.props.textClassName,id:this.props.id}),this.state.inFocus&&this.state.dropdownOpen&&!this.props.disabled&&fe.createElement(ee,{options:this.options,value:this.props.value,disabled:this.props.disabled,onSelect:this.handleSelect,continuousOptions:!0}))}};C(ne,"propTypes",{inputFormats:S.arrayOf(S.string).isRequired,displayFormat:S.string.isRequired,placeholder:S.string,onChange:S.func,value:S.number,disabled:S.bool,step:S.number.isRequired,block:S.bool,autoErase:S.bool,className:S.string,relativeTo:S.number,relativeStart:S.number,rightHang:S.bool,showClearButton:S.bool,textClassName:S.string,id:S.string}),C(ne,"defaultProps",{inputFormats:["h:mm:ss a","h:mm:ssa","h:mm:ss","h:mm a","H:mm:ss","H:mm","h:mma","h:mm","h a","H:mm","H","ha","h"],longFormat:"h:mm:ss a",displayFormat:"h:mm a",placeholder:"hh:mm",step:30,autoErase:!0,relativeStart:0,rightHang:!1,showClearButton:!0});import Vt,{useState as ft,useRef as At,useEffect as Cs}from"react";import de from"prop-types";import vs from"classnames";import ct from"react";var Lt=ct.createElement("svg",{width:"24",height:"24",viewBox:"0 0 6.3499998 6.3499998",className:"MIRECO-spinner"},ct.createElement("g",{transform:"translate(0,-290.65)"},ct.createElement("path",{d:"m 3.175,295.94168 a 2.1166666,2.1166666 0 0 1 -1.9555449,-1.30665 2.1166666,2.1166666 0 0 1 0.4588356,-2.30673 2.1166666,2.1166666 0 0 1 2.3067225,-0.45883 2.1166666,2.1166666 0 0 1 1.3066533,1.95554",style:{fill:"none",fillOpacity:.271255,stroke:"#333333",strokeWidth:.529167,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:4,strokeDasharray:"none",strokeDashoffset:5.39717,strokeOpacity:1}})));function dt(e){let[t,n]=ft([]),[s,r]=ft(!1),[a,l]=ft(""),c=At(),m=At();c.current=a,Cs(()=>{e.value===null&&(t.length>0||s)&&(n([]),r(!1))});let h=[];s||(h=[...t]);let d=e.value;e.value!==null&&typeof e.value!="undefined"&&(d=e.value.value,h.find(x=>x.value===d)||(h=[...h,e.value]));let y=g=>{let x=g.trim();l(x),x.length>0?typeof e.getOptions=="function"&&(r(!0),m.current&&window.clearTimeout(m.current),m.current=window.setTimeout(()=>{e.getOptions(x).then(I=>{x==c.current&&(n(I),r(!1))})},e.debounce)):(n([]),r(!1))},M=g=>{if(typeof e.onChange=="function"){if(g!==null&&typeof g!="undefined"){let x=h.find(I=>I.value===g);x?g=x:g={value:g,label:`${g}`}}e.onChange(g)}},b={noOptionsPrompt:"No options"};return s?h.length>0?b.afterOptions=Vt.createElement("li",{className:"none"},e.loadingPrompt):b.noOptionsPrompt=e.loadingPrompt:e.value===null&&(b.noOptionsPrompt=e.searchPrompt),Vt.createElement(it,{...e,className:vs(e.className,"MIRECO-async-select"),options:h,value:d,onTextChange:y,onChange:M,dropdownProps:b,filter:!1,icon:s?Lt:K})}dt.propTypes={value:ce,onChange:de.func,getOptions:de.func.isRequired,loadingPrompt:de.string,searchPrompt:de.string,debounce:de.number,className:de.string};dt.defaultProps={loadingPrompt:"Loading...",searchPrompt:"Type to search",debounce:500};var ks=dt;import W from"react";import V from"prop-types";import{startOfDay as _t,format as Wt,parse as qt}from"date-fns";import Ut from"classnames";function $t(e){return typeof e=="string"}function Pe(e){return typeof e=="number"&&!isNaN(e)}function Kt(e,t){return e===t}function ht(e){return e===null}function ws(e){return e===null}function Ts(e){return+qt(e,constants.ISO_8601_DATE_FORMAT,new Date)}function Ds(e,t){return+_t(qt(e,constants.ISO_8601_DATE_FORMAT,new Date))+t}function pt(e){if(e===null)return{date:null,time:null};if(Pe(e)){let t=Wt(e,constants.ISO_8601_DATE_FORMAT),n=e-Ts(t);return{date:t,time:n}}return{date:void 0,time:void 0}}var J=class extends W.PureComponent{constructor(t){super(t);this.state={...pt(t.value)},this.containerRef=W.createRef(),this.dateRef=W.createRef(),this.timeRef=W.createRef()}componentDidUpdate=(t,n)=>{Kt(t.value,this.props.value)||(ht(this.props.value)?this.setState({date:null,time:null}):Pe(this.props.value)&&(Kt(this.props.value,this.combinedStateValue())||this.setState({...pt(this.props.value)})))};getDefaultDate(){return this.props.defaultDate?this.props.defaultDate:Wt(new Date,constants.ISO_8601_DATE_FORMAT)}combinedStateValue(){return Ds(this.state.date||this.getDefaultDate(),this.state.time||0)}handleDateChange=(t,n)=>{this.setState({date:t},this.updateParentValue)};handleTimeChange=(t,n)=>{this.setState({time:t},this.updateParentValue)};updateParentValue=()=>{typeof this.props.onChange=="function"&&(ws(this.state.date)&&ht(this.state.time)?this.props.onChange(null,!1):$t(this.state.date)||Pe(this.state.time)?this.props.onChange(this.combinedStateValue(),!1):this.props.onChange(void 0,!1))};handleContainerBlur=t=>{if(t.relatedTarget){let n=this.dateRef.current&&this.dateRef.current.containerRef.current&&(this.dateRef.current.containerRef.current.contains(t.relatedTarget)||this.dateRef.current.containerRef.current==t.relatedTarget),s=this.timeRef.current&&this.timeRef.current.containerRef.current&&(this.timeRef.current.containerRef.current.contains(t.relatedTarget)||this.timeRef.current.containerRef.current==t.relatedTarget);if(n||s)return}this.onBlur()};handleClearClick=t=>{typeof this.props.onChange=="function"&&this.props.onChange(null,!0)};onBlur=()=>{window.setTimeout(()=>{if($t(this.state.date)||Pe(this.state.time)){let t=this.combinedStateValue();this.setState({...pt(t)},()=>{typeof this.props.onChange=="function"&&this.props.onChange(t,!0)})}else this.setState({date:null,time:null},()=>{this.props.onChange(null,!0)})},0)};render(){let t={};this.props.timeFirst||(t.id=this.props.id);let n=W.createElement(te,{ref:this.dateRef,value:this.state.date,onChange:this.handleDateChange,disabled:this.props.disabled,block:this.props.block,rightHang:this.props.timeFirst,showClearButton:!1,textClassName:this.props.dateTextClassName,...t}),s,r=this.combinedStateValue();this.props.relativeTo&&!ht(r)&&(s=+_t(new Date(r)));let a={};this.props.timeFirst&&(a.id=this.props.id);let l=W.createElement(ne,{ref:this.timeRef,value:this.state.time,onChange:this.handleTimeChange,disabled:this.props.disabled,relativeTo:this.props.relativeTo,relativeStart:s,block:this.props.block,showClearButton:!1,textClassName:this.props.timeTextClassName,...a}),c=n,m=l;return this.props.timeFirst&&(c=l,m=n),W.createElement(O,{ref:this.containerRef,block:this.props.block,className:Ut("MIRECO-datetime",this.props.className,{clearable:this.props.showClear}),tabIndex:-1,onBlur:this.handleContainerBlur},c,!this.props.block&&W.createElement("span",null," "),W.createElement(O,{block:this.props.block,className:Ut("second",{time:!this.props.timeFirst,date:this.props.timeFirst})},m,this.props.showClear&&W.createElement("span",null," "),this.props.showClear&&W.createElement(U,{onClick:this.handleClearClick,disabled:this.props.disabled,className:this.props.clearButtonClassName})))}};C(J,"propTypes",{value:V.number,onChange:V.func,disabled:V.bool,block:V.bool,timeFirst:V.bool,showClear:V.bool,className:V.string,relativeTo:V.number,defaultDate:Q,dateTextClassName:V.string,timeTextClassName:V.string,clearButtonClassName:V.string,id:V.string}),C(J,"defaultProps",{block:!1,timeFirst:!1,showClear:!0});import q from"react";import E from"prop-types";import Os from"classnames";import{format as zt}from"date-fns";function Ht(e){return e===null}function B(e){return typeof e=="number"&&!isNaN(e)}function Ns(e){return e&&B(e.start)&&B(e.end)}function mt(e){return e?{start:e.start,end:e.end}:{start:void 0,end:void 0}}function Rs(e,t){if(B(e)&&B(t)&&e>t){let n=e;e=t,t=n}return{start:e,end:t}}function Ss(e){return e===null||e&&e.start===null&&e.end===null}function Yt(e,t){return!!(typeof e=="undefined"&&typeof t=="undefined"||e===null&&t===null||e&&t&&e.start===t.start&&e.end===t.end)}var Te=class extends q.PureComponent{constructor(t){super(t);this.containerRef=q.createRef(),this.startRef=q.createRef(),this.endRef=q.createRef(),this.state={...this.state,...mt(t.value)}}componentDidUpdate=(t,n)=>{Yt(t.value,this.props.value)||(Ss(this.props.value)?this.setState({start:null,end:null}):Ns(this.props.value)&&(Yt(this.props.value,this.combinedStateValue())||this.setState({...mt(this.props.value)})))};combinedStateValue(){let t=this.state.start,n=this.state.end;return B(t)&&!B(n)&&(n=t+this.props.defaultDuration),B(n)&&!B(t)&&(t=n-this.props.defaultDuration),Rs(t,n)}handleStartChange=(t,n)=>{let s=this.state.end;if(B(t)&&B(this.state.start)&&B(s)){let r=s-this.state.start;s=t+r}this.setState({start:t,end:s},this.updateParentValue)};handleEndChange=(t,n)=>{this.setState({end:t},this.updateParentValue)};updateParentValue=()=>{typeof this.props.onChange=="function"&&(Ht(this.state.start)&&Ht(this.state.end)?this.props.onChange(null,!1):B(this.state.start)||B(this.state.end)?this.props.onChange(this.combinedStateValue(),!1):this.props.onChange(void 0,!1))};handleClearClick=()=>{typeof this.props.onChange=="function"&&this.props.onChange(null)};handleContainerBlur=t=>{if(t.relatedTarget){let n=this.startRef.current&&this.startRef.current.dateRef.current&&this.startRef.current.dateRef.current.containerRef.current,s=this.startRef.current&&this.startRef.current.timeRef.current&&this.startRef.current.timeRef.current.containerRef.current,r=n&&(n.contains(t.relatedTarget)||t.relatedTarget===n)||s&&(s.contains(t.relatedTarget)||t.relatedTarget===s),a=this.endRef.current&&this.endRef.current.dateRef.current&&this.endRef.current.dateRef.current.containerRef.current,l=this.endRef.current&&this.endRef.current.timeRef.current&&this.endRef.current.timeRef.current.containerRef.current,c=a&&(a.contains(t.relatedTarget)||t.relatedTarget===a)||l&&(l.contains(t.relatedTarget)||t.relatedTarget===l);if(r||c)return}this.onBlur()};onBlur=()=>{window.setTimeout(()=>{if(B(this.state.start)||B(this.state.end)){let t=this.combinedStateValue();this.setState({...mt(t)},()=>{typeof this.props.onChange=="function"&&this.props.onChange(t,!0)})}else this.setState({start:null,end:null},()=>{this.props.onChange(null,!0)})},1)};render(){let t;B(this.state.end)&&(t=zt(new Date(this.state.end),N));let n;return B(this.state.start)&&(n=zt(new Date(this.state.start),N)),q.createElement(O,{block:this.props.block,ref:this.containerRef,className:Os("MIRECO-datetime-range",this.props.className,{clearable:this.props.showClear}),onBlur:this.handleContainerBlur},q.createElement(J,{ref:this.startRef,value:this.state.start,onChange:this.handleStartChange,disabled:this.props.disabled,block:this.props.block,className:"start",showClear:!1,defaultDate:t,dateTextClassName:this.props.startDateTextClassName,timeTextClassName:this.props.startTimeTextClassName,id:this.props.id}),q.createElement(O,{className:"datetime-range-second",block:this.props.block},q.createElement("span",{className:"to"}," - "),q.createElement(J,{ref:this.endRef,value:this.state.end,onChange:this.handleEndChange,disabled:this.props.disabled,timeFirst:!0,block:this.props.block,className:"end",showClear:!1,relativeTo:this.state.start,defaultDate:n,dateTextClassName:this.props.endDateTextClassName,timeTextClassName:this.props.endTimeTextClassName}),!this.props.block&&this.props.showClear&&q.createElement("span",null," "),this.props.showClear&&q.createElement(U,{onClick:this.handleClearClick,disabled:this.props.disabled,className:this.props.clearButtonClassName})))}};C(Te,"propTypes",{block:E.bool,onChange:E.func,value:E.shape({start:E.number,end:E.number}),disabled:E.bool,defaultDuration:E.number.isRequired,showClear:E.bool,className:E.string,startDateTextClassName:E.string,startTimeTextClassName:E.string,endDateTextClassName:E.string,endTimeTextClassName:E.string,clearButtonClassName:E.string,id:E.string}),C(Te,"defaultProps",{block:!1,disabled:!1,defaultDuration:60*60*1e3,showClear:!0});export{ks as AsyncSelect,Ve as Button,rn as Checkbox,Ae as CheckboxInput,te as Date,J as Datetime,Te as DatetimeRange,Vn as Duration,es as MultiSelect,$n as Number,os as Range,it as Select,_ as Text,we as Textarea,ne as Time}; |
{ | ||
"name": "mireco", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "MIcro REact COmponents - extensible library for interfaces with no heavy deps", | ||
@@ -5,0 +5,0 @@ "repository": "git@github.com:bor3ham/mireco.git", |
@@ -69,3 +69,3 @@ import React from 'react' | ||
selectDay: PropTypes.func, | ||
current: mirecoPropTypes.date, | ||
current: datePropType, | ||
showCurrent: PropTypes.bool, | ||
@@ -72,0 +72,0 @@ highlight: PropTypes.func, |
@@ -21,3 +21,3 @@ import React from 'react' | ||
placeholder: PropTypes.string, | ||
value: mirecoPropTypes.date, | ||
value: datePropType, | ||
onChange: PropTypes.func, | ||
@@ -24,0 +24,0 @@ disabled: PropTypes.bool, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
237007