Socket
Socket
Sign inDemoInstall

victory-brush-container

Package Overview
Dependencies
28
Maintainers
16
Versions
144
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 36.9.2-next.0 to 36.9.2-next.1

9

CHANGELOG.md
# victory-brush-container
## 36.9.2-next.0
## 36.9.2-next.1

@@ -8,8 +8,13 @@ ### Patch Changes

- cf42d6e4e: Improve types for brush container and candlestick
- 7efd582cc: Replace lodash array utils with native code
- 9cdaf2c08: Replace lodash values and mapValues with native code
- 6e34169a5: Replace lodash isFunction with native code
- Updated dependencies [7da790934]
- Updated dependencies [3f2da66e3]
- Updated dependencies [c13308624]
- Updated dependencies [7efd582cc]
- Updated dependencies [9cdaf2c08]
- Updated dependencies [f6f7cc515]
- Updated dependencies [6e34169a5]
- victory-core@36.9.2-next.0
- victory-core@36.9.2-next.1

@@ -16,0 +21,0 @@ ## 36.9.1

@@ -1,2 +0,2 @@

!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("react")):"function"==typeof define&&define.amd?define(["react"],n):"object"==typeof exports?exports.VictoryBrushContainer=n(require("react")):t.VictoryBrushContainer=n(t.React)}(self,(function(t){return function(){var n={3273:function(t,n,e){var r=e(163);t.exports=function(){if(!arguments.length)return[];var t=arguments[0];return r(t)?t:[t]}},8708:function(t,n,e){var r=e(1171),o=e(7838),i=e(4859),a=e(4073),s=e(8541);function u(t){var n=-1,e=null==t?0:t.length;for(this.clear();++n<e;){var r=t[n];this.set(r[0],r[1])}}u.prototype.clear=r,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=a,u.prototype.set=s,t.exports=u},2596:function(t,n,e){var r=e(2373).Symbol;t.exports=r},6082:function(t){t.exports=function(t,n,e){switch(e.length){case 0:return t.call(n);case 1:return t.call(n,e[0]);case 2:return t.call(n,e[0],e[1]);case 3:return t.call(n,e[0],e[1],e[2])}return t.apply(n,e)}},8644:function(t){t.exports=function(t,n){for(var e=-1,r=null==t?0:t.length,o=Array(r);++e<r;)o[e]=n(t[e],e,t);return o}},9559:function(t){t.exports=function(t,n){for(var e=-1,r=n.length,o=t.length;++e<r;)t[o+e]=n[e];return t}},1634:function(t){t.exports=function(t,n){for(var e=-1,r=null==t?0:t.length;++e<r;)if(n(t[e],e,t))return!0;return!1}},4132:function(t,n,e){var r=e(8347),o=e(788),i=Object.prototype.hasOwnProperty;t.exports=function(t,n,e){var a=t[n];i.call(t,n)&&o(a,e)&&(void 0!==e||n in t)||r(t,n,e)}},3162:function(t,n,e){var r=e(788);t.exports=function(t,n){for(var e=t.length;e--;)if(r(t[e][0],n))return e;return-1}},8347:function(t,n,e){var r=e(5525);t.exports=function(t,n,e){"__proto__"==n&&r?r(t,n,{configurable:!0,enumerable:!0,value:e,writable:!0}):t[n]=e}},6457:function(t,n,e){var r=e(9559),o=e(3608);t.exports=function t(n,e,i,a,s){var u=-1,c=n.length;for(i||(i=o),s||(s=[]);++u<c;){var l=n[u];e>0&&i(l)?e>1?t(l,e-1,i,a,s):r(s,l):a||(s[s.length]=l)}return s}},320:function(t,n,e){var r=e(4710)();t.exports=r},2446:function(t,n,e){var r=e(320),o=e(7747);t.exports=function(t,n){return t&&r(t,n,o)}},4432:function(t,n,e){var r=e(9026),o=e(3110);t.exports=function(t,n){for(var e=0,i=(n=r(n,t)).length;null!=t&&e<i;)t=t[o(n[e++])];return e&&e==i?t:void 0}},6776:function(t){t.exports=function(t,n){return null!=t&&n in Object(t)}},6123:function(t){t.exports=function(t,n,e){for(var r=e-1,o=t.length;++r<o;)if(t[r]===n)return r;return-1}},9070:function(t,n,e){var r=e(7028),o=e(3474);t.exports=function t(n,e,i,a,s){return n===e||(null==n||null==e||!o(n)&&!o(e)?n!=n&&e!=e:r(n,e,i,a,t,s))}},7028:function(t,n,e){var r=e(8708),o=e(8705),i=e(2813),a=e(6682),s=e(9667),u=e(163),c=e(4801),l=e(4289),f="[object Arguments]",h="[object Array]",p="[object Object]",x=Object.prototype.hasOwnProperty;t.exports=function(t,n,e,v,d,y){var m=u(t),g=u(n),b=m?h:s(t),M=g?h:s(n),w=(b=b==f?p:b)==p,D=(M=M==f?p:M)==p,j=b==M;if(j&&c(t)){if(!c(n))return!1;m=!0,w=!1}if(j&&!w)return y||(y=new r),m||l(t)?o(t,n,e,v,d,y):i(t,n,b,e,v,d,y);if(!(1&e)){var _=w&&x.call(t,"__wrapped__"),O=D&&x.call(n,"__wrapped__");if(_||O){var B=_?t.value():t,E=O?n.value():n;return y||(y=new r),d(B,E,e,v,y)}}return!!j&&(y||(y=new r),a(t,n,e,v,d,y))}},9548:function(t,n,e){var r=e(8708),o=e(9070);t.exports=function(t,n,e,i){var a=e.length,s=a,u=!i;if(null==t)return!s;for(t=Object(t);a--;){var c=e[a];if(u&&c[2]?c[1]!==t[c[0]]:!(c[0]in t))return!1}for(;++a<s;){var l=(c=e[a])[0],f=t[l],h=c[1];if(u&&c[2]){if(void 0===f&&!(l in t))return!1}else{var p=new r;if(i)var x=i(f,h,l,t,n,p);if(!(void 0===x?o(h,f,3,i,p):x))return!1}}return!0}},3472:function(t,n,e){var r=e(758),o=e(5223),i=e(5346),a=e(163),s=e(8532);t.exports=function(t){return"function"==typeof t?t:null==t?i:"object"==typeof t?a(t)?o(t[0],t[1]):r(t):s(t)}},758:function(t,n,e){var r=e(9548),o=e(597),i=e(6878);t.exports=function(t){var n=o(t);return 1==n.length&&n[0][2]?i(n[0][0],n[0][1]):function(e){return e===t||r(e,t,n)}}},5223:function(t,n,e){var r=e(9070),o=e(9201),i=e(5066),a=e(726),s=e(5385),u=e(6878),c=e(3110);t.exports=function(t,n){return a(t)&&s(n)?u(c(t),n):function(e){var a=o(e,t);return void 0===a&&a===n?i(e,t):r(n,a,3)}}},5436:function(t,n,e){var r=e(6371),o=e(5066);t.exports=function(t,n){return r(t,n,(function(n,e){return o(t,e)}))}},6371:function(t,n,e){var r=e(4432),o=e(6539),i=e(9026);t.exports=function(t,n,e){for(var a=-1,s=n.length,u={};++a<s;){var c=n[a],l=r(t,c);e(l,c)&&o(u,i(c,t),l)}return u}},1600:function(t){t.exports=function(t){return function(n){return null==n?void 0:n[t]}}},3301:function(t,n,e){var r=e(4432);t.exports=function(t){return function(n){return r(n,t)}}},6317:function(t,n,e){var r=e(5346),o=e(4280),i=e(201);t.exports=function(t,n){return i(o(t,n,r),t+"")}},6539:function(t,n,e){var r=e(4132),o=e(9026),i=e(9099),a=e(7709),s=e(3110);t.exports=function(t,n,e,u){if(!a(t))return t;for(var c=-1,l=(n=o(n,t)).length,f=l-1,h=t;null!=h&&++c<l;){var p=s(n[c]),x=e;if("__proto__"===p||"constructor"===p||"prototype"===p)return t;if(c!=f){var v=h[p];void 0===(x=u?u(v,p,h):void 0)&&(x=a(v)?v:i(n[c+1])?[]:{})}r(h,p,x),h=h[p]}return t}},6316:function(t,n,e){var r=e(2596),o=e(8644),i=e(163),a=e(1995),s=r?r.prototype:void 0,u=s?s.toString:void 0;t.exports=function t(n){if("string"==typeof n)return n;if(i(n))return o(n,t)+"";if(a(n))return u?u.call(n):"";var e=n+"";return"0"==e&&1/n==-1/0?"-0":e}},9914:function(t,n,e){var r=e(6123);t.exports=function(t,n){return!(null==t||!t.length)&&r(t,n,0)>-1}},9026:function(t,n,e){var r=e(163),o=e(726),i=e(7801),a=e(7010);t.exports=function(t,n){return r(t)?t:o(t,n)?[t]:i(a(t))}},4710:function(t){t.exports=function(t){return function(n,e,r){for(var o=-1,i=Object(n),a=r(n),s=a.length;s--;){var u=a[t?s:++o];if(!1===e(i[u],u,i))break}return n}}},5525:function(t,n,e){var r=e(3743),o=function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=o},8705:function(t,n,e){var r=e(3273),o=e(1634),i=e(9914);t.exports=function(t,n,e,a,s,u){var c=1&e,l=t.length,f=n.length;if(l!=f&&!(c&&f>l))return!1;var h=u.get(t),p=u.get(n);if(h&&p)return h==n&&p==t;var x=-1,v=!0,d=2&e?new r:void 0;for(u.set(t,n),u.set(n,t);++x<l;){var y=t[x],m=n[x];if(a)var g=c?a(m,y,x,n,t,u):a(y,m,x,t,n,u);if(void 0!==g){if(g)continue;v=!1;break}if(d){if(!o(n,(function(t,n){if(!i(d,n)&&(y===t||s(y,t,e,a,u)))return d.push(n)}))){v=!1;break}}else if(y!==m&&!s(y,m,e,a,u)){v=!1;break}}return u.delete(t),u.delete(n),v}},2813:function(t){t.exports=function(t,n){return t===n||t!=t&&n!=n}},6682:function(t,n,e){var r=e(8143),o=Object.prototype.hasOwnProperty;t.exports=function(t,n,e,i,a,s){var u=1&e,c=r(t),l=c.length;if(l!=r(n).length&&!u)return!1;for(var f=l;f--;){var h=c[f];if(!(u?h in n:o.call(n,h)))return!1}var p=s.get(t),x=s.get(n);if(p&&x)return p==n&&x==t;var v=!0;s.set(t,n),s.set(n,t);for(var d=u;++f<l;){var y=t[h=c[f]],m=n[h];if(i)var g=u?i(m,y,h,n,t,s):i(y,m,h,t,n,s);if(!(void 0===g?y===m||a(y,m,e,i,s):g)){v=!1;break}d||(d="constructor"==h)}if(v&&!d){var b=t.constructor,M=n.constructor;b==M||!("constructor"in t)||!("constructor"in n)||"function"==typeof b&&b instanceof b&&"function"==typeof M&&M instanceof M||(v=!1)}return s.delete(t),s.delete(n),v}},5557:function(t,n,e){var r=e(2645),o=e(4280),i=e(201);t.exports=function(t){return i(o(t,void 0,r),t+"")}},2117:function(t,n,e){var r="object"==typeof e.g&&e.g&&e.g.Object===Object&&e.g;t.exports=r},8143:function(t,n,e){var r=e(5125)(Object.keys,Object);t.exports=r},597:function(t,n,e){var r=e(5385),o=e(7747);t.exports=function(t){for(var n=o(t),e=n.length;e--;){var i=n[e],a=t[i];n[e]=[i,a,r(a)]}return n}},3743:function(t){t.exports=function(t,n){return null==t?void 0:t[n]}},9667:function(t){var n=Object.prototype.toString;t.exports=function(t){return n.call(t)}},3096:function(t,n,e){var r=e(9026),o=e(5075),i=e(163),a=e(9099),s=e(8454),u=e(3110);t.exports=function(t,n,e){for(var c=-1,l=(n=r(n,t)).length,f=!1;++c<l;){var h=u(n[c]);if(!(f=null!=t&&e(t,h)))break;t=t[h]}return f||++c!=l?f:!!(l=null==t?0:t.length)&&s(l)&&a(h,l)&&(i(t)||o(t))}},3608:function(t,n,e){var r=e(2596),o=e(5075),i=e(163),a=r?r.isConcatSpreadable:void 0;t.exports=function(t){return i(t)||o(t)||!!(a&&t&&t[a])}},9099:function(t){var n=/^(?:0|[1-9]\d*)$/;t.exports=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&n.test(t))&&t>-1&&t%1==0&&t<e}},8286:function(t){t.exports=function(){return!1}},726:function(t,n,e){var r=e(163),o=e(1995),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;t.exports=function(t,n){if(r(t))return!1;var e=typeof t;return!("number"!=e&&"symbol"!=e&&"boolean"!=e&&null!=t&&!o(t))||a.test(t)||!i.test(t)||null!=n&&t in Object(n)}},5385:function(t,n,e){var r=e(7709);t.exports=function(t){return t==t&&!r(t)}},1171:function(t){t.exports=function(){this.__data__=[],this.size=0}},7838:function(t,n,e){var r=e(3162),o=Array.prototype.splice;t.exports=function(t){var n=this.__data__,e=r(n,t);return!(e<0||(e==n.length-1?n.pop():o.call(n,e,1),--this.size,0))}},4859:function(t,n,e){var r=e(3162);t.exports=function(t){var n=this.__data__,e=r(n,t);return e<0?void 0:n[e][1]}},4073:function(t,n,e){var r=e(3162);t.exports=function(t){return r(this.__data__,t)>-1}},8541:function(t,n,e){var r=e(3162);t.exports=function(t,n){var e=this.__data__,o=r(e,t);return o<0?(++this.size,e.push([t,n])):e[o][1]=n,this}},6878:function(t){t.exports=function(t,n){return function(e){return null!=e&&e[t]===n&&(void 0!==n||t in Object(e))}}},2453:function(t){t.exports=function(t){return t}},5125:function(t){t.exports=function(t,n){return function(e){return t(n(e))}}},4280:function(t,n,e){var r=e(6082),o=Math.max;t.exports=function(t,n,e){return n=o(void 0===n?t.length-1:n,0),function(){for(var i=arguments,a=-1,s=o(i.length-n,0),u=Array(s);++a<s;)u[a]=i[n+a];a=-1;for(var c=Array(n+1);++a<n;)c[a]=i[a];return c[n]=e(u),r(t,this,c)}}},2373:function(t,n,e){var r=e(2117),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();t.exports=i},201:function(t){t.exports=function(t){return t}},7801:function(t,n,e){var r=e(2453),o=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g,a=r((function(t){var n=[];return 46===t.charCodeAt(0)&&n.push(""),t.replace(o,(function(t,e,r,o){n.push(r?o.replace(i,"$1"):e||t)})),n}));t.exports=a},3110:function(t){t.exports=function(t){return t}},5034:function(t,n,e){var r=e(7709),o=e(6987),i=e(5812),a=Math.max,s=Math.min;t.exports=function(t,n,e){var u,c,l,f,h,p,x=0,v=!1,d=!1,y=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function m(n){var e=u,r=c;return u=c=void 0,x=n,f=t.apply(r,e)}function g(t){return x=t,h=setTimeout(M,n),v?m(t):f}function b(t){var e=t-p;return void 0===p||e>=n||e<0||d&&t-x>=l}function M(){var t=o();if(b(t))return w(t);h=setTimeout(M,function(t){var e=n-(t-p);return d?s(e,l-(t-x)):e}(t))}function w(t){return h=void 0,y&&u?m(t):(u=c=void 0,f)}function D(){var t=o(),e=b(t);if(u=arguments,c=this,p=t,e){if(void 0===h)return g(p);if(d)return clearTimeout(h),h=setTimeout(M,n),m(p)}return void 0===h&&(h=setTimeout(M,n)),f}return n=i(n)||0,r(e)&&(v=!!e.leading,l=(d="maxWait"in e)?a(i(e.maxWait)||0,n):l,y="trailing"in e?!!e.trailing:y),D.cancel=function(){void 0!==h&&clearTimeout(h),x=0,u=p=c=h=void 0},D.flush=function(){return void 0===h?f:w(o())},D}},1893:function(t,n,e){var r=e(6317),o=e(788),i=e(8286),a=e(8855),s=Object.prototype,u=s.hasOwnProperty,c=r((function(t,n){t=Object(t);var e=-1,r=n.length,c=r>2?n[2]:void 0;for(c&&i(n[0],n[1],c)&&(r=1);++e<r;)for(var l=n[e],f=a(l),h=-1,p=f.length;++h<p;){var x=f[h],v=t[x];(void 0===v||o(v,s[x])&&!u.call(t,x))&&(t[x]=l[x])}return t}));t.exports=c},788:function(t){t.exports=function(t,n){return t===n||t!=t&&n!=n}},2645:function(t,n,e){var r=e(6457);t.exports=function(t){return null!=t&&t.length?r(t,1):[]}},9201:function(t,n,e){var r=e(4432);t.exports=function(t,n,e){var o=null==t?void 0:r(t,n);return void 0===o?e:o}},5066:function(t,n,e){var r=e(6776),o=e(3096);t.exports=function(t,n){return null!=t&&o(t,n,r)}},5346:function(t){t.exports=function(t){return t}},5075:function(t){t.exports=function(){return!1}},163:function(t){var n=Array.isArray;t.exports=n},4801:function(t){t.exports=function(){return!1}},8454:function(t){t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},7709:function(t){t.exports=function(t){var n=typeof t;return null!=t&&("object"==n||"function"==n)}},3474:function(t){t.exports=function(t){return null!=t&&"object"==typeof t}},1995:function(t){t.exports=function(){return!1}},4289:function(t){t.exports=function(){return!1}},7747:function(t,n,e){var r=e(5125)(Object.keys,Object);t.exports=r},8855:function(t){t.exports=function(t){var n=[];if(null!=t)for(var e in Object(t))n.push(e);return n}},4943:function(t,n,e){var r=e(8347),o=e(2446),i=e(3472);t.exports=function(t,n){var e={};return n=i(n,3),o(t,(function(t,o,i){r(e,o,n(t,o,i))})),e}},6987:function(t,n,e){var r=e(2373);t.exports=function(){return r.Date.now()}},9082:function(t,n,e){var r=e(5436),o=e(5557)((function(t,n){return null==t?{}:r(t,n)}));t.exports=o},8532:function(t,n,e){var r=e(1600),o=e(3301),i=e(726),a=e(3110);t.exports=function(t){return i(t)?r(a(t)):o(t)}},8163:function(t,n,e){var r=e(5034),o=e(7709);t.exports=function(t,n,e){var i=!0,a=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return o(e)&&(i="leading"in e?!!e.leading:i,a="trailing"in e?!!e.trailing:a),r(t,n,{leading:i,maxWait:n,trailing:a})}},5812:function(t){t.exports=function(t){return t}},7010:function(t,n,e){var r=e(6316);t.exports=function(t){return null==t?"":r(t)}},660:function(t,n,e){var r=e(7010),o=0;t.exports=function(t){var n=++o;return r(t)+n}},7491:function(t){var n="undefined"!=typeof Element,e="function"==typeof Map,r="function"==typeof Set,o="function"==typeof ArrayBuffer&&!!ArrayBuffer.isView;function i(t,a){if(t===a)return!0;if(t&&a&&"object"==typeof t&&"object"==typeof a){if(t.constructor!==a.constructor)return!1;var s,u,c,l;if(Array.isArray(t)){if((s=t.length)!=a.length)return!1;for(u=s;0!=u--;)if(!i(t[u],a[u]))return!1;return!0}if(e&&t instanceof Map&&a instanceof Map){if(t.size!==a.size)return!1;for(l=t.entries();!(u=l.next()).done;)if(!a.has(u.value[0]))return!1;for(l=t.entries();!(u=l.next()).done;)if(!i(u.value[1],a.get(u.value[0])))return!1;return!0}if(r&&t instanceof Set&&a instanceof Set){if(t.size!==a.size)return!1;for(l=t.entries();!(u=l.next()).done;)if(!a.has(u.value[0]))return!1;return!0}if(o&&ArrayBuffer.isView(t)&&ArrayBuffer.isView(a)){if((s=t.length)!=a.length)return!1;for(u=s;0!=u--;)if(t[u]!==a[u])return!1;return!0}if(t.constructor===RegExp)return t.source===a.source&&t.flags===a.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===a.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===a.toString();if((s=(c=Object.keys(t)).length)!==Object.keys(a).length)return!1;for(u=s;0!=u--;)if(!Object.prototype.hasOwnProperty.call(a,c[u]))return!1;if(n&&t instanceof Element)return!1;for(u=s;0!=u--;)if(("_owner"!==c[u]&&"__v"!==c[u]&&"__o"!==c[u]||!t.$$typeof)&&!i(t[c[u]],a[c[u]]))return!1;return!0}return t!=t&&a!=a}t.exports=function(t,n){try{return i(t,n)}catch(t){if((t.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw t}}},9787:function(n){"use strict";n.exports=t}},e={};function r(t){var o=e[t];if(void 0!==o)return o.exports;var i=e[t]={exports:{}};return n[t](i,i.exports,r),i.exports}r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,{a:n}),n},r.d=function(t,n){for(var e in n)r.o(n,e)&&!r.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:n[e]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};return function(){"use strict";r.r(o),r.d(o,{BrushHelpers:function(){return it},VictoryBrushContainer:function(){return st},brushContainerMixin:function(){return at}});var t=r(1893),n=r.n(t),e=r(9787),i=r.n(e),a=r(7709),s=r.n(a),u=r(660),c=r.n(u),l=r(7747),f=r.n(l);class h extends i().Component{static displayName="Portal";constructor(t){super(t),this.map={},this.index=1}portalRegister=()=>++this.index;portalUpdate=(t,n)=>{this.map[t]=n,this.forceUpdate()};portalDeregister=t=>{delete this.map[t],this.forceUpdate()};getChildren(){return f()(this.map).map((t=>{const n=this.map[t];return n?i().cloneElement(n,{key:t}):n}))}render(){return i().createElement("svg",this.props,this.getChildren())}}const p=i().createContext({});p.displayName="PortalContext";var x,v,d=0,y=0,m=0,g=0,b=0,M=0,w="object"==typeof performance&&performance.now?performance:Date,D="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function j(){return b||(D(_),b=w.now()+M)}function _(){b=0}function O(){this._call=this._time=this._next=null}function B(t,n,e){var r=new O;return r.restart(t,n,e),r}function E(){b=(g=w.now())+M,d=y=0;try{!function(){j(),++d;for(var t,n=x;n;)(t=b-n._time)>=0&&n._call.call(void 0,t),n=n._next;--d}()}finally{d=0,function(){for(var t,n,e=x,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:x=n);v=t,A(r)}(),b=0}}function S(){var t=w.now(),n=t-g;n>1e3&&(M-=n,g=t)}function A(t){d||(y&&(y=clearTimeout(y)),t-b>24?(t<1/0&&(y=setTimeout(E,t-w.now()-M)),m&&(m=clearInterval(m))):(m||(g=w.now(),m=setInterval(S,1e3)),d=1,D(E)))}O.prototype=B.prototype={constructor:O,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?j():+e)+(null==n?0:+n),this._next||v===this||(v?v._next=this:x=this,v=this),this._call=t,this._time=e,A()},stop:function(){this._call&&(this._call=null,this._time=1/0,A())}};class P{constructor(){this.shouldAnimate=!0,this.subscribers=[],this.timer=null,this.activeSubscriptions=0}bypassAnimation(){this.shouldAnimate=!1}resumeAnimation(){this.shouldAnimate=!0}loop=()=>{this.subscribers.forEach((t=>{t.callback(j()-t.startTime,t.duration)}))};start(){this.timer||(this.timer=B(this.loop))}stop(){this.timer&&(this.timer.stop(),this.timer=null)}subscribe(t,n){const e=this.subscribers.push({startTime:j(),callback:t,duration:this.shouldAnimate?n:0});return this.activeSubscriptions++,this.start(),e}unsubscribe(t){null!==t&&this.subscribers[t-1]&&(delete this.subscribers[t-1],this.activeSubscriptions--),0===this.activeSubscriptions&&this.stop()}}const R=i().createContext({transitionTimer:new P,animationTimer:new P});R.displayName="TimerContext";var C=R;function T(t,n){return z(t)?t(n):t}function z(t){return"function"==typeof t}r(9082),r(8532);const G={startsWith:["data-","aria-"],exactMatch:[]},I=t=>{const n={...t};return Object.fromEntries(Object.entries(n).filter((t=>{let[n]=t;return(t=>!(!(t=>{let n=!1;return G.startsWith.forEach((e=>{new RegExp(`\\b(${e})(\\w|-)+`,"g").test(t)&&(n=!0)})),n})(t)&&!(t=>G.exactMatch.includes(t))(t)))(n)})).map((n=>{let[e,r]=n;return[e,T(r,t)]})))};function k(){return k=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},k.apply(this,arguments)}class N extends i().Component{static displayName="VictoryContainer";static role="container";static defaultProps={className:"VictoryContainer",portalComponent:i().createElement(h,null),portalZIndex:99,responsive:!0,role:"img"};static contextType=C;constructor(t){super(t),this.containerId=s()(t)&&void 0!==t.containerId?t.containerId:c()("victory-container-"),this.shouldHandleWheel=!!(t&&t.events&&t.events.onWheel)}savePortalRef=t=>(this.portalRef=t,t);portalUpdate=(t,n)=>this.portalRef.portalUpdate(t,n);portalRegister=()=>this.portalRef.portalRegister();portalDeregister=t=>this.portalRef.portalDeregister(t);saveContainerRef=t=>(z(this.props.containerRef)&&this.props.containerRef(t),this.containerRef=t,t);handleWheel=t=>t.preventDefault();componentDidMount(){this.shouldHandleWheel&&this.containerRef&&this.containerRef.addEventListener("wheel",this.handleWheel)}componentWillUnmount(){this.shouldHandleWheel&&this.containerRef&&this.containerRef.removeEventListener("wheel",this.handleWheel)}getIdForElement(t){return`${this.containerId}-${t}`}getChildren(t){return t.children}getOUIAProps(t){const{ouiaId:n,ouiaSafe:e,ouiaType:r}=t;return{...n&&{"data-ouia-component-id":n},...r&&{"data-ouia-component-type":r},...void 0!==e&&{"data-ouia-safe":e}}}renderContainer(t,e,r){const{title:o,desc:a,portalComponent:s,className:u,width:c,height:l,portalZIndex:f,responsive:h}=t,x=this.getChildren(t),v=h?{width:"100%",height:"100%"}:{width:c,height:l},d=Object.assign({pointerEvents:"none",touchAction:"none",position:"relative"},v),y=Object.assign({zIndex:f,position:"absolute",top:0,left:0},v),m=Object.assign({pointerEvents:"all"},v),g=Object.assign({overflow:"visible"},v),b={width:c,height:l,viewBox:e.viewBox,preserveAspectRatio:e.preserveAspectRatio,style:g};return i().createElement(p.Provider,{value:{portalUpdate:this.portalUpdate,portalRegister:this.portalRegister,portalDeregister:this.portalDeregister}},i().createElement("div",k({style:n()({},r,d),className:u,ref:this.saveContainerRef},this.getOUIAProps(t)),i().createElement("svg",k({},e,{style:m}),o?i().createElement("title",{id:this.getIdForElement("title")},o):null,a?i().createElement("desc",{id:this.getIdForElement("desc")},a):null,x),i().createElement("div",{style:y},i().cloneElement(s,{...b,ref:this.savePortalRef}))))}render(){const{width:t,height:n,responsive:e,events:r,title:o,desc:i,tabIndex:a,preserveAspectRatio:s,role:u}=this.props,c=e?this.props.style:function(t,n){void 0===n&&(n=[]);const e={};for(const r in t)n.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}(this.props.style,["height","width"]),l=I(this.props),f=Object.assign({width:t,height:n,tabIndex:a,role:u,"aria-labelledby":[o&&this.getIdForElement("title"),this.props["aria-labelledby"]].filter(Boolean).join(" ")||void 0,"aria-describedby":[i&&this.getIdForElement("desc"),this.props["aria-describedby"]].filter(Boolean).join(" ")||void 0,viewBox:e?`0 0 ${t} ${n}`:void 0,preserveAspectRatio:e?s:void 0,...l},r);return this.renderContainer(this.props,f,c)}}function U(){return U=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},U.apply(this,arguments)}const V=(0,e.forwardRef)(((t,n)=>{const{desc:e,id:r,tabIndex:o,origin:a,...s}=t,u={vectorEffect:"non-scaling-stroke",id:T(r,t)?.toString(),tabIndex:T(o,t),...s};return e?i().createElement("rect",U({},u,{ref:n}),i().createElement("desc",null,e)):i().createElement("rect",U({},u,{ref:n}))}));function W(t){return Array.isArray(t)&&t.some((t=>t instanceof Date))}function $(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];const o=t.concat(e);return W(o)?new Date(Math.max(...o)):Math.max(...o)}function H(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];const o=t.concat(e);return W(o)?new Date(Math.min(...o)):Math.min(...o)}function F(t,n,e){const{a:r,d:o,e:i,f:a}=n;return"y"===e?o*t+a:r*t+i}function X(t){return!(!t||void 0===t.identifier)}function Y(t){if(X(t.nativeEvent))return;const n=t=>"svg"===t.nodeName?t:t.parentNode?n(t.parentNode):t;return n(t.target)}function q(t,n){if(X(t.nativeEvent))return{x:t.nativeEvent.locationX,y:t.nativeEvent.locationY};const e=function(t){return t.changedTouches&&t.changedTouches.length>0}(t)?t.changedTouches[0]:t,r=function(t){return t.getScreenCTM().inverse()}(n||Y(e));return{x:F(e.clientX,r,"x"),y:F(e.clientY,r,"y")}}function L(t,n){const{horizontal:e}=t,r=t.scale,o=n||{x:r.x.domain(),y:r.y.domain()};return{x:e?[r.y(o.y[0]),r.y(o.y[1])]:[r.x(o.x[0]),r.x(o.x[1])],y:e?[r.x(o.x[0]),r.x(o.x[1])]:[r.y(o.y[0]),r.y(o.y[1])]}}function Z(t,n,e,r){const{polar:o,horizontal:i}=t;if(!o)return{x:i?n.x.invert(r):n.x.invert(e),y:i?n.y.invert(e):n.y.invert(r)};const a=t.origin||{x:0,y:0},s=e-a.x,u=r-a.y,c=Math.abs(s*Math.sqrt(1+Math.pow(-u/s,2))),l=(-Math.atan2(u,s)+2*Math.PI)%(2*Math.PI);return{x:n.x.invert(l),y:n.y.invert(c)}}function J(t){const{x1:n,x2:e,y1:r,y2:o,scale:i}=t,a=Z(t,i,n,r),s=Z(t,i,e,o),u=(t,n)=>[H([t,n]),$([t,n])];return{x:u(a.x,s.x),y:u(a.y,s.y)}}var K=r(4943),Q=r.n(K),tt=r(8163),nt=r.n(tt),et=r(7491),rt=r.n(et);const ot={getDimension(t){const{horizontal:n,brushDimension:e}=t;return n&&e?"x"===e?"y":"x":e},withinBounds(t,n,e){const{x1:r,x2:o,y1:i,y2:a}=Q()(n,Number),{x:s,y:u}=Q()(t,Number),c=e?e/2:0;return s+c>=Math.min(r,o)&&s-c<=Math.max(r,o)&&u+c>=Math.min(i,a)&&u-c<=Math.max(i,a)},getDomainBox(t,e,r){const o=this.getDimension(t),i=n()({},e,t.domain),a=n()({},r,i),s=L(t,i),u=L(t,a);return{x1:"y"!==o?Math.min(...u.x):Math.min(...s.x),x2:"y"!==o?Math.max(...u.x):Math.max(...s.x),y1:"x"!==o?Math.min(...u.y):Math.min(...s.y),y2:"x"!==o?Math.max(...u.y):Math.max(...s.y)}},getHandles(t,n){const e=this.getDimension(t),{x1:r,x2:o,y1:i,y2:a}=n,s=Math.min(r,o),u=Math.max(r,o),c=Math.min(i,a),l=Math.max(i,a),f=t.handleWidth/2;return{left:"y"!==e&&{x1:s-f,x2:s+f,y1:i,y2:a},right:"y"!==e&&{x1:u-f,x2:u+f,y1:i,y2:a},top:"x"!==e&&{x1:r,x2:o,y1:c-f,y2:c+f},bottom:"x"!==e&&{x1:r,x2:o,y1:l-f,y2:l+f}}},getActiveHandles(t,n,e){const r=this.getHandles(n,e),o=["top","bottom","left","right"].reduce(((n,e)=>r[e]&&this.withinBounds(t,r[e])?n.concat(e):n),[]);return o.length&&o},getResizeMutation(t,n){const{x1:e,y1:r,x2:o,y2:i}=t,a={left:{x1:Math.max(e,o),x2:Math.min(e,o),y1:r,y2:i},right:{x1:Math.min(e,o),x2:Math.max(e,o),y1:r,y2:i},top:{y1:Math.max(r,i),y2:Math.min(r,i),x1:e,x2:o},bottom:{y1:Math.min(r,i),y2:Math.max(r,i),x1:e,x2:o}};return n.reduce(((t,n)=>Object.assign(t,a[n])),{})},getMinimumDomain:()=>({x:[0,1/Number.MAX_SAFE_INTEGER],y:[0,1/Number.MAX_SAFE_INTEGER]}),getDefaultBrushArea(t,n,e){const{domain:r,fullDomain:o,scale:i,horizontal:a,allowResize:s}=t,u=s||t.defaultBrushArea?t.defaultBrushArea:"move";if("none"===u)return this.getMinimumDomain();if("disable"===u)return n;if("move"===u){const r=this.getDomainBox(t,o,n),s=t.parentSVG||Y(e),u=this.panBox({...t,...r,brushDomain:n,startX:(r.x1+r.x2)/2,startY:(r.y1+r.y2)/2},q(e,s)),c=t.fullDomainBox||this.getDomainBox(t,o);return J({...this.constrainBox(u,c),scale:i,horizontal:a})}return r},getSelectionMutation(t,n,e){const{x:r,y:o}=t,{x1:i,x2:a,y1:s,y2:u}=n;return{x1:"y"!==e?r:i,y1:"x"!==e?o:s,x2:"y"!==e?r:a,y2:"x"!==e?o:u}},panBox(t,e){const{domain:r,startX:o,startY:i}=t,a=this.getDimension(t),s=n()({},t.brushDomain,r),u=n()({},t.fullDomain,r),{x1:c,x2:l,y1:f,y2:h}=t.x1?t:this.getDomainBox(t,u,s),{x:p,y:x}=e,v=o?o-p:0,d=i?i-x:0;return{x1:"y"!==a?Math.min(c,l)-v:Math.min(c,l),x2:"y"!==a?Math.max(c,l)-v:Math.max(c,l),y1:"x"!==a?Math.min(f,h)-d:Math.min(f,h),y2:"x"!==a?Math.max(f,h)-d:Math.max(f,h)}},constrainBox(t,n){const{x1:e,y1:r,x2:o,y2:i}=Q()(n,Number);return{x1:t.x2>o?o-Math.abs(t.x2-t.x1):Math.max(t.x1,e),y1:t.y2>i?i-Math.abs(t.y2-t.y1):Math.max(t.y1,r),x2:t.x1<e?e+Math.abs(t.x2-t.x1):Math.min(t.x2,o),y2:t.y1<r?r+Math.abs(t.y2-t.y1):Math.min(t.y2,i)}},constrainPoint(t,n){const{x1:e,y1:r,x2:o,y2:i}=Q()(n,Number);return{x:Math.min(Math.max(t.x,e),o),y:Math.min(Math.max(t.y,r),i)}},hasMoved(t){const{x1:n,x2:e,y1:r,y2:o,mouseMoveThreshold:i}=t,a=this.getDimension(t),s=Math.abs(n-e)>=i,u=Math.abs(r-o)>=i;switch(a){case"x":return s;case"y":return u;default:return s||u}},onMouseDown(t,e){t.preventDefault();const{handleWidth:r,cachedBrushDomain:o,domain:i,allowResize:a,allowDrag:s,allowDraw:u}=e,c=this.getDimension(e),l=a||e.defaultBrushArea?e.defaultBrushArea:"move";if(!a&&!s)return{};const f=e.fullDomainBox||this.getDomainBox(e,i),h=e.parentSVG||Y(t),{x:p,y:x}=q(t,h);if(!this.withinBounds({x:p,y:x},f,r))return{};const v=n()({},e.brushDomain,i),d=rt()(v,o)?e.currentDomain||v||i:v||i,y=this.getDomainBox(e,i,d),m=a&&this.getActiveHandles({x:p,y:x},e,y);return m?[{target:"parent",mutation:()=>({isSelecting:!0,domainBox:y,fullDomainBox:f,cachedBrushDomain:v,currentDomain:d,parentSVG:h,...this.getResizeMutation(y,m)})}]:this.withinBounds({x:p,y:x},y)&&!rt()(i,d)?[{target:"parent",mutation:()=>({isPanning:s,startX:p,startY:x,domainBox:y,fullDomainBox:f,currentDomain:d,cachedBrushDomain:v,parentSVG:h,...y})}]:u?[{target:"parent",mutation:()=>({isSelecting:a||"move"===l,domainBox:y,fullDomainBox:f,parentSVG:h,cachedBrushDomain:v,cachedCurrentDomain:d,currentDomain:this.getMinimumDomain(),...this.getSelectionMutation({x:p,y:x},y,c)})}]:{}},onGlobalMouseMove(t,e){const{scale:r,isPanning:o,isSelecting:i,fullDomainBox:a,onBrushDomainChange:s,allowResize:u,allowDrag:c,horizontal:l,mouseMoveThreshold:f,parentSVG:h}=e,p=this.getDimension(e),{x:x,y:v}=q(t,h);if(!u&&!c||f>0&&!this.hasMoved({...e,x2:x,y2:v}))return{};if(c&&o){const{startX:t,startY:o}=e,i=this.panBox(e,{x:x,y:v}),u=this.constrainBox(i,a),c=J({...u,scale:r,horizontal:l}),f={currentDomain:c,parentSVG:h,startX:i.x2>=a.x2||i.x1<=a.x1?t:x,startY:i.y2>=a.y2||i.y1<=a.y1?o:v,...u};return z(s)&&s(c,n()({},f,e)),[{target:"parent",mutation:()=>f}]}if(u&&i){const{x:t,y:o}=this.constrainPoint({x:"y"!==p?x:e.x2,y:"x"!==p?v:e.y2},a),i=J({x2:t,y2:o,x1:e.x1,y1:e.y1,scale:r,horizontal:l}),u={x2:t,y2:o,currentDomain:i,parentSVG:h};return z(s)&&s(i,n()({},u,e)),[{target:"parent",mutation:()=>u}]}return{}},onGlobalMouseUp(t,e){if(!e.isPanning&&!e.isSelecting)return{};const{x1:r,y1:o,x2:i,y2:a,isPanning:s,isSelecting:u,onBrushDomainChange:c,onBrushDomainChangeEnd:l,onBrushCleared:f,currentDomain:h,allowResize:p,allowDrag:x}=e,v=p||e.defaultBrushArea?e.defaultBrushArea:"move",d={isPanning:!1,isSelecting:!1};if(!p&&(void 0===v||"none"===v)||r!==i&&o!==a)(x&&s||p&&u)&&z(l)&&l(h,n()({},d,e));else{const r=e.cachedCurrentDomain||h,o=this.getDefaultBrushArea(e,r,t);d.currentDomain=o,z(c)&&c(o,n()({},d,e)),z(l)&&l(o,n()({},d,e)),z(f)&&f(o,n()({},d,e))}return[{target:"parent",mutation:()=>d}]}},it={...ot,onMouseDown:ot.onMouseDown.bind(ot),onGlobalMouseUp:ot.onGlobalMouseUp.bind(ot),onGlobalMouseMove:nt()(ot.onGlobalMouseMove.bind(ot),16,{leading:!0,trailing:!1})};function at(t){return class extends t{static displayName="VictoryBrushContainer";static defaultProps={...N.defaultProps,allowDrag:!0,allowDraw:!0,allowResize:!0,brushComponent:i().createElement(V,null),brushStyle:{stroke:"transparent",fill:"black",fillOpacity:.1},handleComponent:i().createElement(V,null),handleStyle:{stroke:"transparent",fill:"transparent"},handleWidth:8,mouseMoveThreshold:0};static defaultEvents=t=>[{target:"parent",eventHandlers:{onMouseDown:(n,e)=>t.disable?{}:it.onMouseDown(n,e),onTouchStart:(n,e)=>t.disable?{}:it.onMouseDown(n,e),onGlobalMouseMove:(n,e)=>t.disable||!e.isPanning&&!e.isSelecting?{}:it.onGlobalMouseMove(n,e),onGlobalTouchMove:(n,e)=>t.disable||!e.isPanning&&!e.isSelecting?{}:it.onGlobalMouseMove(n,e),onGlobalMouseUp:(n,e)=>t.disable?{}:it.onGlobalMouseUp(n,e),onGlobalTouchEnd:(n,e)=>t.disable?{}:it.onGlobalMouseUp(n,e),onGlobalTouchCancel:(n,e)=>t.disable?{}:it.onGlobalMouseUp(n,e)}}];getSelectBox(t,e){const{x:r,y:o}=e,{brushStyle:a,brushComponent:s,name:u}=t,c=s.props&&s.props.style,l=t.allowDrag||t.allowResize?"move":"auto";return r[0]!==r[1]&&o[0]!==o[1]?i().cloneElement(s,{key:`${u}-brush`,width:Math.abs(r[1]-r[0])||1,height:Math.abs(o[1]-o[0])||1,x:Math.min(r[0],r[1]),y:Math.min(o[0],o[1]),cursor:l,style:n()({},c,a)}):null}getCursorPointers(t){const n={yProps:"ns-resize",xProps:"ew-resize"};return!t.allowResize&&t.allowDrag?(n.xProps="move",n.yProps="move"):t.allowResize||t.allowDrag||(n.xProps="auto",n.yProps="auto"),n}getHandles(t,e){const{handleWidth:r,handleStyle:o,handleComponent:a,name:s}=t,u=it.getDomainBox(t,e),{x1:c,x2:l,y1:f,y2:h}=u,{top:p,bottom:x,left:v,right:d}=it.getHandles(t,u),y=Math.abs(l-c)||1,m=Math.abs(h-f)||1,g=a.props&&a.props.style||{},b=n()({},g,o),M=this.getCursorPointers(t),w={style:b,width:y,height:r,cursor:M.yProps},D={style:b,width:r,height:m,cursor:M.xProps},j={top:p&&Object.assign({x:p.x1,y:p.y1},w),bottom:x&&Object.assign({x:x.x1,y:x.y1},w),left:v&&Object.assign({y:v.y1,x:v.x1},D),right:d&&Object.assign({y:d.y1,x:d.x1},D)},_=["top","bottom","left","right"].reduce(((t,n)=>j[n]?t.concat(i().cloneElement(a,Object.assign({key:`${s}-handle-${n}`},j[n]))):t),[]);return _.length?_:null}getRect(t){const{currentDomain:e,cachedBrushDomain:r}=t,o=n()({},t.brushDomain,t.domain),i=rt()(o,r)?n()({},e,o):o,a=L(t,i),s=this.getSelectBox(t,a);return s?[s,this.getHandles(t,i)]:[]}getChildren(t){return[...i().Children.toArray(t.children),...this.getRect(t)]}}}const st=at(N)}(),o}()}));
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports.VictoryBrushContainer=e(require("react")):t.VictoryBrushContainer=e(t.React)}(self,(t=>(()=>{var e={2596:(t,e,r)=>{var n=r(2373).Symbol;t.exports=n},6082:t=>{t.exports=function(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}},8644:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}},9559:t=>{t.exports=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}},4132:(t,e,r)=>{var n=r(8347),o=r(788),a=Object.prototype.hasOwnProperty;t.exports=function(t,e,r){var i=t[e];a.call(t,e)&&o(i,r)&&(void 0!==r||e in t)||n(t,e,r)}},8347:(t,e,r)=>{var n=r(5525);t.exports=function(t,e,r){"__proto__"==e&&n?n(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}},6457:(t,e,r)=>{var n=r(9559),o=r(3608);t.exports=function t(e,r,a,i,u){var c=-1,l=e.length;for(a||(a=o),u||(u=[]);++c<l;){var s=e[c];r>0&&a(s)?r>1?t(s,r-1,a,i,u):n(u,s):i||(u[u.length]=s)}return u}},4432:(t,e,r)=>{var n=r(9026),o=r(3110);t.exports=function(t,e){for(var r=0,a=(e=n(e,t)).length;null!=t&&r<a;)t=t[o(e[r++])];return r&&r==a?t:void 0}},6776:t=>{t.exports=function(t,e){return null!=t&&e in Object(t)}},5436:(t,e,r)=>{var n=r(6371),o=r(5066);t.exports=function(t,e){return n(t,e,(function(e,r){return o(t,r)}))}},6371:(t,e,r)=>{var n=r(4432),o=r(6539),a=r(9026);t.exports=function(t,e,r){for(var i=-1,u=e.length,c={};++i<u;){var l=e[i],s=n(t,l);r(s,l)&&o(c,a(l,t),s)}return c}},1600:t=>{t.exports=function(t){return function(e){return null==e?void 0:e[t]}}},3301:(t,e,r)=>{var n=r(4432);t.exports=function(t){return function(e){return n(e,t)}}},6317:(t,e,r)=>{var n=r(5346),o=r(4280),a=r(201);t.exports=function(t,e){return a(o(t,e,n),t+"")}},6539:(t,e,r)=>{var n=r(4132),o=r(9026),a=r(9099),i=r(7709),u=r(3110);t.exports=function(t,e,r,c){if(!i(t))return t;for(var l=-1,s=(e=o(e,t)).length,f=s-1,y=t;null!=y&&++l<s;){var p=u(e[l]),h=r;if("__proto__"===p||"constructor"===p||"prototype"===p)return t;if(l!=f){var v=y[p];void 0===(h=c?c(v,p,y):void 0)&&(h=i(v)?v:a(e[l+1])?[]:{})}n(y,p,h),y=y[p]}return t}},6316:(t,e,r)=>{var n=r(2596),o=r(8644),a=r(163),i=r(1995),u=n?n.prototype:void 0,c=u?u.toString:void 0;t.exports=function t(e){if("string"==typeof e)return e;if(a(e))return o(e,t)+"";if(i(e))return c?c.call(e):"";var r=e+"";return"0"==r&&1/e==-1/0?"-0":r}},9026:(t,e,r)=>{var n=r(163),o=r(726),a=r(7801),i=r(7010);t.exports=function(t,e){return n(t)?t:o(t,e)?[t]:a(i(t))}},5525:(t,e,r)=>{var n=r(3743),o=function(){try{var t=n(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=o},5557:(t,e,r)=>{var n=r(2645),o=r(4280),a=r(201);t.exports=function(t){return a(o(t,void 0,n),t+"")}},2117:(t,e,r)=>{var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;t.exports=n},3743:t=>{t.exports=function(t,e){return null==t?void 0:t[e]}},3096:(t,e,r)=>{var n=r(9026),o=r(5075),a=r(163),i=r(9099),u=r(8454),c=r(3110);t.exports=function(t,e,r){for(var l=-1,s=(e=n(e,t)).length,f=!1;++l<s;){var y=c(e[l]);if(!(f=null!=t&&r(t,y)))break;t=t[y]}return f||++l!=s?f:!!(s=null==t?0:t.length)&&u(s)&&i(y,s)&&(a(t)||o(t))}},3608:(t,e,r)=>{var n=r(2596),o=r(5075),a=r(163),i=n?n.isConcatSpreadable:void 0;t.exports=function(t){return a(t)||o(t)||!!(i&&t&&t[i])}},9099:t=>{var e=/^(?:0|[1-9]\d*)$/;t.exports=function(t,r){var n=typeof t;return!!(r=null==r?9007199254740991:r)&&("number"==n||"symbol"!=n&&e.test(t))&&t>-1&&t%1==0&&t<r}},8286:t=>{t.exports=function(){return!1}},726:(t,e,r)=>{var n=r(163),o=r(1995),a=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,i=/^\w*$/;t.exports=function(t,e){if(n(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!o(t))||i.test(t)||!a.test(t)||null!=e&&t in Object(e)}},2453:t=>{t.exports=function(t){return t}},4280:(t,e,r)=>{var n=r(6082),o=Math.max;t.exports=function(t,e,r){return e=o(void 0===e?t.length-1:e,0),function(){for(var a=arguments,i=-1,u=o(a.length-e,0),c=Array(u);++i<u;)c[i]=a[e+i];i=-1;for(var l=Array(e+1);++i<e;)l[i]=a[i];return l[e]=r(c),n(t,this,l)}}},2373:(t,e,r)=>{var n=r(2117),o="object"==typeof self&&self&&self.Object===Object&&self,a=n||o||Function("return this")();t.exports=a},201:t=>{t.exports=function(t){return t}},7801:(t,e,r)=>{var n=r(2453),o=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,a=/\\(\\)?/g,i=n((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(o,(function(t,r,n,o){e.push(n?o.replace(a,"$1"):r||t)})),e}));t.exports=i},3110:(t,e,r)=>{var n=r(1995);t.exports=function(t){if("string"==typeof t||n(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}},5034:(t,e,r)=>{var n=r(7709),o=r(6987),a=r(5812),i=Math.max,u=Math.min;t.exports=function(t,e,r){var c,l,s,f,y,p,h=0,v=!1,m=!1,b=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function d(e){var r=c,n=l;return c=l=void 0,h=e,f=t.apply(n,r)}function x(t){return h=t,y=setTimeout(O,e),v?d(t):f}function g(t){var r=t-p;return void 0===p||r>=e||r<0||m&&t-h>=s}function O(){var t=o();if(g(t))return w(t);y=setTimeout(O,function(t){var r=e-(t-p);return m?u(r,s-(t-h)):r}(t))}function w(t){return y=void 0,b&&c?d(t):(c=l=void 0,f)}function M(){var t=o(),r=g(t);if(c=arguments,l=this,p=t,r){if(void 0===y)return x(p);if(m)return clearTimeout(y),y=setTimeout(O,e),d(p)}return void 0===y&&(y=setTimeout(O,e)),f}return e=a(e)||0,n(r)&&(v=!!r.leading,s=(m="maxWait"in r)?i(a(r.maxWait)||0,e):s,b="trailing"in r?!!r.trailing:b),M.cancel=function(){void 0!==y&&clearTimeout(y),h=0,c=p=l=y=void 0},M.flush=function(){return void 0===y?f:w(o())},M}},1893:(t,e,r)=>{var n=r(6317),o=r(788),a=r(8286),i=r(8855),u=Object.prototype,c=u.hasOwnProperty,l=n((function(t,e){t=Object(t);var r=-1,n=e.length,l=n>2?e[2]:void 0;for(l&&a(e[0],e[1],l)&&(n=1);++r<n;)for(var s=e[r],f=i(s),y=-1,p=f.length;++y<p;){var h=f[y],v=t[h];(void 0===v||o(v,u[h])&&!c.call(t,h))&&(t[h]=s[h])}return t}));t.exports=l},788:t=>{t.exports=function(t,e){return t===e||t!=t&&e!=e}},2645:(t,e,r)=>{var n=r(6457);t.exports=function(t){return null!=t&&t.length?n(t,1):[]}},5066:(t,e,r)=>{var n=r(6776),o=r(3096);t.exports=function(t,e){return null!=t&&o(t,e,n)}},5346:t=>{t.exports=function(t){return t}},5075:t=>{t.exports=function(){return!1}},163:t=>{var e=Array.isArray;t.exports=e},8454:t=>{t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},7709:t=>{t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},1995:t=>{t.exports=function(){return!1}},8855:t=>{t.exports=function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}},6987:(t,e,r)=>{var n=r(2373);t.exports=function(){return n.Date.now()}},9082:(t,e,r)=>{var n=r(5436),o=r(5557)((function(t,e){return null==t?{}:n(t,e)}));t.exports=o},8532:(t,e,r)=>{var n=r(1600),o=r(3301),a=r(726),i=r(3110);t.exports=function(t){return a(t)?n(i(t)):o(t)}},8163:(t,e,r)=>{var n=r(5034),o=r(7709);t.exports=function(t,e,r){var a=!0,i=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return o(r)&&(a="leading"in r?!!r.leading:a,i="trailing"in r?!!r.trailing:i),n(t,e,{leading:a,maxWait:e,trailing:i})}},5812:t=>{t.exports=function(t){return t}},7010:(t,e,r)=>{var n=r(6316);t.exports=function(t){return null==t?"":n(t)}},660:(t,e,r)=>{var n=r(7010),o=0;t.exports=function(t){var e=++o;return n(t)+e}},7491:t=>{var e="undefined"!=typeof Element,r="function"==typeof Map,n="function"==typeof Set,o="function"==typeof ArrayBuffer&&!!ArrayBuffer.isView;function a(t,i){if(t===i)return!0;if(t&&i&&"object"==typeof t&&"object"==typeof i){if(t.constructor!==i.constructor)return!1;var u,c,l,s;if(Array.isArray(t)){if((u=t.length)!=i.length)return!1;for(c=u;0!=c--;)if(!a(t[c],i[c]))return!1;return!0}if(r&&t instanceof Map&&i instanceof Map){if(t.size!==i.size)return!1;for(s=t.entries();!(c=s.next()).done;)if(!i.has(c.value[0]))return!1;for(s=t.entries();!(c=s.next()).done;)if(!a(c.value[1],i.get(c.value[0])))return!1;return!0}if(n&&t instanceof Set&&i instanceof Set){if(t.size!==i.size)return!1;for(s=t.entries();!(c=s.next()).done;)if(!i.has(c.value[0]))return!1;return!0}if(o&&ArrayBuffer.isView(t)&&ArrayBuffer.isView(i)){if((u=t.length)!=i.length)return!1;for(c=u;0!=c--;)if(t[c]!==i[c])return!1;return!0}if(t.constructor===RegExp)return t.source===i.source&&t.flags===i.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===i.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===i.toString();if((u=(l=Object.keys(t)).length)!==Object.keys(i).length)return!1;for(c=u;0!=c--;)if(!Object.prototype.hasOwnProperty.call(i,l[c]))return!1;if(e&&t instanceof Element)return!1;for(c=u;0!=c--;)if(("_owner"!==l[c]&&"__v"!==l[c]&&"__o"!==l[c]||!t.$$typeof)&&!a(t[l[c]],i[l[c]]))return!1;return!0}return t!=t&&i!=i}t.exports=function(t,e){try{return a(t,e)}catch(t){if((t.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw t}}},9787:e=>{"use strict";e.exports=t}},r={};function n(t){var o=r[t];if(void 0!==o)return o.exports;var a=r[t]={exports:{}};return e[t](a,a.exports,n),a.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};return(()=>{"use strict";n.r(o),n.d(o,{BrushHelpers:()=>tt,VICTORY_BRUSH_CONTAINER_DEFAULT_PROPS:()=>it,VictoryBrushContainer:()=>ct,useVictoryBrushContainer:()=>ut});var t=n(1893),e=n.n(t),r=n(9787),a=n.n(r);function i(t,e){return u(t)?t(e):t}function u(t){return"function"==typeof t}function c(t,e){if(t)return Object.keys(t).reduce((function(r,n){return r[n]=e(t[n]),r}),{})}n(9082),n(8532);var l=["desc","id","tabIndex","origin"];function s(){return s=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},s.apply(this,arguments)}function f(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function y(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var p=(0,r.forwardRef)((function(t,e){var r,n=t.desc,o=t.id,u=t.tabIndex,c=(t.origin,function(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r,n,o={},a=Object.keys(t);for(n=0;n<a.length;n++)r=a[n],e.indexOf(r)>=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(n=0;n<a.length;n++)r=a[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,l)),p=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?f(Object(r),!0).forEach((function(e){y(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({vectorEffect:"non-scaling-stroke",id:null===(r=i(o,t))||void 0===r?void 0:r.toString(),tabIndex:i(u,t)},c);return n?a().createElement("rect",s({},p,{ref:e}),a().createElement("desc",null,n)):a().createElement("rect",s({},p,{ref:e}))}));function h(t){return function(t){if(Array.isArray(t))return v(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return v(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?v(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function m(t){return Array.isArray(t)&&t.some((function(t){return t instanceof Date}))}function b(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];var o=t.concat(r);return m(o)?new Date(Math.max.apply(Math,h(o))):Math.max.apply(Math,h(o))}function d(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];var o=t.concat(r);return m(o)?new Date(Math.min.apply(Math,h(o))):Math.min.apply(Math,h(o))}function x(t,e,r){var n=e.a,o=e.d,a=e.e,i=e.f;return"y"===r?o*t+i:n*t+a}function g(t){return!(!t||void 0===t.identifier)}function O(t){if(!g(t.nativeEvent)){var e=function(t){return"svg"===t.nodeName?t:t.parentNode?e(t.parentNode):t};return e(t.target)}}function w(t,e){if(g(t.nativeEvent))return{x:t.nativeEvent.locationX,y:t.nativeEvent.locationY};var r=function(t){return t.changedTouches&&t.changedTouches.length>0}(t)?t.changedTouches[0]:t,n=function(t){return t.getScreenCTM().inverse()}(e||O(r));return{x:x(r.clientX,n,"x"),y:x(r.clientY,n,"y")}}function M(t,e){var r=t.horizontal,n=t.scale,o=e||{x:n.x.domain(),y:n.y.domain()};return{x:r?[n.y(o.y[0]),n.y(o.y[1])]:[n.x(o.x[0]),n.x(o.x[1])],y:r?[n.x(o.x[0]),n.x(o.x[1])]:[n.y(o.y[0]),n.y(o.y[1])]}}function j(t,e,r,n){var o=t.polar,a=t.horizontal;if(!o)return{x:a?e.x.invert(n):e.x.invert(r),y:a?e.y.invert(r):e.y.invert(n)};var i=t.origin||{x:0,y:0},u=r-i.x,c=n-i.y,l=Math.abs(u*Math.sqrt(1+Math.pow(-c/u,2))),s=(-Math.atan2(c,u)+2*Math.PI)%(2*Math.PI);return{x:e.x.invert(s),y:e.y.invert(l)}}function D(t){var e=t.x1,r=t.x2,n=t.y1,o=t.y2,a=t.scale,i=j(t,a,e,n),u=j(t,a,r,o),c=function(t,e){return[d([t,e]),b([t,e])]};return{x:c(i.x,u.x),y:c(i.y,u.y)}}var P=n(660),S=n.n(P);function A(){return A=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},A.apply(this,arguments)}var E=a().forwardRef((function(t,e){return a().createElement("svg",A({ref:e},t))})),B=a().createContext(void 0);function I(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a=[],i=!0,u=!1;try{for(r=r.call(t);!(i=(n=r.next()).done)&&(a.push(n.value),!e||a.length!==e);i=!0);}catch(t){u=!0,o=t}finally{try{i||null==r.return||r.return()}finally{if(u)throw o}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return T(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?T(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function T(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function C(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function R(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}B.displayName="PortalContext";var G={startsWith:["data-","aria-"],exactMatch:[]},z=function(t){var e=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?C(Object(r),!0).forEach((function(e){R(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):C(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},t);return Object.fromEntries(Object.entries(e).filter((function(t){return function(t){return!(!function(t){var e=!1;return G.startsWith.forEach((function(r){new RegExp("\\b(".concat(r,")(\\w|-)+"),"g").test(t)&&(e=!0)})),e}(t)&&!function(t){return G.exactMatch.includes(t)}(t))}(I(t,1)[0])})).map((function(e){var r=I(e,2);return[r[0],i(r[1],t)]})))};function _(){return _=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},_.apply(this,arguments)}function k(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function N(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function V(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?N(Object(r),!0).forEach((function(e){U(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):N(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function U(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var $={className:"VictoryContainer",portalComponent:a().createElement(E,null),portalZIndex:99,responsive:!0,role:"img"},W=function(t){var e,n=function(t){var e,n,o=V(V({},$),t),i=o.title,u=o.desc,c=o.width,l=o.height,s=o.responsive,f=(0,r.useRef)(null),y=(e=a().useState(),n=2,function(t){if(Array.isArray(t))return t}(e)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a=[],i=!0,u=!1;try{for(r=r.call(t);!(i=(n=r.next()).done)&&(a.push(n.value),!e||a.length!==e);i=!0);}catch(t){u=!0,o=t}finally{try{i||null==r.return||r.return()}finally{if(u)throw o}}return a}}(e,n)||function(t,e){if(t){if("string"==typeof t)return k(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?k(t,e):void 0}}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),p=y[0],h=y[1],v=(0,r.useRef)(S()("victory-container-")),m=o.containerId??v.current,b=function(t){return"".concat(m,"-").concat(t)},d=z(o),x=s?{width:"100%",height:"100%"}:{width:c,height:l},g=s?"0 0 ".concat(c," ").concat(l):void 0,O=s?o.preserveAspectRatio:void 0,w=[i&&b("title"),o["aria-labelledby"]].filter(Boolean).join(" ")||void 0,M=[u&&b("desc"),o["aria-describedby"]].filter(Boolean).join(" ")||void 0,j=b("title"),D=b("desc");return V(V({},o),{},{titleId:j,descId:D,dimensions:x,viewBox:g,preserveAspectRatio:O,ariaLabelledBy:w,ariaDescribedBy:M,userProps:d,portalRef:function(t){return h(t)},portalElement:p,localContainerRef:f})}(t),o=n.role,i=n.title,u=n.desc,c=n.children,l=n.className,s=n.portalZIndex,f=n.portalComponent,y=n.width,p=n.height,h=n.style,v=n.tabIndex,m=n.responsive,b=n.events,d=n.ouiaId,x=n.ouiaSafe,g=n.ouiaType,O=n.dimensions,w=n.ariaDescribedBy,M=n.ariaLabelledBy,j=n.viewBox,D=n.preserveAspectRatio,P=n.userProps,A=n.titleId,E=n.descId,I=n.portalElement,T=n.portalRef,C=n.containerRef,R=n.localContainerRef;return a().useEffect((function(){if(null!=b&&b.onWheel){var t=function(t){return t.preventDefault()},e=null==C?void 0:C.current;return null==e||e.addEventListener("wheel",t),function(){null==e||e.removeEventListener("wheel",t)}}}),[]),a().createElement(B.Provider,{value:{portalElement:I}},a().createElement("div",{className:l,style:V(V({},h),{},{width:m?null==h?void 0:h.width:O.width,height:m?null==h?void 0:h.height:O.height,pointerEvents:"none",touchAction:"none",position:"relative"}),"data-ouia-component-id":d,"data-ouia-component-type":g,"data-ouia-safe":x,ref:(e=[R,C],function(t){e.forEach((function(e){"function"==typeof e?e(t):null!=e&&(e.current=t)}))})},a().createElement("svg",_({width:y,height:p,tabIndex:v,role:o,"aria-labelledby":M,"aria-describedby":w,viewBox:j,preserveAspectRatio:D,style:V(V({},O),{},{pointerEvents:"all"})},P,b),i?a().createElement("title",{id:A},i):null,u?a().createElement("desc",{id:E},u):null,c),a().createElement("div",{style:V(V({},O),{},{zIndex:s,position:"absolute",top:0,left:0})},a().cloneElement(f,{width:y,height:p,viewBox:j,preserveAspectRatio:D,style:V(V({},O),{},{overflow:"visible"}),ref:T}))))};W.role="container";var X=n(8163),H=n.n(X),Y=n(7491),F=n.n(Y);function L(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function q(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?L(Object(r),!0).forEach((function(e){Z(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):L(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Z(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function J(t){return function(t){if(Array.isArray(t))return K(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return K(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?K(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function K(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var Q={getDimension:function(t){var e=t.horizontal,r=t.brushDimension;return e&&r?"x"===r?"y":"x":r},withinBounds:function(t,e,r){var n=c(e,Number),o=n.x1,a=n.x2,i=n.y1,u=n.y2,l=c(t,Number),s=l.x,f=l.y,y=r?r/2:0;return s+y>=Math.min(o,a)&&s-y<=Math.max(o,a)&&f+y>=Math.min(i,u)&&f-y<=Math.max(i,u)},getDomainBox:function(t,r,n){var o=this.getDimension(t),a=e()({},r,t.domain),i=e()({},n,a),u=M(t,a),c=M(t,i);return{x1:"y"!==o?Math.min.apply(Math,J(c.x)):Math.min.apply(Math,J(u.x)),x2:"y"!==o?Math.max.apply(Math,J(c.x)):Math.max.apply(Math,J(u.x)),y1:"x"!==o?Math.min.apply(Math,J(c.y)):Math.min.apply(Math,J(u.y)),y2:"x"!==o?Math.max.apply(Math,J(c.y)):Math.max.apply(Math,J(u.y))}},getHandles:function(t,e){var r=this.getDimension(t),n=e.x1,o=e.x2,a=e.y1,i=e.y2,u=Math.min(n,o),c=Math.max(n,o),l=Math.min(a,i),s=Math.max(a,i),f=t.handleWidth/2;return{left:"y"!==r&&{x1:u-f,x2:u+f,y1:a,y2:i},right:"y"!==r&&{x1:c-f,x2:c+f,y1:a,y2:i},top:"x"!==r&&{x1:n,x2:o,y1:l-f,y2:l+f},bottom:"x"!==r&&{x1:n,x2:o,y1:s-f,y2:s+f}}},getActiveHandles:function(t,e,r){var n=this,o=this.getHandles(e,r),a=["top","bottom","left","right"].reduce((function(e,r){return o[r]&&n.withinBounds(t,o[r])?e.concat(r):e}),[]);return a.length&&a},getResizeMutation:function(t,e){var r=t.x1,n=t.y1,o=t.x2,a=t.y2,i={left:{x1:Math.max(r,o),x2:Math.min(r,o),y1:n,y2:a},right:{x1:Math.min(r,o),x2:Math.max(r,o),y1:n,y2:a},top:{y1:Math.max(n,a),y2:Math.min(n,a),x1:r,x2:o},bottom:{y1:Math.min(n,a),y2:Math.max(n,a),x1:r,x2:o}};return e.reduce((function(t,e){return Object.assign(t,i[e])}),{})},getMinimumDomain:function(){return{x:[0,1/Number.MAX_SAFE_INTEGER],y:[0,1/Number.MAX_SAFE_INTEGER]}},getDefaultBrushArea:function(t,e,r){var n=t.domain,o=t.fullDomain,a=t.scale,i=t.horizontal,u=t.allowResize||t.defaultBrushArea?t.defaultBrushArea:"move";if("none"===u)return this.getMinimumDomain();if("disable"===u)return e;if("move"===u){var c=this.getDomainBox(t,o,e),l=t.parentSVG||O(r),s=this.panBox(q(q(q({},t),c),{},{brushDomain:e,startX:(c.x1+c.x2)/2,startY:(c.y1+c.y2)/2}),w(r,l)),f=t.fullDomainBox||this.getDomainBox(t,o);return D(q(q({},this.constrainBox(s,f)),{},{scale:a,horizontal:i}))}return n},getSelectionMutation:function(t,e,r){var n=t.x,o=t.y,a=e.x1,i=e.x2,u=e.y1,c=e.y2;return{x1:"y"!==r?n:a,y1:"x"!==r?o:u,x2:"y"!==r?n:i,y2:"x"!==r?o:c}},panBox:function(t,r){var n=t.domain,o=t.startX,a=t.startY,i=this.getDimension(t),u=e()({},t.brushDomain,n),c=e()({},t.fullDomain,n),l=t.x1?t:this.getDomainBox(t,c,u),s=l.x1,f=l.x2,y=l.y1,p=l.y2,h=r.x,v=r.y,m=o?o-h:0,b=a?a-v:0;return{x1:"y"!==i?Math.min(s,f)-m:Math.min(s,f),x2:"y"!==i?Math.max(s,f)-m:Math.max(s,f),y1:"x"!==i?Math.min(y,p)-b:Math.min(y,p),y2:"x"!==i?Math.max(y,p)-b:Math.max(y,p)}},constrainBox:function(t,e){var r=c(e,Number),n=r.x1,o=r.y1,a=r.x2,i=r.y2;return{x1:t.x2>a?a-Math.abs(t.x2-t.x1):Math.max(t.x1,n),y1:t.y2>i?i-Math.abs(t.y2-t.y1):Math.max(t.y1,o),x2:t.x1<n?n+Math.abs(t.x2-t.x1):Math.min(t.x2,a),y2:t.y1<o?o+Math.abs(t.y2-t.y1):Math.min(t.y2,i)}},constrainPoint:function(t,e){var r=c(e,Number),n=r.x1,o=r.y1,a=r.x2,i=r.y2;return{x:Math.min(Math.max(t.x,n),a),y:Math.min(Math.max(t.y,o),i)}},hasMoved:function(t){var e=t.x1,r=t.x2,n=t.y1,o=t.y2,a=t.mouseMoveThreshold,i=this.getDimension(t),u=Math.abs(e-r)>=a,c=Math.abs(n-o)>=a;switch(i){case"x":return u;case"y":return c;default:return u||c}},onMouseDown:function(t,r){var n=this;t.preventDefault();var o=r.handleWidth,a=r.cachedBrushDomain,i=r.domain,u=r.allowResize,c=r.allowDrag,l=r.allowDraw,s=this.getDimension(r),f=u||r.defaultBrushArea?r.defaultBrushArea:"move";if(!u&&!c)return{};var y=r.fullDomainBox||this.getDomainBox(r,i),p=r.parentSVG||O(t),h=w(t,p),v=h.x,m=h.y;if(!this.withinBounds({x:v,y:m},y,o))return{};var b=e()({},r.brushDomain,i),d=F()(b,a)?r.currentDomain||b||i:b||i,x=this.getDomainBox(r,i,d),g=u&&this.getActiveHandles({x:v,y:m},r,x);return g?[{target:"parent",mutation:function(){return q({isSelecting:!0,domainBox:x,fullDomainBox:y,cachedBrushDomain:b,currentDomain:d,parentSVG:p},n.getResizeMutation(x,g))}}]:this.withinBounds({x:v,y:m},x)&&!F()(i,d)?[{target:"parent",mutation:function(){return q({isPanning:c,startX:v,startY:m,domainBox:x,fullDomainBox:y,currentDomain:d,cachedBrushDomain:b,parentSVG:p},x)}}]:l?[{target:"parent",mutation:function(){return q({isSelecting:u||"move"===f,domainBox:x,fullDomainBox:y,parentSVG:p,cachedBrushDomain:b,cachedCurrentDomain:d,currentDomain:n.getMinimumDomain()},n.getSelectionMutation({x:v,y:m},x,s))}}]:{}},onGlobalMouseMove:function(t,r){var n=r.scale,o=r.isPanning,a=r.isSelecting,i=r.fullDomainBox,c=r.onBrushDomainChange,l=r.allowResize,s=r.allowDrag,f=r.horizontal,y=r.mouseMoveThreshold,p=r.parentSVG,h=this.getDimension(r),v=w(t,p),m=v.x,b=v.y;if(!l&&!s||y>0&&!this.hasMoved(q(q({},r),{},{x2:m,y2:b})))return{};if(s&&o){var d=r.startX,x=r.startY,g=this.panBox(r,{x:m,y:b}),O=this.constrainBox(g,i),M=D(q(q({},O),{},{scale:n,horizontal:f})),j=q({currentDomain:M,parentSVG:p,startX:g.x2>=i.x2||g.x1<=i.x1?d:m,startY:g.y2>=i.y2||g.y1<=i.y1?x:b},O);return u(c)&&c(M,e()({},j,r)),[{target:"parent",mutation:function(){return j}}]}if(l&&a){var P=this.constrainPoint({x:"y"!==h?m:r.x2,y:"x"!==h?b:r.y2},i),S=P.x,A=P.y,E=D({x2:S,y2:A,x1:r.x1,y1:r.y1,scale:n,horizontal:f}),B={x2:S,y2:A,currentDomain:E,parentSVG:p};return u(c)&&c(E,e()({},B,r)),[{target:"parent",mutation:function(){return B}}]}return{}},onGlobalMouseUp:function(t,r){if(!r.isPanning&&!r.isSelecting)return{};var n=r.x1,o=r.y1,a=r.x2,i=r.y2,c=r.isPanning,l=r.isSelecting,s=r.onBrushDomainChange,f=r.onBrushDomainChangeEnd,y=r.onBrushCleared,p=r.currentDomain,h=r.allowResize,v=r.allowDrag,m=h||r.defaultBrushArea?r.defaultBrushArea:"move",b={isPanning:!1,isSelecting:!1};if(!h&&(void 0===m||"none"===m)||n!==a&&o!==i)(v&&c||h&&l)&&u(f)&&f(p,e()({},b,r));else{var d=r.cachedCurrentDomain||p,x=this.getDefaultBrushArea(r,d,t);b.currentDomain=x,u(s)&&s(x,e()({},b,r)),u(f)&&f(x,e()({},b,r)),u(y)&&y(x,e()({},b,r))}return[{target:"parent",mutation:function(){return b}}]}},tt=q(q({},Q),{},{onMouseDown:Q.onMouseDown.bind(Q),onGlobalMouseUp:Q.onGlobalMouseUp.bind(Q),onGlobalMouseMove:H()(Q.onGlobalMouseMove.bind(Q),16,{leading:!0,trailing:!1})});function et(t){return function(t){if(Array.isArray(t))return rt(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return rt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?rt(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function rt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function nt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ot(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?nt(Object(r),!0).forEach((function(e){at(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):nt(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function at(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var it={allowDrag:!0,allowDraw:!0,allowResize:!0,brushComponent:a().createElement(p,null),brushStyle:{stroke:"transparent",fill:"black",fillOpacity:.1},handleComponent:a().createElement(p,null),handleStyle:{stroke:"transparent",fill:"transparent"},handleWidth:8,mouseMoveThreshold:0},ut=function(t){var r,n,o,i,u,c,l,s,f,y,p,h,v,m=ot(ot({},it),t),b=m.children;return{props:m,children:[].concat(et(a().Children.toArray(b)),et((f=m.currentDomain,y=m.cachedBrushDomain,p=e()({},m.brushDomain,m.domain),h=F()(p,y)?e()({},f,p):p,r=M(m,h),n=r.x,o=r.y,i=m.brushStyle,u=m.brushComponent,c=m.name,l=u.props&&u.props.style,s=m.allowDrag||m.allowResize?"move":"auto",v=n[0]!==n[1]&&o[0]!==o[1]?a().cloneElement(u,{key:"".concat(c,"-brush"),width:Math.abs(n[1]-n[0])||1,height:Math.abs(o[1]-o[0])||1,x:Math.min(n[0],n[1]),y:Math.min(o[0],o[1]),cursor:s,style:e()({},l,i)}):null,v?[v,function(t){var r=m.handleWidth,n=m.handleStyle,o=m.handleComponent,i=m.name,u=tt.getDomainBox(m,t),c=u.x1,l=u.x2,s=u.y1,f=u.y2,y=tt.getHandles(m,u),p=y.top,h=y.bottom,v=y.left,b=y.right,d=Math.abs(l-c)||1,x=Math.abs(f-s)||1,g=o.props&&o.props.style||{},O=e()({},g,n),w=function(){var t={yProps:"ns-resize",xProps:"ew-resize"};return!m.allowResize&&m.allowDrag?(t.xProps="move",t.yProps="move"):m.allowResize||m.allowDrag||(t.xProps="auto",t.yProps="auto"),t}(),M={style:O,width:d,height:r,cursor:w.yProps},j={style:O,width:r,height:x,cursor:w.xProps},D={top:p&&Object.assign({x:p.x1,y:p.y1},M),bottom:h&&Object.assign({x:h.x1,y:h.y1},M),left:v&&Object.assign({y:v.y1,x:v.x1},j),right:b&&Object.assign({y:b.y1,x:b.x1},j)},P=["top","bottom","left","right"].reduce((function(t,e){return D[e]?t.concat(a().cloneElement(o,Object.assign({key:"".concat(i,"-handle-").concat(e)},D[e]))):t}),[]);return P.length?P:null}(h)]:[])))}},ct=function(t){var e=ut(t),r=e.props,n=e.children;return a().createElement(W,r,n)};ct.role="container",ct.defaultEvents=function(t){var e=ot(ot({},it),t),r=function(t,r){return function(n,o,a,i){return e.disable||null!=r&&r(o)?{}:t(n,ot(ot({},e),o),a,i)}};return[{target:"parent",eventHandlers:{onMouseDown:r(tt.onMouseDown),onTouchStart:r(tt.onMouseDown),onGlobalMouseMove:r(tt.onGlobalMouseMove,(function(t){return!t.isPanning&&!t.isSelecting})),onGlobalTouchMove:r(tt.onGlobalMouseMove,(function(t){return!t.isPanning&&!t.isSelecting})),onGlobalMouseUp:r(tt.onGlobalMouseUp),onGlobalTouchEnd:r(tt.onGlobalMouseUp),onGlobalTouchCancel:r(tt.onGlobalMouseUp)}}]}})(),o})()));
//# sourceMappingURL=victory-brush-container.min.js.map

@@ -62,4 +62,4 @@ /// <reference types="lodash" />

y1: number;
x2: number;
y2: number;
x2: any;
y2: any;
};

@@ -66,0 +66,0 @@ constrainPoint(point: any, fullDomainBox: any): {

@@ -1,57 +0,76 @@

import _mapValues from "lodash/mapValues";
import _defaults from "lodash/defaults";
import _throttle from "lodash/throttle";
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
import { Helpers as CoreHelpers, Selection } from "victory-core";
import isEqual from "react-fast-compare";
const Helpers = {
getDimension(props) {
const {
horizontal,
brushDimension
} = props;
var Helpers = {
getDimension: function (props) {
var horizontal = props.horizontal,
brushDimension = props.brushDimension;
if (!horizontal || !brushDimension) {
return brushDimension;
}
return brushDimension === "x" ? "y" : "x";
},
withinBounds(point, bounds, padding) {
const {
x1,
x2,
y1,
y2
} = _mapValues(bounds, Number);
const {
x,
y
} = _mapValues(point, Number);
const paddingValue = padding ? padding / 2 : 0;
withinBounds: function (point, bounds, padding) {
var _CoreHelpers$mapValue = CoreHelpers.mapValues(bounds, Number),
x1 = _CoreHelpers$mapValue.x1,
x2 = _CoreHelpers$mapValue.x2,
y1 = _CoreHelpers$mapValue.y1,
y2 = _CoreHelpers$mapValue.y2;
var _CoreHelpers$mapValue2 = CoreHelpers.mapValues(point, Number),
x = _CoreHelpers$mapValue2.x,
y = _CoreHelpers$mapValue2.y;
var paddingValue = padding ? padding / 2 : 0;
return x + paddingValue >= Math.min(x1, x2) && x - paddingValue <= Math.max(x1, x2) && y + paddingValue >= Math.min(y1, y2) && y - paddingValue <= Math.max(y1, y2);
},
getDomainBox(props, fullDomain, selectedDomain) {
const brushDimension = this.getDimension(props);
const fullDomainObject = _defaults({}, fullDomain, props.domain);
const selectedDomainObject = _defaults({}, selectedDomain, fullDomainObject);
const fullCoords = Selection.getDomainCoordinates(props, fullDomainObject);
const selectedCoords = Selection.getDomainCoordinates(props, selectedDomainObject);
getDomainBox: function (props, fullDomain, selectedDomain) {
var brushDimension = this.getDimension(props);
var fullDomainObject = _defaults({}, fullDomain, props.domain);
var selectedDomainObject = _defaults({}, selectedDomain, fullDomainObject);
var fullCoords = Selection.getDomainCoordinates(props, fullDomainObject);
var selectedCoords = Selection.getDomainCoordinates(props, selectedDomainObject);
return {
x1: brushDimension !== "y" ? Math.min(...selectedCoords.x) : Math.min(...fullCoords.x),
x2: brushDimension !== "y" ? Math.max(...selectedCoords.x) : Math.max(...fullCoords.x),
y1: brushDimension !== "x" ? Math.min(...selectedCoords.y) : Math.min(...fullCoords.y),
y2: brushDimension !== "x" ? Math.max(...selectedCoords.y) : Math.max(...fullCoords.y)
x1: brushDimension !== "y" ? Math.min.apply(Math, _toConsumableArray(selectedCoords.x)) : Math.min.apply(Math, _toConsumableArray(fullCoords.x)),
x2: brushDimension !== "y" ? Math.max.apply(Math, _toConsumableArray(selectedCoords.x)) : Math.max.apply(Math, _toConsumableArray(fullCoords.x)),
y1: brushDimension !== "x" ? Math.min.apply(Math, _toConsumableArray(selectedCoords.y)) : Math.min.apply(Math, _toConsumableArray(fullCoords.y)),
y2: brushDimension !== "x" ? Math.max.apply(Math, _toConsumableArray(selectedCoords.y)) : Math.max.apply(Math, _toConsumableArray(fullCoords.y))
};
},
getHandles(props, domainBox) {
const brushDimension = this.getDimension(props);
const {
x1,
x2,
y1,
y2
} = domainBox;
const minX = Math.min(x1, x2);
const maxX = Math.max(x1, x2);
const minY = Math.min(y1, y2);
const maxY = Math.max(y1, y2);
const handleWidth = props.handleWidth / 2;
getHandles: function (props, domainBox) {
var brushDimension = this.getDimension(props);
var x1 = domainBox.x1,
x2 = domainBox.x2,
y1 = domainBox.y1,
y2 = domainBox.y2;
var minX = Math.min(x1, x2);
var maxX = Math.max(x1, x2);
var minY = Math.min(y1, y2);
var maxY = Math.max(y1, y2);
var handleWidth = props.handleWidth / 2;
return {

@@ -61,4 +80,4 @@ left: brushDimension !== "y" && {

x2: minX + handleWidth,
y1,
y2
y1: y1,
y2: y2
},

@@ -68,8 +87,8 @@ right: brushDimension !== "y" && {

x2: maxX + handleWidth,
y1,
y2
y1: y1,
y2: y2
},
top: brushDimension !== "x" && {
x1,
x2,
x1: x1,
x2: x2,
y1: minY - handleWidth,

@@ -79,4 +98,4 @@ y2: minY + handleWidth

bottom: brushDimension !== "x" && {
x1,
x2,
x1: x1,
x2: x2,
y1: maxY - handleWidth,

@@ -87,20 +106,22 @@ y2: maxY + handleWidth

},
getActiveHandles(point, props, domainBox) {
const handles = this.getHandles(props, domainBox);
const activeHandles = ["top", "bottom", "left", "right"].reduce((memo, opt) => handles[opt] && this.withinBounds(point, handles[opt]) ? memo.concat(opt) : memo, []);
getActiveHandles: function (point, props, domainBox) {
var _this = this;
var handles = this.getHandles(props, domainBox);
var activeHandles = ["top", "bottom", "left", "right"].reduce(function (memo, opt) {
return handles[opt] && _this.withinBounds(point, handles[opt]) ? memo.concat(opt) : memo;
}, []);
return activeHandles.length && activeHandles;
},
getResizeMutation(box, handles) {
const {
x1,
y1,
x2,
y2
} = box;
const mutations = {
getResizeMutation: function (box, handles) {
var x1 = box.x1,
y1 = box.y1,
x2 = box.x2,
y2 = box.y2;
var mutations = {
left: {
x1: Math.max(x1, x2),
x2: Math.min(x1, x2),
y1,
y2
y1: y1,
y2: y2
},

@@ -110,4 +131,4 @@ right: {

x2: Math.max(x1, x2),
y1,
y2
y1: y1,
y2: y2
},

@@ -117,4 +138,4 @@ top: {

y2: Math.min(y1, y2),
x1,
x2
x1: x1,
x2: x2
},

@@ -124,11 +145,11 @@ bottom: {

y2: Math.max(y1, y2),
x1,
x2
x1: x1,
x2: x2
}
};
return handles.reduce((memo, current) => {
return handles.reduce(function (memo, current) {
return Object.assign(memo, mutations[current]);
}, {});
},
getMinimumDomain() {
getMinimumDomain: function () {
return {

@@ -139,11 +160,10 @@ x: [0, 1 / Number.MAX_SAFE_INTEGER],

},
getDefaultBrushArea(targetProps, cachedDomain, evt) {
const {
domain,
fullDomain,
scale,
horizontal,
allowResize
} = targetProps;
const defaultBrushArea = !allowResize && !targetProps.defaultBrushArea ? "move" : targetProps.defaultBrushArea;
getDefaultBrushArea: function (targetProps, cachedDomain, evt) {
var domain = targetProps.domain,
fullDomain = targetProps.fullDomain,
scale = targetProps.scale,
horizontal = targetProps.horizontal,
allowResize = targetProps.allowResize;
var defaultBrushArea = !allowResize && !targetProps.defaultBrushArea ? "move" : targetProps.defaultBrushArea;
if (defaultBrushArea === "none") {

@@ -154,32 +174,26 @@ return this.getMinimumDomain();

} else if (defaultBrushArea === "move") {
const brushBox = this.getDomainBox(targetProps, fullDomain, cachedDomain);
const parentSVG = targetProps.parentSVG || Selection.getParentSVG(evt);
const pannedBox = this.panBox({
...targetProps,
...brushBox,
var brushBox = this.getDomainBox(targetProps, fullDomain, cachedDomain);
var parentSVG = targetProps.parentSVG || Selection.getParentSVG(evt);
var pannedBox = this.panBox(_objectSpread(_objectSpread(_objectSpread({}, targetProps), brushBox), {}, {
brushDomain: cachedDomain,
startX: (brushBox.x1 + brushBox.x2) / 2,
startY: (brushBox.y1 + brushBox.y2) / 2
}, Selection.getSVGEventCoordinates(evt, parentSVG));
const fullDomainBox = targetProps.fullDomainBox || this.getDomainBox(targetProps, fullDomain);
const constrainedBox = this.constrainBox(pannedBox, fullDomainBox);
return Selection.getBounds({
...constrainedBox,
scale,
horizontal
});
}), Selection.getSVGEventCoordinates(evt, parentSVG));
var fullDomainBox = targetProps.fullDomainBox || this.getDomainBox(targetProps, fullDomain);
var constrainedBox = this.constrainBox(pannedBox, fullDomainBox);
return Selection.getBounds(_objectSpread(_objectSpread({}, constrainedBox), {}, {
scale: scale,
horizontal: horizontal
}));
}
return domain;
},
getSelectionMutation(point, box, brushDimension) {
const {
x,
y
} = point;
const {
x1,
x2,
y1,
y2
} = box;
getSelectionMutation: function (point, box, brushDimension) {
var x = point.x,
y = point.y;
var x1 = box.x1,
x2 = box.x2,
y1 = box.y1,
y2 = box.y2;
return {

@@ -192,22 +206,21 @@ x1: brushDimension !== "y" ? x : x1,

},
panBox(props, point) {
const {
domain,
startX,
startY
} = props;
const brushDimension = this.getDimension(props);
const brushDomain = _defaults({}, props.brushDomain, domain);
const fullDomain = _defaults({}, props.fullDomain, domain);
const {
x1,
x2,
y1,
y2
} = props.x1 ? props : this.getDomainBox(props, fullDomain, brushDomain);
const {
x,
y
} = point;
const delta = {
panBox: function (props, point) {
var domain = props.domain,
startX = props.startX,
startY = props.startY;
var brushDimension = this.getDimension(props);
var brushDomain = _defaults({}, props.brushDomain, domain);
var fullDomain = _defaults({}, props.fullDomain, domain);
var _ref = props.x1 ? props : this.getDomainBox(props, fullDomain, brushDomain),
x1 = _ref.x1,
x2 = _ref.x2,
y1 = _ref.y1,
y2 = _ref.y2;
var x = point.x,
y = point.y;
var delta = {
x: startX ? startX - x : 0,

@@ -223,9 +236,9 @@ y: startY ? startY - y : 0

},
constrainBox(box, fullDomainBox) {
const {
x1,
y1,
x2,
y2
} = _mapValues(fullDomainBox, Number);
constrainBox: function (box, fullDomainBox) {
var _CoreHelpers$mapValue3 = CoreHelpers.mapValues(fullDomainBox, Number),
x1 = _CoreHelpers$mapValue3.x1,
y1 = _CoreHelpers$mapValue3.y1,
x2 = _CoreHelpers$mapValue3.x2,
y2 = _CoreHelpers$mapValue3.y2;
return {

@@ -238,9 +251,9 @@ x1: box.x2 > x2 ? x2 - Math.abs(box.x2 - box.x1) : Math.max(box.x1, x1),

},
constrainPoint(point, fullDomainBox) {
const {
x1,
y1,
x2,
y2
} = _mapValues(fullDomainBox, Number);
constrainPoint: function (point, fullDomainBox) {
var _CoreHelpers$mapValue4 = CoreHelpers.mapValues(fullDomainBox, Number),
x1 = _CoreHelpers$mapValue4.x1,
y1 = _CoreHelpers$mapValue4.y1,
x2 = _CoreHelpers$mapValue4.x2,
y2 = _CoreHelpers$mapValue4.y2;
return {

@@ -251,18 +264,19 @@ x: Math.min(Math.max(point.x, x1), x2),

},
hasMoved(props) {
const {
x1,
x2,
y1,
y2,
mouseMoveThreshold
} = props;
const brushDimension = this.getDimension(props);
const xMoved = Math.abs(x1 - x2) >= mouseMoveThreshold;
const yMoved = Math.abs(y1 - y2) >= mouseMoveThreshold;
hasMoved: function (props) {
var x1 = props.x1,
x2 = props.x2,
y1 = props.y1,
y2 = props.y2,
mouseMoveThreshold = props.mouseMoveThreshold;
var brushDimension = this.getDimension(props);
var xMoved = Math.abs(x1 - x2) >= mouseMoveThreshold;
var yMoved = Math.abs(y1 - y2) >= mouseMoveThreshold;
switch (brushDimension) {
case "x":
return xMoved;
case "y":
return yMoved;
default:

@@ -273,57 +287,60 @@ return xMoved || yMoved;

// eslint-disable-next-line max-statements, complexity
onMouseDown(evt, targetProps) {
onMouseDown: function (evt, targetProps) {
var _this2 = this;
evt.preventDefault();
const {
handleWidth,
cachedBrushDomain,
domain,
allowResize,
allowDrag,
allowDraw
} = targetProps;
const brushDimension = this.getDimension(targetProps);
const defaultBrushArea = !allowResize && !targetProps.defaultBrushArea ? "move" : targetProps.defaultBrushArea;
// Don't trigger events for static brushes
var handleWidth = targetProps.handleWidth,
cachedBrushDomain = targetProps.cachedBrushDomain,
domain = targetProps.domain,
allowResize = targetProps.allowResize,
allowDrag = targetProps.allowDrag,
allowDraw = targetProps.allowDraw;
var brushDimension = this.getDimension(targetProps);
var defaultBrushArea = !allowResize && !targetProps.defaultBrushArea ? "move" : targetProps.defaultBrushArea; // Don't trigger events for static brushes
if (!allowResize && !allowDrag) {
return {};
}
const fullDomainBox = targetProps.fullDomainBox || this.getDomainBox(targetProps, domain);
const parentSVG = targetProps.parentSVG || Selection.getParentSVG(evt);
const {
x,
y
} = Selection.getSVGEventCoordinates(evt, parentSVG);
// Ignore events that occur outside of the maximum domain region
var fullDomainBox = targetProps.fullDomainBox || this.getDomainBox(targetProps, domain);
var parentSVG = targetProps.parentSVG || Selection.getParentSVG(evt);
var _Selection$getSVGEven = Selection.getSVGEventCoordinates(evt, parentSVG),
x = _Selection$getSVGEven.x,
y = _Selection$getSVGEven.y; // Ignore events that occur outside of the maximum domain region
if (!this.withinBounds({
x,
y
x: x,
y: y
}, fullDomainBox, handleWidth)) {
return {};
}
const brushDomain = _defaults({}, targetProps.brushDomain, domain);
const currentDomain = isEqual(brushDomain, cachedBrushDomain) ? targetProps.currentDomain || brushDomain || domain : brushDomain || domain;
const domainBox = this.getDomainBox(targetProps, domain, currentDomain);
const activeHandles = allowResize && this.getActiveHandles({
x,
y
}, targetProps, domainBox);
// If the event occurs in any of the handle regions, start a resize
var brushDomain = _defaults({}, targetProps.brushDomain, domain);
var currentDomain = isEqual(brushDomain, cachedBrushDomain) ? targetProps.currentDomain || brushDomain || domain : brushDomain || domain;
var domainBox = this.getDomainBox(targetProps, domain, currentDomain);
var activeHandles = allowResize && this.getActiveHandles({
x: x,
y: y
}, targetProps, domainBox); // If the event occurs in any of the handle regions, start a resize
if (activeHandles) {
return [{
target: "parent",
mutation: () => {
return {
mutation: function () {
return _objectSpread({
isSelecting: true,
domainBox,
fullDomainBox,
domainBox: domainBox,
fullDomainBox: fullDomainBox,
cachedBrushDomain: brushDomain,
currentDomain,
parentSVG,
...this.getResizeMutation(domainBox, activeHandles)
};
currentDomain: currentDomain,
parentSVG: parentSVG
}, _this2.getResizeMutation(domainBox, activeHandles));
}
}];
} else if (this.withinBounds({
x,
y
x: x,
y: y
}, domainBox) && !isEqual(domain, currentDomain)) {

@@ -334,160 +351,170 @@ // if the event occurs within a selected region start a panning event, unless the whole

target: "parent",
mutation: () => ({
isPanning: allowDrag,
startX: x,
startY: y,
domainBox,
fullDomainBox,
currentDomain,
cachedBrushDomain: brushDomain,
parentSVG,
...domainBox // set x1, x2, y1, y2
})
mutation: function () {
return _objectSpread({
isPanning: allowDrag,
startX: x,
startY: y,
domainBox: domainBox,
fullDomainBox: fullDomainBox,
currentDomain: currentDomain,
cachedBrushDomain: brushDomain,
parentSVG: parentSVG
}, domainBox);
}
}];
}
// if the event occurs outside the region, or if the whole domain is selected,
} // if the event occurs outside the region, or if the whole domain is selected,
// start a new selection
return allowDraw ? [{
target: "parent",
mutation: () => ({
isSelecting: allowResize || defaultBrushArea === "move",
domainBox,
fullDomainBox,
parentSVG,
cachedBrushDomain: brushDomain,
cachedCurrentDomain: currentDomain,
currentDomain: this.getMinimumDomain(),
...this.getSelectionMutation({
x,
y
}, domainBox, brushDimension)
})
mutation: function () {
return _objectSpread({
isSelecting: allowResize || defaultBrushArea === "move",
domainBox: domainBox,
fullDomainBox: fullDomainBox,
parentSVG: parentSVG,
cachedBrushDomain: brushDomain,
cachedCurrentDomain: currentDomain,
currentDomain: _this2.getMinimumDomain()
}, _this2.getSelectionMutation({
x: x,
y: y
}, domainBox, brushDimension));
}
}] : {};
},
// eslint-disable-next-line max-statements, complexity
onGlobalMouseMove(evt, targetProps) {
const {
scale,
isPanning,
isSelecting,
fullDomainBox,
onBrushDomainChange,
allowResize,
allowDrag,
horizontal,
mouseMoveThreshold,
parentSVG
} = targetProps;
const brushDimension = this.getDimension(targetProps);
const {
x,
y
} = Selection.getSVGEventCoordinates(evt, parentSVG);
if (!allowResize && !allowDrag || mouseMoveThreshold > 0 && !this.hasMoved({
...targetProps,
onGlobalMouseMove: function (evt, targetProps) {
var scale = targetProps.scale,
isPanning = targetProps.isPanning,
isSelecting = targetProps.isSelecting,
fullDomainBox = targetProps.fullDomainBox,
onBrushDomainChange = targetProps.onBrushDomainChange,
allowResize = targetProps.allowResize,
allowDrag = targetProps.allowDrag,
horizontal = targetProps.horizontal,
mouseMoveThreshold = targetProps.mouseMoveThreshold,
parentSVG = targetProps.parentSVG;
var brushDimension = this.getDimension(targetProps);
var _Selection$getSVGEven2 = Selection.getSVGEventCoordinates(evt, parentSVG),
x = _Selection$getSVGEven2.x,
y = _Selection$getSVGEven2.y;
if (!allowResize && !allowDrag || mouseMoveThreshold > 0 && !this.hasMoved(_objectSpread(_objectSpread({}, targetProps), {}, {
x2: x,
y2: y
})) {
}))) {
return {};
}
if (allowDrag && isPanning) {
const {
startX,
startY
} = targetProps;
const pannedBox = this.panBox(targetProps, {
x,
y
var startX = targetProps.startX,
startY = targetProps.startY;
var pannedBox = this.panBox(targetProps, {
x: x,
y: y
});
const constrainedBox = this.constrainBox(pannedBox, fullDomainBox);
const currentDomain = Selection.getBounds({
...constrainedBox,
scale,
horizontal
});
const mutatedProps = {
currentDomain,
parentSVG,
var constrainedBox = this.constrainBox(pannedBox, fullDomainBox);
var currentDomain = Selection.getBounds(_objectSpread(_objectSpread({}, constrainedBox), {}, {
scale: scale,
horizontal: horizontal
}));
var mutatedProps = _objectSpread({
currentDomain: currentDomain,
parentSVG: parentSVG,
startX: pannedBox.x2 >= fullDomainBox.x2 || pannedBox.x1 <= fullDomainBox.x1 ? startX : x,
startY: pannedBox.y2 >= fullDomainBox.y2 || pannedBox.y1 <= fullDomainBox.y1 ? startY : y,
...constrainedBox
};
startY: pannedBox.y2 >= fullDomainBox.y2 || pannedBox.y1 <= fullDomainBox.y1 ? startY : y
}, constrainedBox);
if (CoreHelpers.isFunction(onBrushDomainChange)) {
onBrushDomainChange(currentDomain, _defaults({}, mutatedProps, targetProps));
}
return [{
target: "parent",
mutation: () => mutatedProps
mutation: function () {
return mutatedProps;
}
}];
} else if (allowResize && isSelecting) {
const {
x: x2,
y: y2
} = this.constrainPoint({
var _this$constrainPoint = this.constrainPoint({
x: brushDimension !== "y" ? x : targetProps.x2,
y: brushDimension !== "x" ? y : targetProps.y2
}, fullDomainBox);
const currentDomain = Selection.getBounds({
x2,
y2,
}, fullDomainBox),
x2 = _this$constrainPoint.x,
y2 = _this$constrainPoint.y;
var _currentDomain = Selection.getBounds({
x2: x2,
y2: y2,
x1: targetProps.x1,
y1: targetProps.y1,
scale,
horizontal
scale: scale,
horizontal: horizontal
});
const mutatedProps = {
x2,
y2,
currentDomain,
parentSVG
var _mutatedProps = {
x2: x2,
y2: y2,
currentDomain: _currentDomain,
parentSVG: parentSVG
};
if (CoreHelpers.isFunction(onBrushDomainChange)) {
onBrushDomainChange(currentDomain, _defaults({}, mutatedProps, targetProps));
onBrushDomainChange(_currentDomain, _defaults({}, _mutatedProps, targetProps));
}
return [{
target: "parent",
mutation: () => mutatedProps
mutation: function () {
return _mutatedProps;
}
}];
}
return {};
},
// eslint-disable-next-line complexity
onGlobalMouseUp(evt, targetProps) {
onGlobalMouseUp: function (evt, targetProps) {
// if a panning or selection has not been started, ignore the event
if (!targetProps.isPanning && !targetProps.isSelecting) {
return {};
}
// eslint-disable-line max-statements, complexity
const {
x1,
y1,
x2,
y2,
isPanning,
isSelecting,
onBrushDomainChange,
onBrushDomainChangeEnd,
onBrushCleared,
currentDomain,
allowResize,
allowDrag
} = targetProps;
const defaultBrushArea = !allowResize && !targetProps.defaultBrushArea ? "move" : targetProps.defaultBrushArea;
const defaultBrushHasArea = defaultBrushArea !== undefined && defaultBrushArea !== "none";
const mutatedProps = {
} // eslint-disable-line max-statements, complexity
var x1 = targetProps.x1,
y1 = targetProps.y1,
x2 = targetProps.x2,
y2 = targetProps.y2,
isPanning = targetProps.isPanning,
isSelecting = targetProps.isSelecting,
onBrushDomainChange = targetProps.onBrushDomainChange,
onBrushDomainChangeEnd = targetProps.onBrushDomainChangeEnd,
onBrushCleared = targetProps.onBrushCleared,
currentDomain = targetProps.currentDomain,
allowResize = targetProps.allowResize,
allowDrag = targetProps.allowDrag;
var defaultBrushArea = !allowResize && !targetProps.defaultBrushArea ? "move" : targetProps.defaultBrushArea;
var defaultBrushHasArea = defaultBrushArea !== undefined && defaultBrushArea !== "none";
var mutatedProps = {
isPanning: false,
isSelecting: false
};
}; // if the mouse hasn't moved since a mouseDown event, select the default brush area
// if the mouse hasn't moved since a mouseDown event, select the default brush area
if ((allowResize || defaultBrushHasArea) && (x1 === x2 || y1 === y2)) {
const cachedDomain = targetProps.cachedCurrentDomain || currentDomain;
const defaultDomain = this.getDefaultBrushArea(targetProps, cachedDomain, evt);
var cachedDomain = targetProps.cachedCurrentDomain || currentDomain;
var defaultDomain = this.getDefaultBrushArea(targetProps, cachedDomain, evt);
mutatedProps.currentDomain = defaultDomain;
if (CoreHelpers.isFunction(onBrushDomainChange)) {
onBrushDomainChange(defaultDomain, _defaults({}, mutatedProps, targetProps));
}
if (CoreHelpers.isFunction(onBrushDomainChangeEnd)) {
onBrushDomainChangeEnd(defaultDomain, _defaults({}, mutatedProps, targetProps));
}
if (CoreHelpers.isFunction(onBrushCleared)) {

@@ -501,14 +528,15 @@ onBrushCleared(defaultDomain, _defaults({}, mutatedProps, targetProps));

}
return [{
target: "parent",
mutation: () => mutatedProps
mutation: function () {
return mutatedProps;
}
}];
}
};
export const BrushHelpers = {
...Helpers,
export var BrushHelpers = _objectSpread(_objectSpread({}, Helpers), {}, {
onMouseDown: Helpers.onMouseDown.bind(Helpers),
onGlobalMouseUp: Helpers.onGlobalMouseUp.bind(Helpers),
onGlobalMouseMove: _throttle(Helpers.onGlobalMouseMove.bind(Helpers), 16,
// eslint-disable-line no-magic-numbers
onGlobalMouseMove: _throttle(Helpers.onGlobalMouseMove.bind(Helpers), 16, // eslint-disable-line no-magic-numbers
{

@@ -518,2 +546,2 @@ leading: true,

})
};
});
import React from "react";
import { VictoryContainer, DomainTuple, VictoryContainerProps } from "victory-core";
import { DomainTuple, VictoryContainerProps, VictoryEventHandler } from "victory-core";
export interface VictoryBrushContainerProps extends VictoryContainerProps {

@@ -32,55 +32,34 @@ allowDrag?: boolean;

}
declare type ComponentClass<TProps> = {
new (props: TProps): React.Component<TProps>;
export declare const VICTORY_BRUSH_CONTAINER_DEFAULT_PROPS: {
allowDrag: boolean;
allowDraw: boolean;
allowResize: boolean;
brushComponent: JSX.Element;
brushStyle: {
stroke: string;
fill: string;
fillOpacity: number;
};
handleComponent: JSX.Element;
handleStyle: {
stroke: string;
fill: string;
};
handleWidth: number;
mouseMoveThreshold: number;
};
export declare function brushContainerMixin<TBase extends ComponentClass<TProps>, TProps extends VictoryBrushContainerProps>(Base: TBase): {
new (props: TProps): {
getSelectBox(props: any, coordinates: any): React.DetailedReactHTMLElement<{
key: string;
width: number;
height: number;
x: number;
y: number;
cursor: string;
style: any;
}, HTMLElement> | null;
getCursorPointers(props: any): {
yProps: string;
xProps: string;
export declare const useVictoryBrushContainer: (initialProps: VictoryBrushContainerProps) => {
props: {
domain: {
x: DomainTuple;
y: DomainTuple;
};
getHandles(props: any, domain: any): React.ReactElement<any, string | React.JSXElementConstructor<any>>[] | null;
getRect(props: any): (React.ReactElement<any, string | React.JSXElementConstructor<any>>[] | React.DetailedReactHTMLElement<{
key: string;
width: number;
height: number;
x: number;
y: number;
cursor: string;
style: any;
}, HTMLElement> | null)[];
getChildren(props: any): (string | number | React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactFragment | null)[];
context: unknown;
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<TProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
forceUpdate(callback?: (() => void) | undefined): void;
render(): React.ReactNode;
readonly props: Readonly<TProps>;
state: Readonly<{}>;
refs: {
[key: string]: React.ReactInstance;
};
componentDidMount?(): void;
shouldComponentUpdate?(nextProps: Readonly<TProps>, nextState: Readonly<{}>, nextContext: any): boolean;
componentWillUnmount?(): void;
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
getSnapshotBeforeUpdate?(prevProps: Readonly<TProps>, prevState: Readonly<{}>): any;
componentDidUpdate?(prevProps: Readonly<TProps>, prevState: Readonly<{}>, snapshot?: any): void;
componentWillMount?(): void;
UNSAFE_componentWillMount?(): void;
componentWillReceiveProps?(nextProps: Readonly<TProps>, nextContext: any): void;
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<TProps>, nextContext: any): void;
componentWillUpdate?(nextProps: Readonly<TProps>, nextState: Readonly<{}>, nextContext: any): void;
UNSAFE_componentWillUpdate?(nextProps: Readonly<TProps>, nextState: Readonly<{}>, nextContext: any): void;
};
displayName: string;
defaultProps: {
currentDomain: {
x: DomainTuple;
y: DomainTuple;
} | undefined;
cachedBrushDomain: {
x: DomainTuple;
y: DomainTuple;
} | undefined;
allowDrag: boolean;

@@ -90,3 +69,8 @@ allowDraw: boolean;

brushComponent: JSX.Element;
brushStyle: {
brushDimension?: "x" | "y" | undefined;
brushDomain?: {
x?: DomainTuple | undefined;
y?: DomainTuple | undefined;
} | undefined;
brushStyle: React.CSSProperties | {
stroke: string;

@@ -96,4 +80,6 @@ fill: string;

};
defaultBrushArea?: "move" | "none" | "disable" | "all" | undefined;
disable?: boolean | undefined;
handleComponent: JSX.Element;
handleStyle: {
handleStyle: React.CSSProperties | {
stroke: string;

@@ -103,108 +89,63 @@ fill: string;

handleWidth: number;
onBrushCleared?: ((domain: {
x: DomainTuple;
y: DomainTuple;
}, props: VictoryBrushContainerProps) => void) | undefined;
onBrushDomainChange?: ((domain: {
x: DomainTuple;
y: DomainTuple;
}, props: VictoryBrushContainerProps) => void) | undefined;
onBrushDomainChangeEnd?: ((domain: {
x: DomainTuple;
y: DomainTuple;
}, props: VictoryBrushContainerProps) => void) | undefined;
"aria-describedby"?: string | undefined;
"aria-labelledby"?: string | undefined;
children?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactElement<any, string | React.JSXElementConstructor<any>>[] | undefined;
className?: string | undefined;
containerId?: string | number | undefined;
containerRef?: React.Ref<HTMLElement> | undefined;
desc?: string | undefined;
events?: React.DOMAttributes<any> | undefined;
height?: number | undefined;
name?: string | undefined;
origin?: import("victory-core").OriginType | undefined;
polar?: boolean | undefined;
portalComponent?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
portalZIndex?: number | undefined;
preserveAspectRatio?: string | undefined;
responsive?: boolean | undefined;
role?: string | undefined;
scale?: {
x?: import("victory-core").D3Scale<any> | undefined;
y?: import("victory-core").D3Scale<any> | undefined;
} | undefined;
style?: React.CSSProperties | undefined;
tabIndex?: number | undefined;
theme?: import("victory-core").VictoryThemeDefinition | undefined;
title?: string | undefined;
width?: number | undefined;
ouiaId?: string | number | undefined;
ouiaSafe?: boolean | undefined;
ouiaType?: string | undefined;
mouseMoveThreshold: number;
className: string;
portalComponent: JSX.Element;
portalZIndex: number;
responsive: boolean;
role: string;
};
defaultEvents: (props: any) => {
target: string;
eventHandlers: {
onMouseDown: (evt: any, targetProps: any) => {};
onTouchStart: (evt: any, targetProps: any) => {};
onGlobalMouseMove: (evt: any, targetProps: any) => {} | undefined;
onGlobalTouchMove: (evt: any, targetProps: any) => {} | undefined;
onGlobalMouseUp: (evt: any, targetProps: any) => {};
onGlobalTouchEnd: (evt: any, targetProps: any) => {};
onGlobalTouchCancel: (evt: any, targetProps: any) => {};
};
}[];
} & TBase;
children: React.ReactElement<any, string | React.JSXElementConstructor<any>>[];
};
export declare const VictoryBrushContainer: {
new (props: VictoryBrushContainerProps): {
getSelectBox(props: any, coordinates: any): React.DetailedReactHTMLElement<{
key: string;
width: number;
height: number;
x: number;
y: number;
cursor: string;
style: any;
}, HTMLElement> | null;
getCursorPointers(props: any): {
yProps: string;
xProps: string;
};
getHandles(props: any, domain: any): React.ReactElement<any, string | React.JSXElementConstructor<any>>[] | null;
getRect(props: any): (React.ReactElement<any, string | React.JSXElementConstructor<any>>[] | React.DetailedReactHTMLElement<{
key: string;
width: number;
height: number;
x: number;
y: number;
cursor: string;
style: any;
}, HTMLElement> | null)[];
getChildren(props: any): (string | number | React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactFragment | null)[];
context: unknown;
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<VictoryBrushContainerProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
forceUpdate(callback?: (() => void) | undefined): void;
render(): React.ReactNode;
readonly props: Readonly<VictoryBrushContainerProps>;
state: Readonly<{}>;
refs: {
[key: string]: React.ReactInstance;
};
componentDidMount?(): void;
shouldComponentUpdate?(nextProps: Readonly<VictoryBrushContainerProps>, nextState: Readonly<{}>, nextContext: any): boolean;
componentWillUnmount?(): void;
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
getSnapshotBeforeUpdate?(prevProps: Readonly<VictoryBrushContainerProps>, prevState: Readonly<{}>): any;
componentDidUpdate?(prevProps: Readonly<VictoryBrushContainerProps>, prevState: Readonly<{}>, snapshot?: any): void;
componentWillMount?(): void;
UNSAFE_componentWillMount?(): void;
componentWillReceiveProps?(nextProps: Readonly<VictoryBrushContainerProps>, nextContext: any): void;
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<VictoryBrushContainerProps>, nextContext: any): void;
componentWillUpdate?(nextProps: Readonly<VictoryBrushContainerProps>, nextState: Readonly<{}>, nextContext: any): void;
UNSAFE_componentWillUpdate?(nextProps: Readonly<VictoryBrushContainerProps>, nextState: Readonly<{}>, nextContext: any): void;
};
displayName: string;
defaultProps: {
allowDrag: boolean;
allowDraw: boolean;
allowResize: boolean;
brushComponent: JSX.Element;
brushStyle: {
stroke: string;
fill: string;
fillOpacity: number;
};
handleComponent: JSX.Element;
handleStyle: {
stroke: string;
fill: string;
};
handleWidth: number;
mouseMoveThreshold: number;
className: string;
portalComponent: JSX.Element;
portalZIndex: number;
responsive: boolean;
role: string;
};
defaultEvents: (props: any) => {
(initialProps: VictoryBrushContainerProps): JSX.Element;
role: string;
defaultEvents(initialProps: VictoryBrushContainerProps): {
target: string;
eventHandlers: {
onMouseDown: (evt: any, targetProps: any) => {};
onTouchStart: (evt: any, targetProps: any) => {};
onGlobalMouseMove: (evt: any, targetProps: any) => {} | undefined;
onGlobalTouchMove: (evt: any, targetProps: any) => {} | undefined;
onGlobalMouseUp: (evt: any, targetProps: any) => {};
onGlobalTouchEnd: (evt: any, targetProps: any) => {};
onGlobalTouchCancel: (evt: any, targetProps: any) => {};
onMouseDown: VictoryEventHandler;
onTouchStart: VictoryEventHandler;
onGlobalMouseMove: VictoryEventHandler;
onGlobalTouchMove: VictoryEventHandler;
onGlobalMouseUp: VictoryEventHandler;
onGlobalTouchEnd: VictoryEventHandler;
onGlobalTouchCancel: VictoryEventHandler;
};
}[];
} & typeof VictoryContainer;
export {};
};
//# sourceMappingURL=victory-brush-container.d.ts.map
import _defaults from "lodash/defaults";
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
import React from "react";
import { VictoryContainer, Selection, Rect } from "victory-core";
import { Selection, Rect, VictoryContainer } from "victory-core";
import { BrushHelpers } from "./brush-helpers";
import isEqual from "react-fast-compare";
export function brushContainerMixin(Base) {
// @ts-expect-error "TS2545: A mixin class must have a constructor with a single rest parameter of type 'any[]'."
return class VictoryBrushContainer extends Base {
static displayName = "VictoryBrushContainer";
static defaultProps = {
...VictoryContainer.defaultProps,
allowDrag: true,
allowDraw: true,
allowResize: true,
brushComponent: /*#__PURE__*/React.createElement(Rect, null),
brushStyle: {
stroke: "transparent",
fill: "black",
fillOpacity: 0.1
},
handleComponent: /*#__PURE__*/React.createElement(Rect, null),
handleStyle: {
stroke: "transparent",
fill: "transparent"
},
handleWidth: 8,
mouseMoveThreshold: 0
export var VICTORY_BRUSH_CONTAINER_DEFAULT_PROPS = {
allowDrag: true,
allowDraw: true,
allowResize: true,
brushComponent: /*#__PURE__*/React.createElement(Rect, null),
brushStyle: {
stroke: "transparent",
fill: "black",
fillOpacity: 0.1
},
handleComponent: /*#__PURE__*/React.createElement(Rect, null),
handleStyle: {
stroke: "transparent",
fill: "transparent"
},
handleWidth: 8,
mouseMoveThreshold: 0
};
export var useVictoryBrushContainer = function (initialProps) {
var props = _objectSpread(_objectSpread({}, VICTORY_BRUSH_CONTAINER_DEFAULT_PROPS), initialProps);
var children = props.children;
var getSelectBox = function (coordinates) {
var x = coordinates.x,
y = coordinates.y;
var brushStyle = props.brushStyle,
brushComponent = props.brushComponent,
name = props.name;
var brushComponentStyle = brushComponent.props && brushComponent.props.style;
var cursor = !props.allowDrag && !props.allowResize ? "auto" : "move";
return x[0] !== x[1] && y[0] !== y[1] ? /*#__PURE__*/React.cloneElement(brushComponent, {
key: "".concat(name, "-brush"),
width: Math.abs(x[1] - x[0]) || 1,
height: Math.abs(y[1] - y[0]) || 1,
x: Math.min(x[0], x[1]),
y: Math.min(y[0], y[1]),
cursor: cursor,
style: _defaults({}, brushComponentStyle, brushStyle)
}) : null;
};
var getCursorPointers = function () {
var cursors = {
yProps: "ns-resize",
xProps: "ew-resize"
};
static defaultEvents = props => {
return [{
target: "parent",
eventHandlers: {
onMouseDown: (evt, targetProps) => {
return props.disable ? {} : BrushHelpers.onMouseDown(evt, targetProps);
},
onTouchStart: (evt, targetProps) => {
return props.disable ? {} : BrushHelpers.onMouseDown(evt, targetProps);
},
onGlobalMouseMove: (evt, targetProps) => {
return props.disable || !targetProps.isPanning && !targetProps.isSelecting ? {} : BrushHelpers.onGlobalMouseMove(evt, targetProps);
},
onGlobalTouchMove: (evt, targetProps) => {
return props.disable || !targetProps.isPanning && !targetProps.isSelecting ? {} : BrushHelpers.onGlobalMouseMove(evt, targetProps);
},
onGlobalMouseUp: (evt, targetProps) => {
return props.disable ? {} : BrushHelpers.onGlobalMouseUp(evt, targetProps);
},
onGlobalTouchEnd: (evt, targetProps) => {
return props.disable ? {} : BrushHelpers.onGlobalMouseUp(evt, targetProps);
},
onGlobalTouchCancel: (evt, targetProps) => {
return props.disable ? {} : BrushHelpers.onGlobalMouseUp(evt, targetProps);
}
}
}];
if (!props.allowResize && props.allowDrag) {
cursors.xProps = "move";
cursors.yProps = "move";
} else if (!props.allowResize && !props.allowDrag) {
cursors.xProps = "auto";
cursors.yProps = "auto";
}
return cursors;
};
var getHandles = function (domain) {
var handleWidth = props.handleWidth,
handleStyle = props.handleStyle,
handleComponent = props.handleComponent,
name = props.name;
var domainBox = BrushHelpers.getDomainBox(props, domain);
var x1 = domainBox.x1,
x2 = domainBox.x2,
y1 = domainBox.y1,
y2 = domainBox.y2;
var _BrushHelpers$getHand = BrushHelpers.getHandles(props, domainBox),
top = _BrushHelpers$getHand.top,
bottom = _BrushHelpers$getHand.bottom,
left = _BrushHelpers$getHand.left,
right = _BrushHelpers$getHand.right;
var width = Math.abs(x2 - x1) || 1;
var height = Math.abs(y2 - y1) || 1;
var handleComponentStyle = handleComponent.props && handleComponent.props.style || {};
var style = _defaults({}, handleComponentStyle, handleStyle);
var cursors = getCursorPointers();
var yProps = {
style: style,
width: width,
height: handleWidth,
cursor: cursors.yProps
};
getSelectBox(props, coordinates) {
const {
x,
y
} = coordinates;
const {
brushStyle,
brushComponent,
name
} = props;
const brushComponentStyle = brushComponent.props && brushComponent.props.style;
const cursor = !props.allowDrag && !props.allowResize ? "auto" : "move";
return x[0] !== x[1] && y[0] !== y[1] ? /*#__PURE__*/React.cloneElement(brushComponent, {
key: `${name}-brush`,
width: Math.abs(x[1] - x[0]) || 1,
height: Math.abs(y[1] - y[0]) || 1,
x: Math.min(x[0], x[1]),
y: Math.min(y[0], y[1]),
cursor,
style: _defaults({}, brushComponentStyle, brushStyle)
}) : null;
}
getCursorPointers(props) {
const cursors = {
yProps: "ns-resize",
xProps: "ew-resize"
};
if (!props.allowResize && props.allowDrag) {
cursors.xProps = "move";
cursors.yProps = "move";
} else if (!props.allowResize && !props.allowDrag) {
cursors.xProps = "auto";
cursors.yProps = "auto";
var xProps = {
style: style,
width: handleWidth,
height: height,
cursor: cursors.xProps
};
var handleProps = {
top: top && Object.assign({
x: top.x1,
y: top.y1
}, yProps),
bottom: bottom && Object.assign({
x: bottom.x1,
y: bottom.y1
}, yProps),
left: left && Object.assign({
y: left.y1,
x: left.x1
}, xProps),
right: right && Object.assign({
y: right.y1,
x: right.x1
}, xProps)
};
var handles = ["top", "bottom", "left", "right"].reduce(function (memo, curr) {
return handleProps[curr] ? memo.concat( /*#__PURE__*/React.cloneElement(handleComponent, Object.assign({
key: "".concat(name, "-handle-").concat(curr)
}, handleProps[curr]))) : memo;
}, []);
return handles.length ? handles : null;
};
var getRect = function () {
var currentDomain = props.currentDomain,
cachedBrushDomain = props.cachedBrushDomain;
var brushDomain = _defaults({}, props.brushDomain, props.domain);
var domain = isEqual(brushDomain, cachedBrushDomain) ? _defaults({}, currentDomain, brushDomain) : brushDomain;
var coordinates = Selection.getDomainCoordinates(props, domain);
var selectBox = getSelectBox(coordinates);
return selectBox ? [selectBox, getHandles(domain)] : [];
};
return {
props: props,
children: [].concat(_toConsumableArray(React.Children.toArray(children)), _toConsumableArray(getRect()))
};
};
export var VictoryBrushContainer = function (initialProps) {
var _useVictoryBrushConta = useVictoryBrushContainer(initialProps),
props = _useVictoryBrushConta.props,
children = _useVictoryBrushConta.children;
return /*#__PURE__*/React.createElement(VictoryContainer, props, children);
};
VictoryBrushContainer.role = "container";
VictoryBrushContainer.defaultEvents = function (initialProps) {
var props = _objectSpread(_objectSpread({}, VICTORY_BRUSH_CONTAINER_DEFAULT_PROPS), initialProps);
var createEventHandler = function (handler, isDisabled) {
return (// eslint-disable-next-line max-params
function (event, targetProps, eventKey, context) {
return props.disable || isDisabled !== null && isDisabled !== void 0 && isDisabled(targetProps) ? {} : handler(event, _objectSpread(_objectSpread({}, props), targetProps), eventKey, context);
}
return cursors;
}
getHandles(props, domain) {
const {
handleWidth,
handleStyle,
handleComponent,
name
} = props;
const domainBox = BrushHelpers.getDomainBox(props, domain);
const {
x1,
x2,
y1,
y2
} = domainBox;
const {
top,
bottom,
left,
right
} = BrushHelpers.getHandles(props, domainBox);
const width = Math.abs(x2 - x1) || 1;
const height = Math.abs(y2 - y1) || 1;
const handleComponentStyle = handleComponent.props && handleComponent.props.style || {};
const style = _defaults({}, handleComponentStyle, handleStyle);
const cursors = this.getCursorPointers(props);
const yProps = {
style,
width,
height: handleWidth,
cursor: cursors.yProps
};
const xProps = {
style,
width: handleWidth,
height,
cursor: cursors.xProps
};
const handleProps = {
top: top && Object.assign({
x: top.x1,
y: top.y1
}, yProps),
bottom: bottom && Object.assign({
x: bottom.x1,
y: bottom.y1
}, yProps),
left: left && Object.assign({
y: left.y1,
x: left.x1
}, xProps),
right: right && Object.assign({
y: right.y1,
x: right.x1
}, xProps)
};
const handles = ["top", "bottom", "left", "right"].reduce((memo, curr) => handleProps[curr] ? memo.concat( /*#__PURE__*/React.cloneElement(handleComponent, Object.assign({
key: `${name}-handle-${curr}`
}, handleProps[curr]))) : memo, []);
return handles.length ? handles : null;
}
getRect(props) {
const {
currentDomain,
cachedBrushDomain
} = props;
const brushDomain = _defaults({}, props.brushDomain, props.domain);
const domain = isEqual(brushDomain, cachedBrushDomain) ? _defaults({}, currentDomain, brushDomain) : brushDomain;
const coordinates = Selection.getDomainCoordinates(props, domain);
const selectBox = this.getSelectBox(props, coordinates);
return selectBox ? [selectBox, this.getHandles(props, domain)] : [];
}
);
};
// Overrides method in VictoryContainer
getChildren(props) {
return [...React.Children.toArray(props.children), ...this.getRect(props)];
return [{
target: "parent",
eventHandlers: {
onMouseDown: createEventHandler(BrushHelpers.onMouseDown),
onTouchStart: createEventHandler(BrushHelpers.onMouseDown),
onGlobalMouseMove: createEventHandler(BrushHelpers.onGlobalMouseMove, function (targetProps) {
return !targetProps.isPanning && !targetProps.isSelecting;
}),
onGlobalTouchMove: createEventHandler(BrushHelpers.onGlobalMouseMove, function (targetProps) {
return !targetProps.isPanning && !targetProps.isSelecting;
}),
onGlobalMouseUp: createEventHandler(BrushHelpers.onGlobalMouseUp),
onGlobalTouchEnd: createEventHandler(BrushHelpers.onGlobalMouseUp),
onGlobalTouchCancel: createEventHandler(BrushHelpers.onGlobalMouseUp)
}
};
}
export const VictoryBrushContainer = brushContainerMixin(VictoryContainer);
}];
};

@@ -62,4 +62,4 @@ /// <reference types="lodash" />

y1: number;
x2: number;
y2: number;
x2: any;
y2: any;
};

@@ -66,0 +66,0 @@ constrainPoint(point: any, fullDomainBox: any): {

@@ -7,59 +7,83 @@ "use strict";

exports.BrushHelpers = void 0;
var _mapValues2 = _interopRequireDefault(require("lodash/mapValues"));
var _defaults2 = _interopRequireDefault(require("lodash/defaults"));
var _throttle2 = _interopRequireDefault(require("lodash/throttle"));
var _victoryCore = require("victory-core");
var _reactFastCompare = _interopRequireDefault(require("react-fast-compare"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const Helpers = {
getDimension(props) {
const {
horizontal,
brushDimension
} = props;
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
var Helpers = {
getDimension: function (props) {
var horizontal = props.horizontal,
brushDimension = props.brushDimension;
if (!horizontal || !brushDimension) {
return brushDimension;
}
return brushDimension === "x" ? "y" : "x";
},
withinBounds(point, bounds, padding) {
const {
x1,
x2,
y1,
y2
} = (0, _mapValues2.default)(bounds, Number);
const {
x,
y
} = (0, _mapValues2.default)(point, Number);
const paddingValue = padding ? padding / 2 : 0;
withinBounds: function (point, bounds, padding) {
var _CoreHelpers$mapValue = _victoryCore.Helpers.mapValues(bounds, Number),
x1 = _CoreHelpers$mapValue.x1,
x2 = _CoreHelpers$mapValue.x2,
y1 = _CoreHelpers$mapValue.y1,
y2 = _CoreHelpers$mapValue.y2;
var _CoreHelpers$mapValue2 = _victoryCore.Helpers.mapValues(point, Number),
x = _CoreHelpers$mapValue2.x,
y = _CoreHelpers$mapValue2.y;
var paddingValue = padding ? padding / 2 : 0;
return x + paddingValue >= Math.min(x1, x2) && x - paddingValue <= Math.max(x1, x2) && y + paddingValue >= Math.min(y1, y2) && y - paddingValue <= Math.max(y1, y2);
},
getDomainBox(props, fullDomain, selectedDomain) {
const brushDimension = this.getDimension(props);
const fullDomainObject = (0, _defaults2.default)({}, fullDomain, props.domain);
const selectedDomainObject = (0, _defaults2.default)({}, selectedDomain, fullDomainObject);
const fullCoords = _victoryCore.Selection.getDomainCoordinates(props, fullDomainObject);
const selectedCoords = _victoryCore.Selection.getDomainCoordinates(props, selectedDomainObject);
getDomainBox: function (props, fullDomain, selectedDomain) {
var brushDimension = this.getDimension(props);
var fullDomainObject = (0, _defaults2.default)({}, fullDomain, props.domain);
var selectedDomainObject = (0, _defaults2.default)({}, selectedDomain, fullDomainObject);
var fullCoords = _victoryCore.Selection.getDomainCoordinates(props, fullDomainObject);
var selectedCoords = _victoryCore.Selection.getDomainCoordinates(props, selectedDomainObject);
return {
x1: brushDimension !== "y" ? Math.min(...selectedCoords.x) : Math.min(...fullCoords.x),
x2: brushDimension !== "y" ? Math.max(...selectedCoords.x) : Math.max(...fullCoords.x),
y1: brushDimension !== "x" ? Math.min(...selectedCoords.y) : Math.min(...fullCoords.y),
y2: brushDimension !== "x" ? Math.max(...selectedCoords.y) : Math.max(...fullCoords.y)
x1: brushDimension !== "y" ? Math.min.apply(Math, _toConsumableArray(selectedCoords.x)) : Math.min.apply(Math, _toConsumableArray(fullCoords.x)),
x2: brushDimension !== "y" ? Math.max.apply(Math, _toConsumableArray(selectedCoords.x)) : Math.max.apply(Math, _toConsumableArray(fullCoords.x)),
y1: brushDimension !== "x" ? Math.min.apply(Math, _toConsumableArray(selectedCoords.y)) : Math.min.apply(Math, _toConsumableArray(fullCoords.y)),
y2: brushDimension !== "x" ? Math.max.apply(Math, _toConsumableArray(selectedCoords.y)) : Math.max.apply(Math, _toConsumableArray(fullCoords.y))
};
},
getHandles(props, domainBox) {
const brushDimension = this.getDimension(props);
const {
x1,
x2,
y1,
y2
} = domainBox;
const minX = Math.min(x1, x2);
const maxX = Math.max(x1, x2);
const minY = Math.min(y1, y2);
const maxY = Math.max(y1, y2);
const handleWidth = props.handleWidth / 2;
getHandles: function (props, domainBox) {
var brushDimension = this.getDimension(props);
var x1 = domainBox.x1,
x2 = domainBox.x2,
y1 = domainBox.y1,
y2 = domainBox.y2;
var minX = Math.min(x1, x2);
var maxX = Math.max(x1, x2);
var minY = Math.min(y1, y2);
var maxY = Math.max(y1, y2);
var handleWidth = props.handleWidth / 2;
return {

@@ -69,4 +93,4 @@ left: brushDimension !== "y" && {

x2: minX + handleWidth,
y1,
y2
y1: y1,
y2: y2
},

@@ -76,8 +100,8 @@ right: brushDimension !== "y" && {

x2: maxX + handleWidth,
y1,
y2
y1: y1,
y2: y2
},
top: brushDimension !== "x" && {
x1,
x2,
x1: x1,
x2: x2,
y1: minY - handleWidth,

@@ -87,4 +111,4 @@ y2: minY + handleWidth

bottom: brushDimension !== "x" && {
x1,
x2,
x1: x1,
x2: x2,
y1: maxY - handleWidth,

@@ -95,20 +119,22 @@ y2: maxY + handleWidth

},
getActiveHandles(point, props, domainBox) {
const handles = this.getHandles(props, domainBox);
const activeHandles = ["top", "bottom", "left", "right"].reduce((memo, opt) => handles[opt] && this.withinBounds(point, handles[opt]) ? memo.concat(opt) : memo, []);
getActiveHandles: function (point, props, domainBox) {
var _this = this;
var handles = this.getHandles(props, domainBox);
var activeHandles = ["top", "bottom", "left", "right"].reduce(function (memo, opt) {
return handles[opt] && _this.withinBounds(point, handles[opt]) ? memo.concat(opt) : memo;
}, []);
return activeHandles.length && activeHandles;
},
getResizeMutation(box, handles) {
const {
x1,
y1,
x2,
y2
} = box;
const mutations = {
getResizeMutation: function (box, handles) {
var x1 = box.x1,
y1 = box.y1,
x2 = box.x2,
y2 = box.y2;
var mutations = {
left: {
x1: Math.max(x1, x2),
x2: Math.min(x1, x2),
y1,
y2
y1: y1,
y2: y2
},

@@ -118,4 +144,4 @@ right: {

x2: Math.max(x1, x2),
y1,
y2
y1: y1,
y2: y2
},

@@ -125,4 +151,4 @@ top: {

y2: Math.min(y1, y2),
x1,
x2
x1: x1,
x2: x2
},

@@ -132,11 +158,11 @@ bottom: {

y2: Math.max(y1, y2),
x1,
x2
x1: x1,
x2: x2
}
};
return handles.reduce((memo, current) => {
return handles.reduce(function (memo, current) {
return Object.assign(memo, mutations[current]);
}, {});
},
getMinimumDomain() {
getMinimumDomain: function () {
return {

@@ -147,11 +173,10 @@ x: [0, 1 / Number.MAX_SAFE_INTEGER],

},
getDefaultBrushArea(targetProps, cachedDomain, evt) {
const {
domain,
fullDomain,
scale,
horizontal,
allowResize
} = targetProps;
const defaultBrushArea = !allowResize && !targetProps.defaultBrushArea ? "move" : targetProps.defaultBrushArea;
getDefaultBrushArea: function (targetProps, cachedDomain, evt) {
var domain = targetProps.domain,
fullDomain = targetProps.fullDomain,
scale = targetProps.scale,
horizontal = targetProps.horizontal,
allowResize = targetProps.allowResize;
var defaultBrushArea = !allowResize && !targetProps.defaultBrushArea ? "move" : targetProps.defaultBrushArea;
if (defaultBrushArea === "none") {

@@ -162,32 +187,28 @@ return this.getMinimumDomain();

} else if (defaultBrushArea === "move") {
const brushBox = this.getDomainBox(targetProps, fullDomain, cachedDomain);
const parentSVG = targetProps.parentSVG || _victoryCore.Selection.getParentSVG(evt);
const pannedBox = this.panBox({
...targetProps,
...brushBox,
var brushBox = this.getDomainBox(targetProps, fullDomain, cachedDomain);
var parentSVG = targetProps.parentSVG || _victoryCore.Selection.getParentSVG(evt);
var pannedBox = this.panBox(_objectSpread(_objectSpread(_objectSpread({}, targetProps), brushBox), {}, {
brushDomain: cachedDomain,
startX: (brushBox.x1 + brushBox.x2) / 2,
startY: (brushBox.y1 + brushBox.y2) / 2
}, _victoryCore.Selection.getSVGEventCoordinates(evt, parentSVG));
const fullDomainBox = targetProps.fullDomainBox || this.getDomainBox(targetProps, fullDomain);
const constrainedBox = this.constrainBox(pannedBox, fullDomainBox);
return _victoryCore.Selection.getBounds({
...constrainedBox,
scale,
horizontal
});
}), _victoryCore.Selection.getSVGEventCoordinates(evt, parentSVG));
var fullDomainBox = targetProps.fullDomainBox || this.getDomainBox(targetProps, fullDomain);
var constrainedBox = this.constrainBox(pannedBox, fullDomainBox);
return _victoryCore.Selection.getBounds(_objectSpread(_objectSpread({}, constrainedBox), {}, {
scale: scale,
horizontal: horizontal
}));
}
return domain;
},
getSelectionMutation(point, box, brushDimension) {
const {
x,
y
} = point;
const {
x1,
x2,
y1,
y2
} = box;
getSelectionMutation: function (point, box, brushDimension) {
var x = point.x,
y = point.y;
var x1 = box.x1,
x2 = box.x2,
y1 = box.y1,
y2 = box.y2;
return {

@@ -200,22 +221,19 @@ x1: brushDimension !== "y" ? x : x1,

},
panBox(props, point) {
const {
domain,
startX,
startY
} = props;
const brushDimension = this.getDimension(props);
const brushDomain = (0, _defaults2.default)({}, props.brushDomain, domain);
const fullDomain = (0, _defaults2.default)({}, props.fullDomain, domain);
const {
x1,
x2,
y1,
y2
} = props.x1 ? props : this.getDomainBox(props, fullDomain, brushDomain);
const {
x,
y
} = point;
const delta = {
panBox: function (props, point) {
var domain = props.domain,
startX = props.startX,
startY = props.startY;
var brushDimension = this.getDimension(props);
var brushDomain = (0, _defaults2.default)({}, props.brushDomain, domain);
var fullDomain = (0, _defaults2.default)({}, props.fullDomain, domain);
var _ref = props.x1 ? props : this.getDomainBox(props, fullDomain, brushDomain),
x1 = _ref.x1,
x2 = _ref.x2,
y1 = _ref.y1,
y2 = _ref.y2;
var x = point.x,
y = point.y;
var delta = {
x: startX ? startX - x : 0,

@@ -231,9 +249,9 @@ y: startY ? startY - y : 0

},
constrainBox(box, fullDomainBox) {
const {
x1,
y1,
x2,
y2
} = (0, _mapValues2.default)(fullDomainBox, Number);
constrainBox: function (box, fullDomainBox) {
var _CoreHelpers$mapValue3 = _victoryCore.Helpers.mapValues(fullDomainBox, Number),
x1 = _CoreHelpers$mapValue3.x1,
y1 = _CoreHelpers$mapValue3.y1,
x2 = _CoreHelpers$mapValue3.x2,
y2 = _CoreHelpers$mapValue3.y2;
return {

@@ -246,9 +264,9 @@ x1: box.x2 > x2 ? x2 - Math.abs(box.x2 - box.x1) : Math.max(box.x1, x1),

},
constrainPoint(point, fullDomainBox) {
const {
x1,
y1,
x2,
y2
} = (0, _mapValues2.default)(fullDomainBox, Number);
constrainPoint: function (point, fullDomainBox) {
var _CoreHelpers$mapValue4 = _victoryCore.Helpers.mapValues(fullDomainBox, Number),
x1 = _CoreHelpers$mapValue4.x1,
y1 = _CoreHelpers$mapValue4.y1,
x2 = _CoreHelpers$mapValue4.x2,
y2 = _CoreHelpers$mapValue4.y2;
return {

@@ -259,18 +277,19 @@ x: Math.min(Math.max(point.x, x1), x2),

},
hasMoved(props) {
const {
x1,
x2,
y1,
y2,
mouseMoveThreshold
} = props;
const brushDimension = this.getDimension(props);
const xMoved = Math.abs(x1 - x2) >= mouseMoveThreshold;
const yMoved = Math.abs(y1 - y2) >= mouseMoveThreshold;
hasMoved: function (props) {
var x1 = props.x1,
x2 = props.x2,
y1 = props.y1,
y2 = props.y2,
mouseMoveThreshold = props.mouseMoveThreshold;
var brushDimension = this.getDimension(props);
var xMoved = Math.abs(x1 - x2) >= mouseMoveThreshold;
var yMoved = Math.abs(y1 - y2) >= mouseMoveThreshold;
switch (brushDimension) {
case "x":
return xMoved;
case "y":
return yMoved;
default:

@@ -281,57 +300,60 @@ return xMoved || yMoved;

// eslint-disable-next-line max-statements, complexity
onMouseDown(evt, targetProps) {
onMouseDown: function (evt, targetProps) {
var _this2 = this;
evt.preventDefault();
const {
handleWidth,
cachedBrushDomain,
domain,
allowResize,
allowDrag,
allowDraw
} = targetProps;
const brushDimension = this.getDimension(targetProps);
const defaultBrushArea = !allowResize && !targetProps.defaultBrushArea ? "move" : targetProps.defaultBrushArea;
// Don't trigger events for static brushes
var handleWidth = targetProps.handleWidth,
cachedBrushDomain = targetProps.cachedBrushDomain,
domain = targetProps.domain,
allowResize = targetProps.allowResize,
allowDrag = targetProps.allowDrag,
allowDraw = targetProps.allowDraw;
var brushDimension = this.getDimension(targetProps);
var defaultBrushArea = !allowResize && !targetProps.defaultBrushArea ? "move" : targetProps.defaultBrushArea; // Don't trigger events for static brushes
if (!allowResize && !allowDrag) {
return {};
}
const fullDomainBox = targetProps.fullDomainBox || this.getDomainBox(targetProps, domain);
const parentSVG = targetProps.parentSVG || _victoryCore.Selection.getParentSVG(evt);
const {
x,
y
} = _victoryCore.Selection.getSVGEventCoordinates(evt, parentSVG);
// Ignore events that occur outside of the maximum domain region
var fullDomainBox = targetProps.fullDomainBox || this.getDomainBox(targetProps, domain);
var parentSVG = targetProps.parentSVG || _victoryCore.Selection.getParentSVG(evt);
var _Selection$getSVGEven = _victoryCore.Selection.getSVGEventCoordinates(evt, parentSVG),
x = _Selection$getSVGEven.x,
y = _Selection$getSVGEven.y; // Ignore events that occur outside of the maximum domain region
if (!this.withinBounds({
x,
y
x: x,
y: y
}, fullDomainBox, handleWidth)) {
return {};
}
const brushDomain = (0, _defaults2.default)({}, targetProps.brushDomain, domain);
const currentDomain = (0, _reactFastCompare.default)(brushDomain, cachedBrushDomain) ? targetProps.currentDomain || brushDomain || domain : brushDomain || domain;
const domainBox = this.getDomainBox(targetProps, domain, currentDomain);
const activeHandles = allowResize && this.getActiveHandles({
x,
y
}, targetProps, domainBox);
// If the event occurs in any of the handle regions, start a resize
var brushDomain = (0, _defaults2.default)({}, targetProps.brushDomain, domain);
var currentDomain = (0, _reactFastCompare.default)(brushDomain, cachedBrushDomain) ? targetProps.currentDomain || brushDomain || domain : brushDomain || domain;
var domainBox = this.getDomainBox(targetProps, domain, currentDomain);
var activeHandles = allowResize && this.getActiveHandles({
x: x,
y: y
}, targetProps, domainBox); // If the event occurs in any of the handle regions, start a resize
if (activeHandles) {
return [{
target: "parent",
mutation: () => {
return {
mutation: function () {
return _objectSpread({
isSelecting: true,
domainBox,
fullDomainBox,
domainBox: domainBox,
fullDomainBox: fullDomainBox,
cachedBrushDomain: brushDomain,
currentDomain,
parentSVG,
...this.getResizeMutation(domainBox, activeHandles)
};
currentDomain: currentDomain,
parentSVG: parentSVG
}, _this2.getResizeMutation(domainBox, activeHandles));
}
}];
} else if (this.withinBounds({
x,
y
x: x,
y: y
}, domainBox) && !(0, _reactFastCompare.default)(domain, currentDomain)) {

@@ -342,160 +364,171 @@ // if the event occurs within a selected region start a panning event, unless the whole

target: "parent",
mutation: () => ({
isPanning: allowDrag,
startX: x,
startY: y,
domainBox,
fullDomainBox,
currentDomain,
cachedBrushDomain: brushDomain,
parentSVG,
...domainBox // set x1, x2, y1, y2
})
mutation: function () {
return _objectSpread({
isPanning: allowDrag,
startX: x,
startY: y,
domainBox: domainBox,
fullDomainBox: fullDomainBox,
currentDomain: currentDomain,
cachedBrushDomain: brushDomain,
parentSVG: parentSVG
}, domainBox);
}
}];
}
// if the event occurs outside the region, or if the whole domain is selected,
} // if the event occurs outside the region, or if the whole domain is selected,
// start a new selection
return allowDraw ? [{
target: "parent",
mutation: () => ({
isSelecting: allowResize || defaultBrushArea === "move",
domainBox,
fullDomainBox,
parentSVG,
cachedBrushDomain: brushDomain,
cachedCurrentDomain: currentDomain,
currentDomain: this.getMinimumDomain(),
...this.getSelectionMutation({
x,
y
}, domainBox, brushDimension)
})
mutation: function () {
return _objectSpread({
isSelecting: allowResize || defaultBrushArea === "move",
domainBox: domainBox,
fullDomainBox: fullDomainBox,
parentSVG: parentSVG,
cachedBrushDomain: brushDomain,
cachedCurrentDomain: currentDomain,
currentDomain: _this2.getMinimumDomain()
}, _this2.getSelectionMutation({
x: x,
y: y
}, domainBox, brushDimension));
}
}] : {};
},
// eslint-disable-next-line max-statements, complexity
onGlobalMouseMove(evt, targetProps) {
const {
scale,
isPanning,
isSelecting,
fullDomainBox,
onBrushDomainChange,
allowResize,
allowDrag,
horizontal,
mouseMoveThreshold,
parentSVG
} = targetProps;
const brushDimension = this.getDimension(targetProps);
const {
x,
y
} = _victoryCore.Selection.getSVGEventCoordinates(evt, parentSVG);
if (!allowResize && !allowDrag || mouseMoveThreshold > 0 && !this.hasMoved({
...targetProps,
onGlobalMouseMove: function (evt, targetProps) {
var scale = targetProps.scale,
isPanning = targetProps.isPanning,
isSelecting = targetProps.isSelecting,
fullDomainBox = targetProps.fullDomainBox,
onBrushDomainChange = targetProps.onBrushDomainChange,
allowResize = targetProps.allowResize,
allowDrag = targetProps.allowDrag,
horizontal = targetProps.horizontal,
mouseMoveThreshold = targetProps.mouseMoveThreshold,
parentSVG = targetProps.parentSVG;
var brushDimension = this.getDimension(targetProps);
var _Selection$getSVGEven2 = _victoryCore.Selection.getSVGEventCoordinates(evt, parentSVG),
x = _Selection$getSVGEven2.x,
y = _Selection$getSVGEven2.y;
if (!allowResize && !allowDrag || mouseMoveThreshold > 0 && !this.hasMoved(_objectSpread(_objectSpread({}, targetProps), {}, {
x2: x,
y2: y
})) {
}))) {
return {};
}
if (allowDrag && isPanning) {
const {
startX,
startY
} = targetProps;
const pannedBox = this.panBox(targetProps, {
x,
y
var startX = targetProps.startX,
startY = targetProps.startY;
var pannedBox = this.panBox(targetProps, {
x: x,
y: y
});
const constrainedBox = this.constrainBox(pannedBox, fullDomainBox);
const currentDomain = _victoryCore.Selection.getBounds({
...constrainedBox,
scale,
horizontal
});
const mutatedProps = {
currentDomain,
parentSVG,
var constrainedBox = this.constrainBox(pannedBox, fullDomainBox);
var currentDomain = _victoryCore.Selection.getBounds(_objectSpread(_objectSpread({}, constrainedBox), {}, {
scale: scale,
horizontal: horizontal
}));
var mutatedProps = _objectSpread({
currentDomain: currentDomain,
parentSVG: parentSVG,
startX: pannedBox.x2 >= fullDomainBox.x2 || pannedBox.x1 <= fullDomainBox.x1 ? startX : x,
startY: pannedBox.y2 >= fullDomainBox.y2 || pannedBox.y1 <= fullDomainBox.y1 ? startY : y,
...constrainedBox
};
startY: pannedBox.y2 >= fullDomainBox.y2 || pannedBox.y1 <= fullDomainBox.y1 ? startY : y
}, constrainedBox);
if (_victoryCore.Helpers.isFunction(onBrushDomainChange)) {
onBrushDomainChange(currentDomain, (0, _defaults2.default)({}, mutatedProps, targetProps));
}
return [{
target: "parent",
mutation: () => mutatedProps
mutation: function () {
return mutatedProps;
}
}];
} else if (allowResize && isSelecting) {
const {
x: x2,
y: y2
} = this.constrainPoint({
var _this$constrainPoint = this.constrainPoint({
x: brushDimension !== "y" ? x : targetProps.x2,
y: brushDimension !== "x" ? y : targetProps.y2
}, fullDomainBox);
const currentDomain = _victoryCore.Selection.getBounds({
x2,
y2,
}, fullDomainBox),
x2 = _this$constrainPoint.x,
y2 = _this$constrainPoint.y;
var _currentDomain = _victoryCore.Selection.getBounds({
x2: x2,
y2: y2,
x1: targetProps.x1,
y1: targetProps.y1,
scale,
horizontal
scale: scale,
horizontal: horizontal
});
const mutatedProps = {
x2,
y2,
currentDomain,
parentSVG
var _mutatedProps = {
x2: x2,
y2: y2,
currentDomain: _currentDomain,
parentSVG: parentSVG
};
if (_victoryCore.Helpers.isFunction(onBrushDomainChange)) {
onBrushDomainChange(currentDomain, (0, _defaults2.default)({}, mutatedProps, targetProps));
onBrushDomainChange(_currentDomain, (0, _defaults2.default)({}, _mutatedProps, targetProps));
}
return [{
target: "parent",
mutation: () => mutatedProps
mutation: function () {
return _mutatedProps;
}
}];
}
return {};
},
// eslint-disable-next-line complexity
onGlobalMouseUp(evt, targetProps) {
onGlobalMouseUp: function (evt, targetProps) {
// if a panning or selection has not been started, ignore the event
if (!targetProps.isPanning && !targetProps.isSelecting) {
return {};
}
// eslint-disable-line max-statements, complexity
const {
x1,
y1,
x2,
y2,
isPanning,
isSelecting,
onBrushDomainChange,
onBrushDomainChangeEnd,
onBrushCleared,
currentDomain,
allowResize,
allowDrag
} = targetProps;
const defaultBrushArea = !allowResize && !targetProps.defaultBrushArea ? "move" : targetProps.defaultBrushArea;
const defaultBrushHasArea = defaultBrushArea !== undefined && defaultBrushArea !== "none";
const mutatedProps = {
} // eslint-disable-line max-statements, complexity
var x1 = targetProps.x1,
y1 = targetProps.y1,
x2 = targetProps.x2,
y2 = targetProps.y2,
isPanning = targetProps.isPanning,
isSelecting = targetProps.isSelecting,
onBrushDomainChange = targetProps.onBrushDomainChange,
onBrushDomainChangeEnd = targetProps.onBrushDomainChangeEnd,
onBrushCleared = targetProps.onBrushCleared,
currentDomain = targetProps.currentDomain,
allowResize = targetProps.allowResize,
allowDrag = targetProps.allowDrag;
var defaultBrushArea = !allowResize && !targetProps.defaultBrushArea ? "move" : targetProps.defaultBrushArea;
var defaultBrushHasArea = defaultBrushArea !== undefined && defaultBrushArea !== "none";
var mutatedProps = {
isPanning: false,
isSelecting: false
};
}; // if the mouse hasn't moved since a mouseDown event, select the default brush area
// if the mouse hasn't moved since a mouseDown event, select the default brush area
if ((allowResize || defaultBrushHasArea) && (x1 === x2 || y1 === y2)) {
const cachedDomain = targetProps.cachedCurrentDomain || currentDomain;
const defaultDomain = this.getDefaultBrushArea(targetProps, cachedDomain, evt);
var cachedDomain = targetProps.cachedCurrentDomain || currentDomain;
var defaultDomain = this.getDefaultBrushArea(targetProps, cachedDomain, evt);
mutatedProps.currentDomain = defaultDomain;
if (_victoryCore.Helpers.isFunction(onBrushDomainChange)) {
onBrushDomainChange(defaultDomain, (0, _defaults2.default)({}, mutatedProps, targetProps));
}
if (_victoryCore.Helpers.isFunction(onBrushDomainChangeEnd)) {
onBrushDomainChangeEnd(defaultDomain, (0, _defaults2.default)({}, mutatedProps, targetProps));
}
if (_victoryCore.Helpers.isFunction(onBrushCleared)) {

@@ -509,14 +542,16 @@ onBrushCleared(defaultDomain, (0, _defaults2.default)({}, mutatedProps, targetProps));

}
return [{
target: "parent",
mutation: () => mutatedProps
mutation: function () {
return mutatedProps;
}
}];
}
};
const BrushHelpers = exports.BrushHelpers = {
...Helpers,
var BrushHelpers = _objectSpread(_objectSpread({}, Helpers), {}, {
onMouseDown: Helpers.onMouseDown.bind(Helpers),
onGlobalMouseUp: Helpers.onGlobalMouseUp.bind(Helpers),
onGlobalMouseMove: (0, _throttle2.default)(Helpers.onGlobalMouseMove.bind(Helpers), 16,
// eslint-disable-line no-magic-numbers
onGlobalMouseMove: (0, _throttle2.default)(Helpers.onGlobalMouseMove.bind(Helpers), 16, // eslint-disable-line no-magic-numbers
{

@@ -526,2 +561,4 @@ leading: true,

})
};
});
exports.BrushHelpers = BrushHelpers;

@@ -6,3 +6,5 @@ "use strict";

});
var _victoryBrushContainer = require("./victory-brush-container");
Object.keys(_victoryBrushContainer).forEach(function (key) {

@@ -18,3 +20,5 @@ if (key === "default" || key === "__esModule") return;

});
var _brushHelpers = require("./brush-helpers");
Object.keys(_brushHelpers).forEach(function (key) {

@@ -21,0 +25,0 @@ if (key === "default" || key === "__esModule") return;

import React from "react";
import { VictoryContainer, DomainTuple, VictoryContainerProps } from "victory-core";
import { DomainTuple, VictoryContainerProps, VictoryEventHandler } from "victory-core";
export interface VictoryBrushContainerProps extends VictoryContainerProps {

@@ -32,55 +32,34 @@ allowDrag?: boolean;

}
declare type ComponentClass<TProps> = {
new (props: TProps): React.Component<TProps>;
export declare const VICTORY_BRUSH_CONTAINER_DEFAULT_PROPS: {
allowDrag: boolean;
allowDraw: boolean;
allowResize: boolean;
brushComponent: JSX.Element;
brushStyle: {
stroke: string;
fill: string;
fillOpacity: number;
};
handleComponent: JSX.Element;
handleStyle: {
stroke: string;
fill: string;
};
handleWidth: number;
mouseMoveThreshold: number;
};
export declare function brushContainerMixin<TBase extends ComponentClass<TProps>, TProps extends VictoryBrushContainerProps>(Base: TBase): {
new (props: TProps): {
getSelectBox(props: any, coordinates: any): React.DetailedReactHTMLElement<{
key: string;
width: number;
height: number;
x: number;
y: number;
cursor: string;
style: any;
}, HTMLElement> | null;
getCursorPointers(props: any): {
yProps: string;
xProps: string;
export declare const useVictoryBrushContainer: (initialProps: VictoryBrushContainerProps) => {
props: {
domain: {
x: DomainTuple;
y: DomainTuple;
};
getHandles(props: any, domain: any): React.ReactElement<any, string | React.JSXElementConstructor<any>>[] | null;
getRect(props: any): (React.ReactElement<any, string | React.JSXElementConstructor<any>>[] | React.DetailedReactHTMLElement<{
key: string;
width: number;
height: number;
x: number;
y: number;
cursor: string;
style: any;
}, HTMLElement> | null)[];
getChildren(props: any): (string | number | React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactFragment | null)[];
context: unknown;
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<TProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
forceUpdate(callback?: (() => void) | undefined): void;
render(): React.ReactNode;
readonly props: Readonly<TProps>;
state: Readonly<{}>;
refs: {
[key: string]: React.ReactInstance;
};
componentDidMount?(): void;
shouldComponentUpdate?(nextProps: Readonly<TProps>, nextState: Readonly<{}>, nextContext: any): boolean;
componentWillUnmount?(): void;
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
getSnapshotBeforeUpdate?(prevProps: Readonly<TProps>, prevState: Readonly<{}>): any;
componentDidUpdate?(prevProps: Readonly<TProps>, prevState: Readonly<{}>, snapshot?: any): void;
componentWillMount?(): void;
UNSAFE_componentWillMount?(): void;
componentWillReceiveProps?(nextProps: Readonly<TProps>, nextContext: any): void;
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<TProps>, nextContext: any): void;
componentWillUpdate?(nextProps: Readonly<TProps>, nextState: Readonly<{}>, nextContext: any): void;
UNSAFE_componentWillUpdate?(nextProps: Readonly<TProps>, nextState: Readonly<{}>, nextContext: any): void;
};
displayName: string;
defaultProps: {
currentDomain: {
x: DomainTuple;
y: DomainTuple;
} | undefined;
cachedBrushDomain: {
x: DomainTuple;
y: DomainTuple;
} | undefined;
allowDrag: boolean;

@@ -90,3 +69,8 @@ allowDraw: boolean;

brushComponent: JSX.Element;
brushStyle: {
brushDimension?: "x" | "y" | undefined;
brushDomain?: {
x?: DomainTuple | undefined;
y?: DomainTuple | undefined;
} | undefined;
brushStyle: React.CSSProperties | {
stroke: string;

@@ -96,4 +80,6 @@ fill: string;

};
defaultBrushArea?: "move" | "none" | "disable" | "all" | undefined;
disable?: boolean | undefined;
handleComponent: JSX.Element;
handleStyle: {
handleStyle: React.CSSProperties | {
stroke: string;

@@ -103,108 +89,63 @@ fill: string;

handleWidth: number;
onBrushCleared?: ((domain: {
x: DomainTuple;
y: DomainTuple;
}, props: VictoryBrushContainerProps) => void) | undefined;
onBrushDomainChange?: ((domain: {
x: DomainTuple;
y: DomainTuple;
}, props: VictoryBrushContainerProps) => void) | undefined;
onBrushDomainChangeEnd?: ((domain: {
x: DomainTuple;
y: DomainTuple;
}, props: VictoryBrushContainerProps) => void) | undefined;
"aria-describedby"?: string | undefined;
"aria-labelledby"?: string | undefined;
children?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactElement<any, string | React.JSXElementConstructor<any>>[] | undefined;
className?: string | undefined;
containerId?: string | number | undefined;
containerRef?: React.Ref<HTMLElement> | undefined;
desc?: string | undefined;
events?: React.DOMAttributes<any> | undefined;
height?: number | undefined;
name?: string | undefined;
origin?: import("victory-core").OriginType | undefined;
polar?: boolean | undefined;
portalComponent?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
portalZIndex?: number | undefined;
preserveAspectRatio?: string | undefined;
responsive?: boolean | undefined;
role?: string | undefined;
scale?: {
x?: import("victory-core").D3Scale<any> | undefined;
y?: import("victory-core").D3Scale<any> | undefined;
} | undefined;
style?: React.CSSProperties | undefined;
tabIndex?: number | undefined;
theme?: import("victory-core").VictoryThemeDefinition | undefined;
title?: string | undefined;
width?: number | undefined;
ouiaId?: string | number | undefined;
ouiaSafe?: boolean | undefined;
ouiaType?: string | undefined;
mouseMoveThreshold: number;
className: string;
portalComponent: JSX.Element;
portalZIndex: number;
responsive: boolean;
role: string;
};
defaultEvents: (props: any) => {
target: string;
eventHandlers: {
onMouseDown: (evt: any, targetProps: any) => {};
onTouchStart: (evt: any, targetProps: any) => {};
onGlobalMouseMove: (evt: any, targetProps: any) => {} | undefined;
onGlobalTouchMove: (evt: any, targetProps: any) => {} | undefined;
onGlobalMouseUp: (evt: any, targetProps: any) => {};
onGlobalTouchEnd: (evt: any, targetProps: any) => {};
onGlobalTouchCancel: (evt: any, targetProps: any) => {};
};
}[];
} & TBase;
children: React.ReactElement<any, string | React.JSXElementConstructor<any>>[];
};
export declare const VictoryBrushContainer: {
new (props: VictoryBrushContainerProps): {
getSelectBox(props: any, coordinates: any): React.DetailedReactHTMLElement<{
key: string;
width: number;
height: number;
x: number;
y: number;
cursor: string;
style: any;
}, HTMLElement> | null;
getCursorPointers(props: any): {
yProps: string;
xProps: string;
};
getHandles(props: any, domain: any): React.ReactElement<any, string | React.JSXElementConstructor<any>>[] | null;
getRect(props: any): (React.ReactElement<any, string | React.JSXElementConstructor<any>>[] | React.DetailedReactHTMLElement<{
key: string;
width: number;
height: number;
x: number;
y: number;
cursor: string;
style: any;
}, HTMLElement> | null)[];
getChildren(props: any): (string | number | React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactFragment | null)[];
context: unknown;
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<VictoryBrushContainerProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
forceUpdate(callback?: (() => void) | undefined): void;
render(): React.ReactNode;
readonly props: Readonly<VictoryBrushContainerProps>;
state: Readonly<{}>;
refs: {
[key: string]: React.ReactInstance;
};
componentDidMount?(): void;
shouldComponentUpdate?(nextProps: Readonly<VictoryBrushContainerProps>, nextState: Readonly<{}>, nextContext: any): boolean;
componentWillUnmount?(): void;
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
getSnapshotBeforeUpdate?(prevProps: Readonly<VictoryBrushContainerProps>, prevState: Readonly<{}>): any;
componentDidUpdate?(prevProps: Readonly<VictoryBrushContainerProps>, prevState: Readonly<{}>, snapshot?: any): void;
componentWillMount?(): void;
UNSAFE_componentWillMount?(): void;
componentWillReceiveProps?(nextProps: Readonly<VictoryBrushContainerProps>, nextContext: any): void;
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<VictoryBrushContainerProps>, nextContext: any): void;
componentWillUpdate?(nextProps: Readonly<VictoryBrushContainerProps>, nextState: Readonly<{}>, nextContext: any): void;
UNSAFE_componentWillUpdate?(nextProps: Readonly<VictoryBrushContainerProps>, nextState: Readonly<{}>, nextContext: any): void;
};
displayName: string;
defaultProps: {
allowDrag: boolean;
allowDraw: boolean;
allowResize: boolean;
brushComponent: JSX.Element;
brushStyle: {
stroke: string;
fill: string;
fillOpacity: number;
};
handleComponent: JSX.Element;
handleStyle: {
stroke: string;
fill: string;
};
handleWidth: number;
mouseMoveThreshold: number;
className: string;
portalComponent: JSX.Element;
portalZIndex: number;
responsive: boolean;
role: string;
};
defaultEvents: (props: any) => {
(initialProps: VictoryBrushContainerProps): JSX.Element;
role: string;
defaultEvents(initialProps: VictoryBrushContainerProps): {
target: string;
eventHandlers: {
onMouseDown: (evt: any, targetProps: any) => {};
onTouchStart: (evt: any, targetProps: any) => {};
onGlobalMouseMove: (evt: any, targetProps: any) => {} | undefined;
onGlobalTouchMove: (evt: any, targetProps: any) => {} | undefined;
onGlobalMouseUp: (evt: any, targetProps: any) => {};
onGlobalTouchEnd: (evt: any, targetProps: any) => {};
onGlobalTouchCancel: (evt: any, targetProps: any) => {};
onMouseDown: VictoryEventHandler;
onTouchStart: VictoryEventHandler;
onGlobalMouseMove: VictoryEventHandler;
onGlobalTouchMove: VictoryEventHandler;
onGlobalMouseUp: VictoryEventHandler;
onGlobalTouchEnd: VictoryEventHandler;
onGlobalTouchCancel: VictoryEventHandler;
};
}[];
} & typeof VictoryContainer;
export {};
};
//# sourceMappingURL=victory-brush-container.d.ts.map

@@ -6,175 +6,215 @@ "use strict";

});
exports.VictoryBrushContainer = void 0;
exports.brushContainerMixin = brushContainerMixin;
exports.useVictoryBrushContainer = exports.VictoryBrushContainer = exports.VICTORY_BRUSH_CONTAINER_DEFAULT_PROPS = void 0;
var _defaults2 = _interopRequireDefault(require("lodash/defaults"));
var _react = _interopRequireDefault(require("react"));
var _victoryCore = require("victory-core");
var _brushHelpers = require("./brush-helpers");
var _reactFastCompare = _interopRequireDefault(require("react-fast-compare"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function brushContainerMixin(Base) {
// @ts-expect-error "TS2545: A mixin class must have a constructor with a single rest parameter of type 'any[]'."
return class VictoryBrushContainer extends Base {
static displayName = "VictoryBrushContainer";
static defaultProps = {
..._victoryCore.VictoryContainer.defaultProps,
allowDrag: true,
allowDraw: true,
allowResize: true,
brushComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.Rect, null),
brushStyle: {
stroke: "transparent",
fill: "black",
fillOpacity: 0.1
},
handleComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.Rect, null),
handleStyle: {
stroke: "transparent",
fill: "transparent"
},
handleWidth: 8,
mouseMoveThreshold: 0
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var VICTORY_BRUSH_CONTAINER_DEFAULT_PROPS = {
allowDrag: true,
allowDraw: true,
allowResize: true,
brushComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.Rect, null),
brushStyle: {
stroke: "transparent",
fill: "black",
fillOpacity: 0.1
},
handleComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.Rect, null),
handleStyle: {
stroke: "transparent",
fill: "transparent"
},
handleWidth: 8,
mouseMoveThreshold: 0
};
exports.VICTORY_BRUSH_CONTAINER_DEFAULT_PROPS = VICTORY_BRUSH_CONTAINER_DEFAULT_PROPS;
var useVictoryBrushContainer = function (initialProps) {
var props = _objectSpread(_objectSpread({}, VICTORY_BRUSH_CONTAINER_DEFAULT_PROPS), initialProps);
var children = props.children;
var getSelectBox = function (coordinates) {
var x = coordinates.x,
y = coordinates.y;
var brushStyle = props.brushStyle,
brushComponent = props.brushComponent,
name = props.name;
var brushComponentStyle = brushComponent.props && brushComponent.props.style;
var cursor = !props.allowDrag && !props.allowResize ? "auto" : "move";
return x[0] !== x[1] && y[0] !== y[1] ? /*#__PURE__*/_react.default.cloneElement(brushComponent, {
key: "".concat(name, "-brush"),
width: Math.abs(x[1] - x[0]) || 1,
height: Math.abs(y[1] - y[0]) || 1,
x: Math.min(x[0], x[1]),
y: Math.min(y[0], y[1]),
cursor: cursor,
style: (0, _defaults2.default)({}, brushComponentStyle, brushStyle)
}) : null;
};
var getCursorPointers = function () {
var cursors = {
yProps: "ns-resize",
xProps: "ew-resize"
};
static defaultEvents = props => {
return [{
target: "parent",
eventHandlers: {
onMouseDown: (evt, targetProps) => {
return props.disable ? {} : _brushHelpers.BrushHelpers.onMouseDown(evt, targetProps);
},
onTouchStart: (evt, targetProps) => {
return props.disable ? {} : _brushHelpers.BrushHelpers.onMouseDown(evt, targetProps);
},
onGlobalMouseMove: (evt, targetProps) => {
return props.disable || !targetProps.isPanning && !targetProps.isSelecting ? {} : _brushHelpers.BrushHelpers.onGlobalMouseMove(evt, targetProps);
},
onGlobalTouchMove: (evt, targetProps) => {
return props.disable || !targetProps.isPanning && !targetProps.isSelecting ? {} : _brushHelpers.BrushHelpers.onGlobalMouseMove(evt, targetProps);
},
onGlobalMouseUp: (evt, targetProps) => {
return props.disable ? {} : _brushHelpers.BrushHelpers.onGlobalMouseUp(evt, targetProps);
},
onGlobalTouchEnd: (evt, targetProps) => {
return props.disable ? {} : _brushHelpers.BrushHelpers.onGlobalMouseUp(evt, targetProps);
},
onGlobalTouchCancel: (evt, targetProps) => {
return props.disable ? {} : _brushHelpers.BrushHelpers.onGlobalMouseUp(evt, targetProps);
}
}
}];
if (!props.allowResize && props.allowDrag) {
cursors.xProps = "move";
cursors.yProps = "move";
} else if (!props.allowResize && !props.allowDrag) {
cursors.xProps = "auto";
cursors.yProps = "auto";
}
return cursors;
};
var getHandles = function (domain) {
var handleWidth = props.handleWidth,
handleStyle = props.handleStyle,
handleComponent = props.handleComponent,
name = props.name;
var domainBox = _brushHelpers.BrushHelpers.getDomainBox(props, domain);
var x1 = domainBox.x1,
x2 = domainBox.x2,
y1 = domainBox.y1,
y2 = domainBox.y2;
var _BrushHelpers$getHand = _brushHelpers.BrushHelpers.getHandles(props, domainBox),
top = _BrushHelpers$getHand.top,
bottom = _BrushHelpers$getHand.bottom,
left = _BrushHelpers$getHand.left,
right = _BrushHelpers$getHand.right;
var width = Math.abs(x2 - x1) || 1;
var height = Math.abs(y2 - y1) || 1;
var handleComponentStyle = handleComponent.props && handleComponent.props.style || {};
var style = (0, _defaults2.default)({}, handleComponentStyle, handleStyle);
var cursors = getCursorPointers();
var yProps = {
style: style,
width: width,
height: handleWidth,
cursor: cursors.yProps
};
getSelectBox(props, coordinates) {
const {
x,
y
} = coordinates;
const {
brushStyle,
brushComponent,
name
} = props;
const brushComponentStyle = brushComponent.props && brushComponent.props.style;
const cursor = !props.allowDrag && !props.allowResize ? "auto" : "move";
return x[0] !== x[1] && y[0] !== y[1] ? /*#__PURE__*/_react.default.cloneElement(brushComponent, {
key: `${name}-brush`,
width: Math.abs(x[1] - x[0]) || 1,
height: Math.abs(y[1] - y[0]) || 1,
x: Math.min(x[0], x[1]),
y: Math.min(y[0], y[1]),
cursor,
style: (0, _defaults2.default)({}, brushComponentStyle, brushStyle)
}) : null;
}
getCursorPointers(props) {
const cursors = {
yProps: "ns-resize",
xProps: "ew-resize"
};
if (!props.allowResize && props.allowDrag) {
cursors.xProps = "move";
cursors.yProps = "move";
} else if (!props.allowResize && !props.allowDrag) {
cursors.xProps = "auto";
cursors.yProps = "auto";
var xProps = {
style: style,
width: handleWidth,
height: height,
cursor: cursors.xProps
};
var handleProps = {
top: top && Object.assign({
x: top.x1,
y: top.y1
}, yProps),
bottom: bottom && Object.assign({
x: bottom.x1,
y: bottom.y1
}, yProps),
left: left && Object.assign({
y: left.y1,
x: left.x1
}, xProps),
right: right && Object.assign({
y: right.y1,
x: right.x1
}, xProps)
};
var handles = ["top", "bottom", "left", "right"].reduce(function (memo, curr) {
return handleProps[curr] ? memo.concat( /*#__PURE__*/_react.default.cloneElement(handleComponent, Object.assign({
key: "".concat(name, "-handle-").concat(curr)
}, handleProps[curr]))) : memo;
}, []);
return handles.length ? handles : null;
};
var getRect = function () {
var currentDomain = props.currentDomain,
cachedBrushDomain = props.cachedBrushDomain;
var brushDomain = (0, _defaults2.default)({}, props.brushDomain, props.domain);
var domain = (0, _reactFastCompare.default)(brushDomain, cachedBrushDomain) ? (0, _defaults2.default)({}, currentDomain, brushDomain) : brushDomain;
var coordinates = _victoryCore.Selection.getDomainCoordinates(props, domain);
var selectBox = getSelectBox(coordinates);
return selectBox ? [selectBox, getHandles(domain)] : [];
};
return {
props: props,
children: [].concat(_toConsumableArray(_react.default.Children.toArray(children)), _toConsumableArray(getRect()))
};
};
exports.useVictoryBrushContainer = useVictoryBrushContainer;
var VictoryBrushContainer = function (initialProps) {
var _useVictoryBrushConta = useVictoryBrushContainer(initialProps),
props = _useVictoryBrushConta.props,
children = _useVictoryBrushConta.children;
return /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryContainer, props, children);
};
exports.VictoryBrushContainer = VictoryBrushContainer;
VictoryBrushContainer.role = "container";
VictoryBrushContainer.defaultEvents = function (initialProps) {
var props = _objectSpread(_objectSpread({}, VICTORY_BRUSH_CONTAINER_DEFAULT_PROPS), initialProps);
var createEventHandler = function (handler, isDisabled) {
return (// eslint-disable-next-line max-params
function (event, targetProps, eventKey, context) {
return props.disable || isDisabled !== null && isDisabled !== void 0 && isDisabled(targetProps) ? {} : handler(event, _objectSpread(_objectSpread({}, props), targetProps), eventKey, context);
}
return cursors;
}
getHandles(props, domain) {
const {
handleWidth,
handleStyle,
handleComponent,
name
} = props;
const domainBox = _brushHelpers.BrushHelpers.getDomainBox(props, domain);
const {
x1,
x2,
y1,
y2
} = domainBox;
const {
top,
bottom,
left,
right
} = _brushHelpers.BrushHelpers.getHandles(props, domainBox);
const width = Math.abs(x2 - x1) || 1;
const height = Math.abs(y2 - y1) || 1;
const handleComponentStyle = handleComponent.props && handleComponent.props.style || {};
const style = (0, _defaults2.default)({}, handleComponentStyle, handleStyle);
const cursors = this.getCursorPointers(props);
const yProps = {
style,
width,
height: handleWidth,
cursor: cursors.yProps
};
const xProps = {
style,
width: handleWidth,
height,
cursor: cursors.xProps
};
const handleProps = {
top: top && Object.assign({
x: top.x1,
y: top.y1
}, yProps),
bottom: bottom && Object.assign({
x: bottom.x1,
y: bottom.y1
}, yProps),
left: left && Object.assign({
y: left.y1,
x: left.x1
}, xProps),
right: right && Object.assign({
y: right.y1,
x: right.x1
}, xProps)
};
const handles = ["top", "bottom", "left", "right"].reduce((memo, curr) => handleProps[curr] ? memo.concat( /*#__PURE__*/_react.default.cloneElement(handleComponent, Object.assign({
key: `${name}-handle-${curr}`
}, handleProps[curr]))) : memo, []);
return handles.length ? handles : null;
}
getRect(props) {
const {
currentDomain,
cachedBrushDomain
} = props;
const brushDomain = (0, _defaults2.default)({}, props.brushDomain, props.domain);
const domain = (0, _reactFastCompare.default)(brushDomain, cachedBrushDomain) ? (0, _defaults2.default)({}, currentDomain, brushDomain) : brushDomain;
const coordinates = _victoryCore.Selection.getDomainCoordinates(props, domain);
const selectBox = this.getSelectBox(props, coordinates);
return selectBox ? [selectBox, this.getHandles(props, domain)] : [];
}
);
};
// Overrides method in VictoryContainer
getChildren(props) {
return [..._react.default.Children.toArray(props.children), ...this.getRect(props)];
return [{
target: "parent",
eventHandlers: {
onMouseDown: createEventHandler(_brushHelpers.BrushHelpers.onMouseDown),
onTouchStart: createEventHandler(_brushHelpers.BrushHelpers.onMouseDown),
onGlobalMouseMove: createEventHandler(_brushHelpers.BrushHelpers.onGlobalMouseMove, function (targetProps) {
return !targetProps.isPanning && !targetProps.isSelecting;
}),
onGlobalTouchMove: createEventHandler(_brushHelpers.BrushHelpers.onGlobalMouseMove, function (targetProps) {
return !targetProps.isPanning && !targetProps.isSelecting;
}),
onGlobalMouseUp: createEventHandler(_brushHelpers.BrushHelpers.onGlobalMouseUp),
onGlobalTouchEnd: createEventHandler(_brushHelpers.BrushHelpers.onGlobalMouseUp),
onGlobalTouchCancel: createEventHandler(_brushHelpers.BrushHelpers.onGlobalMouseUp)
}
};
}
const VictoryBrushContainer = exports.VictoryBrushContainer = brushContainerMixin(_victoryCore.VictoryContainer);
}];
};
{
"name": "victory-brush-container",
"version": "36.9.2-next.0",
"version": "36.9.2-next.1",
"description": "Interactive Brush Component for Victory",

@@ -25,3 +25,3 @@ "keywords": [

"react-fast-compare": "^3.2.0",
"victory-core": "^36.9.2-next.0"
"victory-core": "^36.9.2-next.1"
},

@@ -28,0 +28,0 @@ "peerDependencies": {

import { Helpers as CoreHelpers, Selection } from "victory-core";
import { throttle, defaults, mapValues } from "lodash";
import { throttle, defaults } from "lodash";
import isEqual from "react-fast-compare";

@@ -15,4 +15,4 @@

withinBounds(point, bounds, padding?) {
const { x1, x2, y1, y2 } = mapValues(bounds, Number);
const { x, y } = mapValues(point, Number);
const { x1, x2, y1, y2 } = CoreHelpers.mapValues(bounds, Number);
const { x, y } = CoreHelpers.mapValues(point, Number);
const paddingValue = padding ? padding / 2 : 0;

@@ -194,3 +194,3 @@ return (

constrainBox(box, fullDomainBox) {
const { x1, y1, x2, y2 } = mapValues(fullDomainBox, Number);
const { x1, y1, x2, y2 } = CoreHelpers.mapValues(fullDomainBox, Number);
return {

@@ -205,3 +205,3 @@ x1: box.x2 > x2 ? x2 - Math.abs(box.x2 - box.x1) : Math.max(box.x1, x1),

constrainPoint(point, fullDomainBox) {
const { x1, y1, x2, y2 } = mapValues(fullDomainBox, Number);
const { x1, y1, x2, y2 } = CoreHelpers.mapValues(fullDomainBox, Number);
return {

@@ -208,0 +208,0 @@ x: Math.min(Math.max(point.x, x1), x2),

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc