4 lines
11 KiB
JavaScript
4 lines
11 KiB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[27],{"1shM":function(t,e,r){t.exports={"error-icon":"error-icon-3x-w99oG","intent-danger":"intent-danger-3x-w99oG","intent-warning":"intent-warning-3x-w99oG"}},"8d0Q":function(t,e,r){"use strict";r.d(e,"b",(function(){return o})),r.d(e,"a",(function(){return n}));var s=r("q1tI");function o(){const[t,e]=Object(s.useState)(!1);return[t,{onMouseOver:function(t){n(t)&&e(!0)},onMouseOut:function(t){n(t)&&e(!1)}}]}function n(t){return!t.currentTarget.contains(t.relatedTarget)}},"Db/h":function(t,e,r){t.exports={errors:"errors-3rBjZvef",show:"show-3rBjZvef",error:"error-3rBjZvef"}},VB86:function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16" fill="none"><path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M8 15c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm0 1c4.418 0 8-3.582 8-8s-3.582-8-8-8-8 3.582-8 8 3.582 8 8 8zm-1-12c0-.552.448-1 1-1s1 .448 1 1v4c0 .552-.448 1-1 1s-1-.448-1-1v-4zm1 7c-.552 0-1 .448-1 1s.448 1 1 1 1-.448 1-1-.448-1-1-1z"/></svg>'},VET0:function(t,e,r){"use strict";r.d(e,"a",(function(){return s}));r("q1tI");const s={bottom:{attachment:{horizontal:"left",vertical:"top"},targetAttachment:{horizontal:"left",vertical:"bottom"}},top:{attachment:{horizontal:"left",vertical:"bottom"},targetAttachment:{horizontal:"left",vertical:"top"}},topRight:{attachment:{horizontal:"right",vertical:"bottom"},targetAttachment:{horizontal:"right",vertical:"top"}},bottomRight:{attachment:{horizontal:"right",vertical:"top"},targetAttachment:{horizontal:"right",vertical:"bottom"}}}},dKnb:function(t,e,r){"use strict";r.d(e,"a",(function(){return l}));var s=r("mrSG"),o=r("q1tI"),n=r("wHCJ"),a=r("jh7f"),i=r("xADF"),h=r("3F0O"),c=r("ECWH");function l(t){var e;const{intent:r,onFocus:l,onBlur:m,onMouseOver:g,onMouseOut:d,containerReference:p=null,endSlot:u,hasErrors:f,hasWarnings:w,errors:b,warnings:v,alwaysShowAttachedErrors:E,iconHidden:O,messagesPosition:A,messagesAttachment:M,customErrorsAttachment:S,messagesRoot:R,inheritMessagesWidthFromTarget:W,disableMessagesRtlStyles:_}=t,T=Object(s.a)(t,["intent","onFocus","onBlur","onMouseOver","onMouseOut","containerReference","endSlot","hasErrors","hasWarnings","errors","warnings","alwaysShowAttachedErrors","iconHidden","messagesPosition","messagesAttachment","customErrorsAttachment","messagesRoot","inheritMessagesWidthFromTarget","disableMessagesRtlStyles"]),x=Object(a.b)({hasErrors:f,hasWarnings:w,errors:b,warnings:v,alwaysShowAttachedErrors:E,iconHidden:O,messagesPosition:A,messagesAttachment:M,customErrorsAttachment:S,messagesRoot:R,inheritMessagesWidthFromTarget:W,disableMessagesRtlStyles:_}),y=Object(h.a)(l,x.onFocus),F=Object(h.a)(m,x.onBlur),j=Object(h.a)(g,x.onMouseOver),P=Object(h.a)(d,x.onMouseOut);return o.createElement(o.Fragment,null,o.createElement(n.a,Object.assign({},T,{intent:null!==(e=x.intent)&&void 0!==e?e:r,onFocus:y,onBlur:F,onMouseOver:j,onMouseOut:P,containerReference:Object(c.a)([p,x.containerReference]),
|
|
endSlot:o.createElement(o.Fragment,null,x.icon&&o.createElement(i.b,{icon:!0},x.icon),u)})),x.renderedErrors)}},jh7f:function(t,e,r){"use strict";var s=r("q1tI"),o=r.n(s),n=r("TSYQ"),a=r("SpAO"),i=r("8d0Q"),h=r("xADF"),c=r("VET0"),l=r("uqKQ"),m=r("i8i4");var g=r("Db/h"),d=r("Ialn");class p extends s.PureComponent{render(){const{children:t=[],show:e=!1,customErrorClass:r,disableRtlStyles:o}=this.props,a=n(g.errors,{[g.show]:e},r),i=t.map((t,e)=>s.createElement("div",{className:g.error,key:e},t));let h={position:"absolute",top:this.props.top,width:this.props.width,height:this.props.height,bottom:void 0!==this.props.bottom?this.props.bottom:"100%",right:void 0!==this.props.right?this.props.right:0,left:this.props.left,zIndex:this.props.zIndex,maxWidth:this.props.maxWidth};if(Object(d.isRtl)()&&!o){const{left:t,right:e}=h;h=Object.assign(Object.assign({},h),{left:e,right:t})}return s.createElement("div",{style:h,className:a},i)}}const u=Object(l.a)((f=p,(w=class extends s.PureComponent{constructor(t){super(t),this._getComponentInstance=t=>{this._instance=t},this._throttleCalcProps=()=>{requestAnimationFrame(()=>this.setState(this._calcProps(this.props)))},this.state=this._getStateFromProps()}componentDidMount(){this._instanceElem=m.findDOMNode(this._instance),this.props.attachOnce||this._subscribe(),this.setState(this._calcProps(this.props))}componentDidUpdate(t){t.children===this.props.children&&t.top===this.props.top&&t.left===this.props.left&&t.width===this.props.width||this.setState(this._getStateFromProps(),()=>this.setState(this._calcProps(this.props)))}render(){return s.createElement("div",{style:{position:"absolute",width:"100%",top:0,left:0}},s.createElement(f,Object.assign({},this.props,{ref:this._getComponentInstance,top:this.state.top,bottom:void 0!==this.state.bottom?this.state.bottom:"auto",right:void 0!==this.state.right?this.state.right:"auto",left:this.state.left,width:this.state.width,maxWidth:this.state.maxWidth}),this.props.children))}componentWillUnmount(){this._unsubsribe()}_getStateFromProps(){return{bottom:this.props.bottom,left:this.props.left,right:this.props.right,top:void 0!==this.props.top?this.props.top:-1e4,width:this.props.inheritWidthFromTarget?this.props.target&&this.props.target.getBoundingClientRect().width:this.props.width,maxWidth:this.props.inheritMaxWidthFromTarget&&this.props.target&&this.props.target.getBoundingClientRect().width}}_calcProps(t){if(t.target&&t.attachment&&t.targetAttachment){const e=this._calcTargetProps(t.target,t.attachment,t.targetAttachment);if(null===e)return{};const{width:r,inheritWidthFromTarget:s=!0,inheritMaxWidthFromTarget:o=!1}=this.props,n={width:s?e.width:r,maxWidth:o?e.width:void 0};switch(t.attachment.vertical){case"bottom":case"middle":n.top=e.y;break;default:n[t.attachment.vertical]=e.y}switch(t.attachment.horizontal){case"right":case"center":n.left=e.x;break;default:n[t.attachment.horizontal]=e.x}return n}return{}}_calcTargetProps(t,e,r){
|
|
const s=t.getBoundingClientRect(),o=this._instanceElem.getBoundingClientRect(),n="parent"===this.props.root?this._getCoordsRelToParentEl(t,s):this._getCoordsRelToDocument(s);if(null===n)return null;const a=this._getDimensions(o),i=this._getDimensions(s).width;let h=0,c=0;switch(e.vertical){case"top":c=n[r.vertical];break;case"bottom":c=n[r.vertical]-a.height;break;case"middle":c=n[r.vertical]-a.height/2}switch(e.horizontal){case"left":h=n[r.horizontal];break;case"right":h=n[r.horizontal]-a.width;break;case"center":h=n[r.horizontal]-a.width/2}return"number"==typeof this.props.attachmentOffsetY&&(c+=this.props.attachmentOffsetY),"number"==typeof this.props.attachmentOffsetX&&(h+=this.props.attachmentOffsetX),{x:h,y:c,width:i}}_getCoordsRelToDocument(t){const e=pageYOffset,r=pageXOffset,s=t.top+e,o=t.bottom+e,n=t.left+r;return{top:s,bottom:o,left:n,right:t.right+r,middle:(s+t.height)/2,center:n+t.width/2}}_getCoordsRelToParentEl(t,e){const r=t.offsetParent;if(null===r)return null;const s=r.scrollTop,o=r.scrollLeft,n=t.offsetTop+s,a=t.offsetLeft+o,i=e.width+a;return{top:n,bottom:e.height+n,left:a,right:i,middle:(n+e.height)/2,center:(a+e.width)/2}}_getDimensions(t){return{height:t.height,width:t.width}}_subscribe(){"document"===this.props.root&&(window.addEventListener("scroll",this._throttleCalcProps,!0),window.addEventListener("resize",this._throttleCalcProps))}_unsubsribe(){window.removeEventListener("scroll",this._throttleCalcProps,!0),window.removeEventListener("resize",this._throttleCalcProps)}}).displayName="Attachable Component",w));var f,w,b=r("Iivm"),v=r("VB86"),E=r("1shM");function O(t){const{intent:e="danger"}=t;return s.createElement(b.a,{icon:v,className:n(E["error-icon"],E["intent-"+e])})}var A,M,S=r("rOyT");r.d(e,"a",(function(){return A})),r.d(e,"b",(function(){return F})),function(t){t[t.Attached=0]="Attached",t[t.Static=1]="Static",t[t.Hidden=2]="Hidden"}(A||(A={})),function(t){t.Top="top",t.Bottom="bottom"}(M||(M={}));const R={top:{attachment:c.a.topRight.attachment,targetAttachment:c.a.topRight.targetAttachment,attachmentOffsetY:-4},bottom:{attachment:c.a.bottomRight.attachment,targetAttachment:c.a.bottomRight.targetAttachment,attachmentOffsetY:4}};function W(t){const{isOpened:e,target:r,errorAttachment:s=M.Top,customErrorsAttachment:n,root:a="parent",inheritWidthFromTarget:i=!1,disableRtlStyles:h,children:c}=t,{attachment:l,targetAttachment:m,attachmentOffsetY:g}=null!=n?n:R[s];return o.a.createElement(u,{isOpened:e,target:r,root:a,inheritWidthFromTarget:i,attachment:l,targetAttachment:m,attachmentOffsetY:g,disableRtlStyles:h,inheritMaxWidthFromTarget:!0,show:!0},c)}function _(t,e){return Boolean(t)&&void 0!==e&&e.length>0}function T(t,e,r){return t===A.Attached&&_(e,r)}function x(t,e,r){return t===A.Static&&_(e,r)}function y(t,e,r){const{hasErrors:s,hasWarnings:o,alwaysShowAttachedErrors:n,iconHidden:a,errors:i,warnings:h,messagesPosition:c=A.Static}=t,l=T(c,s,i),m=T(c,o,h),g=l&&(e||r||Boolean(n)),d=!g&&m&&(e||r),p=x(c,s,i),u=!p&&x(c,o,h),f=!a&&Boolean(s);return{hasAttachedErrorMessages:l,
|
|
hasAttachedWarningMessages:m,showAttachedErrorMessages:g,showAttachedWarningMessages:d,showStaticErrorMessages:p,showStaticWarningMessages:u,showErrorIcon:f,showWarningIcon:!a&&!f&&Boolean(o),intent:function(t,e){return Boolean(t)?"danger":Boolean(e)?"warning":void 0}(s,o)}}function F(t){var e,r;const{errors:c,warnings:l,messagesAttachment:m,customErrorsAttachment:g,messagesRoot:d,inheritMessagesWidthFromTarget:p,disableMessagesRtlStyles:u}=t,[f,w]=Object(a.a)(),[b,v]=Object(i.b)(),E=Object(s.useRef)(null),{hasAttachedErrorMessages:A,hasAttachedWarningMessages:M,showAttachedErrorMessages:R,showAttachedWarningMessages:_,showStaticErrorMessages:T,showStaticWarningMessages:x,showErrorIcon:F,showWarningIcon:j,intent:P}=y(t,f,b),z=F||j?o.a.createElement(O,{intent:F?"danger":"warning"}):void 0,C=A?o.a.createElement(W,{errorAttachment:m,customErrorsAttachment:g,isOpened:R,target:E.current,root:d,inheritWidthFromTarget:p,disableRtlStyles:u,children:c}):void 0,B=M?o.a.createElement(W,{errorAttachment:m,isOpened:_,target:E.current,root:d,inheritWidthFromTarget:p,disableRtlStyles:u,children:l}):void 0,I=T?o.a.createElement(h.a,{className:n(S["static-messages"],S.errors)},null==c?void 0:c.map((t,e)=>o.a.createElement("p",{key:e,className:S.message},t))):void 0,N=x?o.a.createElement(h.a,{className:n(S["static-messages"],S.warnings)},null==l?void 0:l.map((t,e)=>o.a.createElement("p",{key:e,className:S.message},t))):void 0,D=null!==(r=null!==(e=null!=C?C:B)&&void 0!==e?e:I)&&void 0!==r?r:N;return Object.assign(Object.assign({icon:z,renderedErrors:D,containerReference:E,intent:P},w),v)}},rOyT:function(t,e,r){t.exports={"static-messages":"static-messages-1hgcN2c2",errors:"errors-1hgcN2c2",warnings:"warnings-1hgcN2c2",message:"message-1hgcN2c2"}}}]); |