foundation-sites
Version:
The most advanced responsive front-end framework in the world.
3 lines (2 loc) • 3.36 kB
JavaScript
((e,t)=>{"object"==typeof exports&&"object"==typeof module?module.exports=t(require("./foundation.core"),require("jquery")):"function"==typeof define&&define.amd?define(["./foundation.core","jquery"],t):"object"==typeof exports?exports.__FOUNDATION_EXTERNAL__=t(require("./foundation.core"),require("jquery")):(e.__FOUNDATION_EXTERNAL__=e.__FOUNDATION_EXTERNAL__||{},e.__FOUNDATION_EXTERNAL__["foundation.util.keyboard"]=t(e.__FOUNDATION_EXTERNAL__["foundation.core"],e.jQuery))})(self,function(t,n){return r={"./js/foundation.util.keyboard.js":function(e,t,n){n.r(t),n.d(t,{Keyboard:function(){return f}});var t=n("jquery"),r=n.n(t),a=n("./foundation.core"),o={9:"TAB",13:"ENTER",27:"ESCAPE",32:"SPACE",35:"END",36:"HOME",37:"ARROW_LEFT",38:"ARROW_UP",39:"ARROW_RIGHT",40:"ARROW_DOWN"},i={};function u(e){return!!e&&e.find("a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, *[tabindex], *[contenteditable]").filter(function(){return!(!r()(this).is(":visible")||r()(this).attr("tabindex")<0)}).sort(function(e,t){var n,o;return r()(e).attr("tabindex")===r()(t).attr("tabindex")?0:(n=parseInt(r()(e).attr("tabindex"),10),o=parseInt(r()(t).attr("tabindex"),10),void 0===r()(e).attr("tabindex")&&0<o?1:void 0===r()(t).attr("tabindex")&&0<n?-1:0===n&&0<o?1:0===o&&0<n||n<o?-1:o<n?1:void 0)})}function d(e){var t=(t=o[e.which||e.keyCode]||String.fromCharCode(e.which).toUpperCase()).replace(/\W+/,"");return e.shiftKey&&(t="SHIFT_".concat(t)),e.ctrlKey&&(t="CTRL_".concat(t)),t=(t=e.altKey?"ALT_".concat(t):t).replace(/_$/,"")}var f={keys:(e=>{var t,n={};for(t in e)e.hasOwnProperty(t)&&(n[e[t]]=e[t]);return n})(o),parseKey:d,handleKey:function(e,t,n){var t=i[t],o=this.parseKey(e);if(!t)return console.warn("Component not defined!");!0!==e.zfIsKeyHandled&&((t=n[(void 0===t.ltr?t:(0,a.rtl)()?r().extend({},t.ltr,t.rtl):r().extend({},t.rtl,t.ltr))[o]])&&"function"==typeof t?(o=t.apply(),e.zfIsKeyHandled=!0,!n.handled&&"function"!=typeof n.handled||n.handled(o)):!n.unhandled&&"function"!=typeof n.unhandled||n.unhandled())},findFocusable:u,register:function(e,t){i[e]=t},trapFocus:function(e){var t=u(e),n=t.eq(0),o=t.eq(-1);e.on("keydown.zf.trapfocus",function(e){e.target===o[0]&&"TAB"===d(e)?(e.preventDefault(),n.focus()):e.target===n[0]&&"SHIFT_TAB"===d(e)&&(e.preventDefault(),o.focus())})},releaseFocus:function(e){e.off("keydown.zf.trapfocus")}}},"./foundation.core":function(e){e.exports=t},jquery:function(e){e.exports=n}},a={},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,{a:t}),t},o.d=function(e,t){for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},u={},(o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})})(u),o.d(u,{Foundation:function(){return e.Foundation},Keyboard:function(){return i.Keyboard}}),e=o("./foundation.core"),i=o("./js/foundation.util.keyboard.js"),e.Foundation.Keyboard=i.Keyboard,u;function o(e){var t=a[e];return void 0!==t||(t=a[e]={exports:{}},r[e](t,t.exports,o)),t.exports}var r,a,e,i,u});
//# sourceMappingURL=foundation.util.keyboard.min.js.map