Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ak-dropdown-menu

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ak-dropdown-menu - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

10

CHANGELOG.md

@@ -1,6 +0,11 @@

<a name="1.3.0"></a>
# 1.3.0 (2016-12-21)
<a name="1.4.0"></a>
# 1.4.0 (2016-12-21)
<a name="ak-dropdown-menu@1.4.0"></a>
# ak-dropdown-menu@1.4.0 (2016-12-21)
<a name="ak-dropdown-menu@1.3.0"></a>

@@ -20,2 +25,3 @@ # ak-dropdown-menu@1.3.0 (2016-12-21)

* **component:** checkbox and radio behavior is implemented ([462d8c4](https://bitbucket.org/atlassian/atlaskit/commits/462d8c4))
* **component:** keyboard navigation for the dropdown menu is implemented ([21875b2](https://bitbucket.org/atlassian/atlaskit/commits/21875b2))

@@ -22,0 +28,0 @@

64

dist/bundle-cjs.js

@@ -85,3 +85,3 @@ module.exports = /******/

});
var _toConsumableArray2 = __webpack_require__(6), _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2), _getPrototypeOf = __webpack_require__(7), _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf), _classCallCheck2 = __webpack_require__(8), _classCallCheck3 = _interopRequireDefault(_classCallCheck2), _createClass2 = __webpack_require__(9), _createClass3 = _interopRequireDefault(_createClass2), _possibleConstructorReturn2 = __webpack_require__(10), _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2), _inherits2 = __webpack_require__(11), _inherits3 = _interopRequireDefault(_inherits2), _react = __webpack_require__(12), _react2 = _interopRequireDefault(_react), _reactDom = __webpack_require__(13), _reactDom2 = _interopRequireDefault(_reactDom), _styles = __webpack_require__(14), _styles2 = _interopRequireDefault(_styles), _akLayer = __webpack_require__(18), _akLayer2 = _interopRequireDefault(_akLayer), _akDroplistGroup = __webpack_require__(19), _akDroplistGroup2 = _interopRequireDefault(_akDroplistGroup), _akDroplistTrigger = __webpack_require__(20), _akDroplistTrigger2 = _interopRequireDefault(_akDroplistTrigger), _akDroplistItem = __webpack_require__(21), _akDroplistItem2 = _interopRequireDefault(_akDroplistItem), _keycode = __webpack_require__(22), _keycode2 = _interopRequireDefault(_keycode), _getAvailablePreviousItem = __webpack_require__(23), _getAvailablePreviousItem2 = _interopRequireDefault(_getAvailablePreviousItem), _getAvailableNextItem = __webpack_require__(24), _getAvailableNextItem2 = _interopRequireDefault(_getAvailableNextItem), halfGrid = 4, itemHeight = 7 * halfGrid, dropdownMaxHeight = 9.5 * itemHeight + 2 * halfGrid, getCurrentlyFocusedItem = function(items, currentFocus) {
var _toConsumableArray2 = __webpack_require__(6), _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2), _getPrototypeOf = __webpack_require__(7), _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf), _classCallCheck2 = __webpack_require__(8), _classCallCheck3 = _interopRequireDefault(_classCallCheck2), _createClass2 = __webpack_require__(9), _createClass3 = _interopRequireDefault(_createClass2), _possibleConstructorReturn2 = __webpack_require__(10), _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2), _inherits2 = __webpack_require__(11), _inherits3 = _interopRequireDefault(_inherits2), _react = __webpack_require__(12), _react2 = _interopRequireDefault(_react), _reactDom = __webpack_require__(13), _reactDom2 = _interopRequireDefault(_reactDom), _styles = __webpack_require__(14), _styles2 = _interopRequireDefault(_styles), _akLayer = __webpack_require__(18), _akLayer2 = _interopRequireDefault(_akLayer), _akDroplistGroup = __webpack_require__(19), _akDroplistGroup2 = _interopRequireDefault(_akDroplistGroup), _akDroplistTrigger = __webpack_require__(20), _akDroplistTrigger2 = _interopRequireDefault(_akDroplistTrigger), _akDroplistItem = __webpack_require__(21), _akDroplistItem2 = _interopRequireDefault(_akDroplistItem), _keycode = __webpack_require__(22), _keycode2 = _interopRequireDefault(_keycode), _getAvailablePreviousItem = __webpack_require__(23), _getAvailablePreviousItem2 = _interopRequireDefault(_getAvailablePreviousItem), _getAvailableNextItem = __webpack_require__(24), _getAvailableNextItem2 = _interopRequireDefault(_getAvailableNextItem), _findItem = __webpack_require__(25), _findItem2 = _interopRequireDefault(_findItem), _findGroup = __webpack_require__(26), _findGroup2 = _interopRequireDefault(_findGroup), halfGrid = 4, itemHeight = 7 * halfGrid, dropdownMaxHeight = 9.5 * itemHeight + 2 * halfGrid, getCurrentlyFocusedItem = function(items, currentFocus) {
return items[currentFocus.group].items[currentFocus.item];

@@ -130,8 +130,32 @@ }, DropdownMenu = function(_Component) {

}
}, _this.handleItemActivation = function(attrs, item) {
"link" !== attrs.item.props.type && (_this.props.onItemActivated({
item: item
}), _this.close({
source: attrs.event.type
}));
}, _this.handleItemActivation = function(activatedAttrs, group, item) {
var items = [].concat((0, _toConsumableArray3.default)(_this.state.items)), activatedGroup = (0,
_findGroup2.default)(items, group), activatedItem = (0, _findItem2.default)(activatedGroup, item);
switch (activatedAttrs.item.props.type) {
case "checkbox":
activatedItem.isChecked = !activatedItem.isChecked, _this.props.onItemActivated(activatedItem),
_this.setState({
items: items
});
break;
case "radio":
activatedGroup.items.forEach(function(i) {
i === activatedItem ? i.isChecked = !0 : i.isChecked = !1;
}), _this.props.onItemActivated(activatedItem), _this.setState({
items: items
});
break;
case "link":
activatedItem.href || _this.props.onItemActivated(activatedItem), _this.close({
source: activatedAttrs.event.type
});
break;
default:
_this.close({
source: activatedAttrs.event.type
});
}
}, _this.handleAccessibility = function(attrs) {

@@ -205,4 +229,4 @@ var event = attrs.event;

elemBefore: item.elemBefore,
onActivate: function(attrs) {
_this.handleItemActivation(attrs, item);
onActivate: function(activatedAttrs) {
_this.handleItemActivation(activatedAttrs, group, item);
},

@@ -604,2 +628,24 @@ onKeyDown: _this.handleAccessibility

};
}, /* 25 */
/***/
function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.default = function(group, item) {
return group.items.filter(function(i) {
return i === item;
})[0];
};
}, /* 26 */
/***/
function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.default = function(items, group) {
return items.filter(function(g) {
return g === group;
})[0];
};
} ]);

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

