123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341 |
- (function webpackUniversalModuleDefinition(root, factory) {
- if(typeof exports === 'object' && typeof module === 'object')
- module.exports = factory(require("./foundation.core"), require("jquery"));
- else if(typeof define === 'function' && define.amd)
- define(["./foundation.core", "jquery"], factory);
- else if(typeof exports === 'object')
- exports["foundation.util.keyboard"] = factory(require("./foundation.core"), require("jquery"));
- else
- root["__FOUNDATION_EXTERNAL__"] = root["__FOUNDATION_EXTERNAL__"] || {}, root["__FOUNDATION_EXTERNAL__"]["foundation.util.keyboard"] = factory(root["__FOUNDATION_EXTERNAL__"]["foundation.core"], root["jQuery"]);
- })(window, function(__WEBPACK_EXTERNAL_MODULE__foundation_core__, __WEBPACK_EXTERNAL_MODULE_jquery__) {
- return (function(modules) {
-
- var installedModules = {};
-
- function __webpack_require__(moduleId) {
-
- if(installedModules[moduleId]) {
- return installedModules[moduleId].exports;
- }
-
- var module = installedModules[moduleId] = {
- i: moduleId,
- l: false,
- exports: {}
- };
-
- modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
-
- module.l = true;
-
- return module.exports;
- }
-
- __webpack_require__.m = modules;
-
- __webpack_require__.c = installedModules;
-
- __webpack_require__.d = function(exports, name, getter) {
- if(!__webpack_require__.o(exports, name)) {
- Object.defineProperty(exports, name, { enumerable: true, get: getter });
- }
- };
-
- __webpack_require__.r = function(exports) {
- if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
- }
- Object.defineProperty(exports, '__esModule', { value: true });
- };
-
-
-
-
-
- __webpack_require__.t = function(value, mode) {
- if(mode & 1) value = __webpack_require__(value);
- if(mode & 8) return value;
- if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
- var ns = Object.create(null);
- __webpack_require__.r(ns);
- Object.defineProperty(ns, 'default', { enumerable: true, value: value });
- if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
- return ns;
- };
-
- __webpack_require__.n = function(module) {
- var getter = module && module.__esModule ?
- function getDefault() { return module['default']; } :
- function getModuleExports() { return module; };
- __webpack_require__.d(getter, 'a', getter);
- return getter;
- };
-
- __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
-
- __webpack_require__.p = "";
-
- return __webpack_require__(__webpack_require__.s = 23);
- })
- ({
- "./foundation.core":
- (function(module, exports) {
- module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_core__;
- }),
- "./js/entries/plugins/foundation.util.keyboard.js":
- (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- var _foundation_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( "./foundation.core");
- var _foundation_core__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(_foundation_core__WEBPACK_IMPORTED_MODULE_0__);
- __webpack_require__.d(__webpack_exports__, "Foundation", function() { return _foundation_core__WEBPACK_IMPORTED_MODULE_0__["Foundation"]; });
- var _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( "./js/foundation.util.keyboard.js");
- __webpack_require__.d(__webpack_exports__, "Keyboard", function() { return _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_1__["Keyboard"]; });
- _foundation_core__WEBPACK_IMPORTED_MODULE_0__["Foundation"].Keyboard = _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_1__["Keyboard"];
- }),
- "./js/foundation.util.keyboard.js":
- (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- __webpack_require__.d(__webpack_exports__, "Keyboard", function() { return Keyboard; });
- var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( "jquery");
- var jquery__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
- var _foundation_core_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( "./foundation.core");
- var _foundation_core_utils__WEBPACK_IMPORTED_MODULE_1___default = __webpack_require__.n(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_1__);
- var keyCodes = {
- 9: 'TAB',
- 13: 'ENTER',
- 27: 'ESCAPE',
- 32: 'SPACE',
- 35: 'END',
- 36: 'HOME',
- 37: 'ARROW_LEFT',
- 38: 'ARROW_UP',
- 39: 'ARROW_RIGHT',
- 40: 'ARROW_DOWN'
- };
- var commands = {};
- function findFocusable($element) {
- if (!$element) {
- return false;
- }
- return $element.find('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, *[tabindex], *[contenteditable]').filter(function () {
- if (!jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).is(':visible') || jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).attr('tabindex') < 0) {
- return false;
- }
- return true;
- });
- }
- function parseKey(event) {
- var key = keyCodes[event.which || event.keyCode] || String.fromCharCode(event.which).toUpperCase();
- key = key.replace(/\W+/, '');
- if (event.shiftKey) key = "SHIFT_".concat(key);
- if (event.ctrlKey) key = "CTRL_".concat(key);
- if (event.altKey) key = "ALT_".concat(key);
- key = key.replace(/_$/, '');
- return key;
- }
- var Keyboard = {
- keys: getKeyCodes(keyCodes),
-
- parseKey: parseKey,
-
- handleKey: function handleKey(event, component, functions) {
- var commandList = commands[component],
- keyCode = this.parseKey(event),
- cmds,
- command,
- fn;
- if (!commandList) return console.warn('Component not defined!');
- if (event.zfIsKeyHandled === true) return;
- if (typeof commandList.ltr === 'undefined') {
- cmds = commandList;
- } else {
-
- if (Object(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_1__["rtl"])()) cmds = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.extend({}, commandList.ltr, commandList.rtl);else cmds = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.extend({}, commandList.rtl, commandList.ltr);
- }
- command = cmds[keyCode];
- fn = functions[command];
- if (fn && typeof fn === 'function') {
- var returnValue = fn.apply();
- event.zfIsKeyHandled = true;
- if (functions.handled || typeof functions.handled === 'function') {
- functions.handled(returnValue);
- }
- } else {
-
- if (functions.unhandled || typeof functions.unhandled === 'function') {
- functions.unhandled();
- }
- }
- },
-
- findFocusable: findFocusable,
-
- register: function register(componentName, cmds) {
- commands[componentName] = cmds;
- },
-
-
-
- trapFocus: function trapFocus($element) {
- var $focusable = findFocusable($element),
- $firstFocusable = $focusable.eq(0),
- $lastFocusable = $focusable.eq(-1);
- $element.on('keydown.zf.trapfocus', function (event) {
- if (event.target === $lastFocusable[0] && parseKey(event) === 'TAB') {
- event.preventDefault();
- $firstFocusable.focus();
- } else if (event.target === $firstFocusable[0] && parseKey(event) === 'SHIFT_TAB') {
- event.preventDefault();
- $lastFocusable.focus();
- }
- });
- },
-
- releaseFocus: function releaseFocus($element) {
- $element.off('keydown.zf.trapfocus');
- }
- };
- function getKeyCodes(kcs) {
- var k = {};
- for (var kc in kcs) {
- k[kcs[kc]] = kcs[kc];
- }
- return k;
- }
- }),
- 23:
- (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__("./js/entries/plugins/foundation.util.keyboard.js");
- }),
- "jquery":
- (function(module, exports) {
- module.exports = __WEBPACK_EXTERNAL_MODULE_jquery__;
- })
- });
- });
|