pleroma/priv/static/packs/modals/mute_modal.js
2018-08-12 18:02:43 +02:00

2 lines
8.2 KiB
JavaScript

webpackJsonp([29],{835:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n.d(t,"default",function(){return T});var o,a,c=n(2),i=n.n(c),l=n(1),s=n.n(l),r=n(3),u=n.n(r),d=n(4),h=n.n(d),f=n(0),p=n.n(f),v=n(9),m=n(7),k=n(867),g=n.n(k),b=n(100),y=n(26),_=n(22),C=n(90),O=function(e){return{isSubmitting:e.getIn(["reports","new","isSubmitting"]),account:e.getIn(["mutes","new","account"]),notifications:e.getIn(["mutes","new","notifications"])}},E=function(e){return{onConfirm:function(t,n){e(Object(_.A)(t.get("id"),n))},onClose:function(){e(Object(y.c)())},onToggleNotifications:function(){e(Object(C.h)())}}},T=(o=Object(v.connect)(O,E))(a=Object(m.g)(a=function(e){function t(){var n,o,a;s()(this,t);for(var c=arguments.length,i=Array(c),l=0;l<c;l++)i[l]=arguments[l];return n=o=u()(this,e.call.apply(e,[this].concat(i))),o.handleClick=function(){o.props.onClose(),o.props.onConfirm(o.props.account,o.props.notifications)},o.handleCancel=function(){o.props.onClose()},o.setRef=function(e){o.button=e},o.toggleNotifications=function(){o.props.onToggleNotifications()},a=n,u()(o,a)}return h()(t,e),t.prototype.componentDidMount=function(){this.button.focus()},t.prototype.render=function(){var e=this.props,t=e.account,n=e.notifications;return i()("div",{className:"modal-root__modal mute-modal"},void 0,i()("div",{className:"mute-modal__container"},void 0,i()("p",{},void 0,i()(m.b,{id:"confirmations.mute.message",defaultMessage:"Are you sure you want to mute {name}?",values:{name:i()("strong",{},void 0,"@",t.get("acct"))}})),i()("div",{},void 0,i()("label",{htmlFor:"mute-modal__hide-notifications-checkbox"},void 0,i()(m.b,{id:"mute_modal.hide_notifications",defaultMessage:"Hide notifications from this user?"})," ",i()(g.a,{id:"mute-modal__hide-notifications-checkbox",checked:n,onChange:this.toggleNotifications})))),i()("div",{className:"mute-modal__action-bar"},void 0,i()(b.a,{onClick:this.handleCancel,className:"mute-modal__cancel-button"},void 0,i()(m.b,{id:"confirmation_modal.cancel",defaultMessage:"Cancel"})),p.a.createElement(b.a,{onClick:this.handleClick,ref:this.setRef},i()(m.b,{id:"confirmations.mute.confirm",defaultMessage:"Mute"}))))},t}(p.a.PureComponent))||a)||a},867:function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function a(e,t){var n={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),u=n(0),d=o(u),h=n(10),f=o(h),p=n(5),v=o(p),m=n(868),k=o(m),g=n(869),b=o(g),y=n(870),_=function(e){function t(e){c(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.handleClick=n.handleClick.bind(n),n.handleTouchStart=n.handleTouchStart.bind(n),n.handleTouchMove=n.handleTouchMove.bind(n),n.handleTouchEnd=n.handleTouchEnd.bind(n),n.handleFocus=n.handleFocus.bind(n),n.handleBlur=n.handleBlur.bind(n),n.previouslyChecked=!(!e.checked&&!e.defaultChecked),n.state={checked:!(!e.checked&&!e.defaultChecked),hasFocus:!1},n}return l(t,e),r(t,[{key:"componentWillReceiveProps",value:function(e){"checked"in e&&this.setState({checked:!!e.checked})}},{key:"handleClick",value:function(e){var t=this.input;if(e.target!==t&&!this.moved)return this.previouslyChecked=t.checked,e.preventDefault(),t.focus(),void t.click();var n=this.props.hasOwnProperty("checked")?this.props.checked:t.checked;this.setState({checked:n})}},{key:"handleTouchStart",value:function(e){this.startX=(0,y.pointerCoord)(e).x,this.activated=!0}},{key:"handleTouchMove",value:function(e){if(this.activated&&(this.moved=!0,this.startX)){var t=(0,y.pointerCoord)(e).x;this.state.checked&&t+15<this.startX?(this.setState({checked:!1}),this.startX=t,this.activated=!0):t-15>this.startX&&(this.setState({checked:!0}),this.startX=t,this.activated=t<this.startX+5)}}},{key:"handleTouchEnd",value:function(e){if(this.moved){var t=this.input;if(e.preventDefault(),this.startX){var n=(0,y.pointerCoord)(e).x;!0===this.previouslyChecked&&this.startX+4>n?this.previouslyChecked!==this.state.checked&&(this.setState({checked:!1}),this.previouslyChecked=this.state.checked,t.click()):this.startX-4<n&&this.previouslyChecked!==this.state.checked&&(this.setState({checked:!0}),this.previouslyChecked=this.state.checked,t.click()),this.activated=!1,this.startX=null,this.moved=!1}}}},{key:"handleFocus",value:function(e){var t=this.props.onFocus;t&&t(e),this.setState({hasFocus:!0})}},{key:"handleBlur",value:function(e){var t=this.props.onBlur;t&&t(e),this.setState({hasFocus:!1})}},{key:"getIcon",value:function(e){var n=this.props.icons;return n?void 0===n[e]?t.defaultProps.icons[e]:n[e]:null}},{key:"render",value:function(){var e=this,t=this.props,n=t.className,o=(t.icons,a(t,["className","icons"])),c=(0,f.default)("react-toggle",{"react-toggle--checked":this.state.checked,"react-toggle--focus":this.state.hasFocus,"react-toggle--disabled":this.props.disabled},n);return d.default.createElement("div",{className:c,onClick:this.handleClick,onTouchStart:this.handleTouchStart,onTouchMove:this.handleTouchMove,onTouchEnd:this.handleTouchEnd},d.default.createElement("div",{className:"react-toggle-track"},d.default.createElement("div",{className:"react-toggle-track-check"},this.getIcon("checked")),d.default.createElement("div",{className:"react-toggle-track-x"},this.getIcon("unchecked"))),d.default.createElement("div",{className:"react-toggle-thumb"}),d.default.createElement("input",s({},o,{ref:function(t){e.input=t},onFocus:this.handleFocus,onBlur:this.handleBlur,className:"react-toggle-screenreader-only",type:"checkbox"})))}}]),t}(u.PureComponent);t.default=_,_.displayName="Toggle",_.defaultProps={icons:{checked:d.default.createElement(k.default,null),unchecked:d.default.createElement(b.default,null)}},_.propTypes={checked:v.default.bool,disabled:v.default.bool,defaultChecked:v.default.bool,onChange:v.default.func,onFocus:v.default.func,onBlur:v.default.func,className:v.default.string,name:v.default.string,value:v.default.string,id:v.default.string,"aria-labelledby":v.default.string,"aria-label":v.default.string,icons:v.default.oneOfType([v.default.bool,v.default.shape({checked:v.default.node,unchecked:v.default.node})])}},868:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),a=function(e){return e&&e.__esModule?e:{default:e}}(o);t.default=function(){return a.default.createElement("svg",{width:"14",height:"11",viewBox:"0 0 14 11"},a.default.createElement("title",null,"switch-check"),a.default.createElement("path",{d:"M11.264 0L5.26 6.004 2.103 2.847 0 4.95l5.26 5.26 8.108-8.107L11.264 0",fill:"#fff",fillRule:"evenodd"}))}},869:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),a=function(e){return e&&e.__esModule?e:{default:e}}(o);t.default=function(){return a.default.createElement("svg",{width:"10",height:"10",viewBox:"0 0 10 10"},a.default.createElement("title",null,"switch-x"),a.default.createElement("path",{d:"M9.9 2.12L7.78 0 4.95 2.828 2.12 0 0 2.12l2.83 2.83L0 7.776 2.123 9.9 4.95 7.07 7.78 9.9 9.9 7.776 7.072 4.95 9.9 2.12",fill:"#fff",fillRule:"evenodd"}))}},870:function(e,t,n){"use strict";function o(e){if(e){var t=e.changedTouches;if(t&&t.length>0){var n=t[0];return{x:n.clientX,y:n.clientY}}var o=e.pageX;if(void 0!==o)return{x:o,y:e.pageY}}return{x:0,y:0}}Object.defineProperty(t,"__esModule",{value:!0}),t.pointerCoord=o}});
//# sourceMappingURL=mute_modal.js.map