All checks were successful
Publish To Prod / deploy_and_publish (push) Successful in 35s
1 line
19 KiB
JavaScript
1 line
19 KiB
JavaScript
!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.updateOptions(e),this.handleBlur=function(){var e=this;e.blurTimer=setTimeout(function(){if(e.button){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},updateOptions:function(e){var t=this.options;this.options=e||this.options||{},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),t&&t.id&&t.id!==this.options.id&&o.unregisterManager(this.options.id,this)},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){return{onMenuToggle:e.onMenuToggle,onSelection:e.onSelection,closeOnSelection:e.closeOnSelection,closeOnBlur:e.closeOnBlur,id:e.id}},p=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(f(n)),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.componentDidUpdate=function(){this.manager.updateOptions(f(this.props))},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);p.propTypes=c,p.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(p,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}}])}); |