From 66bc597256532b817b91ab764d00987a5552f743 Mon Sep 17 00:00:00 2001 From: Alan Souza Date: Fri, 6 Oct 2017 11:41:39 -0700 Subject: [PATCH] v1.8.3 --- bower.json | 4 ++-- grommet.js | 4 +++- grommet.min.js | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bower.json b/bower.json index c47e667..ae8028a 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "grommet", - "version": "1.8.2", + "version": "1.8.3", "main": "grommet.js", "description": "The most advanced UX framework for enterprise applications.", "authors": [ @@ -26,7 +26,7 @@ }, "dependencies": { "react": "^15.0.2", - "grommet": "^1.8.2" + "grommet": "^1.8.3" }, "ignore": [] } \ No newline at end of file diff --git a/grommet.js b/grommet.js index ae5836d..73b7e46 100644 --- a/grommet.js +++ b/grommet.js @@ -41674,7 +41674,9 @@ var Grommet = ); } - var tileContents = _react.Children.map(children, function (element, index) { + var tileContents = _react.Children.toArray(children).filter(function (child) { + return child; + }).map(function (element, index) { return _this4._renderChild(element, index); }); diff --git a/grommet.min.js b/grommet.min.js index 076bab5..e3cec17 100644 --- a/grommet.min.js +++ b/grommet.min.js @@ -53,7 +53,7 @@ e.exports=function(e){return null!=e&&(n(e)||r(e)||!!e._isBuffer)}},function(e,t return r&&r.length>0&&(void 0===n?(r[0].classList.add(z),this.setState({activeRow:0},function(){t._announceRow(r[t.state.activeRow].innerText)})):n-1>=0&&(r[n].classList.remove(z),r[n-1].classList.add(z),this.setState({activeRow:n-1},function(){t._announceRow(r[t.state.activeRow].innerText)}))),!0}}},{key:"_onNextRow",value:function(e){var t=this;if(this.tableRef.contains(document.activeElement)){e.preventDefault();var n=this.state.activeRow,r=c(this.tableRef.querySelectorAll("tbody tr"),this.tableRef);return r&&r.length>0&&(void 0===n?(r[0].classList.add(z),this.setState({activeRow:0},function(){t._announceRow(r[t.state.activeRow].innerText)})):n+1<=r.length-1&&(r[n].classList.remove(z),r[n+1].classList.add(z),this.setState({activeRow:n+1},function(){t._announceRow(r[t.state.activeRow].innerText)}))),!0}}},{key:"_fireClick",value:function(e,t){var n=void 0;try{n=new MouseEvent("click",{bubbles:!0,cancelable:!0,shiftKey:t})}catch(e){n=document.createEvent("Event"),n.initEvent("click",!0,!0)}e.dispatchEvent(n)}},{key:"_onEnter",value:function(e){var t=this.state.activeRow,n=this.context.intl;if(this.tableRef.contains(document.activeElement)&&void 0!==t){var r=c(this.tableRef.querySelectorAll("tbody tr"),this.tableRef);this._fireClick(r[t],e.shiftKey),r[t].classList.remove(z);var o=r[t].innerText,a=I.default.getMessage(n,"Selected");(0,S.announce)(o+" "+a)}}},{key:"_onClick",value:function(e){var t=this.props,n=t.onSelect,r=t.selectable,o=t.selected,a=j.default.onClick(e,{containerElement:this._container(),childSelector:"tr",selectedClass:A,multiSelect:"multiple"===r,priorSelectedIndexes:this.state.selected});void 0===o&&this.setState({selected:a},this._setSelection),n&&n(1===a.length?a[0]:a)}},{key:"_adjustBodyCells",value:function(){if(this.tableRef){var e=c(this.tableRef.querySelectorAll("thead th"),this.tableRef),t=u(e);if(e.length>0){var n=[];e.forEach(function(e){var t=e.getAttribute("colspan");n.push(t?parseInt(t):1)});var r=c(this.tableRef.querySelectorAll("tbody tr"),this.tableRef);r.forEach(function(r){var o=0,a=0;u(r.cells)!==t&&console.error("Table row cells do not match length of header cells."),[].forEach.call(r.cells,function(r){var i=r.getAttribute("colspan"),l=i?parseInt(i):1;l0){var n=this.tableRef,r=c(n.querySelectorAll("thead tr th"),n),o=n.getBoundingClientRect();e.style.width=""+Math.floor(o.right-o.left)+"px";for(var a=0,i=0;i=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){var n=[],r=!0,o=!1,a=void 0;try{for(var i,l=e[Symbol.iterator]();!(r=(i=l.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){o=!0,a=e}finally{try{!r&&l.return&&l.return()}finally{if(o)throw a}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=function(){function e(e,t){for(var n=0;n=0){var p=void 0;n===i&&(p=a?f.default.createElement(_.default,null):f.default.createElement(O.default,null)),o=f.default.createElement(b.default,{direction:"row",justify:"start",align:"center",pad:{between:"small"}},f.default.createElement("span",null,o),p),l.sortable&&(o=f.default.createElement(y.default,{plain:!0,fill:!0,onClick:e._onSort.bind(e,n)},o))}return f.default.createElement("th",{key:n},o)});return f.default.createElement("thead",l,f.default.createElement("tr",null,u))}}]),t}(c.Component);L.displayName="TableHeader",t.default=L,L.propTypes={labels:d.default.arrayOf(d.default.oneOfType([d.default.node,d.default.array])).isRequired,onSort:d.default.func,sortAscending:d.default.bool,sortIndex:d.default.number},e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:250,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this,r=void 0,o=void 0;return function(){var a=Date.now();r&&a=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t=-o/2?t===!1&&(this._setSlideInterval(),this.setState({slide:!0})):(clearInterval(this._slideAnimation),this.setState({slide:!1}))}},{key:"_announce",value:function(){var e=this.context.intl,t=I.default.getMessage(e,"Slide Number",{slideNumber:this.state.activeIndex+1}),n=I.default.getMessage(e,"Activated");(0,S.announce)(t+" "+n,"polite")}},{key:"_setSlideInterval",value:function(){var e=this.props.autoplaySpeed;clearInterval(this._slideAnimation),this._slideAnimation=setInterval(function(){var e=this.props,t=e.children,n=e.infinite,r=this.state.activeIndex,o=t.length,a=(r+1)%o;this.props.hasOwnProperty("activeIndex")||this.setState({activeIndex:a},this._announce),n||r!==o-1||clearInterval(this._slideAnimation),this.props.onActive&&this.props.onActive(a)}.bind(this),e)}},{key:"_onSelect",value:function(e){this.props.hasOwnProperty("activeIndex")||e===this.state.activeIndex||this.setState({activeIndex:e},this._announce),this.props.onActive&&this.props.onActive(e)}},{key:"_stopAutoplay",value:function(){var e=this.props.persistentNav;this._slideAnimation&&clearInterval(this._slideAnimation),e||this.setState({hideControls:!1})}},{key:"_startAutoplay",value:function(){var e=this.state.activeIndex,t=this.props,n=t.autoplay,r=t.children,o=t.infinite,a=t.persistentNav;!n||!o&&e===r.length-1||this.carouselRef.contains(document.activeElement)||this._setSlideInterval(),a||this.setState({hideControls:!0})}},{key:"_onResize",value:function(){this.setState({width:this.carouselRef.offsetWidth})}},{key:"_slidePrev",value:function(){var e=this.props.children,t=this.state.activeIndex,n=e.length,r=this.props.infinite||0!==t?(t+n-1)%n:t;this.props.hasOwnProperty("activeIndex")||this.setState({activeIndex:r},this._announce),this.props.onActive&&this.props.onActive(r)}},{key:"_slideNext",value:function(){var e=this.props.children,t=this.state.activeIndex,n=e.length,r=this.props.infinite||t!==e.length-1?(t+1)%n:t;this.props.hasOwnProperty("activeIndex")||this.setState({activeIndex:r},this._announce),this.props.onActive&&this.props.onActive(r)}},{key:"_renderPrevButton",value:function(){var e=this.props.infinite,t=this.state.activeIndex,n=this.context.intl,r=void 0;if(e||0!==t){var o=I.default.getMessage(n,"Previous Slide");r=p.default.createElement(C.default,{icon:p.default.createElement(M.default,{size:"large"}),a11yTitle:o,className:Y+"__arrow "+Y+"__arrow--prev",onClick:this._slidePrev})}return r}},{key:"_renderNextButton",value:function(){var e=this.props,t=e.children,n=e.infinite,r=this.state.activeIndex,o=this.context.intl,a=void 0;if(n||r!==t.length-1){var i=I.default.getMessage(o,"Next Slide");a=p.default.createElement(C.default,{icon:p.default.createElement(T.default,{size:"large"}),a11yTitle:i,className:Y+"__arrow "+Y+"__arrow--next",onClick:this._slideNext})}return a}},{key:"render",value:function(){var e=this,n=this.props,r=n.a11yTitle,i=n.children,l=n.className,s=a(n,["a11yTitle","children","className"]);delete s.activeIndex,delete s.onActive;var c=D.default.omit(u({},s),Object.keys(t.propTypes)),f=this.state,d=f.activeIndex,h=f.hideControls,y=f.width,b=this.context.intl,_=(0,m.default)(Y,o({},Y+"--hide-controls",h),l),O=y*i.length,w=y*d,j=p.default.Children.map(i,function(e,t){var n=d!==t;return p.default.createElement(L.default,{className:Y+"__item","aria-hidden":n},e)}),M=p.default.Children.map(i,function(t,n){var r=n===d,a=(0,m.default)(Y+"__control",o({},Y+"__control--active",r)),i=I.default.getMessage(b,"Activate"),l=I.default.getMessage(b,"Slide Number",{slideNumber:n+1}),s="";return r&&(s="("+I.default.getMessage(b,"Currently Active")+")"),p.default.createElement(C.default,{plain:!0,onClick:e._onSelect.bind(e,n),a11yTitle:i+" "+l+" "+s},p.default.createElement("svg",{className:a,viewBox:"0 0 24 24",version:"1.1"},p.default.createElement("circle",{cx:12,cy:12,r:6})))},this),x=r||I.default.getMessage(b,"Carousel"),T=(0,m.default)(Y+"__track",o({},Y+"__track--animate",this.state.animate));return p.default.createElement("div",u({ref:function(t){return e.carouselRef=t}},c,{className:_,role:"group","aria-label":x,onFocus:this._stopAutoplay,onBlur:this._startAutoplay,onMouseOver:this._stopAutoplay,onMouseOut:this._startAutoplay}),p.default.createElement("div",{className:T,style:{width:O&&O>0?O:"",marginLeft:-w,marginRight:-(O-w-y)}},p.default.createElement(g.default,{fill:!0,responsive:!1,wrap:!1,direction:"row"},j)),this._renderPrevButton(),this._renderNextButton(),p.default.createElement(v.default,{className:Y+"__controls",direction:"row",justify:"center",responsive:!1},M))}}]),t}(f.Component);A.displayName="Carousel",t.default=A,A.contextTypes={intl:h.default.object},A.defaultProps={autoplay:!0,autoplaySpeed:5e3,infinite:!0,persistentNav:!0},A.propTypes={a11yTitle:h.default.string,activeIndex:h.default.number,autoplay:h.default.bool,autoplaySpeed:h.default.number,infinite:h.default.bool,onActive:h.default.func,persistentNav:h.default.bool},e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t15?e.substring(0,15)+"...":e;(0,R.announce)(r+" "+n)}},{key:"_onPreviousTile",value:function(e){var t=this;if((0,h.findDOMNode)(this.tilesRef).contains(document.activeElement)){e.preventDefault();var n=this.state.activeTile,r=(0,h.findDOMNode)(this.tilesRef).querySelectorAll("."+F);return r&&r.length>0&&(void 0===n?(r[0].classList.add(q),this.setState({activeTile:0},function(){t._announceTile(r[t.state.activeTile].innerText)})):n-1>=0&&(r[n].classList.remove(q),r[n-1].classList.add(q),this.setState({activeTile:n-1},function(){t._announceTile(r[t.state.activeTile].innerText)}))),!0}}},{key:"_onNextTile",value:function(e){var t=this;if((0,h.findDOMNode)(this.tilesRef).contains(document.activeElement)){e.preventDefault();var n=this.state.activeTile,r=(0,h.findDOMNode)(this.tilesRef).querySelectorAll("."+F);return r&&r.length>0&&(void 0===n?(r[0].classList.add(q),this.setState({activeTile:0},function(){t._announceTile(r[t.state.activeTile].innerText)})):n+1<=r.length-1&&(r[n].classList.remove(q),r[n+1].classList.add(q),this.setState({activeTile:n+1},function(){t._announceTile(r[t.state.activeTile].innerText)}))),!0}}},{key:"_fireClick",value:function(e,t){var n=void 0;try{n=new MouseEvent("click",{bubbles:!0,cancelable:!0,shiftKey:t})}catch(e){n=document.createEvent("Event"),n.initEvent("click",!0,!0)}e.dispatchEvent(n)}},{key:"_onEnter",value:function(e){var t=this.state.activeTile,n=this.context.intl;if((0,h.findDOMNode)(this.tilesRef).contains(document.activeElement)&&void 0!==t){var r=(0,h.findDOMNode)(this.tilesRef).querySelectorAll("."+F);this._fireClick(r[t],e.shiftKey),r[t].classList.remove(q);var o=r[t].innerText,a=o.length>15?o.substring(0,15)+"...":o,i=S.default.getMessage(n,"Selected");(0,R.announce)(a+" "+i)}}},{key:"_onLeft",value:function(){var e=(0,h.findDOMNode)(this.tilesRef);M.default.scrollBy(e,"scrollLeft",-e.offsetWidth)}},{key:"_onRight",value:function(){var e=(0,h.findDOMNode)(this.tilesRef);M.default.scrollBy(e,"scrollLeft",e.offsetWidth)}},{key:"_onScrollHorizontal",value:function(){clearTimeout(this._layoutTimer),this._layoutTimer=setTimeout(this._layout,50)}},{key:"_onWheel",value:function(e){Math.abs(e.deltaX)>100?clearInterval(this._scrollTimer):e.deltaX>5?this._onRight():e.deltaX<-5&&this._onLeft()}},{key:"_layout",value:function(){var e=this.props.direction;if("row"===e){var t=(0,h.findDOMNode)(this.tilesRef),n={overflow:t.scrollWidth>t.offsetWidth+20,overflowStart:t.scrollLeft<=20,overflowEnd:t.scrollLeft>=t.scrollWidth-t.offsetWidth,scrollWidth:t.scrollWidth},r={overflow:this.state.overflow,overflowStart:this.state.overflowStart,overflowEnd:this.state.overflowEnd,scrollWidth:this.state.scrollWidth};JSON.stringify(n)!==JSON.stringify(r)&&this.setState(s({},n));var o=t.getBoundingClientRect(),a=t.querySelectorAll("."+F);Array.from(a).map(function(e,t){var n=e.getBoundingClientRect();n.left+12o.right?e.classList.add(F+"--eclipsed"):e.classList.remove(F+"--eclipsed")})}}},{key:"_onResize",value:function(){clearTimeout(this._layoutTimer),this._layoutTimer=setTimeout(this._layout,50)}},{key:"_trackHorizontalScroll",value:function(){var e=this.state.overflow;if(e&&!this._tracking){var t=(0,h.findDOMNode)(this.tilesRef);t.addEventListener("scroll",this._onScrollHorizontal),this._tracking=!0}}},{key:"_onClick",value:function(e){var t=this.props,n=t.onSelect,r=t.selectable,o=t.selected,a=P.default.onClick(e,{containerElement:(0,h.findDOMNode)(this.tilesRef),childSelector:"."+F,selectedClass:W,multiSelect:"multiple"===r,priorSelectedIndexes:this.state.selected});void 0===o&&this.setState({selected:a}),n&&n(1===a.length?a[0]:a)}},{key:"_renderChild",value:function(e,t){var n=this.props.flush,r=this.state.selected,o=e.props.selected;if(r&&r.indexOf(t)>-1&&(o=!0),e){if(e.type&&"Tile"===e.type.displayName){var a=f.default.cloneElement(e,{hoverBorder:!n,selected:o});return a}return e}}},{key:"render",value:function(){var e,t=this,n=this.props,r=n.a11yTitle,a=n.className,i=n.children,l=n.direction,u=n.fill,p=n.flush,d=n.onBlur,y=n.onFocus,b=n.onMore,_=n.onMouseDown,O=n.onMouseUp,w=n.selectable,j=this.state,M=j.activeTile,x=j.focus,T=j.mouseActive,k=j.overflow,P=j.overflowEnd,E=j.overflowStart,N=this.context.intl,I=(0,m.default)(Z,(e={},o(e,Z+"--fill",u),o(e,Z+"--flush",p),o(e,Z+"--focus",x),o(e,Z+"--selectable",w),o(e,Z+"--moreable",b),o(e,Z+"--overflowed",k),e),a),R=v.default.pick(this.props,Object.keys(g.default.propTypes)),D=void 0;b&&(D=f.default.createElement("div",{ref:function(e){return t.moreRef=e},className:Z+"__more"},f.default.createElement(C.default,null)));var A=c.Children.map(i,function(e,n){return t._renderChild(e,n)}),H=void 0;if(w){var B="multiple"===w?"("+S.default.getMessage(N,"Multi Select")+")":"",W=r||S.default.getMessage(N,"Tiles"),K=S.default.getMessage(N,"Navigation Help");H={"aria-label":W+" "+B+" "+K,tabIndex:"0",onClick:this._onClick,onMouseDown:function(e){t.setState({mouseActive:!0}),_&&_(e)},onMouseUp:function(e){t.setState({mouseActive:!1}),O&&O(e)},onFocus:function(e){T===!1&&t.setState({focus:!0}),y&&y(e)},onBlur:function(e){if(M){var n=(0,h.findDOMNode)(t.tilesRef).querySelectorAll("."+F);n[M].classList.remove(q)}t.setState({focus:!1,activeTile:void 0}),d&&d(e)}}}var X=f.default.createElement(g.default,s({ref:function(e){return t.tilesRef=e}},R,{wrap:!l,direction:l?l:"row",className:I,focusable:!1},H),A,D);if(k){var U=void 0,G=void 0;if(!E){var J=S.default.getMessage(N,"Previous Tiles");U=f.default.createElement(L.default,{className:Z+"__left",icon:f.default.createElement(Y.default,null),a11yTitle:J,onClick:this._onLeft})}if(!P){var V=S.default.getMessage(N,"Next Tiles");G=f.default.createElement(L.default,{className:Z+"__right",icon:f.default.createElement(z.default,null),a11yTitle:V,onClick:this._onRight})}X=f.default.createElement("div",{className:Z+"__container"},U,X,G)}return X}}]),t}(c.Component);K.displayName="Tiles",t.default=K,K.contextTypes={intl:d.default.object},K.propTypes=s({fill:d.default.bool,flush:d.default.bool,onMore:d.default.func,onSelect:d.default.func,selectable:d.default.oneOfType([d.default.bool,d.default.oneOf(["multiple"])]),selected:d.default.oneOfType([d.default.number,d.default.arrayOf(d.default.number)])},g.default.propTypes),K.defaultProps={flush:!0,justify:"start",pad:"small"},e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t15?e.substring(0,15)+"...":e;(0,R.announce)(r+" "+n)}},{key:"_onPreviousTile",value:function(e){var t=this;if((0,h.findDOMNode)(this.tilesRef).contains(document.activeElement)){e.preventDefault();var n=this.state.activeTile,r=(0,h.findDOMNode)(this.tilesRef).querySelectorAll("."+F);return r&&r.length>0&&(void 0===n?(r[0].classList.add(q),this.setState({activeTile:0},function(){t._announceTile(r[t.state.activeTile].innerText)})):n-1>=0&&(r[n].classList.remove(q),r[n-1].classList.add(q),this.setState({activeTile:n-1},function(){t._announceTile(r[t.state.activeTile].innerText)}))),!0}}},{key:"_onNextTile",value:function(e){var t=this;if((0,h.findDOMNode)(this.tilesRef).contains(document.activeElement)){e.preventDefault();var n=this.state.activeTile,r=(0,h.findDOMNode)(this.tilesRef).querySelectorAll("."+F);return r&&r.length>0&&(void 0===n?(r[0].classList.add(q),this.setState({activeTile:0},function(){t._announceTile(r[t.state.activeTile].innerText)})):n+1<=r.length-1&&(r[n].classList.remove(q),r[n+1].classList.add(q),this.setState({activeTile:n+1},function(){t._announceTile(r[t.state.activeTile].innerText)}))),!0}}},{key:"_fireClick",value:function(e,t){var n=void 0;try{n=new MouseEvent("click",{bubbles:!0,cancelable:!0,shiftKey:t})}catch(e){n=document.createEvent("Event"),n.initEvent("click",!0,!0)}e.dispatchEvent(n)}},{key:"_onEnter",value:function(e){var t=this.state.activeTile,n=this.context.intl;if((0,h.findDOMNode)(this.tilesRef).contains(document.activeElement)&&void 0!==t){var r=(0,h.findDOMNode)(this.tilesRef).querySelectorAll("."+F);this._fireClick(r[t],e.shiftKey),r[t].classList.remove(q);var o=r[t].innerText,a=o.length>15?o.substring(0,15)+"...":o,i=S.default.getMessage(n,"Selected");(0,R.announce)(a+" "+i)}}},{key:"_onLeft",value:function(){var e=(0,h.findDOMNode)(this.tilesRef);M.default.scrollBy(e,"scrollLeft",-e.offsetWidth)}},{key:"_onRight",value:function(){var e=(0,h.findDOMNode)(this.tilesRef);M.default.scrollBy(e,"scrollLeft",e.offsetWidth)}},{key:"_onScrollHorizontal",value:function(){clearTimeout(this._layoutTimer),this._layoutTimer=setTimeout(this._layout,50)}},{key:"_onWheel",value:function(e){Math.abs(e.deltaX)>100?clearInterval(this._scrollTimer):e.deltaX>5?this._onRight():e.deltaX<-5&&this._onLeft()}},{key:"_layout",value:function(){var e=this.props.direction;if("row"===e){var t=(0,h.findDOMNode)(this.tilesRef),n={overflow:t.scrollWidth>t.offsetWidth+20,overflowStart:t.scrollLeft<=20,overflowEnd:t.scrollLeft>=t.scrollWidth-t.offsetWidth,scrollWidth:t.scrollWidth},r={overflow:this.state.overflow,overflowStart:this.state.overflowStart,overflowEnd:this.state.overflowEnd,scrollWidth:this.state.scrollWidth};JSON.stringify(n)!==JSON.stringify(r)&&this.setState(s({},n));var o=t.getBoundingClientRect(),a=t.querySelectorAll("."+F);Array.from(a).map(function(e,t){var n=e.getBoundingClientRect();n.left+12o.right?e.classList.add(F+"--eclipsed"):e.classList.remove(F+"--eclipsed")})}}},{key:"_onResize",value:function(){clearTimeout(this._layoutTimer),this._layoutTimer=setTimeout(this._layout,50)}},{key:"_trackHorizontalScroll",value:function(){var e=this.state.overflow;if(e&&!this._tracking){var t=(0,h.findDOMNode)(this.tilesRef);t.addEventListener("scroll",this._onScrollHorizontal),this._tracking=!0}}},{key:"_onClick",value:function(e){var t=this.props,n=t.onSelect,r=t.selectable,o=t.selected,a=P.default.onClick(e,{containerElement:(0,h.findDOMNode)(this.tilesRef),childSelector:"."+F,selectedClass:W,multiSelect:"multiple"===r,priorSelectedIndexes:this.state.selected});void 0===o&&this.setState({selected:a}),n&&n(1===a.length?a[0]:a)}},{key:"_renderChild",value:function(e,t){var n=this.props.flush,r=this.state.selected,o=e.props.selected;if(r&&r.indexOf(t)>-1&&(o=!0),e){if(e.type&&"Tile"===e.type.displayName){var a=f.default.cloneElement(e,{hoverBorder:!n,selected:o});return a}return e}}},{key:"render",value:function(){var e,t=this,n=this.props,r=n.a11yTitle,a=n.className,i=n.children,l=n.direction,u=n.fill,p=n.flush,d=n.onBlur,y=n.onFocus,b=n.onMore,_=n.onMouseDown,O=n.onMouseUp,w=n.selectable,j=this.state,M=j.activeTile,x=j.focus,T=j.mouseActive,k=j.overflow,P=j.overflowEnd,E=j.overflowStart,N=this.context.intl,I=(0,m.default)(Z,(e={},o(e,Z+"--fill",u),o(e,Z+"--flush",p),o(e,Z+"--focus",x),o(e,Z+"--selectable",w),o(e,Z+"--moreable",b),o(e,Z+"--overflowed",k),e),a),R=v.default.pick(this.props,Object.keys(g.default.propTypes)),D=void 0;b&&(D=f.default.createElement("div",{ref:function(e){return t.moreRef=e},className:Z+"__more"},f.default.createElement(C.default,null)));var A=c.Children.toArray(i).filter(function(e){return e}).map(function(e,n){return t._renderChild(e,n)}),H=void 0;if(w){var B="multiple"===w?"("+S.default.getMessage(N,"Multi Select")+")":"",W=r||S.default.getMessage(N,"Tiles"),K=S.default.getMessage(N,"Navigation Help");H={"aria-label":W+" "+B+" "+K,tabIndex:"0",onClick:this._onClick,onMouseDown:function(e){t.setState({mouseActive:!0}),_&&_(e)},onMouseUp:function(e){t.setState({mouseActive:!1}),O&&O(e)},onFocus:function(e){T===!1&&t.setState({focus:!0}),y&&y(e)},onBlur:function(e){if(M){var n=(0,h.findDOMNode)(t.tilesRef).querySelectorAll("."+F);n[M].classList.remove(q)}t.setState({focus:!1,activeTile:void 0}),d&&d(e)}}}var X=f.default.createElement(g.default,s({ref:function(e){return t.tilesRef=e}},R,{wrap:!l,direction:l?l:"row",className:I,focusable:!1},H),A,D);if(k){var U=void 0,G=void 0;if(!E){var J=S.default.getMessage(N,"Previous Tiles");U=f.default.createElement(L.default,{className:Z+"__left",icon:f.default.createElement(Y.default,null),a11yTitle:J,onClick:this._onLeft})}if(!P){var V=S.default.getMessage(N,"Next Tiles");G=f.default.createElement(L.default,{className:Z+"__right",icon:f.default.createElement(z.default,null),a11yTitle:V,onClick:this._onRight})}X=f.default.createElement("div",{className:Z+"__container"},U,X,G)}return X}}]),t}(c.Component);K.displayName="Tiles",t.default=K,K.contextTypes={intl:d.default.object},K.propTypes=s({fill:d.default.bool,flush:d.default.bool,onMore:d.default.func,onSelect:d.default.func,selectable:d.default.oneOfType([d.default.bool,d.default.oneOf(["multiple"])]),selected:d.default.oneOfType([d.default.number,d.default.arrayOf(d.default.number)])},g.default.propTypes),K.defaultProps={flush:!0,justify:"start",pad:"small"},e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t