react-aria-menubutton
Advanced tools
Comparing version 6.3.0 to 7.0.0
# Changelog | ||
## 7.0.0 | ||
- **Breaking:** Removed usage of `ReactDOM.findDOMNode` and `create-react-context`. This will no longer support older versions of React, it now requires `^16.3.0` | ||
## 6.3.0 | ||
@@ -4,0 +7,0 @@ - Removed usage of legacy React context API, the package now use `create-react-context` which uses new context API if available else fallsback to the legacy API. |
@@ -11,4 +11,8 @@ 'use strict'; | ||
var PropTypes = require('prop-types'); | ||
var ManagerContext = require('./ManagerContext'); | ||
var _require = require("./propTypes"), | ||
refType = _require.refType; | ||
var specialAssign = require('./specialAssign'); | ||
var withManagerContext = require('./withManagerContext'); | ||
@@ -19,2 +23,3 @@ var checkedProps = { | ||
disabled: PropTypes.bool, | ||
forwardedRef: refType, | ||
tag: PropTypes.string | ||
@@ -40,3 +45,3 @@ }; | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleKeyDown = function (event) { | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.ref = React.createRef(), _this.handleKeyDown = function (event) { | ||
if (_this.props.disabled) return; | ||
@@ -70,2 +75,9 @@ | ||
_this.props.ambManager.toggleMenu({}, { focusMenu: false }); | ||
}, _this.setRef = function (instance) { | ||
_this.ref.current = instance; | ||
if (typeof _this.props.forwardedRef === "function") { | ||
_this.props.forwardedRef(instance); | ||
} else if (_this.props.forwardedRef) { | ||
_this.props.forwardedRef.current = instance; | ||
} | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
@@ -110,2 +122,3 @@ } | ||
specialAssign(buttonProps, props, reserved); | ||
specialAssign(buttonProps, { ref: this.setRef }); | ||
@@ -122,2 +135,12 @@ return React.createElement(props.tag, buttonProps, props.children); | ||
module.exports = withManagerContext(AriaMenuButtonButton); | ||
module.exports = React.forwardRef(function (props, ref) { | ||
return React.createElement(ManagerContext.Consumer, null, function (ambManager) { | ||
var buttonProps = { ambManager: ambManager, forwardedRef: ref }; | ||
specialAssign(buttonProps, props, { | ||
ambManager: checkedProps.ambManager, | ||
children: checkedProps.children, | ||
forwardedRef: checkedProps.forwardedRef | ||
}); | ||
return React.createElement(AriaMenuButtonButton, buttonProps, props.children); | ||
}); | ||
}); |
'use strict'; | ||
var ReactDOM = require('react-dom'); | ||
var createFocusGroup = require('focus-group'); | ||
@@ -93,3 +92,3 @@ var externalStateControl = require('./externalStateControl'); | ||
if (closeOptions.focusButton) { | ||
ReactDOM.findDOMNode(this.button).focus(); | ||
this.button.ref.current.focus(); | ||
} | ||
@@ -111,7 +110,7 @@ }, | ||
self.blurTimer = setTimeout(function () { | ||
var buttonNode = ReactDOM.findDOMNode(self.button); | ||
var buttonNode = self.button.ref.current; | ||
if (!buttonNode) return; | ||
var activeEl = buttonNode.ownerDocument.activeElement; | ||
if (buttonNode && activeEl === buttonNode) return; | ||
var menuNode = ReactDOM.findDOMNode(self.menu); | ||
var menuNode = self.menu.ref.current; | ||
if (menuNode === activeEl) { | ||
@@ -118,0 +117,0 @@ self.focusItem(0); |
'use strict'; | ||
var createReactContext = require('create-react-context'); | ||
var React = require('react'); | ||
var AriaMenuButtonManagerContext = createReactContext(); | ||
var AriaMenuButtonManagerContext = React.createContext(); | ||
module.exports = AriaMenuButtonManagerContext; |
@@ -10,7 +10,10 @@ 'use strict'; | ||
var React = require('react'); | ||
var ReactDOM = require('react-dom'); | ||
var PropTypes = require('prop-types'); | ||
var createTapListener = require('teeny-tap'); | ||
var ManagerContext = require('./ManagerContext'); | ||
var _require = require("./propTypes"), | ||
refType = _require.refType; | ||
var specialAssign = require('./specialAssign'); | ||
var withManagerContext = require('./withManagerContext'); | ||
@@ -20,2 +23,3 @@ var checkedProps = { | ||
children: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired, | ||
forwardedRef: refType, | ||
tag: PropTypes.string | ||
@@ -36,4 +40,4 @@ }; | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.addTapListener = function () { | ||
var el = ReactDOM.findDOMNode(_this); | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.ref = React.createRef(), _this.addTapListener = function () { | ||
var el = _this.ref.current; | ||
if (!el) return; | ||
@@ -44,5 +48,12 @@ var doc = el.ownerDocument; | ||
}, _this.handleTap = function (event) { | ||
if (ReactDOM.findDOMNode(_this).contains(event.target)) return; | ||
if (ReactDOM.findDOMNode(_this.props.ambManager.button).contains(event.target)) return; | ||
if (_this.ref.current.contains(event.target)) return; | ||
if (_this.props.ambManager.button.ref.current.contains(event.target)) return; | ||
_this.props.ambManager.closeMenu(); | ||
}, _this.setRef = function (instance) { | ||
_this.ref.current = instance; | ||
if (typeof _this.props.forwardedRef === "function") { | ||
_this.props.forwardedRef(instance); | ||
} else if (_this.props.forwardedRef) { | ||
_this.props.forwardedRef.current = instance; | ||
} | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
@@ -102,2 +113,3 @@ } | ||
specialAssign(menuProps, props, checkedProps); | ||
specialAssign(menuProps, { ref: this.setRef }); | ||
@@ -114,2 +126,12 @@ return React.createElement(props.tag, menuProps, childrenToRender); | ||
module.exports = withManagerContext(AriaMenuButtonMenu); | ||
module.exports = React.forwardRef(function (props, ref) { | ||
return React.createElement(ManagerContext.Consumer, null, function (ambManager) { | ||
var buttonProps = { ambManager: ambManager, forwardedRef: ref }; | ||
specialAssign(buttonProps, props, { | ||
ambManager: checkedProps.ambManager, | ||
children: checkedProps.children, | ||
forwardedRef: checkedProps.forwardedRef | ||
}); | ||
return React.createElement(AriaMenuButtonMenu, buttonProps, props.children); | ||
}); | ||
}); |
@@ -11,4 +11,8 @@ 'use strict'; | ||
var PropTypes = require('prop-types'); | ||
var ManagerContext = require('./ManagerContext'); | ||
var _require = require("./propTypes"), | ||
refType = _require.refType; | ||
var specialAssign = require('./specialAssign'); | ||
var withManagerContext = require('./withManagerContext'); | ||
@@ -18,2 +22,3 @@ var checkedProps = { | ||
children: PropTypes.node.isRequired, | ||
forwardedRef: refType, | ||
tag: PropTypes.string, | ||
@@ -36,3 +41,3 @@ text: PropTypes.string, | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleKeyDown = function (event) { | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.ref = React.createRef(), _this.handleKeyDown = function (event) { | ||
if (event.key !== 'Enter' && event.key !== ' ') return; | ||
@@ -46,4 +51,9 @@ if (_this.props.tag === 'a' && _this.props.href) return; | ||
_this.props.ambManager.handleSelection(value, event); | ||
}, _this.registerNode = function (node) { | ||
_this.node = node; | ||
}, _this.setRef = function (instance) { | ||
_this.ref.current = instance; | ||
if (typeof _this.props.forwardedRef === "function") { | ||
_this.props.forwardedRef(instance); | ||
} else if (_this.props.forwardedRef) { | ||
_this.props.forwardedRef.current = instance; | ||
} | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
@@ -54,3 +64,3 @@ } | ||
this.props.ambManager.addItem({ | ||
node: this.node, | ||
node: this.ref.current, | ||
text: this.props.text | ||
@@ -66,3 +76,3 @@ }); | ||
tabIndex: '-1', | ||
ref: this.registerNode | ||
ref: this.setRef | ||
}; | ||
@@ -82,2 +92,12 @@ | ||
module.exports = withManagerContext(AriaMenuButtonMenuItem); | ||
module.exports = React.forwardRef(function (props, ref) { | ||
return React.createElement(ManagerContext.Consumer, null, function (ambManager) { | ||
var buttonProps = { ambManager: ambManager, forwardedRef: ref }; | ||
specialAssign(buttonProps, props, { | ||
ambManager: checkedProps.ambManager, | ||
children: checkedProps.children, | ||
forwardedRef: checkedProps.forwardedRef | ||
}); | ||
return React.createElement(AriaMenuButtonMenuItem, buttonProps, props.children); | ||
}); | ||
}); |
@@ -13,2 +13,6 @@ 'use strict'; | ||
var ManagerContext = require('./ManagerContext'); | ||
var _require = require("./propTypes"), | ||
refType = _require.refType; | ||
var specialAssign = require('./specialAssign'); | ||
@@ -18,2 +22,3 @@ | ||
children: PropTypes.node.isRequired, | ||
forwardedRef: refType, | ||
onMenuToggle: PropTypes.func, | ||
@@ -58,2 +63,7 @@ onSelection: PropTypes.func, | ||
module.exports = AriaMenuButtonWrapper; | ||
module.exports = React.forwardRef(function (props, ref) { | ||
var wrapperProps = { forwardedRef: ref }; | ||
specialAssign(wrapperProps, props, { children: checkedProps.children, forwardedRef: checkedProps.forwardedRef }); | ||
specialAssign(wrapperProps, { forwardedRef: ref }); | ||
return React.createElement(AriaMenuButtonWrapper, wrapperProps, props.children); | ||
}); |
{ | ||
"name": "react-aria-menubutton", | ||
"version": "6.3.0", | ||
"version": "7.0.0", | ||
"description": "A fully accessible and flexible React-powered menu button", | ||
@@ -53,11 +53,8 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"create-react-context": "^0.3.0", | ||
"focus-group": "^0.3.1", | ||
"prop-types": "^15.6.0", | ||
"react-display-name": "^0.2.4", | ||
"teeny-tap": "^0.2.0" | ||
}, | ||
"peerDependencies": { | ||
"react": "0.14.x || ^15.0.0 || ^16.0.0", | ||
"react-dom": "0.14.x || ^15.0.0 || ^16.0.0" | ||
"react": "^16.3.0" | ||
}, | ||
@@ -64,0 +61,0 @@ "devDependencies": { |
# react-aria-menubutton [![Build Status](https://travis-ci.org/davidtheclark/react-aria-menubutton.svg?branch=master)](https://travis-ci.org/davidtheclark/react-aria-menubutton) | ||
--- | ||
**SEEKING CO-MAINTAINERS!** Continued development of this project is going to require the work of one or more dedicated co-maintainers (or forkers). If you're interested, please comment in [this issue](https://github.com/davidtheclark/react-aria-menubutton/issues/96). | ||
--- | ||
A React component (set of components, really) that will help you build accessible menu buttons by providing keyboard interactions and ARIA attributes aligned with [the WAI-ARIA Menu Button Design Pattern](http://www.w3.org/TR/wai-aria-practices/#menubutton). | ||
@@ -10,0 +4,0 @@ |
/* globals Promise */ | ||
var findDOMNodeMock = jest.fn(); | ||
jest.setMock('react-dom', { | ||
findDOMNode: findDOMNodeMock | ||
}); | ||
@@ -10,2 +6,3 @@ var createManager = require('../createManager'); | ||
var mockNode = document.createElement('button'); | ||
var nodeOne = document.createElement('button'); | ||
@@ -29,3 +26,3 @@ nodeOne.focus = jest.fn(); | ||
manager.button = { | ||
focus: jest.fn(), | ||
ref: { current: mockNode }, | ||
setState: jest.fn() | ||
@@ -103,6 +100,3 @@ }; | ||
it('Manager#closeMenu focusing on button', function() { | ||
var mockNode = { focus: jest.fn() }; | ||
findDOMNodeMock.mockImplementation(function() { | ||
return mockNode; | ||
}); | ||
mockNode.focus = jest.fn(); | ||
@@ -124,6 +118,3 @@ var manager = createManagerWithMockedElements(); | ||
it('Manager#closeMenu without focusing on button', function() { | ||
var mockNode = { focus: jest.fn() }; | ||
findDOMNodeMock.mockImplementation(function() { | ||
return mockNode; | ||
}); | ||
mockNode.focus = jest.fn(); | ||
@@ -130,0 +121,0 @@ var manager = createManagerWithMockedElements(); |
const React = require('react'); | ||
const PropTypes = require('prop-types'); | ||
const ManagerContext = require('./ManagerContext'); | ||
const { refType } = require("./propTypes"); | ||
const specialAssign = require('./specialAssign'); | ||
const withManagerContext = require('./withManagerContext'); | ||
@@ -10,2 +11,3 @@ const checkedProps = { | ||
disabled: PropTypes.bool, | ||
forwardedRef: refType, | ||
tag: PropTypes.string | ||
@@ -30,2 +32,4 @@ }; | ||
ref = React.createRef(); | ||
componentDidMount() { | ||
@@ -72,2 +76,11 @@ this.props.ambManager.button = this; | ||
setRef = instance => { | ||
this.ref.current = instance; | ||
if (typeof this.props.forwardedRef === "function") { | ||
this.props.forwardedRef(instance); | ||
} else if (this.props.forwardedRef) { | ||
this.props.forwardedRef.current = instance; | ||
} | ||
}; | ||
render() { | ||
@@ -101,2 +114,3 @@ const props = this.props; | ||
specialAssign(buttonProps, props, reserved); | ||
specialAssign(buttonProps, { ref: this.setRef }); | ||
@@ -107,2 +121,14 @@ return React.createElement(props.tag, buttonProps, props.children); | ||
module.exports = withManagerContext(AriaMenuButtonButton); | ||
module.exports = React.forwardRef((props, ref) => React.createElement( | ||
ManagerContext.Consumer, | ||
null, | ||
(ambManager) => { | ||
const buttonProps = { ambManager, forwardedRef: ref }; | ||
specialAssign(buttonProps, props, { | ||
ambManager: checkedProps.ambManager, | ||
children: checkedProps.children, | ||
forwardedRef: checkedProps.forwardedRef | ||
}); | ||
return React.createElement(AriaMenuButtonButton, buttonProps, props.children); | ||
} | ||
)); |
@@ -1,2 +0,1 @@ | ||
const ReactDOM = require('react-dom'); | ||
const createFocusGroup = require('focus-group'); | ||
@@ -100,3 +99,3 @@ const externalStateControl = require('./externalStateControl'); | ||
if (closeOptions.focusButton) { | ||
ReactDOM.findDOMNode(this.button).focus(); | ||
this.button.ref.current.focus(); | ||
} | ||
@@ -119,7 +118,7 @@ }, | ||
self.blurTimer = setTimeout(function() { | ||
const buttonNode = ReactDOM.findDOMNode(self.button); | ||
const buttonNode = self.button.ref.current; | ||
if (!buttonNode) return; | ||
const activeEl = buttonNode.ownerDocument.activeElement; | ||
if (buttonNode && activeEl === buttonNode) return; | ||
const menuNode = ReactDOM.findDOMNode(self.menu); | ||
const menuNode = self.menu.ref.current; | ||
if (menuNode === activeEl) { | ||
@@ -126,0 +125,0 @@ self.focusItem(0); |
@@ -1,5 +0,5 @@ | ||
const createReactContext = require('create-react-context'); | ||
const React = require('react'); | ||
const AriaMenuButtonManagerContext = createReactContext(); | ||
const AriaMenuButtonManagerContext = React.createContext(); | ||
module.exports = AriaMenuButtonManagerContext; |
const React = require('react'); | ||
const ReactDOM = require('react-dom'); | ||
const PropTypes = require('prop-types'); | ||
const createTapListener = require('teeny-tap'); | ||
const ManagerContext = require('./ManagerContext'); | ||
const { refType } = require("./propTypes"); | ||
const specialAssign = require('./specialAssign'); | ||
const withManagerContext = require('./withManagerContext'); | ||
@@ -11,2 +11,3 @@ const checkedProps = { | ||
children: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired, | ||
forwardedRef: refType, | ||
tag: PropTypes.string | ||
@@ -19,2 +20,4 @@ }; | ||
ref = React.createRef(); | ||
componentDidMount() { | ||
@@ -47,3 +50,3 @@ this.props.ambManager.menu = this; | ||
addTapListener = () => { | ||
const el = ReactDOM.findDOMNode(this); | ||
const el = this.ref.current; | ||
if (!el) return; | ||
@@ -56,5 +59,5 @@ const doc = el.ownerDocument; | ||
handleTap = event => { | ||
if (ReactDOM.findDOMNode(this).contains(event.target)) return; | ||
if (this.ref.current.contains(event.target)) return; | ||
if ( | ||
ReactDOM.findDOMNode(this.props.ambManager.button).contains( | ||
this.props.ambManager.button.ref.current.contains( | ||
event.target | ||
@@ -67,2 +70,11 @@ ) | ||
setRef = instance => { | ||
this.ref.current = instance; | ||
if (typeof this.props.forwardedRef === "function") { | ||
this.props.forwardedRef(instance); | ||
} else if (this.props.forwardedRef) { | ||
this.props.forwardedRef.current = instance; | ||
} | ||
}; | ||
render() { | ||
@@ -93,2 +105,3 @@ const props = this.props; | ||
specialAssign(menuProps, props, checkedProps); | ||
specialAssign(menuProps, { ref: this.setRef }); | ||
@@ -99,2 +112,14 @@ return React.createElement(props.tag, menuProps, childrenToRender); | ||
module.exports = withManagerContext(AriaMenuButtonMenu); | ||
module.exports = React.forwardRef((props, ref) => React.createElement( | ||
ManagerContext.Consumer, | ||
null, | ||
(ambManager) => { | ||
const buttonProps = { ambManager, forwardedRef: ref }; | ||
specialAssign(buttonProps, props, { | ||
ambManager: checkedProps.ambManager, | ||
children: checkedProps.children, | ||
forwardedRef: checkedProps.forwardedRef | ||
}); | ||
return React.createElement(AriaMenuButtonMenu, buttonProps, props.children); | ||
} | ||
)); |
const React = require('react'); | ||
const PropTypes = require('prop-types'); | ||
const ManagerContext = require('./ManagerContext'); | ||
const { refType } = require("./propTypes"); | ||
const specialAssign = require('./specialAssign'); | ||
const withManagerContext = require('./withManagerContext'); | ||
@@ -9,2 +10,3 @@ const checkedProps = { | ||
children: PropTypes.node.isRequired, | ||
forwardedRef: refType, | ||
tag: PropTypes.string, | ||
@@ -19,5 +21,7 @@ text: PropTypes.string, | ||
ref = React.createRef(); | ||
componentDidMount() { | ||
this.props.ambManager.addItem({ | ||
node: this.node, | ||
node: this.ref.current, | ||
text: this.props.text | ||
@@ -42,4 +46,9 @@ }); | ||
registerNode = node => { | ||
this.node = node; | ||
setRef = instance => { | ||
this.ref.current = instance; | ||
if (typeof this.props.forwardedRef === "function") { | ||
this.props.forwardedRef(instance); | ||
} else if (this.props.forwardedRef) { | ||
this.props.forwardedRef.current = instance; | ||
} | ||
}; | ||
@@ -53,3 +62,3 @@ | ||
tabIndex: '-1', | ||
ref: this.registerNode | ||
ref: this.setRef | ||
}; | ||
@@ -67,2 +76,14 @@ | ||
module.exports = withManagerContext(AriaMenuButtonMenuItem); | ||
module.exports = React.forwardRef((props, ref) => React.createElement( | ||
ManagerContext.Consumer, | ||
null, | ||
(ambManager) => { | ||
const buttonProps = { ambManager, forwardedRef: ref }; | ||
specialAssign(buttonProps, props, { | ||
ambManager: checkedProps.ambManager, | ||
children: checkedProps.children, | ||
forwardedRef: checkedProps.forwardedRef | ||
}); | ||
return React.createElement(AriaMenuButtonMenuItem, buttonProps, props.children); | ||
} | ||
)); |
@@ -5,2 +5,3 @@ const React = require('react'); | ||
const ManagerContext = require('./ManagerContext'); | ||
const { refType } = require("./propTypes"); | ||
const specialAssign = require('./specialAssign'); | ||
@@ -10,2 +11,3 @@ | ||
children: PropTypes.node.isRequired, | ||
forwardedRef: refType, | ||
onMenuToggle: PropTypes.func, | ||
@@ -49,2 +51,7 @@ onSelection: PropTypes.func, | ||
module.exports = AriaMenuButtonWrapper; | ||
module.exports = React.forwardRef((props, ref) => { | ||
const wrapperProps = { forwardedRef: ref }; | ||
specialAssign(wrapperProps, props, { children: checkedProps.children, forwardedRef: checkedProps.forwardedRef }); | ||
specialAssign(wrapperProps, { forwardedRef: ref }); | ||
return React.createElement(AriaMenuButtonWrapper, wrapperProps, props.children); | ||
}); |
@@ -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)}(window,function(e,t){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=24)}([function(t,n){t.exports=e},function(e,t,n){"use strict";e.exports=function(e,t,n){for(var o in n=n||{},t)t.hasOwnProperty(o)&&(n[o]||(e[o]=t[o]))}},function(e,t,n){e.exports=n(22)()},function(e,t,n){"use strict";var o=n(0),r=n(10).default,i=n(4),s=n(1);e.exports=function(e){var t,n;return n=t=function(t){function n(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),function(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}(this,t.apply(this,arguments))}return function(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)}(n,t),n.prototype.render=function(){var t=this;return o.createElement(i.Consumer,null,function(n){var r={};return s(r,t.props),s(r,{ambManager:n}),o.createElement(e,r,t.props.children)})},n}(o.Component),t.displayName="withManagerContext("+r(e)+")",n}},function(e,t,n){"use strict";var o=n(16)();e.exports=o},function(e,n){e.exports=t},function(e,t,n){"use strict";var o={},r="a menu outside a mounted Wrapper with an id, or a menu that does not exist";e.exports={registerManager:function(e,t){o[e]=t},unregisterManager:function(e){delete o[e]},openMenu:function(e,t){var n=o[e];if(!n)throw new Error("Cannot open "+r);n.openMenu(t)},closeMenu:function(e,t){var n=o[e];if(!n)throw new Error("Cannot close "+r);n.closeMenu(t)}}},function(e,t,n){"use strict";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}var r=n(0),i=n(2),s=n(1),u=n(3),c={ambManager:i.object.isRequired,children:i.node.isRequired,tag:i.string,text:i.string,value:i.any},a=function(e){function t(){var n,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var i=arguments.length,s=Array(i),u=0;u<i;u++)s[u]=arguments[u];return n=r=o(this,e.call.apply(e,[this].concat(s))),r.handleKeyDown=function(e){"Enter"!==e.key&&" "!==e.key||"a"===r.props.tag&&r.props.href||(e.preventDefault(),r.selectItem(e))},r.selectItem=function(e){var t=void 0!==r.props.value?r.props.value:r.props.children;r.props.ambManager.handleSelection(t,e)},r.registerNode=function(e){r.node=e},o(r,n)}return function(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)}(t,e),t.prototype.componentDidMount=function(){this.props.ambManager.addItem({node:this.node,text:this.props.text})},t.prototype.render=function(){var e={onClick:this.selectItem,onKeyDown:this.handleKeyDown,role:"menuitem",tabIndex:"-1",ref:this.registerNode};return s(e,this.props,c),r.createElement(this.props.tag,e,this.props.children)},t}(r.Component);a.propTypes=c,a.defaultProps={tag:"div"},e.exports=u(a)},function(e,t){e.exports=function(e,t,n){var o=0,r=0,i=!1,s=!1,u=!1;function c(e){u||t(e)}function a(t){u=!0,i||(i=!0,e.addEventListener("touchmove",p,n),e.addEventListener("touchend",f,n),e.addEventListener("touchcancel",l,n),s=!1,o=t.touches[0].clientX,r=t.touches[0].clientY)}function p(e){s||Math.abs(e.touches[0].clientX-o)<=10&&Math.abs(e.touches[0].clientY-r)<=10||(s=!0)}function f(e){i=!1,h(),s||t(e)}function l(){i=!1,s=!1,o=0,r=0}function h(){e.removeEventListener("touchmove",p,n),e.removeEventListener("touchend",f,n),e.removeEventListener("touchcancel",l,n)}return e.addEventListener("click",c,n),e.addEventListener("touchstart",a,n),{remove:function(){e.removeEventListener("click",c,n),e.removeEventListener("touchstart",a,n),h()}}}},function(e,t,n){"use strict";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}var r=n(0),i=n(5),s=n(2),u=n(8),c=n(1),a=n(3),p={ambManager:s.object.isRequired,children:s.oneOfType([s.func,s.node]).isRequired,tag:s.string},f=function(e){function t(){var n,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var s=arguments.length,c=Array(s),a=0;a<s;a++)c[a]=arguments[a];return n=r=o(this,e.call.apply(e,[this].concat(c))),r.addTapListener=function(){var e=i.findDOMNode(r);if(e){var t=e.ownerDocument;t&&(r.tapListener=u(t.documentElement,r.handleTap))}},r.handleTap=function(e){i.findDOMNode(r).contains(e.target)||i.findDOMNode(r.props.ambManager.button).contains(e.target)||r.props.ambManager.closeMenu()},o(r,n)}return function(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)}(t,e),t.prototype.componentDidMount=function(){this.props.ambManager.menu=this},t.prototype.componentDidUpdate=function(){var e=this.props.ambManager;e.options.closeOnBlur&&(e.isOpen&&!this.tapListener?this.addTapListener():!e.isOpen&&this.tapListener&&(this.tapListener.remove(),delete this.tapListener),e.isOpen||e.clearItems())},t.prototype.componentWillUnmount=function(){this.tapListener&&this.tapListener.remove(),this.props.ambManager.destroy()},t.prototype.render=function(){var e=this.props,t=this.props.ambManager,n="function"==typeof e.children?e.children({isOpen:t.isOpen}):!!t.isOpen&&e.children;if(!n)return!1;var o={onKeyDown:t.handleMenuKey,role:"menu",tabIndex:-1};return t.options.closeOnBlur&&(o.onBlur=t.handleBlur),c(o,e,p),r.createElement(e.tag,o,n)},t}(r.Component);f.propTypes=p,f.defaultProps={tag:"div"},e.exports=a(f)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return e.displayName||e.name||("string"==typeof e&&e.length>0?e:"Unknown")}},function(e,t,n){"use strict";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}var r=n(0),i=n(2),s=n(1),u=n(3),c={ambManager:i.object.isRequired,children:i.node.isRequired,disabled:i.bool,tag:i.string},a=function(e){function t(){var n,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var i=arguments.length,s=Array(i),u=0;u<i;u++)s[u]=arguments[u];return n=r=o(this,e.call.apply(e,[this].concat(s))),r.handleKeyDown=function(e){if(!r.props.disabled){var t=r.props.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)}}},r.handleClick=function(){r.props.disabled||r.props.ambManager.toggleMenu({},{focusMenu:!1})},o(r,n)}return function(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)}(t,e),t.prototype.componentDidMount=function(){this.props.ambManager.button=this},t.prototype.componentWillUnmount=function(){this.props.ambManager.destroy()},t.prototype.render=function(){var e=this.props,t=this.props.ambManager,n={role:"button",tabIndex:e.disabled?"":"0","aria-haspopup":!0,"aria-expanded":t.isOpen,"aria-disabled":e.disabled,onKeyDown:this.handleKeyDown,onClick:this.handleClick},o={};return s(o,c),["button","fieldset","input","optgroup","option","select","textarea"].indexOf(e.tag)>=0&&delete o.disabled,t.options.closeOnBlur&&(n.onBlur=t.handleBlur),s(n,e,o),r.createElement(e.tag,n,e.children)},t}(r.Component);a.propTypes=c,a.defaultProps={tag:"span"},e.exports=u(a)},function(e,t,n){"use strict";var o=function(){};e.exports=o},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";(function(t){var n="__global_unique_id__";e.exports=function(){return t[n]=(t[n]||0)+1}}).call(this,n(13))},function(e,t,n){"use strict";t.__esModule=!0;var o=n(0),r=(s(o),s(n(2))),i=s(n(14));s(n(12));function s(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(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 a(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 p=1073741823;t.default=function(e,t){var n,s,f="__create-react-context-"+(0,i.default)()+"__",l=function(e){function n(){var t,o;u(this,n);for(var r=arguments.length,i=Array(r),s=0;s<r;s++)i[s]=arguments[s];return t=o=c(this,e.call.apply(e,[this].concat(i))),o.emitter=function(e){var t=[];return{on:function(e){t.push(e)},off:function(e){t=t.filter(function(t){return t!==e})},get:function(){return e},set:function(n,o){e=n,t.forEach(function(t){return t(e,o)})}}}(o.props.value),c(o,t)}return a(n,e),n.prototype.getChildContext=function(){var e;return(e={})[f]=this.emitter,e},n.prototype.componentWillReceiveProps=function(e){if(this.props.value!==e.value){var n=this.props.value,o=e.value,r=void 0;!function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}(n,o)?(r="function"==typeof t?t(n,o):p,0!=(r|=0)&&this.emitter.set(e.value,r)):r=0}},n.prototype.render=function(){return this.props.children},n}(o.Component);l.childContextTypes=((n={})[f]=r.default.object.isRequired,n);var h=function(t){function n(){var e,o;u(this,n);for(var r=arguments.length,i=Array(r),s=0;s<r;s++)i[s]=arguments[s];return e=o=c(this,t.call.apply(t,[this].concat(i))),o.state={value:o.getValue()},o.onUpdate=function(e,t){0!=((0|o.observedBits)&t)&&o.setState({value:o.getValue()})},c(o,e)}return a(n,t),n.prototype.componentWillReceiveProps=function(e){var t=e.observedBits;this.observedBits=void 0===t||null===t?p:t},n.prototype.componentDidMount=function(){this.context[f]&&this.context[f].on(this.onUpdate);var e=this.props.observedBits;this.observedBits=void 0===e||null===e?p:e},n.prototype.componentWillUnmount=function(){this.context[f]&&this.context[f].off(this.onUpdate)},n.prototype.getValue=function(){return this.context[f]?this.context[f].get():e},n.prototype.render=function(){return function(e){return Array.isArray(e)?e[0]:e}(this.props.children)(this.state.value)},n}(o.Component);return h.contextTypes=((s={})[f]=r.default.object,s),{Provider:l,Consumer:h}},e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var o=i(n(0)),r=i(n(15));function i(e){return e&&e.__esModule?e:{default:e}}t.default=o.default.createContext||r.default,e.exports=t.default},function(e,t){function n(e){var t,n,o=(e=e||{}).keybindings||{};for(t in this._settings={keybindings:{next:o.next||{keyCode:40},prev:o.prev||{keyCode:38},first:o.first,last:o.last},wrap:e.wrap,stringSearch:e.stringSearch,stringSearchDelay:800},this._keybindingsLookup=[],this._settings.keybindings)(n=this._settings.keybindings[t])&&[].concat(n).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:t,eventMatcher:e})}.bind(this));this._searchString="",this._members=[],e.members&&this.setMembers(e.members),this._boundHandleKeydownEvent=this._handleKeydownEvent.bind(this)}function o(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(function(e,t){for(var n in e)if(void 0!==t[n]&&e[n]!==t[n])return!1;return!0}(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(!function(e){return e>=65&&e<=90}(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]).text&&0===t.text.indexOf(e))return o(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&&o(t.node),this},n.prototype.addMember=function(e,t){var n=e.node||e,o=e.text||n.getAttribute("data-focus-group-text")||n.textContent||"";this._checkNode(n);var r={node:n,text:o.replace(/[\W_]/g,"").toLowerCase()};return null!==t&&void 0!==t?this._members.splice(t,0,r):this._members.push(r),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";var o=n(5),r=n(17),i=n(6),s={wrap:!0,stringSearch:!0},u={init:function(e){this.options=e||{},void 0===this.options.closeOnSelection&&(this.options.closeOnSelection=!0),void 0===this.options.closeOnBlur&&(this.options.closeOnBlur=!0),this.options.id&&i.registerManager(this.options.id,this),this.handleBlur=function(){var e=this;e.blurTimer=setTimeout(function(){var t=o.findDOMNode(e.button);if(t){var n=t.ownerDocument.activeElement;if(!t||n!==t){var r=o.findDOMNode(e.menu);r!==n?r&&r.contains(n)||e.isOpen&&e.closeMenu({focusButton:!1}):e.focusItem(0)}}},0)}.bind(this),this.handleSelection=function(e,t){this.options.closeOnSelection&&this.closeMenu({focusButton:!0});this.options.onSelection&&this.options.onSelection(e,t)}.bind(this),this.handleMenuKey=function(e){if(this.isOpen)switch(e.key){case"Escape":e.preventDefault(),this.closeMenu({focusButton:!0});break;case"Home":e.preventDefault(),this.focusGroup.moveFocusToFirst();break;case"End":e.preventDefault(),this.focusGroup.moveFocusToLast()}}.bind(this),this.focusGroup=r(s),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&&(void 0===(e=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&&o.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(u);return t.init(e),t}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";var o=function(e){};e.exports=function(e,t,n,r,i,s,u,c){if(o(t),!e){var a;if(void 0===t)a=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var p=[n,r,i,s,u,c],f=0;(a=new Error(t.replace(/%s/g,function(){return p[f++]}))).name="Invariant Violation"}throw a.framesToPop=1,a}}},function(e,t,n){"use strict";function o(e){return function(){return e}}var r=function(){};r.thatReturns=o,r.thatReturnsFalse=o(!1),r.thatReturnsTrue=o(!0),r.thatReturnsNull=o(null),r.thatReturnsThis=function(){return this},r.thatReturnsArgument=function(e){return e},e.exports=r},function(e,t,n){"use strict";var o=n(21),r=n(20),i=n(19);e.exports=function(){function e(e,t,n,o,s,u){u!==i&&r(!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,exact:t};return n.checkPropTypes=o,n.PropTypes=n,n}},function(e,t,n){"use strict";var o=n(0),r=n(2),i=n(18),s=n(4),u=n(1),c={children:r.node.isRequired,onMenuToggle:r.func,onSelection:r.func,closeOnSelection:r.bool,closeOnBlur:r.bool,tag:r.string},a=function(e){function t(n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(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}(this,e.call(this,n));return o.manager=i({onMenuToggle:o.props.onMenuToggle,onSelection:o.props.onSelection,closeOnSelection:o.props.closeOnSelection,closeOnBlur:o.props.closeOnBlur,id:o.props.id}),o}return function(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)}(t,e),t.prototype.render=function(){var e={};return u(e,this.props,c),o.createElement(s.Provider,{value:this.manager},o.createElement(this.props.tag,e,this.props.children))},t}(o.Component);a.propTypes=c,a.defaultProps={tag:"div"},e.exports=a},function(e,t,n){"use strict";var o=n(6);e.exports={Wrapper:n(23),Button:n(11),Menu:n(9),MenuItem:n(7),openMenu:o.openMenu,closeMenu:o.closeMenu}}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.ReactAriaMenuButton=t(require("react")):e.ReactAriaMenuButton=t(e.React)}(window,function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=17)}([function(e,t,n){e.exports=n(15)()},function(t,n){t.exports=e},function(e,t,n){"use strict";e.exports=function(e,t,n){for(var r in n=n||{},t)t.hasOwnProperty(r)&&(n[r]||(e[r]=t[r]))}},function(e,t,n){"use strict";var r=n(0);e.exports={refType:r.oneOfType([r.func,r.shape({current:r.elementType})])}},function(e,t,n){"use strict";var r=n(1).createContext();e.exports=r},function(e,t,n){"use strict";var r={},o="a menu outside a mounted Wrapper with an id, or a menu that does not exist";e.exports={registerManager:function(e,t){r[e]=t},unregisterManager:function(e){delete r[e]},openMenu:function(e,t){var n=r[e];if(!n)throw new Error("Cannot open "+o);n.openMenu(t)},closeMenu:function(e,t){var n=r[e];if(!n)throw new Error("Cannot close "+o);n.closeMenu(t)}}},function(e,t,n){"use strict";function r(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}var o=n(1),i=n(0),s=n(4),a=n(3).refType,u=n(2),c={ambManager:i.object.isRequired,children:i.node.isRequired,forwardedRef:a,tag:i.string,text:i.string,value:i.any},f=function(e){function t(){var n,i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var s=arguments.length,a=Array(s),u=0;u<s;u++)a[u]=arguments[u];return n=i=r(this,e.call.apply(e,[this].concat(a))),i.ref=o.createRef(),i.handleKeyDown=function(e){"Enter"!==e.key&&" "!==e.key||"a"===i.props.tag&&i.props.href||(e.preventDefault(),i.selectItem(e))},i.selectItem=function(e){var t=void 0!==i.props.value?i.props.value:i.props.children;i.props.ambManager.handleSelection(t,e)},i.setRef=function(e){i.ref.current=e,"function"==typeof i.props.forwardedRef?i.props.forwardedRef(e):i.props.forwardedRef&&(i.props.forwardedRef.current=e)},r(i,n)}return function(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)}(t,e),t.prototype.componentDidMount=function(){this.props.ambManager.addItem({node:this.ref.current,text:this.props.text})},t.prototype.render=function(){var e={onClick:this.selectItem,onKeyDown:this.handleKeyDown,role:"menuitem",tabIndex:"-1",ref:this.setRef};return u(e,this.props,c),o.createElement(this.props.tag,e,this.props.children)},t}(o.Component);f.propTypes=c,f.defaultProps={tag:"div"},e.exports=o.forwardRef(function(e,t){return o.createElement(s.Consumer,null,function(n){var r={ambManager:n,forwardedRef:t};return u(r,e,{ambManager:c.ambManager,children:c.children,forwardedRef:c.forwardedRef}),o.createElement(f,r,e.children)})})},function(e,t){e.exports=function(e,t,n){var r=0,o=0,i=!1,s=!1,a=!1;function u(e){a||t(e)}function c(t){a=!0,i||(i=!0,e.addEventListener("touchmove",f,n),e.addEventListener("touchend",p,n),e.addEventListener("touchcancel",l,n),s=!1,r=t.touches[0].clientX,o=t.touches[0].clientY)}function f(e){s||Math.abs(e.touches[0].clientX-r)<=10&&Math.abs(e.touches[0].clientY-o)<=10||(s=!0)}function p(e){i=!1,d(),s||t(e)}function l(){i=!1,s=!1,r=0,o=0}function d(){e.removeEventListener("touchmove",f,n),e.removeEventListener("touchend",p,n),e.removeEventListener("touchcancel",l,n)}return e.addEventListener("click",u,n),e.addEventListener("touchstart",c,n),{remove:function(){e.removeEventListener("click",u,n),e.removeEventListener("touchstart",c,n),d()}}}},function(e,t,n){"use strict";function r(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}var o=n(1),i=n(0),s=n(7),a=n(4),u=n(3).refType,c=n(2),f={ambManager:i.object.isRequired,children:i.oneOfType([i.func,i.node]).isRequired,forwardedRef:u,tag:i.string},p=function(e){function t(){var n,i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var a=arguments.length,u=Array(a),c=0;c<a;c++)u[c]=arguments[c];return n=i=r(this,e.call.apply(e,[this].concat(u))),i.ref=o.createRef(),i.addTapListener=function(){var e=i.ref.current;if(e){var t=e.ownerDocument;t&&(i.tapListener=s(t.documentElement,i.handleTap))}},i.handleTap=function(e){i.ref.current.contains(e.target)||i.props.ambManager.button.ref.current.contains(e.target)||i.props.ambManager.closeMenu()},i.setRef=function(e){i.ref.current=e,"function"==typeof i.props.forwardedRef?i.props.forwardedRef(e):i.props.forwardedRef&&(i.props.forwardedRef.current=e)},r(i,n)}return function(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)}(t,e),t.prototype.componentDidMount=function(){this.props.ambManager.menu=this},t.prototype.componentDidUpdate=function(){var e=this.props.ambManager;e.options.closeOnBlur&&(e.isOpen&&!this.tapListener?this.addTapListener():!e.isOpen&&this.tapListener&&(this.tapListener.remove(),delete this.tapListener),e.isOpen||e.clearItems())},t.prototype.componentWillUnmount=function(){this.tapListener&&this.tapListener.remove(),this.props.ambManager.destroy()},t.prototype.render=function(){var e=this.props,t=this.props.ambManager,n="function"==typeof e.children?e.children({isOpen:t.isOpen}):!!t.isOpen&&e.children;if(!n)return!1;var r={onKeyDown:t.handleMenuKey,role:"menu",tabIndex:-1};return t.options.closeOnBlur&&(r.onBlur=t.handleBlur),c(r,e,f),c(r,{ref:this.setRef}),o.createElement(e.tag,r,n)},t}(o.Component);p.propTypes=f,p.defaultProps={tag:"div"},e.exports=o.forwardRef(function(e,t){return o.createElement(a.Consumer,null,function(n){var r={ambManager:n,forwardedRef:t};return c(r,e,{ambManager:f.ambManager,children:f.children,forwardedRef:f.forwardedRef}),o.createElement(p,r,e.children)})})},function(e,t,n){"use strict";function r(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}var o=n(1),i=n(0),s=n(4),a=n(3).refType,u=n(2),c={ambManager:i.object.isRequired,children:i.node.isRequired,disabled:i.bool,forwardedRef:a,tag:i.string},f=function(e){function t(){var n,i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var s=arguments.length,a=Array(s),u=0;u<s;u++)a[u]=arguments[u];return n=i=r(this,e.call.apply(e,[this].concat(a))),i.ref=o.createRef(),i.handleKeyDown=function(e){if(!i.props.disabled){var t=i.props.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.props.ambManager.toggleMenu({},{focusMenu:!1})},i.setRef=function(e){i.ref.current=e,"function"==typeof i.props.forwardedRef?i.props.forwardedRef(e):i.props.forwardedRef&&(i.props.forwardedRef.current=e)},r(i,n)}return function(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)}(t,e),t.prototype.componentDidMount=function(){this.props.ambManager.button=this},t.prototype.componentWillUnmount=function(){this.props.ambManager.destroy()},t.prototype.render=function(){var e=this.props,t=this.props.ambManager,n={role:"button",tabIndex:e.disabled?"":"0","aria-haspopup":!0,"aria-expanded":t.isOpen,"aria-disabled":e.disabled,onKeyDown:this.handleKeyDown,onClick:this.handleClick},r={};return u(r,c),["button","fieldset","input","optgroup","option","select","textarea"].indexOf(e.tag)>=0&&delete r.disabled,t.options.closeOnBlur&&(n.onBlur=t.handleBlur),u(n,e,r),u(n,{ref:this.setRef}),o.createElement(e.tag,n,e.children)},t}(o.Component);f.propTypes=c,f.defaultProps={tag:"span"},e.exports=o.forwardRef(function(e,t){return o.createElement(s.Consumer,null,function(n){var r={ambManager:n,forwardedRef:t};return u(r,e,{ambManager:c.ambManager,children:c.children,forwardedRef:c.forwardedRef}),o.createElement(f,r,e.children)})})},function(e,t){function n(e){var t,n,r=(e=e||{}).keybindings||{};for(t in this._settings={keybindings:{next:r.next||{keyCode:40},prev:r.prev||{keyCode:38},first:r.first,last:r.last},wrap:e.wrap,stringSearch:e.stringSearch,stringSearchDelay:800},this._keybindingsLookup=[],this._settings.keybindings)(n=this._settings.keybindings[t])&&[].concat(n).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:t,eventMatcher:e})}.bind(this));this._searchString="",this._members=[],e.members&&this.setMembers(e.members),this._boundHandleKeydownEvent=this._handleKeydownEvent.bind(this)}function r(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(function(e,t){for(var n in e)if(void 0!==t[n]&&e[n]!==t[n])return!1;return!0}(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(!function(e){return e>=65&&e<=90}(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,o=this._members.length;n<o;n++)if((t=this._members[n]).text&&0===t.text.indexOf(e))return r(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&&r(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={node:n,text:r.replace(/[\W_]/g,"").toLowerCase()};return null!==t&&void 0!==t?this._members.splice(t,0,o):this._members.push(o),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";var r=n(10),o=n(5),i={wrap:!0,stringSearch:!0},s={init:function(e){this.options=e||{},void 0===this.options.closeOnSelection&&(this.options.closeOnSelection=!0),void 0===this.options.closeOnBlur&&(this.options.closeOnBlur=!0),this.options.id&&o.registerManager(this.options.id,this),this.handleBlur=function(){var e=this;e.blurTimer=setTimeout(function(){var t=e.button.ref.current;if(t){var n=t.ownerDocument.activeElement;if(!t||n!==t){var r=e.menu.ref.current;r!==n?r&&r.contains(n)||e.isOpen&&e.closeMenu({focusButton:!1}):e.focusItem(0)}}},0)}.bind(this),this.handleSelection=function(e,t){this.options.closeOnSelection&&this.closeMenu({focusButton:!0});this.options.onSelection&&this.options.onSelection(e,t)}.bind(this),this.handleMenuKey=function(e){if(this.isOpen)switch(e.key){case"Escape":e.preventDefault(),this.closeMenu({focusButton:!0});break;case"Home":e.preventDefault(),this.focusGroup.moveFocusToFirst();break;case"End":e.preventDefault(),this.focusGroup.moveFocusToLast()}}.bind(this),this.focusGroup=r(i),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&&(void 0===(e=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&&this.button.ref.current.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(s);return t.init(e),t}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";var r=function(e){};e.exports=function(e,t,n,o,i,s,a,u){if(r(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,o,i,s,a,u],p=0;(c=new Error(t.replace(/%s/g,function(){return f[p++]}))).name="Invariant Violation"}throw c.framesToPop=1,c}}},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";var r=n(14),o=n(13),i=n(12);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,exact:t};return n.checkPropTypes=r,n.PropTypes=n,n}},function(e,t,n){"use strict";var r=n(1),o=n(0),i=n(11),s=n(4),a=n(3).refType,u=n(2),c={children:o.node.isRequired,forwardedRef:a,onMenuToggle:o.func,onSelection:o.func,closeOnSelection:o.bool,closeOnBlur:o.bool,tag:o.string},f=function(e){function t(n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(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}(this,e.call(this,n));return r.manager=i({onMenuToggle:r.props.onMenuToggle,onSelection:r.props.onSelection,closeOnSelection:r.props.closeOnSelection,closeOnBlur:r.props.closeOnBlur,id:r.props.id}),r}return function(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)}(t,e),t.prototype.render=function(){var e={};return u(e,this.props,c),r.createElement(s.Provider,{value:this.manager},r.createElement(this.props.tag,e,this.props.children))},t}(r.Component);f.propTypes=c,f.defaultProps={tag:"div"},e.exports=r.forwardRef(function(e,t){var n={forwardedRef:t};return u(n,e,{children:c.children,forwardedRef:c.forwardedRef}),u(n,{forwardedRef:t}),r.createElement(f,n,e.children)})},function(e,t,n){"use strict";var r=n(5);e.exports={Wrapper:n(16),Button:n(9),Menu:n(8),MenuItem:n(6),openMenu:r.openMenu,closeMenu:r.closeMenu}}])}); |
@@ -26,10 +26,2 @@ const path = require("path"); | ||
}, | ||
{ | ||
"react-dom": { | ||
root: "ReactDOM", | ||
commonjs2: "react-dom", | ||
commonjs: "react-dom", | ||
amd: "react-dom" | ||
} | ||
} | ||
], | ||
@@ -36,0 +28,0 @@ module: { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 2 instances in 1 package
4
1679
0
108532
383
- Removedcreate-react-context@^0.3.0
- Removedreact-display-name@^0.2.4
- Removedcreate-react-context@0.3.0(transitive)
- Removedgud@1.0.0(transitive)
- Removedreact-display-name@0.2.5(transitive)
- Removedreact-dom@16.14.0(transitive)
- Removedscheduler@0.19.1(transitive)
- Removedwarning@4.0.3(transitive)