honkoma/priv/static/packs/features/list_editor.js

2 lines
4.8 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[2],{705:function(e,t,n){"use strict";n.r(t);var a,i,o,r,s,c,d,u=n(0),l=n.n(u),p=n(6),f=n.n(p),v=n(3),h=n.n(v),m=n(7),b=n.n(m),g=n(1),y=n.n(g),_=n(2),I=n.n(_),R=n(17),j=n.n(R),C=n(12),O=n(18),N=n(4),q=n(23),w=n(32),k=n(40),M=n(39),A=n(20),x=Object(N.f)({remove:{id:"lists.account.remove",defaultMessage:"Remove from list"},add:{id:"lists.account.add",defaultMessage:"Add to list"}}),E=Object(C.connect)(function(){var e=Object(w.d)();return function(t,n){var a=n.accountId,i=n.added;return{account:e(t,a),added:void 0===i?t.getIn(["listEditor","accounts","items"]).includes(a):i}}},function(e,t){var n=t.accountId;return{onRemove:function(){return e(Object(q.D)(n))},onAdd:function(){return e(Object(q.v)(n))}}})(a=Object(N.g)((o=i=function(e){function t(){return f()(this,t),h()(this,e.apply(this,arguments))}return b()(t,e),t.prototype.render=function(){var e=this.props,t=e.account,n=e.intl,a=e.onRemove,i=e.onAdd,o=void 0;return o=e.added?l()(A.a,{icon:"times",title:n.formatMessage(x.remove),onClick:a}):l()(A.a,{icon:"plus",title:n.formatMessage(x.add),onClick:i}),l()("div",{className:"account"},void 0,l()("div",{className:"account__wrapper"},void 0,l()("div",{className:"account__display-name"},void 0,l()("div",{className:"account__avatar-wrapper"},void 0,l()(k.a,{account:t,size:36})),l()(M.a,{account:t})),l()("div",{className:"account__relationship"},void 0,o)))},t}(O.a),i.propTypes={account:j.a.map.isRequired,intl:I.a.object.isRequired,onRemove:I.a.func.isRequired,onAdd:I.a.func.isRequired,added:I.a.bool},i.defaultProps={added:!1},a=o))||a)||a,z=n(14),S=n.n(z),U=Object(N.f)({search:{id:"lists.search",defaultMessage:"Search among people you follow"}}),K=Object(C.connect)(function(e){return{value:e.getIn(["listEditor","suggestions","value"])}},function(e){return{onSubmit:function(t){return e(Object(q.B)(t))},onClear:function(){return e(Object(q.y)())},onChange:function(t){return e(Object(q.x)(t))}}})(r=Object(N.g)(r=function(e){function t(){var n,a,i;f()(this,t);for(var o=arguments.length,r=Array(o),s=0;s<o;s++)r[s]=arguments[s];return n=a=h()(this,e.call.apply(e,[this].concat(r))),a.handleChange=function(e){a.props.onChange(e.target.value)},a.handleKeyUp=function(e){13===e.keyCode&&a.props.onSubmit(a.props.value)},a.handleClear=function(){a.props.onClear()},i=n,h()(a,i)}return b()(t,e),t.prototype.render=function(){var e=this.props,t=e.value,n=e.intl,a=t.length>0;return l()("div",{className:"list-editor__search search"},void 0,l()("label",{},void 0,l()("span",{style:{display:"none"}},void 0,n.formatMessage(U.search)),l()("input",{className:"search__input",type:"text",value:t,onChange:this.handleChange,onKeyUp:this.handleKeyUp,placeholder:n.formatMessage(U.search)})),l()("div",{role:"button",tabIndex:"0",className:"search__icon",onClick:this.handleClear},void 0,l()("i",{className:S()("fa fa-search",{active:!a})}),l()("i",{"aria-label":n.formatMessage(U.search),className:S()("fa fa-times-circle",{active:a})})))},t}(y.a.PureComponent))||r)||r,D=n(25),J=n(22),P=n.n(J);n.d(t,"default",function(){return T});var T=Object(C.connect)(function(e){return{title:e.getIn(["listEditor","title"]),accountIds:e.getIn(["listEditor","accounts","items"]),searchAccountIds:e.getIn(["listEditor","suggestions","items"])}},function(e){return{onInitialize:function(t){return e(Object(q.F)(t))},onClear:function(){return e(Object(q.y)())},onReset:function(){return e(Object(q.E)())}}})(s=Object(N.g)((d=c=function(e){function t(){return f()(this,t),h()(this,e.apply(this,arguments))}return b()(t,e),t.prototype.componentDidMount=function(){var e=this.props;(0,e.onInitialize)(e.listId)},t.prototype.componentWillUnmount=function(){(0,this.props.onReset)()},t.prototype.render=function(){var e=this.props,t=e.title,n=e.accountIds,a=e.searchAccountIds,i=e.onClear,o=a.size>0;return l()("div",{className:"modal-root__modal list-editor"},void 0,l()("h4",{},void 0,t),l()(K,{}),l()("div",{className:"drawer__pager"},void 0,l()("div",{className:"drawer__inner list-editor__accounts"},void 0,n.map(function(e){return l()(E,{accountId:e,added:!0},e)})),o&&l()("div",{role:"button",tabIndex:"-1",className:"drawer__backdrop",onClick:i}),l()(D.a,{defaultStyle:{x:-100},style:{x:P()(o?0:-100,{stiffness:210,damping:20})}},void 0,function(e){var t=e.x;return l()("div",{className:"drawer__inner backdrop",style:{transform:0===t?null:"translateX("+t+"%)",visibility:-100===t?"hidden":"visible"}},void 0,a.map(function(e){return l()(E,{accountId:e},e)}))})))},t}(O.a),c.propTypes={listId:I.a.string.isRequired,onClose:I.a.func.isRequired,intl:I.a.object.isRequired,onInitialize:I.a.func.isRequired,onClear:I.a.func.isRequired,onReset:I.a.func.isRequired,title:I.a.string.isRequired,accountIds:j.a.list.isRequired,searchAccountIds:j.a.list.isRequired},s=d))||s)||s}}]);
//# sourceMappingURL=list_editor.js.map