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

react-aria-menubutton

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-aria-menubutton - npm Package Compare versions

Comparing version 5.0.0 to 5.0.1

6

CHANGELOG.md
# Changelog
## 5.0.1
- Clicks inside the menu that are not on a `MenuItem` move focus to the first `MenuItem`.
- When the menu opens, focus only moves to the first menu item *if you opened with keyboard interactions*.
With a mouse click on the trigger, for example, focus remains on the trigger.
## 5.0.0

@@ -4,0 +10,0 @@

4

dist/Button.js

@@ -45,2 +45,4 @@ 'use strict';

ambManager.openMenu();
} else {
ambManager.focusItem(0);
}

@@ -62,3 +64,3 @@ break;

if (_this.props.disabled) return;
_this.context.ambManager.toggleMenu();
_this.context.ambManager.toggleMenu({}, { focusMenu: false });
}, _temp), _possibleConstructorReturn(_this, _ret);

@@ -65,0 +67,0 @@ }

@@ -107,5 +107,10 @@ 'use strict';

var buttonNode = ReactDOM.findDOMNode(self.button);
var menuNode = ReactDOM.findDOMNode(self.menu);
if (!buttonNode) return;
var activeEl = buttonNode.ownerDocument.activeElement;
if (buttonNode && activeEl === buttonNode) return;
var menuNode = ReactDOM.findDOMNode(self.menu);
if (menuNode === activeEl) {
self.focusItem(0);
return;
}
if (menuNode && menuNode.contains(activeEl)) return;

@@ -112,0 +117,0 @@ if (self.isOpen) self.closeMenu({ focusButton: false });

@@ -98,3 +98,4 @@ 'use strict';

role: 'menu',
onBlur: ambManager.handleBlur
onBlur: ambManager.handleBlur,
tabIndex: -1
};

@@ -101,0 +102,0 @@

{
"name": "react-aria-menubutton",
"version": "5.0.0",
"version": "5.0.1",
"description": "A fully accessible and flexible React-powered menu button",

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

@@ -38,2 +38,4 @@ const React = require('react');

ambManager.openMenu();
} else {
ambManager.focusItem(0);
}

@@ -57,3 +59,3 @@ break;

if (this.props.disabled) return;
this.context.ambManager.toggleMenu();
this.context.ambManager.toggleMenu({}, { focusMenu: false });
};

@@ -60,0 +62,0 @@

@@ -115,5 +115,10 @@ const ReactDOM = require('react-dom');

const buttonNode = ReactDOM.findDOMNode(self.button);
const menuNode = ReactDOM.findDOMNode(self.menu);
if (!buttonNode) return;
const activeEl = buttonNode.ownerDocument.activeElement;
if (buttonNode && activeEl === buttonNode) return;
const menuNode = ReactDOM.findDOMNode(self.menu);
if (menuNode === activeEl) {
self.focusItem(0);
return;
}
if (menuNode && menuNode.contains(activeEl)) return;

@@ -120,0 +125,0 @@ if (self.isOpen) self.closeMenu({ focusButton: false });

@@ -81,3 +81,4 @@ const React = require('react');

role: 'menu',
onBlur: ambManager.handleBlur
onBlur: ambManager.handleBlur,
tabIndex: -1
};