module.exports=function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(5)},,,,,function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=r(o),s=n(7),u=r(s),a=n(8),c=r(a),l=n(9),p=r(l),f=n(10),d=r(f),m=n(11),h=r(m),g=n(12),v=r(g),y=n(13),b=r(y),x=n(14),k=r(x),C=n(18),_=r(C),O=n(19),F=r(O),T=n(20),w=r(T),A=n(21),q=r(A),E=n(22),I=r(E),L=n(23),S=r(L),M=n(24),R=r(M),P=4,N=7*P,U=9.5*N+2*P,j=function(e,t){return e[t.group].items[t.item]},K=function(e){function t(){var e,n,r,o;(0,c.default)(this,t);for(var s=arguments.length,a=Array(s),l=0;l<s;l++)a[l]=arguments[l];return n=r=(0,d.default)(this,(e=t.__proto__||(0,u.default)(t)).call.apply(e,[this].concat(a))),r.state={isOpen:r.props.defaultOpen,items:r.props.items},r.setMaxHeight=function(e){if(e){var t=r.props.appearance;e.style.maxHeight="tall"!==t?U+"px":"none"}},r.handleKeyDown=function(e){e.keyCode===(0,I.default)("escape")&&r.close({source:"keydown"})},r.handleClickOutside=function(e){if(r.state.isOpen){var t=b.default.findDOMNode(r);(!t||e.target instanceof Node&&!t.contains(e.target))&&r.close({source:"click"})}},r.handleTriggerActivation=function(e){r.toggle({source:e.source})},r.focusFirstItem=function(){r.setState({isTriggerFocused:!1}),r.changeFocus((0,R.default)(r.state.items))},r.removeFocusFromItems=function(){if(r.currentFocus){var e=[].concat((0,i.default)(r.state.items)),t=j(e,r.currentFocus);t.isFocused=!1,r.setState({items:e}),r.currentFocus=null}},r.handleItemActivation=function(e,t){"link"!==e.item.props.type&&(r.props.onItemActivated({item:t}),r.close({source:e.event.type}))},r.handleAccessibility=function(e){var t=e.event;switch(t.preventDefault(),t.keyCode){case(0,I.default)("up"):r.focusPreviousItem();break;case(0,I.default)("down"):r.focusNextItem();break;case(0,I.default)("tab"):r.close({source:"keydown"})}},r.focusPreviousItem=function(){r.currentFocus&&r.changeFocus((0,S.default)(r.state.items,r.currentFocus))},r.focusNextItem=function(){r.currentFocus&&r.changeFocus((0,R.default)(r.state.items,r.currentFocus))},r.changeFocus=function(e){var t=e.group,n=e.item,o=[].concat((0,i.default)(r.state.items));if(r.currentFocus){var s=j(o,r.currentFocus);s.isFocused=!1}o[t].items[n].isFocused=!0,r.currentFocus={group:t,item:n},r.setState({items:o})},r.open=function(e){"keydown"===e.source&&r.focusFirstItem(),r.state.isTriggerFocused&&r.setState({isTriggerFocused:!1}),r.setState({isOpen:!0}),r.props.onOpenChange({isOpen:!0})},r.close=function(e){r.setState({isOpen:!1}),r.props.onOpenChange({isOpen:!1}),e.source&&"keydown"===e.source&&(r.setState({isTriggerFocused:!0}),r.removeFocusFromItems())},r.toggle=function(e){r.state.isOpen?r.close(e):r.open(e)},r.renderSubComponents=function(e){return e.map(function(e,t){var n=e.items.map(function(e,t){return v.default.createElement(q.default,{key:t,href:e.href,target:e.target,type:e.type,isActive:e.isActive,isDisabled:e.isDisabled,isFocused:e.isFocused,isHidden:e.isHidden,isChecked:e.isChecked,elemBefore:e.elemBefore,onActivate:function(t){r.handleItemActivation(t,e)},onKeyDown:r.handleAccessibility},e.content)});return v.default.createElement(F.default,{heading:e.heading,key:t},n)})},r.render=function(){var e=r,t=e.props,n=e.state;return v.default.createElement("div",{className:k.default.dropWrapper},v.default.createElement(_.default,{position:t.position,offset:"0 4",content:n.isOpen?v.default.createElement("div",{className:k.default.dropContent,ref:r.setMaxHeight,role:"menu"},r.renderSubComponents(t.items)):null},v.default.createElement("div",{className:k.default.dropTrigger},v.default.createElement(w.default,{type:t.triggerType,isOpened:n.isOpen,onActivate:r.handleTriggerActivation,isFocused:r.state.isTriggerFocused},t.children))))},o=n,(0,d.default)(r,o)}return(0,h.default)(t,e),(0,p.default)(t,[{key:"componentDidMount",value:function(){document.addEventListener("click",this.handleClickOutside,!0),document.addEventListener("keydown",this.handleKeyDown)}},{key:"componentWillUnmount",value:function(){document.removeEventListener("click",this.handleClickOutside,!0),document.removeEventListener("keydown",this.handleKeyDown)}}]),t}(g.Component);K.propTypes={appearance:g.PropTypes.oneOf(["default","tall"]),position:g.PropTypes.string,triggerType:g.PropTypes.oneOf(["default","button"]),items:g.PropTypes.array.isRequired,defaultOpen:g.PropTypes.bool,onItemActivated:g.PropTypes.func,onOpenChange:g.PropTypes.func,children:g.PropTypes.node},K.defaultProps={appearance:"default",position:"bottom left",triggerType:"default",items:[],defaultOpen:!1,onItemActivated:function(){},onOpenChange:function(){}},t.default=K},function(e,t){e.exports=require("babel-runtime/helpers/toConsumableArray")},function(e,t){e.exports=require("babel-runtime/core-js/object/get-prototype-of")},function(e,t){e.exports=require("babel-runtime/helpers/classCallCheck")},function(e,t){e.exports=require("babel-runtime/helpers/createClass")},function(e,t){e.exports=require("babel-runtime/helpers/possibleConstructorReturn")},function(e,t){e.exports=require("babel-runtime/helpers/inherits")},function(e,t){e.exports=require("react")},function(e,t){e.exports=require("react-dom")},function(e,t,n){var r=n(15);"string"==typeof r&&(r=[[e.id,r,""]]),n(17)(r,{}),r.locals&&(e.exports=r.locals)},function(e,t,n){t=e.exports=n(16)(),t.push([e.id,"._3kPc8A6nN6B8Jqhh1_TbKq{background:#253858;border-radius:3px;box-sizing:border-box;overflow-y:auto;padding:4px 0}._2r4rgI-xE_oiQpK1yE1V2q{display:-webkit-box;display:flex;width:100%}._1tw_LKkCMR0moIv_o_HhSt{display:-webkit-inline-box;display:inline-flex}",""]),t.locals={dropContent:"_3kPc8A6nN6B8Jqhh1_TbKq",dropContent:"_3kPc8A6nN6B8Jqhh1_TbKq",dropTrigger:"_2r4rgI-xE_oiQpK1yE1V2q",dropTrigger:"_2r4rgI-xE_oiQpK1yE1V2q",dropWrapper:"_1tw_LKkCMR0moIv_o_HhSt",dropWrapper:"_1tw_LKkCMR0moIv_o_HhSt"}},function(e,t){e.exports=function(){var e=[];return e.toString=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t];n[2]?e.push("@media "+n[2]+"{"+n[1]+"}"):e.push(n[1])}return e.join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var r={},o=0;o<this.length;o++){var i=this[o][0];"number"==typeof i&&(r[i]=!0)}for(o=0;o<t.length;o++){var s=t[o];"number"==typeof s[0]&&r[s[0]]||(n&&!s[2]?s[2]=n:n&&(s[2]="("+s[2]+") and ("+n+")"),e.push(s))}},e}},function(e,t,n){function r(e,t){for(var n=0;n<e.length;n++){var r=e[n],o=d[r.id];if(o){o.refs++;for(var i=0;i<o.parts.length;i++)o.parts[i](r.parts[i]);for(;i<r.parts.length;i++)o.parts.push(c(r.parts[i],t))}else{for(var s=[],i=0;i<r.parts.length;i++)s.push(c(r.parts[i],t));d[r.id]={id:r.id,refs:1,parts:s}}}}function o(e){for(var t=[],n={},r=0;r<e.length;r++){var o=e[r],i=o[0],s=o[1],u=o[2],a=o[3],c={css:s,media:u,sourceMap:a};n[i]?n[i].parts.push(c):t.push(n[i]={id:i,parts:[c]})}return t}function i(e,t){var n=g(),r=b[b.length-1];if("top"===e.insertAt)r?r.nextSibling?n.insertBefore(t,r.nextSibling):n.appendChild(t):n.insertBefore(t,n.firstChild),b.push(t);else{if("bottom"!==e.insertAt)throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");n.appendChild(t)}}function s(e){e.parentNode.removeChild(e);var t=b.indexOf(e);t>=0&&b.splice(t,1)}function u(e){var t=document.createElement("style");return t.type="text/css",i(e,t),t}function a(e){var t=document.createElement("link");return t.rel="stylesheet",i(e,t),t}function c(e,t){var n,r,o;if(t.singleton){var i=y++;n=v||(v=u(t)),r=l.bind(null,n,i,!1),o=l.bind(null,n,i,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=a(t),r=f.bind(null,n),o=function(){s(n),n.href&&URL.revokeObjectURL(n.href)}):(n=u(t),r=p.bind(null,n),o=function(){s(n)});return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else o()}}function l(e,t,n,r){var o=n?"":r.css;if(e.styleSheet)e.styleSheet.cssText=x(t,o);else{var i=document.createTextNode(o),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(i,s[t]):e.appendChild(i)}}function p(e,t){var n=t.css,r=t.media;if(r&&e.setAttribute("media",r),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}function f(e,t){var n=t.css,r=t.sourceMap;r&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var o=new Blob([n],{type:"text/css"}),i=e.href;e.href=URL.createObjectURL(o),i&&URL.revokeObjectURL(i)}var d={},m=function(e){var t;return function(){return"undefined"==typeof t&&(t=e.apply(this,arguments)),t}},h=m(function(){return/msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase())}),g=m(function(){return document.head||document.getElementsByTagName("head")[0]}),v=null,y=0,b=[];e.exports=function(e,t){t=t||{},"undefined"==typeof t.singleton&&(t.singleton=h()),"undefined"==typeof t.insertAt&&(t.insertAt="bottom");var n=o(e);return r(n,t),function(e){for(var i=[],s=0;s<n.length;s++){var u=n[s],a=d[u.id];a.refs--,i.push(a)}if(e){var c=o(e);r(c,t)}for(var s=0;s<i.length;s++){var a=i[s];if(0===a.refs){for(var l=0;l<a.parts.length;l++)a.parts[l]();delete d[a.id]}}}};var x=function(){var e=[];return function(t,n){return e[t]=n,e.filter(Boolean).join("\n")}}()},function(e,t){e.exports=require("ak-layer")},function(e,t){e.exports=require("ak-droplist-group")},function(e,t){e.exports=require("ak-droplist-trigger")},function(e,t){e.exports=require("ak-droplist-item")},function(e,t){e.exports=require("keycode")},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var n=t.item,r=t.group;return 0!==n?n--:0!==r&&(r--,n=e[r].items.length-1),{item:n,group:r}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if(!t)return{item:0,group:0};var n=t.item,r=t.group,o=e[r].items.length-1;return n!==o?n++:r!==e.length-1&&(r++,n=0),{item:n,group:r}}}]);
module.exports=function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(5)},,,,,function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=r(o),s=n(7),u=r(s),a=n(8),c=r(a),l=n(9),f=r(l),p=n(10),d=r(p),m=n(11),h=r(m),v=n(12),g=r(v),y=n(13),b=r(y),x=n(14),k=r(x),C=n(18),_=r(C),O=n(19),F=r(O),T=n(20),A=r(T),w=n(21),q=r(w),I=n(22),E=r(I),S=n(23),L=r(S),M=n(24),P=r(M),R=n(25),N=r(R),j=n(26),U=r(j),K=4,B=7*K,D=9.5*B+2*K,H=function(e,t){return e[t.group].items[t.item]},J=function(e){function t(){var e,n,r,o;(0,c.default)(this,t);for(var s=arguments.length,a=Array(s),l=0;l<s;l++)a[l]=arguments[l];return n=r=(0,d.default)(this,(e=t.__proto__||(0,u.default)(t)).call.apply(e,[this].concat(a))),r.state={isOpen:r.props.defaultOpen,items:r.props.items},r.setMaxHeight=function(e){if(e){var t=r.props.appearance;e.style.maxHeight="tall"!==t?D+"px":"none"}},r.handleKeyDown=function(e){e.keyCode===(0,E.default)("escape")&&r.close({source:"keydown"})},r.handleClickOutside=function(e){if(r.state.isOpen){var t=b.default.findDOMNode(r);(!t||e.target instanceof Node&&!t.contains(e.target))&&r.close({source:"click"})}},r.handleTriggerActivation=function(e){r.toggle({source:e.source})},r.focusFirstItem=function(){r.setState({isTriggerFocused:!1}),r.changeFocus((0,P.default)(r.state.items))},r.removeFocusFromItems=function(){if(r.currentFocus){var e=[].concat((0,i.default)(r.state.items)),t=H(e,r.currentFocus);t.isFocused=!1,r.setState({items:e}),r.currentFocus=null}},r.handleItemActivation=function(e,t,n){var o=[].concat((0,i.default)(r.state.items)),s=(0,U.default)(o,t),u=(0,N.default)(s,n);switch(e.item.props.type){case"checkbox":u.isChecked=!u.isChecked,r.props.onItemActivated(u),r.setState({items:o});break;case"radio":s.items.forEach(function(e){e===u?e.isChecked=!0:e.isChecked=!1}),r.props.onItemActivated(u),r.setState({items:o});break;case"link":u.href||r.props.onItemActivated(u),r.close({source:e.event.type});break;default:r.close({source:e.event.type})}},r.handleAccessibility=function(e){var t=e.event;switch(t.preventDefault(),t.keyCode){case(0,E.default)("up"):r.focusPreviousItem();break;case(0,E.default)("down"):r.focusNextItem();break;case(0,E.default)("tab"):r.close({source:"keydown"})}},r.focusPreviousItem=function(){r.currentFocus&&r.changeFocus((0,L.default)(r.state.items,r.currentFocus))},r.focusNextItem=function(){r.currentFocus&&r.changeFocus((0,P.default)(r.state.items,r.currentFocus))},r.changeFocus=function(e){var t=e.group,n=e.item,o=[].concat((0,i.default)(r.state.items));if(r.currentFocus){var s=H(o,r.currentFocus);s.isFocused=!1}o[t].items[n].isFocused=!0,r.currentFocus={group:t,item:n},r.setState({items:o})},r.open=function(e){"keydown"===e.source&&r.focusFirstItem(),r.state.isTriggerFocused&&r.setState({isTriggerFocused:!1}),r.setState({isOpen:!0}),r.props.onOpenChange({isOpen:!0})},r.close=function(e){r.setState({isOpen:!1}),r.props.onOpenChange({isOpen:!1}),e.source&&"keydown"===e.source&&(r.setState({isTriggerFocused:!0}),r.removeFocusFromItems())},r.toggle=function(e){r.state.isOpen?r.close(e):r.open(e)},r.renderSubComponents=function(e){return e.map(function(e,t){var n=e.items.map(function(t,n){return g.default.createElement(q.default,{key:n,href:t.href,target:t.target,type:t.type,isActive:t.isActive,isDisabled:t.isDisabled,isFocused:t.isFocused,isHidden:t.isHidden,isChecked:t.isChecked,elemBefore:t.elemBefore,onActivate:function(n){r.handleItemActivation(n,e,t)},onKeyDown:r.handleAccessibility},t.content)});return g.default.createElement(F.default,{heading:e.heading,key:t},n)})},r.render=function(){var e=r,t=e.props,n=e.state;return g.default.createElement("div",{className:k.default.dropWrapper},g.default.createElement(_.default,{position:t.position,offset:"0 4",content:n.isOpen?g.default.createElement("div",{className:k.default.dropContent,ref:r.setMaxHeight,role:"menu"},r.renderSubComponents(t.items)):null},g.default.createElement("div",{className:k.default.dropTrigger},g.default.createElement(A.default,{type:t.triggerType,isOpened:n.isOpen,onActivate:r.handleTriggerActivation,isFocused:r.state.isTriggerFocused},t.children))))},o=n,(0,d.default)(r,o)}return(0,h.default)(t,e),(0,f.default)(t,[{key:"componentDidMount",value:function(){document.addEventListener("click",this.handleClickOutside,!0),document.addEventListener("keydown",this.handleKeyDown)}},{key:"componentWillUnmount",value:function(){document.removeEventListener("click",this.handleClickOutside,!0),document.removeEventListener("keydown",this.handleKeyDown)}}]),t}(v.Component);J.propTypes={appearance:v.PropTypes.oneOf(["default","tall"]),position:v.PropTypes.string,triggerType:v.PropTypes.oneOf(["default","button"]),items:v.PropTypes.array.isRequired,defaultOpen:v.PropTypes.bool,onItemActivated:v.PropTypes.func,onOpenChange:v.PropTypes.func,children:v.PropTypes.node},J.defaultProps={appearance:"default",position:"bottom left",triggerType:"default",items:[],defaultOpen:!1,onItemActivated:function(){},onOpenChange:function(){}},t.default=J},function(e,t){e.exports=require("babel-runtime/helpers/toConsumableArray")},function(e,t){e.exports=require("babel-runtime/core-js/object/get-prototype-of")},function(e,t){e.exports=require("babel-runtime/helpers/classCallCheck")},function(e,t){e.exports=require("babel-runtime/helpers/createClass")},function(e,t){e.exports=require("babel-runtime/helpers/possibleConstructorReturn")},function(e,t){e.exports=require("babel-runtime/helpers/inherits")},function(e,t){e.exports=require("react")},function(e,t){e.exports=require("react-dom")},function(e,t,n){var r=n(15);"string"==typeof r&&(r=[[e.id,r,""]]),n(17)(r,{}),r.locals&&(e.exports=r.locals)},function(e,t,n){t=e.exports=n(16)(),t.push([e.id,"._3kPc8A6nN6B8Jqhh1_TbKq{background:#253858;border-radius:3px;box-sizing:border-box;overflow-y:auto;padding:4px 0}._2r4rgI-xE_oiQpK1yE1V2q{display:-webkit-box;display:flex;width:100%}._1tw_LKkCMR0moIv_o_HhSt{display:-webkit-inline-box;display:inline-flex}",""]),t.locals={dropContent:"_3kPc8A6nN6B8Jqhh1_TbKq",dropContent:"_3kPc8A6nN6B8Jqhh1_TbKq",dropTrigger:"_2r4rgI-xE_oiQpK1yE1V2q",dropTrigger:"_2r4rgI-xE_oiQpK1yE1V2q",dropWrapper:"_1tw_LKkCMR0moIv_o_HhSt",dropWrapper:"_1tw_LKkCMR0moIv_o_HhSt"}},function(e,t){e.exports=function(){var e=[];return e.toString=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t];n[2]?e.push("@media "+n[2]+"{"+n[1]+"}"):e.push(n[1])}return e.join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var r={},o=0;o<this.length;o++){var i=this[o][0];"number"==typeof i&&(r[i]=!0)}for(o=0;o<t.length;o++){var s=t[o];"number"==typeof s[0]&&r[s[0]]||(n&&!s[2]?s[2]=n:n&&(s[2]="("+s[2]+") and ("+n+")"),e.push(s))}},e}},function(e,t,n){function r(e,t){for(var n=0;n<e.length;n++){var r=e[n],o=d[r.id];if(o){o.refs++;for(var i=0;i<o.parts.length;i++)o.parts[i](r.parts[i]);for(;i<r.parts.length;i++)o.parts.push(c(r.parts[i],t))}else{for(var s=[],i=0;i<r.parts.length;i++)s.push(c(r.parts[i],t));d[r.id]={id:r.id,refs:1,parts:s}}}}function o(e){for(var t=[],n={},r=0;r<e.length;r++){var o=e[r],i=o[0],s=o[1],u=o[2],a=o[3],c={css:s,media:u,sourceMap:a};n[i]?n[i].parts.push(c):t.push(n[i]={id:i,parts:[c]})}return t}function i(e,t){var n=v(),r=b[b.length-1];if("top"===e.insertAt)r?r.nextSibling?n.insertBefore(t,r.nextSibling):n.appendChild(t):n.insertBefore(t,n.firstChild),b.push(t);else{if("bottom"!==e.insertAt)throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");n.appendChild(t)}}function s(e){e.parentNode.removeChild(e);var t=b.indexOf(e);t>=0&&b.splice(t,1)}function u(e){var t=document.createElement("style");return t.type="text/css",i(e,t),t}function a(e){var t=document.createElement("link");return t.rel="stylesheet",i(e,t),t}function c(e,t){var n,r,o;if(t.singleton){var i=y++;n=g||(g=u(t)),r=l.bind(null,n,i,!1),o=l.bind(null,n,i,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=a(t),r=p.bind(null,n),o=function(){s(n),n.href&&URL.revokeObjectURL(n.href)}):(n=u(t),r=f.bind(null,n),o=function(){s(n)});return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else o()}}function l(e,t,n,r){var o=n?"":r.css;if(e.styleSheet)e.styleSheet.cssText=x(t,o);else{var i=document.createTextNode(o),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(i,s[t]):e.appendChild(i)}}function f(e,t){var n=t.css,r=t.media;if(r&&e.setAttribute("media",r),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}function p(e,t){var n=t.css,r=t.sourceMap;r&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var o=new Blob([n],{type:"text/css"}),i=e.href;e.href=URL.createObjectURL(o),i&&URL.revokeObjectURL(i)}var d={},m=function(e){var t;return function(){return"undefined"==typeof t&&(t=e.apply(this,arguments)),t}},h=m(function(){return/msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase())}),v=m(function(){return document.head||document.getElementsByTagName("head")[0]}),g=null,y=0,b=[];e.exports=function(e,t){t=t||{},"undefined"==typeof t.singleton&&(t.singleton=h()),"undefined"==typeof t.insertAt&&(t.insertAt="bottom");var n=o(e);return r(n,t),function(e){for(var i=[],s=0;s<n.length;s++){var u=n[s],a=d[u.id];a.refs--,i.push(a)}if(e){var c=o(e);r(c,t)}for(var s=0;s<i.length;s++){var a=i[s];if(0===a.refs){for(var l=0;l<a.parts.length;l++)a.parts[l]();delete d[a.id]}}}};var x=function(){var e=[];return function(t,n){return e[t]=n,e.filter(Boolean).join("\n")}}()},function(e,t){e.exports=require("ak-layer")},function(e,t){e.exports=require("ak-droplist-group")},function(e,t){e.exports=require("ak-droplist-trigger")},function(e,t){e.exports=require("ak-droplist-item")},function(e,t){e.exports=require("keycode")},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var n=t.item,r=t.group;return 0!==n?n--:0!==r&&(r--,n=e[r].items.length-1),{item:n,group:r}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if(!t)return{item:0,group:0};var n=t.item,r=t.group,o=e[r].items.length-1;return n!==o?n++:r!==e.length-1&&(r++,n=0),{item:n,group:r}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){return e.items.filter(function(e){return e===t})[0]}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){return e.filter(function(e){return e===t})[0]}}]);

@@ -88,3 +88,3 @@ !function(root, factory) {

});
var _toConsumableArray2 = __webpack_require__(6), _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2), _getPrototypeOf = __webpack_require__(7), _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf), _classCallCheck2 = __webpack_require__(8), _classCallCheck3 = _interopRequireDefault(_classCallCheck2), _createClass2 = __webpack_require__(9), _createClass3 = _interopRequireDefault(_createClass2), _possibleConstructorReturn2 = __webpack_require__(10), _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2), _inherits2 = __webpack_require__(11), _inherits3 = _interopRequireDefault(_inherits2), _react = __webpack_require__(12), _react2 = _interopRequireDefault(_react), _reactDom = __webpack_require__(13), _reactDom2 = _interopRequireDefault(_reactDom), _styles = __webpack_require__(14), _styles2 = _interopRequireDefault(_styles), _akLayer = __webpack_require__(18), _akLayer2 = _interopRequireDefault(_akLayer), _akDroplistGroup = __webpack_require__(19), _akDroplistGroup2 = _interopRequireDefault(_akDroplistGroup), _akDroplistTrigger = __webpack_require__(20), _akDroplistTrigger2 = _interopRequireDefault(_akDroplistTrigger), _akDroplistItem = __webpack_require__(21), _akDroplistItem2 = _interopRequireDefault(_akDroplistItem), _keycode = __webpack_require__(22), _keycode2 = _interopRequireDefault(_keycode), _getAvailablePreviousItem = __webpack_require__(23), _getAvailablePreviousItem2 = _interopRequireDefault(_getAvailablePreviousItem), _getAvailableNextItem = __webpack_require__(24), _getAvailableNextItem2 = _interopRequireDefault(_getAvailableNextItem), halfGrid = 4, itemHeight = 7 * halfGrid, dropdownMaxHeight = 9.5 * itemHeight + 2 * halfGrid, getCurrentlyFocusedItem = function(items, currentFocus) {
var _toConsumableArray2 = __webpack_require__(6), _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2), _getPrototypeOf = __webpack_require__(7), _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf), _classCallCheck2 = __webpack_require__(8), _classCallCheck3 = _interopRequireDefault(_classCallCheck2), _createClass2 = __webpack_require__(9), _createClass3 = _interopRequireDefault(_createClass2), _possibleConstructorReturn2 = __webpack_require__(10), _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2), _inherits2 = __webpack_require__(11), _inherits3 = _interopRequireDefault(_inherits2), _react = __webpack_require__(12), _react2 = _interopRequireDefault(_react), _reactDom = __webpack_require__(13), _reactDom2 = _interopRequireDefault(_reactDom), _styles = __webpack_require__(14), _styles2 = _interopRequireDefault(_styles), _akLayer = __webpack_require__(18), _akLayer2 = _interopRequireDefault(_akLayer), _akDroplistGroup = __webpack_require__(19), _akDroplistGroup2 = _interopRequireDefault(_akDroplistGroup), _akDroplistTrigger = __webpack_require__(20), _akDroplistTrigger2 = _interopRequireDefault(_akDroplistTrigger), _akDroplistItem = __webpack_require__(21), _akDroplistItem2 = _interopRequireDefault(_akDroplistItem), _keycode = __webpack_require__(22), _keycode2 = _interopRequireDefault(_keycode), _getAvailablePreviousItem = __webpack_require__(23), _getAvailablePreviousItem2 = _interopRequireDefault(_getAvailablePreviousItem), _getAvailableNextItem = __webpack_require__(24), _getAvailableNextItem2 = _interopRequireDefault(_getAvailableNextItem), _findItem = __webpack_require__(25), _findItem2 = _interopRequireDefault(_findItem), _findGroup = __webpack_require__(26), _findGroup2 = _interopRequireDefault(_findGroup), halfGrid = 4, itemHeight = 7 * halfGrid, dropdownMaxHeight = 9.5 * itemHeight + 2 * halfGrid, getCurrentlyFocusedItem = function(items, currentFocus) {
return items[currentFocus.group].items[currentFocus.item];

@@ -133,8 +133,32 @@ }, DropdownMenu = function(_Component) {

}
}, _this.handleItemActivation = function(attrs, item) {
"link" !== attrs.item.props.type && (_this.props.onItemActivated({
item: item
}), _this.close({
source: attrs.event.type
}));
}, _this.handleItemActivation = function(activatedAttrs, group, item) {
var items = [].concat((0, _toConsumableArray3.default)(_this.state.items)), activatedGroup = (0,
_findGroup2.default)(items, group), activatedItem = (0, _findItem2.default)(activatedGroup, item);
switch (activatedAttrs.item.props.type) {
case "checkbox":
activatedItem.isChecked = !activatedItem.isChecked, _this.props.onItemActivated(activatedItem),
_this.setState({
items: items
});
break;
case "radio":
activatedGroup.items.forEach(function(i) {
i === activatedItem ? i.isChecked = !0 : i.isChecked = !1;
}), _this.props.onItemActivated(activatedItem), _this.setState({
items: items
});
break;
case "link":
activatedItem.href || _this.props.onItemActivated(activatedItem), _this.close({
source: activatedAttrs.event.type
});
break;
default:
_this.close({
source: activatedAttrs.event.type
});
}
}, _this.handleAccessibility = function(attrs) {

@@ -208,4 +232,4 @@ var event = attrs.event;

elemBefore: item.elemBefore,
onActivate: function(attrs) {
_this.handleItemActivation(attrs, item);
onActivate: function(activatedAttrs) {
_this.handleItemActivation(activatedAttrs, group, item);
},

@@ -607,3 +631,25 @@ onKeyDown: _this.handleAccessibility

};
}, /* 25 */
/***/
function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.default = function(group, item) {
return group.items.filter(function(i) {
return i === item;
})[0];
};
}, /* 26 */
/***/
function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.default = function(items, group) {
return items.filter(function(g) {
return g === group;
})[0];
};
} ]);
});

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

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("babel-runtime/helpers/toConsumableArray"),require("babel-runtime/core-js/object/get-prototype-of"),require("babel-runtime/helpers/classCallCheck"),require("babel-runtime/helpers/createClass"),require("babel-runtime/helpers/possibleConstructorReturn"),require("babel-runtime/helpers/inherits"),require("react"),require("react-dom"),require("ak-layer"),require("ak-droplist-group"),require("ak-droplist-trigger"),require("ak-droplist-item"),require("keycode")):"function"==typeof define&&define.amd?define(["babel-runtime/helpers/toConsumableArray","babel-runtime/core-js/object/get-prototype-of","babel-runtime/helpers/classCallCheck","babel-runtime/helpers/createClass","babel-runtime/helpers/possibleConstructorReturn","babel-runtime/helpers/inherits","react","react-dom","ak-layer","ak-droplist-group","ak-droplist-trigger","ak-droplist-item","keycode"],t):"object"==typeof exports?exports.akDropdownMenu=t(require("babel-runtime/helpers/toConsumableArray"),require("babel-runtime/core-js/object/get-prototype-of"),require("babel-runtime/helpers/classCallCheck"),require("babel-runtime/helpers/createClass"),require("babel-runtime/helpers/possibleConstructorReturn"),require("babel-runtime/helpers/inherits"),require("react"),require("react-dom"),require("ak-layer"),require("ak-droplist-group"),require("ak-droplist-trigger"),require("ak-droplist-item"),require("keycode")):e.akDropdownMenu=t(e["babel-runtime/helpers/toConsumableArray"],e["babel-runtime/core-js/object/get-prototype-of"],e["babel-runtime/helpers/classCallCheck"],e["babel-runtime/helpers/createClass"],e["babel-runtime/helpers/possibleConstructorReturn"],e["babel-runtime/helpers/inherits"],e.react,e["react-dom"],e["ak-layer"],e["ak-droplist-group"],e["ak-droplist-trigger"],e["ak-droplist-item"],e.keycode)}(this,function(e,t,r,n,o,i,s,u,a,c,l,p,d){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){e.exports=r(5)},,,,,function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(6),i=n(o),s=r(7),u=n(s),a=r(8),c=n(a),l=r(9),p=n(l),d=r(10),f=n(d),m=r(11),h=n(m),b=r(12),g=n(b),v=r(13),y=n(v),k=r(14),x=n(k),C=r(18),q=n(C),_=r(19),O=n(_),F=r(20),T=n(F),A=r(21),w=n(A),j=r(22),E=n(j),I=r(23),R=n(I),L=r(24),M=n(L),S=4,P=7*S,N=9.5*P+2*S,U=function(e,t){return e[t.group].items[t.item]},K=function(e){function t(){var e,r,n,o;(0,c.default)(this,t);for(var s=arguments.length,a=Array(s),l=0;l<s;l++)a[l]=arguments[l];return r=n=(0,f.default)(this,(e=t.__proto__||(0,u.default)(t)).call.apply(e,[this].concat(a))),n.state={isOpen:n.props.defaultOpen,items:n.props.items},n.setMaxHeight=function(e){if(e){var t=n.props.appearance;e.style.maxHeight="tall"!==t?N+"px":"none"}},n.handleKeyDown=function(e){e.keyCode===(0,E.default)("escape")&&n.close({source:"keydown"})},n.handleClickOutside=function(e){if(n.state.isOpen){var t=y.default.findDOMNode(n);(!t||e.target instanceof Node&&!t.contains(e.target))&&n.close({source:"click"})}},n.handleTriggerActivation=function(e){n.toggle({source:e.source})},n.focusFirstItem=function(){n.setState({isTriggerFocused:!1}),n.changeFocus((0,M.default)(n.state.items))},n.removeFocusFromItems=function(){if(n.currentFocus){var e=[].concat((0,i.default)(n.state.items)),t=U(e,n.currentFocus);t.isFocused=!1,n.setState({items:e}),n.currentFocus=null}},n.handleItemActivation=function(e,t){"link"!==e.item.props.type&&(n.props.onItemActivated({item:t}),n.close({source:e.event.type}))},n.handleAccessibility=function(e){var t=e.event;switch(t.preventDefault(),t.keyCode){case(0,E.default)("up"):n.focusPreviousItem();break;case(0,E.default)("down"):n.focusNextItem();break;case(0,E.default)("tab"):n.close({source:"keydown"})}},n.focusPreviousItem=function(){n.currentFocus&&n.changeFocus((0,R.default)(n.state.items,n.currentFocus))},n.focusNextItem=function(){n.currentFocus&&n.changeFocus((0,M.default)(n.state.items,n.currentFocus))},n.changeFocus=function(e){var t=e.group,r=e.item,o=[].concat((0,i.default)(n.state.items));if(n.currentFocus){var s=U(o,n.currentFocus);s.isFocused=!1}o[t].items[r].isFocused=!0,n.currentFocus={group:t,item:r},n.setState({items:o})},n.open=function(e){"keydown"===e.source&&n.focusFirstItem(),n.state.isTriggerFocused&&n.setState({isTriggerFocused:!1}),n.setState({isOpen:!0}),n.props.onOpenChange({isOpen:!0})},n.close=function(e){n.setState({isOpen:!1}),n.props.onOpenChange({isOpen:!1}),e.source&&"keydown"===e.source&&(n.setState({isTriggerFocused:!0}),n.removeFocusFromItems())},n.toggle=function(e){n.state.isOpen?n.close(e):n.open(e)},n.renderSubComponents=function(e){return e.map(function(e,t){var r=e.items.map(function(e,t){return g.default.createElement(w.default,{key:t,href:e.href,target:e.target,type:e.type,isActive:e.isActive,isDisabled:e.isDisabled,isFocused:e.isFocused,isHidden:e.isHidden,isChecked:e.isChecked,elemBefore:e.elemBefore,onActivate:function(t){n.handleItemActivation(t,e)},onKeyDown:n.handleAccessibility},e.content)});return g.default.createElement(O.default,{heading:e.heading,key:t},r)})},n.render=function(){var e=n,t=e.props,r=e.state;return g.default.createElement("div",{className:x.default.dropWrapper},g.default.createElement(q.default,{position:t.position,offset:"0 4",content:r.isOpen?g.default.createElement("div",{className:x.default.dropContent,ref:n.setMaxHeight,role:"menu"},n.renderSubComponents(t.items)):null},g.default.createElement("div",{className:x.default.dropTrigger},g.default.createElement(T.default,{type:t.triggerType,isOpened:r.isOpen,onActivate:n.handleTriggerActivation,isFocused:n.state.isTriggerFocused},t.children))))},o=r,(0,f.default)(n,o)}return(0,h.default)(t,e),(0,p.default)(t,[{key:"componentDidMount",value:function(){document.addEventListener("click",this.handleClickOutside,!0),document.addEventListener("keydown",this.handleKeyDown)}},{key:"componentWillUnmount",value:function(){document.removeEventListener("click",this.handleClickOutside,!0),document.removeEventListener("keydown",this.handleKeyDown)}}]),t}(b.Component);K.propTypes={appearance:b.PropTypes.oneOf(["default","tall"]),position:b.PropTypes.string,triggerType:b.PropTypes.oneOf(["default","button"]),items:b.PropTypes.array.isRequired,defaultOpen:b.PropTypes.bool,onItemActivated:b.PropTypes.func,onOpenChange:b.PropTypes.func,children:b.PropTypes.node},K.defaultProps={appearance:"default",position:"bottom left",triggerType:"default",items:[],defaultOpen:!1,onItemActivated:function(){},onOpenChange:function(){}},t.default=K},function(t,r){t.exports=e},function(e,r){e.exports=t},function(e,t){e.exports=r},function(e,t){e.exports=n},function(e,t){e.exports=o},function(e,t){e.exports=i},function(e,t){e.exports=s},function(e,t){e.exports=u},function(e,t,r){var n=r(15);"string"==typeof n&&(n=[[e.id,n,""]]),r(17)(n,{}),n.locals&&(e.exports=n.locals)},function(e,t,r){t=e.exports=r(16)(),t.push([e.id,"._3kPc8A6nN6B8Jqhh1_TbKq{background:#253858;border-radius:3px;box-sizing:border-box;overflow-y:auto;padding:4px 0}._2r4rgI-xE_oiQpK1yE1V2q{display:-webkit-box;display:flex;width:100%}._1tw_LKkCMR0moIv_o_HhSt{display:-webkit-inline-box;display:inline-flex}",""]),t.locals={dropContent:"_3kPc8A6nN6B8Jqhh1_TbKq",dropContent:"_3kPc8A6nN6B8Jqhh1_TbKq",dropTrigger:"_2r4rgI-xE_oiQpK1yE1V2q",dropTrigger:"_2r4rgI-xE_oiQpK1yE1V2q",dropWrapper:"_1tw_LKkCMR0moIv_o_HhSt",dropWrapper:"_1tw_LKkCMR0moIv_o_HhSt"}},function(e,t){e.exports=function(){var e=[];return e.toString=function(){for(var e=[],t=0;t<this.length;t++){var r=this[t];r[2]?e.push("@media "+r[2]+"{"+r[1]+"}"):e.push(r[1])}return e.join("")},e.i=function(t,r){"string"==typeof t&&(t=[[null,t,""]]);for(var n={},o=0;o<this.length;o++){var i=this[o][0];"number"==typeof i&&(n[i]=!0)}for(o=0;o<t.length;o++){var s=t[o];"number"==typeof s[0]&&n[s[0]]||(r&&!s[2]?s[2]=r:r&&(s[2]="("+s[2]+") and ("+r+")"),e.push(s))}},e}},function(e,t,r){function n(e,t){for(var r=0;r<e.length;r++){var n=e[r],o=f[n.id];if(o){o.refs++;for(var i=0;i<o.parts.length;i++)o.parts[i](n.parts[i]);for(;i<n.parts.length;i++)o.parts.push(c(n.parts[i],t))}else{for(var s=[],i=0;i<n.parts.length;i++)s.push(c(n.parts[i],t));f[n.id]={id:n.id,refs:1,parts:s}}}}function o(e){for(var t=[],r={},n=0;n<e.length;n++){var o=e[n],i=o[0],s=o[1],u=o[2],a=o[3],c={css:s,media:u,sourceMap:a};r[i]?r[i].parts.push(c):t.push(r[i]={id:i,parts:[c]})}return t}function i(e,t){var r=b(),n=y[y.length-1];if("top"===e.insertAt)n?n.nextSibling?r.insertBefore(t,n.nextSibling):r.appendChild(t):r.insertBefore(t,r.firstChild),y.push(t);else{if("bottom"!==e.insertAt)throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");r.appendChild(t)}}function s(e){e.parentNode.removeChild(e);var t=y.indexOf(e);t>=0&&y.splice(t,1)}function u(e){var t=document.createElement("style");return t.type="text/css",i(e,t),t}function a(e){var t=document.createElement("link");return t.rel="stylesheet",i(e,t),t}function c(e,t){var r,n,o;if(t.singleton){var i=v++;r=g||(g=u(t)),n=l.bind(null,r,i,!1),o=l.bind(null,r,i,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(r=a(t),n=d.bind(null,r),o=function(){s(r),r.href&&URL.revokeObjectURL(r.href)}):(r=u(t),n=p.bind(null,r),o=function(){s(r)});return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else o()}}function l(e,t,r,n){var o=r?"":n.css;if(e.styleSheet)e.styleSheet.cssText=k(t,o);else{var i=document.createTextNode(o),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(i,s[t]):e.appendChild(i)}}function p(e,t){var r=t.css,n=t.media;if(n&&e.setAttribute("media",n),e.styleSheet)e.styleSheet.cssText=r;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(r))}}function d(e,t){var r=t.css,n=t.sourceMap;n&&(r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(n))))+" */");var o=new Blob([r],{type:"text/css"}),i=e.href;e.href=URL.createObjectURL(o),i&&URL.revokeObjectURL(i)}var f={},m=function(e){var t;return function(){return"undefined"==typeof t&&(t=e.apply(this,arguments)),t}},h=m(function(){return/msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase())}),b=m(function(){return document.head||document.getElementsByTagName("head")[0]}),g=null,v=0,y=[];e.exports=function(e,t){t=t||{},"undefined"==typeof t.singleton&&(t.singleton=h()),"undefined"==typeof t.insertAt&&(t.insertAt="bottom");var r=o(e);return n(r,t),function(e){for(var i=[],s=0;s<r.length;s++){var u=r[s],a=f[u.id];a.refs--,i.push(a)}if(e){var c=o(e);n(c,t)}for(var s=0;s<i.length;s++){var a=i[s];if(0===a.refs){for(var l=0;l<a.parts.length;l++)a.parts[l]();delete f[a.id]}}}};var k=function(){var e=[];return function(t,r){return e[t]=r,e.filter(Boolean).join("\n")}}()},function(e,t){e.exports=a},function(e,t){e.exports=c},function(e,t){e.exports=l},function(e,t){e.exports=p},function(e,t){e.exports=d},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var r=t.item,n=t.group;return 0!==r?r--:0!==n&&(n--,r=e[n].items.length-1),{item:r,group:n}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if(!t)return{item:0,group:0};var r=t.item,n=t.group,o=e[n].items.length-1;return r!==o?r++:n!==e.length-1&&(n++,r=0),{item:r,group:n}}}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("babel-runtime/helpers/toConsumableArray"),require("babel-runtime/core-js/object/get-prototype-of"),require("babel-runtime/helpers/classCallCheck"),require("babel-runtime/helpers/createClass"),require("babel-runtime/helpers/possibleConstructorReturn"),require("babel-runtime/helpers/inherits"),require("react"),require("react-dom"),require("ak-layer"),require("ak-droplist-group"),require("ak-droplist-trigger"),require("ak-droplist-item"),require("keycode")):"function"==typeof define&&define.amd?define(["babel-runtime/helpers/toConsumableArray","babel-runtime/core-js/object/get-prototype-of","babel-runtime/helpers/classCallCheck","babel-runtime/helpers/createClass","babel-runtime/helpers/possibleConstructorReturn","babel-runtime/helpers/inherits","react","react-dom","ak-layer","ak-droplist-group","ak-droplist-trigger","ak-droplist-item","keycode"],t):"object"==typeof exports?exports.akDropdownMenu=t(require("babel-runtime/helpers/toConsumableArray"),require("babel-runtime/core-js/object/get-prototype-of"),require("babel-runtime/helpers/classCallCheck"),require("babel-runtime/helpers/createClass"),require("babel-runtime/helpers/possibleConstructorReturn"),require("babel-runtime/helpers/inherits"),require("react"),require("react-dom"),require("ak-layer"),require("ak-droplist-group"),require("ak-droplist-trigger"),require("ak-droplist-item"),require("keycode")):e.akDropdownMenu=t(e["babel-runtime/helpers/toConsumableArray"],e["babel-runtime/core-js/object/get-prototype-of"],e["babel-runtime/helpers/classCallCheck"],e["babel-runtime/helpers/createClass"],e["babel-runtime/helpers/possibleConstructorReturn"],e["babel-runtime/helpers/inherits"],e.react,e["react-dom"],e["ak-layer"],e["ak-droplist-group"],e["ak-droplist-trigger"],e["ak-droplist-item"],e.keycode)}(this,function(e,t,r,n,o,i,s,u,a,c,l,p,d){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){e.exports=r(5)},,,,,function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(6),i=n(o),s=r(7),u=n(s),a=r(8),c=n(a),l=r(9),p=n(l),d=r(10),f=n(d),m=r(11),h=n(m),b=r(12),g=n(b),v=r(13),y=n(v),k=r(14),C=n(k),x=r(18),_=n(x),q=r(19),O=n(q),F=r(20),A=n(F),T=r(21),w=n(T),j=r(22),I=n(j),E=r(23),M=n(E),S=r(24),R=n(S),L=r(25),P=n(L),N=r(26),U=n(N),K=4,B=7*K,D=9.5*B+2*K,H=function(e,t){return e[t.group].items[t.item]},J=function(e){function t(){var e,r,n,o;(0,c.default)(this,t);for(var s=arguments.length,a=Array(s),l=0;l<s;l++)a[l]=arguments[l];return r=n=(0,f.default)(this,(e=t.__proto__||(0,u.default)(t)).call.apply(e,[this].concat(a))),n.state={isOpen:n.props.defaultOpen,items:n.props.items},n.setMaxHeight=function(e){if(e){var t=n.props.appearance;e.style.maxHeight="tall"!==t?D+"px":"none"}},n.handleKeyDown=function(e){e.keyCode===(0,I.default)("escape")&&n.close({source:"keydown"})},n.handleClickOutside=function(e){if(n.state.isOpen){var t=y.default.findDOMNode(n);(!t||e.target instanceof Node&&!t.contains(e.target))&&n.close({source:"click"})}},n.handleTriggerActivation=function(e){n.toggle({source:e.source})},n.focusFirstItem=function(){n.setState({isTriggerFocused:!1}),n.changeFocus((0,R.default)(n.state.items))},n.removeFocusFromItems=function(){if(n.currentFocus){var e=[].concat((0,i.default)(n.state.items)),t=H(e,n.currentFocus);t.isFocused=!1,n.setState({items:e}),n.currentFocus=null}},n.handleItemActivation=function(e,t,r){var o=[].concat((0,i.default)(n.state.items)),s=(0,U.default)(o,t),u=(0,P.default)(s,r);switch(e.item.props.type){case"checkbox":u.isChecked=!u.isChecked,n.props.onItemActivated(u),n.setState({items:o});break;case"radio":s.items.forEach(function(e){e===u?e.isChecked=!0:e.isChecked=!1}),n.props.onItemActivated(u),n.setState({items:o});break;case"link":u.href||n.props.onItemActivated(u),n.close({source:e.event.type});break;default:n.close({source:e.event.type})}},n.handleAccessibility=function(e){var t=e.event;switch(t.preventDefault(),t.keyCode){case(0,I.default)("up"):n.focusPreviousItem();break;case(0,I.default)("down"):n.focusNextItem();break;case(0,I.default)("tab"):n.close({source:"keydown"})}},n.focusPreviousItem=function(){n.currentFocus&&n.changeFocus((0,M.default)(n.state.items,n.currentFocus))},n.focusNextItem=function(){n.currentFocus&&n.changeFocus((0,R.default)(n.state.items,n.currentFocus))},n.changeFocus=function(e){var t=e.group,r=e.item,o=[].concat((0,i.default)(n.state.items));if(n.currentFocus){var s=H(o,n.currentFocus);s.isFocused=!1}o[t].items[r].isFocused=!0,n.currentFocus={group:t,item:r},n.setState({items:o})},n.open=function(e){"keydown"===e.source&&n.focusFirstItem(),n.state.isTriggerFocused&&n.setState({isTriggerFocused:!1}),n.setState({isOpen:!0}),n.props.onOpenChange({isOpen:!0})},n.close=function(e){n.setState({isOpen:!1}),n.props.onOpenChange({isOpen:!1}),e.source&&"keydown"===e.source&&(n.setState({isTriggerFocused:!0}),n.removeFocusFromItems())},n.toggle=function(e){n.state.isOpen?n.close(e):n.open(e)},n.renderSubComponents=function(e){return e.map(function(e,t){var r=e.items.map(function(t,r){return g.default.createElement(w.default,{key:r,href:t.href,target:t.target,type:t.type,isActive:t.isActive,isDisabled:t.isDisabled,isFocused:t.isFocused,isHidden:t.isHidden,isChecked:t.isChecked,elemBefore:t.elemBefore,onActivate:function(r){n.handleItemActivation(r,e,t)},onKeyDown:n.handleAccessibility},t.content)});return g.default.createElement(O.default,{heading:e.heading,key:t},r)})},n.render=function(){var e=n,t=e.props,r=e.state;return g.default.createElement("div",{className:C.default.dropWrapper},g.default.createElement(_.default,{position:t.position,offset:"0 4",content:r.isOpen?g.default.createElement("div",{className:C.default.dropContent,ref:n.setMaxHeight,role:"menu"},n.renderSubComponents(t.items)):null},g.default.createElement("div",{className:C.default.dropTrigger},g.default.createElement(A.default,{type:t.triggerType,isOpened:r.isOpen,onActivate:n.handleTriggerActivation,isFocused:n.state.isTriggerFocused},t.children))))},o=r,(0,f.default)(n,o)}return(0,h.default)(t,e),(0,p.default)(t,[{key:"componentDidMount",value:function(){document.addEventListener("click",this.handleClickOutside,!0),document.addEventListener("keydown",this.handleKeyDown)}},{key:"componentWillUnmount",value:function(){document.removeEventListener("click",this.handleClickOutside,!0),document.removeEventListener("keydown",this.handleKeyDown)}}]),t}(b.Component);J.propTypes={appearance:b.PropTypes.oneOf(["default","tall"]),position:b.PropTypes.string,triggerType:b.PropTypes.oneOf(["default","button"]),items:b.PropTypes.array.isRequired,defaultOpen:b.PropTypes.bool,onItemActivated:b.PropTypes.func,onOpenChange:b.PropTypes.func,children:b.PropTypes.node},J.defaultProps={appearance:"default",position:"bottom left",triggerType:"default",items:[],defaultOpen:!1,onItemActivated:function(){},onOpenChange:function(){}},t.default=J},function(t,r){t.exports=e},function(e,r){e.exports=t},function(e,t){e.exports=r},function(e,t){e.exports=n},function(e,t){e.exports=o},function(e,t){e.exports=i},function(e,t){e.exports=s},function(e,t){e.exports=u},function(e,t,r){var n=r(15);"string"==typeof n&&(n=[[e.id,n,""]]),r(17)(n,{}),n.locals&&(e.exports=n.locals)},function(e,t,r){t=e.exports=r(16)(),t.push([e.id,"._3kPc8A6nN6B8Jqhh1_TbKq{background:#253858;border-radius:3px;box-sizing:border-box;overflow-y:auto;padding:4px 0}._2r4rgI-xE_oiQpK1yE1V2q{display:-webkit-box;display:flex;width:100%}._1tw_LKkCMR0moIv_o_HhSt{display:-webkit-inline-box;display:inline-flex}",""]),t.locals={dropContent:"_3kPc8A6nN6B8Jqhh1_TbKq",dropContent:"_3kPc8A6nN6B8Jqhh1_TbKq",dropTrigger:"_2r4rgI-xE_oiQpK1yE1V2q",dropTrigger:"_2r4rgI-xE_oiQpK1yE1V2q",dropWrapper:"_1tw_LKkCMR0moIv_o_HhSt",dropWrapper:"_1tw_LKkCMR0moIv_o_HhSt"}},function(e,t){e.exports=function(){var e=[];return e.toString=function(){for(var e=[],t=0;t<this.length;t++){var r=this[t];r[2]?e.push("@media "+r[2]+"{"+r[1]+"}"):e.push(r[1])}return e.join("")},e.i=function(t,r){"string"==typeof t&&(t=[[null,t,""]]);for(var n={},o=0;o<this.length;o++){var i=this[o][0];"number"==typeof i&&(n[i]=!0)}for(o=0;o<t.length;o++){var s=t[o];"number"==typeof s[0]&&n[s[0]]||(r&&!s[2]?s[2]=r:r&&(s[2]="("+s[2]+") and ("+r+")"),e.push(s))}},e}},function(e,t,r){function n(e,t){for(var r=0;r<e.length;r++){var n=e[r],o=f[n.id];if(o){o.refs++;for(var i=0;i<o.parts.length;i++)o.parts[i](n.parts[i]);for(;i<n.parts.length;i++)o.parts.push(c(n.parts[i],t))}else{for(var s=[],i=0;i<n.parts.length;i++)s.push(c(n.parts[i],t));f[n.id]={id:n.id,refs:1,parts:s}}}}function o(e){for(var t=[],r={},n=0;n<e.length;n++){var o=e[n],i=o[0],s=o[1],u=o[2],a=o[3],c={css:s,media:u,sourceMap:a};r[i]?r[i].parts.push(c):t.push(r[i]={id:i,parts:[c]})}return t}function i(e,t){var r=b(),n=y[y.length-1];if("top"===e.insertAt)n?n.nextSibling?r.insertBefore(t,n.nextSibling):r.appendChild(t):r.insertBefore(t,r.firstChild),y.push(t);else{if("bottom"!==e.insertAt)throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");r.appendChild(t)}}function s(e){e.parentNode.removeChild(e);var t=y.indexOf(e);t>=0&&y.splice(t,1)}function u(e){var t=document.createElement("style");return t.type="text/css",i(e,t),t}function a(e){var t=document.createElement("link");return t.rel="stylesheet",i(e,t),t}function c(e,t){var r,n,o;if(t.singleton){var i=v++;r=g||(g=u(t)),n=l.bind(null,r,i,!1),o=l.bind(null,r,i,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(r=a(t),n=d.bind(null,r),o=function(){s(r),r.href&&URL.revokeObjectURL(r.href)}):(r=u(t),n=p.bind(null,r),o=function(){s(r)});return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else o()}}function l(e,t,r,n){var o=r?"":n.css;if(e.styleSheet)e.styleSheet.cssText=k(t,o);else{var i=document.createTextNode(o),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(i,s[t]):e.appendChild(i)}}function p(e,t){var r=t.css,n=t.media;if(n&&e.setAttribute("media",n),e.styleSheet)e.styleSheet.cssText=r;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(r))}}function d(e,t){var r=t.css,n=t.sourceMap;n&&(r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(n))))+" */");var o=new Blob([r],{type:"text/css"}),i=e.href;e.href=URL.createObjectURL(o),i&&URL.revokeObjectURL(i)}var f={},m=function(e){var t;return function(){return"undefined"==typeof t&&(t=e.apply(this,arguments)),t}},h=m(function(){return/msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase())}),b=m(function(){return document.head||document.getElementsByTagName("head")[0]}),g=null,v=0,y=[];e.exports=function(e,t){t=t||{},"undefined"==typeof t.singleton&&(t.singleton=h()),"undefined"==typeof t.insertAt&&(t.insertAt="bottom");var r=o(e);return n(r,t),function(e){for(var i=[],s=0;s<r.length;s++){var u=r[s],a=f[u.id];a.refs--,i.push(a)}if(e){var c=o(e);n(c,t)}for(var s=0;s<i.length;s++){var a=i[s];if(0===a.refs){for(var l=0;l<a.parts.length;l++)a.parts[l]();delete f[a.id]}}}};var k=function(){var e=[];return function(t,r){return e[t]=r,e.filter(Boolean).join("\n")}}()},function(e,t){e.exports=a},function(e,t){e.exports=c},function(e,t){e.exports=l},function(e,t){e.exports=p},function(e,t){e.exports=d},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var r=t.item,n=t.group;return 0!==r?r--:0!==n&&(n--,r=e[n].items.length-1),{item:r,group:n}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if(!t)return{item:0,group:0};var r=t.item,n=t.group,o=e[n].items.length-1;return r!==o?r++:n!==e.length-1&&(n++,r=0),{item:r,group:n}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){return e.items.filter(function(e){return e===t})[0]}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){return e.filter(function(e){return e===t})[0]}}])});
{
"name": "ak-dropdown-menu",
"version": "1.3.0",
"version": "1.4.0",
"description": "ak-dropdown-menu React component",

@@ -5,0 +5,0 @@ "main": "dist/bundle.js",

@@ -5,3 +5,3 @@ [![AtlasKit component registry](https://img.shields.io/badge/AtlasKit-components-FF5230.svg)](http://aui-cdn.atlassian.com/atlaskit/registry/)

[![Report an issue](https://img.shields.io/badge/Report-an_issue-6554C0.svg)](https://ecosystem.atlassian.net/browse/AK)
[![Ask in our forum](https://img.shields.io/badge/Ask-in_our_forum-6554C0.svg)](https://answers.atlassian.com/questions/ask?title=AtlasKit%3A%20&topics=atlaskit,ak-dropdown-menu,ak-dropdown-menu@1.3.0)
[![Ask in our forum](https://img.shields.io/badge/Ask-in_our_forum-6554C0.svg)](https://answers.atlassian.com/questions/ask?title=AtlasKit%3A%20&topics=atlaskit,ak-dropdown-menu,ak-dropdown-menu@1.4.0)

@@ -14,3 +14,3 @@ # Dropdown menu

See more detailed documentation and code examples in the [live demo of the component](https://aui-cdn.atlassian.com/atlaskit/stories/ak-dropdown-menu/1.3.0/).
See more detailed documentation and code examples in the [live demo of the component](https://aui-cdn.atlassian.com/atlaskit/stories/ak-dropdown-menu/1.4.0/).

@@ -25,3 +25,3 @@ ## Installation

See examples of usage and detailed documentation in the [live demo of the component](https://aui-cdn.atlassian.com/atlaskit/stories/ak-dropdown-menu/1.3.0/).
See examples of usage and detailed documentation in the [live demo of the component](https://aui-cdn.atlassian.com/atlaskit/stories/ak-dropdown-menu/1.4.0/).

@@ -118,3 +118,3 @@ <a name="DropdownMenu"></a>

Ask a question in our [forum](https://answers.atlassian.com/questions/ask?title=AtlasKit%3A%20&topics=atlaskit,ak-dropdown-menu,ak-dropdown-menu@1.3.0).
Ask a question in our [forum](https://answers.atlassian.com/questions/ask?title=AtlasKit%3A%20&topics=atlaskit,ak-dropdown-menu,ak-dropdown-menu@1.4.0).

@@ -121,0 +121,0 @@ Check [if someone has already asked the same question before](https://answers.atlassian.com/questions/topics/42926171/atlaskit).

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc