├── .gitignore
├── LICENSE
├── README.md
├── build.js
├── demo_bundles
└── scroll.bundle.js
├── dist
├── poppy.amd.js
├── poppy.amd.min.js
├── poppy.commonjs2.js
├── poppy.commonjs2.min.js
├── poppy.css
├── poppy.js
├── poppy.min.js
├── poppy.umd.js
└── poppy.umd.min.js
├── libs
├── container.js
├── index.js
├── poppy.css
└── poppy.js
├── package.json
└── webpack.config.js
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 |
6 | # Runtime data
7 | pids
8 | *.pid
9 | *.seed
10 |
11 | # Directory for instrumented libs generated by jscoverage/JSCover
12 | lib-cov
13 |
14 | # Coverage directory used by tools like istanbul
15 | coverage
16 |
17 | # nyc test coverage
18 | .nyc_output
19 |
20 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
21 | .grunt
22 |
23 | # node-waf configuration
24 | .lock-wscript
25 |
26 | # Compiled binary addons (http://nodejs.org/api/addons.html)
27 | build/Release
28 |
29 | # Dependency directories
30 | node_modules
31 | jspm_packages
32 |
33 | # Optional npm cache directory
34 | .npm
35 |
36 | # Optional REPL history
37 | .node_repl_history
38 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2016 TaDaa
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | #React-Poppy
2 |
3 | React popover that scales, follows, scrolls, and grows
4 |
5 |
6 | ##Usage
7 | ```
8 | npm install react-poppy
9 | ```
10 |
11 | or
12 |
13 | clone/download and use appropriate script in /dist
14 |
15 |
16 |
17 |
18 | ##Demos
19 |
20 | * reposition on scroll events
21 |
22 | * interactions (hover to show, mouse over to keep popover open, toggle to open, grow based on content, scroll content)
23 |
24 | * repositions on state change
25 |
26 | * can track elements (same as above demo except follows elements not modified by react state)
27 |
28 |
29 |
30 | ##Psuedo JSX
31 | ```
32 |
33 |
34 |
35 | ```
36 |
37 |
38 |
39 | ###Properties
40 | * children=[ReactElement] - the target element that the popover should follow and position around
41 |
42 | * constrainTo=[element,ReactElement,querySelector='parent'] - used to calculate the bounding area that the popover should be contained in. If using a string, the querySelector is matched upward from the popover's location in the DOM tree. Parent is a special selector that will use the React element containing the popover.
43 |
44 | * show=[boolean=undefined] - forces the popover to show. Show takes precedence over all other types of show/hide interactions.
45 |
46 | * showDelay=[number=300] - amount of time that needs to pass before the popover begins to show.
47 |
48 | * hideDelay=[number=320] - amount of time that needs to pass before the popover begins to hide.
49 |
50 | * track=[boolean=false] - enables an internal timer to track the target element's position and size
51 |
52 | * constrainHeight=[boolean=true] - limits the height to the constrainTo's available space
53 |
54 | * constrainWidth=[boolean=true] - limits the width to the constrainTo's available space
55 |
56 | * arrowSize=[number=15] - changes the size of the arrow
57 |
58 | * region=["left"|"right|"top|"bottom"|undefined] - forces popover placement in a particular region
59 |
60 | * bindScroll=[boolean=false|querySelector] - binds the popover to the window scroll event if "true" or an element matching the querySelector traversing upwards from the popover target.
61 |
62 | * bindWindowResize=[boolean=false] - binds the popover to the window resize event
63 |
64 | * arrowStyle=[object={}] - arrowStyle override
65 |
66 | * backgroundStyle=[object=undefined] - backgroundStyle override
67 |
68 | * wrapperStyle=[object=undefined] - wrapperStyle verride
69 |
70 | * titleStyle=[object=undefined] - titleStyle override
71 |
72 | * className=[string=''] - className to apply to popover
73 |
74 | * title=[string=''|ReactElement] - title to be used.
75 |
76 | * showOnMouseEnter=[boolean=true] - popover will show when mouse enters target element
77 |
78 | * hideOnMouseLeave=[boolean=true] - popover will hide when mouse leaves target element.
79 |
80 | * toggleOnClick=[boolean=false] - popover will toggle show/hide when target element is clicked.
81 |
82 | * persistOverContent=[boolean=false] - popover will stay visible while the mouse is over the popover
83 |
84 | * onHide=[function] - event called when the popover is hidden
85 |
86 | * onShow=[function] - event called when the popover is shown
87 |
88 |
89 |
90 |
91 | ###Methods -- warning you should generally control these behaviors with props to keep behaviors consistent
92 |
93 | * track() - start tracking target element
94 |
95 | * untrack() - stop tracking target element
96 |
97 | * show() - show popover
98 |
99 | * hide() - hide popover
100 |
101 | * refresh() - redraw popover
102 |
103 |
--------------------------------------------------------------------------------
/build.js:
--------------------------------------------------------------------------------
1 | var babel = require('babel-core'),
2 | fs = require('fs');
3 |
4 | copy ("index.js") ("poppy.css");
5 | transform_jsx ("container.js") ("poppy.js")
6 |
7 |
8 | function copy (file) {
9 | fs.readFile("libs/"+file,function (err,data) {
10 | fs.writeFile("dist/"+file,data,function (err,data) {
11 | if (err) {
12 | console.error(err.toString());
13 | } else {
14 | console.error("done writing " + file);
15 | }
16 | });
17 | });
18 | return copy;
19 | }
20 | function transform_jsx (file) {
21 | babel.transformFile("libs/"+file,{
22 | 'presets' : ['react']
23 | },function (err,code) {
24 | if (err) {
25 | console.error(err.toString());
26 | } else {
27 | fs.writeFile("dist/"+file,code.code,function (err) {
28 | if (err) {
29 | console.error(err.toString());
30 | } else {
31 | console.error("done writing " + file);
32 | }
33 | });
34 | }
35 | });
36 | return transform_jsx;
37 | }
38 |
--------------------------------------------------------------------------------
/demo_bundles/scroll.bundle.js:
--------------------------------------------------------------------------------
1 | /******/ (function(modules) { // webpackBootstrap
2 | /******/ // The module cache
3 | /******/ var installedModules = {};
4 |
5 | /******/ // The require function
6 | /******/ function __webpack_require__(moduleId) {
7 |
8 | /******/ // Check if module is in cache
9 | /******/ if(installedModules[moduleId])
10 | /******/ return installedModules[moduleId].exports;
11 |
12 | /******/ // Create a new module (and put it into the cache)
13 | /******/ var module = installedModules[moduleId] = {
14 | /******/ exports: {},
15 | /******/ id: moduleId,
16 | /******/ loaded: false
17 | /******/ };
18 |
19 | /******/ // Execute the module function
20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21 |
22 | /******/ // Flag the module as loaded
23 | /******/ module.loaded = true;
24 |
25 | /******/ // Return the exports of the module
26 | /******/ return module.exports;
27 | /******/ }
28 |
29 |
30 | /******/ // expose the modules object (__webpack_modules__)
31 | /******/ __webpack_require__.m = modules;
32 |
33 | /******/ // expose the module cache
34 | /******/ __webpack_require__.c = installedModules;
35 |
36 | /******/ // __webpack_public_path__
37 | /******/ __webpack_require__.p = "";
38 |
39 | /******/ // Load entry module and return exports
40 | /******/ return __webpack_require__(0);
41 | /******/ })
42 | /************************************************************************/
43 | /******/ ([
44 | /* 0 */
45 | /***/ function(module, exports, __webpack_require__) {
46 |
47 | (function webpackMissingModule() { throw new Error("Cannot find module \"./demos/scroll.js\""); }());
48 |
49 |
50 | /***/ }
51 | /******/ ]);
--------------------------------------------------------------------------------
/dist/poppy.amd.min.js:
--------------------------------------------------------------------------------
1 | define("poppy",["react","react-dom"],function(__WEBPACK_EXTERNAL_MODULE_4__,__WEBPACK_EXTERNAL_MODULE_9__){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=6)}([function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(e){if(p===setTimeout)return setTimeout(e,0);if((p===n||!p)&&setTimeout)return p=setTimeout,setTimeout(e,0);try{return p(e,0)}catch(t){try{return p.call(null,e,0)}catch(t){return p.call(this,e,0)}}}function i(e){if(c===clearTimeout)return clearTimeout(e);if((c===r||!c)&&clearTimeout)return c=clearTimeout,clearTimeout(e);try{return c(e)}catch(t){try{return c.call(null,e)}catch(t){return c.call(this,e)}}}function s(){y&&h&&(y=!1,h.length?d=h.concat(d):m=-1,d.length&&a())}function a(){if(!y){var e=o(s);y=!0;for(var t=d.length;t;){for(h=d,d=[];++m1)for(var n=1;n1?t-1:0),r=1;r2?r-2:0),i=2;i=0&&isSafari.indexOf("chrome")<0;var SHOWING={NONE:0,MOUSEOVER:1,CONTENT:2,CLICK:4,PROPERTY:8},LEFT=1,RIGHT=2,TOP=3,BOTTOM=4,defaults={backgroundStyle:void 0,arrowStyle:{},wrapperStyle:void 0,titleStyle:void 0,content:"",className:"",title:"",position:{overflow:"auto",position:"relative",top:0,height:"100%",left:0,width:"100%"},constrainTo:"parent",persistOverContent:!1,showOnMouseEnter:!0,hideOnMouseLeave:!0,bindWindowResize:!1,bindScroll:!1,toggleOnClick:!1,constrainWidth:!0,constrainHeight:!0,track:!1,arrowSize:15,region:void 0,show:void 0,showDelay:300,hideDelay:320},getDefaults=eval("(function () {return "+JSON.stringify(defaults)+";})");!function(defaults){var p,item;for(p in defaults)(item=defaults[p])&&"object"===(void 0===item?"undefined":_typeof(item))&&(defaults[p]=eval("(function (obj) {var result ="+JSON.stringify(item)+",p; for (p in obj) {result[p]=obj[p]} return result;})"))}(defaults);var Popover=function(e){function t(){_classCallCheck(this,t);var e=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e._onExit=function(t){e.__onExit(t)},e._onEnter=function(t){e.__onEnter(t)},e}return _inherits(t,e),_createClass(t,[{key:"shouldComponentUpdate",value:function(e,t){var n=this.state||{},r=t.position||{};return this.minWidth!==r.minWidth||this.minHeight!==r.minHeight||this.maxWidth!==r.maxWidth||n.content!==t.content||n.title!==t.title||this.maxHeight!==r.maxHeight}},{key:"render",value:function(){var e=this.state;if(!e)return null;var t=e.title,n=e.position,r=n.maxWidth,o=n.maxHeight,i=n.minWidth,s=n.minHeight,a=e.content,l=this.overflowStyle,u=this.wrapperStyle,p=e.wrapperStyle||{},c=e.backgroundStyle||{};return l.overflow=a?"auto":null,this.maxHeight=l.maxHeight=u.maxHeight=o,this.maxWidth=l.maxWidth=u.maxWidth=r,this.minHeight=c.minHeight=p.minHeight=s,this.minWidth=c.minWidth=p.minWidth=i,React.createElement("span",{className:"poppy "+(e.className||""),onMouseOver:this._onEnter,onMouseOut:this._onExit},React.createElement("span",{ref:"inner",style:e.backgroundStyle,className:"poppy-background"},React.createElement("div",{ref:"arrow",className:"poppy-arrow",style:e.mergedArrowStyle}),React.createElement("div",{ref:"wrapper",className:"poppy-background-overlay",style:p})),React.createElement("div",{ref:"content",className:"poppy-content-wrapper",style:u},t?React.createElement("div",{ref:"titleWrapper",style:e.titleStyle,className:"poppy-title-wrapper"},React.createElement("span",{ref:"title",className:"poppy-title"},e.title)):null,React.createElement("div",{ref:"overflow",className:"poppy-overflow",style:l},a?React.createElement("div",{ref:"popover",className:"poppy-content"}," ",a||""," "):React.createElement("span",{ref:"popover"}))))}},{key:"__onEnter",value:function(){this.state.onEnterContent&&this.state.onEnterContent(SHOWING.CONTENT)}},{key:"__onExit",value:function(){this.state.onLeaveContent&&this.state.onLeaveContent(SHOWING.CONTENT)}}]),t}(React.Component),overlay_template=document.createElement("span");overlay_template.innerHTML='',overlay_template=overlay_template.lastChild,Popover.prototype.overflowStyle={},Popover.prototype.wrapperStyle={},module.exports=function(e){function t(){_classCallCheck(this,t);var e=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this)),n=assign_defaults(e.props);return e._lastTargetRect={left:0,top:0,width:0,height:0},e.pack={},e._transitioning=!0,e._doTrack=function(t){return e.__doTrack(t)},e._onClick=function(t){return e.__onClick(t)},e._onResize=function(t){return e.__onResize(t)},e._onScroll=function(t){return e.__onScroll(t)},e._onMouseEnter=function(t){return e.__onMouseEnter(t)},e._onMouseLeave=function(t){return e.__onMouseLeave(t)},e.settings={arrowStyle:{width:defaults.arrowSize,height:defaults.arrowSize},constrainTo:defaults.constrainTo,showing:0,showDelay:defaults.showDelay,hideDelay:defaults.hideDelay,track:defaults.track,constrainHeight:defaults.constrainHeight,constrainWidth:defaults.constrainWidth,className:defaults.className,title:""},e.componentWillUpdate(e.props,n),e.state=n,e}return _inherits(t,e),_createClass(t,[{key:"componentDidMount",value:function(){var e=this,t=ReactDOM.findDOMNode(this);e.setState({target:t}),this._mount_timer=setTimeout(function(){e._updateSync(e.props,e.state)})}},{key:"componentWillUnmount",value:function(){var e=this.state.target,t=e.ownerDocument,n=t.defaultView;this.settings&&(e=this.settings.target)&&(e.removeEventListener("mouseenter",this._onMouseEnter),e.removeEventListener("mouseleave",this._onMouseLeave),e.removeEventListener("click",this._onClick)),this.untrack(),this._resize_timer&&clearTimeout(this._resize_timer),this._show_timer&&clearTimeout(this._show_timer),this._mount_timer&&clearTimeout(this._mount_timer),this.overlay&&this.popoverEl.parentNode===this.overlay&&this.overlay.removeChild(this.popoverEl),this._init_timer&&clearTimeout(this._init_timer),this.settings.bindWindowResize&&n.removeEventListener("resize",this._onResize),this._boundScroll&&this._boundScroll.removeEventListener("scroll",this._onScroll)}},{key:"componentWillUpdate",value:function(e,t){this._updateSync(e,t),!this._group&&group(this)}},{key:"_updateSync",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments[1];n=n||this.state;var r=this.settings,o=t.bindWindowResize||!1,i=n&&n.target,s=r.target,a=t.track||!1,l=i&&i.ownerDocument.defaultView,u=!0===t.bindScroll?"window":t.bindScroll,p=this._boundScroll,c=!!r.target&&this._upwardSelector(u,r);o!==r.bindWindowResize&&(o?l&&(l.addEventListener("resize",this._onResize),r.bindWindowResize=!0):(l&&l.removeEventListener("resize",this._onResize),r.bindWindowResize=!1)),r.titleStyle=t.titleStyle||defaults.titleStyle,r.wrapperStyle=t.wrapperStyle||defaults.wrapperStyle,c!==p&&(p&&(p.removeEventListener("scroll",this._onScroll),this._boundScroll=!1),c&&(c.addEventListener("scroll",this._onScroll,!0),this._boundScroll=c)),a!==r.track&&(a?(r.track=!0,this.track()):(r.track=!1,this.untrack())),i&&s!==i&&(i.addEventListener("mouseenter",this._onMouseEnter),i.addEventListener("mouseleave",this._onMouseLeave),i.addEventListener("click",this._onClick),r.target=i,s&&(s.removeEventListener("mouseenter",this._onMouseEnter),s.removeEventListener("mouseleave",this._onMouseLeave),s.removeEventListener("click",this._onClick))),t.persistOverContent?(r.persistOverContent=!0,r.onEnterContent=function(t){return e.show(t)},r.onLeaveContent=function(t){return e.hide(t)}):(r.persistOverContent=!1,r.onEnterContent=!1,r.onLeaveContent=!1),r.toggleOnClick=void 0!==t.toggleOnClick?t.toggleOnClick:defaults.toggleOnClick,r.showOnMouseEnter=void 0!==t.showOnMouseEnter?t.showOnMouseEnter:defaults.showOnMouseEnter,r.hideOnMouseLeave=void 0!==t.hideOnMouseLeave?t.hideOnMouseLeave:defaults.hideOnMouseLeave,r.constrainHeight=void 0!==t.constrainHeight?t.constrainHeight:defaults.constrainHeight,r.constrainWidth=void 0!==t.constrainWidth?t.constrainWidth:defaults.constrainWidth}},{key:"_updateAsync",value:function(){if(this.settings.target){var e=this,t=this.props,n=t.show,r=this.settings,o=r.showing&SHOWING.PROPERTY,i=r.target.ownerDocument,s=i.body,a=this._upwardSelector(".poppy-container",r),l=this.popover,u=void 0!==t.arrowSize?t.arrowSize:defaults.arrowSize,p=r.mergedArrowStyle=Object.assign({},r.arrowStyle,t.arrowStyle),c=t.region;if(c&&c!==r.last_prop_region?"top"===c?r.region=TOP:"left"===c?r.region=LEFT:"right"===c?r.region=RIGHT:"bottom"===c&&(r.region=BOTTOM):c||(r.region=defaults.region),r.backgroundStyle=t.backgroundStyle,r.last_prop_region=c,r.title=t.title||defaults.title,r.content=t.content||defaults.content,r.className=t.className||defaults.className,r.arrowSize=u,r.arrowSize3_4=.75*u,r.arrowSize1_2=.5*u,r.arrowSize2_1=2*u,r.arrowSize3_2=1.5*u,p.height=p.width=u,this._adjustPosition(this.settings),a===s&&(a=s.querySelector(".poppy-container")),a?this.overlay||(this.overlay=a):s.appendChild(a=this.overlay=overlay_template.cloneNode(!0)),l)this.overlay.ownerDocument!==i&&this.popoverEl&&(a.appendChild(this.popoverEl),this.overlay=a);else{var f=document.createElement("div");l=this.popover=ReactDOM.render(React.createElement(Popover,null),f),a.appendChild(f.lastChild)}l.setState(r),this.popoverEl||(this.popoverEl=ReactDOM.findDOMNode(l)),
2 | //!this._init_timer && requestAnimationFrame(function () {
3 | o&&!n?e.hide(SHOWING.PROPERTY):!o&&n&&e.show(SHOWING.PROPERTY),e._updatePositions()}}},{key:"__onResize",value:function(){var e=this;this._resize_timer&&clearTimeout(this._resize_timer),this._resize_timer=setTimeout(function(){e._resize_timer=void 0,e.setState({})},60)}},{key:"__onMouseEnter",value:function(){this.settings.showOnMouseEnter&&this.show(SHOWING.MOUSEOVER)}},{key:"__onMouseLeave",value:function(){this.settings.hideOnMouseLeave&&this.hide(SHOWING.MOUSEOVER)}},{key:"__onClick",value:function(){this.settings.toggleOnClick&&(this.settings.showing&SHOWING.CLICK?this.hide(SHOWING.CLICK):this.show(SHOWING.CLICK))}},{key:"_adjustPosition",value:function(e){var t,n,r,o,i=this.pack.targetRect,s=this.pack.parentRect,a=s.width/s.height,l=e.region,u=e.leftSpace=i.left-s.left,p=e.rightSpace=s.left+s.width-(i.left+i.width),c=e.topSpace=i.top-s.top,f=e.bottomSpace=s.top+s.height-(i.top+i.height),h=e.arrowSize,d=e.position,y=e.arrowSize3_4,m=e.constrainHeight,v=e.constrainWidth,g=2*h;d||(d=e.position={}),l||(n=.75*u,r=.75*p,t=c*a,o=f*a,l=e.region=n>o&&n>t&&n>=r?LEFT:r>o&&r>t?RIGHT:t>o?TOP:BOTTOM),l===LEFT?(d.minWidth=h,d.minHeight=g,d.top=d.left=0,v&&(d.maxWidth=Math.max(u-y-25,g)),m&&(d.maxHeight=Math.max(c+f+i.height-30,5))):l===RIGHT?(d.minWidth=h,d.top=0,d.minHeight=g,d.left=i.left+i.width+y,v&&(d.maxWidth=Math.max(p-y-25,g)),m&&(d.maxHeight=Math.max(c+f+i.height-30,5))):l===BOTTOM?(d.minHeight=h,d.top=i.top+i.height+y,d.left=0,d.minWidth=g,m&&(d.maxHeight=Math.max(f-y-5,25)),v&&(d.maxWidth=Math.max(u+p+i.width-30,25))):(d.minHeight=h,d.top=d.left=0,d.minWidth=g,m&&(d.maxHeight=Math.max(c-y+2,25)),v&&(d.maxWidth=Math.max(u+p+i.width-30,25)))}},{key:"__onScroll",value:function(){!this._group&&group(this,!0)}},{key:"__doTrack",value:function(){this._track_timer=setTimeout(this._doTrack,16),this.settings.target&&this.popover&&!this._group&&group(this,!0)}},{key:"track",value:function(){return this._track_timer||(this._track_timer=setTimeout(this._doTrack,16)),this}},{key:"untrack",value:function(){return this._track_timer&&(clearTimeout(this._track_timer),this._track_timer=!1),this}},{key:"refresh",value:function(){return this.setState({}),this}},{key:"hide",value:function(e){var t=this,n=this.settings,r=n.showing;if(r&&r&e){n.showing-=e;var o=this.popoverEl,i=o.style;this._show_timer&&clearTimeout(this._show_timer),this._show_timer=setTimeout(function(){n.showing||(!o.$listener&&o.addEventListener("transitionend",o.$listener=function(){o.removeEventListener("transitionend",o.$listener),o.$listener=!1,!n.showing&&(o.style.visibility="hidden")}),t._show_timer=void 0,i.transition="all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms",n.region===RIGHT?i.transform="translateX(30px)translateY(0px)":n.region===LEFT?i.transform="translateX(-30px)translateY(0px)":n.region===TOP?i.transform="translateX(0px)translateY(-30px)":i.transform="translateX(0px)translateY(30px)",i.pointerEvents="none",i.opacity=0,t.props.onHide&&t.props.onHide())},n.hideDelay)}}},{key:"show",value:function(e){var t=this,n=this.settings,r=this.popoverEl,o=r.style,i=!0,s=n.showing;n.showing|=e,s||(this._show_timer&&(clearTimeout(this._show_timer),this._show_timer=void 0,i=!1),r.$listener&&r.removeEventListener("transitionend",r.$listener),r.$listener=!1,i?this._show_timer=setTimeout(function(){n.showing&&(t.props.onShow&&t.props.onShow(),t._show_timer=void 0,o.transition=null,n.region===RIGHT?o.transfrom="translateX(30px)translateY(0px)":n.region===LEFT?o.transform="translateX(-30px)translateY(0px)":n.region===TOP?o.transform="translateX(0px)translateY(-30px)":o.transform="translateX(0px)translateY(30px)",o.pointerEvents="all",t._show_timer=setTimeout(function(){t._show_timer=void 0,o.transition="all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms",o.visibility=null,o.opacity=1,o.transform="translateX(0px)translateY(0px)"},n.showDelay))}):(o.transition="all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms",o.visibility=null,o.opacity=1,o.transform="translateX(0px)translateY(0px)"))}},{key:"_upwardSelector",value:function(e,t){var n=t.target,r=n.ownerDocument;if(!e)return e;if("string"==typeof e){if("body"===e)return r.body;if("parent"===e)return n&&n.parentNode;if("window"===e)return n&&n.ownerDocument.defaultView;for(;n;){if(n.matches&&n.matches(e))return n;n=n.parentNode}return r.body}return(n=ReactDOM.findDOMNode(e))?n:e}},{key:"_updatePositions",value:function(){if(this.settings.target){var e,t,n,r,o,i,s,a,l=this.popover.refs.overflow,u=l.style,p=this.popover.refs.wrapper.style,c=this.popover.refs.arrow,f=c.style,h=this.popover.refs.content.style,d=this.settings,y=this.popover.refs.title,m=y&&y.getBoundingClientRect(),v=this.pack.targetRect,g=this.pack.parentRect,_=m&&m.width||0,w=m&&m.height||0,b=v.top,T=v.width,E=T/2,O=v.height,S=O/2,x=v.left,k=t=g.top,R=n=g.left,C=0|n,N=0|t,M=d.region,L=d.leftSpace,P=d.topSpace,W=0|d.arrowSize,H=d.arrowSize1_2,z=d.arrowSize3_4,D=d.arrowSize2_1,j=d.arrowSize3_2,I=d.position.left,A=d.position.top;u.paddingTop=w+"px",u.maxHeight=Math.max(Math.round(this.settings.position.maxHeight-w),0)+"px",e=l.getBoundingClientRect(),r=Math.max(e.width,_),o=e.height,this.settings.target&&(M===TOP||M===BOTTOM?(s=5,i=R+g.width-5,n=x+E-r/2,n(a=i-r)&&(n=a),(a=x+W)>i&&(n=a-r),C+=L+E-W,C=Math.max(Math.min(C,n+r-D),n)+H,I=n,M===TOP?(A=b-o-z-9,N=b-z-9-H):N=A-H):M!==LEFT&&M!==RIGHT||(t+=P+O-S-o/2,i=k+g.height-5,s=5,t(a=i-o)&&(t=a),(a=b+W)>i&&(t=a-o),N+=P+S-W,N=Math.max(Math.min(N,t+o-D),t)+H,A=t,M===LEFT?(I=x-r-z-6,C=I+r-H-1):(I=x+T+z,C=I-H+1)),h.width=p.width=(0|r)+"px",isSafari&&this._unsafe&&this.popoverEl&&(this.popoverEl.style.transition=f.transition=h.transition=p.transition=group_timer?"none":null),h.width=p.width=(0|r)+"px",f.top=(0|N)+"px",f.left=(0|C)+"px",p.top=h.top=(0|A)+"px",p.left=h.left=(0|I)+"px",p.height=(0|o)+"px",this.settings.showing&&this.popoverEl.style.visiblity&&(this.popoverEl.style.visiblity=null))}}},{key:"render",value:function(){var e=this.props.children;return"string"==typeof e&&(e=React.createElement("span",null,e)),e||null}}]),t}(React.Component),module.exports.propTypes={children:propTypes.any,constrainTo:propTypes.any,show:propTypes.bool,showDelay:propTypes.number,hideDelay:propTypes.number,track:propTypes.bool,constrainHeight:propTypes.bool,constrainWidth:propTypes.bool,arrowSize:propTypes.number,region:propTypes.oneOf(["left","right","top","bottom",null,!1,void 0]),bindScroll:propTypes.oneOfType([propTypes.bool,propTypes.string]),bindWindowResize:propTypes.bool,arrowStyle:propTypes.object,backgroundStyle:propTypes.object,wrapperStyle:propTypes.object,titleStyle:propTypes.object,className:propTypes.string,title:propTypes.any,showOnMouseEnter:propTypes.bool,hideOnMouseLeave:propTypes.bool,toggleOnClick:propTypes.bool,persistOverContent:propTypes.bool,onHide:propTypes.func,onShow:propTypes.func},module.exports.defaultProps={constrainTo:"parent",showDelay:300,hideDelay:320,track:!1,constrainHeight:!0,constrainWidth:!0,arrowSize:15,bindScroll:!1,bindWindowResize:!1,className:"",title:"",showOnMouseEnter:!0,hideOnMouseLeave:!0,toggleOnClick:!1,persistOverContent:!1}},function(e,t){e.exports=__WEBPACK_EXTERNAL_MODULE_9__},function(e,t,n){(function(t){if("production"!==t.env.NODE_ENV){var r="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,o=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r};e.exports=n(11)(o,!0)}else e.exports=n(13)()}).call(t,n(0))},function(e,t,n){"use strict";(function(t){var r=n(1),o=n(2),i=n(5),s=n(3),a=n(12);e.exports=function(e,n){function l(e){var t=e&&(S&&e[S]||e[x]);if("function"==typeof t)return t}function u(e,t){return e===t?0!==e||1/e==1/t:e!==e&&t!==t}function p(e){this.message=e,this.stack=""}function c(e){function r(r,u,c,f,h,d,y){if(f=f||k,d=d||c,y!==s)if(n)o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else if("production"!==t.env.NODE_ENV&&"undefined"!=typeof console){var m=f+":"+c;!a[m]&&l<3&&(i(!1,"You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.",d,f),a[m]=!0,l++)}return null==u[c]?r?new p(null===u[c]?"The "+h+" `"+d+"` is marked as required in `"+f+"`, but its value is `null`.":"The "+h+" `"+d+"` is marked as required in `"+f+"`, but its value is `undefined`."):null:e(u,c,f,h,d)}if("production"!==t.env.NODE_ENV)var a={},l=0;var u=r.bind(null,!1);return u.isRequired=r.bind(null,!0),u}function f(e){function t(t,n,r,o,i,s){var a=t[n];if(b(a)!==e)return new p("Invalid "+o+" `"+i+"` of type `"+T(a)+"` supplied to `"+r+"`, expected `"+e+"`.");return null}return c(t)}function h(e){function t(t,n,r,o,i){if("function"!=typeof e)return new p("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var a=t[n];if(!Array.isArray(a)){return new p("Invalid "+o+" `"+i+"` of type `"+b(a)+"` supplied to `"+r+"`, expected an array.")}for(var l=0;l>",R={array:f("array"),bool:f("boolean"),func:f("function"),number:f("number"),object:f("object"),string:f("string"),symbol:f("symbol"),any:function(){return c(r.thatReturnsNull)}(),arrayOf:h,element:function(){function t(t,n,r,o,i){var s=t[n];if(!e(s)){return new p("Invalid "+o+" `"+i+"` of type `"+b(s)+"` supplied to `"+r+"`, expected a single ReactElement.")}return null}return c(t)}(),instanceOf:d,node:function(){function e(e,t,n,r,o){return _(e[t])?null:new p("Invalid "+r+" `"+o+"` supplied to `"+n+"`, expected a ReactNode.")}return c(e)}(),objectOf:m,oneOf:y,oneOfType:v,shape:g};return p.prototype=Error.prototype,R.checkPropTypes=a,R.PropTypes=R,R}}).call(t,n(0))},function(e,t,n){"use strict";(function(t){function r(e,n,r,l,u){if("production"!==t.env.NODE_ENV)for(var p in e)if(e.hasOwnProperty(p)){var c;try{o("function"==typeof e[p],"%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",l||"React class",r,p),c=e[p](n,p,l,r,null,s)}catch(e){c=e}if(i(!c||c instanceof Error,"%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",l||"React class",r,p,typeof c),c instanceof Error&&!(c.message in a)){a[c.message]=!0;var f=u?u():"";i(!1,"Failed %s type: %s%s",r,c.message,null!=f?f:"")}}}if("production"!==t.env.NODE_ENV)var o=n(2),i=n(5),s=n(3),a={};e.exports=r}).call(t,n(0))},function(e,t,n){"use strict";var r=n(1),o=n(2),i=n(3);e.exports=function(){function e(e,t,n,r,s,a){a!==i&&o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t};return n.checkPropTypes=r,n.PropTypes=n,n}},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var n=0;n1)for(var n=1;n1?t-1:0),r=1;r2?r-2:0),i=2;i=0&&isSafari.indexOf("chrome")<0;var SHOWING={NONE:0,MOUSEOVER:1,CONTENT:2,CLICK:4,PROPERTY:8},LEFT=1,RIGHT=2,TOP=3,BOTTOM=4,defaults={backgroundStyle:void 0,arrowStyle:{},wrapperStyle:void 0,titleStyle:void 0,content:"",className:"",title:"",position:{overflow:"auto",position:"relative",top:0,height:"100%",left:0,width:"100%"},constrainTo:"parent",persistOverContent:!1,showOnMouseEnter:!0,hideOnMouseLeave:!0,bindWindowResize:!1,bindScroll:!1,toggleOnClick:!1,constrainWidth:!0,constrainHeight:!0,track:!1,arrowSize:15,region:void 0,show:void 0,showDelay:300,hideDelay:320},getDefaults=eval("(function () {return "+JSON.stringify(defaults)+";})");!function(defaults){var p,item;for(p in defaults)(item=defaults[p])&&"object"===(void 0===item?"undefined":_typeof(item))&&(defaults[p]=eval("(function (obj) {var result ="+JSON.stringify(item)+",p; for (p in obj) {result[p]=obj[p]} return result;})"))}(defaults);var Popover=function(e){function t(){_classCallCheck(this,t);var e=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e._onExit=function(t){e.__onExit(t)},e._onEnter=function(t){e.__onEnter(t)},e}return _inherits(t,e),_createClass(t,[{key:"shouldComponentUpdate",value:function(e,t){var n=this.state||{},r=t.position||{};return this.minWidth!==r.minWidth||this.minHeight!==r.minHeight||this.maxWidth!==r.maxWidth||n.content!==t.content||n.title!==t.title||this.maxHeight!==r.maxHeight}},{key:"render",value:function(){var e=this.state;if(!e)return null;var t=e.title,n=e.position,r=n.maxWidth,o=n.maxHeight,i=n.minWidth,s=n.minHeight,a=e.content,l=this.overflowStyle,u=this.wrapperStyle,p=e.wrapperStyle||{},c=e.backgroundStyle||{};return l.overflow=a?"auto":null,this.maxHeight=l.maxHeight=u.maxHeight=o,this.maxWidth=l.maxWidth=u.maxWidth=r,this.minHeight=c.minHeight=p.minHeight=s,this.minWidth=c.minWidth=p.minWidth=i,React.createElement("span",{className:"poppy "+(e.className||""),onMouseOver:this._onEnter,onMouseOut:this._onExit},React.createElement("span",{ref:"inner",style:e.backgroundStyle,className:"poppy-background"},React.createElement("div",{ref:"arrow",className:"poppy-arrow",style:e.mergedArrowStyle}),React.createElement("div",{ref:"wrapper",className:"poppy-background-overlay",style:p})),React.createElement("div",{ref:"content",className:"poppy-content-wrapper",style:u},t?React.createElement("div",{ref:"titleWrapper",style:e.titleStyle,className:"poppy-title-wrapper"},React.createElement("span",{ref:"title",className:"poppy-title"},e.title)):null,React.createElement("div",{ref:"overflow",className:"poppy-overflow",style:l},a?React.createElement("div",{ref:"popover",className:"poppy-content"}," ",a||""," "):React.createElement("span",{ref:"popover"}))))}},{key:"__onEnter",value:function(){this.state.onEnterContent&&this.state.onEnterContent(SHOWING.CONTENT)}},{key:"__onExit",value:function(){this.state.onLeaveContent&&this.state.onLeaveContent(SHOWING.CONTENT)}}]),t}(React.Component),overlay_template=document.createElement("span");overlay_template.innerHTML='',overlay_template=overlay_template.lastChild,Popover.prototype.overflowStyle={},Popover.prototype.wrapperStyle={},module.exports=function(e){function t(){_classCallCheck(this,t);var e=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this)),n=assign_defaults(e.props);return e._lastTargetRect={left:0,top:0,width:0,height:0},e.pack={},e._transitioning=!0,e._doTrack=function(t){return e.__doTrack(t)},e._onClick=function(t){return e.__onClick(t)},e._onResize=function(t){return e.__onResize(t)},e._onScroll=function(t){return e.__onScroll(t)},e._onMouseEnter=function(t){return e.__onMouseEnter(t)},e._onMouseLeave=function(t){return e.__onMouseLeave(t)},e.settings={arrowStyle:{width:defaults.arrowSize,height:defaults.arrowSize},constrainTo:defaults.constrainTo,showing:0,showDelay:defaults.showDelay,hideDelay:defaults.hideDelay,track:defaults.track,constrainHeight:defaults.constrainHeight,constrainWidth:defaults.constrainWidth,className:defaults.className,title:""},e.componentWillUpdate(e.props,n),e.state=n,e}return _inherits(t,e),_createClass(t,[{key:"componentDidMount",value:function(){var e=this,t=ReactDOM.findDOMNode(this);e.setState({target:t}),this._mount_timer=setTimeout(function(){e._updateSync(e.props,e.state)})}},{key:"componentWillUnmount",value:function(){var e=this.state.target,t=e.ownerDocument,n=t.defaultView;this.settings&&(e=this.settings.target)&&(e.removeEventListener("mouseenter",this._onMouseEnter),e.removeEventListener("mouseleave",this._onMouseLeave),e.removeEventListener("click",this._onClick)),this.untrack(),this._resize_timer&&clearTimeout(this._resize_timer),this._show_timer&&clearTimeout(this._show_timer),this._mount_timer&&clearTimeout(this._mount_timer),this.overlay&&this.popoverEl.parentNode===this.overlay&&this.overlay.removeChild(this.popoverEl),this._init_timer&&clearTimeout(this._init_timer),this.settings.bindWindowResize&&n.removeEventListener("resize",this._onResize),this._boundScroll&&this._boundScroll.removeEventListener("scroll",this._onScroll)}},{key:"componentWillUpdate",value:function(e,t){this._updateSync(e,t),!this._group&&group(this)}},{key:"_updateSync",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments[1];n=n||this.state;var r=this.settings,o=t.bindWindowResize||!1,i=n&&n.target,s=r.target,a=t.track||!1,l=i&&i.ownerDocument.defaultView,u=!0===t.bindScroll?"window":t.bindScroll,p=this._boundScroll,c=!!r.target&&this._upwardSelector(u,r);o!==r.bindWindowResize&&(o?l&&(l.addEventListener("resize",this._onResize),r.bindWindowResize=!0):(l&&l.removeEventListener("resize",this._onResize),r.bindWindowResize=!1)),r.titleStyle=t.titleStyle||defaults.titleStyle,r.wrapperStyle=t.wrapperStyle||defaults.wrapperStyle,c!==p&&(p&&(p.removeEventListener("scroll",this._onScroll),this._boundScroll=!1),c&&(c.addEventListener("scroll",this._onScroll,!0),this._boundScroll=c)),a!==r.track&&(a?(r.track=!0,this.track()):(r.track=!1,this.untrack())),i&&s!==i&&(i.addEventListener("mouseenter",this._onMouseEnter),i.addEventListener("mouseleave",this._onMouseLeave),i.addEventListener("click",this._onClick),r.target=i,s&&(s.removeEventListener("mouseenter",this._onMouseEnter),s.removeEventListener("mouseleave",this._onMouseLeave),s.removeEventListener("click",this._onClick))),t.persistOverContent?(r.persistOverContent=!0,r.onEnterContent=function(t){return e.show(t)},r.onLeaveContent=function(t){return e.hide(t)}):(r.persistOverContent=!1,r.onEnterContent=!1,r.onLeaveContent=!1),r.toggleOnClick=void 0!==t.toggleOnClick?t.toggleOnClick:defaults.toggleOnClick,r.showOnMouseEnter=void 0!==t.showOnMouseEnter?t.showOnMouseEnter:defaults.showOnMouseEnter,r.hideOnMouseLeave=void 0!==t.hideOnMouseLeave?t.hideOnMouseLeave:defaults.hideOnMouseLeave,r.constrainHeight=void 0!==t.constrainHeight?t.constrainHeight:defaults.constrainHeight,r.constrainWidth=void 0!==t.constrainWidth?t.constrainWidth:defaults.constrainWidth}},{key:"_updateAsync",value:function(){if(this.settings.target){var e=this,t=this.props,n=t.show,r=this.settings,o=r.showing&SHOWING.PROPERTY,i=r.target.ownerDocument,s=i.body,a=this._upwardSelector(".poppy-container",r),l=this.popover,u=void 0!==t.arrowSize?t.arrowSize:defaults.arrowSize,p=r.mergedArrowStyle=Object.assign({},r.arrowStyle,t.arrowStyle),c=t.region;if(c&&c!==r.last_prop_region?"top"===c?r.region=TOP:"left"===c?r.region=LEFT:"right"===c?r.region=RIGHT:"bottom"===c&&(r.region=BOTTOM):c||(r.region=defaults.region),r.backgroundStyle=t.backgroundStyle,r.last_prop_region=c,r.title=t.title||defaults.title,r.content=t.content||defaults.content,r.className=t.className||defaults.className,r.arrowSize=u,r.arrowSize3_4=.75*u,r.arrowSize1_2=.5*u,r.arrowSize2_1=2*u,r.arrowSize3_2=1.5*u,p.height=p.width=u,this._adjustPosition(this.settings),a===s&&(a=s.querySelector(".poppy-container")),a?this.overlay||(this.overlay=a):s.appendChild(a=this.overlay=overlay_template.cloneNode(!0)),l)this.overlay.ownerDocument!==i&&this.popoverEl&&(a.appendChild(this.popoverEl),this.overlay=a);else{var f=document.createElement("div");l=this.popover=ReactDOM.render(React.createElement(Popover,null),f),a.appendChild(f.lastChild)}l.setState(r),this.popoverEl||(this.popoverEl=ReactDOM.findDOMNode(l)),
2 | //!this._init_timer && requestAnimationFrame(function () {
3 | o&&!n?e.hide(SHOWING.PROPERTY):!o&&n&&e.show(SHOWING.PROPERTY),e._updatePositions()}}},{key:"__onResize",value:function(){var e=this;this._resize_timer&&clearTimeout(this._resize_timer),this._resize_timer=setTimeout(function(){e._resize_timer=void 0,e.setState({})},60)}},{key:"__onMouseEnter",value:function(){this.settings.showOnMouseEnter&&this.show(SHOWING.MOUSEOVER)}},{key:"__onMouseLeave",value:function(){this.settings.hideOnMouseLeave&&this.hide(SHOWING.MOUSEOVER)}},{key:"__onClick",value:function(){this.settings.toggleOnClick&&(this.settings.showing&SHOWING.CLICK?this.hide(SHOWING.CLICK):this.show(SHOWING.CLICK))}},{key:"_adjustPosition",value:function(e){var t,n,r,o,i=this.pack.targetRect,s=this.pack.parentRect,a=s.width/s.height,l=e.region,u=e.leftSpace=i.left-s.left,p=e.rightSpace=s.left+s.width-(i.left+i.width),c=e.topSpace=i.top-s.top,f=e.bottomSpace=s.top+s.height-(i.top+i.height),h=e.arrowSize,d=e.position,y=e.arrowSize3_4,m=e.constrainHeight,v=e.constrainWidth,g=2*h;d||(d=e.position={}),l||(n=.75*u,r=.75*p,t=c*a,o=f*a,l=e.region=n>o&&n>t&&n>=r?LEFT:r>o&&r>t?RIGHT:t>o?TOP:BOTTOM),l===LEFT?(d.minWidth=h,d.minHeight=g,d.top=d.left=0,v&&(d.maxWidth=Math.max(u-y-25,g)),m&&(d.maxHeight=Math.max(c+f+i.height-30,5))):l===RIGHT?(d.minWidth=h,d.top=0,d.minHeight=g,d.left=i.left+i.width+y,v&&(d.maxWidth=Math.max(p-y-25,g)),m&&(d.maxHeight=Math.max(c+f+i.height-30,5))):l===BOTTOM?(d.minHeight=h,d.top=i.top+i.height+y,d.left=0,d.minWidth=g,m&&(d.maxHeight=Math.max(f-y-5,25)),v&&(d.maxWidth=Math.max(u+p+i.width-30,25))):(d.minHeight=h,d.top=d.left=0,d.minWidth=g,m&&(d.maxHeight=Math.max(c-y+2,25)),v&&(d.maxWidth=Math.max(u+p+i.width-30,25)))}},{key:"__onScroll",value:function(){!this._group&&group(this,!0)}},{key:"__doTrack",value:function(){this._track_timer=setTimeout(this._doTrack,16),this.settings.target&&this.popover&&!this._group&&group(this,!0)}},{key:"track",value:function(){return this._track_timer||(this._track_timer=setTimeout(this._doTrack,16)),this}},{key:"untrack",value:function(){return this._track_timer&&(clearTimeout(this._track_timer),this._track_timer=!1),this}},{key:"refresh",value:function(){return this.setState({}),this}},{key:"hide",value:function(e){var t=this,n=this.settings,r=n.showing;if(r&&r&e){n.showing-=e;var o=this.popoverEl,i=o.style;this._show_timer&&clearTimeout(this._show_timer),this._show_timer=setTimeout(function(){n.showing||(!o.$listener&&o.addEventListener("transitionend",o.$listener=function(){o.removeEventListener("transitionend",o.$listener),o.$listener=!1,!n.showing&&(o.style.visibility="hidden")}),t._show_timer=void 0,i.transition="all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms",n.region===RIGHT?i.transform="translateX(30px)translateY(0px)":n.region===LEFT?i.transform="translateX(-30px)translateY(0px)":n.region===TOP?i.transform="translateX(0px)translateY(-30px)":i.transform="translateX(0px)translateY(30px)",i.pointerEvents="none",i.opacity=0,t.props.onHide&&t.props.onHide())},n.hideDelay)}}},{key:"show",value:function(e){var t=this,n=this.settings,r=this.popoverEl,o=r.style,i=!0,s=n.showing;n.showing|=e,s||(this._show_timer&&(clearTimeout(this._show_timer),this._show_timer=void 0,i=!1),r.$listener&&r.removeEventListener("transitionend",r.$listener),r.$listener=!1,i?this._show_timer=setTimeout(function(){n.showing&&(t.props.onShow&&t.props.onShow(),t._show_timer=void 0,o.transition=null,n.region===RIGHT?o.transfrom="translateX(30px)translateY(0px)":n.region===LEFT?o.transform="translateX(-30px)translateY(0px)":n.region===TOP?o.transform="translateX(0px)translateY(-30px)":o.transform="translateX(0px)translateY(30px)",o.pointerEvents="all",t._show_timer=setTimeout(function(){t._show_timer=void 0,o.transition="all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms",o.visibility=null,o.opacity=1,o.transform="translateX(0px)translateY(0px)"},n.showDelay))}):(o.transition="all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms",o.visibility=null,o.opacity=1,o.transform="translateX(0px)translateY(0px)"))}},{key:"_upwardSelector",value:function(e,t){var n=t.target,r=n.ownerDocument;if(!e)return e;if("string"==typeof e){if("body"===e)return r.body;if("parent"===e)return n&&n.parentNode;if("window"===e)return n&&n.ownerDocument.defaultView;for(;n;){if(n.matches&&n.matches(e))return n;n=n.parentNode}return r.body}return(n=ReactDOM.findDOMNode(e))?n:e}},{key:"_updatePositions",value:function(){if(this.settings.target){var e,t,n,r,o,i,s,a,l=this.popover.refs.overflow,u=l.style,p=this.popover.refs.wrapper.style,c=this.popover.refs.arrow,f=c.style,h=this.popover.refs.content.style,d=this.settings,y=this.popover.refs.title,m=y&&y.getBoundingClientRect(),v=this.pack.targetRect,g=this.pack.parentRect,_=m&&m.width||0,w=m&&m.height||0,b=v.top,T=v.width,O=T/2,E=v.height,S=E/2,x=v.left,k=t=g.top,R=n=g.left,C=0|n,N=0|t,M=d.region,L=d.leftSpace,H=d.topSpace,P=0|d.arrowSize,W=d.arrowSize1_2,z=d.arrowSize3_4,j=d.arrowSize2_1,D=d.arrowSize3_2,I=d.position.left,A=d.position.top;u.paddingTop=w+"px",u.maxHeight=Math.max(Math.round(this.settings.position.maxHeight-w),0)+"px",e=l.getBoundingClientRect(),r=Math.max(e.width,_),o=e.height,this.settings.target&&(M===TOP||M===BOTTOM?(s=5,i=R+g.width-5,n=x+O-r/2,n(a=i-r)&&(n=a),(a=x+P)>i&&(n=a-r),C+=L+O-P,C=Math.max(Math.min(C,n+r-j),n)+W,I=n,M===TOP?(A=b-o-z-9,N=b-z-9-W):N=A-W):M!==LEFT&&M!==RIGHT||(t+=H+E-S-o/2,i=k+g.height-5,s=5,t(a=i-o)&&(t=a),(a=b+P)>i&&(t=a-o),N+=H+S-P,N=Math.max(Math.min(N,t+o-j),t)+W,A=t,M===LEFT?(I=x-r-z-6,C=I+r-W-1):(I=x+T+z,C=I-W+1)),h.width=p.width=(0|r)+"px",isSafari&&this._unsafe&&this.popoverEl&&(this.popoverEl.style.transition=f.transition=h.transition=p.transition=group_timer?"none":null),h.width=p.width=(0|r)+"px",f.top=(0|N)+"px",f.left=(0|C)+"px",p.top=h.top=(0|A)+"px",p.left=h.left=(0|I)+"px",p.height=(0|o)+"px",this.settings.showing&&this.popoverEl.style.visiblity&&(this.popoverEl.style.visiblity=null))}}},{key:"render",value:function(){var e=this.props.children;return"string"==typeof e&&(e=React.createElement("span",null,e)),e||null}}]),t}(React.Component),module.exports.propTypes={children:propTypes.any,constrainTo:propTypes.any,show:propTypes.bool,showDelay:propTypes.number,hideDelay:propTypes.number,track:propTypes.bool,constrainHeight:propTypes.bool,constrainWidth:propTypes.bool,arrowSize:propTypes.number,region:propTypes.oneOf(["left","right","top","bottom",null,!1,void 0]),bindScroll:propTypes.oneOfType([propTypes.bool,propTypes.string]),bindWindowResize:propTypes.bool,arrowStyle:propTypes.object,backgroundStyle:propTypes.object,wrapperStyle:propTypes.object,titleStyle:propTypes.object,className:propTypes.string,title:propTypes.any,showOnMouseEnter:propTypes.bool,hideOnMouseLeave:propTypes.bool,toggleOnClick:propTypes.bool,persistOverContent:propTypes.bool,onHide:propTypes.func,onShow:propTypes.func},module.exports.defaultProps={constrainTo:"parent",showDelay:300,hideDelay:320,track:!1,constrainHeight:!0,constrainWidth:!0,arrowSize:15,bindScroll:!1,bindWindowResize:!1,className:"",title:"",showOnMouseEnter:!0,hideOnMouseLeave:!0,toggleOnClick:!1,persistOverContent:!1}},function(e,t){e.exports=require("react-dom")},function(e,t,n){(function(t){if("production"!==t.env.NODE_ENV){var r="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,o=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r};e.exports=n(11)(o,!0)}else e.exports=n(13)()}).call(t,n(0))},function(e,t,n){"use strict";(function(t){var r=n(1),o=n(2),i=n(5),s=n(3),a=n(12);e.exports=function(e,n){function l(e){var t=e&&(S&&e[S]||e[x]);if("function"==typeof t)return t}function u(e,t){return e===t?0!==e||1/e==1/t:e!==e&&t!==t}function p(e){this.message=e,this.stack=""}function c(e){function r(r,u,c,f,h,d,y){if(f=f||k,d=d||c,y!==s)if(n)o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else if("production"!==t.env.NODE_ENV&&"undefined"!=typeof console){var m=f+":"+c;!a[m]&&l<3&&(i(!1,"You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.",d,f),a[m]=!0,l++)}return null==u[c]?r?new p(null===u[c]?"The "+h+" `"+d+"` is marked as required in `"+f+"`, but its value is `null`.":"The "+h+" `"+d+"` is marked as required in `"+f+"`, but its value is `undefined`."):null:e(u,c,f,h,d)}if("production"!==t.env.NODE_ENV)var a={},l=0;var u=r.bind(null,!1);return u.isRequired=r.bind(null,!0),u}function f(e){function t(t,n,r,o,i,s){var a=t[n];if(b(a)!==e)return new p("Invalid "+o+" `"+i+"` of type `"+T(a)+"` supplied to `"+r+"`, expected `"+e+"`.");return null}return c(t)}function h(e){function t(t,n,r,o,i){if("function"!=typeof e)return new p("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var a=t[n];if(!Array.isArray(a)){return new p("Invalid "+o+" `"+i+"` of type `"+b(a)+"` supplied to `"+r+"`, expected an array.")}for(var l=0;l>",R={array:f("array"),bool:f("boolean"),func:f("function"),number:f("number"),object:f("object"),string:f("string"),symbol:f("symbol"),any:function(){return c(r.thatReturnsNull)}(),arrayOf:h,element:function(){function t(t,n,r,o,i){var s=t[n];if(!e(s)){return new p("Invalid "+o+" `"+i+"` of type `"+b(s)+"` supplied to `"+r+"`, expected a single ReactElement.")}return null}return c(t)}(),instanceOf:d,node:function(){function e(e,t,n,r,o){return _(e[t])?null:new p("Invalid "+r+" `"+o+"` supplied to `"+n+"`, expected a ReactNode.")}return c(e)}(),objectOf:m,oneOf:y,oneOfType:v,shape:g};return p.prototype=Error.prototype,R.checkPropTypes=a,R.PropTypes=R,R}}).call(t,n(0))},function(e,t,n){"use strict";(function(t){function r(e,n,r,l,u){if("production"!==t.env.NODE_ENV)for(var p in e)if(e.hasOwnProperty(p)){var c;try{o("function"==typeof e[p],"%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",l||"React class",r,p),c=e[p](n,p,l,r,null,s)}catch(e){c=e}if(i(!c||c instanceof Error,"%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",l||"React class",r,p,typeof c),c instanceof Error&&!(c.message in a)){a[c.message]=!0;var f=u?u():"";i(!1,"Failed %s type: %s%s",r,c.message,null!=f?f:"")}}}if("production"!==t.env.NODE_ENV)var o=n(2),i=n(5),s=n(3),a={};e.exports=r}).call(t,n(0))},function(e,t,n){"use strict";var r=n(1),o=n(2),i=n(3);e.exports=function(){function e(e,t,n,r,s,a){a!==i&&o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t};return n.checkPropTypes=r,n.PropTypes=n,n}},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var n=0;n1)for(var n=1;n1?t-1:0),r=1;r2?r-2:0),i=2;i=0&&isSafari.indexOf("chrome")<0;var SHOWING={NONE:0,MOUSEOVER:1,CONTENT:2,CLICK:4,PROPERTY:8},LEFT=1,RIGHT=2,TOP=3,BOTTOM=4,defaults={backgroundStyle:void 0,arrowStyle:{},wrapperStyle:void 0,titleStyle:void 0,content:"",className:"",title:"",position:{overflow:"auto",position:"relative",top:0,height:"100%",left:0,width:"100%"},constrainTo:"parent",persistOverContent:!1,showOnMouseEnter:!0,hideOnMouseLeave:!0,bindWindowResize:!1,bindScroll:!1,toggleOnClick:!1,constrainWidth:!0,constrainHeight:!0,track:!1,arrowSize:15,region:void 0,show:void 0,showDelay:300,hideDelay:320},getDefaults=eval("(function () {return "+JSON.stringify(defaults)+";})");!function(defaults){var p,item;for(p in defaults)(item=defaults[p])&&"object"===(void 0===item?"undefined":_typeof(item))&&(defaults[p]=eval("(function (obj) {var result ="+JSON.stringify(item)+",p; for (p in obj) {result[p]=obj[p]} return result;})"))}(defaults);var Popover=function(e){function t(){_classCallCheck(this,t);var e=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e._onExit=function(t){e.__onExit(t)},e._onEnter=function(t){e.__onEnter(t)},e}return _inherits(t,e),_createClass(t,[{key:"shouldComponentUpdate",value:function(e,t){var n=this.state||{},r=t.position||{};return this.minWidth!==r.minWidth||this.minHeight!==r.minHeight||this.maxWidth!==r.maxWidth||n.content!==t.content||n.title!==t.title||this.maxHeight!==r.maxHeight}},{key:"render",value:function(){var e=this.state;if(!e)return null;var t=e.title,n=e.position,r=n.maxWidth,o=n.maxHeight,i=n.minWidth,s=n.minHeight,a=e.content,l=this.overflowStyle,u=this.wrapperStyle,p=e.wrapperStyle||{},c=e.backgroundStyle||{};return l.overflow=a?"auto":null,this.maxHeight=l.maxHeight=u.maxHeight=o,this.maxWidth=l.maxWidth=u.maxWidth=r,this.minHeight=c.minHeight=p.minHeight=s,this.minWidth=c.minWidth=p.minWidth=i,React.createElement("span",{className:"poppy "+(e.className||""),onMouseOver:this._onEnter,onMouseOut:this._onExit},React.createElement("span",{ref:"inner",style:e.backgroundStyle,className:"poppy-background"},React.createElement("div",{ref:"arrow",className:"poppy-arrow",style:e.mergedArrowStyle}),React.createElement("div",{ref:"wrapper",className:"poppy-background-overlay",style:p})),React.createElement("div",{ref:"content",className:"poppy-content-wrapper",style:u},t?React.createElement("div",{ref:"titleWrapper",style:e.titleStyle,className:"poppy-title-wrapper"},React.createElement("span",{ref:"title",className:"poppy-title"},e.title)):null,React.createElement("div",{ref:"overflow",className:"poppy-overflow",style:l},a?React.createElement("div",{ref:"popover",className:"poppy-content"}," ",a||""," "):React.createElement("span",{ref:"popover"}))))}},{key:"__onEnter",value:function(){this.state.onEnterContent&&this.state.onEnterContent(SHOWING.CONTENT)}},{key:"__onExit",value:function(){this.state.onLeaveContent&&this.state.onLeaveContent(SHOWING.CONTENT)}}]),t}(React.Component),overlay_template=document.createElement("span");overlay_template.innerHTML='',overlay_template=overlay_template.lastChild,Popover.prototype.overflowStyle={},Popover.prototype.wrapperStyle={},module.exports=function(e){function t(){_classCallCheck(this,t);var e=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this)),n=assign_defaults(e.props);return e._lastTargetRect={left:0,top:0,width:0,height:0},e.pack={},e._transitioning=!0,e._doTrack=function(t){return e.__doTrack(t)},e._onClick=function(t){return e.__onClick(t)},e._onResize=function(t){return e.__onResize(t)},e._onScroll=function(t){return e.__onScroll(t)},e._onMouseEnter=function(t){return e.__onMouseEnter(t)},e._onMouseLeave=function(t){return e.__onMouseLeave(t)},e.settings={arrowStyle:{width:defaults.arrowSize,height:defaults.arrowSize},constrainTo:defaults.constrainTo,showing:0,showDelay:defaults.showDelay,hideDelay:defaults.hideDelay,track:defaults.track,constrainHeight:defaults.constrainHeight,constrainWidth:defaults.constrainWidth,className:defaults.className,title:""},e.componentWillUpdate(e.props,n),e.state=n,e}return _inherits(t,e),_createClass(t,[{key:"componentDidMount",value:function(){var e=this,t=ReactDOM.findDOMNode(this);e.setState({target:t}),this._mount_timer=setTimeout(function(){e._updateSync(e.props,e.state)})}},{key:"componentWillUnmount",value:function(){var e=this.state.target,t=e.ownerDocument,n=t.defaultView;this.settings&&(e=this.settings.target)&&(e.removeEventListener("mouseenter",this._onMouseEnter),e.removeEventListener("mouseleave",this._onMouseLeave),e.removeEventListener("click",this._onClick)),this.untrack(),this._resize_timer&&clearTimeout(this._resize_timer),this._show_timer&&clearTimeout(this._show_timer),this._mount_timer&&clearTimeout(this._mount_timer),this.overlay&&this.popoverEl.parentNode===this.overlay&&this.overlay.removeChild(this.popoverEl),this._init_timer&&clearTimeout(this._init_timer),this.settings.bindWindowResize&&n.removeEventListener("resize",this._onResize),this._boundScroll&&this._boundScroll.removeEventListener("scroll",this._onScroll)}},{key:"componentWillUpdate",value:function(e,t){this._updateSync(e,t),!this._group&&group(this)}},{key:"_updateSync",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments[1];n=n||this.state;var r=this.settings,o=t.bindWindowResize||!1,i=n&&n.target,s=r.target,a=t.track||!1,l=i&&i.ownerDocument.defaultView,u=!0===t.bindScroll?"window":t.bindScroll,p=this._boundScroll,c=!!r.target&&this._upwardSelector(u,r);o!==r.bindWindowResize&&(o?l&&(l.addEventListener("resize",this._onResize),r.bindWindowResize=!0):(l&&l.removeEventListener("resize",this._onResize),r.bindWindowResize=!1)),r.titleStyle=t.titleStyle||defaults.titleStyle,r.wrapperStyle=t.wrapperStyle||defaults.wrapperStyle,c!==p&&(p&&(p.removeEventListener("scroll",this._onScroll),this._boundScroll=!1),c&&(c.addEventListener("scroll",this._onScroll,!0),this._boundScroll=c)),a!==r.track&&(a?(r.track=!0,this.track()):(r.track=!1,this.untrack())),i&&s!==i&&(i.addEventListener("mouseenter",this._onMouseEnter),i.addEventListener("mouseleave",this._onMouseLeave),i.addEventListener("click",this._onClick),r.target=i,s&&(s.removeEventListener("mouseenter",this._onMouseEnter),s.removeEventListener("mouseleave",this._onMouseLeave),s.removeEventListener("click",this._onClick))),t.persistOverContent?(r.persistOverContent=!0,r.onEnterContent=function(t){return e.show(t)},r.onLeaveContent=function(t){return e.hide(t)}):(r.persistOverContent=!1,r.onEnterContent=!1,r.onLeaveContent=!1),r.toggleOnClick=void 0!==t.toggleOnClick?t.toggleOnClick:defaults.toggleOnClick,r.showOnMouseEnter=void 0!==t.showOnMouseEnter?t.showOnMouseEnter:defaults.showOnMouseEnter,r.hideOnMouseLeave=void 0!==t.hideOnMouseLeave?t.hideOnMouseLeave:defaults.hideOnMouseLeave,r.constrainHeight=void 0!==t.constrainHeight?t.constrainHeight:defaults.constrainHeight,r.constrainWidth=void 0!==t.constrainWidth?t.constrainWidth:defaults.constrainWidth}},{key:"_updateAsync",value:function(){if(this.settings.target){var e=this,t=this.props,n=t.show,r=this.settings,o=r.showing&SHOWING.PROPERTY,i=r.target.ownerDocument,s=i.body,a=this._upwardSelector(".poppy-container",r),l=this.popover,u=void 0!==t.arrowSize?t.arrowSize:defaults.arrowSize,p=r.mergedArrowStyle=Object.assign({},r.arrowStyle,t.arrowStyle),c=t.region;if(c&&c!==r.last_prop_region?"top"===c?r.region=TOP:"left"===c?r.region=LEFT:"right"===c?r.region=RIGHT:"bottom"===c&&(r.region=BOTTOM):c||(r.region=defaults.region),r.backgroundStyle=t.backgroundStyle,r.last_prop_region=c,r.title=t.title||defaults.title,r.content=t.content||defaults.content,r.className=t.className||defaults.className,r.arrowSize=u,r.arrowSize3_4=.75*u,r.arrowSize1_2=.5*u,r.arrowSize2_1=2*u,r.arrowSize3_2=1.5*u,p.height=p.width=u,this._adjustPosition(this.settings),a===s&&(a=s.querySelector(".poppy-container")),a?this.overlay||(this.overlay=a):s.appendChild(a=this.overlay=overlay_template.cloneNode(!0)),l)this.overlay.ownerDocument!==i&&this.popoverEl&&(a.appendChild(this.popoverEl),this.overlay=a);else{var f=document.createElement("div");l=this.popover=ReactDOM.render(React.createElement(Popover,null),f),a.appendChild(f.lastChild)}l.setState(r),this.popoverEl||(this.popoverEl=ReactDOM.findDOMNode(l)),
2 | //!this._init_timer && requestAnimationFrame(function () {
3 | o&&!n?e.hide(SHOWING.PROPERTY):!o&&n&&e.show(SHOWING.PROPERTY),e._updatePositions()}}},{key:"__onResize",value:function(){var e=this;this._resize_timer&&clearTimeout(this._resize_timer),this._resize_timer=setTimeout(function(){e._resize_timer=void 0,e.setState({})},60)}},{key:"__onMouseEnter",value:function(){this.settings.showOnMouseEnter&&this.show(SHOWING.MOUSEOVER)}},{key:"__onMouseLeave",value:function(){this.settings.hideOnMouseLeave&&this.hide(SHOWING.MOUSEOVER)}},{key:"__onClick",value:function(){this.settings.toggleOnClick&&(this.settings.showing&SHOWING.CLICK?this.hide(SHOWING.CLICK):this.show(SHOWING.CLICK))}},{key:"_adjustPosition",value:function(e){var t,n,r,o,i=this.pack.targetRect,s=this.pack.parentRect,a=s.width/s.height,l=e.region,u=e.leftSpace=i.left-s.left,p=e.rightSpace=s.left+s.width-(i.left+i.width),c=e.topSpace=i.top-s.top,f=e.bottomSpace=s.top+s.height-(i.top+i.height),h=e.arrowSize,d=e.position,y=e.arrowSize3_4,m=e.constrainHeight,v=e.constrainWidth,g=2*h;d||(d=e.position={}),l||(n=.75*u,r=.75*p,t=c*a,o=f*a,l=e.region=n>o&&n>t&&n>=r?LEFT:r>o&&r>t?RIGHT:t>o?TOP:BOTTOM),l===LEFT?(d.minWidth=h,d.minHeight=g,d.top=d.left=0,v&&(d.maxWidth=Math.max(u-y-25,g)),m&&(d.maxHeight=Math.max(c+f+i.height-30,5))):l===RIGHT?(d.minWidth=h,d.top=0,d.minHeight=g,d.left=i.left+i.width+y,v&&(d.maxWidth=Math.max(p-y-25,g)),m&&(d.maxHeight=Math.max(c+f+i.height-30,5))):l===BOTTOM?(d.minHeight=h,d.top=i.top+i.height+y,d.left=0,d.minWidth=g,m&&(d.maxHeight=Math.max(f-y-5,25)),v&&(d.maxWidth=Math.max(u+p+i.width-30,25))):(d.minHeight=h,d.top=d.left=0,d.minWidth=g,m&&(d.maxHeight=Math.max(c-y+2,25)),v&&(d.maxWidth=Math.max(u+p+i.width-30,25)))}},{key:"__onScroll",value:function(){!this._group&&group(this,!0)}},{key:"__doTrack",value:function(){this._track_timer=setTimeout(this._doTrack,16),this.settings.target&&this.popover&&!this._group&&group(this,!0)}},{key:"track",value:function(){return this._track_timer||(this._track_timer=setTimeout(this._doTrack,16)),this}},{key:"untrack",value:function(){return this._track_timer&&(clearTimeout(this._track_timer),this._track_timer=!1),this}},{key:"refresh",value:function(){return this.setState({}),this}},{key:"hide",value:function(e){var t=this,n=this.settings,r=n.showing;if(r&&r&e){n.showing-=e;var o=this.popoverEl,i=o.style;this._show_timer&&clearTimeout(this._show_timer),this._show_timer=setTimeout(function(){n.showing||(!o.$listener&&o.addEventListener("transitionend",o.$listener=function(){o.removeEventListener("transitionend",o.$listener),o.$listener=!1,!n.showing&&(o.style.visibility="hidden")}),t._show_timer=void 0,i.transition="all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms",n.region===RIGHT?i.transform="translateX(30px)translateY(0px)":n.region===LEFT?i.transform="translateX(-30px)translateY(0px)":n.region===TOP?i.transform="translateX(0px)translateY(-30px)":i.transform="translateX(0px)translateY(30px)",i.pointerEvents="none",i.opacity=0,t.props.onHide&&t.props.onHide())},n.hideDelay)}}},{key:"show",value:function(e){var t=this,n=this.settings,r=this.popoverEl,o=r.style,i=!0,s=n.showing;n.showing|=e,s||(this._show_timer&&(clearTimeout(this._show_timer),this._show_timer=void 0,i=!1),r.$listener&&r.removeEventListener("transitionend",r.$listener),r.$listener=!1,i?this._show_timer=setTimeout(function(){n.showing&&(t.props.onShow&&t.props.onShow(),t._show_timer=void 0,o.transition=null,n.region===RIGHT?o.transfrom="translateX(30px)translateY(0px)":n.region===LEFT?o.transform="translateX(-30px)translateY(0px)":n.region===TOP?o.transform="translateX(0px)translateY(-30px)":o.transform="translateX(0px)translateY(30px)",o.pointerEvents="all",t._show_timer=setTimeout(function(){t._show_timer=void 0,o.transition="all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms",o.visibility=null,o.opacity=1,o.transform="translateX(0px)translateY(0px)"},n.showDelay))}):(o.transition="all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms",o.visibility=null,o.opacity=1,o.transform="translateX(0px)translateY(0px)"))}},{key:"_upwardSelector",value:function(e,t){var n=t.target,r=n.ownerDocument;if(!e)return e;if("string"==typeof e){if("body"===e)return r.body;if("parent"===e)return n&&n.parentNode;if("window"===e)return n&&n.ownerDocument.defaultView;for(;n;){if(n.matches&&n.matches(e))return n;n=n.parentNode}return r.body}return(n=ReactDOM.findDOMNode(e))?n:e}},{key:"_updatePositions",value:function(){if(this.settings.target){var e,t,n,r,o,i,s,a,l=this.popover.refs.overflow,u=l.style,p=this.popover.refs.wrapper.style,c=this.popover.refs.arrow,f=c.style,h=this.popover.refs.content.style,d=this.settings,y=this.popover.refs.title,m=y&&y.getBoundingClientRect(),v=this.pack.targetRect,g=this.pack.parentRect,_=m&&m.width||0,w=m&&m.height||0,b=v.top,T=v.width,O=T/2,E=v.height,S=E/2,x=v.left,k=t=g.top,R=n=g.left,C=0|n,N=0|t,M=d.region,L=d.leftSpace,H=d.topSpace,P=0|d.arrowSize,W=d.arrowSize1_2,z=d.arrowSize3_4,j=d.arrowSize2_1,D=d.arrowSize3_2,I=d.position.left,A=d.position.top;u.paddingTop=w+"px",u.maxHeight=Math.max(Math.round(this.settings.position.maxHeight-w),0)+"px",e=l.getBoundingClientRect(),r=Math.max(e.width,_),o=e.height,this.settings.target&&(M===TOP||M===BOTTOM?(s=5,i=R+g.width-5,n=x+O-r/2,n(a=i-r)&&(n=a),(a=x+P)>i&&(n=a-r),C+=L+O-P,C=Math.max(Math.min(C,n+r-j),n)+W,I=n,M===TOP?(A=b-o-z-9,N=b-z-9-W):N=A-W):M!==LEFT&&M!==RIGHT||(t+=H+E-S-o/2,i=k+g.height-5,s=5,t(a=i-o)&&(t=a),(a=b+P)>i&&(t=a-o),N+=H+S-P,N=Math.max(Math.min(N,t+o-j),t)+W,A=t,M===LEFT?(I=x-r-z-6,C=I+r-W-1):(I=x+T+z,C=I-W+1)),h.width=p.width=(0|r)+"px",isSafari&&this._unsafe&&this.popoverEl&&(this.popoverEl.style.transition=f.transition=h.transition=p.transition=group_timer?"none":null),h.width=p.width=(0|r)+"px",f.top=(0|N)+"px",f.left=(0|C)+"px",p.top=h.top=(0|A)+"px",p.left=h.left=(0|I)+"px",p.height=(0|o)+"px",this.settings.showing&&this.popoverEl.style.visiblity&&(this.popoverEl.style.visiblity=null))}}},{key:"render",value:function(){var e=this.props.children;return"string"==typeof e&&(e=React.createElement("span",null,e)),e||null}}]),t}(React.Component),module.exports.propTypes={children:propTypes.any,constrainTo:propTypes.any,show:propTypes.bool,showDelay:propTypes.number,hideDelay:propTypes.number,track:propTypes.bool,constrainHeight:propTypes.bool,constrainWidth:propTypes.bool,arrowSize:propTypes.number,region:propTypes.oneOf(["left","right","top","bottom",null,!1,void 0]),bindScroll:propTypes.oneOfType([propTypes.bool,propTypes.string]),bindWindowResize:propTypes.bool,arrowStyle:propTypes.object,backgroundStyle:propTypes.object,wrapperStyle:propTypes.object,titleStyle:propTypes.object,className:propTypes.string,title:propTypes.any,showOnMouseEnter:propTypes.bool,hideOnMouseLeave:propTypes.bool,toggleOnClick:propTypes.bool,persistOverContent:propTypes.bool,onHide:propTypes.func,onShow:propTypes.func},module.exports.defaultProps={constrainTo:"parent",showDelay:300,hideDelay:320,track:!1,constrainHeight:!0,constrainWidth:!0,arrowSize:15,bindScroll:!1,bindWindowResize:!1,className:"",title:"",showOnMouseEnter:!0,hideOnMouseLeave:!0,toggleOnClick:!1,persistOverContent:!1}},function(e,t){e.exports=void 0},function(e,t,n){(function(t){if("production"!==t.env.NODE_ENV){var r="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,o=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r};e.exports=n(11)(o,!0)}else e.exports=n(13)()}).call(t,n(0))},function(e,t,n){"use strict";(function(t){var r=n(1),o=n(2),i=n(5),s=n(3),a=n(12);e.exports=function(e,n){function l(e){var t=e&&(S&&e[S]||e[x]);if("function"==typeof t)return t}function u(e,t){return e===t?0!==e||1/e==1/t:e!==e&&t!==t}function p(e){this.message=e,this.stack=""}function c(e){function r(r,u,c,f,h,d,y){if(f=f||k,d=d||c,y!==s)if(n)o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else if("production"!==t.env.NODE_ENV&&"undefined"!=typeof console){var m=f+":"+c;!a[m]&&l<3&&(i(!1,"You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.",d,f),a[m]=!0,l++)}return null==u[c]?r?new p(null===u[c]?"The "+h+" `"+d+"` is marked as required in `"+f+"`, but its value is `null`.":"The "+h+" `"+d+"` is marked as required in `"+f+"`, but its value is `undefined`."):null:e(u,c,f,h,d)}if("production"!==t.env.NODE_ENV)var a={},l=0;var u=r.bind(null,!1);return u.isRequired=r.bind(null,!0),u}function f(e){function t(t,n,r,o,i,s){var a=t[n];if(b(a)!==e)return new p("Invalid "+o+" `"+i+"` of type `"+T(a)+"` supplied to `"+r+"`, expected `"+e+"`.");return null}return c(t)}function h(e){function t(t,n,r,o,i){if("function"!=typeof e)return new p("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var a=t[n];if(!Array.isArray(a)){return new p("Invalid "+o+" `"+i+"` of type `"+b(a)+"` supplied to `"+r+"`, expected an array.")}for(var l=0;l>",R={array:f("array"),bool:f("boolean"),func:f("function"),number:f("number"),object:f("object"),string:f("string"),symbol:f("symbol"),any:function(){return c(r.thatReturnsNull)}(),arrayOf:h,element:function(){function t(t,n,r,o,i){var s=t[n];if(!e(s)){return new p("Invalid "+o+" `"+i+"` of type `"+b(s)+"` supplied to `"+r+"`, expected a single ReactElement.")}return null}return c(t)}(),instanceOf:d,node:function(){function e(e,t,n,r,o){return _(e[t])?null:new p("Invalid "+r+" `"+o+"` supplied to `"+n+"`, expected a ReactNode.")}return c(e)}(),objectOf:m,oneOf:y,oneOfType:v,shape:g};return p.prototype=Error.prototype,R.checkPropTypes=a,R.PropTypes=R,R}}).call(t,n(0))},function(e,t,n){"use strict";(function(t){function r(e,n,r,l,u){if("production"!==t.env.NODE_ENV)for(var p in e)if(e.hasOwnProperty(p)){var c;try{o("function"==typeof e[p],"%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",l||"React class",r,p),c=e[p](n,p,l,r,null,s)}catch(e){c=e}if(i(!c||c instanceof Error,"%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",l||"React class",r,p,typeof c),c instanceof Error&&!(c.message in a)){a[c.message]=!0;var f=u?u():"";i(!1,"Failed %s type: %s%s",r,c.message,null!=f?f:"")}}}if("production"!==t.env.NODE_ENV)var o=n(2),i=n(5),s=n(3),a={};e.exports=r}).call(t,n(0))},function(e,t,n){"use strict";var r=n(1),o=n(2),i=n(3);e.exports=function(){function e(e,t,n,r,s,a){a!==i&&o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t};return n.checkPropTypes=r,n.PropTypes=n,n}},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var n=0;n1)for(var n=1;n1?t-1:0),r=1;r2?r-2:0),i=2;i=0&&isSafari.indexOf("chrome")<0;var SHOWING={NONE:0,MOUSEOVER:1,CONTENT:2,CLICK:4,PROPERTY:8},LEFT=1,RIGHT=2,TOP=3,BOTTOM=4,defaults={backgroundStyle:void 0,arrowStyle:{},wrapperStyle:void 0,titleStyle:void 0,content:"",className:"",title:"",position:{overflow:"auto",position:"relative",top:0,height:"100%",left:0,width:"100%"},constrainTo:"parent",persistOverContent:!1,showOnMouseEnter:!0,hideOnMouseLeave:!0,bindWindowResize:!1,bindScroll:!1,toggleOnClick:!1,constrainWidth:!0,constrainHeight:!0,track:!1,arrowSize:15,region:void 0,show:void 0,showDelay:300,hideDelay:320},getDefaults=eval("(function () {return "+JSON.stringify(defaults)+";})");!function(defaults){var p,item;for(p in defaults)(item=defaults[p])&&"object"===(void 0===item?"undefined":_typeof(item))&&(defaults[p]=eval("(function (obj) {var result ="+JSON.stringify(item)+",p; for (p in obj) {result[p]=obj[p]} return result;})"))}(defaults);var Popover=function(e){function t(){_classCallCheck(this,t);var e=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e._onExit=function(t){e.__onExit(t)},e._onEnter=function(t){e.__onEnter(t)},e}return _inherits(t,e),_createClass(t,[{key:"shouldComponentUpdate",value:function(e,t){var n=this.state||{},r=t.position||{};return this.minWidth!==r.minWidth||this.minHeight!==r.minHeight||this.maxWidth!==r.maxWidth||n.content!==t.content||n.title!==t.title||this.maxHeight!==r.maxHeight}},{key:"render",value:function(){var e=this.state;if(!e)return null;var t=e.title,n=e.position,r=n.maxWidth,o=n.maxHeight,i=n.minWidth,s=n.minHeight,a=e.content,u=this.overflowStyle,l=this.wrapperStyle,p=e.wrapperStyle||{},c=e.backgroundStyle||{};return u.overflow=a?"auto":null,this.maxHeight=u.maxHeight=l.maxHeight=o,this.maxWidth=u.maxWidth=l.maxWidth=r,this.minHeight=c.minHeight=p.minHeight=s,this.minWidth=c.minWidth=p.minWidth=i,React.createElement("span",{className:"poppy "+(e.className||""),onMouseOver:this._onEnter,onMouseOut:this._onExit},React.createElement("span",{ref:"inner",style:e.backgroundStyle,className:"poppy-background"},React.createElement("div",{ref:"arrow",className:"poppy-arrow",style:e.mergedArrowStyle}),React.createElement("div",{ref:"wrapper",className:"poppy-background-overlay",style:p})),React.createElement("div",{ref:"content",className:"poppy-content-wrapper",style:l},t?React.createElement("div",{ref:"titleWrapper",style:e.titleStyle,className:"poppy-title-wrapper"},React.createElement("span",{ref:"title",className:"poppy-title"},e.title)):null,React.createElement("div",{ref:"overflow",className:"poppy-overflow",style:u},a?React.createElement("div",{ref:"popover",className:"poppy-content"}," ",a||""," "):React.createElement("span",{ref:"popover"}))))}},{key:"__onEnter",value:function(){this.state.onEnterContent&&this.state.onEnterContent(SHOWING.CONTENT)}},{key:"__onExit",value:function(){this.state.onLeaveContent&&this.state.onLeaveContent(SHOWING.CONTENT)}}]),t}(React.Component),overlay_template=document.createElement("span");overlay_template.innerHTML='',overlay_template=overlay_template.lastChild,Popover.prototype.overflowStyle={},Popover.prototype.wrapperStyle={},module.exports=function(e){function t(){_classCallCheck(this,t);var e=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this)),n=assign_defaults(e.props);return e._lastTargetRect={left:0,top:0,width:0,height:0},e.pack={},e._transitioning=!0,e._doTrack=function(t){return e.__doTrack(t)},e._onClick=function(t){return e.__onClick(t)},e._onResize=function(t){return e.__onResize(t)},e._onScroll=function(t){return e.__onScroll(t)},e._onMouseEnter=function(t){return e.__onMouseEnter(t)},e._onMouseLeave=function(t){return e.__onMouseLeave(t)},e.settings={arrowStyle:{width:defaults.arrowSize,height:defaults.arrowSize},constrainTo:defaults.constrainTo,showing:0,showDelay:defaults.showDelay,hideDelay:defaults.hideDelay,track:defaults.track,constrainHeight:defaults.constrainHeight,constrainWidth:defaults.constrainWidth,className:defaults.className,title:""},e.componentWillUpdate(e.props,n),e.state=n,e}return _inherits(t,e),_createClass(t,[{key:"componentDidMount",value:function(){var e=this,t=ReactDOM.findDOMNode(this);e.setState({target:t}),this._mount_timer=setTimeout(function(){e._updateSync(e.props,e.state)})}},{key:"componentWillUnmount",value:function(){var e=this.state.target,t=e.ownerDocument,n=t.defaultView;this.settings&&(e=this.settings.target)&&(e.removeEventListener("mouseenter",this._onMouseEnter),e.removeEventListener("mouseleave",this._onMouseLeave),e.removeEventListener("click",this._onClick)),this.untrack(),this._resize_timer&&clearTimeout(this._resize_timer),this._show_timer&&clearTimeout(this._show_timer),this._mount_timer&&clearTimeout(this._mount_timer),this.overlay&&this.popoverEl.parentNode===this.overlay&&this.overlay.removeChild(this.popoverEl),this._init_timer&&clearTimeout(this._init_timer),this.settings.bindWindowResize&&n.removeEventListener("resize",this._onResize),this._boundScroll&&this._boundScroll.removeEventListener("scroll",this._onScroll)}},{key:"componentWillUpdate",value:function(e,t){this._updateSync(e,t),!this._group&&group(this)}},{key:"_updateSync",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments[1];n=n||this.state;var r=this.settings,o=t.bindWindowResize||!1,i=n&&n.target,s=r.target,a=t.track||!1,u=i&&i.ownerDocument.defaultView,l=!0===t.bindScroll?"window":t.bindScroll,p=this._boundScroll,c=!!r.target&&this._upwardSelector(l,r);o!==r.bindWindowResize&&(o?u&&(u.addEventListener("resize",this._onResize),r.bindWindowResize=!0):(u&&u.removeEventListener("resize",this._onResize),r.bindWindowResize=!1)),r.titleStyle=t.titleStyle||defaults.titleStyle,r.wrapperStyle=t.wrapperStyle||defaults.wrapperStyle,c!==p&&(p&&(p.removeEventListener("scroll",this._onScroll),this._boundScroll=!1),c&&(c.addEventListener("scroll",this._onScroll,!0),this._boundScroll=c)),a!==r.track&&(a?(r.track=!0,this.track()):(r.track=!1,this.untrack())),i&&s!==i&&(i.addEventListener("mouseenter",this._onMouseEnter),i.addEventListener("mouseleave",this._onMouseLeave),i.addEventListener("click",this._onClick),r.target=i,s&&(s.removeEventListener("mouseenter",this._onMouseEnter),s.removeEventListener("mouseleave",this._onMouseLeave),s.removeEventListener("click",this._onClick))),t.persistOverContent?(r.persistOverContent=!0,r.onEnterContent=function(t){return e.show(t)},r.onLeaveContent=function(t){return e.hide(t)}):(r.persistOverContent=!1,r.onEnterContent=!1,r.onLeaveContent=!1),r.toggleOnClick=void 0!==t.toggleOnClick?t.toggleOnClick:defaults.toggleOnClick,r.showOnMouseEnter=void 0!==t.showOnMouseEnter?t.showOnMouseEnter:defaults.showOnMouseEnter,r.hideOnMouseLeave=void 0!==t.hideOnMouseLeave?t.hideOnMouseLeave:defaults.hideOnMouseLeave,r.constrainHeight=void 0!==t.constrainHeight?t.constrainHeight:defaults.constrainHeight,r.constrainWidth=void 0!==t.constrainWidth?t.constrainWidth:defaults.constrainWidth}},{key:"_updateAsync",value:function(){if(this.settings.target){var e=this,t=this.props,n=t.show,r=this.settings,o=r.showing&SHOWING.PROPERTY,i=r.target.ownerDocument,s=i.body,a=this._upwardSelector(".poppy-container",r),u=this.popover,l=void 0!==t.arrowSize?t.arrowSize:defaults.arrowSize,p=r.mergedArrowStyle=Object.assign({},r.arrowStyle,t.arrowStyle),c=t.region;if(c&&c!==r.last_prop_region?"top"===c?r.region=TOP:"left"===c?r.region=LEFT:"right"===c?r.region=RIGHT:"bottom"===c&&(r.region=BOTTOM):c||(r.region=defaults.region),r.backgroundStyle=t.backgroundStyle,r.last_prop_region=c,r.title=t.title||defaults.title,r.content=t.content||defaults.content,r.className=t.className||defaults.className,r.arrowSize=l,r.arrowSize3_4=.75*l,r.arrowSize1_2=.5*l,r.arrowSize2_1=2*l,r.arrowSize3_2=1.5*l,p.height=p.width=l,this._adjustPosition(this.settings),a===s&&(a=s.querySelector(".poppy-container")),a?this.overlay||(this.overlay=a):s.appendChild(a=this.overlay=overlay_template.cloneNode(!0)),u)this.overlay.ownerDocument!==i&&this.popoverEl&&(a.appendChild(this.popoverEl),this.overlay=a);else{var f=document.createElement("div");u=this.popover=ReactDOM.render(React.createElement(Popover,null),f),a.appendChild(f.lastChild)}u.setState(r),this.popoverEl||(this.popoverEl=ReactDOM.findDOMNode(u)),
2 | //!this._init_timer && requestAnimationFrame(function () {
3 | o&&!n?e.hide(SHOWING.PROPERTY):!o&&n&&e.show(SHOWING.PROPERTY),e._updatePositions()}}},{key:"__onResize",value:function(){var e=this;this._resize_timer&&clearTimeout(this._resize_timer),this._resize_timer=setTimeout(function(){e._resize_timer=void 0,e.setState({})},60)}},{key:"__onMouseEnter",value:function(){this.settings.showOnMouseEnter&&this.show(SHOWING.MOUSEOVER)}},{key:"__onMouseLeave",value:function(){this.settings.hideOnMouseLeave&&this.hide(SHOWING.MOUSEOVER)}},{key:"__onClick",value:function(){this.settings.toggleOnClick&&(this.settings.showing&SHOWING.CLICK?this.hide(SHOWING.CLICK):this.show(SHOWING.CLICK))}},{key:"_adjustPosition",value:function(e){var t,n,r,o,i=this.pack.targetRect,s=this.pack.parentRect,a=s.width/s.height,u=e.region,l=e.leftSpace=i.left-s.left,p=e.rightSpace=s.left+s.width-(i.left+i.width),c=e.topSpace=i.top-s.top,f=e.bottomSpace=s.top+s.height-(i.top+i.height),h=e.arrowSize,d=e.position,y=e.arrowSize3_4,m=e.constrainHeight,v=e.constrainWidth,g=2*h;d||(d=e.position={}),u||(n=.75*l,r=.75*p,t=c*a,o=f*a,u=e.region=n>o&&n>t&&n>=r?LEFT:r>o&&r>t?RIGHT:t>o?TOP:BOTTOM),u===LEFT?(d.minWidth=h,d.minHeight=g,d.top=d.left=0,v&&(d.maxWidth=Math.max(l-y-25,g)),m&&(d.maxHeight=Math.max(c+f+i.height-30,5))):u===RIGHT?(d.minWidth=h,d.top=0,d.minHeight=g,d.left=i.left+i.width+y,v&&(d.maxWidth=Math.max(p-y-25,g)),m&&(d.maxHeight=Math.max(c+f+i.height-30,5))):u===BOTTOM?(d.minHeight=h,d.top=i.top+i.height+y,d.left=0,d.minWidth=g,m&&(d.maxHeight=Math.max(f-y-5,25)),v&&(d.maxWidth=Math.max(l+p+i.width-30,25))):(d.minHeight=h,d.top=d.left=0,d.minWidth=g,m&&(d.maxHeight=Math.max(c-y+2,25)),v&&(d.maxWidth=Math.max(l+p+i.width-30,25)))}},{key:"__onScroll",value:function(){!this._group&&group(this,!0)}},{key:"__doTrack",value:function(){this._track_timer=setTimeout(this._doTrack,16),this.settings.target&&this.popover&&!this._group&&group(this,!0)}},{key:"track",value:function(){return this._track_timer||(this._track_timer=setTimeout(this._doTrack,16)),this}},{key:"untrack",value:function(){return this._track_timer&&(clearTimeout(this._track_timer),this._track_timer=!1),this}},{key:"refresh",value:function(){return this.setState({}),this}},{key:"hide",value:function(e){var t=this,n=this.settings,r=n.showing;if(r&&r&e){n.showing-=e;var o=this.popoverEl,i=o.style;this._show_timer&&clearTimeout(this._show_timer),this._show_timer=setTimeout(function(){n.showing||(!o.$listener&&o.addEventListener("transitionend",o.$listener=function(){o.removeEventListener("transitionend",o.$listener),o.$listener=!1,!n.showing&&(o.style.visibility="hidden")}),t._show_timer=void 0,i.transition="all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms",n.region===RIGHT?i.transform="translateX(30px)translateY(0px)":n.region===LEFT?i.transform="translateX(-30px)translateY(0px)":n.region===TOP?i.transform="translateX(0px)translateY(-30px)":i.transform="translateX(0px)translateY(30px)",i.pointerEvents="none",i.opacity=0,t.props.onHide&&t.props.onHide())},n.hideDelay)}}},{key:"show",value:function(e){var t=this,n=this.settings,r=this.popoverEl,o=r.style,i=!0,s=n.showing;n.showing|=e,s||(this._show_timer&&(clearTimeout(this._show_timer),this._show_timer=void 0,i=!1),r.$listener&&r.removeEventListener("transitionend",r.$listener),r.$listener=!1,i?this._show_timer=setTimeout(function(){n.showing&&(t.props.onShow&&t.props.onShow(),t._show_timer=void 0,o.transition=null,n.region===RIGHT?o.transfrom="translateX(30px)translateY(0px)":n.region===LEFT?o.transform="translateX(-30px)translateY(0px)":n.region===TOP?o.transform="translateX(0px)translateY(-30px)":o.transform="translateX(0px)translateY(30px)",o.pointerEvents="all",t._show_timer=setTimeout(function(){t._show_timer=void 0,o.transition="all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms",o.visibility=null,o.opacity=1,o.transform="translateX(0px)translateY(0px)"},n.showDelay))}):(o.transition="all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms",o.visibility=null,o.opacity=1,o.transform="translateX(0px)translateY(0px)"))}},{key:"_upwardSelector",value:function(e,t){var n=t.target,r=n.ownerDocument;if(!e)return e;if("string"==typeof e){if("body"===e)return r.body;if("parent"===e)return n&&n.parentNode;if("window"===e)return n&&n.ownerDocument.defaultView;for(;n;){if(n.matches&&n.matches(e))return n;n=n.parentNode}return r.body}return(n=ReactDOM.findDOMNode(e))?n:e}},{key:"_updatePositions",value:function(){if(this.settings.target){var e,t,n,r,o,i,s,a,u=this.popover.refs.overflow,l=u.style,p=this.popover.refs.wrapper.style,c=this.popover.refs.arrow,f=c.style,h=this.popover.refs.content.style,d=this.settings,y=this.popover.refs.title,m=y&&y.getBoundingClientRect(),v=this.pack.targetRect,g=this.pack.parentRect,_=m&&m.width||0,w=m&&m.height||0,b=v.top,T=v.width,E=T/2,O=v.height,S=O/2,x=v.left,k=t=g.top,R=n=g.left,C=0|n,N=0|t,M=d.region,L=d.leftSpace,P=d.topSpace,W=0|d.arrowSize,H=d.arrowSize1_2,z=d.arrowSize3_4,j=d.arrowSize2_1,D=d.arrowSize3_2,I=d.position.left,A=d.position.top;l.paddingTop=w+"px",l.maxHeight=Math.max(Math.round(this.settings.position.maxHeight-w),0)+"px",e=u.getBoundingClientRect(),r=Math.max(e.width,_),o=e.height,this.settings.target&&(M===TOP||M===BOTTOM?(s=5,i=R+g.width-5,n=x+E-r/2,n(a=i-r)&&(n=a),(a=x+W)>i&&(n=a-r),C+=L+E-W,C=Math.max(Math.min(C,n+r-j),n)+H,I=n,M===TOP?(A=b-o-z-9,N=b-z-9-H):N=A-H):M!==LEFT&&M!==RIGHT||(t+=P+O-S-o/2,i=k+g.height-5,s=5,t(a=i-o)&&(t=a),(a=b+W)>i&&(t=a-o),N+=P+S-W,N=Math.max(Math.min(N,t+o-j),t)+H,A=t,M===LEFT?(I=x-r-z-6,C=I+r-H-1):(I=x+T+z,C=I-H+1)),h.width=p.width=(0|r)+"px",isSafari&&this._unsafe&&this.popoverEl&&(this.popoverEl.style.transition=f.transition=h.transition=p.transition=group_timer?"none":null),h.width=p.width=(0|r)+"px",f.top=(0|N)+"px",f.left=(0|C)+"px",p.top=h.top=(0|A)+"px",p.left=h.left=(0|I)+"px",p.height=(0|o)+"px",this.settings.showing&&this.popoverEl.style.visiblity&&(this.popoverEl.style.visiblity=null))}}},{key:"render",value:function(){var e=this.props.children;return"string"==typeof e&&(e=React.createElement("span",null,e)),e||null}}]),t}(React.Component),module.exports.propTypes={children:propTypes.any,constrainTo:propTypes.any,show:propTypes.bool,showDelay:propTypes.number,hideDelay:propTypes.number,track:propTypes.bool,constrainHeight:propTypes.bool,constrainWidth:propTypes.bool,arrowSize:propTypes.number,region:propTypes.oneOf(["left","right","top","bottom",null,!1,void 0]),bindScroll:propTypes.oneOfType([propTypes.bool,propTypes.string]),bindWindowResize:propTypes.bool,arrowStyle:propTypes.object,backgroundStyle:propTypes.object,wrapperStyle:propTypes.object,titleStyle:propTypes.object,className:propTypes.string,title:propTypes.any,showOnMouseEnter:propTypes.bool,hideOnMouseLeave:propTypes.bool,toggleOnClick:propTypes.bool,persistOverContent:propTypes.bool,onHide:propTypes.func,onShow:propTypes.func},module.exports.defaultProps={constrainTo:"parent",showDelay:300,hideDelay:320,track:!1,constrainHeight:!0,constrainWidth:!0,arrowSize:15,bindScroll:!1,bindWindowResize:!1,className:"",title:"",showOnMouseEnter:!0,hideOnMouseLeave:!0,toggleOnClick:!1,persistOverContent:!1}},function(e,t){e.exports=__WEBPACK_EXTERNAL_MODULE_9__},function(e,t,n){(function(t){if("production"!==t.env.NODE_ENV){var r="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,o=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r};e.exports=n(11)(o,!0)}else e.exports=n(13)()}).call(t,n(0))},function(e,t,n){"use strict";(function(t){var r=n(1),o=n(2),i=n(5),s=n(3),a=n(12);e.exports=function(e,n){function u(e){var t=e&&(S&&e[S]||e[x]);if("function"==typeof t)return t}function l(e,t){return e===t?0!==e||1/e==1/t:e!==e&&t!==t}function p(e){this.message=e,this.stack=""}function c(e){function r(r,l,c,f,h,d,y){if(f=f||k,d=d||c,y!==s)if(n)o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else if("production"!==t.env.NODE_ENV&&"undefined"!=typeof console){var m=f+":"+c;!a[m]&&u<3&&(i(!1,"You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.",d,f),a[m]=!0,u++)}return null==l[c]?r?new p(null===l[c]?"The "+h+" `"+d+"` is marked as required in `"+f+"`, but its value is `null`.":"The "+h+" `"+d+"` is marked as required in `"+f+"`, but its value is `undefined`."):null:e(l,c,f,h,d)}if("production"!==t.env.NODE_ENV)var a={},u=0;var l=r.bind(null,!1);return l.isRequired=r.bind(null,!0),l}function f(e){function t(t,n,r,o,i,s){var a=t[n];if(b(a)!==e)return new p("Invalid "+o+" `"+i+"` of type `"+T(a)+"` supplied to `"+r+"`, expected `"+e+"`.");return null}return c(t)}function h(e){function t(t,n,r,o,i){if("function"!=typeof e)return new p("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var a=t[n];if(!Array.isArray(a)){return new p("Invalid "+o+" `"+i+"` of type `"+b(a)+"` supplied to `"+r+"`, expected an array.")}for(var u=0;u>",R={array:f("array"),bool:f("boolean"),func:f("function"),number:f("number"),object:f("object"),string:f("string"),symbol:f("symbol"),any:function(){return c(r.thatReturnsNull)}(),arrayOf:h,element:function(){function t(t,n,r,o,i){var s=t[n];if(!e(s)){return new p("Invalid "+o+" `"+i+"` of type `"+b(s)+"` supplied to `"+r+"`, expected a single ReactElement.")}return null}return c(t)}(),instanceOf:d,node:function(){function e(e,t,n,r,o){return _(e[t])?null:new p("Invalid "+r+" `"+o+"` supplied to `"+n+"`, expected a ReactNode.")}return c(e)}(),objectOf:m,oneOf:y,oneOfType:v,shape:g};return p.prototype=Error.prototype,R.checkPropTypes=a,R.PropTypes=R,R}}).call(t,n(0))},function(e,t,n){"use strict";(function(t){function r(e,n,r,u,l){if("production"!==t.env.NODE_ENV)for(var p in e)if(e.hasOwnProperty(p)){var c;try{o("function"==typeof e[p],"%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",u||"React class",r,p),c=e[p](n,p,u,r,null,s)}catch(e){c=e}if(i(!c||c instanceof Error,"%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",u||"React class",r,p,typeof c),c instanceof Error&&!(c.message in a)){a[c.message]=!0;var f=l?l():"";i(!1,"Failed %s type: %s%s",r,c.message,null!=f?f:"")}}}if("production"!==t.env.NODE_ENV)var o=n(2),i=n(5),s=n(3),a={};e.exports=r}).call(t,n(0))},function(e,t,n){"use strict";var r=n(1),o=n(2),i=n(3);e.exports=function(){function e(e,t,n,r,s,a){a!==i&&o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t};return n.checkPropTypes=r,n.PropTypes=n,n}},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var n=0;n
9 | }
10 | };
11 |
--------------------------------------------------------------------------------
/libs/index.js:
--------------------------------------------------------------------------------
1 | module.exports = require('./poppy.js');
2 | module.exports.Container = require('./container.js');
3 |
--------------------------------------------------------------------------------
/libs/poppy.css:
--------------------------------------------------------------------------------
1 | .poppy {
2 | visiblity:hidden;
3 | display:inline-block;
4 | opacity:0;
5 | position:absolute;
6 | z-index:0;
7 | backface-visibility:hidden;
8 | -webkit-backface-visibility:hidden;
9 | }
10 | .poppy-background {
11 | opacity:0.925;
12 | z-index:0;
13 | backface-visibility:hidden;
14 | background:#000;
15 | transform:translateZ(0);
16 | }
17 | .poppy-arrow {
18 | position:absolute;
19 | z-index:-1;
20 | background:inherit;
21 | transition: all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms;
22 | transform:rotateZ(45deg);
23 | }
24 | .poppy-background-overlay {
25 | z-index:0;
26 | background:inherit;
27 | border-radius:4px;
28 | border-top-width:0;
29 | position: absolute;
30 | top: 0px;
31 | left: 0px;
32 | width: 100%;
33 | transform: translateZ(0);
34 | height: 100%;
35 | transition : all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms;
36 | }
37 | .poppy-content {
38 | display:inline-block;
39 | z-index: 1;
40 | position: relative;
41 | /*pointer-events:all;*/
42 | transition:none;
43 | padding-left: 10px;
44 | width: auto;
45 | padding-right: 10px;
46 | padding-top: 10px;
47 | padding-bottom: 5px;
48 | color: #fff;
49 | font-size: 12px;
50 | box-sizing: border-box;
51 | }
52 | .poppy-overflow {
53 | position:relative;
54 | display: inline-block;
55 | z-index:0;
56 | padding:0;
57 | transition:none;
58 | }
59 | .poppy-content-wrapper {
60 | position:absolute;
61 | /*pointer-events:all;*/
62 | width:auto;
63 | display:inline-block;
64 | transition:all 450ms cubic-bezier(0.23,1,0.32,1) 0ms;
65 | overflow:hidden;
66 | z-index:1;
67 | }
68 | .poppy-title-wrapper {
69 | z-index:1;
70 | transition:none;
71 | position:absolute;
72 | display:inline-block;
73 | width: 100%;
74 | text-align: center;
75 | transition: none;
76 | color: #fff;
77 | }
78 | .poppy-title {
79 | display: inline-block;
80 | white-space:nowrap;
81 | padding: 10px;
82 | }
83 |
--------------------------------------------------------------------------------
/libs/poppy.js:
--------------------------------------------------------------------------------
1 |
2 | var group_timer,
3 | groups=[],
4 | React = require('react'),
5 | ReactDOM = require('react-dom'),
6 | isSafari = navigator.userAgent.toLowerCase(),
7 | propTypes = require('prop-types');
8 |
9 | isSafari = (isSafari.indexOf('safari') >= 0) && (isSafari.indexOf('chrome') < 0);
10 |
11 | function group (item,unsafe) {
12 | if (!group_timer) {
13 | group_timer = requestAnimationFrame(do_group,16);
14 | }
15 | item._group = 1;
16 | unsafe && (item._unsafe=1);
17 | groups.push(item);
18 | }
19 | function ungroup (item) {
20 | var index = groups.indexOf(item);
21 | groups[index] = 0;
22 | }
23 | function do_group () {
24 | var i,ln,item,
25 | pack,
26 | settings;
27 | for (i=0,ln=groups.length;i {this.__onExit(e)};
161 | this._onEnter = (e) => {this.__onEnter(e)};
162 | }
163 | shouldComponentUpdate (props,state) {
164 | var last = this.state || {},
165 | position2 = state.position || {},
166 | result = (this.minWidth !== position2.minWidth || this.minHeight !== position2.minHeight || this.maxWidth !== position2.maxWidth || last.content !== state.content || last.title !== state.title || this.maxHeight !== position2.maxHeight);
167 | return result;
168 | }
169 | render () {
170 | var state = this.state;
171 | if (!state) {
172 | return null;
173 | }
174 | var title = state.title,
175 | position = state.position,
176 | maxWidth = position.maxWidth,
177 | maxHeight = position.maxHeight,
178 | minWidth = position.minWidth,
179 | minHeight = position.minHeight,
180 | content = state.content,
181 | overflowStyle = this.overflowStyle,
182 | wrapperStyle = this.wrapperStyle,
183 | sWrap = state.wrapperStyle || {},
184 | backgroundStyle = state.backgroundStyle || {};
185 |
186 |
187 | overflowStyle.overflow = content ? 'auto' : null;
188 | this.maxHeight = overflowStyle.maxHeight = wrapperStyle.maxHeight = maxHeight;
189 | this.maxWidth = overflowStyle.maxWidth = wrapperStyle.maxWidth = maxWidth;
190 | this.minHeight = backgroundStyle.minHeight = sWrap.minHeight = minHeight;
191 | this.minWidth = backgroundStyle.minWidth = sWrap.minWidth = minWidth;
192 |
193 |
194 |
195 |
196 | return (
197 |
198 |
199 |
200 |
201 |