@@ -84,0 +85,0 @@

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

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],t):"object"==typeof exports?exports.ReactAriaMenuButton=t(require("react"),require("react-dom")):e.ReactAriaMenuButton=t(e.React,e.ReactDOM)}(this,function(e,t){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.i=function(e){return e},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=14)}([function(e,t,n){"use strict";e.exports=function(e,t,n){for(var r in t)t.hasOwnProperty(r)&&(n[r]||(e[r]=t[r]))}},function(e,t,n){if("production"!==process.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(18)(o,!0)}else e.exports=n(17)()},function(t,n){t.exports=e},function(e,t,n){"use strict";function r(e){return function(){return e}}var o=function(){};o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},function(e,t,n){"use strict";function r(e,t,n,r,i,s,a,u){if(o(t),!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var f=[n,r,i,s,a,u],p=0;c=new Error(t.replace(/%s/g,function(){return f[p++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}}var o=function(e){};"production"!==process.env.NODE_ENV&&(o=function(e){if(void 0===e)throw new Error("invariant requires an error message argument")}),e.exports=r},function(e,t,n){"use strict";function r(e,t){a[e]=t}function o(e){delete a[e]}function i(e,t){var n=a[e];if(!n)throw new Error("Cannot open "+u);n.openMenu(t)}function s(e,t){var n=a[e];if(!n)throw new Error("Cannot close "+u);n.closeMenu(t)}var a={},u="a menu outside a mounted Wrapper with an id, or a menu that does not exist";e.exports={registerManager:r,unregisterManager:o,openMenu:i,closeMenu:s}},function(e,t,n){"use strict";var r=n(3),o=r;"production"!==process.env.NODE_ENV&&function(){var e=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o=0,i="Warning: "+e.replace(/%s/g,function(){return n[o++]});"undefined"!=typeof console&&console.error(i);try{throw new Error(i)}catch(e){}};o=function(t,n){if(void 0===n)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(0!==n.indexOf("Failed Composite propType: ")&&!t){for(var r=arguments.length,o=Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];e.apply(void 0,[n].concat(o))}}}(),e.exports=o},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,n){e.exports=t},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<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(2),u=n(1),c=n(0),f={children:u.node.isRequired,disabled:u.bool,tag:u.string},p=function(e){function t(){var e,n,i,s;r(this,t);for(var a=arguments.length,u=Array(a),c=0;c<a;c++)u[c]=arguments[c];return n=i=o(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),i.handleKeyDown=function(e){if(!i.props.disabled){var t=i.context.ambManager;switch(e.key){case"ArrowDown":e.preventDefault(),t.isOpen||t.openMenu();break;case"Enter":case" ":e.preventDefault(),t.toggleMenu();break;case"Escape":t.handleMenuKey(e);break;default:t.handleButtonNonArrowKey(e)}}},i.handleClick=function(){i.props.disabled||i.context.ambManager.toggleMenu()},s=n,o(i,s)}return i(t,e),s(t,[{key:"componentWillMount",value:function(){this.context.ambManager.button=this}},{key:"componentWillUnmount",value:function(){this.context.ambManager.destroy()}},{key:"render",value:function(){var e=this.props,t={role:"button",tabIndex:e.disabled?"":"0","aria-haspopup":!0,"aria-expanded":this.context.ambManager.isOpen,"aria-disabled":e.disabled,onKeyDown:this.handleKeyDown,onClick:this.handleClick,onBlur:this.context.ambManager.handleBlur};return c(t,e,f),a.createElement(e.tag,t,e.children)}}]),t}(a.Component);p.propTypes=f,p.contextTypes={ambManager:u.object.isRequired},p.defaultProps={tag:"span"},e.exports=p},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,a,u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(2),f=n(8),p=n(1),l=n(19),h=n(0),d={children:p.oneOfType([p.func,p.node]).isRequired,tag:p.string};e.exports=(a=s=function(e){function t(){var e,n,i,s;r(this,t);for(var a=arguments.length,u=Array(a),c=0;c<a;c++)u[c]=arguments[c];return n=i=o(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),i.addTapListener=function(){var e=f.findDOMNode(i);if(e){var t=e.ownerDocument;t&&(i.tapListener=l(t.documentElement,i.handleTap))}},i.handleTap=function(e){f.findDOMNode(i).contains(e.target)||f.findDOMNode(i.context.ambManager.button).contains(e.target)||i.context.ambManager.closeMenu()},s=n,o(i,s)}return i(t,e),u(t,[{key:"componentWillMount",value:function(){this.context.ambManager.menu=this}},{key:"componentDidUpdate",value:function(){var e=this.context.ambManager;e.isOpen&&!this.tapListener?this.addTapListener():!e.isOpen&&this.tapListener&&(this.tapListener.remove(),delete this.tapListener),e.isOpen||e.clearItems()}},{key:"componentWillUnmount",value:function(){this.tapListener&&this.tapListener.remove(),this.context.ambManager.destroy()}},{key:"render",value:function(){var e=this.props,t=this.context.ambManager,n=function(){return"function"==typeof e.children?e.children({isOpen:t.isOpen}):!!t.isOpen&&e.children}();if(!n)return!1;var r={onKeyDown:t.handleMenuKey,role:"menu",onBlur:t.handleBlur};return h(r,e,d),c.createElement(e.tag,r,n)}}]),t}(c.Component),s.propTypes=d,s.defaultProps={tag:"div"},s.contextTypes={ambManager:p.object.isRequired},a)},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<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(2),u=n(1),c=n(0),f={children:u.node.isRequired,tag:u.string,text:u.string,value:u.any},p=function(e){function t(){var e,n,i,s;r(this,t);for(var a=arguments.length,u=Array(a),c=0;c<a;c++)u[c]=arguments[c];return n=i=o(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),i.handleKeyDown=function(e){"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),i.selectItem(e))},i.selectItem=function(e){var t=void 0!==i.props.value?i.props.value:i.props.children;i.context.ambManager.handleSelection(t,e)},i.registerNode=function(e){i.node=e},s=n,o(i,s)}return i(t,e),s(t,[{key:"componentDidMount",value:function(){this.context.ambManager.addItem({node:this.node,text:this.props.text})}},{key:"render",value:function(){var e={onClick:this.selectItem,onKeyDown:this.handleKeyDown,role:"menuitem",tabIndex:"-1",ref:this.registerNode};return c(e,this.props,f),a.createElement(this.props.tag,e,this.props.children)}}]),t}(a.Component);p.propTypes=f,p.defaultProps={tag:"div"},p.contextTypes={ambManager:u.object.isRequired},e.exports=p},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<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(2),u=n(1),c=n(13),f=n(0),p={children:u.node.isRequired,onMenuToggle:u.func,onSelection:u.func.isRequired,closeOnSelection:u.bool,tag:u.string},l=function(e){function t(){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),s(t,[{key:"getChildContext",value:function(){return{ambManager:this.manager}}},{key:"componentWillMount",value:function(){this.manager=c({onMenuToggle:this.props.onMenuToggle,onSelection:this.props.onSelection,closeOnSelection:this.props.closeOnSelection,id:this.props.id})}},{key:"render",value:function(){var e={};return f(e,this.props,p),a.createElement(this.props.tag,e,this.props.children)}}]),t}(a.Component);l.propTypes=p,l.defaultProps={tag:"div"},l.childContextTypes={ambManager:u.object},e.exports=l},function(e,t,n){"use strict";function r(){var e=this;e.blurTimer=setTimeout(function(){var t=s.findDOMNode(e.button),n=s.findDOMNode(e.menu),r=t.ownerDocument.activeElement;t&&r===t||n&&n.contains(r)||e.isOpen&&e.closeMenu({focusButton:!1})},0)}function o(e,t){this.options.closeOnSelection&&this.closeMenu({focusButton:!0}),this.options.onSelection(e,t)}function i(e){this.isOpen&&"Escape"===e.key&&(e.preventDefault(),this.closeMenu({focusButton:!0}))}var s=n(8),a=n(15),u=n(5),c={wrap:!0,stringSearch:!0},f={init:function(e){this.options=e||{},void 0===this.options.closeOnSelection&&(this.options.closeOnSelection=!0),this.options.id&&u.registerManager(this.options.id,this),this.handleBlur=r.bind(this),this.handleSelection=o.bind(this),this.handleMenuKey=i.bind(this),this.focusGroup=a(c),this.button=null,this.menu=null,this.isOpen=!1},focusItem:function(e){this.focusGroup.focusNodeAtIndex(e)},addItem:function(e){this.focusGroup.addMember(e)},clearItems:function(){this.focusGroup.clearMembers()},handleButtonNonArrowKey:function(e){this.focusGroup._handleUnboundKey(e)},destroy:function(){this.button=null,this.menu=null,this.focusGroup.deactivate(),clearTimeout(this.blurTimer),clearTimeout(this.moveFocusTimer)},update:function(){this.menu.setState({isOpen:this.isOpen}),this.button.setState({menuOpen:this.isOpen}),this.options.onMenuToggle&&this.options.onMenuToggle({isOpen:this.isOpen})},openMenu:function(e){if(!this.isOpen&&(e=e||{},void 0===e.focusMenu&&(e.focusMenu=!0),this.isOpen=!0,this.update(),this.focusGroup.activate(),e.focusMenu)){var t=this;this.moveFocusTimer=setTimeout(function(){t.focusItem(0)},0)}},closeMenu:function(e){this.isOpen&&(e=e||{},this.isOpen=!1,this.update(),e.focusButton&&s.findDOMNode(this.button).focus())},toggleMenu:function(e,t){e=e||{},t=t||{},this.isOpen?this.closeMenu(e):this.openMenu(t)}};e.exports=function(e){var t=Object.create(f);return t.init(e),t}},function(e,t,n){"use strict";var r=n(5);e.exports={Wrapper:n(12),Button:n(9),Menu:n(10),MenuItem:n(11),openMenu:r.openMenu,closeMenu:r.closeMenu}},function(e,t){function n(e){e=e||{};var t=e.keybindings||{};this._settings={keybindings:{next:t.next||{keyCode:40},prev:t.prev||{keyCode:38},first:t.first,last:t.last},wrap:e.wrap,stringSearch:e.stringSearch,stringSearchDelay:800},this._keybindingsLookup=[];var n,r;for(n in this._settings.keybindings)(r=this._settings.keybindings[n])&&[].concat(r).forEach(function(e){e.metaKey=e.metaKey||!1,e.ctrlKey=e.ctrlKey||!1,e.altKey=e.altKey||!1,e.shiftKey=e.shiftKey||!1,this._keybindingsLookup.push({action:n,eventMatcher:e})}.bind(this));this._searchString="",this._members=[],e.members&&this.setMembers(e.members),this._boundHandleKeydownEvent=this._handleKeydownEvent.bind(this)}function r(e,t){for(var n in e)if(void 0!==t[n]&&e[n]!==t[n])return!1;return!0}function o(e){return e>=65&&e<=90}function i(e){e&&e.focus&&(e.focus(),"input"===e.tagName.toLowerCase()&&e.select())}n.prototype.activate=function(){return document.addEventListener("keydown",this._boundHandleKeydownEvent,!0),this},n.prototype.deactivate=function(){return document.removeEventListener("keydown",this._boundHandleKeydownEvent,!0),this._clearSearchStringRefreshTimer(),this},n.prototype._handleKeydownEvent=function(e){if(-1!==this._getActiveElementIndex()){var t=!1;this._keybindingsLookup.forEach(function(n){if(r(n.eventMatcher,e))switch(t=!0,e.preventDefault(),n.action){case"next":this.moveFocusForward();break;case"prev":this.moveFocusBack();break;case"first":this.moveFocusToFirst();break;case"last":this.moveFocusToLast();break;default:return}}.bind(this)),t||this._handleUnboundKey(e)}},n.prototype.moveFocusForward=function(){var e,t=this._getActiveElementIndex();return e=t<this._members.length-1?t+1:this._settings.wrap?0:t,this.focusNodeAtIndex(e),e},n.prototype.moveFocusBack=function(){var e,t=this._getActiveElementIndex();return e=t>0?t-1:this._settings.wrap?this._members.length-1:t,this.focusNodeAtIndex(e),e},n.prototype.moveFocusToFirst=function(){this.focusNodeAtIndex(0)},n.prototype.moveFocusToLast=function(){this.focusNodeAtIndex(this._members.length-1)},n.prototype._handleUnboundKey=function(e){if(this._settings.stringSearch){if(""!==this._searchString&&(" "===e.key||32===e.keyCode))return e.preventDefault(),-1;if(!o(e.keyCode))return-1;if(e.ctrlKey||e.metaKey||e.altKey)return-1;e.preventDefault(),this._addToSearchString(String.fromCharCode(e.keyCode)),this._runStringSearch()}},n.prototype._clearSearchString=function(){this._searchString=""},n.prototype._addToSearchString=function(e){this._searchString+=e.toLowerCase()},n.prototype._startSearchStringRefreshTimer=function(){var e=this;this._clearSearchStringRefreshTimer(),this._stringSearchTimer=setTimeout(function(){e._clearSearchString()},this._settings.stringSearchDelay)},n.prototype._clearSearchStringRefreshTimer=function(){clearTimeout(this._stringSearchTimer)},n.prototype._runStringSearch=function(){this._startSearchStringRefreshTimer(),this.moveFocusByString(this._searchString)},n.prototype.moveFocusByString=function(e){for(var t,n=0,r=this._members.length;n<r;n++)if(t=this._members[n],t.text&&0===t.text.indexOf(e))return i(t.node)},n.prototype._findIndexOfNode=function(e){for(var t=0,n=this._members.length;t<n;t++)if(this._members[t].node===e)return t;return-1},n.prototype._getActiveElementIndex=function(){return this._findIndexOfNode(document.activeElement)},n.prototype.focusNodeAtIndex=function(e){var t=this._members[e];return t&&i(t.node),this},n.prototype.addMember=function(e,t){var n=e.node||e,r=e.text||n.getAttribute("data-focus-group-text")||n.textContent||"";this._checkNode(n);var o=r.replace(/[\W_]/g,"").toLowerCase(),i={node:n,text:o};return null!==t&&void 0!==t?this._members.splice(t,0,i):this._members.push(i),this},n.prototype.removeMember=function(e){var t="number"==typeof e?e:this._findIndexOfNode(e);if(-1!==t)return this._members.splice(t,1),this},n.prototype.clearMembers=function(){return this._members=[],this},n.prototype.setMembers=function(e){this.clearMembers();for(var t=0,n=e.length;t<n;t++)this.addMember(e[t]);return this},n.prototype.getMembers=function(){return this._members},n.prototype._checkNode=function(e){if(!e.nodeType||e.nodeType!==window.Node.ELEMENT_NODE)throw new Error("focus-group: only DOM nodes allowed");return e},e.exports=function(e){return new n(e)}},function(e,t,n){"use strict";function r(e,t,n,r,u){if("production"!==process.env.NODE_ENV)for(var c in e)if(e.hasOwnProperty(c)){var f;try{o("function"==typeof e[c],"%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",r||"React class",n,c),f=e[c](t,c,r,n,null,s)}catch(e){f=e}if(i(!f||f 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).",r||"React class",n,c,typeof f),f instanceof Error&&!(f.message in a)){a[f.message]=!0;var p=u?u():"";i(!1,"Failed %s type: %s%s",n,f.message,null!=p?p:"")}}}if("production"!==process.env.NODE_ENV)var o=n(4),i=n(6),s=n(7),a={};e.exports=r},function(e,t,n){"use strict";var r=n(3),o=n(4);e.exports=function(){function e(){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";var r=n(3),o=n(4),i=n(6),s=n(7),a=n(16);e.exports=function(e,t){function n(e){var t=e&&(x&&e[x]||e[E]);if("function"==typeof t)return t}function u(e,t){return e===t?0!==e||1/e==1/t:e!==e&&t!==t}function c(e){this.message=e,this.stack=""}function f(e){function n(n,u,f,p,l,h,d){if(p=p||M,h=h||f,d!==s)if(t)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"!==process.env.NODE_ENV&&"undefined"!=typeof console){var y=p+":"+f;!r[y]&&a<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.",h,p),r[y]=!0,a++)}return null==u[f]?n?new c(null===u[f]?"The "+l+" `"+h+"` is marked as required in `"+p+"`, but its value is `null`.":"The "+l+" `"+h+"` is marked as required in `"+p+"`, but its value is `undefined`."):null:e(u,f,p,l,h)}if("production"!==process.env.NODE_ENV)var r={},a=0;var u=n.bind(null,!1);return u.isRequired=n.bind(null,!0),u}function p(e){function t(t,n,r,o,i,s){var a=t[n];if(O(a)!==e)return new c("Invalid "+o+" `"+i+"` of type `"+_(a)+"` supplied to `"+r+"`, expected `"+e+"`.");return null}return f(t)}function l(e){function t(t,n,r,o,i){if("function"!=typeof e)return new c("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var a=t[n];if(!Array.isArray(a)){return new c("Invalid "+o+" `"+i+"` of type `"+O(a)+"` supplied to `"+r+"`, expected an array.")}for(var u=0;u<a.length;u++){var f=e(a,u,r,o,i+"["+u+"]",s);if(f instanceof Error)return f}return null}return f(t)}function h(e){function t(t,n,r,o,i){if(!(t[n]instanceof e)){var s=e.name||M;return new c("Invalid "+o+" `"+i+"` of type `"+w(t[n])+"` supplied to `"+r+"`, expected instance of `"+s+"`.")}return null}return f(t)}function d(e){function t(t,n,r,o,i){for(var s=t[n],a=0;a<e.length;a++)if(u(s,e[a]))return null;return new c("Invalid "+o+" `"+i+"` of value `"+s+"` supplied to `"+r+"`, expected one of "+JSON.stringify(e)+".")}return Array.isArray(e)?f(t):("production"!==process.env.NODE_ENV&&i(!1,"Invalid argument supplied to oneOf, expected an instance of array."),r.thatReturnsNull)}function y(e){function t(t,n,r,o,i){if("function"!=typeof e)return new c("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var a=t[n],u=O(a);if("object"!==u)return new c("Invalid "+o+" `"+i+"` of type `"+u+"` supplied to `"+r+"`, expected an object.");for(var f in a)if(a.hasOwnProperty(f)){var p=e(a,f,r,o,i+"."+f,s);if(p instanceof Error)return p}return null}return f(t)}function m(e){function t(t,n,r,o,i){for(var a=0;a<e.length;a++){if(null==(0,e[a])(t,n,r,o,i,s))return null}return new c("Invalid "+o+" `"+i+"` supplied to `"+r+"`.")}return Array.isArray(e)?f(t):("production"!==process.env.NODE_ENV&&i(!1,"Invalid argument supplied to oneOfType, expected an instance of array."),r.thatReturnsNull)}function v(e){function t(t,n,r,o,i){var a=t[n],u=O(a);if("object"!==u)return new c("Invalid "+o+" `"+i+"` of type `"+u+"` supplied to `"+r+"`, expected `object`.");for(var f in e){var p=e[f];if(p){var l=p(a,f,r,o,i+"."+f,s);if(l)return l}}return null}return f(t)}function b(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(b);if(null===t||e(t))return!0;var r=n(t);if(!r)return!1;var o,i=r.call(t);if(r!==t.entries){for(;!(o=i.next()).done;)if(!b(o.value))return!1}else for(;!(o=i.next()).done;){var s=o.value;if(s&&!b(s[1]))return!1}return!0;default:return!1}}function g(e,t){return"symbol"===e||("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}function O(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":g(t,e)?"symbol":t}function _(e){var t=O(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function w(e){return e.constructor&&e.constructor.name?e.constructor.name:M}var x="function"==typeof Symbol&&Symbol.iterator,E="@@iterator",M="<<anonymous>>",T={array:p("array"),bool:p("boolean"),func:p("function"),number:p("number"),object:p("object"),string:p("string"),symbol:p("symbol"),any:function(){return f(r.thatReturnsNull)}(),arrayOf:l,element:function(){function t(t,n,r,o,i){var s=t[n];if(!e(s)){return new c("Invalid "+o+" `"+i+"` of type `"+O(s)+"` supplied to `"+r+"`, expected a single ReactElement.")}return null}return f(t)}(),instanceOf:h,node:function(){function e(e,t,n,r,o){return b(e[t])?null:new c("Invalid "+r+" `"+o+"` supplied to `"+n+"`, expected a ReactNode.")}return f(e)}(),objectOf:y,oneOf:d,oneOfType:m,shape:v};return c.prototype=Error.prototype,T.checkPropTypes=a,T.PropTypes=T,T}},function(e,t){e.exports=function(e,t,n){function r(e){d||t(e)}function o(t){d=!0,l||(l=!0,e.addEventListener("touchmove",i,n),e.addEventListener("touchend",s,n),e.addEventListener("touchcancel",a,n),h=!1,f=t.touches[0].clientX,p=t.touches[0].clientY)}function i(e){h||Math.abs(e.touches[0].clientX-f)<=10&&Math.abs(e.touches[0].clientY-p)<=10||(h=!0)}function s(e){l=!1,u(),h||t(e)}function a(){l=!1,h=!1,f=0,p=0}function u(){e.removeEventListener("touchmove",i,n),e.removeEventListener("touchend",s,n),e.removeEventListener("touchcancel",a,n)}function c(){e.removeEventListener("click",r,n),e.removeEventListener("touchstart",o,n),u()}var f=0,p=0,l=!1,h=!1,d=!1;return e.addEventListener("click",r,n),e.addEventListener("touchstart",o,n),{remove:c}}}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],t):"object"==typeof exports?exports.ReactAriaMenuButton=t(require("react"),require("react-dom")):e.ReactAriaMenuButton=t(e.React,e.ReactDOM)}(this,function(e,t){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.i=function(e){return e},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=14)}([function(e,t,n){"use strict";e.exports=function(e,t,n){for(var r in t)t.hasOwnProperty(r)&&(n[r]||(e[r]=t[r]))}},function(e,t,n){if("production"!==process.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(18)(o,!0)}else e.exports=n(17)()},function(t,n){t.exports=e},function(e,t,n){"use strict";function r(e){return function(){return e}}var o=function(){};o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},function(e,t,n){"use strict";function r(e,t,n,r,i,s,a,u){if(o(t),!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var f=[n,r,i,s,a,u],p=0;c=new Error(t.replace(/%s/g,function(){return f[p++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}}var o=function(e){};"production"!==process.env.NODE_ENV&&(o=function(e){if(void 0===e)throw new Error("invariant requires an error message argument")}),e.exports=r},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";function r(e,t){a[e]=t}function o(e){delete a[e]}function i(e,t){var n=a[e];if(!n)throw new Error("Cannot open "+u);n.openMenu(t)}function s(e,t){var n=a[e];if(!n)throw new Error("Cannot close "+u);n.closeMenu(t)}var a={},u="a menu outside a mounted Wrapper with an id, or a menu that does not exist";e.exports={registerManager:r,unregisterManager:o,openMenu:i,closeMenu:s}},function(e,t,n){"use strict";var r=n(3),o=r;if("production"!==process.env.NODE_ENV){var i=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o=0,i="Warning: "+e.replace(/%s/g,function(){return n[o++]});"undefined"!=typeof console&&console.error(i);try{throw new Error(i)}catch(e){}};o=function(e,t){if(void 0===t)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(0!==t.indexOf("Failed Composite propType: ")&&!e){for(var n=arguments.length,r=Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];i.apply(void 0,[t].concat(r))}}}e.exports=o},function(e,n){e.exports=t},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<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(2),u=n(1),c=n(0),f={children:u.node.isRequired,disabled:u.bool,tag:u.string},p=function(e){function t(){var e,n,i,s;r(this,t);for(var a=arguments.length,u=Array(a),c=0;c<a;c++)u[c]=arguments[c];return n=i=o(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),i.handleKeyDown=function(e){if(!i.props.disabled){var t=i.context.ambManager;switch(e.key){case"ArrowDown":e.preventDefault(),t.isOpen?t.focusItem(0):t.openMenu();break;case"Enter":case" ":e.preventDefault(),t.toggleMenu();break;case"Escape":t.handleMenuKey(e);break;default:t.handleButtonNonArrowKey(e)}}},i.handleClick=function(){i.props.disabled||i.context.ambManager.toggleMenu({},{focusMenu:!1})},s=n,o(i,s)}return i(t,e),s(t,[{key:"componentWillMount",value:function(){this.context.ambManager.button=this}},{key:"componentWillUnmount",value:function(){this.context.ambManager.destroy()}},{key:"render",value:function(){var e=this.props,t={role:"button",tabIndex:e.disabled?"":"0","aria-haspopup":!0,"aria-expanded":this.context.ambManager.isOpen,"aria-disabled":e.disabled,onKeyDown:this.handleKeyDown,onClick:this.handleClick,onBlur:this.context.ambManager.handleBlur};return c(t,e,f),a.createElement(e.tag,t,e.children)}}]),t}(a.Component);p.propTypes=f,p.contextTypes={ambManager:u.object.isRequired},p.defaultProps={tag:"span"},e.exports=p},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,a,u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(2),f=n(8),p=n(1),l=n(19),h=n(0),d={children:p.oneOfType([p.func,p.node]).isRequired,tag:p.string};e.exports=(a=s=function(e){function t(){var e,n,i,s;r(this,t);for(var a=arguments.length,u=Array(a),c=0;c<a;c++)u[c]=arguments[c];return n=i=o(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),i.addTapListener=function(){var e=f.findDOMNode(i);if(e){var t=e.ownerDocument;t&&(i.tapListener=l(t.documentElement,i.handleTap))}},i.handleTap=function(e){f.findDOMNode(i).contains(e.target)||f.findDOMNode(i.context.ambManager.button).contains(e.target)||i.context.ambManager.closeMenu()},s=n,o(i,s)}return i(t,e),u(t,[{key:"componentWillMount",value:function(){this.context.ambManager.menu=this}},{key:"componentDidUpdate",value:function(){var e=this.context.ambManager;e.isOpen&&!this.tapListener?this.addTapListener():!e.isOpen&&this.tapListener&&(this.tapListener.remove(),delete this.tapListener),e.isOpen||e.clearItems()}},{key:"componentWillUnmount",value:function(){this.tapListener&&this.tapListener.remove(),this.context.ambManager.destroy()}},{key:"render",value:function(){var e=this.props,t=this.context.ambManager,n=function(){return"function"==typeof e.children?e.children({isOpen:t.isOpen}):!!t.isOpen&&e.children}();if(!n)return!1;var r={onKeyDown:t.handleMenuKey,role:"menu",onBlur:t.handleBlur,tabIndex:-1};return h(r,e,d),c.createElement(e.tag,r,n)}}]),t}(c.Component),s.propTypes=d,s.defaultProps={tag:"div"},s.contextTypes={ambManager:p.object.isRequired},a)},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<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(2),u=n(1),c=n(0),f={children:u.node.isRequired,tag:u.string,text:u.string,value:u.any},p=function(e){function t(){var e,n,i,s;r(this,t);for(var a=arguments.length,u=Array(a),c=0;c<a;c++)u[c]=arguments[c];return n=i=o(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),i.handleKeyDown=function(e){"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),i.selectItem(e))},i.selectItem=function(e){var t=void 0!==i.props.value?i.props.value:i.props.children;i.context.ambManager.handleSelection(t,e)},i.registerNode=function(e){i.node=e},s=n,o(i,s)}return i(t,e),s(t,[{key:"componentDidMount",value:function(){this.context.ambManager.addItem({node:this.node,text:this.props.text})}},{key:"render",value:function(){var e={onClick:this.selectItem,onKeyDown:this.handleKeyDown,role:"menuitem",tabIndex:"-1",ref:this.registerNode};return c(e,this.props,f),a.createElement(this.props.tag,e,this.props.children)}}]),t}(a.Component);p.propTypes=f,p.defaultProps={tag:"div"},p.contextTypes={ambManager:u.object.isRequired},e.exports=p},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<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(2),u=n(1),c=n(13),f=n(0),p={children:u.node.isRequired,onMenuToggle:u.func,onSelection:u.func.isRequired,closeOnSelection:u.bool,tag:u.string},l=function(e){function t(){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),s(t,[{key:"getChildContext",value:function(){return{ambManager:this.manager}}},{key:"componentWillMount",value:function(){this.manager=c({onMenuToggle:this.props.onMenuToggle,onSelection:this.props.onSelection,closeOnSelection:this.props.closeOnSelection,id:this.props.id})}},{key:"render",value:function(){var e={};return f(e,this.props,p),a.createElement(this.props.tag,e,this.props.children)}}]),t}(a.Component);l.propTypes=p,l.defaultProps={tag:"div"},l.childContextTypes={ambManager:u.object},e.exports=l},function(e,t,n){"use strict";function r(){var e=this;e.blurTimer=setTimeout(function(){var t=s.findDOMNode(e.button);if(t){var n=t.ownerDocument.activeElement;if(!t||n!==t){var r=s.findDOMNode(e.menu);if(r===n)return void e.focusItem(0);r&&r.contains(n)||e.isOpen&&e.closeMenu({focusButton:!1})}}},0)}function o(e,t){this.options.closeOnSelection&&this.closeMenu({focusButton:!0}),this.options.onSelection(e,t)}function i(e){this.isOpen&&"Escape"===e.key&&(e.preventDefault(),this.closeMenu({focusButton:!0}))}var s=n(8),a=n(15),u=n(6),c={wrap:!0,stringSearch:!0},f={init:function(e){this.options=e||{},void 0===this.options.closeOnSelection&&(this.options.closeOnSelection=!0),this.options.id&&u.registerManager(this.options.id,this),this.handleBlur=r.bind(this),this.handleSelection=o.bind(this),this.handleMenuKey=i.bind(this),this.focusGroup=a(c),this.button=null,this.menu=null,this.isOpen=!1},focusItem:function(e){this.focusGroup.focusNodeAtIndex(e)},addItem:function(e){this.focusGroup.addMember(e)},clearItems:function(){this.focusGroup.clearMembers()},handleButtonNonArrowKey:function(e){this.focusGroup._handleUnboundKey(e)},destroy:function(){this.button=null,this.menu=null,this.focusGroup.deactivate(),clearTimeout(this.blurTimer),clearTimeout(this.moveFocusTimer)},update:function(){this.menu.setState({isOpen:this.isOpen}),this.button.setState({menuOpen:this.isOpen}),this.options.onMenuToggle&&this.options.onMenuToggle({isOpen:this.isOpen})},openMenu:function(e){if(!this.isOpen&&(e=e||{},void 0===e.focusMenu&&(e.focusMenu=!0),this.isOpen=!0,this.update(),this.focusGroup.activate(),e.focusMenu)){var t=this;this.moveFocusTimer=setTimeout(function(){t.focusItem(0)},0)}},closeMenu:function(e){this.isOpen&&(e=e||{},this.isOpen=!1,this.update(),e.focusButton&&s.findDOMNode(this.button).focus())},toggleMenu:function(e,t){e=e||{},t=t||{},this.isOpen?this.closeMenu(e):this.openMenu(t)}};e.exports=function(e){var t=Object.create(f);return t.init(e),t}},function(e,t,n){"use strict";var r=n(6);e.exports={Wrapper:n(12),Button:n(9),Menu:n(10),MenuItem:n(11),openMenu:r.openMenu,closeMenu:r.closeMenu}},function(e,t){function n(e){e=e||{};var t=e.keybindings||{};this._settings={keybindings:{next:t.next||{keyCode:40},prev:t.prev||{keyCode:38},first:t.first,last:t.last},wrap:e.wrap,stringSearch:e.stringSearch,stringSearchDelay:800},this._keybindingsLookup=[];var n,r;for(n in this._settings.keybindings)(r=this._settings.keybindings[n])&&[].concat(r).forEach(function(e){e.metaKey=e.metaKey||!1,e.ctrlKey=e.ctrlKey||!1,e.altKey=e.altKey||!1,e.shiftKey=e.shiftKey||!1,this._keybindingsLookup.push({action:n,eventMatcher:e})}.bind(this));this._searchString="",this._members=[],e.members&&this.setMembers(e.members),this._boundHandleKeydownEvent=this._handleKeydownEvent.bind(this)}function r(e,t){for(var n in e)if(void 0!==t[n]&&e[n]!==t[n])return!1;return!0}function o(e){return e>=65&&e<=90}function i(e){e&&e.focus&&(e.focus(),"input"===e.tagName.toLowerCase()&&e.select())}n.prototype.activate=function(){return document.addEventListener("keydown",this._boundHandleKeydownEvent,!0),this},n.prototype.deactivate=function(){return document.removeEventListener("keydown",this._boundHandleKeydownEvent,!0),this._clearSearchStringRefreshTimer(),this},n.prototype._handleKeydownEvent=function(e){if(-1!==this._getActiveElementIndex()){var t=!1;this._keybindingsLookup.forEach(function(n){if(r(n.eventMatcher,e))switch(t=!0,e.preventDefault(),n.action){case"next":this.moveFocusForward();break;case"prev":this.moveFocusBack();break;case"first":this.moveFocusToFirst();break;case"last":this.moveFocusToLast();break;default:return}}.bind(this)),t||this._handleUnboundKey(e)}},n.prototype.moveFocusForward=function(){var e,t=this._getActiveElementIndex();return e=t<this._members.length-1?t+1:this._settings.wrap?0:t,this.focusNodeAtIndex(e),e},n.prototype.moveFocusBack=function(){var e,t=this._getActiveElementIndex();return e=t>0?t-1:this._settings.wrap?this._members.length-1:t,this.focusNodeAtIndex(e),e},n.prototype.moveFocusToFirst=function(){this.focusNodeAtIndex(0)},n.prototype.moveFocusToLast=function(){this.focusNodeAtIndex(this._members.length-1)},n.prototype._handleUnboundKey=function(e){if(this._settings.stringSearch){if(""!==this._searchString&&(" "===e.key||32===e.keyCode))return e.preventDefault(),-1;if(!o(e.keyCode))return-1;if(e.ctrlKey||e.metaKey||e.altKey)return-1;e.preventDefault(),this._addToSearchString(String.fromCharCode(e.keyCode)),this._runStringSearch()}},n.prototype._clearSearchString=function(){this._searchString=""},n.prototype._addToSearchString=function(e){this._searchString+=e.toLowerCase()},n.prototype._startSearchStringRefreshTimer=function(){var e=this;this._clearSearchStringRefreshTimer(),this._stringSearchTimer=setTimeout(function(){e._clearSearchString()},this._settings.stringSearchDelay)},n.prototype._clearSearchStringRefreshTimer=function(){clearTimeout(this._stringSearchTimer)},n.prototype._runStringSearch=function(){this._startSearchStringRefreshTimer(),this.moveFocusByString(this._searchString)},n.prototype.moveFocusByString=function(e){for(var t,n=0,r=this._members.length;n<r;n++)if(t=this._members[n],t.text&&0===t.text.indexOf(e))return i(t.node)},n.prototype._findIndexOfNode=function(e){for(var t=0,n=this._members.length;t<n;t++)if(this._members[t].node===e)return t;return-1},n.prototype._getActiveElementIndex=function(){return this._findIndexOfNode(document.activeElement)},n.prototype.focusNodeAtIndex=function(e){var t=this._members[e];return t&&i(t.node),this},n.prototype.addMember=function(e,t){var n=e.node||e,r=e.text||n.getAttribute("data-focus-group-text")||n.textContent||"";this._checkNode(n);var o=r.replace(/[\W_]/g,"").toLowerCase(),i={node:n,text:o};return null!==t&&void 0!==t?this._members.splice(t,0,i):this._members.push(i),this},n.prototype.removeMember=function(e){var t="number"==typeof e?e:this._findIndexOfNode(e);if(-1!==t)return this._members.splice(t,1),this},n.prototype.clearMembers=function(){return this._members=[],this},n.prototype.setMembers=function(e){this.clearMembers();for(var t=0,n=e.length;t<n;t++)this.addMember(e[t]);return this},n.prototype.getMembers=function(){return this._members},n.prototype._checkNode=function(e){if(!e.nodeType||e.nodeType!==window.Node.ELEMENT_NODE)throw new Error("focus-group: only DOM nodes allowed");return e},e.exports=function(e){return new n(e)}},function(e,t,n){"use strict";function r(e,t,n,r,u){if("production"!==process.env.NODE_ENV)for(var c in e)if(e.hasOwnProperty(c)){var f;try{o("function"==typeof e[c],"%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",r||"React class",n,c),f=e[c](t,c,r,n,null,s)}catch(e){f=e}if(i(!f||f 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).",r||"React class",n,c,typeof f),f instanceof Error&&!(f.message in a)){a[f.message]=!0;var p=u?u():"";i(!1,"Failed %s type: %s%s",n,f.message,null!=p?p:"")}}}if("production"!==process.env.NODE_ENV)var o=n(4),i=n(7),s=n(5),a={};e.exports=r},function(e,t,n){"use strict";var r=n(3),o=n(4),i=n(5);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";var r=n(3),o=n(4),i=n(7),s=n(5),a=n(16);e.exports=function(e,t){function n(e){var t=e&&(E&&e[E]||e[M]);if("function"==typeof t)return t}function u(e,t){return e===t?0!==e||1/e==1/t:e!==e&&t!==t}function c(e){this.message=e,this.stack=""}function f(e){function n(n,u,f,p,l,h,d){if(p=p||T,h=h||f,d!==s)if(t)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"!==process.env.NODE_ENV&&"undefined"!=typeof console){var y=p+":"+f;!r[y]&&a<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.",h,p),r[y]=!0,a++)}return null==u[f]?n?new c(null===u[f]?"The "+l+" `"+h+"` is marked as required in `"+p+"`, but its value is `null`.":"The "+l+" `"+h+"` is marked as required in `"+p+"`, but its value is `undefined`."):null:e(u,f,p,l,h)}if("production"!==process.env.NODE_ENV)var r={},a=0;var u=n.bind(null,!1);return u.isRequired=n.bind(null,!0),u}function p(e){function t(t,n,r,o,i,s){var a=t[n];if(O(a)!==e)return new c("Invalid "+o+" `"+i+"` of type `"+_(a)+"` supplied to `"+r+"`, expected `"+e+"`.");return null}return f(t)}function l(e){function t(t,n,r,o,i){if("function"!=typeof e)return new c("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var a=t[n];if(!Array.isArray(a)){return new c("Invalid "+o+" `"+i+"` of type `"+O(a)+"` supplied to `"+r+"`, expected an array.")}for(var u=0;u<a.length;u++){var f=e(a,u,r,o,i+"["+u+"]",s);if(f instanceof Error)return f}return null}return f(t)}function h(e){function t(t,n,r,o,i){if(!(t[n]instanceof e)){var s=e.name||T;return new c("Invalid "+o+" `"+i+"` of type `"+x(t[n])+"` supplied to `"+r+"`, expected instance of `"+s+"`.")}return null}return f(t)}function d(e){function t(t,n,r,o,i){for(var s=t[n],a=0;a<e.length;a++)if(u(s,e[a]))return null;return new c("Invalid "+o+" `"+i+"` of value `"+s+"` supplied to `"+r+"`, expected one of "+JSON.stringify(e)+".")}return Array.isArray(e)?f(t):("production"!==process.env.NODE_ENV&&i(!1,"Invalid argument supplied to oneOf, expected an instance of array."),r.thatReturnsNull)}function y(e){function t(t,n,r,o,i){if("function"!=typeof e)return new c("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var a=t[n],u=O(a);if("object"!==u)return new c("Invalid "+o+" `"+i+"` of type `"+u+"` supplied to `"+r+"`, expected an object.");for(var f in a)if(a.hasOwnProperty(f)){var p=e(a,f,r,o,i+"."+f,s);if(p instanceof Error)return p}return null}return f(t)}function m(e){function t(t,n,r,o,i){for(var a=0;a<e.length;a++){if(null==(0,e[a])(t,n,r,o,i,s))return null}return new c("Invalid "+o+" `"+i+"` supplied to `"+r+"`.")}if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&i(!1,"Invalid argument supplied to oneOfType, expected an instance of array."),r.thatReturnsNull;for(var n=0;n<e.length;n++){var o=e[n];if("function"!=typeof o)return i(!1,"Invalid argument supplid to oneOfType. Expected an array of check functions, but received %s at index %s.",w(o),n),r.thatReturnsNull}return f(t)}function v(e){function t(t,n,r,o,i){var a=t[n],u=O(a);if("object"!==u)return new c("Invalid "+o+" `"+i+"` of type `"+u+"` supplied to `"+r+"`, expected `object`.");for(var f in e){var p=e[f];if(p){var l=p(a,f,r,o,i+"."+f,s);if(l)return l}}return null}return f(t)}function b(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(b);if(null===t||e(t))return!0;var r=n(t);if(!r)return!1;var o,i=r.call(t);if(r!==t.entries){for(;!(o=i.next()).done;)if(!b(o.value))return!1}else for(;!(o=i.next()).done;){var s=o.value;if(s&&!b(s[1]))return!1}return!0;default:return!1}}function g(e,t){return"symbol"===e||("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}function O(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":g(t,e)?"symbol":t}function _(e){if(void 0===e||null===e)return""+e;var t=O(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function w(e){var t=_(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}function x(e){return e.constructor&&e.constructor.name?e.constructor.name:T}var E="function"==typeof Symbol&&Symbol.iterator,M="@@iterator",T="<<anonymous>>",S={array:p("array"),bool:p("boolean"),func:p("function"),number:p("number"),object:p("object"),string:p("string"),symbol:p("symbol"),any:function(){return f(r.thatReturnsNull)}(),arrayOf:l,element:function(){function t(t,n,r,o,i){var s=t[n];if(!e(s)){return new c("Invalid "+o+" `"+i+"` of type `"+O(s)+"` supplied to `"+r+"`, expected a single ReactElement.")}return null}return f(t)}(),instanceOf:h,node:function(){function e(e,t,n,r,o){return b(e[t])?null:new c("Invalid "+r+" `"+o+"` supplied to `"+n+"`, expected a ReactNode.")}return f(e)}(),objectOf:y,oneOf:d,oneOfType:m,shape:v};return c.prototype=Error.prototype,S.checkPropTypes=a,S.PropTypes=S,S}},function(e,t){e.exports=function(e,t,n){function r(e){d||t(e)}function o(t){d=!0,l||(l=!0,e.addEventListener("touchmove",i,n),e.addEventListener("touchend",s,n),e.addEventListener("touchcancel",a,n),h=!1,f=t.touches[0].clientX,p=t.touches[0].clientY)}function i(e){h||Math.abs(e.touches[0].clientX-f)<=10&&Math.abs(e.touches[0].clientY-p)<=10||(h=!0)}function s(e){l=!1,u(),h||t(e)}function a(){l=!1,h=!1,f=0,p=0}function u(){e.removeEventListener("touchmove",i,n),e.removeEventListener("touchend",s,n),e.removeEventListener("touchcancel",a,n)}function c(){e.removeEventListener("click",r,n),e.removeEventListener("touchstart",o,n),u()}var f=0,p=0,l=!1,h=!1,d=!1;return e.addEventListener("click",r,n),e.addEventListener("touchstart",o,n),{remove:c}}}])});

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

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