diff --git a/docs/core/makeup-expander/index.js b/docs/core/makeup-expander/index.js
index ab9fc8dc..ed962d4d 100644
--- a/docs/core/makeup-expander/index.js
+++ b/docs/core/makeup-expander/index.js
@@ -30,7 +30,7 @@ hoverAndFocusExpanderEls.forEach(function (el) {
stealthExpanderEls.forEach(function (el) {
expanderWidgets.push(
new Expander(el, {
- ollapseOnClickOut: true,
+ collapseOnClickOut: true,
collapseOnFocusOut: true,
expandOnClick: true,
focusManagement: "focusable",
diff --git a/docs/core/makeup-expander/index.min.js b/docs/core/makeup-expander/index.min.js
index c9862629..f0eba480 100644
--- a/docs/core/makeup-expander/index.min.js
+++ b/docs/core/makeup-expander/index.min.js
@@ -107,7 +107,7 @@ const defaultOptions = {
collapseOnFocusOut: false,
collapseOnMouseOut: false,
collapseOnClickOut: false,
- collapseOnHostFocus: false,
+ collapseOnHostReFocus: false,
contentSelector: ".expander__content",
expandedClass: null,
expandOnClick: false,
@@ -133,18 +133,27 @@ function onHostMouseDown() {
function onHostClick() {
this._expandWasKeyboardClickActivated = this._keyboardClickFlag;
this._expandWasMouseClickActivated = this._mouseClickFlag;
+ this._widgetHasKeyboardFocus = this._keyboardClickFlag;
this.expanded = !this.expanded;
}
function onHostFocus() {
this._expandWasFocusActivated = true;
this.expanded = true;
}
+
+// NOTE: collapseOnHostReFocus cannot be used when expandOnFocus is true
+function onHostReFocus() {
+ if (this.expanded && this._widgetHasKeyboardFocus) {
+ this.expanded = false;
+ }
+}
function onHostHover() {
clearTimeout(this._mouseLeft);
this._expandWasHoverActivated = true;
this.expanded = true;
}
function onFocusExit() {
+ this._widgetHasKeyboardFocus = false;
this.expanded = false;
}
function onMouseLeave() {
@@ -204,6 +213,7 @@ class _default {
this._documentTouchEndListener = _onDocumentTouchEnd.bind(this);
this._hostClickListener = onHostClick.bind(this);
this._hostFocusListener = onHostFocus.bind(this);
+ this._hostReFocusListener = onHostReFocus.bind(this);
this._hostHoverListener = onHostHover.bind(this);
this._focusExitListener = onFocusExit.bind(this);
this._mouseLeaveListener = onMouseLeave.bind(this);
@@ -219,7 +229,7 @@ class _default {
this.expandOnClick = this.options.expandOnClick;
this.expandOnFocus = this.options.expandOnFocus;
this.expandOnHover = this.options.expandOnHover;
- this.collapseOnHostFocus = this.options.collapseOnHostFocus;
+ this.collapseOnHostReFocus = this.options.collapseOnHostReFocus;
if (this.options.autoCollapse === false) {
this.collapseOnClickOut = this.options.collapseOnClickOut;
this.collapseOnFocusOut = this.options.collapseOnFocusOut;
@@ -252,6 +262,13 @@ class _default {
this.hostEl.removeEventListener("focus", this._hostFocusListener);
}
}
+ set collapseOnHostReFocus(bool) {
+ if (bool === true) {
+ this.hostEl.addEventListener("focus", this._hostReFocusListener);
+ } else {
+ this.hostEl.removeEventListener("focus", this._hostReFocusListener);
+ }
+ }
set expandOnHover(bool) {
if (bool === true) {
this.hostEl.addEventListener("mouseenter", this._hostHoverListener);
@@ -284,13 +301,6 @@ class _default {
this.el.removeEventListener("focusExit", this._focusExitListener);
}
}
- set collapseOnHostFocus(bool) {
- if (bool === true) {
- this.contentEl.addEventListener("focusExit", this._focusExitListener);
- } else {
- this.contentEl.removeEventListener("focusExit", this._focusExitListener);
- }
- }
set collapseOnMouseOut(bool) {
if (bool === true) {
this.el.addEventListener("mouseleave", this._mouseLeaveListener);
@@ -342,6 +352,7 @@ class _default {
this.collapseOnClickOut = false;
this.collapseOnFocusOut = false;
this.collapseOnMouseOut = false;
+ this.collapseOnHostReFocus = false;
}
}
destroy() {
@@ -355,9 +366,11 @@ class _default {
this._documentTouchEndListener = null;
this._hostClickListener = null;
this._hostFocusListener = null;
+ this._hostReFocusListener = null;
this._hostHoverListener = null;
this._focusExitListener = null;
this._mouseLeaveListener = null;
+ this._widgetHasKeyboardFocus = null;
}
}
exports["default"] = _default;
@@ -527,7 +540,7 @@ hoverAndFocusExpanderEls.forEach(function (el) {
});
stealthExpanderEls.forEach(function (el) {
expanderWidgets.push(new _makeupExpander.default(el, {
- ollapseOnClickOut: true,
+ collapseOnClickOut: true,
collapseOnFocusOut: true,
expandOnClick: true,
focusManagement: "focusable"
diff --git a/docs/core/makeup-expander/index.min.js.map b/docs/core/makeup-expander/index.min.js.map
index 51fd3a90..9690598e 100644
--- a/docs/core/makeup-expander/index.min.js.map
+++ b/docs/core/makeup-expander/index.min.js.map
@@ -1 +1 @@
-{"version":3,"file":"makeup-expander/index.min.js","mappings":";;;;;;;AAAa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,oBAAoB;AACpB,uBAAuB;AACvB,2CAA2C,mBAAO,CAAC,GAAgB;AACnE,qCAAqC,iCAAiC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC3Ea;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf,2CAA2C,mBAAO,CAAC,GAAgB;AACnE,0CAA0C,mBAAO,CAAC,GAAqB;AACvE,+CAA+C,mBAAO,CAAC,GAAmB;AAC1E,uCAAuC,+CAA+C,0CAA0C,kDAAkD,mBAAmB;AACrM,yCAAyC,uCAAuC,2EAA2E,cAAc,qCAAqC,oCAAoC,UAAU,iBAAiB,gEAAgE,0CAA0C,8BAA8B,0DAA0D,wEAAwE;AACvhB,qCAAqC,iCAAiC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC;AACA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAe;;;;;;;;AChRF;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;;;;;;;ACnCa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAkB,UAAU;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;UCvCA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;ACtBa;;AAEb,6CAA6C,mBAAO,CAAC,GAAiB;AACtE,qCAAqC,iCAAiC;AACtE;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA,GAAG;AACH,CAAC;AACD;AACA;AACA;AACA;AACA,GAAG;AACH,CAAC;AACD;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,CAAC;AACD;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH,CAAC,E","sources":["webpack://root/./packages/core/makeup-exit-emitter/dist/cjs/index.js","webpack://root/./packages/core/makeup-expander/dist/cjs/index.js","webpack://root/./packages/core/makeup-focusables/dist/cjs/index.js","webpack://root/./packages/core/makeup-next-id/dist/cjs/index.js","webpack://root/webpack/bootstrap","webpack://root/./docs/core/makeup-expander/index.compiled.js"],"sourcesContent":["\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.addFocusExit = addFocusExit;\nexports.removeFocusExit = removeFocusExit;\nvar _makeupNextId = _interopRequireDefault(require(\"makeup-next-id\"));\nfunction _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }\nconst focusExitEmitters = {};\nfunction doFocusExit(el, fromElement, toElement) {\n el.dispatchEvent(new CustomEvent(\"focusExit\", {\n detail: {\n fromElement,\n toElement\n },\n bubbles: false // mirror the native mouseleave event\n }));\n}\nfunction onDocumentFocusIn(e) {\n const newFocusElement = e.target;\n const targetIsDescendant = this.el.contains(newFocusElement);\n\n // if focus has moved to a focusable descendant\n if (targetIsDescendant === true) {\n // set the target as the currently focussed element\n this.currentFocusElement = newFocusElement;\n } else {\n // else focus has not gone to a focusable descendant\n window.removeEventListener(\"blur\", this.onWindowBlurListener);\n document.removeEventListener(\"focusin\", this.onDocumentFocusInListener);\n doFocusExit(this.el, this.currentFocusElement, newFocusElement);\n this.currentFocusElement = null;\n }\n}\nfunction onWindowBlur() {\n doFocusExit(this.el, this.currentFocusElement, undefined);\n}\nfunction onWidgetFocusIn() {\n // listen for focus moving to anywhere in document\n // note that mouse click on buttons, checkboxes and radios does not trigger focus events in all browsers!\n document.addEventListener(\"focusin\", this.onDocumentFocusInListener);\n // listen for focus leaving the window\n window.addEventListener(\"blur\", this.onWindowBlurListener);\n}\nclass FocusExitEmitter {\n constructor(el) {\n this.el = el;\n this.currentFocusElement = null;\n this.onWidgetFocusInListener = onWidgetFocusIn.bind(this);\n this.onDocumentFocusInListener = onDocumentFocusIn.bind(this);\n this.onWindowBlurListener = onWindowBlur.bind(this);\n this.el.addEventListener(\"focusin\", this.onWidgetFocusInListener);\n }\n removeEventListeners() {\n window.removeEventListener(\"blur\", this.onWindowBlurListener);\n document.removeEventListener(\"focusin\", this.onDocumentFocusInListener);\n this.el.removeEventListener(\"focusin\", this.onWidgetFocusInListener);\n }\n}\nfunction addFocusExit(el) {\n let exitEmitter = null;\n (0, _makeupNextId.default)(el);\n if (!focusExitEmitters[el.id]) {\n exitEmitter = new FocusExitEmitter(el);\n focusExitEmitters[el.id] = exitEmitter;\n }\n return exitEmitter;\n}\nfunction removeFocusExit(el) {\n const exitEmitter = focusExitEmitters[el.id];\n if (exitEmitter) {\n exitEmitter.removeEventListeners();\n delete focusExitEmitters[el.id];\n }\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _makeupNextId = _interopRequireDefault(require(\"makeup-next-id\"));\nvar ExitEmitter = _interopRequireWildcard(require(\"makeup-exit-emitter\"));\nvar _makeupFocusables = _interopRequireDefault(require(\"makeup-focusables\"));\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != typeof e && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if (\"default\" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\nfunction _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }\nconst defaultOptions = {\n alwaysDoFocusManagement: false,\n ariaControls: true,\n autoCollapse: false,\n collapseOnFocusOut: false,\n collapseOnMouseOut: false,\n collapseOnClickOut: false,\n collapseOnHostFocus: false,\n contentSelector: \".expander__content\",\n expandedClass: null,\n expandOnClick: false,\n expandOnFocus: false,\n expandOnHover: false,\n focusManagement: null,\n hostSelector: \".expander__host\",\n simulateSpacebarClick: false\n};\nfunction onHostKeyDown(e) {\n if (e.keyCode === 13 || e.keyCode === 32) {\n this._keyboardClickFlag = true;\n }\n // if host element does not naturally trigger a click event on spacebar, we can force one to trigger here.\n // careful! if host already triggers click events naturally, we end up with a \"double-click\".\n if (e.keyCode === 32 && this.options.simulateSpacebarClick === true) {\n this.hostEl.click();\n }\n}\nfunction onHostMouseDown() {\n this._mouseClickFlag = true;\n}\nfunction onHostClick() {\n this._expandWasKeyboardClickActivated = this._keyboardClickFlag;\n this._expandWasMouseClickActivated = this._mouseClickFlag;\n this.expanded = !this.expanded;\n}\nfunction onHostFocus() {\n this._expandWasFocusActivated = true;\n this.expanded = true;\n}\nfunction onHostHover() {\n clearTimeout(this._mouseLeft);\n this._expandWasHoverActivated = true;\n this.expanded = true;\n}\nfunction onFocusExit() {\n this.expanded = false;\n}\nfunction onMouseLeave() {\n clearTimeout(this._mouseLeft);\n this._mouseLeft = setTimeout(() => {\n this.expanded = false;\n }, 300);\n}\nfunction _onDocumentClick(e) {\n if (this.el.contains(e.target) === false) {\n this.expanded = false;\n }\n}\nfunction _onDocumentTouchStart() {\n this.documentClick = true;\n}\nfunction _onDocumentTouchMove() {\n this.documentClick = false;\n}\nfunction _onDocumentTouchEnd(e) {\n if (this.documentClick === true) {\n this.documentClick = false;\n if (this.el.contains(e.target) === false) {\n this.expanded = false;\n }\n }\n}\nfunction manageFocus(focusManagement, contentEl) {\n if (focusManagement === \"content\") {\n contentEl.setAttribute(\"tabindex\", \"-1\");\n contentEl.focus();\n } else if (focusManagement === \"focusable\") {\n var _focusables$;\n (_focusables$ = (0, _makeupFocusables.default)(contentEl)[0]) === null || _focusables$ === void 0 || _focusables$.focus();\n } else if (focusManagement === \"interactive\") {\n var _focusables$2;\n (_focusables$2 = (0, _makeupFocusables.default)(contentEl, true)[0]) === null || _focusables$2 === void 0 || _focusables$2.focus();\n } else if (focusManagement !== null) {\n const el = contentEl.querySelector(\"#\".concat(focusManagement));\n if (el) {\n el.focus();\n }\n }\n}\nclass _default {\n constructor(el, selectedOptions) {\n this.options = Object.assign({}, defaultOptions, selectedOptions);\n this.el = el;\n this.hostEl = el.querySelector(this.options.hostSelector); // the keyboard focusable host el\n this.contentEl = el.querySelector(this.options.contentSelector);\n ExitEmitter.addFocusExit(this.el);\n this._hostKeyDownListener = onHostKeyDown.bind(this);\n this._hostMouseDownListener = onHostMouseDown.bind(this);\n this._documentClickListener = _onDocumentClick.bind(this);\n this._documentTouchStartListener = _onDocumentTouchStart.bind(this);\n this._documentTouchMoveListener = _onDocumentTouchMove.bind(this);\n this._documentTouchEndListener = _onDocumentTouchEnd.bind(this);\n this._hostClickListener = onHostClick.bind(this);\n this._hostFocusListener = onHostFocus.bind(this);\n this._hostHoverListener = onHostHover.bind(this);\n this._focusExitListener = onFocusExit.bind(this);\n this._mouseLeaveListener = onMouseLeave.bind(this);\n if (this.hostEl.getAttribute(\"aria-expanded\") === null) {\n this.hostEl.setAttribute(\"aria-expanded\", \"false\");\n }\n if (this.options.ariaControls === true) {\n // ensure the widget has an id\n (0, _makeupNextId.default)(this.el, \"expander\");\n this.contentEl.id = this.contentEl.id || \"\".concat(this.el.id, \"-content\");\n this.hostEl.setAttribute(\"aria-controls\", this.contentEl.id);\n }\n this.expandOnClick = this.options.expandOnClick;\n this.expandOnFocus = this.options.expandOnFocus;\n this.expandOnHover = this.options.expandOnHover;\n this.collapseOnHostFocus = this.options.collapseOnHostFocus;\n if (this.options.autoCollapse === false) {\n this.collapseOnClickOut = this.options.collapseOnClickOut;\n this.collapseOnFocusOut = this.options.collapseOnFocusOut;\n this.collapseOnMouseOut = this.options.collapseOnMouseOut;\n }\n }\n set expandOnClick(bool) {\n if (bool === true) {\n this.hostEl.addEventListener(\"keydown\", this._hostKeyDownListener);\n this.hostEl.addEventListener(\"mousedown\", this._hostMouseDownListener);\n this.hostEl.addEventListener(\"click\", this._hostClickListener);\n if (this.options.autoCollapse === true) {\n this.collapseOnClickOut = true;\n this.collapseOnFocusOut = true;\n }\n } else {\n this.hostEl.removeEventListener(\"click\", this._hostClickListener);\n this.hostEl.removeEventListener(\"mousedown\", this._hostMouseDownListener);\n this.hostEl.removeEventListener(\"keydown\", this._hostKeyDownListener);\n }\n }\n set expandOnFocus(bool) {\n if (bool === true) {\n this.hostEl.addEventListener(\"focus\", this._hostFocusListener);\n if (this.options.autoCollapse === true) {\n this.collapseOnClickOut = true;\n this.collapseOnFocusOut = true;\n }\n } else {\n this.hostEl.removeEventListener(\"focus\", this._hostFocusListener);\n }\n }\n set expandOnHover(bool) {\n if (bool === true) {\n this.hostEl.addEventListener(\"mouseenter\", this._hostHoverListener);\n this.contentEl.addEventListener(\"mouseenter\", this._hostHoverListener);\n if (this.options.autoCollapse === true) {\n this.collapseOnMouseOut = true;\n }\n } else {\n this.hostEl.removeEventListener(\"mouseenter\", this._hostHoverListener);\n this.contentEl.removeEventListener(\"mouseenter\", this._hostHoverListener);\n }\n }\n set collapseOnClickOut(bool) {\n if (bool === true) {\n document.addEventListener(\"click\", this._documentClickListener);\n document.addEventListener(\"touchstart\", this._documentTouchStartListener);\n document.addEventListener(\"touchmove\", this._documentTouchMoveListener);\n document.addEventListener(\"touchend\", this._documentTouchEndListener);\n } else {\n document.removeEventListener(\"click\", this._documentClickListener);\n document.removeEventListener(\"touchstart\", this._documentTouchStartListener);\n document.removeEventListener(\"touchmove\", this._documentTouchMoveListener);\n document.removeEventListener(\"touchend\", this._documentTouchEndListener);\n }\n }\n set collapseOnFocusOut(bool) {\n if (bool === true) {\n this.el.addEventListener(\"focusExit\", this._focusExitListener);\n } else {\n this.el.removeEventListener(\"focusExit\", this._focusExitListener);\n }\n }\n set collapseOnHostFocus(bool) {\n if (bool === true) {\n this.contentEl.addEventListener(\"focusExit\", this._focusExitListener);\n } else {\n this.contentEl.removeEventListener(\"focusExit\", this._focusExitListener);\n }\n }\n set collapseOnMouseOut(bool) {\n if (bool === true) {\n this.el.addEventListener(\"mouseleave\", this._mouseLeaveListener);\n this.contentEl.addEventListener(\"mouseleave\", this._mouseLeaveListener);\n } else {\n this.el.removeEventListener(\"mouseleave\", this._mouseLeaveListener);\n this.contentEl.removeEventListener(\"mouseleave\", this._mouseLeaveListener);\n }\n }\n get expanded() {\n return this.hostEl.getAttribute(\"aria-expanded\") === \"true\";\n }\n set expanded(bool) {\n if (bool === true && this.expanded === false) {\n this.hostEl.setAttribute(\"aria-expanded\", \"true\");\n if (this.options.expandedClass) {\n this.el.classList.add(this.options.expandedClass);\n }\n if (this._expandWasKeyboardClickActivated || this._expandWasMouseClickActivated && this.options.alwaysDoFocusManagement) {\n manageFocus(this.options.focusManagement, this.contentEl);\n }\n this.el.dispatchEvent(new CustomEvent(\"expander-expand\", {\n bubbles: true,\n detail: this.contentEl\n }));\n }\n if (bool === false && this.expanded === true) {\n this.hostEl.setAttribute(\"aria-expanded\", \"false\");\n if (this.options.expandedClass) {\n this.el.classList.remove(this.options.expandedClass);\n }\n this.el.dispatchEvent(new CustomEvent(\"expander-collapse\", {\n bubbles: true,\n detail: this.contentEl\n }));\n }\n this._expandWasKeyboardClickActivated = false;\n this._expandWasMouseClickActivated = false;\n this._expandWasFocusActivated = false;\n this._expandWasHoverActivated = false;\n this._keyboardClickFlag = false;\n this._mouseClickFlag = false;\n }\n sleep() {\n if (this._destroyed !== true) {\n this.expandOnClick = false;\n this.expandOnFocus = false;\n this.expandOnHover = false;\n this.collapseOnClickOut = false;\n this.collapseOnFocusOut = false;\n this.collapseOnMouseOut = false;\n }\n }\n destroy() {\n this.sleep();\n this._destroyed = true;\n this._hostKeyDownListener = null;\n this._hostMouseDownListener = null;\n this._documentClickListener = null;\n this._documentTouchStartListener = null;\n this._documentTouchMoveListener = null;\n this._documentTouchEndListener = null;\n this._hostClickListener = null;\n this._hostFocusListener = null;\n this._hostHoverListener = null;\n this._focusExitListener = null;\n this._mouseLeaveListener = null;\n }\n}\nexports.default = _default;\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = _default;\nconst focusableElList = [\"a[href]\", \"area[href]\", \"button:not([disabled])\", \"embed\", \"iframe\", \"input:not([disabled])\", \"object\", \"select:not([disabled])\", \"textarea:not([disabled])\", \"*[tabindex]\", \"*[contenteditable]\"];\nconst focusableElSelector = focusableElList.join();\nfunction _default(el) {\n let keyboardOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n let callback = arguments.length > 2 ? arguments[2] : undefined;\n if (callback) {\n const request = requestAnimationFrame(() => {\n callback(getFocusables(el, keyboardOnly));\n });\n return () => {\n cancelAnimationFrame(request);\n };\n }\n return getFocusables(el, keyboardOnly);\n}\nfunction getFocusables(el) {\n let keyboardOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n let focusableEls = Array.prototype.slice.call(el.querySelectorAll(focusableElSelector));\n\n // filter out elements with display: none or nested in a display: none parent\n focusableEls = focusableEls.filter(function (focusableEl) {\n return !!(focusableEl.offsetWidth || focusableEl.offsetHeight || focusableEl.getClientRects().length);\n });\n if (keyboardOnly === true) {\n focusableEls = focusableEls.filter(function (focusableEl) {\n return focusableEl.getAttribute(\"tabindex\") !== \"-1\";\n });\n }\n return focusableEls;\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = _default;\nconst sequenceMap = {};\nconst defaultPrefix = \"nid\";\nconst randomPortion = createRandomPortion(3);\nfunction randomNumber(max) {\n return Math.floor(Math.random() * max);\n}\nfunction createRandomPortion(size) {\n const letters = \"abcdefghijklmnopqrstuvwxyz\";\n const digits = \"0123456789\";\n const allChars = letters + digits;\n\n // to ensure a valid HTML ID (when prefix is empty), first character must be a letter\n let portion = letters[randomNumber(25)];\n\n // start iterating from 1, as we already have our first char\n for (let i = 1; i < size; i++) {\n portion += allChars[randomNumber(35)];\n }\n return portion;\n}\nfunction _default(el) {\n let prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultPrefix;\n const separator = prefix === \"\" ? \"\" : \"-\";\n\n // join first prefix with random portion to create key\n const key = \"\".concat(prefix).concat(separator).concat(randomPortion);\n\n // initialise key in sequence map if necessary\n sequenceMap[key] = sequenceMap[key] || 0;\n if (!el.id) {\n el.setAttribute(\"id\", \"\".concat(key, \"-\").concat(sequenceMap[key]++));\n }\n return el.id;\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","\"use strict\";\n\nvar _makeupExpander = _interopRequireDefault(require(\"makeup-expander\"));\nfunction _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }\n// REQUIRE\n// const Expander = require('makeup-expander').default;\n\n// IMPORT\n\nconst clickExpanderEls = document.querySelectorAll(\".expander--click-only\");\nconst focusExpanderEls = document.querySelectorAll(\".expander--focus-only\");\nconst hoverExpanderEls = document.querySelectorAll(\".expander--hover-only\");\nconst hoverAndFocusExpanderEls = document.querySelectorAll(\".expander--focus-and-hover\");\nconst stealthExpanderEls = document.querySelectorAll(\".expander--stealth-only\");\nconst clickAndSpacebarExpanderEls = document.querySelectorAll(\".expander--click-and-spacebar\");\nconst expanderWidgets = [];\nexpanderWidgets.push(new _makeupExpander.default(clickExpanderEls[0], {\n expandOnClick: true\n}));\nexpanderWidgets.push(new _makeupExpander.default(clickExpanderEls[1], {\n autoCollapse: true,\n expandOnClick: true\n}));\nfocusExpanderEls.forEach(function (el) {\n expanderWidgets.push(new _makeupExpander.default(el, {\n autoCollapse: true,\n expandOnFocus: true\n }));\n});\nhoverExpanderEls.forEach(function (el) {\n expanderWidgets.push(new _makeupExpander.default(el, {\n autoCollapse: true,\n expandOnHover: true\n }));\n});\nhoverAndFocusExpanderEls.forEach(function (el) {\n expanderWidgets.push(new _makeupExpander.default(el, {\n autoCollapse: true,\n expandOnFocus: true,\n expandOnHover: true\n }));\n});\nstealthExpanderEls.forEach(function (el) {\n expanderWidgets.push(new _makeupExpander.default(el, {\n ollapseOnClickOut: true,\n collapseOnFocusOut: true,\n expandOnClick: true,\n focusManagement: \"focusable\"\n }));\n});\nclickAndSpacebarExpanderEls.forEach(function (el) {\n expanderWidgets.push(new _makeupExpander.default(el, {\n autoCollapse: true,\n expandOnClick: true,\n simulateSpacebarClick: true,\n expandedClass: \"expander__host-container--expanded\"\n }));\n});\nexpanderWidgets.forEach(function (item) {\n item.el.addEventListener(\"expander-expand\", function (e) {\n console.log(e);\n });\n item.el.addEventListener(\"expander-collapse\", function (e) {\n console.log(e);\n });\n});"],"names":[],"sourceRoot":""}
\ No newline at end of file
+{"version":3,"file":"makeup-expander/index.min.js","mappings":";;;;;;;AAAa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,oBAAoB;AACpB,uBAAuB;AACvB,2CAA2C,mBAAO,CAAC,GAAgB;AACnE,qCAAqC,iCAAiC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC3Ea;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf,2CAA2C,mBAAO,CAAC,GAAgB;AACnE,0CAA0C,mBAAO,CAAC,GAAqB;AACvE,+CAA+C,mBAAO,CAAC,GAAmB;AAC1E,uCAAuC,+CAA+C,0CAA0C,kDAAkD,mBAAmB;AACrM,yCAAyC,uCAAuC,2EAA2E,cAAc,qCAAqC,oCAAoC,UAAU,iBAAiB,gEAAgE,0CAA0C,8BAA8B,0DAA0D,wEAAwE;AACvhB,qCAAqC,iCAAiC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC;AACA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAe;;;;;;;;AC7RF;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;;;;;;;ACnCa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAkB,UAAU;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;UCvCA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;ACtBa;;AAEb,6CAA6C,mBAAO,CAAC,GAAiB;AACtE,qCAAqC,iCAAiC;AACtE;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA,GAAG;AACH,CAAC;AACD;AACA;AACA;AACA;AACA,GAAG;AACH,CAAC;AACD;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,CAAC;AACD;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH,CAAC,E","sources":["webpack://root/./packages/core/makeup-exit-emitter/dist/cjs/index.js","webpack://root/./packages/core/makeup-expander/dist/cjs/index.js","webpack://root/./packages/core/makeup-focusables/dist/cjs/index.js","webpack://root/./packages/core/makeup-next-id/dist/cjs/index.js","webpack://root/webpack/bootstrap","webpack://root/./docs/core/makeup-expander/index.compiled.js"],"sourcesContent":["\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.addFocusExit = addFocusExit;\nexports.removeFocusExit = removeFocusExit;\nvar _makeupNextId = _interopRequireDefault(require(\"makeup-next-id\"));\nfunction _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }\nconst focusExitEmitters = {};\nfunction doFocusExit(el, fromElement, toElement) {\n el.dispatchEvent(new CustomEvent(\"focusExit\", {\n detail: {\n fromElement,\n toElement\n },\n bubbles: false // mirror the native mouseleave event\n }));\n}\nfunction onDocumentFocusIn(e) {\n const newFocusElement = e.target;\n const targetIsDescendant = this.el.contains(newFocusElement);\n\n // if focus has moved to a focusable descendant\n if (targetIsDescendant === true) {\n // set the target as the currently focussed element\n this.currentFocusElement = newFocusElement;\n } else {\n // else focus has not gone to a focusable descendant\n window.removeEventListener(\"blur\", this.onWindowBlurListener);\n document.removeEventListener(\"focusin\", this.onDocumentFocusInListener);\n doFocusExit(this.el, this.currentFocusElement, newFocusElement);\n this.currentFocusElement = null;\n }\n}\nfunction onWindowBlur() {\n doFocusExit(this.el, this.currentFocusElement, undefined);\n}\nfunction onWidgetFocusIn() {\n // listen for focus moving to anywhere in document\n // note that mouse click on buttons, checkboxes and radios does not trigger focus events in all browsers!\n document.addEventListener(\"focusin\", this.onDocumentFocusInListener);\n // listen for focus leaving the window\n window.addEventListener(\"blur\", this.onWindowBlurListener);\n}\nclass FocusExitEmitter {\n constructor(el) {\n this.el = el;\n this.currentFocusElement = null;\n this.onWidgetFocusInListener = onWidgetFocusIn.bind(this);\n this.onDocumentFocusInListener = onDocumentFocusIn.bind(this);\n this.onWindowBlurListener = onWindowBlur.bind(this);\n this.el.addEventListener(\"focusin\", this.onWidgetFocusInListener);\n }\n removeEventListeners() {\n window.removeEventListener(\"blur\", this.onWindowBlurListener);\n document.removeEventListener(\"focusin\", this.onDocumentFocusInListener);\n this.el.removeEventListener(\"focusin\", this.onWidgetFocusInListener);\n }\n}\nfunction addFocusExit(el) {\n let exitEmitter = null;\n (0, _makeupNextId.default)(el);\n if (!focusExitEmitters[el.id]) {\n exitEmitter = new FocusExitEmitter(el);\n focusExitEmitters[el.id] = exitEmitter;\n }\n return exitEmitter;\n}\nfunction removeFocusExit(el) {\n const exitEmitter = focusExitEmitters[el.id];\n if (exitEmitter) {\n exitEmitter.removeEventListeners();\n delete focusExitEmitters[el.id];\n }\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _makeupNextId = _interopRequireDefault(require(\"makeup-next-id\"));\nvar ExitEmitter = _interopRequireWildcard(require(\"makeup-exit-emitter\"));\nvar _makeupFocusables = _interopRequireDefault(require(\"makeup-focusables\"));\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != typeof e && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if (\"default\" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\nfunction _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }\nconst defaultOptions = {\n alwaysDoFocusManagement: false,\n ariaControls: true,\n autoCollapse: false,\n collapseOnFocusOut: false,\n collapseOnMouseOut: false,\n collapseOnClickOut: false,\n collapseOnHostReFocus: false,\n contentSelector: \".expander__content\",\n expandedClass: null,\n expandOnClick: false,\n expandOnFocus: false,\n expandOnHover: false,\n focusManagement: null,\n hostSelector: \".expander__host\",\n simulateSpacebarClick: false\n};\nfunction onHostKeyDown(e) {\n if (e.keyCode === 13 || e.keyCode === 32) {\n this._keyboardClickFlag = true;\n }\n // if host element does not naturally trigger a click event on spacebar, we can force one to trigger here.\n // careful! if host already triggers click events naturally, we end up with a \"double-click\".\n if (e.keyCode === 32 && this.options.simulateSpacebarClick === true) {\n this.hostEl.click();\n }\n}\nfunction onHostMouseDown() {\n this._mouseClickFlag = true;\n}\nfunction onHostClick() {\n this._expandWasKeyboardClickActivated = this._keyboardClickFlag;\n this._expandWasMouseClickActivated = this._mouseClickFlag;\n this._widgetHasKeyboardFocus = this._keyboardClickFlag;\n this.expanded = !this.expanded;\n}\nfunction onHostFocus() {\n this._expandWasFocusActivated = true;\n this.expanded = true;\n}\n\n// NOTE: collapseOnHostReFocus cannot be used when expandOnFocus is true\nfunction onHostReFocus() {\n if (this.expanded && this._widgetHasKeyboardFocus) {\n this.expanded = false;\n }\n}\nfunction onHostHover() {\n clearTimeout(this._mouseLeft);\n this._expandWasHoverActivated = true;\n this.expanded = true;\n}\nfunction onFocusExit() {\n this._widgetHasKeyboardFocus = false;\n this.expanded = false;\n}\nfunction onMouseLeave() {\n clearTimeout(this._mouseLeft);\n this._mouseLeft = setTimeout(() => {\n this.expanded = false;\n }, 300);\n}\nfunction _onDocumentClick(e) {\n if (this.el.contains(e.target) === false) {\n this.expanded = false;\n }\n}\nfunction _onDocumentTouchStart() {\n this.documentClick = true;\n}\nfunction _onDocumentTouchMove() {\n this.documentClick = false;\n}\nfunction _onDocumentTouchEnd(e) {\n if (this.documentClick === true) {\n this.documentClick = false;\n if (this.el.contains(e.target) === false) {\n this.expanded = false;\n }\n }\n}\nfunction manageFocus(focusManagement, contentEl) {\n if (focusManagement === \"content\") {\n contentEl.setAttribute(\"tabindex\", \"-1\");\n contentEl.focus();\n } else if (focusManagement === \"focusable\") {\n var _focusables$;\n (_focusables$ = (0, _makeupFocusables.default)(contentEl)[0]) === null || _focusables$ === void 0 || _focusables$.focus();\n } else if (focusManagement === \"interactive\") {\n var _focusables$2;\n (_focusables$2 = (0, _makeupFocusables.default)(contentEl, true)[0]) === null || _focusables$2 === void 0 || _focusables$2.focus();\n } else if (focusManagement !== null) {\n const el = contentEl.querySelector(\"#\".concat(focusManagement));\n if (el) {\n el.focus();\n }\n }\n}\nclass _default {\n constructor(el, selectedOptions) {\n this.options = Object.assign({}, defaultOptions, selectedOptions);\n this.el = el;\n this.hostEl = el.querySelector(this.options.hostSelector); // the keyboard focusable host el\n this.contentEl = el.querySelector(this.options.contentSelector);\n ExitEmitter.addFocusExit(this.el);\n this._hostKeyDownListener = onHostKeyDown.bind(this);\n this._hostMouseDownListener = onHostMouseDown.bind(this);\n this._documentClickListener = _onDocumentClick.bind(this);\n this._documentTouchStartListener = _onDocumentTouchStart.bind(this);\n this._documentTouchMoveListener = _onDocumentTouchMove.bind(this);\n this._documentTouchEndListener = _onDocumentTouchEnd.bind(this);\n this._hostClickListener = onHostClick.bind(this);\n this._hostFocusListener = onHostFocus.bind(this);\n this._hostReFocusListener = onHostReFocus.bind(this);\n this._hostHoverListener = onHostHover.bind(this);\n this._focusExitListener = onFocusExit.bind(this);\n this._mouseLeaveListener = onMouseLeave.bind(this);\n if (this.hostEl.getAttribute(\"aria-expanded\") === null) {\n this.hostEl.setAttribute(\"aria-expanded\", \"false\");\n }\n if (this.options.ariaControls === true) {\n // ensure the widget has an id\n (0, _makeupNextId.default)(this.el, \"expander\");\n this.contentEl.id = this.contentEl.id || \"\".concat(this.el.id, \"-content\");\n this.hostEl.setAttribute(\"aria-controls\", this.contentEl.id);\n }\n this.expandOnClick = this.options.expandOnClick;\n this.expandOnFocus = this.options.expandOnFocus;\n this.expandOnHover = this.options.expandOnHover;\n this.collapseOnHostReFocus = this.options.collapseOnHostReFocus;\n if (this.options.autoCollapse === false) {\n this.collapseOnClickOut = this.options.collapseOnClickOut;\n this.collapseOnFocusOut = this.options.collapseOnFocusOut;\n this.collapseOnMouseOut = this.options.collapseOnMouseOut;\n }\n }\n set expandOnClick(bool) {\n if (bool === true) {\n this.hostEl.addEventListener(\"keydown\", this._hostKeyDownListener);\n this.hostEl.addEventListener(\"mousedown\", this._hostMouseDownListener);\n this.hostEl.addEventListener(\"click\", this._hostClickListener);\n if (this.options.autoCollapse === true) {\n this.collapseOnClickOut = true;\n this.collapseOnFocusOut = true;\n }\n } else {\n this.hostEl.removeEventListener(\"click\", this._hostClickListener);\n this.hostEl.removeEventListener(\"mousedown\", this._hostMouseDownListener);\n this.hostEl.removeEventListener(\"keydown\", this._hostKeyDownListener);\n }\n }\n set expandOnFocus(bool) {\n if (bool === true) {\n this.hostEl.addEventListener(\"focus\", this._hostFocusListener);\n if (this.options.autoCollapse === true) {\n this.collapseOnClickOut = true;\n this.collapseOnFocusOut = true;\n }\n } else {\n this.hostEl.removeEventListener(\"focus\", this._hostFocusListener);\n }\n }\n set collapseOnHostReFocus(bool) {\n if (bool === true) {\n this.hostEl.addEventListener(\"focus\", this._hostReFocusListener);\n } else {\n this.hostEl.removeEventListener(\"focus\", this._hostReFocusListener);\n }\n }\n set expandOnHover(bool) {\n if (bool === true) {\n this.hostEl.addEventListener(\"mouseenter\", this._hostHoverListener);\n this.contentEl.addEventListener(\"mouseenter\", this._hostHoverListener);\n if (this.options.autoCollapse === true) {\n this.collapseOnMouseOut = true;\n }\n } else {\n this.hostEl.removeEventListener(\"mouseenter\", this._hostHoverListener);\n this.contentEl.removeEventListener(\"mouseenter\", this._hostHoverListener);\n }\n }\n set collapseOnClickOut(bool) {\n if (bool === true) {\n document.addEventListener(\"click\", this._documentClickListener);\n document.addEventListener(\"touchstart\", this._documentTouchStartListener);\n document.addEventListener(\"touchmove\", this._documentTouchMoveListener);\n document.addEventListener(\"touchend\", this._documentTouchEndListener);\n } else {\n document.removeEventListener(\"click\", this._documentClickListener);\n document.removeEventListener(\"touchstart\", this._documentTouchStartListener);\n document.removeEventListener(\"touchmove\", this._documentTouchMoveListener);\n document.removeEventListener(\"touchend\", this._documentTouchEndListener);\n }\n }\n set collapseOnFocusOut(bool) {\n if (bool === true) {\n this.el.addEventListener(\"focusExit\", this._focusExitListener);\n } else {\n this.el.removeEventListener(\"focusExit\", this._focusExitListener);\n }\n }\n set collapseOnMouseOut(bool) {\n if (bool === true) {\n this.el.addEventListener(\"mouseleave\", this._mouseLeaveListener);\n this.contentEl.addEventListener(\"mouseleave\", this._mouseLeaveListener);\n } else {\n this.el.removeEventListener(\"mouseleave\", this._mouseLeaveListener);\n this.contentEl.removeEventListener(\"mouseleave\", this._mouseLeaveListener);\n }\n }\n get expanded() {\n return this.hostEl.getAttribute(\"aria-expanded\") === \"true\";\n }\n set expanded(bool) {\n if (bool === true && this.expanded === false) {\n this.hostEl.setAttribute(\"aria-expanded\", \"true\");\n if (this.options.expandedClass) {\n this.el.classList.add(this.options.expandedClass);\n }\n if (this._expandWasKeyboardClickActivated || this._expandWasMouseClickActivated && this.options.alwaysDoFocusManagement) {\n manageFocus(this.options.focusManagement, this.contentEl);\n }\n this.el.dispatchEvent(new CustomEvent(\"expander-expand\", {\n bubbles: true,\n detail: this.contentEl\n }));\n }\n if (bool === false && this.expanded === true) {\n this.hostEl.setAttribute(\"aria-expanded\", \"false\");\n if (this.options.expandedClass) {\n this.el.classList.remove(this.options.expandedClass);\n }\n this.el.dispatchEvent(new CustomEvent(\"expander-collapse\", {\n bubbles: true,\n detail: this.contentEl\n }));\n }\n this._expandWasKeyboardClickActivated = false;\n this._expandWasMouseClickActivated = false;\n this._expandWasFocusActivated = false;\n this._expandWasHoverActivated = false;\n this._keyboardClickFlag = false;\n this._mouseClickFlag = false;\n }\n sleep() {\n if (this._destroyed !== true) {\n this.expandOnClick = false;\n this.expandOnFocus = false;\n this.expandOnHover = false;\n this.collapseOnClickOut = false;\n this.collapseOnFocusOut = false;\n this.collapseOnMouseOut = false;\n this.collapseOnHostReFocus = false;\n }\n }\n destroy() {\n this.sleep();\n this._destroyed = true;\n this._hostKeyDownListener = null;\n this._hostMouseDownListener = null;\n this._documentClickListener = null;\n this._documentTouchStartListener = null;\n this._documentTouchMoveListener = null;\n this._documentTouchEndListener = null;\n this._hostClickListener = null;\n this._hostFocusListener = null;\n this._hostReFocusListener = null;\n this._hostHoverListener = null;\n this._focusExitListener = null;\n this._mouseLeaveListener = null;\n this._widgetHasKeyboardFocus = null;\n }\n}\nexports.default = _default;\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = _default;\nconst focusableElList = [\"a[href]\", \"area[href]\", \"button:not([disabled])\", \"embed\", \"iframe\", \"input:not([disabled])\", \"object\", \"select:not([disabled])\", \"textarea:not([disabled])\", \"*[tabindex]\", \"*[contenteditable]\"];\nconst focusableElSelector = focusableElList.join();\nfunction _default(el) {\n let keyboardOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n let callback = arguments.length > 2 ? arguments[2] : undefined;\n if (callback) {\n const request = requestAnimationFrame(() => {\n callback(getFocusables(el, keyboardOnly));\n });\n return () => {\n cancelAnimationFrame(request);\n };\n }\n return getFocusables(el, keyboardOnly);\n}\nfunction getFocusables(el) {\n let keyboardOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n let focusableEls = Array.prototype.slice.call(el.querySelectorAll(focusableElSelector));\n\n // filter out elements with display: none or nested in a display: none parent\n focusableEls = focusableEls.filter(function (focusableEl) {\n return !!(focusableEl.offsetWidth || focusableEl.offsetHeight || focusableEl.getClientRects().length);\n });\n if (keyboardOnly === true) {\n focusableEls = focusableEls.filter(function (focusableEl) {\n return focusableEl.getAttribute(\"tabindex\") !== \"-1\";\n });\n }\n return focusableEls;\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = _default;\nconst sequenceMap = {};\nconst defaultPrefix = \"nid\";\nconst randomPortion = createRandomPortion(3);\nfunction randomNumber(max) {\n return Math.floor(Math.random() * max);\n}\nfunction createRandomPortion(size) {\n const letters = \"abcdefghijklmnopqrstuvwxyz\";\n const digits = \"0123456789\";\n const allChars = letters + digits;\n\n // to ensure a valid HTML ID (when prefix is empty), first character must be a letter\n let portion = letters[randomNumber(25)];\n\n // start iterating from 1, as we already have our first char\n for (let i = 1; i < size; i++) {\n portion += allChars[randomNumber(35)];\n }\n return portion;\n}\nfunction _default(el) {\n let prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultPrefix;\n const separator = prefix === \"\" ? \"\" : \"-\";\n\n // join first prefix with random portion to create key\n const key = \"\".concat(prefix).concat(separator).concat(randomPortion);\n\n // initialise key in sequence map if necessary\n sequenceMap[key] = sequenceMap[key] || 0;\n if (!el.id) {\n el.setAttribute(\"id\", \"\".concat(key, \"-\").concat(sequenceMap[key]++));\n }\n return el.id;\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","\"use strict\";\n\nvar _makeupExpander = _interopRequireDefault(require(\"makeup-expander\"));\nfunction _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }\n// REQUIRE\n// const Expander = require('makeup-expander').default;\n\n// IMPORT\n\nconst clickExpanderEls = document.querySelectorAll(\".expander--click-only\");\nconst focusExpanderEls = document.querySelectorAll(\".expander--focus-only\");\nconst hoverExpanderEls = document.querySelectorAll(\".expander--hover-only\");\nconst hoverAndFocusExpanderEls = document.querySelectorAll(\".expander--focus-and-hover\");\nconst stealthExpanderEls = document.querySelectorAll(\".expander--stealth-only\");\nconst clickAndSpacebarExpanderEls = document.querySelectorAll(\".expander--click-and-spacebar\");\nconst expanderWidgets = [];\nexpanderWidgets.push(new _makeupExpander.default(clickExpanderEls[0], {\n expandOnClick: true\n}));\nexpanderWidgets.push(new _makeupExpander.default(clickExpanderEls[1], {\n autoCollapse: true,\n expandOnClick: true\n}));\nfocusExpanderEls.forEach(function (el) {\n expanderWidgets.push(new _makeupExpander.default(el, {\n autoCollapse: true,\n expandOnFocus: true\n }));\n});\nhoverExpanderEls.forEach(function (el) {\n expanderWidgets.push(new _makeupExpander.default(el, {\n autoCollapse: true,\n expandOnHover: true\n }));\n});\nhoverAndFocusExpanderEls.forEach(function (el) {\n expanderWidgets.push(new _makeupExpander.default(el, {\n autoCollapse: true,\n expandOnFocus: true,\n expandOnHover: true\n }));\n});\nstealthExpanderEls.forEach(function (el) {\n expanderWidgets.push(new _makeupExpander.default(el, {\n collapseOnClickOut: true,\n collapseOnFocusOut: true,\n expandOnClick: true,\n focusManagement: \"focusable\"\n }));\n});\nclickAndSpacebarExpanderEls.forEach(function (el) {\n expanderWidgets.push(new _makeupExpander.default(el, {\n autoCollapse: true,\n expandOnClick: true,\n simulateSpacebarClick: true,\n expandedClass: \"expander__host-container--expanded\"\n }));\n});\nexpanderWidgets.forEach(function (item) {\n item.el.addEventListener(\"expander-expand\", function (e) {\n console.log(e);\n });\n item.el.addEventListener(\"expander-collapse\", function (e) {\n console.log(e);\n });\n});"],"names":[],"sourceRoot":""}
\ No newline at end of file
diff --git a/docs/ui/makeup-combobox/index.min.js b/docs/ui/makeup-combobox/index.min.js
index 3dc707f3..e1b80abe 100644
--- a/docs/ui/makeup-combobox/index.min.js
+++ b/docs/ui/makeup-combobox/index.min.js
@@ -377,7 +377,7 @@ const defaultOptions = {
collapseOnFocusOut: false,
collapseOnMouseOut: false,
collapseOnClickOut: false,
- collapseOnHostFocus: false,
+ collapseOnHostReFocus: false,
contentSelector: ".expander__content",
expandedClass: null,
expandOnClick: false,
@@ -403,18 +403,27 @@ function onHostMouseDown() {
function onHostClick() {
this._expandWasKeyboardClickActivated = this._keyboardClickFlag;
this._expandWasMouseClickActivated = this._mouseClickFlag;
+ this._widgetHasKeyboardFocus = this._keyboardClickFlag;
this.expanded = !this.expanded;
}
function onHostFocus() {
this._expandWasFocusActivated = true;
this.expanded = true;
}
+
+// NOTE: collapseOnHostReFocus cannot be used when expandOnFocus is true
+function onHostReFocus() {
+ if (this.expanded && this._widgetHasKeyboardFocus) {
+ this.expanded = false;
+ }
+}
function onHostHover() {
clearTimeout(this._mouseLeft);
this._expandWasHoverActivated = true;
this.expanded = true;
}
function onFocusExit() {
+ this._widgetHasKeyboardFocus = false;
this.expanded = false;
}
function onMouseLeave() {
@@ -474,6 +483,7 @@ class _default {
this._documentTouchEndListener = _onDocumentTouchEnd.bind(this);
this._hostClickListener = onHostClick.bind(this);
this._hostFocusListener = onHostFocus.bind(this);
+ this._hostReFocusListener = onHostReFocus.bind(this);
this._hostHoverListener = onHostHover.bind(this);
this._focusExitListener = onFocusExit.bind(this);
this._mouseLeaveListener = onMouseLeave.bind(this);
@@ -489,7 +499,7 @@ class _default {
this.expandOnClick = this.options.expandOnClick;
this.expandOnFocus = this.options.expandOnFocus;
this.expandOnHover = this.options.expandOnHover;
- this.collapseOnHostFocus = this.options.collapseOnHostFocus;
+ this.collapseOnHostReFocus = this.options.collapseOnHostReFocus;
if (this.options.autoCollapse === false) {
this.collapseOnClickOut = this.options.collapseOnClickOut;
this.collapseOnFocusOut = this.options.collapseOnFocusOut;
@@ -522,6 +532,13 @@ class _default {
this.hostEl.removeEventListener("focus", this._hostFocusListener);
}
}
+ set collapseOnHostReFocus(bool) {
+ if (bool === true) {
+ this.hostEl.addEventListener("focus", this._hostReFocusListener);
+ } else {
+ this.hostEl.removeEventListener("focus", this._hostReFocusListener);
+ }
+ }
set expandOnHover(bool) {
if (bool === true) {
this.hostEl.addEventListener("mouseenter", this._hostHoverListener);
@@ -554,13 +571,6 @@ class _default {
this.el.removeEventListener("focusExit", this._focusExitListener);
}
}
- set collapseOnHostFocus(bool) {
- if (bool === true) {
- this.contentEl.addEventListener("focusExit", this._focusExitListener);
- } else {
- this.contentEl.removeEventListener("focusExit", this._focusExitListener);
- }
- }
set collapseOnMouseOut(bool) {
if (bool === true) {
this.el.addEventListener("mouseleave", this._mouseLeaveListener);
@@ -612,6 +622,7 @@ class _default {
this.collapseOnClickOut = false;
this.collapseOnFocusOut = false;
this.collapseOnMouseOut = false;
+ this.collapseOnHostReFocus = false;
}
}
destroy() {
@@ -625,9 +636,11 @@ class _default {
this._documentTouchEndListener = null;
this._hostClickListener = null;
this._hostFocusListener = null;
+ this._hostReFocusListener = null;
this._hostHoverListener = null;
this._focusExitListener = null;
this._mouseLeaveListener = null;
+ this._widgetHasKeyboardFocus = null;
}
}
exports["default"] = _default;
diff --git a/docs/ui/makeup-combobox/index.min.js.map b/docs/ui/makeup-combobox/index.min.js.map
index 888ca95e..f1883dfc 100644
--- a/docs/ui/makeup-combobox/index.min.js.map
+++ b/docs/ui/makeup-combobox/index.min.js.map
@@ -1 +1 @@
-{"version":3,"file":"makeup-combobox/index.min.js","mappings":";;;;;;AAAA,mBAAO,CAAC,IAA8B;;;;;;;;ACAtC,mBAAO,CAAC,IAA0B;;;;;;;;ACAlC,mBAAO,CAAC,IAAsB;AAC9B,mBAAO,CAAC,IAAuB;;;;;;;;ACD/B,mBAAO,CAAC,IAA+B;;;;;;;;ACAvC,mBAAO,CAAC,IAAgC;;;;;;;;;;ACAxC;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;ACAa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,oBAAoB;AACpB,gDAAgD,mBAAO,CAAC,IAA2B;AACnF,2CAA2C,mBAAO,CAAC,IAAgB;AACnE,qCAAqC,iCAAiC;AACtE,uCAAuC,+CAA+C,0CAA0C,kDAAkD,mBAAmB;AACrM,yCAAyC,uCAAuC,2EAA2E,cAAc,qCAAqC,oCAAoC,UAAU,iBAAiB,gEAAgE,0CAA0C,8BAA8B,0DAA0D,wEAAwE;AACvhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;ACzKa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,oBAAoB;AACpB,uBAAuB;AACvB,2CAA2C,mBAAO,CAAC,IAAgB;AACnE,qCAAqC,iCAAiC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AC3Ea;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf,2CAA2C,mBAAO,CAAC,IAAgB;AACnE,0CAA0C,mBAAO,CAAC,GAAqB;AACvE,+CAA+C,mBAAO,CAAC,IAAmB;AAC1E,uCAAuC,+CAA+C,0CAA0C,kDAAkD,mBAAmB;AACrM,yCAAyC,uCAAuC,2EAA2E,cAAc,qCAAqC,oCAAoC,UAAU,iBAAiB,gEAAgE,0CAA0C,8BAA8B,0DAA0D,wEAAwE;AACvhB,qCAAqC,iCAAiC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC;AACA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAe;;;;;;;;;AChRF;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;;;;;;;;ACnCa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,WAAW;AACX,kBAAkB;AAClB,gBAAgB;AAChB,cAAc;AACd,qBAAqB;AACrB,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;ACrEa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,oBAAoB;AACpB,yCAAyC,mBAAO,CAAC,IAAoB;AACrE,0CAA0C,mBAAO,CAAC,GAAqB;AACvE,uCAAuC,+CAA+C,0CAA0C,kDAAkD,mBAAmB;AACrM,yCAAyC,uCAAuC,2EAA2E,cAAc,qCAAqC,oCAAoC,UAAU,iBAAiB,gEAAgE,0CAA0C,8BAA8B,0DAA0D,wEAAwE;AACvhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,aAAa,aAAa;AAC1B,aAAa,QAAQ;AACrB,aAAa,uBAAuB;AACpC;AACA;AACA,iBAAiB,uBAAuB;AACxC,mCAAmC;;AAEnC,iBAAiB,aAAa;AAC9B;;AAEA,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA,aAAa,aAAa;AAC1B,aAAa,QAAQ;AACrB,aAAa,uBAAuB;AACpC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,aAAa;AAC1B,aAAa,uBAAuB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;;;;;;;AClXa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAkB,UAAU;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;ACvCa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,WAAW;AACX,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;ACjBa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf,6CAA6C,mBAAO,CAAC,IAAiB;AACtE,4CAA4C,mBAAO,CAAC,IAAgB;AACpE,qCAAqC,iCAAiC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAe;AACf;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;;;;;;;;ACvOa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf,+CAA+C,mBAAO,CAAC,IAA0B;AACjF,gDAAgD,mBAAO,CAAC,IAA4B;AACpF,uCAAuC,+CAA+C,0CAA0C,kDAAkD,mBAAmB;AACrM,yCAAyC,uCAAuC,2EAA2E,cAAc,qCAAqC,oCAAoC,UAAU,iBAAiB,gEAAgE,0CAA0C,8BAA8B,0DAA0D,wEAAwE;AACvhB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;;AAEA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;;;;;;UCnNA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;ACNa;;AAEb,mBAAO,CAAC,IAAgB;AACxB,mBAAO,CAAC,IAAmB;AAC3B,mBAAO,CAAC,IAAmB;AAC3B,mBAAO,CAAC,IAAqB;AAC7B,6CAA6C,mBAAO,CAAC,GAAiB;AACtE,qCAAqC,iCAAiC;AACtE;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL,GAAG;AACH,E","sources":["webpack://root/./node_modules/@ebay/skin/combobox.js","webpack://root/./node_modules/@ebay/skin/global.js","webpack://root/./node_modules/@ebay/skin/tokens.js","webpack://root/./node_modules/@ebay/skin/tokens/evo-core.js","webpack://root/./node_modules/@ebay/skin/tokens/evo-light.js","webpack://root/./docs/docs.css?378e","webpack://root/./node_modules/@ebay/skin/dist/combobox/combobox.css?755d","webpack://root/./node_modules/@ebay/skin/dist/global/global.css?e001","webpack://root/./node_modules/@ebay/skin/dist/tokens/evo-core.css?7a96","webpack://root/./node_modules/@ebay/skin/dist/tokens/evo-light.css?9c33","webpack://root/./packages/core/makeup-active-descendant/dist/cjs/index.js","webpack://root/./packages/core/makeup-exit-emitter/dist/cjs/index.js","webpack://root/./packages/core/makeup-expander/dist/cjs/index.js","webpack://root/./packages/core/makeup-focusables/dist/cjs/index.js","webpack://root/./packages/core/makeup-key-emitter/dist/cjs/index.js","webpack://root/./packages/core/makeup-navigation-emitter/dist/cjs/index.js","webpack://root/./packages/core/makeup-next-id/dist/cjs/index.js","webpack://root/./packages/core/makeup-prevent-scroll-keys/dist/cjs/index.js","webpack://root/./packages/ui/makeup-combobox/dist/cjs/index.js","webpack://root/./packages/ui/makeup-listbox/dist/cjs/index.js","webpack://root/webpack/bootstrap","webpack://root/webpack/runtime/make namespace object","webpack://root/./docs/ui/makeup-combobox/index.compiled.js"],"sourcesContent":["require('./dist/combobox/combobox.css');\n","require('./dist/global/global.css');\n","require('./tokens/evo-core.js');\nrequire('./tokens/evo-light.js');\n","require('./../dist/tokens/evo-core.css');\n","require('./../dist/tokens/evo-light.css');\n","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.createLinear = createLinear;\nvar NavigationEmitter = _interopRequireWildcard(require(\"makeup-navigation-emitter\"));\nvar _makeupNextId = _interopRequireDefault(require(\"makeup-next-id\"));\nfunction _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != typeof e && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if (\"default\" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\nconst defaultOptions = {\n activeDescendantClassName: \"active-descendant\",\n autoInit: \"none\",\n autoReset: \"none\",\n autoScroll: false,\n axis: \"both\",\n wrap: false\n};\nfunction onModelInit(e) {\n const {\n items,\n toIndex\n } = e.detail;\n const itemEl = items[toIndex];\n if (itemEl) {\n itemEl.classList.add(this._options.activeDescendantClassName);\n this._focusEl.setAttribute(\"aria-activedescendant\", itemEl.id);\n }\n this._el.dispatchEvent(new CustomEvent(\"activeDescendantInit\", {\n detail: e.detail\n }));\n}\nfunction onModelChange(e) {\n const {\n fromIndex,\n toIndex\n } = e.detail;\n const fromItem = this.items[fromIndex];\n const toItem = this.items[toIndex];\n if (fromItem) {\n fromItem.classList.remove(this._options.activeDescendantClassName);\n }\n if (toItem) {\n toItem.classList.add(this._options.activeDescendantClassName);\n this._focusEl.setAttribute(\"aria-activedescendant\", toItem.id);\n if (this._options.autoScroll && this._itemContainerEl) {\n this._itemContainerEl.scrollTop = toItem.offsetTop - this._itemContainerEl.offsetHeight / 2;\n }\n }\n this._el.dispatchEvent(new CustomEvent(\"activeDescendantChange\", {\n detail: e.detail\n }));\n}\nfunction onModelReset(e) {\n const toIndex = e.detail.toIndex;\n const activeClassName = this._options.activeDescendantClassName;\n this.items.forEach(function (el) {\n el.classList.remove(activeClassName);\n });\n if (toIndex !== null && toIndex !== -1) {\n const itemEl = this.items[toIndex];\n itemEl.classList.add(activeClassName);\n this._focusEl.setAttribute(\"aria-activedescendant\", itemEl.id);\n } else {\n this._focusEl.removeAttribute(\"aria-activedescendant\");\n }\n this._el.dispatchEvent(new CustomEvent(\"activeDescendantReset\", {\n detail: e.detail\n }));\n}\nfunction onModelMutation(e) {\n const {\n toIndex\n } = e.detail;\n const activeDescendantClassName = this._options.activeDescendantClassName;\n this.items.forEach(function (item, index) {\n (0, _makeupNextId.default)(item);\n if (index !== toIndex) {\n item.classList.remove(activeDescendantClassName);\n } else {\n item.classList.add(activeDescendantClassName);\n }\n });\n this._el.dispatchEvent(new CustomEvent(\"activeDescendantMutation\", {\n detail: e.detail\n }));\n}\nclass ActiveDescendant {\n constructor(el) {\n this._el = el;\n this._onMutationListener = onModelMutation.bind(this);\n this._onChangeListener = onModelChange.bind(this);\n this._onResetListener = onModelReset.bind(this);\n this._onInitListener = onModelInit.bind(this);\n this._el.addEventListener(\"navigationModelMutation\", this._onMutationListener);\n this._el.addEventListener(\"navigationModelChange\", this._onChangeListener);\n this._el.addEventListener(\"navigationModelReset\", this._onResetListener);\n this._el.addEventListener(\"navigationModelInit\", this._onInitListener);\n }\n destroy() {\n this._el.removeEventListener(\"navigationModelMutation\", this._onMutationListener);\n this._el.removeEventListener(\"navigationModelChange\", this._onChangeListener);\n this._el.removeEventListener(\"navigationModelReset\", this._onResetListener);\n this._el.removeEventListener(\"navigationModelInit\", this._onInitListener);\n }\n}\nclass LinearActiveDescendant extends ActiveDescendant {\n constructor(el, focusEl, itemContainerEl, itemSelector, selectedOptions) {\n super(el);\n this._options = Object.assign({}, defaultOptions, selectedOptions);\n this._focusEl = focusEl;\n this._itemContainerEl = itemContainerEl;\n this._itemSelector = itemSelector;\n\n // ensure container has an id\n (0, _makeupNextId.default)(this._itemContainerEl);\n\n // if programmatic relationship set aria-owns\n if (this._itemContainerEl !== this._focusEl) {\n focusEl.setAttribute(\"aria-owns\", this._itemContainerEl.id);\n }\n this._navigationEmitter = NavigationEmitter.createLinear(el, itemSelector, {\n autoInit: this._options.autoInit,\n autoReset: this._options.autoReset,\n axis: this._options.axis,\n ignoreByDelegateSelector: this._options.ignoreByDelegateSelector,\n wrap: this._options.wrap\n });\n\n // ensure each item has an id\n this.items.forEach(function (itemEl) {\n (0, _makeupNextId.default)(itemEl);\n });\n }\n get index() {\n return this._navigationEmitter.model.index;\n }\n set index(newIndex) {\n this._navigationEmitter.model.index = newIndex;\n }\n reset() {\n this._navigationEmitter.model.reset();\n }\n get currentItem() {\n return this._navigationEmitter.model.currentItem;\n }\n get items() {\n return this._navigationEmitter.model.items;\n }\n set wrap(newWrap) {\n this._navigationEmitter.model.options.wrap = newWrap;\n }\n destroy() {\n super.destroy();\n this._navigationEmitter.destroy();\n }\n}\n\n/*\nclass GridActiveDescendant extends ActiveDescendant {\n constructor(el, focusEl, containerEl, rowSelector, cellSelector) {\n super(el);\n }\n}\n*/\n\nfunction createLinear(el, focusEl, itemContainerEl, itemSelector, selectedOptions) {\n return new LinearActiveDescendant(el, focusEl, itemContainerEl, itemSelector, selectedOptions);\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.addFocusExit = addFocusExit;\nexports.removeFocusExit = removeFocusExit;\nvar _makeupNextId = _interopRequireDefault(require(\"makeup-next-id\"));\nfunction _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }\nconst focusExitEmitters = {};\nfunction doFocusExit(el, fromElement, toElement) {\n el.dispatchEvent(new CustomEvent(\"focusExit\", {\n detail: {\n fromElement,\n toElement\n },\n bubbles: false // mirror the native mouseleave event\n }));\n}\nfunction onDocumentFocusIn(e) {\n const newFocusElement = e.target;\n const targetIsDescendant = this.el.contains(newFocusElement);\n\n // if focus has moved to a focusable descendant\n if (targetIsDescendant === true) {\n // set the target as the currently focussed element\n this.currentFocusElement = newFocusElement;\n } else {\n // else focus has not gone to a focusable descendant\n window.removeEventListener(\"blur\", this.onWindowBlurListener);\n document.removeEventListener(\"focusin\", this.onDocumentFocusInListener);\n doFocusExit(this.el, this.currentFocusElement, newFocusElement);\n this.currentFocusElement = null;\n }\n}\nfunction onWindowBlur() {\n doFocusExit(this.el, this.currentFocusElement, undefined);\n}\nfunction onWidgetFocusIn() {\n // listen for focus moving to anywhere in document\n // note that mouse click on buttons, checkboxes and radios does not trigger focus events in all browsers!\n document.addEventListener(\"focusin\", this.onDocumentFocusInListener);\n // listen for focus leaving the window\n window.addEventListener(\"blur\", this.onWindowBlurListener);\n}\nclass FocusExitEmitter {\n constructor(el) {\n this.el = el;\n this.currentFocusElement = null;\n this.onWidgetFocusInListener = onWidgetFocusIn.bind(this);\n this.onDocumentFocusInListener = onDocumentFocusIn.bind(this);\n this.onWindowBlurListener = onWindowBlur.bind(this);\n this.el.addEventListener(\"focusin\", this.onWidgetFocusInListener);\n }\n removeEventListeners() {\n window.removeEventListener(\"blur\", this.onWindowBlurListener);\n document.removeEventListener(\"focusin\", this.onDocumentFocusInListener);\n this.el.removeEventListener(\"focusin\", this.onWidgetFocusInListener);\n }\n}\nfunction addFocusExit(el) {\n let exitEmitter = null;\n (0, _makeupNextId.default)(el);\n if (!focusExitEmitters[el.id]) {\n exitEmitter = new FocusExitEmitter(el);\n focusExitEmitters[el.id] = exitEmitter;\n }\n return exitEmitter;\n}\nfunction removeFocusExit(el) {\n const exitEmitter = focusExitEmitters[el.id];\n if (exitEmitter) {\n exitEmitter.removeEventListeners();\n delete focusExitEmitters[el.id];\n }\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _makeupNextId = _interopRequireDefault(require(\"makeup-next-id\"));\nvar ExitEmitter = _interopRequireWildcard(require(\"makeup-exit-emitter\"));\nvar _makeupFocusables = _interopRequireDefault(require(\"makeup-focusables\"));\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != typeof e && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if (\"default\" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\nfunction _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }\nconst defaultOptions = {\n alwaysDoFocusManagement: false,\n ariaControls: true,\n autoCollapse: false,\n collapseOnFocusOut: false,\n collapseOnMouseOut: false,\n collapseOnClickOut: false,\n collapseOnHostFocus: false,\n contentSelector: \".expander__content\",\n expandedClass: null,\n expandOnClick: false,\n expandOnFocus: false,\n expandOnHover: false,\n focusManagement: null,\n hostSelector: \".expander__host\",\n simulateSpacebarClick: false\n};\nfunction onHostKeyDown(e) {\n if (e.keyCode === 13 || e.keyCode === 32) {\n this._keyboardClickFlag = true;\n }\n // if host element does not naturally trigger a click event on spacebar, we can force one to trigger here.\n // careful! if host already triggers click events naturally, we end up with a \"double-click\".\n if (e.keyCode === 32 && this.options.simulateSpacebarClick === true) {\n this.hostEl.click();\n }\n}\nfunction onHostMouseDown() {\n this._mouseClickFlag = true;\n}\nfunction onHostClick() {\n this._expandWasKeyboardClickActivated = this._keyboardClickFlag;\n this._expandWasMouseClickActivated = this._mouseClickFlag;\n this.expanded = !this.expanded;\n}\nfunction onHostFocus() {\n this._expandWasFocusActivated = true;\n this.expanded = true;\n}\nfunction onHostHover() {\n clearTimeout(this._mouseLeft);\n this._expandWasHoverActivated = true;\n this.expanded = true;\n}\nfunction onFocusExit() {\n this.expanded = false;\n}\nfunction onMouseLeave() {\n clearTimeout(this._mouseLeft);\n this._mouseLeft = setTimeout(() => {\n this.expanded = false;\n }, 300);\n}\nfunction _onDocumentClick(e) {\n if (this.el.contains(e.target) === false) {\n this.expanded = false;\n }\n}\nfunction _onDocumentTouchStart() {\n this.documentClick = true;\n}\nfunction _onDocumentTouchMove() {\n this.documentClick = false;\n}\nfunction _onDocumentTouchEnd(e) {\n if (this.documentClick === true) {\n this.documentClick = false;\n if (this.el.contains(e.target) === false) {\n this.expanded = false;\n }\n }\n}\nfunction manageFocus(focusManagement, contentEl) {\n if (focusManagement === \"content\") {\n contentEl.setAttribute(\"tabindex\", \"-1\");\n contentEl.focus();\n } else if (focusManagement === \"focusable\") {\n var _focusables$;\n (_focusables$ = (0, _makeupFocusables.default)(contentEl)[0]) === null || _focusables$ === void 0 || _focusables$.focus();\n } else if (focusManagement === \"interactive\") {\n var _focusables$2;\n (_focusables$2 = (0, _makeupFocusables.default)(contentEl, true)[0]) === null || _focusables$2 === void 0 || _focusables$2.focus();\n } else if (focusManagement !== null) {\n const el = contentEl.querySelector(\"#\".concat(focusManagement));\n if (el) {\n el.focus();\n }\n }\n}\nclass _default {\n constructor(el, selectedOptions) {\n this.options = Object.assign({}, defaultOptions, selectedOptions);\n this.el = el;\n this.hostEl = el.querySelector(this.options.hostSelector); // the keyboard focusable host el\n this.contentEl = el.querySelector(this.options.contentSelector);\n ExitEmitter.addFocusExit(this.el);\n this._hostKeyDownListener = onHostKeyDown.bind(this);\n this._hostMouseDownListener = onHostMouseDown.bind(this);\n this._documentClickListener = _onDocumentClick.bind(this);\n this._documentTouchStartListener = _onDocumentTouchStart.bind(this);\n this._documentTouchMoveListener = _onDocumentTouchMove.bind(this);\n this._documentTouchEndListener = _onDocumentTouchEnd.bind(this);\n this._hostClickListener = onHostClick.bind(this);\n this._hostFocusListener = onHostFocus.bind(this);\n this._hostHoverListener = onHostHover.bind(this);\n this._focusExitListener = onFocusExit.bind(this);\n this._mouseLeaveListener = onMouseLeave.bind(this);\n if (this.hostEl.getAttribute(\"aria-expanded\") === null) {\n this.hostEl.setAttribute(\"aria-expanded\", \"false\");\n }\n if (this.options.ariaControls === true) {\n // ensure the widget has an id\n (0, _makeupNextId.default)(this.el, \"expander\");\n this.contentEl.id = this.contentEl.id || \"\".concat(this.el.id, \"-content\");\n this.hostEl.setAttribute(\"aria-controls\", this.contentEl.id);\n }\n this.expandOnClick = this.options.expandOnClick;\n this.expandOnFocus = this.options.expandOnFocus;\n this.expandOnHover = this.options.expandOnHover;\n this.collapseOnHostFocus = this.options.collapseOnHostFocus;\n if (this.options.autoCollapse === false) {\n this.collapseOnClickOut = this.options.collapseOnClickOut;\n this.collapseOnFocusOut = this.options.collapseOnFocusOut;\n this.collapseOnMouseOut = this.options.collapseOnMouseOut;\n }\n }\n set expandOnClick(bool) {\n if (bool === true) {\n this.hostEl.addEventListener(\"keydown\", this._hostKeyDownListener);\n this.hostEl.addEventListener(\"mousedown\", this._hostMouseDownListener);\n this.hostEl.addEventListener(\"click\", this._hostClickListener);\n if (this.options.autoCollapse === true) {\n this.collapseOnClickOut = true;\n this.collapseOnFocusOut = true;\n }\n } else {\n this.hostEl.removeEventListener(\"click\", this._hostClickListener);\n this.hostEl.removeEventListener(\"mousedown\", this._hostMouseDownListener);\n this.hostEl.removeEventListener(\"keydown\", this._hostKeyDownListener);\n }\n }\n set expandOnFocus(bool) {\n if (bool === true) {\n this.hostEl.addEventListener(\"focus\", this._hostFocusListener);\n if (this.options.autoCollapse === true) {\n this.collapseOnClickOut = true;\n this.collapseOnFocusOut = true;\n }\n } else {\n this.hostEl.removeEventListener(\"focus\", this._hostFocusListener);\n }\n }\n set expandOnHover(bool) {\n if (bool === true) {\n this.hostEl.addEventListener(\"mouseenter\", this._hostHoverListener);\n this.contentEl.addEventListener(\"mouseenter\", this._hostHoverListener);\n if (this.options.autoCollapse === true) {\n this.collapseOnMouseOut = true;\n }\n } else {\n this.hostEl.removeEventListener(\"mouseenter\", this._hostHoverListener);\n this.contentEl.removeEventListener(\"mouseenter\", this._hostHoverListener);\n }\n }\n set collapseOnClickOut(bool) {\n if (bool === true) {\n document.addEventListener(\"click\", this._documentClickListener);\n document.addEventListener(\"touchstart\", this._documentTouchStartListener);\n document.addEventListener(\"touchmove\", this._documentTouchMoveListener);\n document.addEventListener(\"touchend\", this._documentTouchEndListener);\n } else {\n document.removeEventListener(\"click\", this._documentClickListener);\n document.removeEventListener(\"touchstart\", this._documentTouchStartListener);\n document.removeEventListener(\"touchmove\", this._documentTouchMoveListener);\n document.removeEventListener(\"touchend\", this._documentTouchEndListener);\n }\n }\n set collapseOnFocusOut(bool) {\n if (bool === true) {\n this.el.addEventListener(\"focusExit\", this._focusExitListener);\n } else {\n this.el.removeEventListener(\"focusExit\", this._focusExitListener);\n }\n }\n set collapseOnHostFocus(bool) {\n if (bool === true) {\n this.contentEl.addEventListener(\"focusExit\", this._focusExitListener);\n } else {\n this.contentEl.removeEventListener(\"focusExit\", this._focusExitListener);\n }\n }\n set collapseOnMouseOut(bool) {\n if (bool === true) {\n this.el.addEventListener(\"mouseleave\", this._mouseLeaveListener);\n this.contentEl.addEventListener(\"mouseleave\", this._mouseLeaveListener);\n } else {\n this.el.removeEventListener(\"mouseleave\", this._mouseLeaveListener);\n this.contentEl.removeEventListener(\"mouseleave\", this._mouseLeaveListener);\n }\n }\n get expanded() {\n return this.hostEl.getAttribute(\"aria-expanded\") === \"true\";\n }\n set expanded(bool) {\n if (bool === true && this.expanded === false) {\n this.hostEl.setAttribute(\"aria-expanded\", \"true\");\n if (this.options.expandedClass) {\n this.el.classList.add(this.options.expandedClass);\n }\n if (this._expandWasKeyboardClickActivated || this._expandWasMouseClickActivated && this.options.alwaysDoFocusManagement) {\n manageFocus(this.options.focusManagement, this.contentEl);\n }\n this.el.dispatchEvent(new CustomEvent(\"expander-expand\", {\n bubbles: true,\n detail: this.contentEl\n }));\n }\n if (bool === false && this.expanded === true) {\n this.hostEl.setAttribute(\"aria-expanded\", \"false\");\n if (this.options.expandedClass) {\n this.el.classList.remove(this.options.expandedClass);\n }\n this.el.dispatchEvent(new CustomEvent(\"expander-collapse\", {\n bubbles: true,\n detail: this.contentEl\n }));\n }\n this._expandWasKeyboardClickActivated = false;\n this._expandWasMouseClickActivated = false;\n this._expandWasFocusActivated = false;\n this._expandWasHoverActivated = false;\n this._keyboardClickFlag = false;\n this._mouseClickFlag = false;\n }\n sleep() {\n if (this._destroyed !== true) {\n this.expandOnClick = false;\n this.expandOnFocus = false;\n this.expandOnHover = false;\n this.collapseOnClickOut = false;\n this.collapseOnFocusOut = false;\n this.collapseOnMouseOut = false;\n }\n }\n destroy() {\n this.sleep();\n this._destroyed = true;\n this._hostKeyDownListener = null;\n this._hostMouseDownListener = null;\n this._documentClickListener = null;\n this._documentTouchStartListener = null;\n this._documentTouchMoveListener = null;\n this._documentTouchEndListener = null;\n this._hostClickListener = null;\n this._hostFocusListener = null;\n this._hostHoverListener = null;\n this._focusExitListener = null;\n this._mouseLeaveListener = null;\n }\n}\nexports.default = _default;\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = _default;\nconst focusableElList = [\"a[href]\", \"area[href]\", \"button:not([disabled])\", \"embed\", \"iframe\", \"input:not([disabled])\", \"object\", \"select:not([disabled])\", \"textarea:not([disabled])\", \"*[tabindex]\", \"*[contenteditable]\"];\nconst focusableElSelector = focusableElList.join();\nfunction _default(el) {\n let keyboardOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n let callback = arguments.length > 2 ? arguments[2] : undefined;\n if (callback) {\n const request = requestAnimationFrame(() => {\n callback(getFocusables(el, keyboardOnly));\n });\n return () => {\n cancelAnimationFrame(request);\n };\n }\n return getFocusables(el, keyboardOnly);\n}\nfunction getFocusables(el) {\n let keyboardOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n let focusableEls = Array.prototype.slice.call(el.querySelectorAll(focusableElSelector));\n\n // filter out elements with display: none or nested in a display: none parent\n focusableEls = focusableEls.filter(function (focusableEl) {\n return !!(focusableEl.offsetWidth || focusableEl.offsetHeight || focusableEl.getClientRects().length);\n });\n if (keyboardOnly === true) {\n focusableEls = focusableEls.filter(function (focusableEl) {\n return focusableEl.getAttribute(\"tabindex\") !== \"-1\";\n });\n }\n return focusableEls;\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.add = add;\nexports.addKeyDown = addKeyDown;\nexports.addKeyUp = addKeyUp;\nexports.remove = remove;\nexports.removeKeyDown = removeKeyDown;\nexports.removeKeyUp = removeKeyUp;\nfunction uncapitalizeFirstLetter(str) {\n return str.charAt(0).toLowerCase() + str.slice(1);\n}\nfunction onKeyDownOrUp(evt, el, keyEventType) {\n if (!evt.shiftKey) {\n const key = evt.key;\n switch (key) {\n case \"Enter\":\n case \"Escape\":\n case \"PageUp\":\n case \"PageDown\":\n case \"End\":\n case \"Home\":\n case \"ArrowLeft\":\n case \"ArrowUp\":\n case \"ArrowRight\":\n case \"ArrowDown\":\n el.dispatchEvent(new CustomEvent(uncapitalizeFirstLetter(\"\".concat(key, \"Key\").concat(keyEventType)), {\n detail: evt,\n bubbles: true\n }));\n break;\n case \" \":\n el.dispatchEvent(new CustomEvent(\"spacebarKey\".concat(keyEventType), {\n detail: evt,\n bubbles: true\n }));\n break;\n default:\n return;\n }\n }\n}\nfunction onKeyDown(e) {\n onKeyDownOrUp(e, this, \"Down\");\n}\nfunction onKeyUp(e) {\n onKeyDownOrUp(e, this, \"Up\");\n}\nfunction addKeyDown(el) {\n el.addEventListener(\"keydown\", onKeyDown);\n}\nfunction addKeyUp(el) {\n el.addEventListener(\"keyup\", onKeyUp);\n}\nfunction removeKeyDown(el) {\n el.removeEventListener(\"keydown\", onKeyDown);\n}\nfunction removeKeyUp(el) {\n el.removeEventListener(\"keyup\", onKeyUp);\n}\nfunction add(el) {\n addKeyDown(el);\n addKeyUp(el);\n}\nfunction remove(el) {\n removeKeyDown(el);\n removeKeyUp(el);\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.createLinear = createLinear;\nvar KeyEmitter = _interopRequireWildcard(require(\"makeup-key-emitter\"));\nvar ExitEmitter = _interopRequireWildcard(require(\"makeup-exit-emitter\"));\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != typeof e && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if (\"default\" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\nconst defaultOptions = {\n axis: \"both\",\n autoInit: \"interactive\",\n autoReset: \"current\",\n ignoreByDelegateSelector: null,\n wrap: false\n};\nfunction isItemNavigable(el) {\n return !el.hidden && el.getAttribute(\"aria-disabled\") !== \"true\";\n}\nfunction isIndexNavigable(items, index) {\n return index >= 0 && index < items.length ? isItemNavigable(items[index]) : false;\n}\nfunction findNavigableItems(items) {\n return items.filter(isItemNavigable);\n}\nfunction findFirstNavigableIndex(items) {\n return items.findIndex(item => isItemNavigable(item));\n}\nfunction findLastNavigableIndex(items) {\n // todo: at(-1) is more performant than reverse(), but Babel is not transpiling it\n return items.indexOf(findNavigableItems(items).reverse()[0]);\n}\nfunction findIndexByAttribute(items, attribute, value) {\n return items.findIndex(item => isItemNavigable(item) && item.getAttribute(attribute) === value);\n}\nfunction findFirstNavigableAriaCheckedIndex(items) {\n return findIndexByAttribute(items, \"aria-checked\", \"true\");\n}\nfunction findFirstNavigableAriaSelectedIndex(items) {\n return findIndexByAttribute(items, \"aria-selected\", \"true\");\n}\nfunction findIgnoredByDelegateItems(el, options) {\n return options.ignoreByDelegateSelector !== null ? [...el.querySelectorAll(options.ignoreByDelegateSelector)] : [];\n}\nfunction findPreviousNavigableIndex(items, index, wrap) {\n let previousNavigableIndex = -1;\n if (index === null || atStart(items, index)) {\n if (wrap === true) {\n previousNavigableIndex = findLastNavigableIndex(items);\n }\n } else {\n let i = index;\n while (--i >= 0) {\n if (isItemNavigable(items[i])) {\n previousNavigableIndex = i;\n break;\n }\n }\n }\n return previousNavigableIndex;\n}\nfunction findNextNavigableIndex(items, index, wrap) {\n let nextNavigableIndex = -1;\n if (index === null) {\n nextNavigableIndex = findFirstNavigableIndex(items);\n } else if (atEnd(items, index)) {\n if (wrap === true) {\n nextNavigableIndex = findFirstNavigableIndex(items);\n }\n } else {\n let i = index;\n while (++i < items.length) {\n if (isItemNavigable(items[i])) {\n nextNavigableIndex = i;\n break;\n }\n }\n }\n return nextNavigableIndex;\n}\n\n// returning -1 means not found\nfunction findIndexPositionByType(typeOrNum, items, currentIndex) {\n let index = -1;\n switch (typeOrNum) {\n case \"none\":\n index = null;\n break;\n case \"current\":\n index = currentIndex;\n break;\n case \"interactive\":\n index = findFirstNavigableIndex(items);\n break;\n case \"ariaChecked\":\n index = findFirstNavigableAriaCheckedIndex(items);\n break;\n case \"ariaSelected\":\n index = findFirstNavigableAriaSelectedIndex(items);\n break;\n case \"ariaSelectedOrInteractive\":\n index = findFirstNavigableAriaSelectedIndex(items);\n index = index === -1 ? findFirstNavigableIndex(items) : index;\n break;\n default:\n index = typeof typeOrNum === \"number\" || typeOrNum === null ? typeOrNum : -1;\n }\n return index;\n}\nfunction atStart(items, index) {\n return index === findFirstNavigableIndex(items);\n}\nfunction atEnd(items, index) {\n return index === findLastNavigableIndex(items);\n}\nfunction onKeyPrev(e) {\n const ignoredByDelegateItems = findIgnoredByDelegateItems(this._el, this.options);\n\n // todo: update KeyEmitter to deal with ignored items?\n if (ignoredByDelegateItems.length === 0 || !ignoredByDelegateItems.includes(e.detail.target)) {\n this.index = findPreviousNavigableIndex(this.items, this.index, this.options.wrap);\n }\n}\nfunction onKeyNext(e) {\n const ignoredByDelegateItems = findIgnoredByDelegateItems(this._el, this.options);\n\n // todo: update KeyEmitter to deal with ignored items?\n if (ignoredByDelegateItems.length === 0 || !ignoredByDelegateItems.includes(e.detail.target)) {\n this.index = findNextNavigableIndex(this.items, this.index, this.options.wrap);\n }\n}\nfunction onClick(e) {\n const itemIndex = this.indexOf(e.target.closest(this._itemSelector));\n if (isIndexNavigable(this.items, itemIndex)) {\n this.index = itemIndex;\n }\n}\nfunction onKeyHome(e) {\n const ignoredByDelegateItems = findIgnoredByDelegateItems(this._el, this.options);\n\n // todo: update KeyEmitter to deal with ignored items?\n if (ignoredByDelegateItems.length === 0 || !ignoredByDelegateItems.includes(e.detail.target)) {\n this.index = findFirstNavigableIndex(this.items);\n }\n}\nfunction onKeyEnd(e) {\n const ignoredByDelegateItems = findIgnoredByDelegateItems(this._el, this.options);\n\n // todo: update KeyEmitter to deal with ignored items?\n if (ignoredByDelegateItems.length === 0 || !ignoredByDelegateItems.includes(e.detail.target)) {\n this.index = findLastNavigableIndex(this.items);\n }\n}\nfunction onFocusExit() {\n if (this.options.autoReset !== null) {\n this.reset();\n }\n}\nfunction onMutation(e) {\n const fromIndex = this.index;\n let toIndex = this.index;\n // https://developer.mozilla.org/en-US/docs/Web/API/MutationRecord\n const {\n addedNodes,\n attributeName,\n removedNodes,\n target,\n type\n } = e[0];\n if (type === \"attributes\") {\n if (target === this.currentItem) {\n if (attributeName === \"aria-disabled\") {\n // current item was disabled - keep it as current index (until a keyboard navigation happens)\n toIndex = this.index;\n } else if (attributeName === \"hidden\") {\n // current item was hidden and focus is lost - reset index to first interactive element\n toIndex = findFirstNavigableIndex(this.items);\n }\n } else {\n toIndex = this.index;\n }\n } else if (type === \"childList\") {\n if (removedNodes.length > 0 && [...removedNodes].includes(this._cachedElement)) {\n // current item was removed and focus is lost - reset index to first interactive element\n toIndex = findFirstNavigableIndex(this.items);\n } else if (removedNodes.length > 0 || addedNodes.length > 0) {\n // nodes were added and/or removed - keep current item and resync its index\n toIndex = this.indexOf(this._cachedElement);\n }\n }\n this._index = toIndex;\n this._el.dispatchEvent(new CustomEvent(\"navigationModelMutation\", {\n bubbles: false,\n detail: {\n fromIndex,\n toIndex\n }\n }));\n}\nclass NavigationModel {\n /**\n * @param {HTMLElement} el\n * @param {string} itemSelector\n * @param {typeof defaultOptions} selectedOptions\n */\n constructor(el, itemSelector, selectedOptions) {\n /** @member {typeof defaultOptions} */\n this.options = Object.assign({}, defaultOptions, selectedOptions);\n\n /** @member {HTMLElement} */\n this._el = el;\n\n /** @member {string} */\n this._itemSelector = itemSelector;\n }\n}\nclass LinearNavigationModel extends NavigationModel {\n /**\n * @param {HTMLElement} el\n * @param {string} itemSelector\n * @param {typeof defaultOptions} selectedOptions\n */\n constructor(el, itemSelector, selectedOptions) {\n super(el, itemSelector, selectedOptions);\n const fromIndex = this._index;\n const toIndex = findIndexPositionByType(this.options.autoInit, this.items, this.index);\n\n // do not use setter as it will trigger a change event\n this._index = toIndex;\n\n // always keep an element reference to the last item (for use in mutation observer)\n // todo: convert index to Tuple to store last/current values instead?\n this._cachedElement = this.items[toIndex];\n this._el.dispatchEvent(new CustomEvent(\"navigationModelInit\", {\n bubbles: false,\n detail: {\n firstInteractiveIndex: this.firstNavigableIndex,\n fromIndex,\n items: this.items,\n toIndex\n }\n }));\n }\n get currentItem() {\n return this.items[this.index];\n }\n\n // todo: code smell as getter abstracts that the query selector re-runs every time getter is accessed\n get items() {\n return [...this._el.querySelectorAll(\"\".concat(this._itemSelector))];\n }\n get index() {\n return this._index;\n }\n\n /**\n * @param {number} toIndex - update index position in this.items (non-interactive indexes fail silently)\n */\n set index(toIndex) {\n if (toIndex === this.index) {\n return;\n } else if (!isIndexNavigable(this.items, toIndex)) {\n // no-op. throw exception?\n } else {\n const fromIndex = this.index;\n // update cached element reference (for use in mutation observer if DOM node gets removed)\n this._cachedElement = this.items[toIndex];\n this._index = toIndex;\n this._el.dispatchEvent(new CustomEvent(\"navigationModelChange\", {\n bubbles: false,\n detail: {\n fromIndex,\n toIndex\n }\n }));\n }\n }\n indexOf(element) {\n return this.items.indexOf(element);\n }\n reset() {\n const fromIndex = this.index;\n const toIndex = findIndexPositionByType(this.options.autoReset, this.items, this.index);\n if (toIndex !== fromIndex) {\n // do not use setter as it will trigger a navigationModelChange event\n this._index = toIndex;\n this._el.dispatchEvent(new CustomEvent(\"navigationModelReset\", {\n bubbles: false,\n detail: {\n fromIndex,\n toIndex\n }\n }));\n }\n }\n}\n\n// 2D Grid Model will go here\n\n/*\nclass GridModel extends NavigationModel {\n constructor(el, rowSelector, colSelector) {\n super();\n this._coords = null;\n }\n}\n*/\n\nclass NavigationEmitter {\n /**\n * @param {HTMLElement} el\n * @param {LinearNavigationModel} model\n */\n constructor(el, model) {\n this.model = model;\n this.el = el;\n this._keyPrevListener = onKeyPrev.bind(model);\n this._keyNextListener = onKeyNext.bind(model);\n this._keyHomeListener = onKeyHome.bind(model);\n this._keyEndListener = onKeyEnd.bind(model);\n this._clickListener = onClick.bind(model);\n this._focusExitListener = onFocusExit.bind(model);\n this._observer = new MutationObserver(onMutation.bind(model));\n KeyEmitter.addKeyDown(this.el);\n ExitEmitter.addFocusExit(this.el);\n const axis = model.options.axis;\n if (axis === \"both\" || axis === \"x\") {\n this.el.addEventListener(\"arrowLeftKeyDown\", this._keyPrevListener);\n this.el.addEventListener(\"arrowRightKeyDown\", this._keyNextListener);\n }\n if (axis === \"both\" || axis === \"y\") {\n this.el.addEventListener(\"arrowUpKeyDown\", this._keyPrevListener);\n this.el.addEventListener(\"arrowDownKeyDown\", this._keyNextListener);\n }\n this.el.addEventListener(\"homeKeyDown\", this._keyHomeListener);\n this.el.addEventListener(\"endKeyDown\", this._keyEndListener);\n this.el.addEventListener(\"click\", this._clickListener);\n this.el.addEventListener(\"focusExit\", this._focusExitListener);\n this._observer.observe(this.el, {\n childList: true,\n subtree: true,\n attributeFilter: [\"aria-disabled\", \"hidden\"],\n attributes: true,\n attributeOldValue: true\n });\n }\n destroy() {\n KeyEmitter.removeKeyDown(this.el);\n ExitEmitter.removeFocusExit(this.el);\n this.el.removeEventListener(\"arrowLeftKeyDown\", this._keyPrevListener);\n this.el.removeEventListener(\"arrowRightKeyDown\", this._keyNextListener);\n this.el.removeEventListener(\"arrowUpKeyDown\", this._keyPrevListener);\n this.el.removeEventListener(\"arrowDownKeyDown\", this._keyNextListener);\n this.el.removeEventListener(\"homeKeyDown\", this._keyHomeListener);\n this.el.removeEventListener(\"endKeyDown\", this._keyEndListener);\n this.el.removeEventListener(\"click\", this._clickListener);\n this.el.removeEventListener(\"focusExit\", this._focusExitListener);\n this._observer.disconnect();\n }\n}\nfunction createLinear(el, itemSelector, selectedOptions) {\n const model = new LinearNavigationModel(el, itemSelector, selectedOptions);\n return new NavigationEmitter(el, model);\n}\n\n/*\nstatic createGrid(el, rowSelector, colSelector, selectedOptions) {\n return null;\n}\n*/\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = _default;\nconst sequenceMap = {};\nconst defaultPrefix = \"nid\";\nconst randomPortion = createRandomPortion(3);\nfunction randomNumber(max) {\n return Math.floor(Math.random() * max);\n}\nfunction createRandomPortion(size) {\n const letters = \"abcdefghijklmnopqrstuvwxyz\";\n const digits = \"0123456789\";\n const allChars = letters + digits;\n\n // to ensure a valid HTML ID (when prefix is empty), first character must be a letter\n let portion = letters[randomNumber(25)];\n\n // start iterating from 1, as we already have our first char\n for (let i = 1; i < size; i++) {\n portion += allChars[randomNumber(35)];\n }\n return portion;\n}\nfunction _default(el) {\n let prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultPrefix;\n const separator = prefix === \"\" ? \"\" : \"-\";\n\n // join first prefix with random portion to create key\n const key = \"\".concat(prefix).concat(separator).concat(randomPortion);\n\n // initialise key in sequence map if necessary\n sequenceMap[key] = sequenceMap[key] || 0;\n if (!el.id) {\n el.setAttribute(\"id\", \"\".concat(key, \"-\").concat(sequenceMap[key]++));\n }\n return el.id;\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.add = add;\nexports.remove = remove;\nfunction onKeyDown(e) {\n if (e.keyCode >= 32 && e.keyCode <= 40) {\n e.preventDefault();\n }\n}\nfunction add(el) {\n el.addEventListener(\"keydown\", onKeyDown);\n}\nfunction remove(el) {\n el.removeEventListener(\"keydown\", onKeyDown);\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _makeupExpander = _interopRequireDefault(require(\"makeup-expander\"));\nvar _makeupListbox = _interopRequireDefault(require(\"makeup-listbox\"));\nfunction _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }\nconst defaultOptions = {\n autoSelect: true,\n collapseTimeout: 150,\n customElementMode: false,\n autoScroll: true\n};\nclass _default {\n constructor(widgetEl, selectedOptions) {\n this._options = Object.assign({}, defaultOptions, selectedOptions);\n this._el = widgetEl;\n this._inputEl = this._el.querySelector(\"input\");\n this._listboxEl = this._el.querySelector(\".combobox__listbox\");\n this._autocompleteType = this._inputEl.getAttribute(\"aria-autocomplete\");\n this._inputEl.setAttribute(\"autocomplete\", \"off\");\n this._inputEl.setAttribute(\"role\", \"combobox\");\n this._listboxEl.hidden = false;\n this._listboxWidget = new _makeupListbox.default(this._listboxEl, {\n activeDescendantClassName: \"combobox__option--active\",\n autoReset: -1,\n autoSelect: this._options.autoSelect,\n focusableElement: this._inputEl,\n listboxOwnerElement: this._el,\n autoScroll: this._options.autoScroll\n });\n this._expander = new _makeupExpander.default(this._el, {\n collapseOnClickOut: true,\n collapseOnFocusOut: true,\n contentSelector: \".combobox__listbox\",\n expandedClass: \"combobox--expanded\",\n expandOnFocus: true,\n hostSelector: \"input\"\n });\n this._destroyed = false;\n this._onInputFocusListener = _onInputFocus.bind(this);\n this._onListboxClickListener = _onListboxClick.bind(this);\n this._onListboxActiveDescendantChangeListener = _onListboxActiveDescendantChange.bind(this);\n this._onTextboxKeyDownListener = _onTextboxKeyDown.bind(this);\n this._onTextboxInputListener = _onTextboxInput.bind(this);\n this._onTextboxClickListener = _onTextboxClick.bind(this);\n this._onMutationListener = _onMutation.bind(this);\n this._el.classList.add(\"combobox--js\");\n if (!this._options.customElementMode) {\n this._mutationObserver = new MutationObserver(this._onMutationListener);\n this._observeMutations();\n this._observeEvents();\n }\n }\n resetFilter() {\n this._listboxWidget._activeDescendant.reset();\n this._listboxWidget.items.forEach(el => el.hidden = false);\n }\n _observeMutations() {\n if (!this._options.customElementMode) {\n this._mutationObserver.observe(this._inputEl, {\n attributes: true,\n childList: true,\n subtree: true\n });\n }\n }\n _unobserveMutations() {\n if (!this._options.customElementMode) {\n this._mutationObserver.disconnect();\n }\n }\n _observeEvents() {\n if (this._destroyed !== true) {\n this._listboxEl.addEventListener(\"click\", this._onListboxClickListener);\n this._listboxWidget._activeDescendantRootEl.addEventListener(\"activeDescendantChange\", this._onListboxActiveDescendantChangeListener);\n this._inputEl.addEventListener(\"focus\", this._onInputFocusListener);\n this._inputEl.addEventListener(\"keydown\", this._onTextboxKeyDownListener);\n this._inputEl.addEventListener(\"input\", this._onTextboxInputListener);\n this._inputEl.addEventListener(\"click\", this._onTextboxClickListener);\n }\n }\n _unobserveEvents() {\n this._listboxEl.removeEventListener(\"click\", this._onListboxClickListener);\n this._listboxWidget._activeDescendantRootEl.removeEventListener(\"activeDescendantChange\", this._onListboxActiveDescendantChangeListener);\n this._inputEl.removeEventListener(\"focus\", this._onInputFocusListener);\n this._inputEl.removeEventListener(\"keydown\", this._onTextboxKeyDownListener);\n this._inputEl.removeEventListener(\"input\", this._onTextboxInputListener);\n this._inputEl.removeEventListener(\"click\", this._onTextboxClickListener);\n }\n destroy() {\n this._destroyed = true;\n this._unobserveMutations();\n this._unobserveEvents();\n this._onInputFocusListener = null;\n this._onListboxClickListener = null;\n this._onListboxActiveDesendanctChangeListener = null;\n this._onTextboxKeyDownListener = null;\n this._onTextboxInputListener = null;\n this._onTextboxClickListener = null;\n this._onMutationListener = null;\n }\n}\nexports.default = _default;\nfunction _onInputFocus() {\n if (this._autocompleteType === \"list\") {\n _filterSuggestions(this._inputEl.value, this._listboxWidget.items);\n } else {\n this.resetFilter();\n }\n}\nfunction _onTextboxKeyDown(e) {\n // up and down keys should not move caret\n if (e.keyCode === 38 || e.keyCode === 40) {\n e.preventDefault();\n }\n\n // down arrow key should always expand listbox\n if (e.keyCode === 40) {\n if (this._expander.expanded === false) {\n this._expander.expanded = true;\n }\n }\n\n // escape key should always collapse listbox\n if (e.keyCode === 27) {\n if (this._expander.expanded === true) {\n this._expander.expanded = false;\n this._listboxWidget._activeDescendant.reset();\n }\n }\n\n // for manual selection, ENTER should not submit form when there is an active descendant\n if (this._options.autoSelect === false && e.keyCode === 13 && this._inputEl.getAttribute(\"aria-activedescendant\")) {\n e.preventDefault();\n const widget = this;\n this._inputEl.value = this._listboxWidget.items[this._listboxWidget._activeDescendant.index].innerText;\n _dispatchChangeEvent(this._el, this._inputEl.value);\n this._listboxWidget._activeDescendant.reset();\n setTimeout(function () {\n widget._expander.expanded = false;\n if (widget._autocompleteType === \"list\") {\n if (widget._inputEl.value.length === 0) {\n widget.resetFilter();\n } else {\n _filterSuggestions(widget._inputEl.value, widget._listboxWidget.items);\n }\n }\n }, this._options.collapseTimeout);\n }\n}\nfunction _onTextboxClick() {\n if (this._expander.expanded === false) {\n this._expander.expanded = true;\n }\n}\nfunction _onTextboxInput() {\n if (this._expander.expanded === false) {\n this._expander.expanded = true;\n }\n // TODO: refactor this redundant logic with L165: L171\n if (this._autocompleteType === \"list\") {\n this._listboxWidget._activeDescendant.reset();\n if (this._inputEl.value.length === 0) {\n this.resetFilter();\n } else {\n _filterSuggestions(this._inputEl.value, this._listboxWidget.items);\n }\n }\n}\nfunction _onListboxClick(e) {\n const widget = this;\n const element = e.target.closest(\"[role=option]\");\n const indexData = this._listboxWidget.items.indexOf(element);\n if (indexData !== undefined) {\n this._inputEl.value = this._listboxWidget.items[indexData].innerText;\n\n // TODO: refactor this redundant logic with L165: L171\n if (this._autocompleteType === \"list\") {\n this._listboxWidget._activeDescendant.reset();\n if (this._inputEl.value.length === 0) {\n this.resetFilter();\n } else {\n _filterSuggestions(this._inputEl.value, this._listboxWidget.items);\n }\n }\n if (this._options.autoSelect === false) {\n _dispatchChangeEvent(this._el, this._inputEl.value);\n }\n setTimeout(function () {\n widget._expander.expanded = false;\n }, this._options.collapseTimeout);\n }\n}\nfunction _onListboxActiveDescendantChange(e) {\n if (this._options.autoSelect === true) {\n this._inputEl.value = this._listboxWidget.items[e.detail.toIndex].innerText;\n _dispatchChangeEvent(this._el, this._inputEl.value);\n }\n}\nfunction _onMutation(mutationsList) {\n for (const mutation of mutationsList) {\n if (mutation.type === \"attributes\") {\n this._el.dispatchEvent(new CustomEvent(\"makeup-combobox-mutation\", {\n detail: {\n attributeName: mutation.attributeName\n }\n }));\n }\n }\n}\nfunction _filterSuggestions(value, items) {\n const numChars = value.length;\n const currentValue = value.toLowerCase();\n const matchedItems = items.filter(el => {\n return el.innerText.trim().substring(0, numChars).toLowerCase() === currentValue;\n });\n const unmatchedItems = items.filter(el => {\n return el.innerText.trim().substring(0, numChars).toLowerCase() !== currentValue;\n });\n matchedItems.forEach(el => el.hidden = false);\n unmatchedItems.forEach(el => el.hidden = true);\n}\nfunction _dispatchChangeEvent(el, value) {\n el.dispatchEvent(new CustomEvent(\"makeup-combobox-change\", {\n detail: {\n value\n }\n }));\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar ActiveDescendant = _interopRequireWildcard(require(\"makeup-active-descendant\"));\nvar PreventScrollKeys = _interopRequireWildcard(require(\"makeup-prevent-scroll-keys\"));\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != typeof e && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if (\"default\" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\n/**\n * A listbox can be a standalone focusable widget, or controlled by a separate, focusable widget\n * (a textbox for example, in the case of a combobox or datepicker)\n *\n * This listbox code currently supports single-selct only!\n * This code has been copied from Skin & MIND Patterns and has not yet been cleaned up.\n */\n\nconst defaultOptions = {\n activeDescendantClassName: \"listbox__option--active\",\n // the classname applied to the current active desdcendant\n autoInit: \"ariaSelectedOrInteractive\",\n autoReset: \"ariaSelectedOrInteractive\",\n autoSelect: true,\n // when true, aria-checked state matches active-descendant\n autoScroll: true,\n // when true, the listbox will scroll to keep the activeDescendant in view\n customElementMode: false,\n focusableElement: null,\n // used in a combobox/datepicker scenario\n listboxOwnerElement: null,\n // used in a combobox/datepicker scenario\n multiSelect: false,\n // todo\n useAriaChecked: true,\n // doubles up on support for aria-selected to announce visible selected/checked state\n valueSelector: \".listbox__value\" // Selector to get value from\n};\nfunction isSpacebarOrEnter(keyCode) {\n return keyCode === 13 || keyCode === 32;\n}\nclass _default {\n constructor(widgetEl, selectedOptions) {\n this._options = Object.assign({}, defaultOptions, selectedOptions);\n this.el = widgetEl;\n\n // in cases such as combobox, the active-descendant logic is controlled by a parent widget\n this._activeDescendantRootEl = this._options.listboxOwnerElement || this.el;\n\n // todo: not sure this check is needed any more\n if (widgetEl.getAttribute(\"role\") === \"listbox\") {\n this._listboxEl = widgetEl;\n } else {\n this._listboxEl = this.el.querySelector(\"[role=listbox]\");\n }\n if (!this._options.focusableElement && this._listboxEl.getAttribute(\"tabindex\") === null) {\n this._listboxEl.setAttribute(\"tabindex\", \"0\");\n }\n PreventScrollKeys.add(this.el);\n this._onKeyDownListener = _onKeyDown.bind(this);\n this._onClickListener = _onClick.bind(this);\n this._onActiveDescendantChangeListener = _onActiveDescendantChange.bind(this);\n this._onMutationListener = _onMutation.bind(this);\n this.el.classList.add(\"listbox--js\");\n if (!this._options.customElementMode) {\n this._mutationObserver = new MutationObserver(this._onMutationListener);\n this._observeMutations();\n this._observeEvents();\n }\n this._activeDescendant = ActiveDescendant.createLinear(this._activeDescendantRootEl, this._options.focusableElement || this._listboxEl, this._listboxEl.parentElement, \"[role=option]\", {\n activeDescendantClassName: this._options.activeDescendantClassName,\n autoInit: this._options.autoInit,\n autoReset: this._options.autoReset,\n autoScroll: this._options.autoScroll,\n axis: \"y\"\n });\n }\n _observeMutations() {\n if (!this._options.customElementMode) {\n this._mutationObserver.observe(this._listboxEl, {\n attributeFilter: [\"aria-selected\"],\n attributes: true,\n childList: true,\n subtree: true\n });\n }\n }\n _unobserveMutations() {\n if (!this._options.customElementMode) {\n this._mutationObserver.disconnect();\n }\n }\n _observeEvents() {\n if (this._destroyed !== true) {\n this._activeDescendantRootEl.addEventListener(\"activeDescendantChange\", this._onActiveDescendantChangeListener);\n this._listboxEl.addEventListener(\"keydown\", this._onKeyDownListener);\n this._listboxEl.addEventListener(\"click\", this._onClickListener);\n }\n }\n _unobserveEvents() {\n this._listboxEl.removeEventListener(\"keydown\", this._onKeyDownListener);\n this._listboxEl.removeEventListener(\"click\", this._onClickListener);\n this._activeDescendantRootEl.removeEventListener(\"activeDescendantChange\", this._onActiveDescendantChangeListener);\n }\n get index() {\n return this.items.findIndex(el => el.getAttribute(\"aria-selected\") === \"true\");\n }\n get items() {\n return this._activeDescendant.items;\n }\n select(index) {\n this._unobserveMutations();\n const itemEl = this.items[index];\n if (itemEl && itemEl.getAttribute(\"aria-disabled\") !== \"true\") {\n const matchingItem = this.items[index];\n let optionValue;\n matchingItem.setAttribute(\"aria-selected\", \"true\");\n if (this._options.useAriaChecked === true) {\n matchingItem.setAttribute(\"aria-checked\", \"true\");\n }\n optionValue = matchingItem.innerText;\n\n // Check if value selector is present and use that to get innerText instead\n // If its not present, will default to innerText of the whole item\n if (this._options.valueSelector) {\n const valueSelector = matchingItem.querySelector(this._options.valueSelector);\n if (valueSelector) {\n optionValue = valueSelector.innerText;\n }\n }\n this.el.dispatchEvent(new CustomEvent(\"makeup-listbox-change\", {\n detail: {\n el: matchingItem,\n optionIndex: index,\n optionValue\n }\n }));\n }\n this._observeMutations();\n }\n unselect(index) {\n this._unobserveMutations();\n const itemEl = this.items[index];\n if (itemEl && itemEl.getAttribute(\"aria-disabled\") !== \"true\") {\n const matchingItem = this.items[index];\n matchingItem.setAttribute(\"aria-selected\", \"false\");\n if (this._options.useAriaChecked === true) {\n matchingItem.setAttribute(\"aria-checked\", \"false\");\n }\n }\n this._observeMutations();\n }\n destroy() {\n this._destroyed = true;\n this._unobserveMutations();\n this._unobserveEvents();\n this._onKeyDownListener = null;\n this._onClickListener = null;\n this._onActiveDescendantChangeListener = null;\n this._onMutationListener = null;\n }\n}\nexports.default = _default;\nfunction _onKeyDown(e) {\n const activeDescendantEl = this._activeDescendant.currentItem;\n if (isSpacebarOrEnter(e.keyCode) && (activeDescendantEl === null || activeDescendantEl === void 0 ? void 0 : activeDescendantEl.getAttribute(\"aria-selected\")) !== \"true\") {\n // todo: this.select() should take care of unselecting any existing selections\n this.unselect(this.index);\n this.select(this._activeDescendant.index);\n }\n}\nfunction _onClick(e) {\n // unlike the keyDown event, the click event target can be a child element of the option\n // e.g.
Item 1
\n const toEl = e.target.closest(\"[role=option]\");\n const toElIndex = this.items.indexOf(toEl);\n const isTolElSelected = toEl.getAttribute(\"aria-selected\") === \"true\";\n const isTolElDisabled = toEl.getAttribute(\"aria-disabled\") === \"true\";\n if (!isTolElDisabled && this._options.autoSelect === false && isTolElSelected === false) {\n // todo: this.select() should take care of unselecting any existing selections\n this.unselect(this.index);\n this.select(toElIndex);\n }\n}\nfunction _onActiveDescendantChange(e) {\n const {\n fromIndex,\n toIndex\n } = e.detail;\n if (this._options.autoSelect === true) {\n const fromEl = this.items[fromIndex];\n const toEl = this.items[toIndex];\n if (fromEl) {\n // todo: this.select() should take care of unselecting any existing selections\n this.unselect(fromIndex);\n }\n if (toEl) {\n this.select(toIndex);\n }\n }\n}\nfunction _onMutation(mutationsList) {\n for (const mutation of mutationsList) {\n if (mutation.type === \"attributes\") {\n this.el.dispatchEvent(new CustomEvent(\"makeup-listbox-mutation\", {\n detail: {\n attributeName: mutation.attributeName\n }\n }));\n }\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","\"use strict\";\n\nrequire(\"../../docs.css\");\nrequire(\"@ebay/skin/tokens\");\nrequire(\"@ebay/skin/global\");\nrequire(\"@ebay/skin/combobox\");\nvar _makeupCombobox = _interopRequireDefault(require(\"makeup-combobox\"));\nfunction _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }\n// REQUIRE\n// const Combobox = require('makeup-combobox').default;\n\n// IMPORT\n\nwindow.onload = function () {\n document.querySelectorAll(\".combobox\").forEach(function (el, i) {\n const widget = new _makeupCombobox.default(el, {\n autoSelect: el.dataset.makeupAutoSelect === \"false\" ? false : true\n });\n el.addEventListener(\"makeup-combobox-change\", function (e) {\n console.log(e.type, e.detail);\n });\n el.addEventListener(\"makeup-combobox-mutation\", function (e) {\n console.log(e.type, e.detail);\n });\n });\n};"],"names":[],"sourceRoot":""}
\ No newline at end of file
+{"version":3,"file":"makeup-combobox/index.min.js","mappings":";;;;;;AAAA,mBAAO,CAAC,IAA8B;;;;;;;;ACAtC,mBAAO,CAAC,IAA0B;;;;;;;;ACAlC,mBAAO,CAAC,IAAsB;AAC9B,mBAAO,CAAC,IAAuB;;;;;;;;ACD/B,mBAAO,CAAC,IAA+B;;;;;;;;ACAvC,mBAAO,CAAC,IAAgC;;;;;;;;;;ACAxC;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;ACAa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,oBAAoB;AACpB,gDAAgD,mBAAO,CAAC,IAA2B;AACnF,2CAA2C,mBAAO,CAAC,IAAgB;AACnE,qCAAqC,iCAAiC;AACtE,uCAAuC,+CAA+C,0CAA0C,kDAAkD,mBAAmB;AACrM,yCAAyC,uCAAuC,2EAA2E,cAAc,qCAAqC,oCAAoC,UAAU,iBAAiB,gEAAgE,0CAA0C,8BAA8B,0DAA0D,wEAAwE;AACvhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;ACzKa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,oBAAoB;AACpB,uBAAuB;AACvB,2CAA2C,mBAAO,CAAC,IAAgB;AACnE,qCAAqC,iCAAiC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AC3Ea;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf,2CAA2C,mBAAO,CAAC,IAAgB;AACnE,0CAA0C,mBAAO,CAAC,GAAqB;AACvE,+CAA+C,mBAAO,CAAC,IAAmB;AAC1E,uCAAuC,+CAA+C,0CAA0C,kDAAkD,mBAAmB;AACrM,yCAAyC,uCAAuC,2EAA2E,cAAc,qCAAqC,oCAAoC,UAAU,iBAAiB,gEAAgE,0CAA0C,8BAA8B,0DAA0D,wEAAwE;AACvhB,qCAAqC,iCAAiC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC;AACA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAe;;;;;;;;;AC7RF;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;;;;;;;;ACnCa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,WAAW;AACX,kBAAkB;AAClB,gBAAgB;AAChB,cAAc;AACd,qBAAqB;AACrB,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;ACrEa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,oBAAoB;AACpB,yCAAyC,mBAAO,CAAC,IAAoB;AACrE,0CAA0C,mBAAO,CAAC,GAAqB;AACvE,uCAAuC,+CAA+C,0CAA0C,kDAAkD,mBAAmB;AACrM,yCAAyC,uCAAuC,2EAA2E,cAAc,qCAAqC,oCAAoC,UAAU,iBAAiB,gEAAgE,0CAA0C,8BAA8B,0DAA0D,wEAAwE;AACvhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,aAAa,aAAa;AAC1B,aAAa,QAAQ;AACrB,aAAa,uBAAuB;AACpC;AACA;AACA,iBAAiB,uBAAuB;AACxC,mCAAmC;;AAEnC,iBAAiB,aAAa;AAC9B;;AAEA,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA,aAAa,aAAa;AAC1B,aAAa,QAAQ;AACrB,aAAa,uBAAuB;AACpC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,aAAa;AAC1B,aAAa,uBAAuB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;;;;;;;AClXa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAkB,UAAU;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;ACvCa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,WAAW;AACX,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;ACjBa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf,6CAA6C,mBAAO,CAAC,IAAiB;AACtE,4CAA4C,mBAAO,CAAC,IAAgB;AACpE,qCAAqC,iCAAiC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAe;AACf;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;;;;;;;;ACvOa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf,+CAA+C,mBAAO,CAAC,IAA0B;AACjF,gDAAgD,mBAAO,CAAC,IAA4B;AACpF,uCAAuC,+CAA+C,0CAA0C,kDAAkD,mBAAmB;AACrM,yCAAyC,uCAAuC,2EAA2E,cAAc,qCAAqC,oCAAoC,UAAU,iBAAiB,gEAAgE,0CAA0C,8BAA8B,0DAA0D,wEAAwE;AACvhB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;;AAEA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;;;;;;UCnNA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;ACNa;;AAEb,mBAAO,CAAC,IAAgB;AACxB,mBAAO,CAAC,IAAmB;AAC3B,mBAAO,CAAC,IAAmB;AAC3B,mBAAO,CAAC,IAAqB;AAC7B,6CAA6C,mBAAO,CAAC,GAAiB;AACtE,qCAAqC,iCAAiC;AACtE;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL,GAAG;AACH,E","sources":["webpack://root/./node_modules/@ebay/skin/combobox.js","webpack://root/./node_modules/@ebay/skin/global.js","webpack://root/./node_modules/@ebay/skin/tokens.js","webpack://root/./node_modules/@ebay/skin/tokens/evo-core.js","webpack://root/./node_modules/@ebay/skin/tokens/evo-light.js","webpack://root/./docs/docs.css?378e","webpack://root/./node_modules/@ebay/skin/dist/combobox/combobox.css?755d","webpack://root/./node_modules/@ebay/skin/dist/global/global.css?e001","webpack://root/./node_modules/@ebay/skin/dist/tokens/evo-core.css?7a96","webpack://root/./node_modules/@ebay/skin/dist/tokens/evo-light.css?9c33","webpack://root/./packages/core/makeup-active-descendant/dist/cjs/index.js","webpack://root/./packages/core/makeup-exit-emitter/dist/cjs/index.js","webpack://root/./packages/core/makeup-expander/dist/cjs/index.js","webpack://root/./packages/core/makeup-focusables/dist/cjs/index.js","webpack://root/./packages/core/makeup-key-emitter/dist/cjs/index.js","webpack://root/./packages/core/makeup-navigation-emitter/dist/cjs/index.js","webpack://root/./packages/core/makeup-next-id/dist/cjs/index.js","webpack://root/./packages/core/makeup-prevent-scroll-keys/dist/cjs/index.js","webpack://root/./packages/ui/makeup-combobox/dist/cjs/index.js","webpack://root/./packages/ui/makeup-listbox/dist/cjs/index.js","webpack://root/webpack/bootstrap","webpack://root/webpack/runtime/make namespace object","webpack://root/./docs/ui/makeup-combobox/index.compiled.js"],"sourcesContent":["require('./dist/combobox/combobox.css');\n","require('./dist/global/global.css');\n","require('./tokens/evo-core.js');\nrequire('./tokens/evo-light.js');\n","require('./../dist/tokens/evo-core.css');\n","require('./../dist/tokens/evo-light.css');\n","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.createLinear = createLinear;\nvar NavigationEmitter = _interopRequireWildcard(require(\"makeup-navigation-emitter\"));\nvar _makeupNextId = _interopRequireDefault(require(\"makeup-next-id\"));\nfunction _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != typeof e && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if (\"default\" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\nconst defaultOptions = {\n activeDescendantClassName: \"active-descendant\",\n autoInit: \"none\",\n autoReset: \"none\",\n autoScroll: false,\n axis: \"both\",\n wrap: false\n};\nfunction onModelInit(e) {\n const {\n items,\n toIndex\n } = e.detail;\n const itemEl = items[toIndex];\n if (itemEl) {\n itemEl.classList.add(this._options.activeDescendantClassName);\n this._focusEl.setAttribute(\"aria-activedescendant\", itemEl.id);\n }\n this._el.dispatchEvent(new CustomEvent(\"activeDescendantInit\", {\n detail: e.detail\n }));\n}\nfunction onModelChange(e) {\n const {\n fromIndex,\n toIndex\n } = e.detail;\n const fromItem = this.items[fromIndex];\n const toItem = this.items[toIndex];\n if (fromItem) {\n fromItem.classList.remove(this._options.activeDescendantClassName);\n }\n if (toItem) {\n toItem.classList.add(this._options.activeDescendantClassName);\n this._focusEl.setAttribute(\"aria-activedescendant\", toItem.id);\n if (this._options.autoScroll && this._itemContainerEl) {\n this._itemContainerEl.scrollTop = toItem.offsetTop - this._itemContainerEl.offsetHeight / 2;\n }\n }\n this._el.dispatchEvent(new CustomEvent(\"activeDescendantChange\", {\n detail: e.detail\n }));\n}\nfunction onModelReset(e) {\n const toIndex = e.detail.toIndex;\n const activeClassName = this._options.activeDescendantClassName;\n this.items.forEach(function (el) {\n el.classList.remove(activeClassName);\n });\n if (toIndex !== null && toIndex !== -1) {\n const itemEl = this.items[toIndex];\n itemEl.classList.add(activeClassName);\n this._focusEl.setAttribute(\"aria-activedescendant\", itemEl.id);\n } else {\n this._focusEl.removeAttribute(\"aria-activedescendant\");\n }\n this._el.dispatchEvent(new CustomEvent(\"activeDescendantReset\", {\n detail: e.detail\n }));\n}\nfunction onModelMutation(e) {\n const {\n toIndex\n } = e.detail;\n const activeDescendantClassName = this._options.activeDescendantClassName;\n this.items.forEach(function (item, index) {\n (0, _makeupNextId.default)(item);\n if (index !== toIndex) {\n item.classList.remove(activeDescendantClassName);\n } else {\n item.classList.add(activeDescendantClassName);\n }\n });\n this._el.dispatchEvent(new CustomEvent(\"activeDescendantMutation\", {\n detail: e.detail\n }));\n}\nclass ActiveDescendant {\n constructor(el) {\n this._el = el;\n this._onMutationListener = onModelMutation.bind(this);\n this._onChangeListener = onModelChange.bind(this);\n this._onResetListener = onModelReset.bind(this);\n this._onInitListener = onModelInit.bind(this);\n this._el.addEventListener(\"navigationModelMutation\", this._onMutationListener);\n this._el.addEventListener(\"navigationModelChange\", this._onChangeListener);\n this._el.addEventListener(\"navigationModelReset\", this._onResetListener);\n this._el.addEventListener(\"navigationModelInit\", this._onInitListener);\n }\n destroy() {\n this._el.removeEventListener(\"navigationModelMutation\", this._onMutationListener);\n this._el.removeEventListener(\"navigationModelChange\", this._onChangeListener);\n this._el.removeEventListener(\"navigationModelReset\", this._onResetListener);\n this._el.removeEventListener(\"navigationModelInit\", this._onInitListener);\n }\n}\nclass LinearActiveDescendant extends ActiveDescendant {\n constructor(el, focusEl, itemContainerEl, itemSelector, selectedOptions) {\n super(el);\n this._options = Object.assign({}, defaultOptions, selectedOptions);\n this._focusEl = focusEl;\n this._itemContainerEl = itemContainerEl;\n this._itemSelector = itemSelector;\n\n // ensure container has an id\n (0, _makeupNextId.default)(this._itemContainerEl);\n\n // if programmatic relationship set aria-owns\n if (this._itemContainerEl !== this._focusEl) {\n focusEl.setAttribute(\"aria-owns\", this._itemContainerEl.id);\n }\n this._navigationEmitter = NavigationEmitter.createLinear(el, itemSelector, {\n autoInit: this._options.autoInit,\n autoReset: this._options.autoReset,\n axis: this._options.axis,\n ignoreByDelegateSelector: this._options.ignoreByDelegateSelector,\n wrap: this._options.wrap\n });\n\n // ensure each item has an id\n this.items.forEach(function (itemEl) {\n (0, _makeupNextId.default)(itemEl);\n });\n }\n get index() {\n return this._navigationEmitter.model.index;\n }\n set index(newIndex) {\n this._navigationEmitter.model.index = newIndex;\n }\n reset() {\n this._navigationEmitter.model.reset();\n }\n get currentItem() {\n return this._navigationEmitter.model.currentItem;\n }\n get items() {\n return this._navigationEmitter.model.items;\n }\n set wrap(newWrap) {\n this._navigationEmitter.model.options.wrap = newWrap;\n }\n destroy() {\n super.destroy();\n this._navigationEmitter.destroy();\n }\n}\n\n/*\nclass GridActiveDescendant extends ActiveDescendant {\n constructor(el, focusEl, containerEl, rowSelector, cellSelector) {\n super(el);\n }\n}\n*/\n\nfunction createLinear(el, focusEl, itemContainerEl, itemSelector, selectedOptions) {\n return new LinearActiveDescendant(el, focusEl, itemContainerEl, itemSelector, selectedOptions);\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.addFocusExit = addFocusExit;\nexports.removeFocusExit = removeFocusExit;\nvar _makeupNextId = _interopRequireDefault(require(\"makeup-next-id\"));\nfunction _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }\nconst focusExitEmitters = {};\nfunction doFocusExit(el, fromElement, toElement) {\n el.dispatchEvent(new CustomEvent(\"focusExit\", {\n detail: {\n fromElement,\n toElement\n },\n bubbles: false // mirror the native mouseleave event\n }));\n}\nfunction onDocumentFocusIn(e) {\n const newFocusElement = e.target;\n const targetIsDescendant = this.el.contains(newFocusElement);\n\n // if focus has moved to a focusable descendant\n if (targetIsDescendant === true) {\n // set the target as the currently focussed element\n this.currentFocusElement = newFocusElement;\n } else {\n // else focus has not gone to a focusable descendant\n window.removeEventListener(\"blur\", this.onWindowBlurListener);\n document.removeEventListener(\"focusin\", this.onDocumentFocusInListener);\n doFocusExit(this.el, this.currentFocusElement, newFocusElement);\n this.currentFocusElement = null;\n }\n}\nfunction onWindowBlur() {\n doFocusExit(this.el, this.currentFocusElement, undefined);\n}\nfunction onWidgetFocusIn() {\n // listen for focus moving to anywhere in document\n // note that mouse click on buttons, checkboxes and radios does not trigger focus events in all browsers!\n document.addEventListener(\"focusin\", this.onDocumentFocusInListener);\n // listen for focus leaving the window\n window.addEventListener(\"blur\", this.onWindowBlurListener);\n}\nclass FocusExitEmitter {\n constructor(el) {\n this.el = el;\n this.currentFocusElement = null;\n this.onWidgetFocusInListener = onWidgetFocusIn.bind(this);\n this.onDocumentFocusInListener = onDocumentFocusIn.bind(this);\n this.onWindowBlurListener = onWindowBlur.bind(this);\n this.el.addEventListener(\"focusin\", this.onWidgetFocusInListener);\n }\n removeEventListeners() {\n window.removeEventListener(\"blur\", this.onWindowBlurListener);\n document.removeEventListener(\"focusin\", this.onDocumentFocusInListener);\n this.el.removeEventListener(\"focusin\", this.onWidgetFocusInListener);\n }\n}\nfunction addFocusExit(el) {\n let exitEmitter = null;\n (0, _makeupNextId.default)(el);\n if (!focusExitEmitters[el.id]) {\n exitEmitter = new FocusExitEmitter(el);\n focusExitEmitters[el.id] = exitEmitter;\n }\n return exitEmitter;\n}\nfunction removeFocusExit(el) {\n const exitEmitter = focusExitEmitters[el.id];\n if (exitEmitter) {\n exitEmitter.removeEventListeners();\n delete focusExitEmitters[el.id];\n }\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _makeupNextId = _interopRequireDefault(require(\"makeup-next-id\"));\nvar ExitEmitter = _interopRequireWildcard(require(\"makeup-exit-emitter\"));\nvar _makeupFocusables = _interopRequireDefault(require(\"makeup-focusables\"));\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != typeof e && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if (\"default\" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\nfunction _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }\nconst defaultOptions = {\n alwaysDoFocusManagement: false,\n ariaControls: true,\n autoCollapse: false,\n collapseOnFocusOut: false,\n collapseOnMouseOut: false,\n collapseOnClickOut: false,\n collapseOnHostReFocus: false,\n contentSelector: \".expander__content\",\n expandedClass: null,\n expandOnClick: false,\n expandOnFocus: false,\n expandOnHover: false,\n focusManagement: null,\n hostSelector: \".expander__host\",\n simulateSpacebarClick: false\n};\nfunction onHostKeyDown(e) {\n if (e.keyCode === 13 || e.keyCode === 32) {\n this._keyboardClickFlag = true;\n }\n // if host element does not naturally trigger a click event on spacebar, we can force one to trigger here.\n // careful! if host already triggers click events naturally, we end up with a \"double-click\".\n if (e.keyCode === 32 && this.options.simulateSpacebarClick === true) {\n this.hostEl.click();\n }\n}\nfunction onHostMouseDown() {\n this._mouseClickFlag = true;\n}\nfunction onHostClick() {\n this._expandWasKeyboardClickActivated = this._keyboardClickFlag;\n this._expandWasMouseClickActivated = this._mouseClickFlag;\n this._widgetHasKeyboardFocus = this._keyboardClickFlag;\n this.expanded = !this.expanded;\n}\nfunction onHostFocus() {\n this._expandWasFocusActivated = true;\n this.expanded = true;\n}\n\n// NOTE: collapseOnHostReFocus cannot be used when expandOnFocus is true\nfunction onHostReFocus() {\n if (this.expanded && this._widgetHasKeyboardFocus) {\n this.expanded = false;\n }\n}\nfunction onHostHover() {\n clearTimeout(this._mouseLeft);\n this._expandWasHoverActivated = true;\n this.expanded = true;\n}\nfunction onFocusExit() {\n this._widgetHasKeyboardFocus = false;\n this.expanded = false;\n}\nfunction onMouseLeave() {\n clearTimeout(this._mouseLeft);\n this._mouseLeft = setTimeout(() => {\n this.expanded = false;\n }, 300);\n}\nfunction _onDocumentClick(e) {\n if (this.el.contains(e.target) === false) {\n this.expanded = false;\n }\n}\nfunction _onDocumentTouchStart() {\n this.documentClick = true;\n}\nfunction _onDocumentTouchMove() {\n this.documentClick = false;\n}\nfunction _onDocumentTouchEnd(e) {\n if (this.documentClick === true) {\n this.documentClick = false;\n if (this.el.contains(e.target) === false) {\n this.expanded = false;\n }\n }\n}\nfunction manageFocus(focusManagement, contentEl) {\n if (focusManagement === \"content\") {\n contentEl.setAttribute(\"tabindex\", \"-1\");\n contentEl.focus();\n } else if (focusManagement === \"focusable\") {\n var _focusables$;\n (_focusables$ = (0, _makeupFocusables.default)(contentEl)[0]) === null || _focusables$ === void 0 || _focusables$.focus();\n } else if (focusManagement === \"interactive\") {\n var _focusables$2;\n (_focusables$2 = (0, _makeupFocusables.default)(contentEl, true)[0]) === null || _focusables$2 === void 0 || _focusables$2.focus();\n } else if (focusManagement !== null) {\n const el = contentEl.querySelector(\"#\".concat(focusManagement));\n if (el) {\n el.focus();\n }\n }\n}\nclass _default {\n constructor(el, selectedOptions) {\n this.options = Object.assign({}, defaultOptions, selectedOptions);\n this.el = el;\n this.hostEl = el.querySelector(this.options.hostSelector); // the keyboard focusable host el\n this.contentEl = el.querySelector(this.options.contentSelector);\n ExitEmitter.addFocusExit(this.el);\n this._hostKeyDownListener = onHostKeyDown.bind(this);\n this._hostMouseDownListener = onHostMouseDown.bind(this);\n this._documentClickListener = _onDocumentClick.bind(this);\n this._documentTouchStartListener = _onDocumentTouchStart.bind(this);\n this._documentTouchMoveListener = _onDocumentTouchMove.bind(this);\n this._documentTouchEndListener = _onDocumentTouchEnd.bind(this);\n this._hostClickListener = onHostClick.bind(this);\n this._hostFocusListener = onHostFocus.bind(this);\n this._hostReFocusListener = onHostReFocus.bind(this);\n this._hostHoverListener = onHostHover.bind(this);\n this._focusExitListener = onFocusExit.bind(this);\n this._mouseLeaveListener = onMouseLeave.bind(this);\n if (this.hostEl.getAttribute(\"aria-expanded\") === null) {\n this.hostEl.setAttribute(\"aria-expanded\", \"false\");\n }\n if (this.options.ariaControls === true) {\n // ensure the widget has an id\n (0, _makeupNextId.default)(this.el, \"expander\");\n this.contentEl.id = this.contentEl.id || \"\".concat(this.el.id, \"-content\");\n this.hostEl.setAttribute(\"aria-controls\", this.contentEl.id);\n }\n this.expandOnClick = this.options.expandOnClick;\n this.expandOnFocus = this.options.expandOnFocus;\n this.expandOnHover = this.options.expandOnHover;\n this.collapseOnHostReFocus = this.options.collapseOnHostReFocus;\n if (this.options.autoCollapse === false) {\n this.collapseOnClickOut = this.options.collapseOnClickOut;\n this.collapseOnFocusOut = this.options.collapseOnFocusOut;\n this.collapseOnMouseOut = this.options.collapseOnMouseOut;\n }\n }\n set expandOnClick(bool) {\n if (bool === true) {\n this.hostEl.addEventListener(\"keydown\", this._hostKeyDownListener);\n this.hostEl.addEventListener(\"mousedown\", this._hostMouseDownListener);\n this.hostEl.addEventListener(\"click\", this._hostClickListener);\n if (this.options.autoCollapse === true) {\n this.collapseOnClickOut = true;\n this.collapseOnFocusOut = true;\n }\n } else {\n this.hostEl.removeEventListener(\"click\", this._hostClickListener);\n this.hostEl.removeEventListener(\"mousedown\", this._hostMouseDownListener);\n this.hostEl.removeEventListener(\"keydown\", this._hostKeyDownListener);\n }\n }\n set expandOnFocus(bool) {\n if (bool === true) {\n this.hostEl.addEventListener(\"focus\", this._hostFocusListener);\n if (this.options.autoCollapse === true) {\n this.collapseOnClickOut = true;\n this.collapseOnFocusOut = true;\n }\n } else {\n this.hostEl.removeEventListener(\"focus\", this._hostFocusListener);\n }\n }\n set collapseOnHostReFocus(bool) {\n if (bool === true) {\n this.hostEl.addEventListener(\"focus\", this._hostReFocusListener);\n } else {\n this.hostEl.removeEventListener(\"focus\", this._hostReFocusListener);\n }\n }\n set expandOnHover(bool) {\n if (bool === true) {\n this.hostEl.addEventListener(\"mouseenter\", this._hostHoverListener);\n this.contentEl.addEventListener(\"mouseenter\", this._hostHoverListener);\n if (this.options.autoCollapse === true) {\n this.collapseOnMouseOut = true;\n }\n } else {\n this.hostEl.removeEventListener(\"mouseenter\", this._hostHoverListener);\n this.contentEl.removeEventListener(\"mouseenter\", this._hostHoverListener);\n }\n }\n set collapseOnClickOut(bool) {\n if (bool === true) {\n document.addEventListener(\"click\", this._documentClickListener);\n document.addEventListener(\"touchstart\", this._documentTouchStartListener);\n document.addEventListener(\"touchmove\", this._documentTouchMoveListener);\n document.addEventListener(\"touchend\", this._documentTouchEndListener);\n } else {\n document.removeEventListener(\"click\", this._documentClickListener);\n document.removeEventListener(\"touchstart\", this._documentTouchStartListener);\n document.removeEventListener(\"touchmove\", this._documentTouchMoveListener);\n document.removeEventListener(\"touchend\", this._documentTouchEndListener);\n }\n }\n set collapseOnFocusOut(bool) {\n if (bool === true) {\n this.el.addEventListener(\"focusExit\", this._focusExitListener);\n } else {\n this.el.removeEventListener(\"focusExit\", this._focusExitListener);\n }\n }\n set collapseOnMouseOut(bool) {\n if (bool === true) {\n this.el.addEventListener(\"mouseleave\", this._mouseLeaveListener);\n this.contentEl.addEventListener(\"mouseleave\", this._mouseLeaveListener);\n } else {\n this.el.removeEventListener(\"mouseleave\", this._mouseLeaveListener);\n this.contentEl.removeEventListener(\"mouseleave\", this._mouseLeaveListener);\n }\n }\n get expanded() {\n return this.hostEl.getAttribute(\"aria-expanded\") === \"true\";\n }\n set expanded(bool) {\n if (bool === true && this.expanded === false) {\n this.hostEl.setAttribute(\"aria-expanded\", \"true\");\n if (this.options.expandedClass) {\n this.el.classList.add(this.options.expandedClass);\n }\n if (this._expandWasKeyboardClickActivated || this._expandWasMouseClickActivated && this.options.alwaysDoFocusManagement) {\n manageFocus(this.options.focusManagement, this.contentEl);\n }\n this.el.dispatchEvent(new CustomEvent(\"expander-expand\", {\n bubbles: true,\n detail: this.contentEl\n }));\n }\n if (bool === false && this.expanded === true) {\n this.hostEl.setAttribute(\"aria-expanded\", \"false\");\n if (this.options.expandedClass) {\n this.el.classList.remove(this.options.expandedClass);\n }\n this.el.dispatchEvent(new CustomEvent(\"expander-collapse\", {\n bubbles: true,\n detail: this.contentEl\n }));\n }\n this._expandWasKeyboardClickActivated = false;\n this._expandWasMouseClickActivated = false;\n this._expandWasFocusActivated = false;\n this._expandWasHoverActivated = false;\n this._keyboardClickFlag = false;\n this._mouseClickFlag = false;\n }\n sleep() {\n if (this._destroyed !== true) {\n this.expandOnClick = false;\n this.expandOnFocus = false;\n this.expandOnHover = false;\n this.collapseOnClickOut = false;\n this.collapseOnFocusOut = false;\n this.collapseOnMouseOut = false;\n this.collapseOnHostReFocus = false;\n }\n }\n destroy() {\n this.sleep();\n this._destroyed = true;\n this._hostKeyDownListener = null;\n this._hostMouseDownListener = null;\n this._documentClickListener = null;\n this._documentTouchStartListener = null;\n this._documentTouchMoveListener = null;\n this._documentTouchEndListener = null;\n this._hostClickListener = null;\n this._hostFocusListener = null;\n this._hostReFocusListener = null;\n this._hostHoverListener = null;\n this._focusExitListener = null;\n this._mouseLeaveListener = null;\n this._widgetHasKeyboardFocus = null;\n }\n}\nexports.default = _default;\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = _default;\nconst focusableElList = [\"a[href]\", \"area[href]\", \"button:not([disabled])\", \"embed\", \"iframe\", \"input:not([disabled])\", \"object\", \"select:not([disabled])\", \"textarea:not([disabled])\", \"*[tabindex]\", \"*[contenteditable]\"];\nconst focusableElSelector = focusableElList.join();\nfunction _default(el) {\n let keyboardOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n let callback = arguments.length > 2 ? arguments[2] : undefined;\n if (callback) {\n const request = requestAnimationFrame(() => {\n callback(getFocusables(el, keyboardOnly));\n });\n return () => {\n cancelAnimationFrame(request);\n };\n }\n return getFocusables(el, keyboardOnly);\n}\nfunction getFocusables(el) {\n let keyboardOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n let focusableEls = Array.prototype.slice.call(el.querySelectorAll(focusableElSelector));\n\n // filter out elements with display: none or nested in a display: none parent\n focusableEls = focusableEls.filter(function (focusableEl) {\n return !!(focusableEl.offsetWidth || focusableEl.offsetHeight || focusableEl.getClientRects().length);\n });\n if (keyboardOnly === true) {\n focusableEls = focusableEls.filter(function (focusableEl) {\n return focusableEl.getAttribute(\"tabindex\") !== \"-1\";\n });\n }\n return focusableEls;\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.add = add;\nexports.addKeyDown = addKeyDown;\nexports.addKeyUp = addKeyUp;\nexports.remove = remove;\nexports.removeKeyDown = removeKeyDown;\nexports.removeKeyUp = removeKeyUp;\nfunction uncapitalizeFirstLetter(str) {\n return str.charAt(0).toLowerCase() + str.slice(1);\n}\nfunction onKeyDownOrUp(evt, el, keyEventType) {\n if (!evt.shiftKey) {\n const key = evt.key;\n switch (key) {\n case \"Enter\":\n case \"Escape\":\n case \"PageUp\":\n case \"PageDown\":\n case \"End\":\n case \"Home\":\n case \"ArrowLeft\":\n case \"ArrowUp\":\n case \"ArrowRight\":\n case \"ArrowDown\":\n el.dispatchEvent(new CustomEvent(uncapitalizeFirstLetter(\"\".concat(key, \"Key\").concat(keyEventType)), {\n detail: evt,\n bubbles: true\n }));\n break;\n case \" \":\n el.dispatchEvent(new CustomEvent(\"spacebarKey\".concat(keyEventType), {\n detail: evt,\n bubbles: true\n }));\n break;\n default:\n return;\n }\n }\n}\nfunction onKeyDown(e) {\n onKeyDownOrUp(e, this, \"Down\");\n}\nfunction onKeyUp(e) {\n onKeyDownOrUp(e, this, \"Up\");\n}\nfunction addKeyDown(el) {\n el.addEventListener(\"keydown\", onKeyDown);\n}\nfunction addKeyUp(el) {\n el.addEventListener(\"keyup\", onKeyUp);\n}\nfunction removeKeyDown(el) {\n el.removeEventListener(\"keydown\", onKeyDown);\n}\nfunction removeKeyUp(el) {\n el.removeEventListener(\"keyup\", onKeyUp);\n}\nfunction add(el) {\n addKeyDown(el);\n addKeyUp(el);\n}\nfunction remove(el) {\n removeKeyDown(el);\n removeKeyUp(el);\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.createLinear = createLinear;\nvar KeyEmitter = _interopRequireWildcard(require(\"makeup-key-emitter\"));\nvar ExitEmitter = _interopRequireWildcard(require(\"makeup-exit-emitter\"));\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != typeof e && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if (\"default\" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\nconst defaultOptions = {\n axis: \"both\",\n autoInit: \"interactive\",\n autoReset: \"current\",\n ignoreByDelegateSelector: null,\n wrap: false\n};\nfunction isItemNavigable(el) {\n return !el.hidden && el.getAttribute(\"aria-disabled\") !== \"true\";\n}\nfunction isIndexNavigable(items, index) {\n return index >= 0 && index < items.length ? isItemNavigable(items[index]) : false;\n}\nfunction findNavigableItems(items) {\n return items.filter(isItemNavigable);\n}\nfunction findFirstNavigableIndex(items) {\n return items.findIndex(item => isItemNavigable(item));\n}\nfunction findLastNavigableIndex(items) {\n // todo: at(-1) is more performant than reverse(), but Babel is not transpiling it\n return items.indexOf(findNavigableItems(items).reverse()[0]);\n}\nfunction findIndexByAttribute(items, attribute, value) {\n return items.findIndex(item => isItemNavigable(item) && item.getAttribute(attribute) === value);\n}\nfunction findFirstNavigableAriaCheckedIndex(items) {\n return findIndexByAttribute(items, \"aria-checked\", \"true\");\n}\nfunction findFirstNavigableAriaSelectedIndex(items) {\n return findIndexByAttribute(items, \"aria-selected\", \"true\");\n}\nfunction findIgnoredByDelegateItems(el, options) {\n return options.ignoreByDelegateSelector !== null ? [...el.querySelectorAll(options.ignoreByDelegateSelector)] : [];\n}\nfunction findPreviousNavigableIndex(items, index, wrap) {\n let previousNavigableIndex = -1;\n if (index === null || atStart(items, index)) {\n if (wrap === true) {\n previousNavigableIndex = findLastNavigableIndex(items);\n }\n } else {\n let i = index;\n while (--i >= 0) {\n if (isItemNavigable(items[i])) {\n previousNavigableIndex = i;\n break;\n }\n }\n }\n return previousNavigableIndex;\n}\nfunction findNextNavigableIndex(items, index, wrap) {\n let nextNavigableIndex = -1;\n if (index === null) {\n nextNavigableIndex = findFirstNavigableIndex(items);\n } else if (atEnd(items, index)) {\n if (wrap === true) {\n nextNavigableIndex = findFirstNavigableIndex(items);\n }\n } else {\n let i = index;\n while (++i < items.length) {\n if (isItemNavigable(items[i])) {\n nextNavigableIndex = i;\n break;\n }\n }\n }\n return nextNavigableIndex;\n}\n\n// returning -1 means not found\nfunction findIndexPositionByType(typeOrNum, items, currentIndex) {\n let index = -1;\n switch (typeOrNum) {\n case \"none\":\n index = null;\n break;\n case \"current\":\n index = currentIndex;\n break;\n case \"interactive\":\n index = findFirstNavigableIndex(items);\n break;\n case \"ariaChecked\":\n index = findFirstNavigableAriaCheckedIndex(items);\n break;\n case \"ariaSelected\":\n index = findFirstNavigableAriaSelectedIndex(items);\n break;\n case \"ariaSelectedOrInteractive\":\n index = findFirstNavigableAriaSelectedIndex(items);\n index = index === -1 ? findFirstNavigableIndex(items) : index;\n break;\n default:\n index = typeof typeOrNum === \"number\" || typeOrNum === null ? typeOrNum : -1;\n }\n return index;\n}\nfunction atStart(items, index) {\n return index === findFirstNavigableIndex(items);\n}\nfunction atEnd(items, index) {\n return index === findLastNavigableIndex(items);\n}\nfunction onKeyPrev(e) {\n const ignoredByDelegateItems = findIgnoredByDelegateItems(this._el, this.options);\n\n // todo: update KeyEmitter to deal with ignored items?\n if (ignoredByDelegateItems.length === 0 || !ignoredByDelegateItems.includes(e.detail.target)) {\n this.index = findPreviousNavigableIndex(this.items, this.index, this.options.wrap);\n }\n}\nfunction onKeyNext(e) {\n const ignoredByDelegateItems = findIgnoredByDelegateItems(this._el, this.options);\n\n // todo: update KeyEmitter to deal with ignored items?\n if (ignoredByDelegateItems.length === 0 || !ignoredByDelegateItems.includes(e.detail.target)) {\n this.index = findNextNavigableIndex(this.items, this.index, this.options.wrap);\n }\n}\nfunction onClick(e) {\n const itemIndex = this.indexOf(e.target.closest(this._itemSelector));\n if (isIndexNavigable(this.items, itemIndex)) {\n this.index = itemIndex;\n }\n}\nfunction onKeyHome(e) {\n const ignoredByDelegateItems = findIgnoredByDelegateItems(this._el, this.options);\n\n // todo: update KeyEmitter to deal with ignored items?\n if (ignoredByDelegateItems.length === 0 || !ignoredByDelegateItems.includes(e.detail.target)) {\n this.index = findFirstNavigableIndex(this.items);\n }\n}\nfunction onKeyEnd(e) {\n const ignoredByDelegateItems = findIgnoredByDelegateItems(this._el, this.options);\n\n // todo: update KeyEmitter to deal with ignored items?\n if (ignoredByDelegateItems.length === 0 || !ignoredByDelegateItems.includes(e.detail.target)) {\n this.index = findLastNavigableIndex(this.items);\n }\n}\nfunction onFocusExit() {\n if (this.options.autoReset !== null) {\n this.reset();\n }\n}\nfunction onMutation(e) {\n const fromIndex = this.index;\n let toIndex = this.index;\n // https://developer.mozilla.org/en-US/docs/Web/API/MutationRecord\n const {\n addedNodes,\n attributeName,\n removedNodes,\n target,\n type\n } = e[0];\n if (type === \"attributes\") {\n if (target === this.currentItem) {\n if (attributeName === \"aria-disabled\") {\n // current item was disabled - keep it as current index (until a keyboard navigation happens)\n toIndex = this.index;\n } else if (attributeName === \"hidden\") {\n // current item was hidden and focus is lost - reset index to first interactive element\n toIndex = findFirstNavigableIndex(this.items);\n }\n } else {\n toIndex = this.index;\n }\n } else if (type === \"childList\") {\n if (removedNodes.length > 0 && [...removedNodes].includes(this._cachedElement)) {\n // current item was removed and focus is lost - reset index to first interactive element\n toIndex = findFirstNavigableIndex(this.items);\n } else if (removedNodes.length > 0 || addedNodes.length > 0) {\n // nodes were added and/or removed - keep current item and resync its index\n toIndex = this.indexOf(this._cachedElement);\n }\n }\n this._index = toIndex;\n this._el.dispatchEvent(new CustomEvent(\"navigationModelMutation\", {\n bubbles: false,\n detail: {\n fromIndex,\n toIndex\n }\n }));\n}\nclass NavigationModel {\n /**\n * @param {HTMLElement} el\n * @param {string} itemSelector\n * @param {typeof defaultOptions} selectedOptions\n */\n constructor(el, itemSelector, selectedOptions) {\n /** @member {typeof defaultOptions} */\n this.options = Object.assign({}, defaultOptions, selectedOptions);\n\n /** @member {HTMLElement} */\n this._el = el;\n\n /** @member {string} */\n this._itemSelector = itemSelector;\n }\n}\nclass LinearNavigationModel extends NavigationModel {\n /**\n * @param {HTMLElement} el\n * @param {string} itemSelector\n * @param {typeof defaultOptions} selectedOptions\n */\n constructor(el, itemSelector, selectedOptions) {\n super(el, itemSelector, selectedOptions);\n const fromIndex = this._index;\n const toIndex = findIndexPositionByType(this.options.autoInit, this.items, this.index);\n\n // do not use setter as it will trigger a change event\n this._index = toIndex;\n\n // always keep an element reference to the last item (for use in mutation observer)\n // todo: convert index to Tuple to store last/current values instead?\n this._cachedElement = this.items[toIndex];\n this._el.dispatchEvent(new CustomEvent(\"navigationModelInit\", {\n bubbles: false,\n detail: {\n firstInteractiveIndex: this.firstNavigableIndex,\n fromIndex,\n items: this.items,\n toIndex\n }\n }));\n }\n get currentItem() {\n return this.items[this.index];\n }\n\n // todo: code smell as getter abstracts that the query selector re-runs every time getter is accessed\n get items() {\n return [...this._el.querySelectorAll(\"\".concat(this._itemSelector))];\n }\n get index() {\n return this._index;\n }\n\n /**\n * @param {number} toIndex - update index position in this.items (non-interactive indexes fail silently)\n */\n set index(toIndex) {\n if (toIndex === this.index) {\n return;\n } else if (!isIndexNavigable(this.items, toIndex)) {\n // no-op. throw exception?\n } else {\n const fromIndex = this.index;\n // update cached element reference (for use in mutation observer if DOM node gets removed)\n this._cachedElement = this.items[toIndex];\n this._index = toIndex;\n this._el.dispatchEvent(new CustomEvent(\"navigationModelChange\", {\n bubbles: false,\n detail: {\n fromIndex,\n toIndex\n }\n }));\n }\n }\n indexOf(element) {\n return this.items.indexOf(element);\n }\n reset() {\n const fromIndex = this.index;\n const toIndex = findIndexPositionByType(this.options.autoReset, this.items, this.index);\n if (toIndex !== fromIndex) {\n // do not use setter as it will trigger a navigationModelChange event\n this._index = toIndex;\n this._el.dispatchEvent(new CustomEvent(\"navigationModelReset\", {\n bubbles: false,\n detail: {\n fromIndex,\n toIndex\n }\n }));\n }\n }\n}\n\n// 2D Grid Model will go here\n\n/*\nclass GridModel extends NavigationModel {\n constructor(el, rowSelector, colSelector) {\n super();\n this._coords = null;\n }\n}\n*/\n\nclass NavigationEmitter {\n /**\n * @param {HTMLElement} el\n * @param {LinearNavigationModel} model\n */\n constructor(el, model) {\n this.model = model;\n this.el = el;\n this._keyPrevListener = onKeyPrev.bind(model);\n this._keyNextListener = onKeyNext.bind(model);\n this._keyHomeListener = onKeyHome.bind(model);\n this._keyEndListener = onKeyEnd.bind(model);\n this._clickListener = onClick.bind(model);\n this._focusExitListener = onFocusExit.bind(model);\n this._observer = new MutationObserver(onMutation.bind(model));\n KeyEmitter.addKeyDown(this.el);\n ExitEmitter.addFocusExit(this.el);\n const axis = model.options.axis;\n if (axis === \"both\" || axis === \"x\") {\n this.el.addEventListener(\"arrowLeftKeyDown\", this._keyPrevListener);\n this.el.addEventListener(\"arrowRightKeyDown\", this._keyNextListener);\n }\n if (axis === \"both\" || axis === \"y\") {\n this.el.addEventListener(\"arrowUpKeyDown\", this._keyPrevListener);\n this.el.addEventListener(\"arrowDownKeyDown\", this._keyNextListener);\n }\n this.el.addEventListener(\"homeKeyDown\", this._keyHomeListener);\n this.el.addEventListener(\"endKeyDown\", this._keyEndListener);\n this.el.addEventListener(\"click\", this._clickListener);\n this.el.addEventListener(\"focusExit\", this._focusExitListener);\n this._observer.observe(this.el, {\n childList: true,\n subtree: true,\n attributeFilter: [\"aria-disabled\", \"hidden\"],\n attributes: true,\n attributeOldValue: true\n });\n }\n destroy() {\n KeyEmitter.removeKeyDown(this.el);\n ExitEmitter.removeFocusExit(this.el);\n this.el.removeEventListener(\"arrowLeftKeyDown\", this._keyPrevListener);\n this.el.removeEventListener(\"arrowRightKeyDown\", this._keyNextListener);\n this.el.removeEventListener(\"arrowUpKeyDown\", this._keyPrevListener);\n this.el.removeEventListener(\"arrowDownKeyDown\", this._keyNextListener);\n this.el.removeEventListener(\"homeKeyDown\", this._keyHomeListener);\n this.el.removeEventListener(\"endKeyDown\", this._keyEndListener);\n this.el.removeEventListener(\"click\", this._clickListener);\n this.el.removeEventListener(\"focusExit\", this._focusExitListener);\n this._observer.disconnect();\n }\n}\nfunction createLinear(el, itemSelector, selectedOptions) {\n const model = new LinearNavigationModel(el, itemSelector, selectedOptions);\n return new NavigationEmitter(el, model);\n}\n\n/*\nstatic createGrid(el, rowSelector, colSelector, selectedOptions) {\n return null;\n}\n*/\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = _default;\nconst sequenceMap = {};\nconst defaultPrefix = \"nid\";\nconst randomPortion = createRandomPortion(3);\nfunction randomNumber(max) {\n return Math.floor(Math.random() * max);\n}\nfunction createRandomPortion(size) {\n const letters = \"abcdefghijklmnopqrstuvwxyz\";\n const digits = \"0123456789\";\n const allChars = letters + digits;\n\n // to ensure a valid HTML ID (when prefix is empty), first character must be a letter\n let portion = letters[randomNumber(25)];\n\n // start iterating from 1, as we already have our first char\n for (let i = 1; i < size; i++) {\n portion += allChars[randomNumber(35)];\n }\n return portion;\n}\nfunction _default(el) {\n let prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultPrefix;\n const separator = prefix === \"\" ? \"\" : \"-\";\n\n // join first prefix with random portion to create key\n const key = \"\".concat(prefix).concat(separator).concat(randomPortion);\n\n // initialise key in sequence map if necessary\n sequenceMap[key] = sequenceMap[key] || 0;\n if (!el.id) {\n el.setAttribute(\"id\", \"\".concat(key, \"-\").concat(sequenceMap[key]++));\n }\n return el.id;\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.add = add;\nexports.remove = remove;\nfunction onKeyDown(e) {\n if (e.keyCode >= 32 && e.keyCode <= 40) {\n e.preventDefault();\n }\n}\nfunction add(el) {\n el.addEventListener(\"keydown\", onKeyDown);\n}\nfunction remove(el) {\n el.removeEventListener(\"keydown\", onKeyDown);\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _makeupExpander = _interopRequireDefault(require(\"makeup-expander\"));\nvar _makeupListbox = _interopRequireDefault(require(\"makeup-listbox\"));\nfunction _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }\nconst defaultOptions = {\n autoSelect: true,\n collapseTimeout: 150,\n customElementMode: false,\n autoScroll: true\n};\nclass _default {\n constructor(widgetEl, selectedOptions) {\n this._options = Object.assign({}, defaultOptions, selectedOptions);\n this._el = widgetEl;\n this._inputEl = this._el.querySelector(\"input\");\n this._listboxEl = this._el.querySelector(\".combobox__listbox\");\n this._autocompleteType = this._inputEl.getAttribute(\"aria-autocomplete\");\n this._inputEl.setAttribute(\"autocomplete\", \"off\");\n this._inputEl.setAttribute(\"role\", \"combobox\");\n this._listboxEl.hidden = false;\n this._listboxWidget = new _makeupListbox.default(this._listboxEl, {\n activeDescendantClassName: \"combobox__option--active\",\n autoReset: -1,\n autoSelect: this._options.autoSelect,\n focusableElement: this._inputEl,\n listboxOwnerElement: this._el,\n autoScroll: this._options.autoScroll\n });\n this._expander = new _makeupExpander.default(this._el, {\n collapseOnClickOut: true,\n collapseOnFocusOut: true,\n contentSelector: \".combobox__listbox\",\n expandedClass: \"combobox--expanded\",\n expandOnFocus: true,\n hostSelector: \"input\"\n });\n this._destroyed = false;\n this._onInputFocusListener = _onInputFocus.bind(this);\n this._onListboxClickListener = _onListboxClick.bind(this);\n this._onListboxActiveDescendantChangeListener = _onListboxActiveDescendantChange.bind(this);\n this._onTextboxKeyDownListener = _onTextboxKeyDown.bind(this);\n this._onTextboxInputListener = _onTextboxInput.bind(this);\n this._onTextboxClickListener = _onTextboxClick.bind(this);\n this._onMutationListener = _onMutation.bind(this);\n this._el.classList.add(\"combobox--js\");\n if (!this._options.customElementMode) {\n this._mutationObserver = new MutationObserver(this._onMutationListener);\n this._observeMutations();\n this._observeEvents();\n }\n }\n resetFilter() {\n this._listboxWidget._activeDescendant.reset();\n this._listboxWidget.items.forEach(el => el.hidden = false);\n }\n _observeMutations() {\n if (!this._options.customElementMode) {\n this._mutationObserver.observe(this._inputEl, {\n attributes: true,\n childList: true,\n subtree: true\n });\n }\n }\n _unobserveMutations() {\n if (!this._options.customElementMode) {\n this._mutationObserver.disconnect();\n }\n }\n _observeEvents() {\n if (this._destroyed !== true) {\n this._listboxEl.addEventListener(\"click\", this._onListboxClickListener);\n this._listboxWidget._activeDescendantRootEl.addEventListener(\"activeDescendantChange\", this._onListboxActiveDescendantChangeListener);\n this._inputEl.addEventListener(\"focus\", this._onInputFocusListener);\n this._inputEl.addEventListener(\"keydown\", this._onTextboxKeyDownListener);\n this._inputEl.addEventListener(\"input\", this._onTextboxInputListener);\n this._inputEl.addEventListener(\"click\", this._onTextboxClickListener);\n }\n }\n _unobserveEvents() {\n this._listboxEl.removeEventListener(\"click\", this._onListboxClickListener);\n this._listboxWidget._activeDescendantRootEl.removeEventListener(\"activeDescendantChange\", this._onListboxActiveDescendantChangeListener);\n this._inputEl.removeEventListener(\"focus\", this._onInputFocusListener);\n this._inputEl.removeEventListener(\"keydown\", this._onTextboxKeyDownListener);\n this._inputEl.removeEventListener(\"input\", this._onTextboxInputListener);\n this._inputEl.removeEventListener(\"click\", this._onTextboxClickListener);\n }\n destroy() {\n this._destroyed = true;\n this._unobserveMutations();\n this._unobserveEvents();\n this._onInputFocusListener = null;\n this._onListboxClickListener = null;\n this._onListboxActiveDesendanctChangeListener = null;\n this._onTextboxKeyDownListener = null;\n this._onTextboxInputListener = null;\n this._onTextboxClickListener = null;\n this._onMutationListener = null;\n }\n}\nexports.default = _default;\nfunction _onInputFocus() {\n if (this._autocompleteType === \"list\") {\n _filterSuggestions(this._inputEl.value, this._listboxWidget.items);\n } else {\n this.resetFilter();\n }\n}\nfunction _onTextboxKeyDown(e) {\n // up and down keys should not move caret\n if (e.keyCode === 38 || e.keyCode === 40) {\n e.preventDefault();\n }\n\n // down arrow key should always expand listbox\n if (e.keyCode === 40) {\n if (this._expander.expanded === false) {\n this._expander.expanded = true;\n }\n }\n\n // escape key should always collapse listbox\n if (e.keyCode === 27) {\n if (this._expander.expanded === true) {\n this._expander.expanded = false;\n this._listboxWidget._activeDescendant.reset();\n }\n }\n\n // for manual selection, ENTER should not submit form when there is an active descendant\n if (this._options.autoSelect === false && e.keyCode === 13 && this._inputEl.getAttribute(\"aria-activedescendant\")) {\n e.preventDefault();\n const widget = this;\n this._inputEl.value = this._listboxWidget.items[this._listboxWidget._activeDescendant.index].innerText;\n _dispatchChangeEvent(this._el, this._inputEl.value);\n this._listboxWidget._activeDescendant.reset();\n setTimeout(function () {\n widget._expander.expanded = false;\n if (widget._autocompleteType === \"list\") {\n if (widget._inputEl.value.length === 0) {\n widget.resetFilter();\n } else {\n _filterSuggestions(widget._inputEl.value, widget._listboxWidget.items);\n }\n }\n }, this._options.collapseTimeout);\n }\n}\nfunction _onTextboxClick() {\n if (this._expander.expanded === false) {\n this._expander.expanded = true;\n }\n}\nfunction _onTextboxInput() {\n if (this._expander.expanded === false) {\n this._expander.expanded = true;\n }\n // TODO: refactor this redundant logic with L165: L171\n if (this._autocompleteType === \"list\") {\n this._listboxWidget._activeDescendant.reset();\n if (this._inputEl.value.length === 0) {\n this.resetFilter();\n } else {\n _filterSuggestions(this._inputEl.value, this._listboxWidget.items);\n }\n }\n}\nfunction _onListboxClick(e) {\n const widget = this;\n const element = e.target.closest(\"[role=option]\");\n const indexData = this._listboxWidget.items.indexOf(element);\n if (indexData !== undefined) {\n this._inputEl.value = this._listboxWidget.items[indexData].innerText;\n\n // TODO: refactor this redundant logic with L165: L171\n if (this._autocompleteType === \"list\") {\n this._listboxWidget._activeDescendant.reset();\n if (this._inputEl.value.length === 0) {\n this.resetFilter();\n } else {\n _filterSuggestions(this._inputEl.value, this._listboxWidget.items);\n }\n }\n if (this._options.autoSelect === false) {\n _dispatchChangeEvent(this._el, this._inputEl.value);\n }\n setTimeout(function () {\n widget._expander.expanded = false;\n }, this._options.collapseTimeout);\n }\n}\nfunction _onListboxActiveDescendantChange(e) {\n if (this._options.autoSelect === true) {\n this._inputEl.value = this._listboxWidget.items[e.detail.toIndex].innerText;\n _dispatchChangeEvent(this._el, this._inputEl.value);\n }\n}\nfunction _onMutation(mutationsList) {\n for (const mutation of mutationsList) {\n if (mutation.type === \"attributes\") {\n this._el.dispatchEvent(new CustomEvent(\"makeup-combobox-mutation\", {\n detail: {\n attributeName: mutation.attributeName\n }\n }));\n }\n }\n}\nfunction _filterSuggestions(value, items) {\n const numChars = value.length;\n const currentValue = value.toLowerCase();\n const matchedItems = items.filter(el => {\n return el.innerText.trim().substring(0, numChars).toLowerCase() === currentValue;\n });\n const unmatchedItems = items.filter(el => {\n return el.innerText.trim().substring(0, numChars).toLowerCase() !== currentValue;\n });\n matchedItems.forEach(el => el.hidden = false);\n unmatchedItems.forEach(el => el.hidden = true);\n}\nfunction _dispatchChangeEvent(el, value) {\n el.dispatchEvent(new CustomEvent(\"makeup-combobox-change\", {\n detail: {\n value\n }\n }));\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar ActiveDescendant = _interopRequireWildcard(require(\"makeup-active-descendant\"));\nvar PreventScrollKeys = _interopRequireWildcard(require(\"makeup-prevent-scroll-keys\"));\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != typeof e && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if (\"default\" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\n/**\n * A listbox can be a standalone focusable widget, or controlled by a separate, focusable widget\n * (a textbox for example, in the case of a combobox or datepicker)\n *\n * This listbox code currently supports single-selct only!\n * This code has been copied from Skin & MIND Patterns and has not yet been cleaned up.\n */\n\nconst defaultOptions = {\n activeDescendantClassName: \"listbox__option--active\",\n // the classname applied to the current active desdcendant\n autoInit: \"ariaSelectedOrInteractive\",\n autoReset: \"ariaSelectedOrInteractive\",\n autoSelect: true,\n // when true, aria-checked state matches active-descendant\n autoScroll: true,\n // when true, the listbox will scroll to keep the activeDescendant in view\n customElementMode: false,\n focusableElement: null,\n // used in a combobox/datepicker scenario\n listboxOwnerElement: null,\n // used in a combobox/datepicker scenario\n multiSelect: false,\n // todo\n useAriaChecked: true,\n // doubles up on support for aria-selected to announce visible selected/checked state\n valueSelector: \".listbox__value\" // Selector to get value from\n};\nfunction isSpacebarOrEnter(keyCode) {\n return keyCode === 13 || keyCode === 32;\n}\nclass _default {\n constructor(widgetEl, selectedOptions) {\n this._options = Object.assign({}, defaultOptions, selectedOptions);\n this.el = widgetEl;\n\n // in cases such as combobox, the active-descendant logic is controlled by a parent widget\n this._activeDescendantRootEl = this._options.listboxOwnerElement || this.el;\n\n // todo: not sure this check is needed any more\n if (widgetEl.getAttribute(\"role\") === \"listbox\") {\n this._listboxEl = widgetEl;\n } else {\n this._listboxEl = this.el.querySelector(\"[role=listbox]\");\n }\n if (!this._options.focusableElement && this._listboxEl.getAttribute(\"tabindex\") === null) {\n this._listboxEl.setAttribute(\"tabindex\", \"0\");\n }\n PreventScrollKeys.add(this.el);\n this._onKeyDownListener = _onKeyDown.bind(this);\n this._onClickListener = _onClick.bind(this);\n this._onActiveDescendantChangeListener = _onActiveDescendantChange.bind(this);\n this._onMutationListener = _onMutation.bind(this);\n this.el.classList.add(\"listbox--js\");\n if (!this._options.customElementMode) {\n this._mutationObserver = new MutationObserver(this._onMutationListener);\n this._observeMutations();\n this._observeEvents();\n }\n this._activeDescendant = ActiveDescendant.createLinear(this._activeDescendantRootEl, this._options.focusableElement || this._listboxEl, this._listboxEl.parentElement, \"[role=option]\", {\n activeDescendantClassName: this._options.activeDescendantClassName,\n autoInit: this._options.autoInit,\n autoReset: this._options.autoReset,\n autoScroll: this._options.autoScroll,\n axis: \"y\"\n });\n }\n _observeMutations() {\n if (!this._options.customElementMode) {\n this._mutationObserver.observe(this._listboxEl, {\n attributeFilter: [\"aria-selected\"],\n attributes: true,\n childList: true,\n subtree: true\n });\n }\n }\n _unobserveMutations() {\n if (!this._options.customElementMode) {\n this._mutationObserver.disconnect();\n }\n }\n _observeEvents() {\n if (this._destroyed !== true) {\n this._activeDescendantRootEl.addEventListener(\"activeDescendantChange\", this._onActiveDescendantChangeListener);\n this._listboxEl.addEventListener(\"keydown\", this._onKeyDownListener);\n this._listboxEl.addEventListener(\"click\", this._onClickListener);\n }\n }\n _unobserveEvents() {\n this._listboxEl.removeEventListener(\"keydown\", this._onKeyDownListener);\n this._listboxEl.removeEventListener(\"click\", this._onClickListener);\n this._activeDescendantRootEl.removeEventListener(\"activeDescendantChange\", this._onActiveDescendantChangeListener);\n }\n get index() {\n return this.items.findIndex(el => el.getAttribute(\"aria-selected\") === \"true\");\n }\n get items() {\n return this._activeDescendant.items;\n }\n select(index) {\n this._unobserveMutations();\n const itemEl = this.items[index];\n if (itemEl && itemEl.getAttribute(\"aria-disabled\") !== \"true\") {\n const matchingItem = this.items[index];\n let optionValue;\n matchingItem.setAttribute(\"aria-selected\", \"true\");\n if (this._options.useAriaChecked === true) {\n matchingItem.setAttribute(\"aria-checked\", \"true\");\n }\n optionValue = matchingItem.innerText;\n\n // Check if value selector is present and use that to get innerText instead\n // If its not present, will default to innerText of the whole item\n if (this._options.valueSelector) {\n const valueSelector = matchingItem.querySelector(this._options.valueSelector);\n if (valueSelector) {\n optionValue = valueSelector.innerText;\n }\n }\n this.el.dispatchEvent(new CustomEvent(\"makeup-listbox-change\", {\n detail: {\n el: matchingItem,\n optionIndex: index,\n optionValue\n }\n }));\n }\n this._observeMutations();\n }\n unselect(index) {\n this._unobserveMutations();\n const itemEl = this.items[index];\n if (itemEl && itemEl.getAttribute(\"aria-disabled\") !== \"true\") {\n const matchingItem = this.items[index];\n matchingItem.setAttribute(\"aria-selected\", \"false\");\n if (this._options.useAriaChecked === true) {\n matchingItem.setAttribute(\"aria-checked\", \"false\");\n }\n }\n this._observeMutations();\n }\n destroy() {\n this._destroyed = true;\n this._unobserveMutations();\n this._unobserveEvents();\n this._onKeyDownListener = null;\n this._onClickListener = null;\n this._onActiveDescendantChangeListener = null;\n this._onMutationListener = null;\n }\n}\nexports.default = _default;\nfunction _onKeyDown(e) {\n const activeDescendantEl = this._activeDescendant.currentItem;\n if (isSpacebarOrEnter(e.keyCode) && (activeDescendantEl === null || activeDescendantEl === void 0 ? void 0 : activeDescendantEl.getAttribute(\"aria-selected\")) !== \"true\") {\n // todo: this.select() should take care of unselecting any existing selections\n this.unselect(this.index);\n this.select(this._activeDescendant.index);\n }\n}\nfunction _onClick(e) {\n // unlike the keyDown event, the click event target can be a child element of the option\n // e.g. Item 1
\n const toEl = e.target.closest(\"[role=option]\");\n const toElIndex = this.items.indexOf(toEl);\n const isTolElSelected = toEl.getAttribute(\"aria-selected\") === \"true\";\n const isTolElDisabled = toEl.getAttribute(\"aria-disabled\") === \"true\";\n if (!isTolElDisabled && this._options.autoSelect === false && isTolElSelected === false) {\n // todo: this.select() should take care of unselecting any existing selections\n this.unselect(this.index);\n this.select(toElIndex);\n }\n}\nfunction _onActiveDescendantChange(e) {\n const {\n fromIndex,\n toIndex\n } = e.detail;\n if (this._options.autoSelect === true) {\n const fromEl = this.items[fromIndex];\n const toEl = this.items[toIndex];\n if (fromEl) {\n // todo: this.select() should take care of unselecting any existing selections\n this.unselect(fromIndex);\n }\n if (toEl) {\n this.select(toIndex);\n }\n }\n}\nfunction _onMutation(mutationsList) {\n for (const mutation of mutationsList) {\n if (mutation.type === \"attributes\") {\n this.el.dispatchEvent(new CustomEvent(\"makeup-listbox-mutation\", {\n detail: {\n attributeName: mutation.attributeName\n }\n }));\n }\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","\"use strict\";\n\nrequire(\"../../docs.css\");\nrequire(\"@ebay/skin/tokens\");\nrequire(\"@ebay/skin/global\");\nrequire(\"@ebay/skin/combobox\");\nvar _makeupCombobox = _interopRequireDefault(require(\"makeup-combobox\"));\nfunction _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }\n// REQUIRE\n// const Combobox = require('makeup-combobox').default;\n\n// IMPORT\n\nwindow.onload = function () {\n document.querySelectorAll(\".combobox\").forEach(function (el, i) {\n const widget = new _makeupCombobox.default(el, {\n autoSelect: el.dataset.makeupAutoSelect === \"false\" ? false : true\n });\n el.addEventListener(\"makeup-combobox-change\", function (e) {\n console.log(e.type, e.detail);\n });\n el.addEventListener(\"makeup-combobox-mutation\", function (e) {\n console.log(e.type, e.detail);\n });\n });\n};"],"names":[],"sourceRoot":""}
\ No newline at end of file
diff --git a/docs/ui/makeup-listbox-button/index.min.js b/docs/ui/makeup-listbox-button/index.min.js
index 19896d49..94b6e1b1 100644
--- a/docs/ui/makeup-listbox-button/index.min.js
+++ b/docs/ui/makeup-listbox-button/index.min.js
@@ -413,7 +413,7 @@ const defaultOptions = {
collapseOnFocusOut: false,
collapseOnMouseOut: false,
collapseOnClickOut: false,
- collapseOnHostFocus: false,
+ collapseOnHostReFocus: false,
contentSelector: ".expander__content",
expandedClass: null,
expandOnClick: false,
@@ -439,18 +439,27 @@ function onHostMouseDown() {
function onHostClick() {
this._expandWasKeyboardClickActivated = this._keyboardClickFlag;
this._expandWasMouseClickActivated = this._mouseClickFlag;
+ this._widgetHasKeyboardFocus = this._keyboardClickFlag;
this.expanded = !this.expanded;
}
function onHostFocus() {
this._expandWasFocusActivated = true;
this.expanded = true;
}
+
+// NOTE: collapseOnHostReFocus cannot be used when expandOnFocus is true
+function onHostReFocus() {
+ if (this.expanded && this._widgetHasKeyboardFocus) {
+ this.expanded = false;
+ }
+}
function onHostHover() {
clearTimeout(this._mouseLeft);
this._expandWasHoverActivated = true;
this.expanded = true;
}
function onFocusExit() {
+ this._widgetHasKeyboardFocus = false;
this.expanded = false;
}
function onMouseLeave() {
@@ -510,6 +519,7 @@ class _default {
this._documentTouchEndListener = _onDocumentTouchEnd.bind(this);
this._hostClickListener = onHostClick.bind(this);
this._hostFocusListener = onHostFocus.bind(this);
+ this._hostReFocusListener = onHostReFocus.bind(this);
this._hostHoverListener = onHostHover.bind(this);
this._focusExitListener = onFocusExit.bind(this);
this._mouseLeaveListener = onMouseLeave.bind(this);
@@ -525,7 +535,7 @@ class _default {
this.expandOnClick = this.options.expandOnClick;
this.expandOnFocus = this.options.expandOnFocus;
this.expandOnHover = this.options.expandOnHover;
- this.collapseOnHostFocus = this.options.collapseOnHostFocus;
+ this.collapseOnHostReFocus = this.options.collapseOnHostReFocus;
if (this.options.autoCollapse === false) {
this.collapseOnClickOut = this.options.collapseOnClickOut;
this.collapseOnFocusOut = this.options.collapseOnFocusOut;
@@ -558,6 +568,13 @@ class _default {
this.hostEl.removeEventListener("focus", this._hostFocusListener);
}
}
+ set collapseOnHostReFocus(bool) {
+ if (bool === true) {
+ this.hostEl.addEventListener("focus", this._hostReFocusListener);
+ } else {
+ this.hostEl.removeEventListener("focus", this._hostReFocusListener);
+ }
+ }
set expandOnHover(bool) {
if (bool === true) {
this.hostEl.addEventListener("mouseenter", this._hostHoverListener);
@@ -590,13 +607,6 @@ class _default {
this.el.removeEventListener("focusExit", this._focusExitListener);
}
}
- set collapseOnHostFocus(bool) {
- if (bool === true) {
- this.contentEl.addEventListener("focusExit", this._focusExitListener);
- } else {
- this.contentEl.removeEventListener("focusExit", this._focusExitListener);
- }
- }
set collapseOnMouseOut(bool) {
if (bool === true) {
this.el.addEventListener("mouseleave", this._mouseLeaveListener);
@@ -648,6 +658,7 @@ class _default {
this.collapseOnClickOut = false;
this.collapseOnFocusOut = false;
this.collapseOnMouseOut = false;
+ this.collapseOnHostReFocus = false;
}
}
destroy() {
@@ -661,9 +672,11 @@ class _default {
this._documentTouchEndListener = null;
this._hostClickListener = null;
this._hostFocusListener = null;
+ this._hostReFocusListener = null;
this._hostHoverListener = null;
this._focusExitListener = null;
this._mouseLeaveListener = null;
+ this._widgetHasKeyboardFocus = null;
}
}
exports["default"] = _default;
@@ -1304,7 +1317,7 @@ class _default {
this._expander = new _makeupExpander.default(this.el, {
alwaysDoFocusManagement: true,
autoCollapse: true,
- collapseOnHostFocus: true,
+ collapseOnHostReFocus: true,
contentSelector: this._options.listboxSelector,
expandedClass: "listbox-button--expanded",
expandOnClick: true,
diff --git a/docs/ui/makeup-listbox-button/index.min.js.map b/docs/ui/makeup-listbox-button/index.min.js.map
index 8e261eeb..e903dffe 100644
--- a/docs/ui/makeup-listbox-button/index.min.js.map
+++ b/docs/ui/makeup-listbox-button/index.min.js.map
@@ -1 +1 @@
-{"version":3,"file":"makeup-listbox-button/index.min.js","mappings":";;;;;;AAAA,mBAAO,CAAC,IAA0B;;;;;;;;ACAlC,mBAAO,CAAC,IAA0B;;;;;;;;ACAlC,mBAAO,CAAC,IAA0C;;;;;;;;ACAlD,mBAAO,CAAC,IAAsB;AAC9B,mBAAO,CAAC,IAAuB;;;;;;;;ACD/B,mBAAO,CAAC,IAA+B;;;;;;;;ACAvC,mBAAO,CAAC,IAAgC;;;;;;;;ACAxC,mBAAO,CAAC,IAA4B;;;;;;;;;;ACApC;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;ACAa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,oBAAoB;AACpB,gDAAgD,mBAAO,CAAC,IAA2B;AACnF,2CAA2C,mBAAO,CAAC,IAAgB;AACnE,qCAAqC,iCAAiC;AACtE,uCAAuC,+CAA+C,0CAA0C,kDAAkD,mBAAmB;AACrM,yCAAyC,uCAAuC,2EAA2E,cAAc,qCAAqC,oCAAoC,UAAU,iBAAiB,gEAAgE,0CAA0C,8BAA8B,0DAA0D,wEAAwE;AACvhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;ACzKa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,oBAAoB;AACpB,uBAAuB;AACvB,2CAA2C,mBAAO,CAAC,IAAgB;AACnE,qCAAqC,iCAAiC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AC3Ea;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf,2CAA2C,mBAAO,CAAC,IAAgB;AACnE,0CAA0C,mBAAO,CAAC,GAAqB;AACvE,+CAA+C,mBAAO,CAAC,IAAmB;AAC1E,uCAAuC,+CAA+C,0CAA0C,kDAAkD,mBAAmB;AACrM,yCAAyC,uCAAuC,2EAA2E,cAAc,qCAAqC,oCAAoC,UAAU,iBAAiB,gEAAgE,0CAA0C,8BAA8B,0DAA0D,wEAAwE;AACvhB,qCAAqC,iCAAiC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC;AACA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAe;;;;;;;;;AChRF;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;;;;;;;;ACnCa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,WAAW;AACX,kBAAkB;AAClB,gBAAgB;AAChB,cAAc;AACd,qBAAqB;AACrB,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;ACrEa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,oBAAoB;AACpB,yCAAyC,mBAAO,CAAC,IAAoB;AACrE,0CAA0C,mBAAO,CAAC,GAAqB;AACvE,uCAAuC,+CAA+C,0CAA0C,kDAAkD,mBAAmB;AACrM,yCAAyC,uCAAuC,2EAA2E,cAAc,qCAAqC,oCAAoC,UAAU,iBAAiB,gEAAgE,0CAA0C,8BAA8B,0DAA0D,wEAAwE;AACvhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,aAAa,aAAa;AAC1B,aAAa,QAAQ;AACrB,aAAa,uBAAuB;AACpC;AACA;AACA,iBAAiB,uBAAuB;AACxC,mCAAmC;;AAEnC,iBAAiB,aAAa;AAC9B;;AAEA,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA,aAAa,aAAa;AAC1B,aAAa,QAAQ;AACrB,aAAa,uBAAuB;AACpC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,aAAa;AAC1B,aAAa,uBAAuB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;;;;;;;AClXa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAkB,UAAU;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;ACvCa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,WAAW;AACX,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;ACjBa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf,6CAA6C,mBAAO,CAAC,IAAiB;AACtE,4CAA4C,mBAAO,CAAC,IAAgB;AACpE,qCAAqC,iCAAiC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kBAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;;;;;;;;ACjMa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf,+CAA+C,mBAAO,CAAC,IAA0B;AACjF,gDAAgD,mBAAO,CAAC,IAA4B;AACpF,uCAAuC,+CAA+C,0CAA0C,kDAAkD,mBAAmB;AACrM,yCAAyC,uCAAuC,2EAA2E,cAAc,qCAAqC,oCAAoC,UAAU,iBAAiB,gEAAgE,0CAA0C,8BAA8B,0DAA0D,wEAAwE;AACvhB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;;AAEA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;;;;;;UCnNA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;ACNa;;AAEb,mBAAO,CAAC,IAAgB;AACxB,mBAAO,CAAC,IAAmB;AAC3B,mBAAO,CAAC,IAAmB;AAC3B,mBAAO,CAAC,IAAoB;AAC5B,mBAAO,CAAC,GAAmB;AAC3B,mBAAO,CAAC,IAA2B;AACnC,kDAAkD,mBAAO,CAAC,IAAuB;AACjF,qCAAqC,iCAAiC;AACtE;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH,E","sources":["webpack://root/./node_modules/@ebay/skin/button.js","webpack://root/./node_modules/@ebay/skin/global.js","webpack://root/./node_modules/@ebay/skin/listbox-button.js","webpack://root/./node_modules/@ebay/skin/tokens.js","webpack://root/./node_modules/@ebay/skin/tokens/evo-core.js","webpack://root/./node_modules/@ebay/skin/tokens/evo-light.js","webpack://root/./node_modules/@ebay/skin/utility.js","webpack://root/./docs/docs.css?378e","webpack://root/./node_modules/@ebay/skin/dist/button/button.css?9a44","webpack://root/./node_modules/@ebay/skin/dist/global/global.css?e001","webpack://root/./node_modules/@ebay/skin/dist/listbox-button/listbox-button.css?ea08","webpack://root/./node_modules/@ebay/skin/dist/tokens/evo-core.css?7a96","webpack://root/./node_modules/@ebay/skin/dist/tokens/evo-light.css?9c33","webpack://root/./node_modules/@ebay/skin/dist/utility/utility.css?6c3b","webpack://root/./packages/core/makeup-active-descendant/dist/cjs/index.js","webpack://root/./packages/core/makeup-exit-emitter/dist/cjs/index.js","webpack://root/./packages/core/makeup-expander/dist/cjs/index.js","webpack://root/./packages/core/makeup-focusables/dist/cjs/index.js","webpack://root/./packages/core/makeup-key-emitter/dist/cjs/index.js","webpack://root/./packages/core/makeup-navigation-emitter/dist/cjs/index.js","webpack://root/./packages/core/makeup-next-id/dist/cjs/index.js","webpack://root/./packages/core/makeup-prevent-scroll-keys/dist/cjs/index.js","webpack://root/./packages/ui/makeup-listbox-button/dist/cjs/index.js","webpack://root/./packages/ui/makeup-listbox/dist/cjs/index.js","webpack://root/webpack/bootstrap","webpack://root/webpack/runtime/make namespace object","webpack://root/./docs/ui/makeup-listbox-button/index.compiled.js"],"sourcesContent":["require('./dist/button/button.css');\n","require('./dist/global/global.css');\n","require('./dist/listbox-button/listbox-button.css');\n","require('./tokens/evo-core.js');\nrequire('./tokens/evo-light.js');\n","require('./../dist/tokens/evo-core.css');\n","require('./../dist/tokens/evo-light.css');\n","require('./dist/utility/utility.css');\n","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.createLinear = createLinear;\nvar NavigationEmitter = _interopRequireWildcard(require(\"makeup-navigation-emitter\"));\nvar _makeupNextId = _interopRequireDefault(require(\"makeup-next-id\"));\nfunction _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != typeof e && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if (\"default\" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\nconst defaultOptions = {\n activeDescendantClassName: \"active-descendant\",\n autoInit: \"none\",\n autoReset: \"none\",\n autoScroll: false,\n axis: \"both\",\n wrap: false\n};\nfunction onModelInit(e) {\n const {\n items,\n toIndex\n } = e.detail;\n const itemEl = items[toIndex];\n if (itemEl) {\n itemEl.classList.add(this._options.activeDescendantClassName);\n this._focusEl.setAttribute(\"aria-activedescendant\", itemEl.id);\n }\n this._el.dispatchEvent(new CustomEvent(\"activeDescendantInit\", {\n detail: e.detail\n }));\n}\nfunction onModelChange(e) {\n const {\n fromIndex,\n toIndex\n } = e.detail;\n const fromItem = this.items[fromIndex];\n const toItem = this.items[toIndex];\n if (fromItem) {\n fromItem.classList.remove(this._options.activeDescendantClassName);\n }\n if (toItem) {\n toItem.classList.add(this._options.activeDescendantClassName);\n this._focusEl.setAttribute(\"aria-activedescendant\", toItem.id);\n if (this._options.autoScroll && this._itemContainerEl) {\n this._itemContainerEl.scrollTop = toItem.offsetTop - this._itemContainerEl.offsetHeight / 2;\n }\n }\n this._el.dispatchEvent(new CustomEvent(\"activeDescendantChange\", {\n detail: e.detail\n }));\n}\nfunction onModelReset(e) {\n const toIndex = e.detail.toIndex;\n const activeClassName = this._options.activeDescendantClassName;\n this.items.forEach(function (el) {\n el.classList.remove(activeClassName);\n });\n if (toIndex !== null && toIndex !== -1) {\n const itemEl = this.items[toIndex];\n itemEl.classList.add(activeClassName);\n this._focusEl.setAttribute(\"aria-activedescendant\", itemEl.id);\n } else {\n this._focusEl.removeAttribute(\"aria-activedescendant\");\n }\n this._el.dispatchEvent(new CustomEvent(\"activeDescendantReset\", {\n detail: e.detail\n }));\n}\nfunction onModelMutation(e) {\n const {\n toIndex\n } = e.detail;\n const activeDescendantClassName = this._options.activeDescendantClassName;\n this.items.forEach(function (item, index) {\n (0, _makeupNextId.default)(item);\n if (index !== toIndex) {\n item.classList.remove(activeDescendantClassName);\n } else {\n item.classList.add(activeDescendantClassName);\n }\n });\n this._el.dispatchEvent(new CustomEvent(\"activeDescendantMutation\", {\n detail: e.detail\n }));\n}\nclass ActiveDescendant {\n constructor(el) {\n this._el = el;\n this._onMutationListener = onModelMutation.bind(this);\n this._onChangeListener = onModelChange.bind(this);\n this._onResetListener = onModelReset.bind(this);\n this._onInitListener = onModelInit.bind(this);\n this._el.addEventListener(\"navigationModelMutation\", this._onMutationListener);\n this._el.addEventListener(\"navigationModelChange\", this._onChangeListener);\n this._el.addEventListener(\"navigationModelReset\", this._onResetListener);\n this._el.addEventListener(\"navigationModelInit\", this._onInitListener);\n }\n destroy() {\n this._el.removeEventListener(\"navigationModelMutation\", this._onMutationListener);\n this._el.removeEventListener(\"navigationModelChange\", this._onChangeListener);\n this._el.removeEventListener(\"navigationModelReset\", this._onResetListener);\n this._el.removeEventListener(\"navigationModelInit\", this._onInitListener);\n }\n}\nclass LinearActiveDescendant extends ActiveDescendant {\n constructor(el, focusEl, itemContainerEl, itemSelector, selectedOptions) {\n super(el);\n this._options = Object.assign({}, defaultOptions, selectedOptions);\n this._focusEl = focusEl;\n this._itemContainerEl = itemContainerEl;\n this._itemSelector = itemSelector;\n\n // ensure container has an id\n (0, _makeupNextId.default)(this._itemContainerEl);\n\n // if programmatic relationship set aria-owns\n if (this._itemContainerEl !== this._focusEl) {\n focusEl.setAttribute(\"aria-owns\", this._itemContainerEl.id);\n }\n this._navigationEmitter = NavigationEmitter.createLinear(el, itemSelector, {\n autoInit: this._options.autoInit,\n autoReset: this._options.autoReset,\n axis: this._options.axis,\n ignoreByDelegateSelector: this._options.ignoreByDelegateSelector,\n wrap: this._options.wrap\n });\n\n // ensure each item has an id\n this.items.forEach(function (itemEl) {\n (0, _makeupNextId.default)(itemEl);\n });\n }\n get index() {\n return this._navigationEmitter.model.index;\n }\n set index(newIndex) {\n this._navigationEmitter.model.index = newIndex;\n }\n reset() {\n this._navigationEmitter.model.reset();\n }\n get currentItem() {\n return this._navigationEmitter.model.currentItem;\n }\n get items() {\n return this._navigationEmitter.model.items;\n }\n set wrap(newWrap) {\n this._navigationEmitter.model.options.wrap = newWrap;\n }\n destroy() {\n super.destroy();\n this._navigationEmitter.destroy();\n }\n}\n\n/*\nclass GridActiveDescendant extends ActiveDescendant {\n constructor(el, focusEl, containerEl, rowSelector, cellSelector) {\n super(el);\n }\n}\n*/\n\nfunction createLinear(el, focusEl, itemContainerEl, itemSelector, selectedOptions) {\n return new LinearActiveDescendant(el, focusEl, itemContainerEl, itemSelector, selectedOptions);\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.addFocusExit = addFocusExit;\nexports.removeFocusExit = removeFocusExit;\nvar _makeupNextId = _interopRequireDefault(require(\"makeup-next-id\"));\nfunction _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }\nconst focusExitEmitters = {};\nfunction doFocusExit(el, fromElement, toElement) {\n el.dispatchEvent(new CustomEvent(\"focusExit\", {\n detail: {\n fromElement,\n toElement\n },\n bubbles: false // mirror the native mouseleave event\n }));\n}\nfunction onDocumentFocusIn(e) {\n const newFocusElement = e.target;\n const targetIsDescendant = this.el.contains(newFocusElement);\n\n // if focus has moved to a focusable descendant\n if (targetIsDescendant === true) {\n // set the target as the currently focussed element\n this.currentFocusElement = newFocusElement;\n } else {\n // else focus has not gone to a focusable descendant\n window.removeEventListener(\"blur\", this.onWindowBlurListener);\n document.removeEventListener(\"focusin\", this.onDocumentFocusInListener);\n doFocusExit(this.el, this.currentFocusElement, newFocusElement);\n this.currentFocusElement = null;\n }\n}\nfunction onWindowBlur() {\n doFocusExit(this.el, this.currentFocusElement, undefined);\n}\nfunction onWidgetFocusIn() {\n // listen for focus moving to anywhere in document\n // note that mouse click on buttons, checkboxes and radios does not trigger focus events in all browsers!\n document.addEventListener(\"focusin\", this.onDocumentFocusInListener);\n // listen for focus leaving the window\n window.addEventListener(\"blur\", this.onWindowBlurListener);\n}\nclass FocusExitEmitter {\n constructor(el) {\n this.el = el;\n this.currentFocusElement = null;\n this.onWidgetFocusInListener = onWidgetFocusIn.bind(this);\n this.onDocumentFocusInListener = onDocumentFocusIn.bind(this);\n this.onWindowBlurListener = onWindowBlur.bind(this);\n this.el.addEventListener(\"focusin\", this.onWidgetFocusInListener);\n }\n removeEventListeners() {\n window.removeEventListener(\"blur\", this.onWindowBlurListener);\n document.removeEventListener(\"focusin\", this.onDocumentFocusInListener);\n this.el.removeEventListener(\"focusin\", this.onWidgetFocusInListener);\n }\n}\nfunction addFocusExit(el) {\n let exitEmitter = null;\n (0, _makeupNextId.default)(el);\n if (!focusExitEmitters[el.id]) {\n exitEmitter = new FocusExitEmitter(el);\n focusExitEmitters[el.id] = exitEmitter;\n }\n return exitEmitter;\n}\nfunction removeFocusExit(el) {\n const exitEmitter = focusExitEmitters[el.id];\n if (exitEmitter) {\n exitEmitter.removeEventListeners();\n delete focusExitEmitters[el.id];\n }\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _makeupNextId = _interopRequireDefault(require(\"makeup-next-id\"));\nvar ExitEmitter = _interopRequireWildcard(require(\"makeup-exit-emitter\"));\nvar _makeupFocusables = _interopRequireDefault(require(\"makeup-focusables\"));\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != typeof e && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if (\"default\" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\nfunction _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }\nconst defaultOptions = {\n alwaysDoFocusManagement: false,\n ariaControls: true,\n autoCollapse: false,\n collapseOnFocusOut: false,\n collapseOnMouseOut: false,\n collapseOnClickOut: false,\n collapseOnHostFocus: false,\n contentSelector: \".expander__content\",\n expandedClass: null,\n expandOnClick: false,\n expandOnFocus: false,\n expandOnHover: false,\n focusManagement: null,\n hostSelector: \".expander__host\",\n simulateSpacebarClick: false\n};\nfunction onHostKeyDown(e) {\n if (e.keyCode === 13 || e.keyCode === 32) {\n this._keyboardClickFlag = true;\n }\n // if host element does not naturally trigger a click event on spacebar, we can force one to trigger here.\n // careful! if host already triggers click events naturally, we end up with a \"double-click\".\n if (e.keyCode === 32 && this.options.simulateSpacebarClick === true) {\n this.hostEl.click();\n }\n}\nfunction onHostMouseDown() {\n this._mouseClickFlag = true;\n}\nfunction onHostClick() {\n this._expandWasKeyboardClickActivated = this._keyboardClickFlag;\n this._expandWasMouseClickActivated = this._mouseClickFlag;\n this.expanded = !this.expanded;\n}\nfunction onHostFocus() {\n this._expandWasFocusActivated = true;\n this.expanded = true;\n}\nfunction onHostHover() {\n clearTimeout(this._mouseLeft);\n this._expandWasHoverActivated = true;\n this.expanded = true;\n}\nfunction onFocusExit() {\n this.expanded = false;\n}\nfunction onMouseLeave() {\n clearTimeout(this._mouseLeft);\n this._mouseLeft = setTimeout(() => {\n this.expanded = false;\n }, 300);\n}\nfunction _onDocumentClick(e) {\n if (this.el.contains(e.target) === false) {\n this.expanded = false;\n }\n}\nfunction _onDocumentTouchStart() {\n this.documentClick = true;\n}\nfunction _onDocumentTouchMove() {\n this.documentClick = false;\n}\nfunction _onDocumentTouchEnd(e) {\n if (this.documentClick === true) {\n this.documentClick = false;\n if (this.el.contains(e.target) === false) {\n this.expanded = false;\n }\n }\n}\nfunction manageFocus(focusManagement, contentEl) {\n if (focusManagement === \"content\") {\n contentEl.setAttribute(\"tabindex\", \"-1\");\n contentEl.focus();\n } else if (focusManagement === \"focusable\") {\n var _focusables$;\n (_focusables$ = (0, _makeupFocusables.default)(contentEl)[0]) === null || _focusables$ === void 0 || _focusables$.focus();\n } else if (focusManagement === \"interactive\") {\n var _focusables$2;\n (_focusables$2 = (0, _makeupFocusables.default)(contentEl, true)[0]) === null || _focusables$2 === void 0 || _focusables$2.focus();\n } else if (focusManagement !== null) {\n const el = contentEl.querySelector(\"#\".concat(focusManagement));\n if (el) {\n el.focus();\n }\n }\n}\nclass _default {\n constructor(el, selectedOptions) {\n this.options = Object.assign({}, defaultOptions, selectedOptions);\n this.el = el;\n this.hostEl = el.querySelector(this.options.hostSelector); // the keyboard focusable host el\n this.contentEl = el.querySelector(this.options.contentSelector);\n ExitEmitter.addFocusExit(this.el);\n this._hostKeyDownListener = onHostKeyDown.bind(this);\n this._hostMouseDownListener = onHostMouseDown.bind(this);\n this._documentClickListener = _onDocumentClick.bind(this);\n this._documentTouchStartListener = _onDocumentTouchStart.bind(this);\n this._documentTouchMoveListener = _onDocumentTouchMove.bind(this);\n this._documentTouchEndListener = _onDocumentTouchEnd.bind(this);\n this._hostClickListener = onHostClick.bind(this);\n this._hostFocusListener = onHostFocus.bind(this);\n this._hostHoverListener = onHostHover.bind(this);\n this._focusExitListener = onFocusExit.bind(this);\n this._mouseLeaveListener = onMouseLeave.bind(this);\n if (this.hostEl.getAttribute(\"aria-expanded\") === null) {\n this.hostEl.setAttribute(\"aria-expanded\", \"false\");\n }\n if (this.options.ariaControls === true) {\n // ensure the widget has an id\n (0, _makeupNextId.default)(this.el, \"expander\");\n this.contentEl.id = this.contentEl.id || \"\".concat(this.el.id, \"-content\");\n this.hostEl.setAttribute(\"aria-controls\", this.contentEl.id);\n }\n this.expandOnClick = this.options.expandOnClick;\n this.expandOnFocus = this.options.expandOnFocus;\n this.expandOnHover = this.options.expandOnHover;\n this.collapseOnHostFocus = this.options.collapseOnHostFocus;\n if (this.options.autoCollapse === false) {\n this.collapseOnClickOut = this.options.collapseOnClickOut;\n this.collapseOnFocusOut = this.options.collapseOnFocusOut;\n this.collapseOnMouseOut = this.options.collapseOnMouseOut;\n }\n }\n set expandOnClick(bool) {\n if (bool === true) {\n this.hostEl.addEventListener(\"keydown\", this._hostKeyDownListener);\n this.hostEl.addEventListener(\"mousedown\", this._hostMouseDownListener);\n this.hostEl.addEventListener(\"click\", this._hostClickListener);\n if (this.options.autoCollapse === true) {\n this.collapseOnClickOut = true;\n this.collapseOnFocusOut = true;\n }\n } else {\n this.hostEl.removeEventListener(\"click\", this._hostClickListener);\n this.hostEl.removeEventListener(\"mousedown\", this._hostMouseDownListener);\n this.hostEl.removeEventListener(\"keydown\", this._hostKeyDownListener);\n }\n }\n set expandOnFocus(bool) {\n if (bool === true) {\n this.hostEl.addEventListener(\"focus\", this._hostFocusListener);\n if (this.options.autoCollapse === true) {\n this.collapseOnClickOut = true;\n this.collapseOnFocusOut = true;\n }\n } else {\n this.hostEl.removeEventListener(\"focus\", this._hostFocusListener);\n }\n }\n set expandOnHover(bool) {\n if (bool === true) {\n this.hostEl.addEventListener(\"mouseenter\", this._hostHoverListener);\n this.contentEl.addEventListener(\"mouseenter\", this._hostHoverListener);\n if (this.options.autoCollapse === true) {\n this.collapseOnMouseOut = true;\n }\n } else {\n this.hostEl.removeEventListener(\"mouseenter\", this._hostHoverListener);\n this.contentEl.removeEventListener(\"mouseenter\", this._hostHoverListener);\n }\n }\n set collapseOnClickOut(bool) {\n if (bool === true) {\n document.addEventListener(\"click\", this._documentClickListener);\n document.addEventListener(\"touchstart\", this._documentTouchStartListener);\n document.addEventListener(\"touchmove\", this._documentTouchMoveListener);\n document.addEventListener(\"touchend\", this._documentTouchEndListener);\n } else {\n document.removeEventListener(\"click\", this._documentClickListener);\n document.removeEventListener(\"touchstart\", this._documentTouchStartListener);\n document.removeEventListener(\"touchmove\", this._documentTouchMoveListener);\n document.removeEventListener(\"touchend\", this._documentTouchEndListener);\n }\n }\n set collapseOnFocusOut(bool) {\n if (bool === true) {\n this.el.addEventListener(\"focusExit\", this._focusExitListener);\n } else {\n this.el.removeEventListener(\"focusExit\", this._focusExitListener);\n }\n }\n set collapseOnHostFocus(bool) {\n if (bool === true) {\n this.contentEl.addEventListener(\"focusExit\", this._focusExitListener);\n } else {\n this.contentEl.removeEventListener(\"focusExit\", this._focusExitListener);\n }\n }\n set collapseOnMouseOut(bool) {\n if (bool === true) {\n this.el.addEventListener(\"mouseleave\", this._mouseLeaveListener);\n this.contentEl.addEventListener(\"mouseleave\", this._mouseLeaveListener);\n } else {\n this.el.removeEventListener(\"mouseleave\", this._mouseLeaveListener);\n this.contentEl.removeEventListener(\"mouseleave\", this._mouseLeaveListener);\n }\n }\n get expanded() {\n return this.hostEl.getAttribute(\"aria-expanded\") === \"true\";\n }\n set expanded(bool) {\n if (bool === true && this.expanded === false) {\n this.hostEl.setAttribute(\"aria-expanded\", \"true\");\n if (this.options.expandedClass) {\n this.el.classList.add(this.options.expandedClass);\n }\n if (this._expandWasKeyboardClickActivated || this._expandWasMouseClickActivated && this.options.alwaysDoFocusManagement) {\n manageFocus(this.options.focusManagement, this.contentEl);\n }\n this.el.dispatchEvent(new CustomEvent(\"expander-expand\", {\n bubbles: true,\n detail: this.contentEl\n }));\n }\n if (bool === false && this.expanded === true) {\n this.hostEl.setAttribute(\"aria-expanded\", \"false\");\n if (this.options.expandedClass) {\n this.el.classList.remove(this.options.expandedClass);\n }\n this.el.dispatchEvent(new CustomEvent(\"expander-collapse\", {\n bubbles: true,\n detail: this.contentEl\n }));\n }\n this._expandWasKeyboardClickActivated = false;\n this._expandWasMouseClickActivated = false;\n this._expandWasFocusActivated = false;\n this._expandWasHoverActivated = false;\n this._keyboardClickFlag = false;\n this._mouseClickFlag = false;\n }\n sleep() {\n if (this._destroyed !== true) {\n this.expandOnClick = false;\n this.expandOnFocus = false;\n this.expandOnHover = false;\n this.collapseOnClickOut = false;\n this.collapseOnFocusOut = false;\n this.collapseOnMouseOut = false;\n }\n }\n destroy() {\n this.sleep();\n this._destroyed = true;\n this._hostKeyDownListener = null;\n this._hostMouseDownListener = null;\n this._documentClickListener = null;\n this._documentTouchStartListener = null;\n this._documentTouchMoveListener = null;\n this._documentTouchEndListener = null;\n this._hostClickListener = null;\n this._hostFocusListener = null;\n this._hostHoverListener = null;\n this._focusExitListener = null;\n this._mouseLeaveListener = null;\n }\n}\nexports.default = _default;\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = _default;\nconst focusableElList = [\"a[href]\", \"area[href]\", \"button:not([disabled])\", \"embed\", \"iframe\", \"input:not([disabled])\", \"object\", \"select:not([disabled])\", \"textarea:not([disabled])\", \"*[tabindex]\", \"*[contenteditable]\"];\nconst focusableElSelector = focusableElList.join();\nfunction _default(el) {\n let keyboardOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n let callback = arguments.length > 2 ? arguments[2] : undefined;\n if (callback) {\n const request = requestAnimationFrame(() => {\n callback(getFocusables(el, keyboardOnly));\n });\n return () => {\n cancelAnimationFrame(request);\n };\n }\n return getFocusables(el, keyboardOnly);\n}\nfunction getFocusables(el) {\n let keyboardOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n let focusableEls = Array.prototype.slice.call(el.querySelectorAll(focusableElSelector));\n\n // filter out elements with display: none or nested in a display: none parent\n focusableEls = focusableEls.filter(function (focusableEl) {\n return !!(focusableEl.offsetWidth || focusableEl.offsetHeight || focusableEl.getClientRects().length);\n });\n if (keyboardOnly === true) {\n focusableEls = focusableEls.filter(function (focusableEl) {\n return focusableEl.getAttribute(\"tabindex\") !== \"-1\";\n });\n }\n return focusableEls;\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.add = add;\nexports.addKeyDown = addKeyDown;\nexports.addKeyUp = addKeyUp;\nexports.remove = remove;\nexports.removeKeyDown = removeKeyDown;\nexports.removeKeyUp = removeKeyUp;\nfunction uncapitalizeFirstLetter(str) {\n return str.charAt(0).toLowerCase() + str.slice(1);\n}\nfunction onKeyDownOrUp(evt, el, keyEventType) {\n if (!evt.shiftKey) {\n const key = evt.key;\n switch (key) {\n case \"Enter\":\n case \"Escape\":\n case \"PageUp\":\n case \"PageDown\":\n case \"End\":\n case \"Home\":\n case \"ArrowLeft\":\n case \"ArrowUp\":\n case \"ArrowRight\":\n case \"ArrowDown\":\n el.dispatchEvent(new CustomEvent(uncapitalizeFirstLetter(\"\".concat(key, \"Key\").concat(keyEventType)), {\n detail: evt,\n bubbles: true\n }));\n break;\n case \" \":\n el.dispatchEvent(new CustomEvent(\"spacebarKey\".concat(keyEventType), {\n detail: evt,\n bubbles: true\n }));\n break;\n default:\n return;\n }\n }\n}\nfunction onKeyDown(e) {\n onKeyDownOrUp(e, this, \"Down\");\n}\nfunction onKeyUp(e) {\n onKeyDownOrUp(e, this, \"Up\");\n}\nfunction addKeyDown(el) {\n el.addEventListener(\"keydown\", onKeyDown);\n}\nfunction addKeyUp(el) {\n el.addEventListener(\"keyup\", onKeyUp);\n}\nfunction removeKeyDown(el) {\n el.removeEventListener(\"keydown\", onKeyDown);\n}\nfunction removeKeyUp(el) {\n el.removeEventListener(\"keyup\", onKeyUp);\n}\nfunction add(el) {\n addKeyDown(el);\n addKeyUp(el);\n}\nfunction remove(el) {\n removeKeyDown(el);\n removeKeyUp(el);\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.createLinear = createLinear;\nvar KeyEmitter = _interopRequireWildcard(require(\"makeup-key-emitter\"));\nvar ExitEmitter = _interopRequireWildcard(require(\"makeup-exit-emitter\"));\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != typeof e && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if (\"default\" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\nconst defaultOptions = {\n axis: \"both\",\n autoInit: \"interactive\",\n autoReset: \"current\",\n ignoreByDelegateSelector: null,\n wrap: false\n};\nfunction isItemNavigable(el) {\n return !el.hidden && el.getAttribute(\"aria-disabled\") !== \"true\";\n}\nfunction isIndexNavigable(items, index) {\n return index >= 0 && index < items.length ? isItemNavigable(items[index]) : false;\n}\nfunction findNavigableItems(items) {\n return items.filter(isItemNavigable);\n}\nfunction findFirstNavigableIndex(items) {\n return items.findIndex(item => isItemNavigable(item));\n}\nfunction findLastNavigableIndex(items) {\n // todo: at(-1) is more performant than reverse(), but Babel is not transpiling it\n return items.indexOf(findNavigableItems(items).reverse()[0]);\n}\nfunction findIndexByAttribute(items, attribute, value) {\n return items.findIndex(item => isItemNavigable(item) && item.getAttribute(attribute) === value);\n}\nfunction findFirstNavigableAriaCheckedIndex(items) {\n return findIndexByAttribute(items, \"aria-checked\", \"true\");\n}\nfunction findFirstNavigableAriaSelectedIndex(items) {\n return findIndexByAttribute(items, \"aria-selected\", \"true\");\n}\nfunction findIgnoredByDelegateItems(el, options) {\n return options.ignoreByDelegateSelector !== null ? [...el.querySelectorAll(options.ignoreByDelegateSelector)] : [];\n}\nfunction findPreviousNavigableIndex(items, index, wrap) {\n let previousNavigableIndex = -1;\n if (index === null || atStart(items, index)) {\n if (wrap === true) {\n previousNavigableIndex = findLastNavigableIndex(items);\n }\n } else {\n let i = index;\n while (--i >= 0) {\n if (isItemNavigable(items[i])) {\n previousNavigableIndex = i;\n break;\n }\n }\n }\n return previousNavigableIndex;\n}\nfunction findNextNavigableIndex(items, index, wrap) {\n let nextNavigableIndex = -1;\n if (index === null) {\n nextNavigableIndex = findFirstNavigableIndex(items);\n } else if (atEnd(items, index)) {\n if (wrap === true) {\n nextNavigableIndex = findFirstNavigableIndex(items);\n }\n } else {\n let i = index;\n while (++i < items.length) {\n if (isItemNavigable(items[i])) {\n nextNavigableIndex = i;\n break;\n }\n }\n }\n return nextNavigableIndex;\n}\n\n// returning -1 means not found\nfunction findIndexPositionByType(typeOrNum, items, currentIndex) {\n let index = -1;\n switch (typeOrNum) {\n case \"none\":\n index = null;\n break;\n case \"current\":\n index = currentIndex;\n break;\n case \"interactive\":\n index = findFirstNavigableIndex(items);\n break;\n case \"ariaChecked\":\n index = findFirstNavigableAriaCheckedIndex(items);\n break;\n case \"ariaSelected\":\n index = findFirstNavigableAriaSelectedIndex(items);\n break;\n case \"ariaSelectedOrInteractive\":\n index = findFirstNavigableAriaSelectedIndex(items);\n index = index === -1 ? findFirstNavigableIndex(items) : index;\n break;\n default:\n index = typeof typeOrNum === \"number\" || typeOrNum === null ? typeOrNum : -1;\n }\n return index;\n}\nfunction atStart(items, index) {\n return index === findFirstNavigableIndex(items);\n}\nfunction atEnd(items, index) {\n return index === findLastNavigableIndex(items);\n}\nfunction onKeyPrev(e) {\n const ignoredByDelegateItems = findIgnoredByDelegateItems(this._el, this.options);\n\n // todo: update KeyEmitter to deal with ignored items?\n if (ignoredByDelegateItems.length === 0 || !ignoredByDelegateItems.includes(e.detail.target)) {\n this.index = findPreviousNavigableIndex(this.items, this.index, this.options.wrap);\n }\n}\nfunction onKeyNext(e) {\n const ignoredByDelegateItems = findIgnoredByDelegateItems(this._el, this.options);\n\n // todo: update KeyEmitter to deal with ignored items?\n if (ignoredByDelegateItems.length === 0 || !ignoredByDelegateItems.includes(e.detail.target)) {\n this.index = findNextNavigableIndex(this.items, this.index, this.options.wrap);\n }\n}\nfunction onClick(e) {\n const itemIndex = this.indexOf(e.target.closest(this._itemSelector));\n if (isIndexNavigable(this.items, itemIndex)) {\n this.index = itemIndex;\n }\n}\nfunction onKeyHome(e) {\n const ignoredByDelegateItems = findIgnoredByDelegateItems(this._el, this.options);\n\n // todo: update KeyEmitter to deal with ignored items?\n if (ignoredByDelegateItems.length === 0 || !ignoredByDelegateItems.includes(e.detail.target)) {\n this.index = findFirstNavigableIndex(this.items);\n }\n}\nfunction onKeyEnd(e) {\n const ignoredByDelegateItems = findIgnoredByDelegateItems(this._el, this.options);\n\n // todo: update KeyEmitter to deal with ignored items?\n if (ignoredByDelegateItems.length === 0 || !ignoredByDelegateItems.includes(e.detail.target)) {\n this.index = findLastNavigableIndex(this.items);\n }\n}\nfunction onFocusExit() {\n if (this.options.autoReset !== null) {\n this.reset();\n }\n}\nfunction onMutation(e) {\n const fromIndex = this.index;\n let toIndex = this.index;\n // https://developer.mozilla.org/en-US/docs/Web/API/MutationRecord\n const {\n addedNodes,\n attributeName,\n removedNodes,\n target,\n type\n } = e[0];\n if (type === \"attributes\") {\n if (target === this.currentItem) {\n if (attributeName === \"aria-disabled\") {\n // current item was disabled - keep it as current index (until a keyboard navigation happens)\n toIndex = this.index;\n } else if (attributeName === \"hidden\") {\n // current item was hidden and focus is lost - reset index to first interactive element\n toIndex = findFirstNavigableIndex(this.items);\n }\n } else {\n toIndex = this.index;\n }\n } else if (type === \"childList\") {\n if (removedNodes.length > 0 && [...removedNodes].includes(this._cachedElement)) {\n // current item was removed and focus is lost - reset index to first interactive element\n toIndex = findFirstNavigableIndex(this.items);\n } else if (removedNodes.length > 0 || addedNodes.length > 0) {\n // nodes were added and/or removed - keep current item and resync its index\n toIndex = this.indexOf(this._cachedElement);\n }\n }\n this._index = toIndex;\n this._el.dispatchEvent(new CustomEvent(\"navigationModelMutation\", {\n bubbles: false,\n detail: {\n fromIndex,\n toIndex\n }\n }));\n}\nclass NavigationModel {\n /**\n * @param {HTMLElement} el\n * @param {string} itemSelector\n * @param {typeof defaultOptions} selectedOptions\n */\n constructor(el, itemSelector, selectedOptions) {\n /** @member {typeof defaultOptions} */\n this.options = Object.assign({}, defaultOptions, selectedOptions);\n\n /** @member {HTMLElement} */\n this._el = el;\n\n /** @member {string} */\n this._itemSelector = itemSelector;\n }\n}\nclass LinearNavigationModel extends NavigationModel {\n /**\n * @param {HTMLElement} el\n * @param {string} itemSelector\n * @param {typeof defaultOptions} selectedOptions\n */\n constructor(el, itemSelector, selectedOptions) {\n super(el, itemSelector, selectedOptions);\n const fromIndex = this._index;\n const toIndex = findIndexPositionByType(this.options.autoInit, this.items, this.index);\n\n // do not use setter as it will trigger a change event\n this._index = toIndex;\n\n // always keep an element reference to the last item (for use in mutation observer)\n // todo: convert index to Tuple to store last/current values instead?\n this._cachedElement = this.items[toIndex];\n this._el.dispatchEvent(new CustomEvent(\"navigationModelInit\", {\n bubbles: false,\n detail: {\n firstInteractiveIndex: this.firstNavigableIndex,\n fromIndex,\n items: this.items,\n toIndex\n }\n }));\n }\n get currentItem() {\n return this.items[this.index];\n }\n\n // todo: code smell as getter abstracts that the query selector re-runs every time getter is accessed\n get items() {\n return [...this._el.querySelectorAll(\"\".concat(this._itemSelector))];\n }\n get index() {\n return this._index;\n }\n\n /**\n * @param {number} toIndex - update index position in this.items (non-interactive indexes fail silently)\n */\n set index(toIndex) {\n if (toIndex === this.index) {\n return;\n } else if (!isIndexNavigable(this.items, toIndex)) {\n // no-op. throw exception?\n } else {\n const fromIndex = this.index;\n // update cached element reference (for use in mutation observer if DOM node gets removed)\n this._cachedElement = this.items[toIndex];\n this._index = toIndex;\n this._el.dispatchEvent(new CustomEvent(\"navigationModelChange\", {\n bubbles: false,\n detail: {\n fromIndex,\n toIndex\n }\n }));\n }\n }\n indexOf(element) {\n return this.items.indexOf(element);\n }\n reset() {\n const fromIndex = this.index;\n const toIndex = findIndexPositionByType(this.options.autoReset, this.items, this.index);\n if (toIndex !== fromIndex) {\n // do not use setter as it will trigger a navigationModelChange event\n this._index = toIndex;\n this._el.dispatchEvent(new CustomEvent(\"navigationModelReset\", {\n bubbles: false,\n detail: {\n fromIndex,\n toIndex\n }\n }));\n }\n }\n}\n\n// 2D Grid Model will go here\n\n/*\nclass GridModel extends NavigationModel {\n constructor(el, rowSelector, colSelector) {\n super();\n this._coords = null;\n }\n}\n*/\n\nclass NavigationEmitter {\n /**\n * @param {HTMLElement} el\n * @param {LinearNavigationModel} model\n */\n constructor(el, model) {\n this.model = model;\n this.el = el;\n this._keyPrevListener = onKeyPrev.bind(model);\n this._keyNextListener = onKeyNext.bind(model);\n this._keyHomeListener = onKeyHome.bind(model);\n this._keyEndListener = onKeyEnd.bind(model);\n this._clickListener = onClick.bind(model);\n this._focusExitListener = onFocusExit.bind(model);\n this._observer = new MutationObserver(onMutation.bind(model));\n KeyEmitter.addKeyDown(this.el);\n ExitEmitter.addFocusExit(this.el);\n const axis = model.options.axis;\n if (axis === \"both\" || axis === \"x\") {\n this.el.addEventListener(\"arrowLeftKeyDown\", this._keyPrevListener);\n this.el.addEventListener(\"arrowRightKeyDown\", this._keyNextListener);\n }\n if (axis === \"both\" || axis === \"y\") {\n this.el.addEventListener(\"arrowUpKeyDown\", this._keyPrevListener);\n this.el.addEventListener(\"arrowDownKeyDown\", this._keyNextListener);\n }\n this.el.addEventListener(\"homeKeyDown\", this._keyHomeListener);\n this.el.addEventListener(\"endKeyDown\", this._keyEndListener);\n this.el.addEventListener(\"click\", this._clickListener);\n this.el.addEventListener(\"focusExit\", this._focusExitListener);\n this._observer.observe(this.el, {\n childList: true,\n subtree: true,\n attributeFilter: [\"aria-disabled\", \"hidden\"],\n attributes: true,\n attributeOldValue: true\n });\n }\n destroy() {\n KeyEmitter.removeKeyDown(this.el);\n ExitEmitter.removeFocusExit(this.el);\n this.el.removeEventListener(\"arrowLeftKeyDown\", this._keyPrevListener);\n this.el.removeEventListener(\"arrowRightKeyDown\", this._keyNextListener);\n this.el.removeEventListener(\"arrowUpKeyDown\", this._keyPrevListener);\n this.el.removeEventListener(\"arrowDownKeyDown\", this._keyNextListener);\n this.el.removeEventListener(\"homeKeyDown\", this._keyHomeListener);\n this.el.removeEventListener(\"endKeyDown\", this._keyEndListener);\n this.el.removeEventListener(\"click\", this._clickListener);\n this.el.removeEventListener(\"focusExit\", this._focusExitListener);\n this._observer.disconnect();\n }\n}\nfunction createLinear(el, itemSelector, selectedOptions) {\n const model = new LinearNavigationModel(el, itemSelector, selectedOptions);\n return new NavigationEmitter(el, model);\n}\n\n/*\nstatic createGrid(el, rowSelector, colSelector, selectedOptions) {\n return null;\n}\n*/\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = _default;\nconst sequenceMap = {};\nconst defaultPrefix = \"nid\";\nconst randomPortion = createRandomPortion(3);\nfunction randomNumber(max) {\n return Math.floor(Math.random() * max);\n}\nfunction createRandomPortion(size) {\n const letters = \"abcdefghijklmnopqrstuvwxyz\";\n const digits = \"0123456789\";\n const allChars = letters + digits;\n\n // to ensure a valid HTML ID (when prefix is empty), first character must be a letter\n let portion = letters[randomNumber(25)];\n\n // start iterating from 1, as we already have our first char\n for (let i = 1; i < size; i++) {\n portion += allChars[randomNumber(35)];\n }\n return portion;\n}\nfunction _default(el) {\n let prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultPrefix;\n const separator = prefix === \"\" ? \"\" : \"-\";\n\n // join first prefix with random portion to create key\n const key = \"\".concat(prefix).concat(separator).concat(randomPortion);\n\n // initialise key in sequence map if necessary\n sequenceMap[key] = sequenceMap[key] || 0;\n if (!el.id) {\n el.setAttribute(\"id\", \"\".concat(key, \"-\").concat(sequenceMap[key]++));\n }\n return el.id;\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.add = add;\nexports.remove = remove;\nfunction onKeyDown(e) {\n if (e.keyCode >= 32 && e.keyCode <= 40) {\n e.preventDefault();\n }\n}\nfunction add(el) {\n el.addEventListener(\"keydown\", onKeyDown);\n}\nfunction remove(el) {\n el.removeEventListener(\"keydown\", onKeyDown);\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _makeupExpander = _interopRequireDefault(require(\"makeup-expander\"));\nvar _makeupListbox = _interopRequireDefault(require(\"makeup-listbox\"));\nfunction _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }\nconst defaultOptions = {\n autoSelect: true,\n buttonLabelSelector: \".btn__text\",\n collapseTimeout: 150,\n customElementMode: false,\n listboxSelector: \".listbox-button__listbox\",\n floatingLabelSelector: \".btn__floating-label\",\n floatingLabelInline: \"btn__floating-label--inline\",\n floatingLabelAnimate: \"btn__floating-label--animate\",\n valueSelector: \".listbox-button__value\",\n buttonValueType: \"text\",\n // [\"text\", \"icon\", \"both\"],\n listboxOptionIconSelector: \".icon\",\n listboxOptionAriaLabelSelector: null\n};\nclass _default {\n constructor(widgetEl, selectedOptions) {\n var _this$_buttonEl$datas;\n this._options = Object.assign({}, defaultOptions, selectedOptions);\n this.el = widgetEl;\n this._buttonEl = this.el.querySelector(\"button\");\n this._buttonLabelEl = widgetEl.querySelector(this._options.buttonLabelSelector);\n this._buttonFloatingLabelEl = widgetEl.querySelector(this._options.floatingLabelSelector);\n this._buttonPrefix = (_this$_buttonEl$datas = this._buttonEl.dataset) === null || _this$_buttonEl$datas === void 0 ? void 0 : _this$_buttonEl$datas.listboxButtonPrefix;\n this._listboxEl = this.el.querySelector(this._options.listboxSelector);\n this._onButtonFirstClickListener = _onButtonFirstClick.bind(this);\n this._onListboxClickListener = _onListboxClick.bind(this);\n this._onListboxKeyDownListener = _onListboxKeyDown.bind(this);\n this._onListboxInitListener = _onListboxInit.bind(this);\n this._onListboxChangeListener = _onListboxChange.bind(this);\n this._onMutationListener = _onMutation.bind(this);\n if (!this._options.customElementMode) {\n this._mutationObserver = new MutationObserver(this._onMutationListener);\n this._observeMutations();\n this._observeEvents();\n }\n this.listbox = new _makeupListbox.default(this._listboxEl, {\n activeDescendantClassName: \"listbox-button__option--active\",\n autoReset: \"ariaSelectedOrInteractive\",\n autoSelect: this._options.autoSelect,\n valueSelector: this._options.valueSelector\n });\n this._expander = new _makeupExpander.default(this.el, {\n alwaysDoFocusManagement: true,\n autoCollapse: true,\n collapseOnHostFocus: true,\n contentSelector: this._options.listboxSelector,\n expandedClass: \"listbox-button--expanded\",\n expandOnClick: true,\n focusManagement: \"focusable\",\n hostSelector: \"button\"\n });\n this.el.classList.add(\"listbox-button--js\");\n if (this._buttonFloatingLabelEl) {\n if (!this._buttonLabelEl.innerText) {\n this._buttonFloatingLabelEl.classList.add(this._options.floatingLabelInline);\n }\n }\n }\n _observeMutations() {\n if (!this._options.customElementMode) {\n this._mutationObserver.observe(this._buttonEl, {\n attributeFilter: [\"aria-expanded\"],\n attributes: true,\n childList: false,\n subtree: false\n });\n }\n }\n _unobserveMutations() {\n if (!this._options.customElementMode) {\n this._mutationObserver.disconnect();\n }\n }\n _unobserveEvents() {\n this._buttonEl.removeEventListener(\"click\", this._onButtonFirstClickListener);\n this._listboxEl.removeEventListener(\"click\", this._onListboxClickListener);\n this._listboxEl.removeEventListener(\"keydown\", this._onListboxKeyDownListener);\n this._listboxEl.removeEventListener(\"makeup-listbox-init\", this._onListboxInitListener);\n this._listboxEl.removeEventListener(\"makeup-listbox-change\", this._onListboxChangeListener);\n }\n _observeEvents() {\n if (this._destroyed !== true) {\n this._buttonEl.addEventListener(\"click\", this._onButtonFirstClickListener, {\n once: true\n });\n this._listboxEl.addEventListener(\"click\", this._onListboxClickListener);\n this._listboxEl.addEventListener(\"keydown\", this._onListboxKeyDownListener);\n this._listboxEl.addEventListener(\"makeup-listbox-init\", this._onListboxInitListener);\n this._listboxEl.addEventListener(\"makeup-listbox-change\", this._onListboxChangeListener);\n }\n }\n collapse() {\n const widget = this;\n setTimeout(function () {\n widget._unobserveMutations();\n widget._expander.expanded = false;\n widget._observeMutations();\n widget._buttonEl.focus();\n }, this._options.collapseTimeout);\n }\n destroy() {\n this._destroyed = true;\n this._unobserveEvents();\n this._unobserveMutations();\n this._onButtonFirstClickListener = null;\n this._onListboxClickListener = null;\n this._onListboxKeyDownListener = null;\n this._onListboxInitListener = null;\n this._onListboxChangeListener = null;\n this._onMutationListener = null;\n }\n}\n\n// listbox element should be hidden in initial SSR markup (for progressive enhancement)\nexports.default = _default;\nfunction _onButtonFirstClick() {\n this.listbox.el.hidden = false;\n}\nfunction _onListboxKeyDown(e) {\n if (e.keyCode === 13 || e.keyCode === 27 || e.keyCode === 32) {\n this.collapse();\n }\n}\nfunction _onListboxClick() {\n this.collapse();\n}\nfunction _onListboxInit(e) {\n this.el.dispatchEvent(new CustomEvent(\"makeup-listbox-button-init\", {\n detail: e.detail\n }));\n}\nfunction _onListboxChange(e) {\n const toValue = e.detail.optionValue;\n const {\n listboxOptionIconSelector,\n listboxOptionAriaLabelSelector,\n buttonValueType,\n floatingLabelAnimate,\n floatingLabelInline\n } = this._options;\n const icon = e.detail.el.querySelector(listboxOptionIconSelector).cloneNode(true);\n let btnContent = this._buttonPrefix ? \"\".concat(this._buttonPrefix).concat(toValue) : toValue;\n if (icon) {\n switch (buttonValueType) {\n case \"both\":\n btnContent = \"\".concat(icon.outerHTML, \" \").concat(btnContent, \"\");\n break;\n case \"icon\":\n this._buttonEl.setAttribute(\"aria-label\", btnContent);\n btnContent = icon.outerHTML;\n break;\n default:\n break;\n }\n }\n if (listboxOptionAriaLabelSelector) {\n var _e$detail$el$querySel;\n const selectorText = (_e$detail$el$querySel = e.detail.el.querySelector(listboxOptionAriaLabelSelector)) === null || _e$detail$el$querySel === void 0 ? void 0 : _e$detail$el$querySel.innerText.trim();\n this._buttonEl.setAttribute(\"aria-label\", this._buttonPrefix ? \"\".concat(this._buttonPrefix, \" \").concat(selectorText) : selectorText);\n }\n this._buttonLabelEl.innerHTML = btnContent;\n if (this._buttonFloatingLabelEl) {\n if (toValue) {\n this._buttonFloatingLabelEl.classList.add(floatingLabelAnimate);\n this._buttonFloatingLabelEl.classList.remove(floatingLabelInline);\n } else {\n this._buttonFloatingLabelEl.classList.add(floatingLabelInline);\n }\n }\n this.el.dispatchEvent(new CustomEvent(\"makeup-listbox-button-change\", {\n detail: e.detail\n }));\n}\nfunction _onMutation(mutationsList) {\n for (const mutation of mutationsList) {\n if (mutation.type === \"attributes\") {\n this.el.dispatchEvent(new CustomEvent(\"makeup-listbox-button-mutation\", {\n detail: {\n attributeName: mutation.attributeName\n }\n }));\n }\n }\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar ActiveDescendant = _interopRequireWildcard(require(\"makeup-active-descendant\"));\nvar PreventScrollKeys = _interopRequireWildcard(require(\"makeup-prevent-scroll-keys\"));\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != typeof e && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if (\"default\" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\n/**\n * A listbox can be a standalone focusable widget, or controlled by a separate, focusable widget\n * (a textbox for example, in the case of a combobox or datepicker)\n *\n * This listbox code currently supports single-selct only!\n * This code has been copied from Skin & MIND Patterns and has not yet been cleaned up.\n */\n\nconst defaultOptions = {\n activeDescendantClassName: \"listbox__option--active\",\n // the classname applied to the current active desdcendant\n autoInit: \"ariaSelectedOrInteractive\",\n autoReset: \"ariaSelectedOrInteractive\",\n autoSelect: true,\n // when true, aria-checked state matches active-descendant\n autoScroll: true,\n // when true, the listbox will scroll to keep the activeDescendant in view\n customElementMode: false,\n focusableElement: null,\n // used in a combobox/datepicker scenario\n listboxOwnerElement: null,\n // used in a combobox/datepicker scenario\n multiSelect: false,\n // todo\n useAriaChecked: true,\n // doubles up on support for aria-selected to announce visible selected/checked state\n valueSelector: \".listbox__value\" // Selector to get value from\n};\nfunction isSpacebarOrEnter(keyCode) {\n return keyCode === 13 || keyCode === 32;\n}\nclass _default {\n constructor(widgetEl, selectedOptions) {\n this._options = Object.assign({}, defaultOptions, selectedOptions);\n this.el = widgetEl;\n\n // in cases such as combobox, the active-descendant logic is controlled by a parent widget\n this._activeDescendantRootEl = this._options.listboxOwnerElement || this.el;\n\n // todo: not sure this check is needed any more\n if (widgetEl.getAttribute(\"role\") === \"listbox\") {\n this._listboxEl = widgetEl;\n } else {\n this._listboxEl = this.el.querySelector(\"[role=listbox]\");\n }\n if (!this._options.focusableElement && this._listboxEl.getAttribute(\"tabindex\") === null) {\n this._listboxEl.setAttribute(\"tabindex\", \"0\");\n }\n PreventScrollKeys.add(this.el);\n this._onKeyDownListener = _onKeyDown.bind(this);\n this._onClickListener = _onClick.bind(this);\n this._onActiveDescendantChangeListener = _onActiveDescendantChange.bind(this);\n this._onMutationListener = _onMutation.bind(this);\n this.el.classList.add(\"listbox--js\");\n if (!this._options.customElementMode) {\n this._mutationObserver = new MutationObserver(this._onMutationListener);\n this._observeMutations();\n this._observeEvents();\n }\n this._activeDescendant = ActiveDescendant.createLinear(this._activeDescendantRootEl, this._options.focusableElement || this._listboxEl, this._listboxEl.parentElement, \"[role=option]\", {\n activeDescendantClassName: this._options.activeDescendantClassName,\n autoInit: this._options.autoInit,\n autoReset: this._options.autoReset,\n autoScroll: this._options.autoScroll,\n axis: \"y\"\n });\n }\n _observeMutations() {\n if (!this._options.customElementMode) {\n this._mutationObserver.observe(this._listboxEl, {\n attributeFilter: [\"aria-selected\"],\n attributes: true,\n childList: true,\n subtree: true\n });\n }\n }\n _unobserveMutations() {\n if (!this._options.customElementMode) {\n this._mutationObserver.disconnect();\n }\n }\n _observeEvents() {\n if (this._destroyed !== true) {\n this._activeDescendantRootEl.addEventListener(\"activeDescendantChange\", this._onActiveDescendantChangeListener);\n this._listboxEl.addEventListener(\"keydown\", this._onKeyDownListener);\n this._listboxEl.addEventListener(\"click\", this._onClickListener);\n }\n }\n _unobserveEvents() {\n this._listboxEl.removeEventListener(\"keydown\", this._onKeyDownListener);\n this._listboxEl.removeEventListener(\"click\", this._onClickListener);\n this._activeDescendantRootEl.removeEventListener(\"activeDescendantChange\", this._onActiveDescendantChangeListener);\n }\n get index() {\n return this.items.findIndex(el => el.getAttribute(\"aria-selected\") === \"true\");\n }\n get items() {\n return this._activeDescendant.items;\n }\n select(index) {\n this._unobserveMutations();\n const itemEl = this.items[index];\n if (itemEl && itemEl.getAttribute(\"aria-disabled\") !== \"true\") {\n const matchingItem = this.items[index];\n let optionValue;\n matchingItem.setAttribute(\"aria-selected\", \"true\");\n if (this._options.useAriaChecked === true) {\n matchingItem.setAttribute(\"aria-checked\", \"true\");\n }\n optionValue = matchingItem.innerText;\n\n // Check if value selector is present and use that to get innerText instead\n // If its not present, will default to innerText of the whole item\n if (this._options.valueSelector) {\n const valueSelector = matchingItem.querySelector(this._options.valueSelector);\n if (valueSelector) {\n optionValue = valueSelector.innerText;\n }\n }\n this.el.dispatchEvent(new CustomEvent(\"makeup-listbox-change\", {\n detail: {\n el: matchingItem,\n optionIndex: index,\n optionValue\n }\n }));\n }\n this._observeMutations();\n }\n unselect(index) {\n this._unobserveMutations();\n const itemEl = this.items[index];\n if (itemEl && itemEl.getAttribute(\"aria-disabled\") !== \"true\") {\n const matchingItem = this.items[index];\n matchingItem.setAttribute(\"aria-selected\", \"false\");\n if (this._options.useAriaChecked === true) {\n matchingItem.setAttribute(\"aria-checked\", \"false\");\n }\n }\n this._observeMutations();\n }\n destroy() {\n this._destroyed = true;\n this._unobserveMutations();\n this._unobserveEvents();\n this._onKeyDownListener = null;\n this._onClickListener = null;\n this._onActiveDescendantChangeListener = null;\n this._onMutationListener = null;\n }\n}\nexports.default = _default;\nfunction _onKeyDown(e) {\n const activeDescendantEl = this._activeDescendant.currentItem;\n if (isSpacebarOrEnter(e.keyCode) && (activeDescendantEl === null || activeDescendantEl === void 0 ? void 0 : activeDescendantEl.getAttribute(\"aria-selected\")) !== \"true\") {\n // todo: this.select() should take care of unselecting any existing selections\n this.unselect(this.index);\n this.select(this._activeDescendant.index);\n }\n}\nfunction _onClick(e) {\n // unlike the keyDown event, the click event target can be a child element of the option\n // e.g. Item 1
\n const toEl = e.target.closest(\"[role=option]\");\n const toElIndex = this.items.indexOf(toEl);\n const isTolElSelected = toEl.getAttribute(\"aria-selected\") === \"true\";\n const isTolElDisabled = toEl.getAttribute(\"aria-disabled\") === \"true\";\n if (!isTolElDisabled && this._options.autoSelect === false && isTolElSelected === false) {\n // todo: this.select() should take care of unselecting any existing selections\n this.unselect(this.index);\n this.select(toElIndex);\n }\n}\nfunction _onActiveDescendantChange(e) {\n const {\n fromIndex,\n toIndex\n } = e.detail;\n if (this._options.autoSelect === true) {\n const fromEl = this.items[fromIndex];\n const toEl = this.items[toIndex];\n if (fromEl) {\n // todo: this.select() should take care of unselecting any existing selections\n this.unselect(fromIndex);\n }\n if (toEl) {\n this.select(toIndex);\n }\n }\n}\nfunction _onMutation(mutationsList) {\n for (const mutation of mutationsList) {\n if (mutation.type === \"attributes\") {\n this.el.dispatchEvent(new CustomEvent(\"makeup-listbox-mutation\", {\n detail: {\n attributeName: mutation.attributeName\n }\n }));\n }\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","\"use strict\";\n\nrequire(\"../../docs.css\");\nrequire(\"@ebay/skin/tokens\");\nrequire(\"@ebay/skin/global\");\nrequire(\"@ebay/skin/utility\");\nrequire(\"@ebay/skin/button\");\nrequire(\"@ebay/skin/listbox-button\");\nvar _makeupListboxButton = _interopRequireDefault(require(\"makeup-listbox-button\"));\nfunction _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }\n// REQUIRE\n// const ListboxButton = require('makeup-listbox-button').default;\n\n// IMPORT\n\nconst widgets = [];\nconst log = e => console.log(e.type, e.detail);\nwindow.onload = function () {\n document.querySelectorAll(\".listbox-button\").forEach(function (el, i) {\n const hasCustomLabel = el.classList.contains(\"listbox-button-with-icon-label\");\n const hasIconText = el.classList.contains(\"listbox-button-with-iconText\");\n const hasIcon = el.classList.contains(\"listbox-button-with-icon\");\n let buttonValueType;\n if (hasIconText) {\n buttonValueType = \"both\";\n } else if (hasIcon || hasCustomLabel) {\n buttonValueType = \"icon\";\n } else {\n buttonValueType = \"text\";\n }\n const listboxOptionAriaLabelSelector = hasCustomLabel ? \".listbox-button__value span\" : null;\n el.addEventListener(\"makeup-listbox-button-init\", log);\n el.addEventListener(\"makeup-listbox-button-change\", log);\n el.addEventListener(\"makeup-listbox-button-mutation\", log);\n widgets.push(new _makeupListboxButton.default(el, {\n autoSelect: el.dataset.makeupAutoSelect === \"false\" ? false : true,\n buttonValueType,\n listboxOptionAriaLabelSelector\n }));\n });\n};"],"names":[],"sourceRoot":""}
\ No newline at end of file
+{"version":3,"file":"makeup-listbox-button/index.min.js","mappings":";;;;;;AAAA,mBAAO,CAAC,IAA0B;;;;;;;;ACAlC,mBAAO,CAAC,IAA0B;;;;;;;;ACAlC,mBAAO,CAAC,IAA0C;;;;;;;;ACAlD,mBAAO,CAAC,IAAsB;AAC9B,mBAAO,CAAC,IAAuB;;;;;;;;ACD/B,mBAAO,CAAC,IAA+B;;;;;;;;ACAvC,mBAAO,CAAC,IAAgC;;;;;;;;ACAxC,mBAAO,CAAC,IAA4B;;;;;;;;;;ACApC;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;ACAa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,oBAAoB;AACpB,gDAAgD,mBAAO,CAAC,IAA2B;AACnF,2CAA2C,mBAAO,CAAC,IAAgB;AACnE,qCAAqC,iCAAiC;AACtE,uCAAuC,+CAA+C,0CAA0C,kDAAkD,mBAAmB;AACrM,yCAAyC,uCAAuC,2EAA2E,cAAc,qCAAqC,oCAAoC,UAAU,iBAAiB,gEAAgE,0CAA0C,8BAA8B,0DAA0D,wEAAwE;AACvhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;ACzKa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,oBAAoB;AACpB,uBAAuB;AACvB,2CAA2C,mBAAO,CAAC,IAAgB;AACnE,qCAAqC,iCAAiC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AC3Ea;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf,2CAA2C,mBAAO,CAAC,IAAgB;AACnE,0CAA0C,mBAAO,CAAC,GAAqB;AACvE,+CAA+C,mBAAO,CAAC,IAAmB;AAC1E,uCAAuC,+CAA+C,0CAA0C,kDAAkD,mBAAmB;AACrM,yCAAyC,uCAAuC,2EAA2E,cAAc,qCAAqC,oCAAoC,UAAU,iBAAiB,gEAAgE,0CAA0C,8BAA8B,0DAA0D,wEAAwE;AACvhB,qCAAqC,iCAAiC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC;AACA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAe;;;;;;;;;AC7RF;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;;;;;;;;ACnCa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,WAAW;AACX,kBAAkB;AAClB,gBAAgB;AAChB,cAAc;AACd,qBAAqB;AACrB,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;ACrEa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,oBAAoB;AACpB,yCAAyC,mBAAO,CAAC,IAAoB;AACrE,0CAA0C,mBAAO,CAAC,GAAqB;AACvE,uCAAuC,+CAA+C,0CAA0C,kDAAkD,mBAAmB;AACrM,yCAAyC,uCAAuC,2EAA2E,cAAc,qCAAqC,oCAAoC,UAAU,iBAAiB,gEAAgE,0CAA0C,8BAA8B,0DAA0D,wEAAwE;AACvhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,aAAa,aAAa;AAC1B,aAAa,QAAQ;AACrB,aAAa,uBAAuB;AACpC;AACA;AACA,iBAAiB,uBAAuB;AACxC,mCAAmC;;AAEnC,iBAAiB,aAAa;AAC9B;;AAEA,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA,aAAa,aAAa;AAC1B,aAAa,QAAQ;AACrB,aAAa,uBAAuB;AACpC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,aAAa;AAC1B,aAAa,uBAAuB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;;;;;;;AClXa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAkB,UAAU;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;ACvCa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,WAAW;AACX,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;ACjBa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf,6CAA6C,mBAAO,CAAC,IAAiB;AACtE,4CAA4C,mBAAO,CAAC,IAAgB;AACpE,qCAAqC,iCAAiC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kBAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;;;;;;;;ACjMa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf,+CAA+C,mBAAO,CAAC,IAA0B;AACjF,gDAAgD,mBAAO,CAAC,IAA4B;AACpF,uCAAuC,+CAA+C,0CAA0C,kDAAkD,mBAAmB;AACrM,yCAAyC,uCAAuC,2EAA2E,cAAc,qCAAqC,oCAAoC,UAAU,iBAAiB,gEAAgE,0CAA0C,8BAA8B,0DAA0D,wEAAwE;AACvhB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;;AAEA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;;;;;;UCnNA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;ACNa;;AAEb,mBAAO,CAAC,IAAgB;AACxB,mBAAO,CAAC,IAAmB;AAC3B,mBAAO,CAAC,IAAmB;AAC3B,mBAAO,CAAC,IAAoB;AAC5B,mBAAO,CAAC,GAAmB;AAC3B,mBAAO,CAAC,IAA2B;AACnC,kDAAkD,mBAAO,CAAC,IAAuB;AACjF,qCAAqC,iCAAiC;AACtE;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH,E","sources":["webpack://root/./node_modules/@ebay/skin/button.js","webpack://root/./node_modules/@ebay/skin/global.js","webpack://root/./node_modules/@ebay/skin/listbox-button.js","webpack://root/./node_modules/@ebay/skin/tokens.js","webpack://root/./node_modules/@ebay/skin/tokens/evo-core.js","webpack://root/./node_modules/@ebay/skin/tokens/evo-light.js","webpack://root/./node_modules/@ebay/skin/utility.js","webpack://root/./docs/docs.css?378e","webpack://root/./node_modules/@ebay/skin/dist/button/button.css?9a44","webpack://root/./node_modules/@ebay/skin/dist/global/global.css?e001","webpack://root/./node_modules/@ebay/skin/dist/listbox-button/listbox-button.css?ea08","webpack://root/./node_modules/@ebay/skin/dist/tokens/evo-core.css?7a96","webpack://root/./node_modules/@ebay/skin/dist/tokens/evo-light.css?9c33","webpack://root/./node_modules/@ebay/skin/dist/utility/utility.css?6c3b","webpack://root/./packages/core/makeup-active-descendant/dist/cjs/index.js","webpack://root/./packages/core/makeup-exit-emitter/dist/cjs/index.js","webpack://root/./packages/core/makeup-expander/dist/cjs/index.js","webpack://root/./packages/core/makeup-focusables/dist/cjs/index.js","webpack://root/./packages/core/makeup-key-emitter/dist/cjs/index.js","webpack://root/./packages/core/makeup-navigation-emitter/dist/cjs/index.js","webpack://root/./packages/core/makeup-next-id/dist/cjs/index.js","webpack://root/./packages/core/makeup-prevent-scroll-keys/dist/cjs/index.js","webpack://root/./packages/ui/makeup-listbox-button/dist/cjs/index.js","webpack://root/./packages/ui/makeup-listbox/dist/cjs/index.js","webpack://root/webpack/bootstrap","webpack://root/webpack/runtime/make namespace object","webpack://root/./docs/ui/makeup-listbox-button/index.compiled.js"],"sourcesContent":["require('./dist/button/button.css');\n","require('./dist/global/global.css');\n","require('./dist/listbox-button/listbox-button.css');\n","require('./tokens/evo-core.js');\nrequire('./tokens/evo-light.js');\n","require('./../dist/tokens/evo-core.css');\n","require('./../dist/tokens/evo-light.css');\n","require('./dist/utility/utility.css');\n","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.createLinear = createLinear;\nvar NavigationEmitter = _interopRequireWildcard(require(\"makeup-navigation-emitter\"));\nvar _makeupNextId = _interopRequireDefault(require(\"makeup-next-id\"));\nfunction _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != typeof e && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if (\"default\" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\nconst defaultOptions = {\n activeDescendantClassName: \"active-descendant\",\n autoInit: \"none\",\n autoReset: \"none\",\n autoScroll: false,\n axis: \"both\",\n wrap: false\n};\nfunction onModelInit(e) {\n const {\n items,\n toIndex\n } = e.detail;\n const itemEl = items[toIndex];\n if (itemEl) {\n itemEl.classList.add(this._options.activeDescendantClassName);\n this._focusEl.setAttribute(\"aria-activedescendant\", itemEl.id);\n }\n this._el.dispatchEvent(new CustomEvent(\"activeDescendantInit\", {\n detail: e.detail\n }));\n}\nfunction onModelChange(e) {\n const {\n fromIndex,\n toIndex\n } = e.detail;\n const fromItem = this.items[fromIndex];\n const toItem = this.items[toIndex];\n if (fromItem) {\n fromItem.classList.remove(this._options.activeDescendantClassName);\n }\n if (toItem) {\n toItem.classList.add(this._options.activeDescendantClassName);\n this._focusEl.setAttribute(\"aria-activedescendant\", toItem.id);\n if (this._options.autoScroll && this._itemContainerEl) {\n this._itemContainerEl.scrollTop = toItem.offsetTop - this._itemContainerEl.offsetHeight / 2;\n }\n }\n this._el.dispatchEvent(new CustomEvent(\"activeDescendantChange\", {\n detail: e.detail\n }));\n}\nfunction onModelReset(e) {\n const toIndex = e.detail.toIndex;\n const activeClassName = this._options.activeDescendantClassName;\n this.items.forEach(function (el) {\n el.classList.remove(activeClassName);\n });\n if (toIndex !== null && toIndex !== -1) {\n const itemEl = this.items[toIndex];\n itemEl.classList.add(activeClassName);\n this._focusEl.setAttribute(\"aria-activedescendant\", itemEl.id);\n } else {\n this._focusEl.removeAttribute(\"aria-activedescendant\");\n }\n this._el.dispatchEvent(new CustomEvent(\"activeDescendantReset\", {\n detail: e.detail\n }));\n}\nfunction onModelMutation(e) {\n const {\n toIndex\n } = e.detail;\n const activeDescendantClassName = this._options.activeDescendantClassName;\n this.items.forEach(function (item, index) {\n (0, _makeupNextId.default)(item);\n if (index !== toIndex) {\n item.classList.remove(activeDescendantClassName);\n } else {\n item.classList.add(activeDescendantClassName);\n }\n });\n this._el.dispatchEvent(new CustomEvent(\"activeDescendantMutation\", {\n detail: e.detail\n }));\n}\nclass ActiveDescendant {\n constructor(el) {\n this._el = el;\n this._onMutationListener = onModelMutation.bind(this);\n this._onChangeListener = onModelChange.bind(this);\n this._onResetListener = onModelReset.bind(this);\n this._onInitListener = onModelInit.bind(this);\n this._el.addEventListener(\"navigationModelMutation\", this._onMutationListener);\n this._el.addEventListener(\"navigationModelChange\", this._onChangeListener);\n this._el.addEventListener(\"navigationModelReset\", this._onResetListener);\n this._el.addEventListener(\"navigationModelInit\", this._onInitListener);\n }\n destroy() {\n this._el.removeEventListener(\"navigationModelMutation\", this._onMutationListener);\n this._el.removeEventListener(\"navigationModelChange\", this._onChangeListener);\n this._el.removeEventListener(\"navigationModelReset\", this._onResetListener);\n this._el.removeEventListener(\"navigationModelInit\", this._onInitListener);\n }\n}\nclass LinearActiveDescendant extends ActiveDescendant {\n constructor(el, focusEl, itemContainerEl, itemSelector, selectedOptions) {\n super(el);\n this._options = Object.assign({}, defaultOptions, selectedOptions);\n this._focusEl = focusEl;\n this._itemContainerEl = itemContainerEl;\n this._itemSelector = itemSelector;\n\n // ensure container has an id\n (0, _makeupNextId.default)(this._itemContainerEl);\n\n // if programmatic relationship set aria-owns\n if (this._itemContainerEl !== this._focusEl) {\n focusEl.setAttribute(\"aria-owns\", this._itemContainerEl.id);\n }\n this._navigationEmitter = NavigationEmitter.createLinear(el, itemSelector, {\n autoInit: this._options.autoInit,\n autoReset: this._options.autoReset,\n axis: this._options.axis,\n ignoreByDelegateSelector: this._options.ignoreByDelegateSelector,\n wrap: this._options.wrap\n });\n\n // ensure each item has an id\n this.items.forEach(function (itemEl) {\n (0, _makeupNextId.default)(itemEl);\n });\n }\n get index() {\n return this._navigationEmitter.model.index;\n }\n set index(newIndex) {\n this._navigationEmitter.model.index = newIndex;\n }\n reset() {\n this._navigationEmitter.model.reset();\n }\n get currentItem() {\n return this._navigationEmitter.model.currentItem;\n }\n get items() {\n return this._navigationEmitter.model.items;\n }\n set wrap(newWrap) {\n this._navigationEmitter.model.options.wrap = newWrap;\n }\n destroy() {\n super.destroy();\n this._navigationEmitter.destroy();\n }\n}\n\n/*\nclass GridActiveDescendant extends ActiveDescendant {\n constructor(el, focusEl, containerEl, rowSelector, cellSelector) {\n super(el);\n }\n}\n*/\n\nfunction createLinear(el, focusEl, itemContainerEl, itemSelector, selectedOptions) {\n return new LinearActiveDescendant(el, focusEl, itemContainerEl, itemSelector, selectedOptions);\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.addFocusExit = addFocusExit;\nexports.removeFocusExit = removeFocusExit;\nvar _makeupNextId = _interopRequireDefault(require(\"makeup-next-id\"));\nfunction _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }\nconst focusExitEmitters = {};\nfunction doFocusExit(el, fromElement, toElement) {\n el.dispatchEvent(new CustomEvent(\"focusExit\", {\n detail: {\n fromElement,\n toElement\n },\n bubbles: false // mirror the native mouseleave event\n }));\n}\nfunction onDocumentFocusIn(e) {\n const newFocusElement = e.target;\n const targetIsDescendant = this.el.contains(newFocusElement);\n\n // if focus has moved to a focusable descendant\n if (targetIsDescendant === true) {\n // set the target as the currently focussed element\n this.currentFocusElement = newFocusElement;\n } else {\n // else focus has not gone to a focusable descendant\n window.removeEventListener(\"blur\", this.onWindowBlurListener);\n document.removeEventListener(\"focusin\", this.onDocumentFocusInListener);\n doFocusExit(this.el, this.currentFocusElement, newFocusElement);\n this.currentFocusElement = null;\n }\n}\nfunction onWindowBlur() {\n doFocusExit(this.el, this.currentFocusElement, undefined);\n}\nfunction onWidgetFocusIn() {\n // listen for focus moving to anywhere in document\n // note that mouse click on buttons, checkboxes and radios does not trigger focus events in all browsers!\n document.addEventListener(\"focusin\", this.onDocumentFocusInListener);\n // listen for focus leaving the window\n window.addEventListener(\"blur\", this.onWindowBlurListener);\n}\nclass FocusExitEmitter {\n constructor(el) {\n this.el = el;\n this.currentFocusElement = null;\n this.onWidgetFocusInListener = onWidgetFocusIn.bind(this);\n this.onDocumentFocusInListener = onDocumentFocusIn.bind(this);\n this.onWindowBlurListener = onWindowBlur.bind(this);\n this.el.addEventListener(\"focusin\", this.onWidgetFocusInListener);\n }\n removeEventListeners() {\n window.removeEventListener(\"blur\", this.onWindowBlurListener);\n document.removeEventListener(\"focusin\", this.onDocumentFocusInListener);\n this.el.removeEventListener(\"focusin\", this.onWidgetFocusInListener);\n }\n}\nfunction addFocusExit(el) {\n let exitEmitter = null;\n (0, _makeupNextId.default)(el);\n if (!focusExitEmitters[el.id]) {\n exitEmitter = new FocusExitEmitter(el);\n focusExitEmitters[el.id] = exitEmitter;\n }\n return exitEmitter;\n}\nfunction removeFocusExit(el) {\n const exitEmitter = focusExitEmitters[el.id];\n if (exitEmitter) {\n exitEmitter.removeEventListeners();\n delete focusExitEmitters[el.id];\n }\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _makeupNextId = _interopRequireDefault(require(\"makeup-next-id\"));\nvar ExitEmitter = _interopRequireWildcard(require(\"makeup-exit-emitter\"));\nvar _makeupFocusables = _interopRequireDefault(require(\"makeup-focusables\"));\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != typeof e && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if (\"default\" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\nfunction _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }\nconst defaultOptions = {\n alwaysDoFocusManagement: false,\n ariaControls: true,\n autoCollapse: false,\n collapseOnFocusOut: false,\n collapseOnMouseOut: false,\n collapseOnClickOut: false,\n collapseOnHostReFocus: false,\n contentSelector: \".expander__content\",\n expandedClass: null,\n expandOnClick: false,\n expandOnFocus: false,\n expandOnHover: false,\n focusManagement: null,\n hostSelector: \".expander__host\",\n simulateSpacebarClick: false\n};\nfunction onHostKeyDown(e) {\n if (e.keyCode === 13 || e.keyCode === 32) {\n this._keyboardClickFlag = true;\n }\n // if host element does not naturally trigger a click event on spacebar, we can force one to trigger here.\n // careful! if host already triggers click events naturally, we end up with a \"double-click\".\n if (e.keyCode === 32 && this.options.simulateSpacebarClick === true) {\n this.hostEl.click();\n }\n}\nfunction onHostMouseDown() {\n this._mouseClickFlag = true;\n}\nfunction onHostClick() {\n this._expandWasKeyboardClickActivated = this._keyboardClickFlag;\n this._expandWasMouseClickActivated = this._mouseClickFlag;\n this._widgetHasKeyboardFocus = this._keyboardClickFlag;\n this.expanded = !this.expanded;\n}\nfunction onHostFocus() {\n this._expandWasFocusActivated = true;\n this.expanded = true;\n}\n\n// NOTE: collapseOnHostReFocus cannot be used when expandOnFocus is true\nfunction onHostReFocus() {\n if (this.expanded && this._widgetHasKeyboardFocus) {\n this.expanded = false;\n }\n}\nfunction onHostHover() {\n clearTimeout(this._mouseLeft);\n this._expandWasHoverActivated = true;\n this.expanded = true;\n}\nfunction onFocusExit() {\n this._widgetHasKeyboardFocus = false;\n this.expanded = false;\n}\nfunction onMouseLeave() {\n clearTimeout(this._mouseLeft);\n this._mouseLeft = setTimeout(() => {\n this.expanded = false;\n }, 300);\n}\nfunction _onDocumentClick(e) {\n if (this.el.contains(e.target) === false) {\n this.expanded = false;\n }\n}\nfunction _onDocumentTouchStart() {\n this.documentClick = true;\n}\nfunction _onDocumentTouchMove() {\n this.documentClick = false;\n}\nfunction _onDocumentTouchEnd(e) {\n if (this.documentClick === true) {\n this.documentClick = false;\n if (this.el.contains(e.target) === false) {\n this.expanded = false;\n }\n }\n}\nfunction manageFocus(focusManagement, contentEl) {\n if (focusManagement === \"content\") {\n contentEl.setAttribute(\"tabindex\", \"-1\");\n contentEl.focus();\n } else if (focusManagement === \"focusable\") {\n var _focusables$;\n (_focusables$ = (0, _makeupFocusables.default)(contentEl)[0]) === null || _focusables$ === void 0 || _focusables$.focus();\n } else if (focusManagement === \"interactive\") {\n var _focusables$2;\n (_focusables$2 = (0, _makeupFocusables.default)(contentEl, true)[0]) === null || _focusables$2 === void 0 || _focusables$2.focus();\n } else if (focusManagement !== null) {\n const el = contentEl.querySelector(\"#\".concat(focusManagement));\n if (el) {\n el.focus();\n }\n }\n}\nclass _default {\n constructor(el, selectedOptions) {\n this.options = Object.assign({}, defaultOptions, selectedOptions);\n this.el = el;\n this.hostEl = el.querySelector(this.options.hostSelector); // the keyboard focusable host el\n this.contentEl = el.querySelector(this.options.contentSelector);\n ExitEmitter.addFocusExit(this.el);\n this._hostKeyDownListener = onHostKeyDown.bind(this);\n this._hostMouseDownListener = onHostMouseDown.bind(this);\n this._documentClickListener = _onDocumentClick.bind(this);\n this._documentTouchStartListener = _onDocumentTouchStart.bind(this);\n this._documentTouchMoveListener = _onDocumentTouchMove.bind(this);\n this._documentTouchEndListener = _onDocumentTouchEnd.bind(this);\n this._hostClickListener = onHostClick.bind(this);\n this._hostFocusListener = onHostFocus.bind(this);\n this._hostReFocusListener = onHostReFocus.bind(this);\n this._hostHoverListener = onHostHover.bind(this);\n this._focusExitListener = onFocusExit.bind(this);\n this._mouseLeaveListener = onMouseLeave.bind(this);\n if (this.hostEl.getAttribute(\"aria-expanded\") === null) {\n this.hostEl.setAttribute(\"aria-expanded\", \"false\");\n }\n if (this.options.ariaControls === true) {\n // ensure the widget has an id\n (0, _makeupNextId.default)(this.el, \"expander\");\n this.contentEl.id = this.contentEl.id || \"\".concat(this.el.id, \"-content\");\n this.hostEl.setAttribute(\"aria-controls\", this.contentEl.id);\n }\n this.expandOnClick = this.options.expandOnClick;\n this.expandOnFocus = this.options.expandOnFocus;\n this.expandOnHover = this.options.expandOnHover;\n this.collapseOnHostReFocus = this.options.collapseOnHostReFocus;\n if (this.options.autoCollapse === false) {\n this.collapseOnClickOut = this.options.collapseOnClickOut;\n this.collapseOnFocusOut = this.options.collapseOnFocusOut;\n this.collapseOnMouseOut = this.options.collapseOnMouseOut;\n }\n }\n set expandOnClick(bool) {\n if (bool === true) {\n this.hostEl.addEventListener(\"keydown\", this._hostKeyDownListener);\n this.hostEl.addEventListener(\"mousedown\", this._hostMouseDownListener);\n this.hostEl.addEventListener(\"click\", this._hostClickListener);\n if (this.options.autoCollapse === true) {\n this.collapseOnClickOut = true;\n this.collapseOnFocusOut = true;\n }\n } else {\n this.hostEl.removeEventListener(\"click\", this._hostClickListener);\n this.hostEl.removeEventListener(\"mousedown\", this._hostMouseDownListener);\n this.hostEl.removeEventListener(\"keydown\", this._hostKeyDownListener);\n }\n }\n set expandOnFocus(bool) {\n if (bool === true) {\n this.hostEl.addEventListener(\"focus\", this._hostFocusListener);\n if (this.options.autoCollapse === true) {\n this.collapseOnClickOut = true;\n this.collapseOnFocusOut = true;\n }\n } else {\n this.hostEl.removeEventListener(\"focus\", this._hostFocusListener);\n }\n }\n set collapseOnHostReFocus(bool) {\n if (bool === true) {\n this.hostEl.addEventListener(\"focus\", this._hostReFocusListener);\n } else {\n this.hostEl.removeEventListener(\"focus\", this._hostReFocusListener);\n }\n }\n set expandOnHover(bool) {\n if (bool === true) {\n this.hostEl.addEventListener(\"mouseenter\", this._hostHoverListener);\n this.contentEl.addEventListener(\"mouseenter\", this._hostHoverListener);\n if (this.options.autoCollapse === true) {\n this.collapseOnMouseOut = true;\n }\n } else {\n this.hostEl.removeEventListener(\"mouseenter\", this._hostHoverListener);\n this.contentEl.removeEventListener(\"mouseenter\", this._hostHoverListener);\n }\n }\n set collapseOnClickOut(bool) {\n if (bool === true) {\n document.addEventListener(\"click\", this._documentClickListener);\n document.addEventListener(\"touchstart\", this._documentTouchStartListener);\n document.addEventListener(\"touchmove\", this._documentTouchMoveListener);\n document.addEventListener(\"touchend\", this._documentTouchEndListener);\n } else {\n document.removeEventListener(\"click\", this._documentClickListener);\n document.removeEventListener(\"touchstart\", this._documentTouchStartListener);\n document.removeEventListener(\"touchmove\", this._documentTouchMoveListener);\n document.removeEventListener(\"touchend\", this._documentTouchEndListener);\n }\n }\n set collapseOnFocusOut(bool) {\n if (bool === true) {\n this.el.addEventListener(\"focusExit\", this._focusExitListener);\n } else {\n this.el.removeEventListener(\"focusExit\", this._focusExitListener);\n }\n }\n set collapseOnMouseOut(bool) {\n if (bool === true) {\n this.el.addEventListener(\"mouseleave\", this._mouseLeaveListener);\n this.contentEl.addEventListener(\"mouseleave\", this._mouseLeaveListener);\n } else {\n this.el.removeEventListener(\"mouseleave\", this._mouseLeaveListener);\n this.contentEl.removeEventListener(\"mouseleave\", this._mouseLeaveListener);\n }\n }\n get expanded() {\n return this.hostEl.getAttribute(\"aria-expanded\") === \"true\";\n }\n set expanded(bool) {\n if (bool === true && this.expanded === false) {\n this.hostEl.setAttribute(\"aria-expanded\", \"true\");\n if (this.options.expandedClass) {\n this.el.classList.add(this.options.expandedClass);\n }\n if (this._expandWasKeyboardClickActivated || this._expandWasMouseClickActivated && this.options.alwaysDoFocusManagement) {\n manageFocus(this.options.focusManagement, this.contentEl);\n }\n this.el.dispatchEvent(new CustomEvent(\"expander-expand\", {\n bubbles: true,\n detail: this.contentEl\n }));\n }\n if (bool === false && this.expanded === true) {\n this.hostEl.setAttribute(\"aria-expanded\", \"false\");\n if (this.options.expandedClass) {\n this.el.classList.remove(this.options.expandedClass);\n }\n this.el.dispatchEvent(new CustomEvent(\"expander-collapse\", {\n bubbles: true,\n detail: this.contentEl\n }));\n }\n this._expandWasKeyboardClickActivated = false;\n this._expandWasMouseClickActivated = false;\n this._expandWasFocusActivated = false;\n this._expandWasHoverActivated = false;\n this._keyboardClickFlag = false;\n this._mouseClickFlag = false;\n }\n sleep() {\n if (this._destroyed !== true) {\n this.expandOnClick = false;\n this.expandOnFocus = false;\n this.expandOnHover = false;\n this.collapseOnClickOut = false;\n this.collapseOnFocusOut = false;\n this.collapseOnMouseOut = false;\n this.collapseOnHostReFocus = false;\n }\n }\n destroy() {\n this.sleep();\n this._destroyed = true;\n this._hostKeyDownListener = null;\n this._hostMouseDownListener = null;\n this._documentClickListener = null;\n this._documentTouchStartListener = null;\n this._documentTouchMoveListener = null;\n this._documentTouchEndListener = null;\n this._hostClickListener = null;\n this._hostFocusListener = null;\n this._hostReFocusListener = null;\n this._hostHoverListener = null;\n this._focusExitListener = null;\n this._mouseLeaveListener = null;\n this._widgetHasKeyboardFocus = null;\n }\n}\nexports.default = _default;\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = _default;\nconst focusableElList = [\"a[href]\", \"area[href]\", \"button:not([disabled])\", \"embed\", \"iframe\", \"input:not([disabled])\", \"object\", \"select:not([disabled])\", \"textarea:not([disabled])\", \"*[tabindex]\", \"*[contenteditable]\"];\nconst focusableElSelector = focusableElList.join();\nfunction _default(el) {\n let keyboardOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n let callback = arguments.length > 2 ? arguments[2] : undefined;\n if (callback) {\n const request = requestAnimationFrame(() => {\n callback(getFocusables(el, keyboardOnly));\n });\n return () => {\n cancelAnimationFrame(request);\n };\n }\n return getFocusables(el, keyboardOnly);\n}\nfunction getFocusables(el) {\n let keyboardOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n let focusableEls = Array.prototype.slice.call(el.querySelectorAll(focusableElSelector));\n\n // filter out elements with display: none or nested in a display: none parent\n focusableEls = focusableEls.filter(function (focusableEl) {\n return !!(focusableEl.offsetWidth || focusableEl.offsetHeight || focusableEl.getClientRects().length);\n });\n if (keyboardOnly === true) {\n focusableEls = focusableEls.filter(function (focusableEl) {\n return focusableEl.getAttribute(\"tabindex\") !== \"-1\";\n });\n }\n return focusableEls;\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.add = add;\nexports.addKeyDown = addKeyDown;\nexports.addKeyUp = addKeyUp;\nexports.remove = remove;\nexports.removeKeyDown = removeKeyDown;\nexports.removeKeyUp = removeKeyUp;\nfunction uncapitalizeFirstLetter(str) {\n return str.charAt(0).toLowerCase() + str.slice(1);\n}\nfunction onKeyDownOrUp(evt, el, keyEventType) {\n if (!evt.shiftKey) {\n const key = evt.key;\n switch (key) {\n case \"Enter\":\n case \"Escape\":\n case \"PageUp\":\n case \"PageDown\":\n case \"End\":\n case \"Home\":\n case \"ArrowLeft\":\n case \"ArrowUp\":\n case \"ArrowRight\":\n case \"ArrowDown\":\n el.dispatchEvent(new CustomEvent(uncapitalizeFirstLetter(\"\".concat(key, \"Key\").concat(keyEventType)), {\n detail: evt,\n bubbles: true\n }));\n break;\n case \" \":\n el.dispatchEvent(new CustomEvent(\"spacebarKey\".concat(keyEventType), {\n detail: evt,\n bubbles: true\n }));\n break;\n default:\n return;\n }\n }\n}\nfunction onKeyDown(e) {\n onKeyDownOrUp(e, this, \"Down\");\n}\nfunction onKeyUp(e) {\n onKeyDownOrUp(e, this, \"Up\");\n}\nfunction addKeyDown(el) {\n el.addEventListener(\"keydown\", onKeyDown);\n}\nfunction addKeyUp(el) {\n el.addEventListener(\"keyup\", onKeyUp);\n}\nfunction removeKeyDown(el) {\n el.removeEventListener(\"keydown\", onKeyDown);\n}\nfunction removeKeyUp(el) {\n el.removeEventListener(\"keyup\", onKeyUp);\n}\nfunction add(el) {\n addKeyDown(el);\n addKeyUp(el);\n}\nfunction remove(el) {\n removeKeyDown(el);\n removeKeyUp(el);\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.createLinear = createLinear;\nvar KeyEmitter = _interopRequireWildcard(require(\"makeup-key-emitter\"));\nvar ExitEmitter = _interopRequireWildcard(require(\"makeup-exit-emitter\"));\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != typeof e && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if (\"default\" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\nconst defaultOptions = {\n axis: \"both\",\n autoInit: \"interactive\",\n autoReset: \"current\",\n ignoreByDelegateSelector: null,\n wrap: false\n};\nfunction isItemNavigable(el) {\n return !el.hidden && el.getAttribute(\"aria-disabled\") !== \"true\";\n}\nfunction isIndexNavigable(items, index) {\n return index >= 0 && index < items.length ? isItemNavigable(items[index]) : false;\n}\nfunction findNavigableItems(items) {\n return items.filter(isItemNavigable);\n}\nfunction findFirstNavigableIndex(items) {\n return items.findIndex(item => isItemNavigable(item));\n}\nfunction findLastNavigableIndex(items) {\n // todo: at(-1) is more performant than reverse(), but Babel is not transpiling it\n return items.indexOf(findNavigableItems(items).reverse()[0]);\n}\nfunction findIndexByAttribute(items, attribute, value) {\n return items.findIndex(item => isItemNavigable(item) && item.getAttribute(attribute) === value);\n}\nfunction findFirstNavigableAriaCheckedIndex(items) {\n return findIndexByAttribute(items, \"aria-checked\", \"true\");\n}\nfunction findFirstNavigableAriaSelectedIndex(items) {\n return findIndexByAttribute(items, \"aria-selected\", \"true\");\n}\nfunction findIgnoredByDelegateItems(el, options) {\n return options.ignoreByDelegateSelector !== null ? [...el.querySelectorAll(options.ignoreByDelegateSelector)] : [];\n}\nfunction findPreviousNavigableIndex(items, index, wrap) {\n let previousNavigableIndex = -1;\n if (index === null || atStart(items, index)) {\n if (wrap === true) {\n previousNavigableIndex = findLastNavigableIndex(items);\n }\n } else {\n let i = index;\n while (--i >= 0) {\n if (isItemNavigable(items[i])) {\n previousNavigableIndex = i;\n break;\n }\n }\n }\n return previousNavigableIndex;\n}\nfunction findNextNavigableIndex(items, index, wrap) {\n let nextNavigableIndex = -1;\n if (index === null) {\n nextNavigableIndex = findFirstNavigableIndex(items);\n } else if (atEnd(items, index)) {\n if (wrap === true) {\n nextNavigableIndex = findFirstNavigableIndex(items);\n }\n } else {\n let i = index;\n while (++i < items.length) {\n if (isItemNavigable(items[i])) {\n nextNavigableIndex = i;\n break;\n }\n }\n }\n return nextNavigableIndex;\n}\n\n// returning -1 means not found\nfunction findIndexPositionByType(typeOrNum, items, currentIndex) {\n let index = -1;\n switch (typeOrNum) {\n case \"none\":\n index = null;\n break;\n case \"current\":\n index = currentIndex;\n break;\n case \"interactive\":\n index = findFirstNavigableIndex(items);\n break;\n case \"ariaChecked\":\n index = findFirstNavigableAriaCheckedIndex(items);\n break;\n case \"ariaSelected\":\n index = findFirstNavigableAriaSelectedIndex(items);\n break;\n case \"ariaSelectedOrInteractive\":\n index = findFirstNavigableAriaSelectedIndex(items);\n index = index === -1 ? findFirstNavigableIndex(items) : index;\n break;\n default:\n index = typeof typeOrNum === \"number\" || typeOrNum === null ? typeOrNum : -1;\n }\n return index;\n}\nfunction atStart(items, index) {\n return index === findFirstNavigableIndex(items);\n}\nfunction atEnd(items, index) {\n return index === findLastNavigableIndex(items);\n}\nfunction onKeyPrev(e) {\n const ignoredByDelegateItems = findIgnoredByDelegateItems(this._el, this.options);\n\n // todo: update KeyEmitter to deal with ignored items?\n if (ignoredByDelegateItems.length === 0 || !ignoredByDelegateItems.includes(e.detail.target)) {\n this.index = findPreviousNavigableIndex(this.items, this.index, this.options.wrap);\n }\n}\nfunction onKeyNext(e) {\n const ignoredByDelegateItems = findIgnoredByDelegateItems(this._el, this.options);\n\n // todo: update KeyEmitter to deal with ignored items?\n if (ignoredByDelegateItems.length === 0 || !ignoredByDelegateItems.includes(e.detail.target)) {\n this.index = findNextNavigableIndex(this.items, this.index, this.options.wrap);\n }\n}\nfunction onClick(e) {\n const itemIndex = this.indexOf(e.target.closest(this._itemSelector));\n if (isIndexNavigable(this.items, itemIndex)) {\n this.index = itemIndex;\n }\n}\nfunction onKeyHome(e) {\n const ignoredByDelegateItems = findIgnoredByDelegateItems(this._el, this.options);\n\n // todo: update KeyEmitter to deal with ignored items?\n if (ignoredByDelegateItems.length === 0 || !ignoredByDelegateItems.includes(e.detail.target)) {\n this.index = findFirstNavigableIndex(this.items);\n }\n}\nfunction onKeyEnd(e) {\n const ignoredByDelegateItems = findIgnoredByDelegateItems(this._el, this.options);\n\n // todo: update KeyEmitter to deal with ignored items?\n if (ignoredByDelegateItems.length === 0 || !ignoredByDelegateItems.includes(e.detail.target)) {\n this.index = findLastNavigableIndex(this.items);\n }\n}\nfunction onFocusExit() {\n if (this.options.autoReset !== null) {\n this.reset();\n }\n}\nfunction onMutation(e) {\n const fromIndex = this.index;\n let toIndex = this.index;\n // https://developer.mozilla.org/en-US/docs/Web/API/MutationRecord\n const {\n addedNodes,\n attributeName,\n removedNodes,\n target,\n type\n } = e[0];\n if (type === \"attributes\") {\n if (target === this.currentItem) {\n if (attributeName === \"aria-disabled\") {\n // current item was disabled - keep it as current index (until a keyboard navigation happens)\n toIndex = this.index;\n } else if (attributeName === \"hidden\") {\n // current item was hidden and focus is lost - reset index to first interactive element\n toIndex = findFirstNavigableIndex(this.items);\n }\n } else {\n toIndex = this.index;\n }\n } else if (type === \"childList\") {\n if (removedNodes.length > 0 && [...removedNodes].includes(this._cachedElement)) {\n // current item was removed and focus is lost - reset index to first interactive element\n toIndex = findFirstNavigableIndex(this.items);\n } else if (removedNodes.length > 0 || addedNodes.length > 0) {\n // nodes were added and/or removed - keep current item and resync its index\n toIndex = this.indexOf(this._cachedElement);\n }\n }\n this._index = toIndex;\n this._el.dispatchEvent(new CustomEvent(\"navigationModelMutation\", {\n bubbles: false,\n detail: {\n fromIndex,\n toIndex\n }\n }));\n}\nclass NavigationModel {\n /**\n * @param {HTMLElement} el\n * @param {string} itemSelector\n * @param {typeof defaultOptions} selectedOptions\n */\n constructor(el, itemSelector, selectedOptions) {\n /** @member {typeof defaultOptions} */\n this.options = Object.assign({}, defaultOptions, selectedOptions);\n\n /** @member {HTMLElement} */\n this._el = el;\n\n /** @member {string} */\n this._itemSelector = itemSelector;\n }\n}\nclass LinearNavigationModel extends NavigationModel {\n /**\n * @param {HTMLElement} el\n * @param {string} itemSelector\n * @param {typeof defaultOptions} selectedOptions\n */\n constructor(el, itemSelector, selectedOptions) {\n super(el, itemSelector, selectedOptions);\n const fromIndex = this._index;\n const toIndex = findIndexPositionByType(this.options.autoInit, this.items, this.index);\n\n // do not use setter as it will trigger a change event\n this._index = toIndex;\n\n // always keep an element reference to the last item (for use in mutation observer)\n // todo: convert index to Tuple to store last/current values instead?\n this._cachedElement = this.items[toIndex];\n this._el.dispatchEvent(new CustomEvent(\"navigationModelInit\", {\n bubbles: false,\n detail: {\n firstInteractiveIndex: this.firstNavigableIndex,\n fromIndex,\n items: this.items,\n toIndex\n }\n }));\n }\n get currentItem() {\n return this.items[this.index];\n }\n\n // todo: code smell as getter abstracts that the query selector re-runs every time getter is accessed\n get items() {\n return [...this._el.querySelectorAll(\"\".concat(this._itemSelector))];\n }\n get index() {\n return this._index;\n }\n\n /**\n * @param {number} toIndex - update index position in this.items (non-interactive indexes fail silently)\n */\n set index(toIndex) {\n if (toIndex === this.index) {\n return;\n } else if (!isIndexNavigable(this.items, toIndex)) {\n // no-op. throw exception?\n } else {\n const fromIndex = this.index;\n // update cached element reference (for use in mutation observer if DOM node gets removed)\n this._cachedElement = this.items[toIndex];\n this._index = toIndex;\n this._el.dispatchEvent(new CustomEvent(\"navigationModelChange\", {\n bubbles: false,\n detail: {\n fromIndex,\n toIndex\n }\n }));\n }\n }\n indexOf(element) {\n return this.items.indexOf(element);\n }\n reset() {\n const fromIndex = this.index;\n const toIndex = findIndexPositionByType(this.options.autoReset, this.items, this.index);\n if (toIndex !== fromIndex) {\n // do not use setter as it will trigger a navigationModelChange event\n this._index = toIndex;\n this._el.dispatchEvent(new CustomEvent(\"navigationModelReset\", {\n bubbles: false,\n detail: {\n fromIndex,\n toIndex\n }\n }));\n }\n }\n}\n\n// 2D Grid Model will go here\n\n/*\nclass GridModel extends NavigationModel {\n constructor(el, rowSelector, colSelector) {\n super();\n this._coords = null;\n }\n}\n*/\n\nclass NavigationEmitter {\n /**\n * @param {HTMLElement} el\n * @param {LinearNavigationModel} model\n */\n constructor(el, model) {\n this.model = model;\n this.el = el;\n this._keyPrevListener = onKeyPrev.bind(model);\n this._keyNextListener = onKeyNext.bind(model);\n this._keyHomeListener = onKeyHome.bind(model);\n this._keyEndListener = onKeyEnd.bind(model);\n this._clickListener = onClick.bind(model);\n this._focusExitListener = onFocusExit.bind(model);\n this._observer = new MutationObserver(onMutation.bind(model));\n KeyEmitter.addKeyDown(this.el);\n ExitEmitter.addFocusExit(this.el);\n const axis = model.options.axis;\n if (axis === \"both\" || axis === \"x\") {\n this.el.addEventListener(\"arrowLeftKeyDown\", this._keyPrevListener);\n this.el.addEventListener(\"arrowRightKeyDown\", this._keyNextListener);\n }\n if (axis === \"both\" || axis === \"y\") {\n this.el.addEventListener(\"arrowUpKeyDown\", this._keyPrevListener);\n this.el.addEventListener(\"arrowDownKeyDown\", this._keyNextListener);\n }\n this.el.addEventListener(\"homeKeyDown\", this._keyHomeListener);\n this.el.addEventListener(\"endKeyDown\", this._keyEndListener);\n this.el.addEventListener(\"click\", this._clickListener);\n this.el.addEventListener(\"focusExit\", this._focusExitListener);\n this._observer.observe(this.el, {\n childList: true,\n subtree: true,\n attributeFilter: [\"aria-disabled\", \"hidden\"],\n attributes: true,\n attributeOldValue: true\n });\n }\n destroy() {\n KeyEmitter.removeKeyDown(this.el);\n ExitEmitter.removeFocusExit(this.el);\n this.el.removeEventListener(\"arrowLeftKeyDown\", this._keyPrevListener);\n this.el.removeEventListener(\"arrowRightKeyDown\", this._keyNextListener);\n this.el.removeEventListener(\"arrowUpKeyDown\", this._keyPrevListener);\n this.el.removeEventListener(\"arrowDownKeyDown\", this._keyNextListener);\n this.el.removeEventListener(\"homeKeyDown\", this._keyHomeListener);\n this.el.removeEventListener(\"endKeyDown\", this._keyEndListener);\n this.el.removeEventListener(\"click\", this._clickListener);\n this.el.removeEventListener(\"focusExit\", this._focusExitListener);\n this._observer.disconnect();\n }\n}\nfunction createLinear(el, itemSelector, selectedOptions) {\n const model = new LinearNavigationModel(el, itemSelector, selectedOptions);\n return new NavigationEmitter(el, model);\n}\n\n/*\nstatic createGrid(el, rowSelector, colSelector, selectedOptions) {\n return null;\n}\n*/\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = _default;\nconst sequenceMap = {};\nconst defaultPrefix = \"nid\";\nconst randomPortion = createRandomPortion(3);\nfunction randomNumber(max) {\n return Math.floor(Math.random() * max);\n}\nfunction createRandomPortion(size) {\n const letters = \"abcdefghijklmnopqrstuvwxyz\";\n const digits = \"0123456789\";\n const allChars = letters + digits;\n\n // to ensure a valid HTML ID (when prefix is empty), first character must be a letter\n let portion = letters[randomNumber(25)];\n\n // start iterating from 1, as we already have our first char\n for (let i = 1; i < size; i++) {\n portion += allChars[randomNumber(35)];\n }\n return portion;\n}\nfunction _default(el) {\n let prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultPrefix;\n const separator = prefix === \"\" ? \"\" : \"-\";\n\n // join first prefix with random portion to create key\n const key = \"\".concat(prefix).concat(separator).concat(randomPortion);\n\n // initialise key in sequence map if necessary\n sequenceMap[key] = sequenceMap[key] || 0;\n if (!el.id) {\n el.setAttribute(\"id\", \"\".concat(key, \"-\").concat(sequenceMap[key]++));\n }\n return el.id;\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.add = add;\nexports.remove = remove;\nfunction onKeyDown(e) {\n if (e.keyCode >= 32 && e.keyCode <= 40) {\n e.preventDefault();\n }\n}\nfunction add(el) {\n el.addEventListener(\"keydown\", onKeyDown);\n}\nfunction remove(el) {\n el.removeEventListener(\"keydown\", onKeyDown);\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _makeupExpander = _interopRequireDefault(require(\"makeup-expander\"));\nvar _makeupListbox = _interopRequireDefault(require(\"makeup-listbox\"));\nfunction _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }\nconst defaultOptions = {\n autoSelect: true,\n buttonLabelSelector: \".btn__text\",\n collapseTimeout: 150,\n customElementMode: false,\n listboxSelector: \".listbox-button__listbox\",\n floatingLabelSelector: \".btn__floating-label\",\n floatingLabelInline: \"btn__floating-label--inline\",\n floatingLabelAnimate: \"btn__floating-label--animate\",\n valueSelector: \".listbox-button__value\",\n buttonValueType: \"text\",\n // [\"text\", \"icon\", \"both\"],\n listboxOptionIconSelector: \".icon\",\n listboxOptionAriaLabelSelector: null\n};\nclass _default {\n constructor(widgetEl, selectedOptions) {\n var _this$_buttonEl$datas;\n this._options = Object.assign({}, defaultOptions, selectedOptions);\n this.el = widgetEl;\n this._buttonEl = this.el.querySelector(\"button\");\n this._buttonLabelEl = widgetEl.querySelector(this._options.buttonLabelSelector);\n this._buttonFloatingLabelEl = widgetEl.querySelector(this._options.floatingLabelSelector);\n this._buttonPrefix = (_this$_buttonEl$datas = this._buttonEl.dataset) === null || _this$_buttonEl$datas === void 0 ? void 0 : _this$_buttonEl$datas.listboxButtonPrefix;\n this._listboxEl = this.el.querySelector(this._options.listboxSelector);\n this._onButtonFirstClickListener = _onButtonFirstClick.bind(this);\n this._onListboxClickListener = _onListboxClick.bind(this);\n this._onListboxKeyDownListener = _onListboxKeyDown.bind(this);\n this._onListboxInitListener = _onListboxInit.bind(this);\n this._onListboxChangeListener = _onListboxChange.bind(this);\n this._onMutationListener = _onMutation.bind(this);\n if (!this._options.customElementMode) {\n this._mutationObserver = new MutationObserver(this._onMutationListener);\n this._observeMutations();\n this._observeEvents();\n }\n this.listbox = new _makeupListbox.default(this._listboxEl, {\n activeDescendantClassName: \"listbox-button__option--active\",\n autoReset: \"ariaSelectedOrInteractive\",\n autoSelect: this._options.autoSelect,\n valueSelector: this._options.valueSelector\n });\n this._expander = new _makeupExpander.default(this.el, {\n alwaysDoFocusManagement: true,\n autoCollapse: true,\n collapseOnHostReFocus: true,\n contentSelector: this._options.listboxSelector,\n expandedClass: \"listbox-button--expanded\",\n expandOnClick: true,\n focusManagement: \"focusable\",\n hostSelector: \"button\"\n });\n this.el.classList.add(\"listbox-button--js\");\n if (this._buttonFloatingLabelEl) {\n if (!this._buttonLabelEl.innerText) {\n this._buttonFloatingLabelEl.classList.add(this._options.floatingLabelInline);\n }\n }\n }\n _observeMutations() {\n if (!this._options.customElementMode) {\n this._mutationObserver.observe(this._buttonEl, {\n attributeFilter: [\"aria-expanded\"],\n attributes: true,\n childList: false,\n subtree: false\n });\n }\n }\n _unobserveMutations() {\n if (!this._options.customElementMode) {\n this._mutationObserver.disconnect();\n }\n }\n _unobserveEvents() {\n this._buttonEl.removeEventListener(\"click\", this._onButtonFirstClickListener);\n this._listboxEl.removeEventListener(\"click\", this._onListboxClickListener);\n this._listboxEl.removeEventListener(\"keydown\", this._onListboxKeyDownListener);\n this._listboxEl.removeEventListener(\"makeup-listbox-init\", this._onListboxInitListener);\n this._listboxEl.removeEventListener(\"makeup-listbox-change\", this._onListboxChangeListener);\n }\n _observeEvents() {\n if (this._destroyed !== true) {\n this._buttonEl.addEventListener(\"click\", this._onButtonFirstClickListener, {\n once: true\n });\n this._listboxEl.addEventListener(\"click\", this._onListboxClickListener);\n this._listboxEl.addEventListener(\"keydown\", this._onListboxKeyDownListener);\n this._listboxEl.addEventListener(\"makeup-listbox-init\", this._onListboxInitListener);\n this._listboxEl.addEventListener(\"makeup-listbox-change\", this._onListboxChangeListener);\n }\n }\n collapse() {\n const widget = this;\n setTimeout(function () {\n widget._unobserveMutations();\n widget._expander.expanded = false;\n widget._observeMutations();\n widget._buttonEl.focus();\n }, this._options.collapseTimeout);\n }\n destroy() {\n this._destroyed = true;\n this._unobserveEvents();\n this._unobserveMutations();\n this._onButtonFirstClickListener = null;\n this._onListboxClickListener = null;\n this._onListboxKeyDownListener = null;\n this._onListboxInitListener = null;\n this._onListboxChangeListener = null;\n this._onMutationListener = null;\n }\n}\n\n// listbox element should be hidden in initial SSR markup (for progressive enhancement)\nexports.default = _default;\nfunction _onButtonFirstClick() {\n this.listbox.el.hidden = false;\n}\nfunction _onListboxKeyDown(e) {\n if (e.keyCode === 13 || e.keyCode === 27 || e.keyCode === 32) {\n this.collapse();\n }\n}\nfunction _onListboxClick() {\n this.collapse();\n}\nfunction _onListboxInit(e) {\n this.el.dispatchEvent(new CustomEvent(\"makeup-listbox-button-init\", {\n detail: e.detail\n }));\n}\nfunction _onListboxChange(e) {\n const toValue = e.detail.optionValue;\n const {\n listboxOptionIconSelector,\n listboxOptionAriaLabelSelector,\n buttonValueType,\n floatingLabelAnimate,\n floatingLabelInline\n } = this._options;\n const icon = e.detail.el.querySelector(listboxOptionIconSelector).cloneNode(true);\n let btnContent = this._buttonPrefix ? \"\".concat(this._buttonPrefix).concat(toValue) : toValue;\n if (icon) {\n switch (buttonValueType) {\n case \"both\":\n btnContent = \"\".concat(icon.outerHTML, \" \").concat(btnContent, \"\");\n break;\n case \"icon\":\n this._buttonEl.setAttribute(\"aria-label\", btnContent);\n btnContent = icon.outerHTML;\n break;\n default:\n break;\n }\n }\n if (listboxOptionAriaLabelSelector) {\n var _e$detail$el$querySel;\n const selectorText = (_e$detail$el$querySel = e.detail.el.querySelector(listboxOptionAriaLabelSelector)) === null || _e$detail$el$querySel === void 0 ? void 0 : _e$detail$el$querySel.innerText.trim();\n this._buttonEl.setAttribute(\"aria-label\", this._buttonPrefix ? \"\".concat(this._buttonPrefix, \" \").concat(selectorText) : selectorText);\n }\n this._buttonLabelEl.innerHTML = btnContent;\n if (this._buttonFloatingLabelEl) {\n if (toValue) {\n this._buttonFloatingLabelEl.classList.add(floatingLabelAnimate);\n this._buttonFloatingLabelEl.classList.remove(floatingLabelInline);\n } else {\n this._buttonFloatingLabelEl.classList.add(floatingLabelInline);\n }\n }\n this.el.dispatchEvent(new CustomEvent(\"makeup-listbox-button-change\", {\n detail: e.detail\n }));\n}\nfunction _onMutation(mutationsList) {\n for (const mutation of mutationsList) {\n if (mutation.type === \"attributes\") {\n this.el.dispatchEvent(new CustomEvent(\"makeup-listbox-button-mutation\", {\n detail: {\n attributeName: mutation.attributeName\n }\n }));\n }\n }\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar ActiveDescendant = _interopRequireWildcard(require(\"makeup-active-descendant\"));\nvar PreventScrollKeys = _interopRequireWildcard(require(\"makeup-prevent-scroll-keys\"));\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != typeof e && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if (\"default\" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\n/**\n * A listbox can be a standalone focusable widget, or controlled by a separate, focusable widget\n * (a textbox for example, in the case of a combobox or datepicker)\n *\n * This listbox code currently supports single-selct only!\n * This code has been copied from Skin & MIND Patterns and has not yet been cleaned up.\n */\n\nconst defaultOptions = {\n activeDescendantClassName: \"listbox__option--active\",\n // the classname applied to the current active desdcendant\n autoInit: \"ariaSelectedOrInteractive\",\n autoReset: \"ariaSelectedOrInteractive\",\n autoSelect: true,\n // when true, aria-checked state matches active-descendant\n autoScroll: true,\n // when true, the listbox will scroll to keep the activeDescendant in view\n customElementMode: false,\n focusableElement: null,\n // used in a combobox/datepicker scenario\n listboxOwnerElement: null,\n // used in a combobox/datepicker scenario\n multiSelect: false,\n // todo\n useAriaChecked: true,\n // doubles up on support for aria-selected to announce visible selected/checked state\n valueSelector: \".listbox__value\" // Selector to get value from\n};\nfunction isSpacebarOrEnter(keyCode) {\n return keyCode === 13 || keyCode === 32;\n}\nclass _default {\n constructor(widgetEl, selectedOptions) {\n this._options = Object.assign({}, defaultOptions, selectedOptions);\n this.el = widgetEl;\n\n // in cases such as combobox, the active-descendant logic is controlled by a parent widget\n this._activeDescendantRootEl = this._options.listboxOwnerElement || this.el;\n\n // todo: not sure this check is needed any more\n if (widgetEl.getAttribute(\"role\") === \"listbox\") {\n this._listboxEl = widgetEl;\n } else {\n this._listboxEl = this.el.querySelector(\"[role=listbox]\");\n }\n if (!this._options.focusableElement && this._listboxEl.getAttribute(\"tabindex\") === null) {\n this._listboxEl.setAttribute(\"tabindex\", \"0\");\n }\n PreventScrollKeys.add(this.el);\n this._onKeyDownListener = _onKeyDown.bind(this);\n this._onClickListener = _onClick.bind(this);\n this._onActiveDescendantChangeListener = _onActiveDescendantChange.bind(this);\n this._onMutationListener = _onMutation.bind(this);\n this.el.classList.add(\"listbox--js\");\n if (!this._options.customElementMode) {\n this._mutationObserver = new MutationObserver(this._onMutationListener);\n this._observeMutations();\n this._observeEvents();\n }\n this._activeDescendant = ActiveDescendant.createLinear(this._activeDescendantRootEl, this._options.focusableElement || this._listboxEl, this._listboxEl.parentElement, \"[role=option]\", {\n activeDescendantClassName: this._options.activeDescendantClassName,\n autoInit: this._options.autoInit,\n autoReset: this._options.autoReset,\n autoScroll: this._options.autoScroll,\n axis: \"y\"\n });\n }\n _observeMutations() {\n if (!this._options.customElementMode) {\n this._mutationObserver.observe(this._listboxEl, {\n attributeFilter: [\"aria-selected\"],\n attributes: true,\n childList: true,\n subtree: true\n });\n }\n }\n _unobserveMutations() {\n if (!this._options.customElementMode) {\n this._mutationObserver.disconnect();\n }\n }\n _observeEvents() {\n if (this._destroyed !== true) {\n this._activeDescendantRootEl.addEventListener(\"activeDescendantChange\", this._onActiveDescendantChangeListener);\n this._listboxEl.addEventListener(\"keydown\", this._onKeyDownListener);\n this._listboxEl.addEventListener(\"click\", this._onClickListener);\n }\n }\n _unobserveEvents() {\n this._listboxEl.removeEventListener(\"keydown\", this._onKeyDownListener);\n this._listboxEl.removeEventListener(\"click\", this._onClickListener);\n this._activeDescendantRootEl.removeEventListener(\"activeDescendantChange\", this._onActiveDescendantChangeListener);\n }\n get index() {\n return this.items.findIndex(el => el.getAttribute(\"aria-selected\") === \"true\");\n }\n get items() {\n return this._activeDescendant.items;\n }\n select(index) {\n this._unobserveMutations();\n const itemEl = this.items[index];\n if (itemEl && itemEl.getAttribute(\"aria-disabled\") !== \"true\") {\n const matchingItem = this.items[index];\n let optionValue;\n matchingItem.setAttribute(\"aria-selected\", \"true\");\n if (this._options.useAriaChecked === true) {\n matchingItem.setAttribute(\"aria-checked\", \"true\");\n }\n optionValue = matchingItem.innerText;\n\n // Check if value selector is present and use that to get innerText instead\n // If its not present, will default to innerText of the whole item\n if (this._options.valueSelector) {\n const valueSelector = matchingItem.querySelector(this._options.valueSelector);\n if (valueSelector) {\n optionValue = valueSelector.innerText;\n }\n }\n this.el.dispatchEvent(new CustomEvent(\"makeup-listbox-change\", {\n detail: {\n el: matchingItem,\n optionIndex: index,\n optionValue\n }\n }));\n }\n this._observeMutations();\n }\n unselect(index) {\n this._unobserveMutations();\n const itemEl = this.items[index];\n if (itemEl && itemEl.getAttribute(\"aria-disabled\") !== \"true\") {\n const matchingItem = this.items[index];\n matchingItem.setAttribute(\"aria-selected\", \"false\");\n if (this._options.useAriaChecked === true) {\n matchingItem.setAttribute(\"aria-checked\", \"false\");\n }\n }\n this._observeMutations();\n }\n destroy() {\n this._destroyed = true;\n this._unobserveMutations();\n this._unobserveEvents();\n this._onKeyDownListener = null;\n this._onClickListener = null;\n this._onActiveDescendantChangeListener = null;\n this._onMutationListener = null;\n }\n}\nexports.default = _default;\nfunction _onKeyDown(e) {\n const activeDescendantEl = this._activeDescendant.currentItem;\n if (isSpacebarOrEnter(e.keyCode) && (activeDescendantEl === null || activeDescendantEl === void 0 ? void 0 : activeDescendantEl.getAttribute(\"aria-selected\")) !== \"true\") {\n // todo: this.select() should take care of unselecting any existing selections\n this.unselect(this.index);\n this.select(this._activeDescendant.index);\n }\n}\nfunction _onClick(e) {\n // unlike the keyDown event, the click event target can be a child element of the option\n // e.g. Item 1
\n const toEl = e.target.closest(\"[role=option]\");\n const toElIndex = this.items.indexOf(toEl);\n const isTolElSelected = toEl.getAttribute(\"aria-selected\") === \"true\";\n const isTolElDisabled = toEl.getAttribute(\"aria-disabled\") === \"true\";\n if (!isTolElDisabled && this._options.autoSelect === false && isTolElSelected === false) {\n // todo: this.select() should take care of unselecting any existing selections\n this.unselect(this.index);\n this.select(toElIndex);\n }\n}\nfunction _onActiveDescendantChange(e) {\n const {\n fromIndex,\n toIndex\n } = e.detail;\n if (this._options.autoSelect === true) {\n const fromEl = this.items[fromIndex];\n const toEl = this.items[toIndex];\n if (fromEl) {\n // todo: this.select() should take care of unselecting any existing selections\n this.unselect(fromIndex);\n }\n if (toEl) {\n this.select(toIndex);\n }\n }\n}\nfunction _onMutation(mutationsList) {\n for (const mutation of mutationsList) {\n if (mutation.type === \"attributes\") {\n this.el.dispatchEvent(new CustomEvent(\"makeup-listbox-mutation\", {\n detail: {\n attributeName: mutation.attributeName\n }\n }));\n }\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","\"use strict\";\n\nrequire(\"../../docs.css\");\nrequire(\"@ebay/skin/tokens\");\nrequire(\"@ebay/skin/global\");\nrequire(\"@ebay/skin/utility\");\nrequire(\"@ebay/skin/button\");\nrequire(\"@ebay/skin/listbox-button\");\nvar _makeupListboxButton = _interopRequireDefault(require(\"makeup-listbox-button\"));\nfunction _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }\n// REQUIRE\n// const ListboxButton = require('makeup-listbox-button').default;\n\n// IMPORT\n\nconst widgets = [];\nconst log = e => console.log(e.type, e.detail);\nwindow.onload = function () {\n document.querySelectorAll(\".listbox-button\").forEach(function (el, i) {\n const hasCustomLabel = el.classList.contains(\"listbox-button-with-icon-label\");\n const hasIconText = el.classList.contains(\"listbox-button-with-iconText\");\n const hasIcon = el.classList.contains(\"listbox-button-with-icon\");\n let buttonValueType;\n if (hasIconText) {\n buttonValueType = \"both\";\n } else if (hasIcon || hasCustomLabel) {\n buttonValueType = \"icon\";\n } else {\n buttonValueType = \"text\";\n }\n const listboxOptionAriaLabelSelector = hasCustomLabel ? \".listbox-button__value span\" : null;\n el.addEventListener(\"makeup-listbox-button-init\", log);\n el.addEventListener(\"makeup-listbox-button-change\", log);\n el.addEventListener(\"makeup-listbox-button-mutation\", log);\n widgets.push(new _makeupListboxButton.default(el, {\n autoSelect: el.dataset.makeupAutoSelect === \"false\" ? false : true,\n buttonValueType,\n listboxOptionAriaLabelSelector\n }));\n });\n};"],"names":[],"sourceRoot":""}
\ No newline at end of file
diff --git a/docs/ui/makeup-menu-button/index.min.js b/docs/ui/makeup-menu-button/index.min.js
index 8981cbd1..fa617fe2 100644
--- a/docs/ui/makeup-menu-button/index.min.js
+++ b/docs/ui/makeup-menu-button/index.min.js
@@ -217,7 +217,7 @@ const defaultOptions = {
collapseOnFocusOut: false,
collapseOnMouseOut: false,
collapseOnClickOut: false,
- collapseOnHostFocus: false,
+ collapseOnHostReFocus: false,
contentSelector: ".expander__content",
expandedClass: null,
expandOnClick: false,
@@ -243,18 +243,27 @@ function onHostMouseDown() {
function onHostClick() {
this._expandWasKeyboardClickActivated = this._keyboardClickFlag;
this._expandWasMouseClickActivated = this._mouseClickFlag;
+ this._widgetHasKeyboardFocus = this._keyboardClickFlag;
this.expanded = !this.expanded;
}
function onHostFocus() {
this._expandWasFocusActivated = true;
this.expanded = true;
}
+
+// NOTE: collapseOnHostReFocus cannot be used when expandOnFocus is true
+function onHostReFocus() {
+ if (this.expanded && this._widgetHasKeyboardFocus) {
+ this.expanded = false;
+ }
+}
function onHostHover() {
clearTimeout(this._mouseLeft);
this._expandWasHoverActivated = true;
this.expanded = true;
}
function onFocusExit() {
+ this._widgetHasKeyboardFocus = false;
this.expanded = false;
}
function onMouseLeave() {
@@ -314,6 +323,7 @@ class _default {
this._documentTouchEndListener = _onDocumentTouchEnd.bind(this);
this._hostClickListener = onHostClick.bind(this);
this._hostFocusListener = onHostFocus.bind(this);
+ this._hostReFocusListener = onHostReFocus.bind(this);
this._hostHoverListener = onHostHover.bind(this);
this._focusExitListener = onFocusExit.bind(this);
this._mouseLeaveListener = onMouseLeave.bind(this);
@@ -329,7 +339,7 @@ class _default {
this.expandOnClick = this.options.expandOnClick;
this.expandOnFocus = this.options.expandOnFocus;
this.expandOnHover = this.options.expandOnHover;
- this.collapseOnHostFocus = this.options.collapseOnHostFocus;
+ this.collapseOnHostReFocus = this.options.collapseOnHostReFocus;
if (this.options.autoCollapse === false) {
this.collapseOnClickOut = this.options.collapseOnClickOut;
this.collapseOnFocusOut = this.options.collapseOnFocusOut;
@@ -362,6 +372,13 @@ class _default {
this.hostEl.removeEventListener("focus", this._hostFocusListener);
}
}
+ set collapseOnHostReFocus(bool) {
+ if (bool === true) {
+ this.hostEl.addEventListener("focus", this._hostReFocusListener);
+ } else {
+ this.hostEl.removeEventListener("focus", this._hostReFocusListener);
+ }
+ }
set expandOnHover(bool) {
if (bool === true) {
this.hostEl.addEventListener("mouseenter", this._hostHoverListener);
@@ -394,13 +411,6 @@ class _default {
this.el.removeEventListener("focusExit", this._focusExitListener);
}
}
- set collapseOnHostFocus(bool) {
- if (bool === true) {
- this.contentEl.addEventListener("focusExit", this._focusExitListener);
- } else {
- this.contentEl.removeEventListener("focusExit", this._focusExitListener);
- }
- }
set collapseOnMouseOut(bool) {
if (bool === true) {
this.el.addEventListener("mouseleave", this._mouseLeaveListener);
@@ -452,6 +462,7 @@ class _default {
this.collapseOnClickOut = false;
this.collapseOnFocusOut = false;
this.collapseOnMouseOut = false;
+ this.collapseOnHostReFocus = false;
}
}
destroy() {
@@ -465,9 +476,11 @@ class _default {
this._documentTouchEndListener = null;
this._hostClickListener = null;
this._hostFocusListener = null;
+ this._hostReFocusListener = null;
this._hostHoverListener = null;
this._focusExitListener = null;
this._mouseLeaveListener = null;
+ this._widgetHasKeyboardFocus = null;
}
}
exports["default"] = _default;
@@ -1217,7 +1230,7 @@ class _default {
this._expander = new _makeupExpander.default(widgetEl, {
alwaysDoFocusManagement: true,
autoCollapse: true,
- collapseOnHostFocus: true,
+ collapseOnHostReFocus: true,
contentSelector: this._options.menuSelector,
expandedClass: this._options.expandedClass,
expandOnClick: true,
diff --git a/docs/ui/makeup-menu-button/index.min.js.map b/docs/ui/makeup-menu-button/index.min.js.map
index 06b512af..3bfd2f31 100644
--- a/docs/ui/makeup-menu-button/index.min.js.map
+++ b/docs/ui/makeup-menu-button/index.min.js.map
@@ -1 +1 @@
-{"version":3,"file":"makeup-menu-button/index.min.js","mappings":";;;;;;AAAA,mBAAO,CAAC,IAA0B;;;;;;;;ACAlC,mBAAO,CAAC,IAA0B;;;;;;;;ACAlC,mBAAO,CAAC,IAAoC;;;;;;;;ACA5C,mBAAO,CAAC,IAAsB;AAC9B,mBAAO,CAAC,IAAuB;;;;;;;;ACD/B,mBAAO,CAAC,IAA+B;;;;;;;;ACAvC,mBAAO,CAAC,IAAgC;;;;;;;;;;ACAxC;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;ACAa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,oBAAoB;AACpB,uBAAuB;AACvB,2CAA2C,mBAAO,CAAC,IAAgB;AACnE,qCAAqC,iCAAiC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AC3Ea;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf,2CAA2C,mBAAO,CAAC,IAAgB;AACnE,0CAA0C,mBAAO,CAAC,GAAqB;AACvE,+CAA+C,mBAAO,CAAC,IAAmB;AAC1E,uCAAuC,+CAA+C,0CAA0C,kDAAkD,mBAAmB;AACrM,yCAAyC,uCAAuC,2EAA2E,cAAc,qCAAqC,oCAAoC,UAAU,iBAAiB,gEAAgE,0CAA0C,8BAA8B,0DAA0D,wEAAwE;AACvhB,qCAAqC,iCAAiC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC;AACA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAe;;;;;;;;;AChRF;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;;;;;;;;ACnCa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,WAAW;AACX,kBAAkB;AAClB,gBAAgB;AAChB,cAAc;AACd,qBAAqB;AACrB,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;ACrEa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,oBAAoB;AACpB,yCAAyC,mBAAO,CAAC,IAAoB;AACrE,0CAA0C,mBAAO,CAAC,GAAqB;AACvE,uCAAuC,+CAA+C,0CAA0C,kDAAkD,mBAAmB;AACrM,yCAAyC,uCAAuC,2EAA2E,cAAc,qCAAqC,oCAAoC,UAAU,iBAAiB,gEAAgE,0CAA0C,8BAA8B,0DAA0D,wEAAwE;AACvhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,aAAa,aAAa;AAC1B,aAAa,QAAQ;AACrB,aAAa,uBAAuB;AACpC;AACA;AACA,iBAAiB,uBAAuB;AACxC,mCAAmC;;AAEnC,iBAAiB,aAAa;AAC9B;;AAEA,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA,aAAa,aAAa;AAC1B,aAAa,QAAQ;AACrB,aAAa,uBAAuB;AACpC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,aAAa;AAC1B,aAAa,uBAAuB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;;;;;;;AClXa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAkB,UAAU;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;ACvCa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,WAAW;AACX,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;ACjBa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,oBAAoB;AACpB,gDAAgD,mBAAO,CAAC,IAA2B;AACnF,uCAAuC,+CAA+C,0CAA0C,kDAAkD,mBAAmB;AACrM,yCAAyC,uCAAuC,2EAA2E,cAAc,qCAAqC,oCAAoC,UAAU,iBAAiB,gEAAgE,0CAA0C,8BAA8B,0DAA0D,wEAAwE;AACvhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;ACxHa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf,6CAA6C,mBAAO,CAAC,IAAiB;AACtE,yCAAyC,mBAAO,CAAC,IAAa;AAC9D,qCAAqC,iCAAiC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;ACzJa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf,6CAA6C,mBAAO,CAAC,IAAwB;AAC7E,gDAAgD,mBAAO,CAAC,IAA4B;AACpF,uCAAuC,+CAA+C,0CAA0C,kDAAkD,mBAAmB;AACrM,yCAAyC,uCAAuC,2EAA2E,cAAc,qCAAqC,oCAAoC,UAAU,iBAAiB,gEAAgE,0CAA0C,8BAA8B,0DAA0D,wEAAwE;AACvhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;;;;;;UC/KA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;ACNa;;AAEb,mBAAO,CAAC,IAAgB;AACxB,mBAAO,CAAC,IAAmB;AAC3B,mBAAO,CAAC,IAAmB;AAC3B,mBAAO,CAAC,GAAmB;AAC3B,mBAAO,CAAC,IAAwB;AAChC,+CAA+C,mBAAO,CAAC,IAAoB;AAC3E,qCAAqC,iCAAiC;AACtE;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,GAAG;AACH,E","sources":["webpack://root/./node_modules/@ebay/skin/button.js","webpack://root/./node_modules/@ebay/skin/global.js","webpack://root/./node_modules/@ebay/skin/menu-button.js","webpack://root/./node_modules/@ebay/skin/tokens.js","webpack://root/./node_modules/@ebay/skin/tokens/evo-core.js","webpack://root/./node_modules/@ebay/skin/tokens/evo-light.js","webpack://root/./docs/docs.css?378e","webpack://root/./node_modules/@ebay/skin/dist/button/button.css?9a44","webpack://root/./node_modules/@ebay/skin/dist/global/global.css?e001","webpack://root/./node_modules/@ebay/skin/dist/menu-button/menu-button.css?7300","webpack://root/./node_modules/@ebay/skin/dist/tokens/evo-core.css?7a96","webpack://root/./node_modules/@ebay/skin/dist/tokens/evo-light.css?9c33","webpack://root/./packages/core/makeup-exit-emitter/dist/cjs/index.js","webpack://root/./packages/core/makeup-expander/dist/cjs/index.js","webpack://root/./packages/core/makeup-focusables/dist/cjs/index.js","webpack://root/./packages/core/makeup-key-emitter/dist/cjs/index.js","webpack://root/./packages/core/makeup-navigation-emitter/dist/cjs/index.js","webpack://root/./packages/core/makeup-next-id/dist/cjs/index.js","webpack://root/./packages/core/makeup-prevent-scroll-keys/dist/cjs/index.js","webpack://root/./packages/core/makeup-roving-tabindex/dist/cjs/index.js","webpack://root/./packages/ui/makeup-menu-button/dist/cjs/index.js","webpack://root/./packages/ui/makeup-menu/dist/cjs/index.js","webpack://root/webpack/bootstrap","webpack://root/webpack/runtime/make namespace object","webpack://root/./docs/ui/makeup-menu-button/index.compiled.js"],"sourcesContent":["require('./dist/button/button.css');\n","require('./dist/global/global.css');\n","require('./dist/menu-button/menu-button.css');\n","require('./tokens/evo-core.js');\nrequire('./tokens/evo-light.js');\n","require('./../dist/tokens/evo-core.css');\n","require('./../dist/tokens/evo-light.css');\n","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.addFocusExit = addFocusExit;\nexports.removeFocusExit = removeFocusExit;\nvar _makeupNextId = _interopRequireDefault(require(\"makeup-next-id\"));\nfunction _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }\nconst focusExitEmitters = {};\nfunction doFocusExit(el, fromElement, toElement) {\n el.dispatchEvent(new CustomEvent(\"focusExit\", {\n detail: {\n fromElement,\n toElement\n },\n bubbles: false // mirror the native mouseleave event\n }));\n}\nfunction onDocumentFocusIn(e) {\n const newFocusElement = e.target;\n const targetIsDescendant = this.el.contains(newFocusElement);\n\n // if focus has moved to a focusable descendant\n if (targetIsDescendant === true) {\n // set the target as the currently focussed element\n this.currentFocusElement = newFocusElement;\n } else {\n // else focus has not gone to a focusable descendant\n window.removeEventListener(\"blur\", this.onWindowBlurListener);\n document.removeEventListener(\"focusin\", this.onDocumentFocusInListener);\n doFocusExit(this.el, this.currentFocusElement, newFocusElement);\n this.currentFocusElement = null;\n }\n}\nfunction onWindowBlur() {\n doFocusExit(this.el, this.currentFocusElement, undefined);\n}\nfunction onWidgetFocusIn() {\n // listen for focus moving to anywhere in document\n // note that mouse click on buttons, checkboxes and radios does not trigger focus events in all browsers!\n document.addEventListener(\"focusin\", this.onDocumentFocusInListener);\n // listen for focus leaving the window\n window.addEventListener(\"blur\", this.onWindowBlurListener);\n}\nclass FocusExitEmitter {\n constructor(el) {\n this.el = el;\n this.currentFocusElement = null;\n this.onWidgetFocusInListener = onWidgetFocusIn.bind(this);\n this.onDocumentFocusInListener = onDocumentFocusIn.bind(this);\n this.onWindowBlurListener = onWindowBlur.bind(this);\n this.el.addEventListener(\"focusin\", this.onWidgetFocusInListener);\n }\n removeEventListeners() {\n window.removeEventListener(\"blur\", this.onWindowBlurListener);\n document.removeEventListener(\"focusin\", this.onDocumentFocusInListener);\n this.el.removeEventListener(\"focusin\", this.onWidgetFocusInListener);\n }\n}\nfunction addFocusExit(el) {\n let exitEmitter = null;\n (0, _makeupNextId.default)(el);\n if (!focusExitEmitters[el.id]) {\n exitEmitter = new FocusExitEmitter(el);\n focusExitEmitters[el.id] = exitEmitter;\n }\n return exitEmitter;\n}\nfunction removeFocusExit(el) {\n const exitEmitter = focusExitEmitters[el.id];\n if (exitEmitter) {\n exitEmitter.removeEventListeners();\n delete focusExitEmitters[el.id];\n }\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _makeupNextId = _interopRequireDefault(require(\"makeup-next-id\"));\nvar ExitEmitter = _interopRequireWildcard(require(\"makeup-exit-emitter\"));\nvar _makeupFocusables = _interopRequireDefault(require(\"makeup-focusables\"));\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != typeof e && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if (\"default\" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\nfunction _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }\nconst defaultOptions = {\n alwaysDoFocusManagement: false,\n ariaControls: true,\n autoCollapse: false,\n collapseOnFocusOut: false,\n collapseOnMouseOut: false,\n collapseOnClickOut: false,\n collapseOnHostFocus: false,\n contentSelector: \".expander__content\",\n expandedClass: null,\n expandOnClick: false,\n expandOnFocus: false,\n expandOnHover: false,\n focusManagement: null,\n hostSelector: \".expander__host\",\n simulateSpacebarClick: false\n};\nfunction onHostKeyDown(e) {\n if (e.keyCode === 13 || e.keyCode === 32) {\n this._keyboardClickFlag = true;\n }\n // if host element does not naturally trigger a click event on spacebar, we can force one to trigger here.\n // careful! if host already triggers click events naturally, we end up with a \"double-click\".\n if (e.keyCode === 32 && this.options.simulateSpacebarClick === true) {\n this.hostEl.click();\n }\n}\nfunction onHostMouseDown() {\n this._mouseClickFlag = true;\n}\nfunction onHostClick() {\n this._expandWasKeyboardClickActivated = this._keyboardClickFlag;\n this._expandWasMouseClickActivated = this._mouseClickFlag;\n this.expanded = !this.expanded;\n}\nfunction onHostFocus() {\n this._expandWasFocusActivated = true;\n this.expanded = true;\n}\nfunction onHostHover() {\n clearTimeout(this._mouseLeft);\n this._expandWasHoverActivated = true;\n this.expanded = true;\n}\nfunction onFocusExit() {\n this.expanded = false;\n}\nfunction onMouseLeave() {\n clearTimeout(this._mouseLeft);\n this._mouseLeft = setTimeout(() => {\n this.expanded = false;\n }, 300);\n}\nfunction _onDocumentClick(e) {\n if (this.el.contains(e.target) === false) {\n this.expanded = false;\n }\n}\nfunction _onDocumentTouchStart() {\n this.documentClick = true;\n}\nfunction _onDocumentTouchMove() {\n this.documentClick = false;\n}\nfunction _onDocumentTouchEnd(e) {\n if (this.documentClick === true) {\n this.documentClick = false;\n if (this.el.contains(e.target) === false) {\n this.expanded = false;\n }\n }\n}\nfunction manageFocus(focusManagement, contentEl) {\n if (focusManagement === \"content\") {\n contentEl.setAttribute(\"tabindex\", \"-1\");\n contentEl.focus();\n } else if (focusManagement === \"focusable\") {\n var _focusables$;\n (_focusables$ = (0, _makeupFocusables.default)(contentEl)[0]) === null || _focusables$ === void 0 || _focusables$.focus();\n } else if (focusManagement === \"interactive\") {\n var _focusables$2;\n (_focusables$2 = (0, _makeupFocusables.default)(contentEl, true)[0]) === null || _focusables$2 === void 0 || _focusables$2.focus();\n } else if (focusManagement !== null) {\n const el = contentEl.querySelector(\"#\".concat(focusManagement));\n if (el) {\n el.focus();\n }\n }\n}\nclass _default {\n constructor(el, selectedOptions) {\n this.options = Object.assign({}, defaultOptions, selectedOptions);\n this.el = el;\n this.hostEl = el.querySelector(this.options.hostSelector); // the keyboard focusable host el\n this.contentEl = el.querySelector(this.options.contentSelector);\n ExitEmitter.addFocusExit(this.el);\n this._hostKeyDownListener = onHostKeyDown.bind(this);\n this._hostMouseDownListener = onHostMouseDown.bind(this);\n this._documentClickListener = _onDocumentClick.bind(this);\n this._documentTouchStartListener = _onDocumentTouchStart.bind(this);\n this._documentTouchMoveListener = _onDocumentTouchMove.bind(this);\n this._documentTouchEndListener = _onDocumentTouchEnd.bind(this);\n this._hostClickListener = onHostClick.bind(this);\n this._hostFocusListener = onHostFocus.bind(this);\n this._hostHoverListener = onHostHover.bind(this);\n this._focusExitListener = onFocusExit.bind(this);\n this._mouseLeaveListener = onMouseLeave.bind(this);\n if (this.hostEl.getAttribute(\"aria-expanded\") === null) {\n this.hostEl.setAttribute(\"aria-expanded\", \"false\");\n }\n if (this.options.ariaControls === true) {\n // ensure the widget has an id\n (0, _makeupNextId.default)(this.el, \"expander\");\n this.contentEl.id = this.contentEl.id || \"\".concat(this.el.id, \"-content\");\n this.hostEl.setAttribute(\"aria-controls\", this.contentEl.id);\n }\n this.expandOnClick = this.options.expandOnClick;\n this.expandOnFocus = this.options.expandOnFocus;\n this.expandOnHover = this.options.expandOnHover;\n this.collapseOnHostFocus = this.options.collapseOnHostFocus;\n if (this.options.autoCollapse === false) {\n this.collapseOnClickOut = this.options.collapseOnClickOut;\n this.collapseOnFocusOut = this.options.collapseOnFocusOut;\n this.collapseOnMouseOut = this.options.collapseOnMouseOut;\n }\n }\n set expandOnClick(bool) {\n if (bool === true) {\n this.hostEl.addEventListener(\"keydown\", this._hostKeyDownListener);\n this.hostEl.addEventListener(\"mousedown\", this._hostMouseDownListener);\n this.hostEl.addEventListener(\"click\", this._hostClickListener);\n if (this.options.autoCollapse === true) {\n this.collapseOnClickOut = true;\n this.collapseOnFocusOut = true;\n }\n } else {\n this.hostEl.removeEventListener(\"click\", this._hostClickListener);\n this.hostEl.removeEventListener(\"mousedown\", this._hostMouseDownListener);\n this.hostEl.removeEventListener(\"keydown\", this._hostKeyDownListener);\n }\n }\n set expandOnFocus(bool) {\n if (bool === true) {\n this.hostEl.addEventListener(\"focus\", this._hostFocusListener);\n if (this.options.autoCollapse === true) {\n this.collapseOnClickOut = true;\n this.collapseOnFocusOut = true;\n }\n } else {\n this.hostEl.removeEventListener(\"focus\", this._hostFocusListener);\n }\n }\n set expandOnHover(bool) {\n if (bool === true) {\n this.hostEl.addEventListener(\"mouseenter\", this._hostHoverListener);\n this.contentEl.addEventListener(\"mouseenter\", this._hostHoverListener);\n if (this.options.autoCollapse === true) {\n this.collapseOnMouseOut = true;\n }\n } else {\n this.hostEl.removeEventListener(\"mouseenter\", this._hostHoverListener);\n this.contentEl.removeEventListener(\"mouseenter\", this._hostHoverListener);\n }\n }\n set collapseOnClickOut(bool) {\n if (bool === true) {\n document.addEventListener(\"click\", this._documentClickListener);\n document.addEventListener(\"touchstart\", this._documentTouchStartListener);\n document.addEventListener(\"touchmove\", this._documentTouchMoveListener);\n document.addEventListener(\"touchend\", this._documentTouchEndListener);\n } else {\n document.removeEventListener(\"click\", this._documentClickListener);\n document.removeEventListener(\"touchstart\", this._documentTouchStartListener);\n document.removeEventListener(\"touchmove\", this._documentTouchMoveListener);\n document.removeEventListener(\"touchend\", this._documentTouchEndListener);\n }\n }\n set collapseOnFocusOut(bool) {\n if (bool === true) {\n this.el.addEventListener(\"focusExit\", this._focusExitListener);\n } else {\n this.el.removeEventListener(\"focusExit\", this._focusExitListener);\n }\n }\n set collapseOnHostFocus(bool) {\n if (bool === true) {\n this.contentEl.addEventListener(\"focusExit\", this._focusExitListener);\n } else {\n this.contentEl.removeEventListener(\"focusExit\", this._focusExitListener);\n }\n }\n set collapseOnMouseOut(bool) {\n if (bool === true) {\n this.el.addEventListener(\"mouseleave\", this._mouseLeaveListener);\n this.contentEl.addEventListener(\"mouseleave\", this._mouseLeaveListener);\n } else {\n this.el.removeEventListener(\"mouseleave\", this._mouseLeaveListener);\n this.contentEl.removeEventListener(\"mouseleave\", this._mouseLeaveListener);\n }\n }\n get expanded() {\n return this.hostEl.getAttribute(\"aria-expanded\") === \"true\";\n }\n set expanded(bool) {\n if (bool === true && this.expanded === false) {\n this.hostEl.setAttribute(\"aria-expanded\", \"true\");\n if (this.options.expandedClass) {\n this.el.classList.add(this.options.expandedClass);\n }\n if (this._expandWasKeyboardClickActivated || this._expandWasMouseClickActivated && this.options.alwaysDoFocusManagement) {\n manageFocus(this.options.focusManagement, this.contentEl);\n }\n this.el.dispatchEvent(new CustomEvent(\"expander-expand\", {\n bubbles: true,\n detail: this.contentEl\n }));\n }\n if (bool === false && this.expanded === true) {\n this.hostEl.setAttribute(\"aria-expanded\", \"false\");\n if (this.options.expandedClass) {\n this.el.classList.remove(this.options.expandedClass);\n }\n this.el.dispatchEvent(new CustomEvent(\"expander-collapse\", {\n bubbles: true,\n detail: this.contentEl\n }));\n }\n this._expandWasKeyboardClickActivated = false;\n this._expandWasMouseClickActivated = false;\n this._expandWasFocusActivated = false;\n this._expandWasHoverActivated = false;\n this._keyboardClickFlag = false;\n this._mouseClickFlag = false;\n }\n sleep() {\n if (this._destroyed !== true) {\n this.expandOnClick = false;\n this.expandOnFocus = false;\n this.expandOnHover = false;\n this.collapseOnClickOut = false;\n this.collapseOnFocusOut = false;\n this.collapseOnMouseOut = false;\n }\n }\n destroy() {\n this.sleep();\n this._destroyed = true;\n this._hostKeyDownListener = null;\n this._hostMouseDownListener = null;\n this._documentClickListener = null;\n this._documentTouchStartListener = null;\n this._documentTouchMoveListener = null;\n this._documentTouchEndListener = null;\n this._hostClickListener = null;\n this._hostFocusListener = null;\n this._hostHoverListener = null;\n this._focusExitListener = null;\n this._mouseLeaveListener = null;\n }\n}\nexports.default = _default;\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = _default;\nconst focusableElList = [\"a[href]\", \"area[href]\", \"button:not([disabled])\", \"embed\", \"iframe\", \"input:not([disabled])\", \"object\", \"select:not([disabled])\", \"textarea:not([disabled])\", \"*[tabindex]\", \"*[contenteditable]\"];\nconst focusableElSelector = focusableElList.join();\nfunction _default(el) {\n let keyboardOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n let callback = arguments.length > 2 ? arguments[2] : undefined;\n if (callback) {\n const request = requestAnimationFrame(() => {\n callback(getFocusables(el, keyboardOnly));\n });\n return () => {\n cancelAnimationFrame(request);\n };\n }\n return getFocusables(el, keyboardOnly);\n}\nfunction getFocusables(el) {\n let keyboardOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n let focusableEls = Array.prototype.slice.call(el.querySelectorAll(focusableElSelector));\n\n // filter out elements with display: none or nested in a display: none parent\n focusableEls = focusableEls.filter(function (focusableEl) {\n return !!(focusableEl.offsetWidth || focusableEl.offsetHeight || focusableEl.getClientRects().length);\n });\n if (keyboardOnly === true) {\n focusableEls = focusableEls.filter(function (focusableEl) {\n return focusableEl.getAttribute(\"tabindex\") !== \"-1\";\n });\n }\n return focusableEls;\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.add = add;\nexports.addKeyDown = addKeyDown;\nexports.addKeyUp = addKeyUp;\nexports.remove = remove;\nexports.removeKeyDown = removeKeyDown;\nexports.removeKeyUp = removeKeyUp;\nfunction uncapitalizeFirstLetter(str) {\n return str.charAt(0).toLowerCase() + str.slice(1);\n}\nfunction onKeyDownOrUp(evt, el, keyEventType) {\n if (!evt.shiftKey) {\n const key = evt.key;\n switch (key) {\n case \"Enter\":\n case \"Escape\":\n case \"PageUp\":\n case \"PageDown\":\n case \"End\":\n case \"Home\":\n case \"ArrowLeft\":\n case \"ArrowUp\":\n case \"ArrowRight\":\n case \"ArrowDown\":\n el.dispatchEvent(new CustomEvent(uncapitalizeFirstLetter(\"\".concat(key, \"Key\").concat(keyEventType)), {\n detail: evt,\n bubbles: true\n }));\n break;\n case \" \":\n el.dispatchEvent(new CustomEvent(\"spacebarKey\".concat(keyEventType), {\n detail: evt,\n bubbles: true\n }));\n break;\n default:\n return;\n }\n }\n}\nfunction onKeyDown(e) {\n onKeyDownOrUp(e, this, \"Down\");\n}\nfunction onKeyUp(e) {\n onKeyDownOrUp(e, this, \"Up\");\n}\nfunction addKeyDown(el) {\n el.addEventListener(\"keydown\", onKeyDown);\n}\nfunction addKeyUp(el) {\n el.addEventListener(\"keyup\", onKeyUp);\n}\nfunction removeKeyDown(el) {\n el.removeEventListener(\"keydown\", onKeyDown);\n}\nfunction removeKeyUp(el) {\n el.removeEventListener(\"keyup\", onKeyUp);\n}\nfunction add(el) {\n addKeyDown(el);\n addKeyUp(el);\n}\nfunction remove(el) {\n removeKeyDown(el);\n removeKeyUp(el);\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.createLinear = createLinear;\nvar KeyEmitter = _interopRequireWildcard(require(\"makeup-key-emitter\"));\nvar ExitEmitter = _interopRequireWildcard(require(\"makeup-exit-emitter\"));\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != typeof e && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if (\"default\" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\nconst defaultOptions = {\n axis: \"both\",\n autoInit: \"interactive\",\n autoReset: \"current\",\n ignoreByDelegateSelector: null,\n wrap: false\n};\nfunction isItemNavigable(el) {\n return !el.hidden && el.getAttribute(\"aria-disabled\") !== \"true\";\n}\nfunction isIndexNavigable(items, index) {\n return index >= 0 && index < items.length ? isItemNavigable(items[index]) : false;\n}\nfunction findNavigableItems(items) {\n return items.filter(isItemNavigable);\n}\nfunction findFirstNavigableIndex(items) {\n return items.findIndex(item => isItemNavigable(item));\n}\nfunction findLastNavigableIndex(items) {\n // todo: at(-1) is more performant than reverse(), but Babel is not transpiling it\n return items.indexOf(findNavigableItems(items).reverse()[0]);\n}\nfunction findIndexByAttribute(items, attribute, value) {\n return items.findIndex(item => isItemNavigable(item) && item.getAttribute(attribute) === value);\n}\nfunction findFirstNavigableAriaCheckedIndex(items) {\n return findIndexByAttribute(items, \"aria-checked\", \"true\");\n}\nfunction findFirstNavigableAriaSelectedIndex(items) {\n return findIndexByAttribute(items, \"aria-selected\", \"true\");\n}\nfunction findIgnoredByDelegateItems(el, options) {\n return options.ignoreByDelegateSelector !== null ? [...el.querySelectorAll(options.ignoreByDelegateSelector)] : [];\n}\nfunction findPreviousNavigableIndex(items, index, wrap) {\n let previousNavigableIndex = -1;\n if (index === null || atStart(items, index)) {\n if (wrap === true) {\n previousNavigableIndex = findLastNavigableIndex(items);\n }\n } else {\n let i = index;\n while (--i >= 0) {\n if (isItemNavigable(items[i])) {\n previousNavigableIndex = i;\n break;\n }\n }\n }\n return previousNavigableIndex;\n}\nfunction findNextNavigableIndex(items, index, wrap) {\n let nextNavigableIndex = -1;\n if (index === null) {\n nextNavigableIndex = findFirstNavigableIndex(items);\n } else if (atEnd(items, index)) {\n if (wrap === true) {\n nextNavigableIndex = findFirstNavigableIndex(items);\n }\n } else {\n let i = index;\n while (++i < items.length) {\n if (isItemNavigable(items[i])) {\n nextNavigableIndex = i;\n break;\n }\n }\n }\n return nextNavigableIndex;\n}\n\n// returning -1 means not found\nfunction findIndexPositionByType(typeOrNum, items, currentIndex) {\n let index = -1;\n switch (typeOrNum) {\n case \"none\":\n index = null;\n break;\n case \"current\":\n index = currentIndex;\n break;\n case \"interactive\":\n index = findFirstNavigableIndex(items);\n break;\n case \"ariaChecked\":\n index = findFirstNavigableAriaCheckedIndex(items);\n break;\n case \"ariaSelected\":\n index = findFirstNavigableAriaSelectedIndex(items);\n break;\n case \"ariaSelectedOrInteractive\":\n index = findFirstNavigableAriaSelectedIndex(items);\n index = index === -1 ? findFirstNavigableIndex(items) : index;\n break;\n default:\n index = typeof typeOrNum === \"number\" || typeOrNum === null ? typeOrNum : -1;\n }\n return index;\n}\nfunction atStart(items, index) {\n return index === findFirstNavigableIndex(items);\n}\nfunction atEnd(items, index) {\n return index === findLastNavigableIndex(items);\n}\nfunction onKeyPrev(e) {\n const ignoredByDelegateItems = findIgnoredByDelegateItems(this._el, this.options);\n\n // todo: update KeyEmitter to deal with ignored items?\n if (ignoredByDelegateItems.length === 0 || !ignoredByDelegateItems.includes(e.detail.target)) {\n this.index = findPreviousNavigableIndex(this.items, this.index, this.options.wrap);\n }\n}\nfunction onKeyNext(e) {\n const ignoredByDelegateItems = findIgnoredByDelegateItems(this._el, this.options);\n\n // todo: update KeyEmitter to deal with ignored items?\n if (ignoredByDelegateItems.length === 0 || !ignoredByDelegateItems.includes(e.detail.target)) {\n this.index = findNextNavigableIndex(this.items, this.index, this.options.wrap);\n }\n}\nfunction onClick(e) {\n const itemIndex = this.indexOf(e.target.closest(this._itemSelector));\n if (isIndexNavigable(this.items, itemIndex)) {\n this.index = itemIndex;\n }\n}\nfunction onKeyHome(e) {\n const ignoredByDelegateItems = findIgnoredByDelegateItems(this._el, this.options);\n\n // todo: update KeyEmitter to deal with ignored items?\n if (ignoredByDelegateItems.length === 0 || !ignoredByDelegateItems.includes(e.detail.target)) {\n this.index = findFirstNavigableIndex(this.items);\n }\n}\nfunction onKeyEnd(e) {\n const ignoredByDelegateItems = findIgnoredByDelegateItems(this._el, this.options);\n\n // todo: update KeyEmitter to deal with ignored items?\n if (ignoredByDelegateItems.length === 0 || !ignoredByDelegateItems.includes(e.detail.target)) {\n this.index = findLastNavigableIndex(this.items);\n }\n}\nfunction onFocusExit() {\n if (this.options.autoReset !== null) {\n this.reset();\n }\n}\nfunction onMutation(e) {\n const fromIndex = this.index;\n let toIndex = this.index;\n // https://developer.mozilla.org/en-US/docs/Web/API/MutationRecord\n const {\n addedNodes,\n attributeName,\n removedNodes,\n target,\n type\n } = e[0];\n if (type === \"attributes\") {\n if (target === this.currentItem) {\n if (attributeName === \"aria-disabled\") {\n // current item was disabled - keep it as current index (until a keyboard navigation happens)\n toIndex = this.index;\n } else if (attributeName === \"hidden\") {\n // current item was hidden and focus is lost - reset index to first interactive element\n toIndex = findFirstNavigableIndex(this.items);\n }\n } else {\n toIndex = this.index;\n }\n } else if (type === \"childList\") {\n if (removedNodes.length > 0 && [...removedNodes].includes(this._cachedElement)) {\n // current item was removed and focus is lost - reset index to first interactive element\n toIndex = findFirstNavigableIndex(this.items);\n } else if (removedNodes.length > 0 || addedNodes.length > 0) {\n // nodes were added and/or removed - keep current item and resync its index\n toIndex = this.indexOf(this._cachedElement);\n }\n }\n this._index = toIndex;\n this._el.dispatchEvent(new CustomEvent(\"navigationModelMutation\", {\n bubbles: false,\n detail: {\n fromIndex,\n toIndex\n }\n }));\n}\nclass NavigationModel {\n /**\n * @param {HTMLElement} el\n * @param {string} itemSelector\n * @param {typeof defaultOptions} selectedOptions\n */\n constructor(el, itemSelector, selectedOptions) {\n /** @member {typeof defaultOptions} */\n this.options = Object.assign({}, defaultOptions, selectedOptions);\n\n /** @member {HTMLElement} */\n this._el = el;\n\n /** @member {string} */\n this._itemSelector = itemSelector;\n }\n}\nclass LinearNavigationModel extends NavigationModel {\n /**\n * @param {HTMLElement} el\n * @param {string} itemSelector\n * @param {typeof defaultOptions} selectedOptions\n */\n constructor(el, itemSelector, selectedOptions) {\n super(el, itemSelector, selectedOptions);\n const fromIndex = this._index;\n const toIndex = findIndexPositionByType(this.options.autoInit, this.items, this.index);\n\n // do not use setter as it will trigger a change event\n this._index = toIndex;\n\n // always keep an element reference to the last item (for use in mutation observer)\n // todo: convert index to Tuple to store last/current values instead?\n this._cachedElement = this.items[toIndex];\n this._el.dispatchEvent(new CustomEvent(\"navigationModelInit\", {\n bubbles: false,\n detail: {\n firstInteractiveIndex: this.firstNavigableIndex,\n fromIndex,\n items: this.items,\n toIndex\n }\n }));\n }\n get currentItem() {\n return this.items[this.index];\n }\n\n // todo: code smell as getter abstracts that the query selector re-runs every time getter is accessed\n get items() {\n return [...this._el.querySelectorAll(\"\".concat(this._itemSelector))];\n }\n get index() {\n return this._index;\n }\n\n /**\n * @param {number} toIndex - update index position in this.items (non-interactive indexes fail silently)\n */\n set index(toIndex) {\n if (toIndex === this.index) {\n return;\n } else if (!isIndexNavigable(this.items, toIndex)) {\n // no-op. throw exception?\n } else {\n const fromIndex = this.index;\n // update cached element reference (for use in mutation observer if DOM node gets removed)\n this._cachedElement = this.items[toIndex];\n this._index = toIndex;\n this._el.dispatchEvent(new CustomEvent(\"navigationModelChange\", {\n bubbles: false,\n detail: {\n fromIndex,\n toIndex\n }\n }));\n }\n }\n indexOf(element) {\n return this.items.indexOf(element);\n }\n reset() {\n const fromIndex = this.index;\n const toIndex = findIndexPositionByType(this.options.autoReset, this.items, this.index);\n if (toIndex !== fromIndex) {\n // do not use setter as it will trigger a navigationModelChange event\n this._index = toIndex;\n this._el.dispatchEvent(new CustomEvent(\"navigationModelReset\", {\n bubbles: false,\n detail: {\n fromIndex,\n toIndex\n }\n }));\n }\n }\n}\n\n// 2D Grid Model will go here\n\n/*\nclass GridModel extends NavigationModel {\n constructor(el, rowSelector, colSelector) {\n super();\n this._coords = null;\n }\n}\n*/\n\nclass NavigationEmitter {\n /**\n * @param {HTMLElement} el\n * @param {LinearNavigationModel} model\n */\n constructor(el, model) {\n this.model = model;\n this.el = el;\n this._keyPrevListener = onKeyPrev.bind(model);\n this._keyNextListener = onKeyNext.bind(model);\n this._keyHomeListener = onKeyHome.bind(model);\n this._keyEndListener = onKeyEnd.bind(model);\n this._clickListener = onClick.bind(model);\n this._focusExitListener = onFocusExit.bind(model);\n this._observer = new MutationObserver(onMutation.bind(model));\n KeyEmitter.addKeyDown(this.el);\n ExitEmitter.addFocusExit(this.el);\n const axis = model.options.axis;\n if (axis === \"both\" || axis === \"x\") {\n this.el.addEventListener(\"arrowLeftKeyDown\", this._keyPrevListener);\n this.el.addEventListener(\"arrowRightKeyDown\", this._keyNextListener);\n }\n if (axis === \"both\" || axis === \"y\") {\n this.el.addEventListener(\"arrowUpKeyDown\", this._keyPrevListener);\n this.el.addEventListener(\"arrowDownKeyDown\", this._keyNextListener);\n }\n this.el.addEventListener(\"homeKeyDown\", this._keyHomeListener);\n this.el.addEventListener(\"endKeyDown\", this._keyEndListener);\n this.el.addEventListener(\"click\", this._clickListener);\n this.el.addEventListener(\"focusExit\", this._focusExitListener);\n this._observer.observe(this.el, {\n childList: true,\n subtree: true,\n attributeFilter: [\"aria-disabled\", \"hidden\"],\n attributes: true,\n attributeOldValue: true\n });\n }\n destroy() {\n KeyEmitter.removeKeyDown(this.el);\n ExitEmitter.removeFocusExit(this.el);\n this.el.removeEventListener(\"arrowLeftKeyDown\", this._keyPrevListener);\n this.el.removeEventListener(\"arrowRightKeyDown\", this._keyNextListener);\n this.el.removeEventListener(\"arrowUpKeyDown\", this._keyPrevListener);\n this.el.removeEventListener(\"arrowDownKeyDown\", this._keyNextListener);\n this.el.removeEventListener(\"homeKeyDown\", this._keyHomeListener);\n this.el.removeEventListener(\"endKeyDown\", this._keyEndListener);\n this.el.removeEventListener(\"click\", this._clickListener);\n this.el.removeEventListener(\"focusExit\", this._focusExitListener);\n this._observer.disconnect();\n }\n}\nfunction createLinear(el, itemSelector, selectedOptions) {\n const model = new LinearNavigationModel(el, itemSelector, selectedOptions);\n return new NavigationEmitter(el, model);\n}\n\n/*\nstatic createGrid(el, rowSelector, colSelector, selectedOptions) {\n return null;\n}\n*/\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = _default;\nconst sequenceMap = {};\nconst defaultPrefix = \"nid\";\nconst randomPortion = createRandomPortion(3);\nfunction randomNumber(max) {\n return Math.floor(Math.random() * max);\n}\nfunction createRandomPortion(size) {\n const letters = \"abcdefghijklmnopqrstuvwxyz\";\n const digits = \"0123456789\";\n const allChars = letters + digits;\n\n // to ensure a valid HTML ID (when prefix is empty), first character must be a letter\n let portion = letters[randomNumber(25)];\n\n // start iterating from 1, as we already have our first char\n for (let i = 1; i < size; i++) {\n portion += allChars[randomNumber(35)];\n }\n return portion;\n}\nfunction _default(el) {\n let prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultPrefix;\n const separator = prefix === \"\" ? \"\" : \"-\";\n\n // join first prefix with random portion to create key\n const key = \"\".concat(prefix).concat(separator).concat(randomPortion);\n\n // initialise key in sequence map if necessary\n sequenceMap[key] = sequenceMap[key] || 0;\n if (!el.id) {\n el.setAttribute(\"id\", \"\".concat(key, \"-\").concat(sequenceMap[key]++));\n }\n return el.id;\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.add = add;\nexports.remove = remove;\nfunction onKeyDown(e) {\n if (e.keyCode >= 32 && e.keyCode <= 40) {\n e.preventDefault();\n }\n}\nfunction add(el) {\n el.addEventListener(\"keydown\", onKeyDown);\n}\nfunction remove(el) {\n el.removeEventListener(\"keydown\", onKeyDown);\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.createLinear = createLinear;\nvar NavigationEmitter = _interopRequireWildcard(require(\"makeup-navigation-emitter\"));\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != typeof e && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if (\"default\" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\nconst defaultOptions = {\n autoInit: \"interactive\",\n autoReset: \"current\",\n wrap: false,\n axis: \"both\"\n};\nfunction refreshTabindex(items, focusIndex) {\n items.forEach(function (el, i) {\n el.setAttribute(\"tabindex\", i === focusIndex ? \"0\" : \"-1\");\n });\n}\nfunction onModelInit(e) {\n refreshTabindex(e.detail.items, e.detail.toIndex);\n this._el.dispatchEvent(new CustomEvent(\"rovingTabindexInit\", {\n detail: e.detail\n }));\n}\nfunction onModelChange(e) {\n const items = this.items;\n const fromItem = items[e.detail.fromIndex];\n const toItem = items[e.detail.toIndex];\n if (fromItem) {\n fromItem.setAttribute(\"tabindex\", \"-1\");\n }\n if (toItem) {\n toItem.setAttribute(\"tabindex\", \"0\");\n toItem.focus();\n }\n this._el.dispatchEvent(new CustomEvent(\"rovingTabindexChange\", {\n detail: e.detail\n }));\n}\nfunction onModelReset(e) {\n refreshTabindex(this.items, e.detail.toIndex);\n this._el.dispatchEvent(new CustomEvent(\"rovingTabindexReset\", {\n detail: e.detail\n }));\n}\nfunction onModelMutation(e) {\n refreshTabindex(this.items, e.detail.toIndex);\n this._el.dispatchEvent(new CustomEvent(\"rovingTabindexMutation\", {\n detail: e.detail\n }));\n}\nclass RovingTabindex {\n constructor(el) {\n this._el = el;\n this._onMutationListener = onModelMutation.bind(this);\n this._onChangeListener = onModelChange.bind(this);\n this._onInitListener = onModelInit.bind(this);\n this._onResetListener = onModelReset.bind(this);\n this._el.addEventListener(\"navigationModelMutation\", this._onMutationListener);\n this._el.addEventListener(\"navigationModelChange\", this._onChangeListener);\n this._el.addEventListener(\"navigationModelInit\", this._onInitListener);\n this._el.addEventListener(\"navigationModelReset\", this._onResetListener);\n }\n destroy() {\n this._el.removeEventListener(\"navigationModelMutation\", this._onMutationListener);\n this._el.removeEventListener(\"navigationModelChange\", this._onChangeListener);\n this._el.removeEventListener(\"navigationModelInit\", this._onInitListener);\n this._el.removeEventListener(\"navigationModelReset\", this._onResetListener);\n }\n}\nclass LinearRovingTabindex extends RovingTabindex {\n constructor(el, itemSelector, selectedOptions) {\n super(el);\n this._options = Object.assign({}, defaultOptions, selectedOptions);\n this._itemSelector = itemSelector;\n\n // todo: options.index is deprecated. Remove support in future release.\n this._navigationEmitter = NavigationEmitter.createLinear(el, itemSelector, {\n autoInit: this._options.index !== undefined ? this._options.index : this._options.autoInit,\n autoReset: this._options.autoReset,\n wrap: this._options.wrap,\n axis: this._options.axis\n });\n }\n get index() {\n return this._navigationEmitter.model.index;\n }\n set index(newIndex) {\n this._navigationEmitter.model.index = newIndex;\n }\n set wrap(newWrap) {\n this._navigationEmitter.model.options.wrap = newWrap;\n }\n get currentItem() {\n return this._navigationEmitter.model.currentItem;\n }\n get items() {\n return this._navigationEmitter.model.items;\n }\n reset() {\n this._navigationEmitter.model.reset();\n }\n destroy() {\n super.destroy();\n this._navigationEmitter.destroy();\n }\n}\n\n/*\nclass GridRovingTabindex extends RovingTabindex {\n constructor(el, rowSelector, cellSelector, selectedOptions) {\n super(el);\n }\n}\n*/\n\nfunction createLinear(el, itemSelector, selectedOptions) {\n return new LinearRovingTabindex(el, itemSelector, selectedOptions);\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _makeupExpander = _interopRequireDefault(require(\"makeup-expander\"));\nvar _makeupMenu = _interopRequireDefault(require(\"makeup-menu\"));\nfunction _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }\nconst defaultOptions = {\n customElementMode: false,\n expandedClass: \"menu-button--expanded\",\n menuSelector: \".menu-button__menu\",\n buttonTextSelector: \".btn__text\",\n buttonValueType: \"text\",\n // [\"text\", \"icon\", \"both\"],\n menuItemIconSelector: \".icon\",\n menuItemButtonAriaLabelSelector: null\n};\nclass _default {\n constructor(widgetEl, selectedOptions) {\n var _this$_buttonEl$datas;\n this._options = Object.assign({}, defaultOptions, selectedOptions);\n this.el = widgetEl;\n this._buttonEl = widgetEl.querySelector(\"button\");\n this._buttonEl.setAttribute(\"aria-haspopup\", \"true\");\n this.menu = new _makeupMenu.default(widgetEl.querySelector(this._options.menuSelector), {\n autoReset: \"interactive\"\n });\n this._buttonPrefix = (_this$_buttonEl$datas = this._buttonEl.dataset) === null || _this$_buttonEl$datas === void 0 ? void 0 : _this$_buttonEl$datas.makeupMenuButtonPrefix;\n this._buttonTextEl = this._buttonEl.querySelector(this._options.buttonTextSelector);\n this._expander = new _makeupExpander.default(widgetEl, {\n alwaysDoFocusManagement: true,\n autoCollapse: true,\n collapseOnHostFocus: true,\n contentSelector: this._options.menuSelector,\n expandedClass: this._options.expandedClass,\n expandOnClick: true,\n focusManagement: \"focusable\",\n hostSelector: \"button\"\n });\n this._onButtonFirstClickListener = _onButtonFirstClick.bind(this);\n this._onMenuKeyDownListener = _onMenuKeyDown.bind(this);\n this._onMenuItemSelectListener = _onMenuItemSelect.bind(this);\n this._onMutationListener = _onMutation.bind(this);\n this.el.classList.add(\"menu-button--js\");\n if (!this._options.customElementMode) {\n this._mutationObserver = new MutationObserver(this._onMutationListener);\n this._observeMutations();\n this._observeEvents();\n }\n }\n _observeMutations() {\n if (!this._options.customElementMode) {\n this._mutationObserver.observe(this.el, {\n attributeFilter: [\"aria-expanded\", \"disabled\"],\n attributes: true,\n childList: false,\n subtree: false\n });\n }\n }\n _unobserveMutations() {\n if (!this._options.customElementMode) {\n this._mutationObserver.disconnect();\n }\n }\n _observeEvents() {\n if (this._destroyed !== true) {\n this._buttonEl.addEventListener(\"click\", this._onButtonFirstClickListener, {\n once: true\n });\n this.menu.el.addEventListener(\"keydown\", this._onMenuKeyDownListener);\n this.menu.el.addEventListener(\"makeup-menu-select\", this._onMenuItemSelectListener);\n this.menu.el.addEventListener(\"makeup-menu-change\", this._onMenuItemSelectListener);\n }\n }\n _unobserveEvents() {\n this._buttonEl.removeEventListener(\"click\", this._onButtonFirstClickListener);\n this.menu.el.removeEventListener(\"keydown\", this._onMenuKeyDownListener);\n this.menu.el.removeEventListener(\"makeup-menu-select\", this._onMenuItemSelectListener);\n this.menu.el.removeEventListener(\"makeup-menu-change\", this._onMenuItemSelectListener);\n }\n destroy() {\n this._destroyed = true;\n this._unobserveMutations();\n this._unobserveEvents();\n this._onButtonFirstClickListener = null;\n this._onMenuKeyDownListener = null;\n this._onMenuItemSelectListener = null;\n this._onMutationListener = null;\n }\n}\nexports.default = _default;\nfunction _onMutation(mutationsList) {\n for (const mutation of mutationsList) {\n if (mutation.type === \"attributes\") {\n this.el.dispatchEvent(new CustomEvent(\"makeup-menu-button-mutation\", {\n detail: {\n attributeName: mutation.attributeName\n }\n }));\n }\n }\n}\nfunction _onButtonFirstClick() {\n this.menu.el.hidden = false;\n}\nfunction _onMenuKeyDown(e) {\n if (e.keyCode === 27) {\n this._expander.expanded = false;\n this._buttonEl.focus();\n }\n}\nfunction _onMenuItemSelect(e) {\n const widget = this;\n const {\n el\n } = e.detail;\n setTimeout(function () {\n widget._expander.expanded = false;\n widget._buttonEl.focus();\n }, 150);\n if (el.getAttribute(\"role\") !== \"menuitemradio\") {\n return;\n }\n const {\n menuItemIconSelector,\n menuItemButtonAriaLabelSelector,\n buttonValueType\n } = this._options;\n const icon = el.querySelector(menuItemIconSelector).cloneNode(true);\n const text = el.innerText.trim();\n let btnContent = this._buttonPrefix ? \"\".concat(this._buttonPrefix, \" \").concat(text) : text;\n if (icon) {\n switch (buttonValueType) {\n case \"both\":\n btnContent = \"\".concat(icon.outerHTML, \" \").concat(btnContent, \"\");\n break;\n case \"icon\":\n this._buttonEl.setAttribute(\"aria-label\", btnContent);\n btnContent = icon.outerHTML;\n break;\n default:\n break;\n }\n }\n if (menuItemButtonAriaLabelSelector) {\n var _el$querySelector;\n const selectorText = (_el$querySelector = el.querySelector(menuItemButtonAriaLabelSelector)) === null || _el$querySelector === void 0 ? void 0 : _el$querySelector.innerText.trim();\n this._buttonEl.setAttribute(\"aria-label\", this._buttonPrefix ? \"\".concat(this._buttonPrefix, \" \").concat(selectorText) : selectorText);\n }\n this._buttonTextEl.innerHTML = btnContent;\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar RovingTabIndex = _interopRequireWildcard(require(\"makeup-roving-tabindex\"));\nvar PreventScrollKeys = _interopRequireWildcard(require(\"makeup-prevent-scroll-keys\"));\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != typeof e && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if (\"default\" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\nconst defaultOptions = {\n customElementMode: false,\n autoInit: \"interactive\",\n autoReset: \"interactive\"\n};\nclass _default {\n constructor(widgetEl, selectedOptions) {\n this._options = Object.assign({}, defaultOptions, selectedOptions);\n this.el = widgetEl;\n this._rovingTabIndex = RovingTabIndex.createLinear(this.el, \"[role^=menuitem]\", {\n autoInit: this._options.autoInit,\n autoReset: this._options.autoReset\n });\n PreventScrollKeys.add(this.el);\n this._onKeyDownListener = _onKeyDown.bind(this);\n this._onClickListener = _onClick.bind(this);\n this._onMutationListener = _onMutation.bind(this);\n this.el.classList.add(\"menu--js\");\n if (!this._options.customElementMode) {\n this._mutationObserver = new MutationObserver(this._onMutationListener);\n this._observeMutations();\n this._observeEvents();\n }\n }\n select(index) {\n this._unobserveMutations();\n const el = this.items[index];\n switch (el.getAttribute(\"role\")) {\n case \"menuitemcheckbox\":\n _selectMenuItemCheckbox(this.el, el);\n break;\n case \"menuitemradio\":\n _selectMenuItemRadio(this.el, el);\n break;\n default:\n _selectMenuItem(this.el, el);\n break;\n }\n this._observeMutations();\n }\n get items() {\n return this._rovingTabIndex.items;\n }\n get radioGroupNames() {\n const els = [...this.el.querySelectorAll(\"[role=menuitemradio][data-makeup-group]\")];\n const groupNames = [...new Set(els.map(el => el.dataset.makeupGroup))];\n return groupNames;\n }\n get checkboxGroupNames() {\n const els = [...this.el.querySelectorAll(\"[role=menuitemcheckbox][data-makeup-group]\")];\n const groupNames = [...new Set(els.map(el => el.dataset.makeupGroup))];\n return groupNames;\n }\n _observeMutations() {\n if (!this._options.customElementMode) {\n this._mutationObserver.observe(this.el, {\n attributeFilter: [\"aria-checked\", \"aria-disabled\"],\n attributes: true,\n childList: true,\n subtree: true\n });\n }\n }\n _unobserveMutations() {\n if (!this._options.customElementMode) {\n this._mutationObserver.disconnect();\n }\n }\n _observeEvents() {\n if (this._destroyed !== true) {\n this.el.addEventListener(\"keydown\", this._onKeyDownListener);\n this.el.addEventListener(\"click\", this._onClickListener);\n }\n }\n _unobserveEvents() {\n this.el.removeEventListener(\"keydown\", this._onKeyDownListener);\n this.el.removeEventListener(\"click\", this._onClickListener);\n }\n destroy() {\n this._destroyed = true;\n this._unobserveMutations();\n this._unobserveEvents();\n this._onKeyDownListener = null;\n this._onClickListener = null;\n this._onMutationListener = null;\n }\n}\nexports.default = _default;\nfunction _onMutation(mutationsList) {\n for (const mutation of mutationsList) {\n if (mutation.type === \"attributes\") {\n this.el.dispatchEvent(new CustomEvent(\"makeup-menu-mutation\", {\n detail: {\n attributeName: mutation.attributeName\n }\n }));\n }\n }\n}\nfunction _onKeyDown(e) {\n this._unobserveMutations();\n if (e.keyCode === 13) {\n e.preventDefault();\n }\n if (e.keyCode === 13 || e.keyCode === 32) {\n this.select(Array.from(this.items).indexOf(e.target));\n }\n this._observeMutations();\n}\nfunction _onClick(e) {\n // unlike the keyDown event, the click event target can be a child element of the menuitem\n // e.g. Item 1
\n const menuItemEl = e.target.closest(\"[role^=menuitem]\");\n const index = this.items.indexOf(menuItemEl);\n if (index !== -1) {\n this.select(index);\n }\n}\nfunction _selectMenuItem(widgetEl, menuItemEl) {\n widgetEl.dispatchEvent(new CustomEvent(\"makeup-menu-select\", {\n detail: {\n el: menuItemEl,\n value: menuItemEl.innerText\n }\n }));\n}\nfunction _selectMenuItemCheckbox(widgetEl, menuItemEl) {\n if (menuItemEl.getAttribute(\"aria-disabled\") !== \"true\") {\n const groupName = menuItemEl.dataset.makeupGroup;\n menuItemEl.setAttribute(\"aria-checked\", menuItemEl.getAttribute(\"aria-checked\") === \"true\" ? \"false\" : \"true\");\n widgetEl.dispatchEvent(new CustomEvent(\"makeup-menu-change\", {\n detail: {\n el: menuItemEl,\n checked: menuItemEl.getAttribute(\"aria-checked\"),\n group: groupName,\n value: menuItemEl.innerText\n }\n }));\n }\n}\nfunction _selectMenuItemRadio(widgetEl, menuItemEl) {\n if (menuItemEl.getAttribute(\"aria-disabled\") !== \"true\") {\n const groupName = menuItemEl.dataset.makeupGroup;\n const checkedEl = widgetEl.querySelector(\"[data-makeup-group=\".concat(groupName, \"][aria-checked=true]\"));\n if (!checkedEl) {\n menuItemEl.setAttribute(\"aria-checked\", \"true\");\n widgetEl.dispatchEvent(new CustomEvent(\"makeup-menu-change\", {\n detail: {\n el: menuItemEl,\n group: groupName,\n value: menuItemEl.innerText\n }\n }));\n } else if (checkedEl !== menuItemEl) {\n checkedEl.setAttribute(\"aria-checked\", \"false\");\n menuItemEl.setAttribute(\"aria-checked\", \"true\");\n widgetEl.dispatchEvent(new CustomEvent(\"makeup-menu-change\", {\n detail: {\n el: menuItemEl,\n group: groupName,\n value: menuItemEl.innerText\n }\n }));\n }\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","\"use strict\";\n\nrequire(\"../../docs.css\");\nrequire(\"@ebay/skin/tokens\");\nrequire(\"@ebay/skin/global\");\nrequire(\"@ebay/skin/button\");\nrequire(\"@ebay/skin/menu-button\");\nvar _makeupMenuButton = _interopRequireDefault(require(\"makeup-menu-button\"));\nfunction _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }\n// REQUIRE\n// const MenuButton = require('makeup-menu-button').default;\n\n// IMPORT\n\nwindow.onload = function () {\n document.querySelectorAll(\".menu-button\").forEach(function (el, i) {\n const hasCustomLabel = el.classList.contains(\"menu-button-with-icon-customText\");\n const hasIconText = el.classList.contains(\"menu-button-with-iconText\");\n const hasIcon = el.classList.contains(\"menu-button-with-icon\");\n let buttonValueType;\n if (hasIconText) {\n buttonValueType = \"both\";\n } else if (hasIcon || hasCustomLabel) {\n buttonValueType = \"icon\";\n } else {\n buttonValueType = \"text\";\n }\n const menuItemButtonAriaLabelSelector = hasCustomLabel ? \".menu-button__item-value span\" : null;\n const widget = new _makeupMenuButton.default(el, {\n buttonValueType,\n menuItemButtonAriaLabelSelector\n });\n widget.menu.el.addEventListener(\"makeup-menu-select\", e => console.log(e.type, e.detail));\n widget.menu.el.addEventListener(\"makeup-menu-change\", e => console.log(e.type, e.detail));\n widget.menu.el.addEventListener(\"makeup-menu-button-mutation\", e => console.log(e.type, e.detail));\n });\n};"],"names":[],"sourceRoot":""}
\ No newline at end of file
+{"version":3,"file":"makeup-menu-button/index.min.js","mappings":";;;;;;AAAA,mBAAO,CAAC,IAA0B;;;;;;;;ACAlC,mBAAO,CAAC,IAA0B;;;;;;;;ACAlC,mBAAO,CAAC,IAAoC;;;;;;;;ACA5C,mBAAO,CAAC,IAAsB;AAC9B,mBAAO,CAAC,IAAuB;;;;;;;;ACD/B,mBAAO,CAAC,IAA+B;;;;;;;;ACAvC,mBAAO,CAAC,IAAgC;;;;;;;;;;ACAxC;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;ACAa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,oBAAoB;AACpB,uBAAuB;AACvB,2CAA2C,mBAAO,CAAC,IAAgB;AACnE,qCAAqC,iCAAiC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AC3Ea;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf,2CAA2C,mBAAO,CAAC,IAAgB;AACnE,0CAA0C,mBAAO,CAAC,GAAqB;AACvE,+CAA+C,mBAAO,CAAC,IAAmB;AAC1E,uCAAuC,+CAA+C,0CAA0C,kDAAkD,mBAAmB;AACrM,yCAAyC,uCAAuC,2EAA2E,cAAc,qCAAqC,oCAAoC,UAAU,iBAAiB,gEAAgE,0CAA0C,8BAA8B,0DAA0D,wEAAwE;AACvhB,qCAAqC,iCAAiC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC;AACA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAe;;;;;;;;;AC7RF;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;;;;;;;;ACnCa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,WAAW;AACX,kBAAkB;AAClB,gBAAgB;AAChB,cAAc;AACd,qBAAqB;AACrB,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;ACrEa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,oBAAoB;AACpB,yCAAyC,mBAAO,CAAC,IAAoB;AACrE,0CAA0C,mBAAO,CAAC,GAAqB;AACvE,uCAAuC,+CAA+C,0CAA0C,kDAAkD,mBAAmB;AACrM,yCAAyC,uCAAuC,2EAA2E,cAAc,qCAAqC,oCAAoC,UAAU,iBAAiB,gEAAgE,0CAA0C,8BAA8B,0DAA0D,wEAAwE;AACvhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,aAAa,aAAa;AAC1B,aAAa,QAAQ;AACrB,aAAa,uBAAuB;AACpC;AACA;AACA,iBAAiB,uBAAuB;AACxC,mCAAmC;;AAEnC,iBAAiB,aAAa;AAC9B;;AAEA,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA,aAAa,aAAa;AAC1B,aAAa,QAAQ;AACrB,aAAa,uBAAuB;AACpC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,aAAa;AAC1B,aAAa,uBAAuB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;;;;;;;AClXa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAkB,UAAU;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;ACvCa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,WAAW;AACX,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;ACjBa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,oBAAoB;AACpB,gDAAgD,mBAAO,CAAC,IAA2B;AACnF,uCAAuC,+CAA+C,0CAA0C,kDAAkD,mBAAmB;AACrM,yCAAyC,uCAAuC,2EAA2E,cAAc,qCAAqC,oCAAoC,UAAU,iBAAiB,gEAAgE,0CAA0C,8BAA8B,0DAA0D,wEAAwE;AACvhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;ACxHa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf,6CAA6C,mBAAO,CAAC,IAAiB;AACtE,yCAAyC,mBAAO,CAAC,IAAa;AAC9D,qCAAqC,iCAAiC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;ACzJa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf,6CAA6C,mBAAO,CAAC,IAAwB;AAC7E,gDAAgD,mBAAO,CAAC,IAA4B;AACpF,uCAAuC,+CAA+C,0CAA0C,kDAAkD,mBAAmB;AACrM,yCAAyC,uCAAuC,2EAA2E,cAAc,qCAAqC,oCAAoC,UAAU,iBAAiB,gEAAgE,0CAA0C,8BAA8B,0DAA0D,wEAAwE;AACvhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;;;;;;UC/KA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;ACNa;;AAEb,mBAAO,CAAC,IAAgB;AACxB,mBAAO,CAAC,IAAmB;AAC3B,mBAAO,CAAC,IAAmB;AAC3B,mBAAO,CAAC,GAAmB;AAC3B,mBAAO,CAAC,IAAwB;AAChC,+CAA+C,mBAAO,CAAC,IAAoB;AAC3E,qCAAqC,iCAAiC;AACtE;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,GAAG;AACH,E","sources":["webpack://root/./node_modules/@ebay/skin/button.js","webpack://root/./node_modules/@ebay/skin/global.js","webpack://root/./node_modules/@ebay/skin/menu-button.js","webpack://root/./node_modules/@ebay/skin/tokens.js","webpack://root/./node_modules/@ebay/skin/tokens/evo-core.js","webpack://root/./node_modules/@ebay/skin/tokens/evo-light.js","webpack://root/./docs/docs.css?378e","webpack://root/./node_modules/@ebay/skin/dist/button/button.css?9a44","webpack://root/./node_modules/@ebay/skin/dist/global/global.css?e001","webpack://root/./node_modules/@ebay/skin/dist/menu-button/menu-button.css?7300","webpack://root/./node_modules/@ebay/skin/dist/tokens/evo-core.css?7a96","webpack://root/./node_modules/@ebay/skin/dist/tokens/evo-light.css?9c33","webpack://root/./packages/core/makeup-exit-emitter/dist/cjs/index.js","webpack://root/./packages/core/makeup-expander/dist/cjs/index.js","webpack://root/./packages/core/makeup-focusables/dist/cjs/index.js","webpack://root/./packages/core/makeup-key-emitter/dist/cjs/index.js","webpack://root/./packages/core/makeup-navigation-emitter/dist/cjs/index.js","webpack://root/./packages/core/makeup-next-id/dist/cjs/index.js","webpack://root/./packages/core/makeup-prevent-scroll-keys/dist/cjs/index.js","webpack://root/./packages/core/makeup-roving-tabindex/dist/cjs/index.js","webpack://root/./packages/ui/makeup-menu-button/dist/cjs/index.js","webpack://root/./packages/ui/makeup-menu/dist/cjs/index.js","webpack://root/webpack/bootstrap","webpack://root/webpack/runtime/make namespace object","webpack://root/./docs/ui/makeup-menu-button/index.compiled.js"],"sourcesContent":["require('./dist/button/button.css');\n","require('./dist/global/global.css');\n","require('./dist/menu-button/menu-button.css');\n","require('./tokens/evo-core.js');\nrequire('./tokens/evo-light.js');\n","require('./../dist/tokens/evo-core.css');\n","require('./../dist/tokens/evo-light.css');\n","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.addFocusExit = addFocusExit;\nexports.removeFocusExit = removeFocusExit;\nvar _makeupNextId = _interopRequireDefault(require(\"makeup-next-id\"));\nfunction _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }\nconst focusExitEmitters = {};\nfunction doFocusExit(el, fromElement, toElement) {\n el.dispatchEvent(new CustomEvent(\"focusExit\", {\n detail: {\n fromElement,\n toElement\n },\n bubbles: false // mirror the native mouseleave event\n }));\n}\nfunction onDocumentFocusIn(e) {\n const newFocusElement = e.target;\n const targetIsDescendant = this.el.contains(newFocusElement);\n\n // if focus has moved to a focusable descendant\n if (targetIsDescendant === true) {\n // set the target as the currently focussed element\n this.currentFocusElement = newFocusElement;\n } else {\n // else focus has not gone to a focusable descendant\n window.removeEventListener(\"blur\", this.onWindowBlurListener);\n document.removeEventListener(\"focusin\", this.onDocumentFocusInListener);\n doFocusExit(this.el, this.currentFocusElement, newFocusElement);\n this.currentFocusElement = null;\n }\n}\nfunction onWindowBlur() {\n doFocusExit(this.el, this.currentFocusElement, undefined);\n}\nfunction onWidgetFocusIn() {\n // listen for focus moving to anywhere in document\n // note that mouse click on buttons, checkboxes and radios does not trigger focus events in all browsers!\n document.addEventListener(\"focusin\", this.onDocumentFocusInListener);\n // listen for focus leaving the window\n window.addEventListener(\"blur\", this.onWindowBlurListener);\n}\nclass FocusExitEmitter {\n constructor(el) {\n this.el = el;\n this.currentFocusElement = null;\n this.onWidgetFocusInListener = onWidgetFocusIn.bind(this);\n this.onDocumentFocusInListener = onDocumentFocusIn.bind(this);\n this.onWindowBlurListener = onWindowBlur.bind(this);\n this.el.addEventListener(\"focusin\", this.onWidgetFocusInListener);\n }\n removeEventListeners() {\n window.removeEventListener(\"blur\", this.onWindowBlurListener);\n document.removeEventListener(\"focusin\", this.onDocumentFocusInListener);\n this.el.removeEventListener(\"focusin\", this.onWidgetFocusInListener);\n }\n}\nfunction addFocusExit(el) {\n let exitEmitter = null;\n (0, _makeupNextId.default)(el);\n if (!focusExitEmitters[el.id]) {\n exitEmitter = new FocusExitEmitter(el);\n focusExitEmitters[el.id] = exitEmitter;\n }\n return exitEmitter;\n}\nfunction removeFocusExit(el) {\n const exitEmitter = focusExitEmitters[el.id];\n if (exitEmitter) {\n exitEmitter.removeEventListeners();\n delete focusExitEmitters[el.id];\n }\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _makeupNextId = _interopRequireDefault(require(\"makeup-next-id\"));\nvar ExitEmitter = _interopRequireWildcard(require(\"makeup-exit-emitter\"));\nvar _makeupFocusables = _interopRequireDefault(require(\"makeup-focusables\"));\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != typeof e && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if (\"default\" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\nfunction _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }\nconst defaultOptions = {\n alwaysDoFocusManagement: false,\n ariaControls: true,\n autoCollapse: false,\n collapseOnFocusOut: false,\n collapseOnMouseOut: false,\n collapseOnClickOut: false,\n collapseOnHostReFocus: false,\n contentSelector: \".expander__content\",\n expandedClass: null,\n expandOnClick: false,\n expandOnFocus: false,\n expandOnHover: false,\n focusManagement: null,\n hostSelector: \".expander__host\",\n simulateSpacebarClick: false\n};\nfunction onHostKeyDown(e) {\n if (e.keyCode === 13 || e.keyCode === 32) {\n this._keyboardClickFlag = true;\n }\n // if host element does not naturally trigger a click event on spacebar, we can force one to trigger here.\n // careful! if host already triggers click events naturally, we end up with a \"double-click\".\n if (e.keyCode === 32 && this.options.simulateSpacebarClick === true) {\n this.hostEl.click();\n }\n}\nfunction onHostMouseDown() {\n this._mouseClickFlag = true;\n}\nfunction onHostClick() {\n this._expandWasKeyboardClickActivated = this._keyboardClickFlag;\n this._expandWasMouseClickActivated = this._mouseClickFlag;\n this._widgetHasKeyboardFocus = this._keyboardClickFlag;\n this.expanded = !this.expanded;\n}\nfunction onHostFocus() {\n this._expandWasFocusActivated = true;\n this.expanded = true;\n}\n\n// NOTE: collapseOnHostReFocus cannot be used when expandOnFocus is true\nfunction onHostReFocus() {\n if (this.expanded && this._widgetHasKeyboardFocus) {\n this.expanded = false;\n }\n}\nfunction onHostHover() {\n clearTimeout(this._mouseLeft);\n this._expandWasHoverActivated = true;\n this.expanded = true;\n}\nfunction onFocusExit() {\n this._widgetHasKeyboardFocus = false;\n this.expanded = false;\n}\nfunction onMouseLeave() {\n clearTimeout(this._mouseLeft);\n this._mouseLeft = setTimeout(() => {\n this.expanded = false;\n }, 300);\n}\nfunction _onDocumentClick(e) {\n if (this.el.contains(e.target) === false) {\n this.expanded = false;\n }\n}\nfunction _onDocumentTouchStart() {\n this.documentClick = true;\n}\nfunction _onDocumentTouchMove() {\n this.documentClick = false;\n}\nfunction _onDocumentTouchEnd(e) {\n if (this.documentClick === true) {\n this.documentClick = false;\n if (this.el.contains(e.target) === false) {\n this.expanded = false;\n }\n }\n}\nfunction manageFocus(focusManagement, contentEl) {\n if (focusManagement === \"content\") {\n contentEl.setAttribute(\"tabindex\", \"-1\");\n contentEl.focus();\n } else if (focusManagement === \"focusable\") {\n var _focusables$;\n (_focusables$ = (0, _makeupFocusables.default)(contentEl)[0]) === null || _focusables$ === void 0 || _focusables$.focus();\n } else if (focusManagement === \"interactive\") {\n var _focusables$2;\n (_focusables$2 = (0, _makeupFocusables.default)(contentEl, true)[0]) === null || _focusables$2 === void 0 || _focusables$2.focus();\n } else if (focusManagement !== null) {\n const el = contentEl.querySelector(\"#\".concat(focusManagement));\n if (el) {\n el.focus();\n }\n }\n}\nclass _default {\n constructor(el, selectedOptions) {\n this.options = Object.assign({}, defaultOptions, selectedOptions);\n this.el = el;\n this.hostEl = el.querySelector(this.options.hostSelector); // the keyboard focusable host el\n this.contentEl = el.querySelector(this.options.contentSelector);\n ExitEmitter.addFocusExit(this.el);\n this._hostKeyDownListener = onHostKeyDown.bind(this);\n this._hostMouseDownListener = onHostMouseDown.bind(this);\n this._documentClickListener = _onDocumentClick.bind(this);\n this._documentTouchStartListener = _onDocumentTouchStart.bind(this);\n this._documentTouchMoveListener = _onDocumentTouchMove.bind(this);\n this._documentTouchEndListener = _onDocumentTouchEnd.bind(this);\n this._hostClickListener = onHostClick.bind(this);\n this._hostFocusListener = onHostFocus.bind(this);\n this._hostReFocusListener = onHostReFocus.bind(this);\n this._hostHoverListener = onHostHover.bind(this);\n this._focusExitListener = onFocusExit.bind(this);\n this._mouseLeaveListener = onMouseLeave.bind(this);\n if (this.hostEl.getAttribute(\"aria-expanded\") === null) {\n this.hostEl.setAttribute(\"aria-expanded\", \"false\");\n }\n if (this.options.ariaControls === true) {\n // ensure the widget has an id\n (0, _makeupNextId.default)(this.el, \"expander\");\n this.contentEl.id = this.contentEl.id || \"\".concat(this.el.id, \"-content\");\n this.hostEl.setAttribute(\"aria-controls\", this.contentEl.id);\n }\n this.expandOnClick = this.options.expandOnClick;\n this.expandOnFocus = this.options.expandOnFocus;\n this.expandOnHover = this.options.expandOnHover;\n this.collapseOnHostReFocus = this.options.collapseOnHostReFocus;\n if (this.options.autoCollapse === false) {\n this.collapseOnClickOut = this.options.collapseOnClickOut;\n this.collapseOnFocusOut = this.options.collapseOnFocusOut;\n this.collapseOnMouseOut = this.options.collapseOnMouseOut;\n }\n }\n set expandOnClick(bool) {\n if (bool === true) {\n this.hostEl.addEventListener(\"keydown\", this._hostKeyDownListener);\n this.hostEl.addEventListener(\"mousedown\", this._hostMouseDownListener);\n this.hostEl.addEventListener(\"click\", this._hostClickListener);\n if (this.options.autoCollapse === true) {\n this.collapseOnClickOut = true;\n this.collapseOnFocusOut = true;\n }\n } else {\n this.hostEl.removeEventListener(\"click\", this._hostClickListener);\n this.hostEl.removeEventListener(\"mousedown\", this._hostMouseDownListener);\n this.hostEl.removeEventListener(\"keydown\", this._hostKeyDownListener);\n }\n }\n set expandOnFocus(bool) {\n if (bool === true) {\n this.hostEl.addEventListener(\"focus\", this._hostFocusListener);\n if (this.options.autoCollapse === true) {\n this.collapseOnClickOut = true;\n this.collapseOnFocusOut = true;\n }\n } else {\n this.hostEl.removeEventListener(\"focus\", this._hostFocusListener);\n }\n }\n set collapseOnHostReFocus(bool) {\n if (bool === true) {\n this.hostEl.addEventListener(\"focus\", this._hostReFocusListener);\n } else {\n this.hostEl.removeEventListener(\"focus\", this._hostReFocusListener);\n }\n }\n set expandOnHover(bool) {\n if (bool === true) {\n this.hostEl.addEventListener(\"mouseenter\", this._hostHoverListener);\n this.contentEl.addEventListener(\"mouseenter\", this._hostHoverListener);\n if (this.options.autoCollapse === true) {\n this.collapseOnMouseOut = true;\n }\n } else {\n this.hostEl.removeEventListener(\"mouseenter\", this._hostHoverListener);\n this.contentEl.removeEventListener(\"mouseenter\", this._hostHoverListener);\n }\n }\n set collapseOnClickOut(bool) {\n if (bool === true) {\n document.addEventListener(\"click\", this._documentClickListener);\n document.addEventListener(\"touchstart\", this._documentTouchStartListener);\n document.addEventListener(\"touchmove\", this._documentTouchMoveListener);\n document.addEventListener(\"touchend\", this._documentTouchEndListener);\n } else {\n document.removeEventListener(\"click\", this._documentClickListener);\n document.removeEventListener(\"touchstart\", this._documentTouchStartListener);\n document.removeEventListener(\"touchmove\", this._documentTouchMoveListener);\n document.removeEventListener(\"touchend\", this._documentTouchEndListener);\n }\n }\n set collapseOnFocusOut(bool) {\n if (bool === true) {\n this.el.addEventListener(\"focusExit\", this._focusExitListener);\n } else {\n this.el.removeEventListener(\"focusExit\", this._focusExitListener);\n }\n }\n set collapseOnMouseOut(bool) {\n if (bool === true) {\n this.el.addEventListener(\"mouseleave\", this._mouseLeaveListener);\n this.contentEl.addEventListener(\"mouseleave\", this._mouseLeaveListener);\n } else {\n this.el.removeEventListener(\"mouseleave\", this._mouseLeaveListener);\n this.contentEl.removeEventListener(\"mouseleave\", this._mouseLeaveListener);\n }\n }\n get expanded() {\n return this.hostEl.getAttribute(\"aria-expanded\") === \"true\";\n }\n set expanded(bool) {\n if (bool === true && this.expanded === false) {\n this.hostEl.setAttribute(\"aria-expanded\", \"true\");\n if (this.options.expandedClass) {\n this.el.classList.add(this.options.expandedClass);\n }\n if (this._expandWasKeyboardClickActivated || this._expandWasMouseClickActivated && this.options.alwaysDoFocusManagement) {\n manageFocus(this.options.focusManagement, this.contentEl);\n }\n this.el.dispatchEvent(new CustomEvent(\"expander-expand\", {\n bubbles: true,\n detail: this.contentEl\n }));\n }\n if (bool === false && this.expanded === true) {\n this.hostEl.setAttribute(\"aria-expanded\", \"false\");\n if (this.options.expandedClass) {\n this.el.classList.remove(this.options.expandedClass);\n }\n this.el.dispatchEvent(new CustomEvent(\"expander-collapse\", {\n bubbles: true,\n detail: this.contentEl\n }));\n }\n this._expandWasKeyboardClickActivated = false;\n this._expandWasMouseClickActivated = false;\n this._expandWasFocusActivated = false;\n this._expandWasHoverActivated = false;\n this._keyboardClickFlag = false;\n this._mouseClickFlag = false;\n }\n sleep() {\n if (this._destroyed !== true) {\n this.expandOnClick = false;\n this.expandOnFocus = false;\n this.expandOnHover = false;\n this.collapseOnClickOut = false;\n this.collapseOnFocusOut = false;\n this.collapseOnMouseOut = false;\n this.collapseOnHostReFocus = false;\n }\n }\n destroy() {\n this.sleep();\n this._destroyed = true;\n this._hostKeyDownListener = null;\n this._hostMouseDownListener = null;\n this._documentClickListener = null;\n this._documentTouchStartListener = null;\n this._documentTouchMoveListener = null;\n this._documentTouchEndListener = null;\n this._hostClickListener = null;\n this._hostFocusListener = null;\n this._hostReFocusListener = null;\n this._hostHoverListener = null;\n this._focusExitListener = null;\n this._mouseLeaveListener = null;\n this._widgetHasKeyboardFocus = null;\n }\n}\nexports.default = _default;\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = _default;\nconst focusableElList = [\"a[href]\", \"area[href]\", \"button:not([disabled])\", \"embed\", \"iframe\", \"input:not([disabled])\", \"object\", \"select:not([disabled])\", \"textarea:not([disabled])\", \"*[tabindex]\", \"*[contenteditable]\"];\nconst focusableElSelector = focusableElList.join();\nfunction _default(el) {\n let keyboardOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n let callback = arguments.length > 2 ? arguments[2] : undefined;\n if (callback) {\n const request = requestAnimationFrame(() => {\n callback(getFocusables(el, keyboardOnly));\n });\n return () => {\n cancelAnimationFrame(request);\n };\n }\n return getFocusables(el, keyboardOnly);\n}\nfunction getFocusables(el) {\n let keyboardOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n let focusableEls = Array.prototype.slice.call(el.querySelectorAll(focusableElSelector));\n\n // filter out elements with display: none or nested in a display: none parent\n focusableEls = focusableEls.filter(function (focusableEl) {\n return !!(focusableEl.offsetWidth || focusableEl.offsetHeight || focusableEl.getClientRects().length);\n });\n if (keyboardOnly === true) {\n focusableEls = focusableEls.filter(function (focusableEl) {\n return focusableEl.getAttribute(\"tabindex\") !== \"-1\";\n });\n }\n return focusableEls;\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.add = add;\nexports.addKeyDown = addKeyDown;\nexports.addKeyUp = addKeyUp;\nexports.remove = remove;\nexports.removeKeyDown = removeKeyDown;\nexports.removeKeyUp = removeKeyUp;\nfunction uncapitalizeFirstLetter(str) {\n return str.charAt(0).toLowerCase() + str.slice(1);\n}\nfunction onKeyDownOrUp(evt, el, keyEventType) {\n if (!evt.shiftKey) {\n const key = evt.key;\n switch (key) {\n case \"Enter\":\n case \"Escape\":\n case \"PageUp\":\n case \"PageDown\":\n case \"End\":\n case \"Home\":\n case \"ArrowLeft\":\n case \"ArrowUp\":\n case \"ArrowRight\":\n case \"ArrowDown\":\n el.dispatchEvent(new CustomEvent(uncapitalizeFirstLetter(\"\".concat(key, \"Key\").concat(keyEventType)), {\n detail: evt,\n bubbles: true\n }));\n break;\n case \" \":\n el.dispatchEvent(new CustomEvent(\"spacebarKey\".concat(keyEventType), {\n detail: evt,\n bubbles: true\n }));\n break;\n default:\n return;\n }\n }\n}\nfunction onKeyDown(e) {\n onKeyDownOrUp(e, this, \"Down\");\n}\nfunction onKeyUp(e) {\n onKeyDownOrUp(e, this, \"Up\");\n}\nfunction addKeyDown(el) {\n el.addEventListener(\"keydown\", onKeyDown);\n}\nfunction addKeyUp(el) {\n el.addEventListener(\"keyup\", onKeyUp);\n}\nfunction removeKeyDown(el) {\n el.removeEventListener(\"keydown\", onKeyDown);\n}\nfunction removeKeyUp(el) {\n el.removeEventListener(\"keyup\", onKeyUp);\n}\nfunction add(el) {\n addKeyDown(el);\n addKeyUp(el);\n}\nfunction remove(el) {\n removeKeyDown(el);\n removeKeyUp(el);\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.createLinear = createLinear;\nvar KeyEmitter = _interopRequireWildcard(require(\"makeup-key-emitter\"));\nvar ExitEmitter = _interopRequireWildcard(require(\"makeup-exit-emitter\"));\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != typeof e && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if (\"default\" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\nconst defaultOptions = {\n axis: \"both\",\n autoInit: \"interactive\",\n autoReset: \"current\",\n ignoreByDelegateSelector: null,\n wrap: false\n};\nfunction isItemNavigable(el) {\n return !el.hidden && el.getAttribute(\"aria-disabled\") !== \"true\";\n}\nfunction isIndexNavigable(items, index) {\n return index >= 0 && index < items.length ? isItemNavigable(items[index]) : false;\n}\nfunction findNavigableItems(items) {\n return items.filter(isItemNavigable);\n}\nfunction findFirstNavigableIndex(items) {\n return items.findIndex(item => isItemNavigable(item));\n}\nfunction findLastNavigableIndex(items) {\n // todo: at(-1) is more performant than reverse(), but Babel is not transpiling it\n return items.indexOf(findNavigableItems(items).reverse()[0]);\n}\nfunction findIndexByAttribute(items, attribute, value) {\n return items.findIndex(item => isItemNavigable(item) && item.getAttribute(attribute) === value);\n}\nfunction findFirstNavigableAriaCheckedIndex(items) {\n return findIndexByAttribute(items, \"aria-checked\", \"true\");\n}\nfunction findFirstNavigableAriaSelectedIndex(items) {\n return findIndexByAttribute(items, \"aria-selected\", \"true\");\n}\nfunction findIgnoredByDelegateItems(el, options) {\n return options.ignoreByDelegateSelector !== null ? [...el.querySelectorAll(options.ignoreByDelegateSelector)] : [];\n}\nfunction findPreviousNavigableIndex(items, index, wrap) {\n let previousNavigableIndex = -1;\n if (index === null || atStart(items, index)) {\n if (wrap === true) {\n previousNavigableIndex = findLastNavigableIndex(items);\n }\n } else {\n let i = index;\n while (--i >= 0) {\n if (isItemNavigable(items[i])) {\n previousNavigableIndex = i;\n break;\n }\n }\n }\n return previousNavigableIndex;\n}\nfunction findNextNavigableIndex(items, index, wrap) {\n let nextNavigableIndex = -1;\n if (index === null) {\n nextNavigableIndex = findFirstNavigableIndex(items);\n } else if (atEnd(items, index)) {\n if (wrap === true) {\n nextNavigableIndex = findFirstNavigableIndex(items);\n }\n } else {\n let i = index;\n while (++i < items.length) {\n if (isItemNavigable(items[i])) {\n nextNavigableIndex = i;\n break;\n }\n }\n }\n return nextNavigableIndex;\n}\n\n// returning -1 means not found\nfunction findIndexPositionByType(typeOrNum, items, currentIndex) {\n let index = -1;\n switch (typeOrNum) {\n case \"none\":\n index = null;\n break;\n case \"current\":\n index = currentIndex;\n break;\n case \"interactive\":\n index = findFirstNavigableIndex(items);\n break;\n case \"ariaChecked\":\n index = findFirstNavigableAriaCheckedIndex(items);\n break;\n case \"ariaSelected\":\n index = findFirstNavigableAriaSelectedIndex(items);\n break;\n case \"ariaSelectedOrInteractive\":\n index = findFirstNavigableAriaSelectedIndex(items);\n index = index === -1 ? findFirstNavigableIndex(items) : index;\n break;\n default:\n index = typeof typeOrNum === \"number\" || typeOrNum === null ? typeOrNum : -1;\n }\n return index;\n}\nfunction atStart(items, index) {\n return index === findFirstNavigableIndex(items);\n}\nfunction atEnd(items, index) {\n return index === findLastNavigableIndex(items);\n}\nfunction onKeyPrev(e) {\n const ignoredByDelegateItems = findIgnoredByDelegateItems(this._el, this.options);\n\n // todo: update KeyEmitter to deal with ignored items?\n if (ignoredByDelegateItems.length === 0 || !ignoredByDelegateItems.includes(e.detail.target)) {\n this.index = findPreviousNavigableIndex(this.items, this.index, this.options.wrap);\n }\n}\nfunction onKeyNext(e) {\n const ignoredByDelegateItems = findIgnoredByDelegateItems(this._el, this.options);\n\n // todo: update KeyEmitter to deal with ignored items?\n if (ignoredByDelegateItems.length === 0 || !ignoredByDelegateItems.includes(e.detail.target)) {\n this.index = findNextNavigableIndex(this.items, this.index, this.options.wrap);\n }\n}\nfunction onClick(e) {\n const itemIndex = this.indexOf(e.target.closest(this._itemSelector));\n if (isIndexNavigable(this.items, itemIndex)) {\n this.index = itemIndex;\n }\n}\nfunction onKeyHome(e) {\n const ignoredByDelegateItems = findIgnoredByDelegateItems(this._el, this.options);\n\n // todo: update KeyEmitter to deal with ignored items?\n if (ignoredByDelegateItems.length === 0 || !ignoredByDelegateItems.includes(e.detail.target)) {\n this.index = findFirstNavigableIndex(this.items);\n }\n}\nfunction onKeyEnd(e) {\n const ignoredByDelegateItems = findIgnoredByDelegateItems(this._el, this.options);\n\n // todo: update KeyEmitter to deal with ignored items?\n if (ignoredByDelegateItems.length === 0 || !ignoredByDelegateItems.includes(e.detail.target)) {\n this.index = findLastNavigableIndex(this.items);\n }\n}\nfunction onFocusExit() {\n if (this.options.autoReset !== null) {\n this.reset();\n }\n}\nfunction onMutation(e) {\n const fromIndex = this.index;\n let toIndex = this.index;\n // https://developer.mozilla.org/en-US/docs/Web/API/MutationRecord\n const {\n addedNodes,\n attributeName,\n removedNodes,\n target,\n type\n } = e[0];\n if (type === \"attributes\") {\n if (target === this.currentItem) {\n if (attributeName === \"aria-disabled\") {\n // current item was disabled - keep it as current index (until a keyboard navigation happens)\n toIndex = this.index;\n } else if (attributeName === \"hidden\") {\n // current item was hidden and focus is lost - reset index to first interactive element\n toIndex = findFirstNavigableIndex(this.items);\n }\n } else {\n toIndex = this.index;\n }\n } else if (type === \"childList\") {\n if (removedNodes.length > 0 && [...removedNodes].includes(this._cachedElement)) {\n // current item was removed and focus is lost - reset index to first interactive element\n toIndex = findFirstNavigableIndex(this.items);\n } else if (removedNodes.length > 0 || addedNodes.length > 0) {\n // nodes were added and/or removed - keep current item and resync its index\n toIndex = this.indexOf(this._cachedElement);\n }\n }\n this._index = toIndex;\n this._el.dispatchEvent(new CustomEvent(\"navigationModelMutation\", {\n bubbles: false,\n detail: {\n fromIndex,\n toIndex\n }\n }));\n}\nclass NavigationModel {\n /**\n * @param {HTMLElement} el\n * @param {string} itemSelector\n * @param {typeof defaultOptions} selectedOptions\n */\n constructor(el, itemSelector, selectedOptions) {\n /** @member {typeof defaultOptions} */\n this.options = Object.assign({}, defaultOptions, selectedOptions);\n\n /** @member {HTMLElement} */\n this._el = el;\n\n /** @member {string} */\n this._itemSelector = itemSelector;\n }\n}\nclass LinearNavigationModel extends NavigationModel {\n /**\n * @param {HTMLElement} el\n * @param {string} itemSelector\n * @param {typeof defaultOptions} selectedOptions\n */\n constructor(el, itemSelector, selectedOptions) {\n super(el, itemSelector, selectedOptions);\n const fromIndex = this._index;\n const toIndex = findIndexPositionByType(this.options.autoInit, this.items, this.index);\n\n // do not use setter as it will trigger a change event\n this._index = toIndex;\n\n // always keep an element reference to the last item (for use in mutation observer)\n // todo: convert index to Tuple to store last/current values instead?\n this._cachedElement = this.items[toIndex];\n this._el.dispatchEvent(new CustomEvent(\"navigationModelInit\", {\n bubbles: false,\n detail: {\n firstInteractiveIndex: this.firstNavigableIndex,\n fromIndex,\n items: this.items,\n toIndex\n }\n }));\n }\n get currentItem() {\n return this.items[this.index];\n }\n\n // todo: code smell as getter abstracts that the query selector re-runs every time getter is accessed\n get items() {\n return [...this._el.querySelectorAll(\"\".concat(this._itemSelector))];\n }\n get index() {\n return this._index;\n }\n\n /**\n * @param {number} toIndex - update index position in this.items (non-interactive indexes fail silently)\n */\n set index(toIndex) {\n if (toIndex === this.index) {\n return;\n } else if (!isIndexNavigable(this.items, toIndex)) {\n // no-op. throw exception?\n } else {\n const fromIndex = this.index;\n // update cached element reference (for use in mutation observer if DOM node gets removed)\n this._cachedElement = this.items[toIndex];\n this._index = toIndex;\n this._el.dispatchEvent(new CustomEvent(\"navigationModelChange\", {\n bubbles: false,\n detail: {\n fromIndex,\n toIndex\n }\n }));\n }\n }\n indexOf(element) {\n return this.items.indexOf(element);\n }\n reset() {\n const fromIndex = this.index;\n const toIndex = findIndexPositionByType(this.options.autoReset, this.items, this.index);\n if (toIndex !== fromIndex) {\n // do not use setter as it will trigger a navigationModelChange event\n this._index = toIndex;\n this._el.dispatchEvent(new CustomEvent(\"navigationModelReset\", {\n bubbles: false,\n detail: {\n fromIndex,\n toIndex\n }\n }));\n }\n }\n}\n\n// 2D Grid Model will go here\n\n/*\nclass GridModel extends NavigationModel {\n constructor(el, rowSelector, colSelector) {\n super();\n this._coords = null;\n }\n}\n*/\n\nclass NavigationEmitter {\n /**\n * @param {HTMLElement} el\n * @param {LinearNavigationModel} model\n */\n constructor(el, model) {\n this.model = model;\n this.el = el;\n this._keyPrevListener = onKeyPrev.bind(model);\n this._keyNextListener = onKeyNext.bind(model);\n this._keyHomeListener = onKeyHome.bind(model);\n this._keyEndListener = onKeyEnd.bind(model);\n this._clickListener = onClick.bind(model);\n this._focusExitListener = onFocusExit.bind(model);\n this._observer = new MutationObserver(onMutation.bind(model));\n KeyEmitter.addKeyDown(this.el);\n ExitEmitter.addFocusExit(this.el);\n const axis = model.options.axis;\n if (axis === \"both\" || axis === \"x\") {\n this.el.addEventListener(\"arrowLeftKeyDown\", this._keyPrevListener);\n this.el.addEventListener(\"arrowRightKeyDown\", this._keyNextListener);\n }\n if (axis === \"both\" || axis === \"y\") {\n this.el.addEventListener(\"arrowUpKeyDown\", this._keyPrevListener);\n this.el.addEventListener(\"arrowDownKeyDown\", this._keyNextListener);\n }\n this.el.addEventListener(\"homeKeyDown\", this._keyHomeListener);\n this.el.addEventListener(\"endKeyDown\", this._keyEndListener);\n this.el.addEventListener(\"click\", this._clickListener);\n this.el.addEventListener(\"focusExit\", this._focusExitListener);\n this._observer.observe(this.el, {\n childList: true,\n subtree: true,\n attributeFilter: [\"aria-disabled\", \"hidden\"],\n attributes: true,\n attributeOldValue: true\n });\n }\n destroy() {\n KeyEmitter.removeKeyDown(this.el);\n ExitEmitter.removeFocusExit(this.el);\n this.el.removeEventListener(\"arrowLeftKeyDown\", this._keyPrevListener);\n this.el.removeEventListener(\"arrowRightKeyDown\", this._keyNextListener);\n this.el.removeEventListener(\"arrowUpKeyDown\", this._keyPrevListener);\n this.el.removeEventListener(\"arrowDownKeyDown\", this._keyNextListener);\n this.el.removeEventListener(\"homeKeyDown\", this._keyHomeListener);\n this.el.removeEventListener(\"endKeyDown\", this._keyEndListener);\n this.el.removeEventListener(\"click\", this._clickListener);\n this.el.removeEventListener(\"focusExit\", this._focusExitListener);\n this._observer.disconnect();\n }\n}\nfunction createLinear(el, itemSelector, selectedOptions) {\n const model = new LinearNavigationModel(el, itemSelector, selectedOptions);\n return new NavigationEmitter(el, model);\n}\n\n/*\nstatic createGrid(el, rowSelector, colSelector, selectedOptions) {\n return null;\n}\n*/\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = _default;\nconst sequenceMap = {};\nconst defaultPrefix = \"nid\";\nconst randomPortion = createRandomPortion(3);\nfunction randomNumber(max) {\n return Math.floor(Math.random() * max);\n}\nfunction createRandomPortion(size) {\n const letters = \"abcdefghijklmnopqrstuvwxyz\";\n const digits = \"0123456789\";\n const allChars = letters + digits;\n\n // to ensure a valid HTML ID (when prefix is empty), first character must be a letter\n let portion = letters[randomNumber(25)];\n\n // start iterating from 1, as we already have our first char\n for (let i = 1; i < size; i++) {\n portion += allChars[randomNumber(35)];\n }\n return portion;\n}\nfunction _default(el) {\n let prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultPrefix;\n const separator = prefix === \"\" ? \"\" : \"-\";\n\n // join first prefix with random portion to create key\n const key = \"\".concat(prefix).concat(separator).concat(randomPortion);\n\n // initialise key in sequence map if necessary\n sequenceMap[key] = sequenceMap[key] || 0;\n if (!el.id) {\n el.setAttribute(\"id\", \"\".concat(key, \"-\").concat(sequenceMap[key]++));\n }\n return el.id;\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.add = add;\nexports.remove = remove;\nfunction onKeyDown(e) {\n if (e.keyCode >= 32 && e.keyCode <= 40) {\n e.preventDefault();\n }\n}\nfunction add(el) {\n el.addEventListener(\"keydown\", onKeyDown);\n}\nfunction remove(el) {\n el.removeEventListener(\"keydown\", onKeyDown);\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.createLinear = createLinear;\nvar NavigationEmitter = _interopRequireWildcard(require(\"makeup-navigation-emitter\"));\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != typeof e && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if (\"default\" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\nconst defaultOptions = {\n autoInit: \"interactive\",\n autoReset: \"current\",\n wrap: false,\n axis: \"both\"\n};\nfunction refreshTabindex(items, focusIndex) {\n items.forEach(function (el, i) {\n el.setAttribute(\"tabindex\", i === focusIndex ? \"0\" : \"-1\");\n });\n}\nfunction onModelInit(e) {\n refreshTabindex(e.detail.items, e.detail.toIndex);\n this._el.dispatchEvent(new CustomEvent(\"rovingTabindexInit\", {\n detail: e.detail\n }));\n}\nfunction onModelChange(e) {\n const items = this.items;\n const fromItem = items[e.detail.fromIndex];\n const toItem = items[e.detail.toIndex];\n if (fromItem) {\n fromItem.setAttribute(\"tabindex\", \"-1\");\n }\n if (toItem) {\n toItem.setAttribute(\"tabindex\", \"0\");\n toItem.focus();\n }\n this._el.dispatchEvent(new CustomEvent(\"rovingTabindexChange\", {\n detail: e.detail\n }));\n}\nfunction onModelReset(e) {\n refreshTabindex(this.items, e.detail.toIndex);\n this._el.dispatchEvent(new CustomEvent(\"rovingTabindexReset\", {\n detail: e.detail\n }));\n}\nfunction onModelMutation(e) {\n refreshTabindex(this.items, e.detail.toIndex);\n this._el.dispatchEvent(new CustomEvent(\"rovingTabindexMutation\", {\n detail: e.detail\n }));\n}\nclass RovingTabindex {\n constructor(el) {\n this._el = el;\n this._onMutationListener = onModelMutation.bind(this);\n this._onChangeListener = onModelChange.bind(this);\n this._onInitListener = onModelInit.bind(this);\n this._onResetListener = onModelReset.bind(this);\n this._el.addEventListener(\"navigationModelMutation\", this._onMutationListener);\n this._el.addEventListener(\"navigationModelChange\", this._onChangeListener);\n this._el.addEventListener(\"navigationModelInit\", this._onInitListener);\n this._el.addEventListener(\"navigationModelReset\", this._onResetListener);\n }\n destroy() {\n this._el.removeEventListener(\"navigationModelMutation\", this._onMutationListener);\n this._el.removeEventListener(\"navigationModelChange\", this._onChangeListener);\n this._el.removeEventListener(\"navigationModelInit\", this._onInitListener);\n this._el.removeEventListener(\"navigationModelReset\", this._onResetListener);\n }\n}\nclass LinearRovingTabindex extends RovingTabindex {\n constructor(el, itemSelector, selectedOptions) {\n super(el);\n this._options = Object.assign({}, defaultOptions, selectedOptions);\n this._itemSelector = itemSelector;\n\n // todo: options.index is deprecated. Remove support in future release.\n this._navigationEmitter = NavigationEmitter.createLinear(el, itemSelector, {\n autoInit: this._options.index !== undefined ? this._options.index : this._options.autoInit,\n autoReset: this._options.autoReset,\n wrap: this._options.wrap,\n axis: this._options.axis\n });\n }\n get index() {\n return this._navigationEmitter.model.index;\n }\n set index(newIndex) {\n this._navigationEmitter.model.index = newIndex;\n }\n set wrap(newWrap) {\n this._navigationEmitter.model.options.wrap = newWrap;\n }\n get currentItem() {\n return this._navigationEmitter.model.currentItem;\n }\n get items() {\n return this._navigationEmitter.model.items;\n }\n reset() {\n this._navigationEmitter.model.reset();\n }\n destroy() {\n super.destroy();\n this._navigationEmitter.destroy();\n }\n}\n\n/*\nclass GridRovingTabindex extends RovingTabindex {\n constructor(el, rowSelector, cellSelector, selectedOptions) {\n super(el);\n }\n}\n*/\n\nfunction createLinear(el, itemSelector, selectedOptions) {\n return new LinearRovingTabindex(el, itemSelector, selectedOptions);\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _makeupExpander = _interopRequireDefault(require(\"makeup-expander\"));\nvar _makeupMenu = _interopRequireDefault(require(\"makeup-menu\"));\nfunction _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }\nconst defaultOptions = {\n customElementMode: false,\n expandedClass: \"menu-button--expanded\",\n menuSelector: \".menu-button__menu\",\n buttonTextSelector: \".btn__text\",\n buttonValueType: \"text\",\n // [\"text\", \"icon\", \"both\"],\n menuItemIconSelector: \".icon\",\n menuItemButtonAriaLabelSelector: null\n};\nclass _default {\n constructor(widgetEl, selectedOptions) {\n var _this$_buttonEl$datas;\n this._options = Object.assign({}, defaultOptions, selectedOptions);\n this.el = widgetEl;\n this._buttonEl = widgetEl.querySelector(\"button\");\n this._buttonEl.setAttribute(\"aria-haspopup\", \"true\");\n this.menu = new _makeupMenu.default(widgetEl.querySelector(this._options.menuSelector), {\n autoReset: \"interactive\"\n });\n this._buttonPrefix = (_this$_buttonEl$datas = this._buttonEl.dataset) === null || _this$_buttonEl$datas === void 0 ? void 0 : _this$_buttonEl$datas.makeupMenuButtonPrefix;\n this._buttonTextEl = this._buttonEl.querySelector(this._options.buttonTextSelector);\n this._expander = new _makeupExpander.default(widgetEl, {\n alwaysDoFocusManagement: true,\n autoCollapse: true,\n collapseOnHostReFocus: true,\n contentSelector: this._options.menuSelector,\n expandedClass: this._options.expandedClass,\n expandOnClick: true,\n focusManagement: \"focusable\",\n hostSelector: \"button\"\n });\n this._onButtonFirstClickListener = _onButtonFirstClick.bind(this);\n this._onMenuKeyDownListener = _onMenuKeyDown.bind(this);\n this._onMenuItemSelectListener = _onMenuItemSelect.bind(this);\n this._onMutationListener = _onMutation.bind(this);\n this.el.classList.add(\"menu-button--js\");\n if (!this._options.customElementMode) {\n this._mutationObserver = new MutationObserver(this._onMutationListener);\n this._observeMutations();\n this._observeEvents();\n }\n }\n _observeMutations() {\n if (!this._options.customElementMode) {\n this._mutationObserver.observe(this.el, {\n attributeFilter: [\"aria-expanded\", \"disabled\"],\n attributes: true,\n childList: false,\n subtree: false\n });\n }\n }\n _unobserveMutations() {\n if (!this._options.customElementMode) {\n this._mutationObserver.disconnect();\n }\n }\n _observeEvents() {\n if (this._destroyed !== true) {\n this._buttonEl.addEventListener(\"click\", this._onButtonFirstClickListener, {\n once: true\n });\n this.menu.el.addEventListener(\"keydown\", this._onMenuKeyDownListener);\n this.menu.el.addEventListener(\"makeup-menu-select\", this._onMenuItemSelectListener);\n this.menu.el.addEventListener(\"makeup-menu-change\", this._onMenuItemSelectListener);\n }\n }\n _unobserveEvents() {\n this._buttonEl.removeEventListener(\"click\", this._onButtonFirstClickListener);\n this.menu.el.removeEventListener(\"keydown\", this._onMenuKeyDownListener);\n this.menu.el.removeEventListener(\"makeup-menu-select\", this._onMenuItemSelectListener);\n this.menu.el.removeEventListener(\"makeup-menu-change\", this._onMenuItemSelectListener);\n }\n destroy() {\n this._destroyed = true;\n this._unobserveMutations();\n this._unobserveEvents();\n this._onButtonFirstClickListener = null;\n this._onMenuKeyDownListener = null;\n this._onMenuItemSelectListener = null;\n this._onMutationListener = null;\n }\n}\nexports.default = _default;\nfunction _onMutation(mutationsList) {\n for (const mutation of mutationsList) {\n if (mutation.type === \"attributes\") {\n this.el.dispatchEvent(new CustomEvent(\"makeup-menu-button-mutation\", {\n detail: {\n attributeName: mutation.attributeName\n }\n }));\n }\n }\n}\nfunction _onButtonFirstClick() {\n this.menu.el.hidden = false;\n}\nfunction _onMenuKeyDown(e) {\n if (e.keyCode === 27) {\n this._expander.expanded = false;\n this._buttonEl.focus();\n }\n}\nfunction _onMenuItemSelect(e) {\n const widget = this;\n const {\n el\n } = e.detail;\n setTimeout(function () {\n widget._expander.expanded = false;\n widget._buttonEl.focus();\n }, 150);\n if (el.getAttribute(\"role\") !== \"menuitemradio\") {\n return;\n }\n const {\n menuItemIconSelector,\n menuItemButtonAriaLabelSelector,\n buttonValueType\n } = this._options;\n const icon = el.querySelector(menuItemIconSelector).cloneNode(true);\n const text = el.innerText.trim();\n let btnContent = this._buttonPrefix ? \"\".concat(this._buttonPrefix, \" \").concat(text) : text;\n if (icon) {\n switch (buttonValueType) {\n case \"both\":\n btnContent = \"\".concat(icon.outerHTML, \" \").concat(btnContent, \"\");\n break;\n case \"icon\":\n this._buttonEl.setAttribute(\"aria-label\", btnContent);\n btnContent = icon.outerHTML;\n break;\n default:\n break;\n }\n }\n if (menuItemButtonAriaLabelSelector) {\n var _el$querySelector;\n const selectorText = (_el$querySelector = el.querySelector(menuItemButtonAriaLabelSelector)) === null || _el$querySelector === void 0 ? void 0 : _el$querySelector.innerText.trim();\n this._buttonEl.setAttribute(\"aria-label\", this._buttonPrefix ? \"\".concat(this._buttonPrefix, \" \").concat(selectorText) : selectorText);\n }\n this._buttonTextEl.innerHTML = btnContent;\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar RovingTabIndex = _interopRequireWildcard(require(\"makeup-roving-tabindex\"));\nvar PreventScrollKeys = _interopRequireWildcard(require(\"makeup-prevent-scroll-keys\"));\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != typeof e && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if (\"default\" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\nconst defaultOptions = {\n customElementMode: false,\n autoInit: \"interactive\",\n autoReset: \"interactive\"\n};\nclass _default {\n constructor(widgetEl, selectedOptions) {\n this._options = Object.assign({}, defaultOptions, selectedOptions);\n this.el = widgetEl;\n this._rovingTabIndex = RovingTabIndex.createLinear(this.el, \"[role^=menuitem]\", {\n autoInit: this._options.autoInit,\n autoReset: this._options.autoReset\n });\n PreventScrollKeys.add(this.el);\n this._onKeyDownListener = _onKeyDown.bind(this);\n this._onClickListener = _onClick.bind(this);\n this._onMutationListener = _onMutation.bind(this);\n this.el.classList.add(\"menu--js\");\n if (!this._options.customElementMode) {\n this._mutationObserver = new MutationObserver(this._onMutationListener);\n this._observeMutations();\n this._observeEvents();\n }\n }\n select(index) {\n this._unobserveMutations();\n const el = this.items[index];\n switch (el.getAttribute(\"role\")) {\n case \"menuitemcheckbox\":\n _selectMenuItemCheckbox(this.el, el);\n break;\n case \"menuitemradio\":\n _selectMenuItemRadio(this.el, el);\n break;\n default:\n _selectMenuItem(this.el, el);\n break;\n }\n this._observeMutations();\n }\n get items() {\n return this._rovingTabIndex.items;\n }\n get radioGroupNames() {\n const els = [...this.el.querySelectorAll(\"[role=menuitemradio][data-makeup-group]\")];\n const groupNames = [...new Set(els.map(el => el.dataset.makeupGroup))];\n return groupNames;\n }\n get checkboxGroupNames() {\n const els = [...this.el.querySelectorAll(\"[role=menuitemcheckbox][data-makeup-group]\")];\n const groupNames = [...new Set(els.map(el => el.dataset.makeupGroup))];\n return groupNames;\n }\n _observeMutations() {\n if (!this._options.customElementMode) {\n this._mutationObserver.observe(this.el, {\n attributeFilter: [\"aria-checked\", \"aria-disabled\"],\n attributes: true,\n childList: true,\n subtree: true\n });\n }\n }\n _unobserveMutations() {\n if (!this._options.customElementMode) {\n this._mutationObserver.disconnect();\n }\n }\n _observeEvents() {\n if (this._destroyed !== true) {\n this.el.addEventListener(\"keydown\", this._onKeyDownListener);\n this.el.addEventListener(\"click\", this._onClickListener);\n }\n }\n _unobserveEvents() {\n this.el.removeEventListener(\"keydown\", this._onKeyDownListener);\n this.el.removeEventListener(\"click\", this._onClickListener);\n }\n destroy() {\n this._destroyed = true;\n this._unobserveMutations();\n this._unobserveEvents();\n this._onKeyDownListener = null;\n this._onClickListener = null;\n this._onMutationListener = null;\n }\n}\nexports.default = _default;\nfunction _onMutation(mutationsList) {\n for (const mutation of mutationsList) {\n if (mutation.type === \"attributes\") {\n this.el.dispatchEvent(new CustomEvent(\"makeup-menu-mutation\", {\n detail: {\n attributeName: mutation.attributeName\n }\n }));\n }\n }\n}\nfunction _onKeyDown(e) {\n this._unobserveMutations();\n if (e.keyCode === 13) {\n e.preventDefault();\n }\n if (e.keyCode === 13 || e.keyCode === 32) {\n this.select(Array.from(this.items).indexOf(e.target));\n }\n this._observeMutations();\n}\nfunction _onClick(e) {\n // unlike the keyDown event, the click event target can be a child element of the menuitem\n // e.g. Item 1
\n const menuItemEl = e.target.closest(\"[role^=menuitem]\");\n const index = this.items.indexOf(menuItemEl);\n if (index !== -1) {\n this.select(index);\n }\n}\nfunction _selectMenuItem(widgetEl, menuItemEl) {\n widgetEl.dispatchEvent(new CustomEvent(\"makeup-menu-select\", {\n detail: {\n el: menuItemEl,\n value: menuItemEl.innerText\n }\n }));\n}\nfunction _selectMenuItemCheckbox(widgetEl, menuItemEl) {\n if (menuItemEl.getAttribute(\"aria-disabled\") !== \"true\") {\n const groupName = menuItemEl.dataset.makeupGroup;\n menuItemEl.setAttribute(\"aria-checked\", menuItemEl.getAttribute(\"aria-checked\") === \"true\" ? \"false\" : \"true\");\n widgetEl.dispatchEvent(new CustomEvent(\"makeup-menu-change\", {\n detail: {\n el: menuItemEl,\n checked: menuItemEl.getAttribute(\"aria-checked\"),\n group: groupName,\n value: menuItemEl.innerText\n }\n }));\n }\n}\nfunction _selectMenuItemRadio(widgetEl, menuItemEl) {\n if (menuItemEl.getAttribute(\"aria-disabled\") !== \"true\") {\n const groupName = menuItemEl.dataset.makeupGroup;\n const checkedEl = widgetEl.querySelector(\"[data-makeup-group=\".concat(groupName, \"][aria-checked=true]\"));\n if (!checkedEl) {\n menuItemEl.setAttribute(\"aria-checked\", \"true\");\n widgetEl.dispatchEvent(new CustomEvent(\"makeup-menu-change\", {\n detail: {\n el: menuItemEl,\n group: groupName,\n value: menuItemEl.innerText\n }\n }));\n } else if (checkedEl !== menuItemEl) {\n checkedEl.setAttribute(\"aria-checked\", \"false\");\n menuItemEl.setAttribute(\"aria-checked\", \"true\");\n widgetEl.dispatchEvent(new CustomEvent(\"makeup-menu-change\", {\n detail: {\n el: menuItemEl,\n group: groupName,\n value: menuItemEl.innerText\n }\n }));\n }\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","\"use strict\";\n\nrequire(\"../../docs.css\");\nrequire(\"@ebay/skin/tokens\");\nrequire(\"@ebay/skin/global\");\nrequire(\"@ebay/skin/button\");\nrequire(\"@ebay/skin/menu-button\");\nvar _makeupMenuButton = _interopRequireDefault(require(\"makeup-menu-button\"));\nfunction _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }\n// REQUIRE\n// const MenuButton = require('makeup-menu-button').default;\n\n// IMPORT\n\nwindow.onload = function () {\n document.querySelectorAll(\".menu-button\").forEach(function (el, i) {\n const hasCustomLabel = el.classList.contains(\"menu-button-with-icon-customText\");\n const hasIconText = el.classList.contains(\"menu-button-with-iconText\");\n const hasIcon = el.classList.contains(\"menu-button-with-icon\");\n let buttonValueType;\n if (hasIconText) {\n buttonValueType = \"both\";\n } else if (hasIcon || hasCustomLabel) {\n buttonValueType = \"icon\";\n } else {\n buttonValueType = \"text\";\n }\n const menuItemButtonAriaLabelSelector = hasCustomLabel ? \".menu-button__item-value span\" : null;\n const widget = new _makeupMenuButton.default(el, {\n buttonValueType,\n menuItemButtonAriaLabelSelector\n });\n widget.menu.el.addEventListener(\"makeup-menu-select\", e => console.log(e.type, e.detail));\n widget.menu.el.addEventListener(\"makeup-menu-change\", e => console.log(e.type, e.detail));\n widget.menu.el.addEventListener(\"makeup-menu-button-mutation\", e => console.log(e.type, e.detail));\n });\n};"],"names":[],"sourceRoot":""}
\ No newline at end of file
diff --git a/packages/core/makeup-expander/README.md b/packages/core/makeup-expander/README.md
index 38117a31..5bd1e6fb 100644
--- a/packages/core/makeup-expander/README.md
+++ b/packages/core/makeup-expander/README.md
@@ -96,7 +96,7 @@ Setting focus on the host (a text input) sets it's aria-expanded state _and_ add
- `options.collapseOnClickOut`: whether the content should collapse when clicking outside of content (default: false)
- `options.collapseOnFocusOut`: whether the content should collapse when focus leaves the content (default: false)
- `options.collapseOnMouseOut`: whether the content should collapse when mouse leaves the content (default: false)
-- `options.collapseOnHostFocus`: whether the content should collapse when focus is on the host (default: false)
+- `options.collapseOnHostReFocus`: whether the content should collapse when focus moves back to the host from content (default: false). This cannot be set to true when expandOnFocus is true
- `options.contentSelector`: the query selector for the expandee element in relation to the widget (default: '.expander\_\_content')
- `options.expandOnClick`: whether the host should be click activated (default: false)
- `options.expandOnFocus`: whether the host should be focus activated (default: false)
diff --git a/packages/core/makeup-expander/dist/cjs/index.js b/packages/core/makeup-expander/dist/cjs/index.js
index 6cc52578..30568955 100644
--- a/packages/core/makeup-expander/dist/cjs/index.js
+++ b/packages/core/makeup-expander/dist/cjs/index.js
@@ -17,7 +17,7 @@ const defaultOptions = {
collapseOnFocusOut: false,
collapseOnMouseOut: false,
collapseOnClickOut: false,
- collapseOnHostFocus: false,
+ collapseOnHostReFocus: false,
contentSelector: ".expander__content",
expandedClass: null,
expandOnClick: false,
@@ -43,18 +43,27 @@ function onHostMouseDown() {
function onHostClick() {
this._expandWasKeyboardClickActivated = this._keyboardClickFlag;
this._expandWasMouseClickActivated = this._mouseClickFlag;
+ this._widgetHasKeyboardFocus = this._keyboardClickFlag;
this.expanded = !this.expanded;
}
function onHostFocus() {
this._expandWasFocusActivated = true;
this.expanded = true;
}
+
+// NOTE: collapseOnHostReFocus cannot be used when expandOnFocus is true
+function onHostReFocus() {
+ if (this.expanded && this._widgetHasKeyboardFocus) {
+ this.expanded = false;
+ }
+}
function onHostHover() {
clearTimeout(this._mouseLeft);
this._expandWasHoverActivated = true;
this.expanded = true;
}
function onFocusExit() {
+ this._widgetHasKeyboardFocus = false;
this.expanded = false;
}
function onMouseLeave() {
@@ -114,6 +123,7 @@ class _default {
this._documentTouchEndListener = _onDocumentTouchEnd.bind(this);
this._hostClickListener = onHostClick.bind(this);
this._hostFocusListener = onHostFocus.bind(this);
+ this._hostReFocusListener = onHostReFocus.bind(this);
this._hostHoverListener = onHostHover.bind(this);
this._focusExitListener = onFocusExit.bind(this);
this._mouseLeaveListener = onMouseLeave.bind(this);
@@ -129,7 +139,7 @@ class _default {
this.expandOnClick = this.options.expandOnClick;
this.expandOnFocus = this.options.expandOnFocus;
this.expandOnHover = this.options.expandOnHover;
- this.collapseOnHostFocus = this.options.collapseOnHostFocus;
+ this.collapseOnHostReFocus = this.options.collapseOnHostReFocus;
if (this.options.autoCollapse === false) {
this.collapseOnClickOut = this.options.collapseOnClickOut;
this.collapseOnFocusOut = this.options.collapseOnFocusOut;
@@ -162,6 +172,13 @@ class _default {
this.hostEl.removeEventListener("focus", this._hostFocusListener);
}
}
+ set collapseOnHostReFocus(bool) {
+ if (bool === true) {
+ this.hostEl.addEventListener("focus", this._hostReFocusListener);
+ } else {
+ this.hostEl.removeEventListener("focus", this._hostReFocusListener);
+ }
+ }
set expandOnHover(bool) {
if (bool === true) {
this.hostEl.addEventListener("mouseenter", this._hostHoverListener);
@@ -194,13 +211,6 @@ class _default {
this.el.removeEventListener("focusExit", this._focusExitListener);
}
}
- set collapseOnHostFocus(bool) {
- if (bool === true) {
- this.contentEl.addEventListener("focusExit", this._focusExitListener);
- } else {
- this.contentEl.removeEventListener("focusExit", this._focusExitListener);
- }
- }
set collapseOnMouseOut(bool) {
if (bool === true) {
this.el.addEventListener("mouseleave", this._mouseLeaveListener);
@@ -252,6 +262,7 @@ class _default {
this.collapseOnClickOut = false;
this.collapseOnFocusOut = false;
this.collapseOnMouseOut = false;
+ this.collapseOnHostReFocus = false;
}
}
destroy() {
@@ -265,9 +276,11 @@ class _default {
this._documentTouchEndListener = null;
this._hostClickListener = null;
this._hostFocusListener = null;
+ this._hostReFocusListener = null;
this._hostHoverListener = null;
this._focusExitListener = null;
this._mouseLeaveListener = null;
+ this._widgetHasKeyboardFocus = null;
}
}
exports.default = _default;
diff --git a/packages/core/makeup-expander/dist/mjs/index.js b/packages/core/makeup-expander/dist/mjs/index.js
index fc9924a2..ce6da763 100644
--- a/packages/core/makeup-expander/dist/mjs/index.js
+++ b/packages/core/makeup-expander/dist/mjs/index.js
@@ -8,7 +8,7 @@ const defaultOptions = {
collapseOnFocusOut: false,
collapseOnMouseOut: false,
collapseOnClickOut: false,
- collapseOnHostFocus: false,
+ collapseOnHostReFocus: false,
contentSelector: ".expander__content",
expandedClass: null,
expandOnClick: false,
@@ -32,18 +32,25 @@ function onHostMouseDown() {
function onHostClick() {
this._expandWasKeyboardClickActivated = this._keyboardClickFlag;
this._expandWasMouseClickActivated = this._mouseClickFlag;
+ this._widgetHasKeyboardFocus = this._keyboardClickFlag;
this.expanded = !this.expanded;
}
function onHostFocus() {
this._expandWasFocusActivated = true;
this.expanded = true;
}
+function onHostReFocus() {
+ if (this.expanded && this._widgetHasKeyboardFocus) {
+ this.expanded = false;
+ }
+}
function onHostHover() {
clearTimeout(this._mouseLeft);
this._expandWasHoverActivated = true;
this.expanded = true;
}
function onFocusExit() {
+ this._widgetHasKeyboardFocus = false;
this.expanded = false;
}
function onMouseLeave() {
@@ -101,6 +108,7 @@ class index_default {
this._documentTouchEndListener = _onDocumentTouchEnd.bind(this);
this._hostClickListener = onHostClick.bind(this);
this._hostFocusListener = onHostFocus.bind(this);
+ this._hostReFocusListener = onHostReFocus.bind(this);
this._hostHoverListener = onHostHover.bind(this);
this._focusExitListener = onFocusExit.bind(this);
this._mouseLeaveListener = onMouseLeave.bind(this);
@@ -115,7 +123,7 @@ class index_default {
this.expandOnClick = this.options.expandOnClick;
this.expandOnFocus = this.options.expandOnFocus;
this.expandOnHover = this.options.expandOnHover;
- this.collapseOnHostFocus = this.options.collapseOnHostFocus;
+ this.collapseOnHostReFocus = this.options.collapseOnHostReFocus;
if (this.options.autoCollapse === false) {
this.collapseOnClickOut = this.options.collapseOnClickOut;
this.collapseOnFocusOut = this.options.collapseOnFocusOut;
@@ -148,6 +156,13 @@ class index_default {
this.hostEl.removeEventListener("focus", this._hostFocusListener);
}
}
+ set collapseOnHostReFocus(bool) {
+ if (bool === true) {
+ this.hostEl.addEventListener("focus", this._hostReFocusListener);
+ } else {
+ this.hostEl.removeEventListener("focus", this._hostReFocusListener);
+ }
+ }
set expandOnHover(bool) {
if (bool === true) {
this.hostEl.addEventListener("mouseenter", this._hostHoverListener);
@@ -180,13 +195,6 @@ class index_default {
this.el.removeEventListener("focusExit", this._focusExitListener);
}
}
- set collapseOnHostFocus(bool) {
- if (bool === true) {
- this.contentEl.addEventListener("focusExit", this._focusExitListener);
- } else {
- this.contentEl.removeEventListener("focusExit", this._focusExitListener);
- }
- }
set collapseOnMouseOut(bool) {
if (bool === true) {
this.el.addEventListener("mouseleave", this._mouseLeaveListener);
@@ -232,6 +240,7 @@ class index_default {
this.collapseOnClickOut = false;
this.collapseOnFocusOut = false;
this.collapseOnMouseOut = false;
+ this.collapseOnHostReFocus = false;
}
}
destroy() {
@@ -245,9 +254,11 @@ class index_default {
this._documentTouchEndListener = null;
this._hostClickListener = null;
this._hostFocusListener = null;
+ this._hostReFocusListener = null;
this._hostHoverListener = null;
this._focusExitListener = null;
this._mouseLeaveListener = null;
+ this._widgetHasKeyboardFocus = null;
}
}
export {
diff --git a/packages/core/makeup-expander/src/index.js b/packages/core/makeup-expander/src/index.js
index 9ea13a46..72ebe200 100644
--- a/packages/core/makeup-expander/src/index.js
+++ b/packages/core/makeup-expander/src/index.js
@@ -9,7 +9,7 @@ const defaultOptions = {
collapseOnFocusOut: false,
collapseOnMouseOut: false,
collapseOnClickOut: false,
- collapseOnHostFocus: false,
+ collapseOnHostReFocus: false,
contentSelector: ".expander__content",
expandedClass: null,
expandOnClick: false,
@@ -38,6 +38,7 @@ function onHostMouseDown() {
function onHostClick() {
this._expandWasKeyboardClickActivated = this._keyboardClickFlag;
this._expandWasMouseClickActivated = this._mouseClickFlag;
+ this._widgetHasKeyboardFocus = this._keyboardClickFlag;
this.expanded = !this.expanded;
}
@@ -46,6 +47,13 @@ function onHostFocus() {
this.expanded = true;
}
+// NOTE: collapseOnHostReFocus cannot be used when expandOnFocus is true
+function onHostReFocus() {
+ if (this.expanded && this._widgetHasKeyboardFocus) {
+ this.expanded = false;
+ }
+}
+
function onHostHover() {
clearTimeout(this._mouseLeft);
this._expandWasHoverActivated = true;
@@ -53,6 +61,7 @@ function onHostHover() {
}
function onFocusExit() {
+ this._widgetHasKeyboardFocus = false;
this.expanded = false;
}
@@ -120,6 +129,7 @@ export default class {
this._documentTouchEndListener = _onDocumentTouchEnd.bind(this);
this._hostClickListener = onHostClick.bind(this);
this._hostFocusListener = onHostFocus.bind(this);
+ this._hostReFocusListener = onHostReFocus.bind(this);
this._hostHoverListener = onHostHover.bind(this);
this._focusExitListener = onFocusExit.bind(this);
this._mouseLeaveListener = onMouseLeave.bind(this);
@@ -138,7 +148,7 @@ export default class {
this.expandOnClick = this.options.expandOnClick;
this.expandOnFocus = this.options.expandOnFocus;
this.expandOnHover = this.options.expandOnHover;
- this.collapseOnHostFocus = this.options.collapseOnHostFocus;
+ this.collapseOnHostReFocus = this.options.collapseOnHostReFocus;
if (this.options.autoCollapse === false) {
this.collapseOnClickOut = this.options.collapseOnClickOut;
@@ -177,6 +187,14 @@ export default class {
}
}
+ set collapseOnHostReFocus(bool) {
+ if (bool === true) {
+ this.hostEl.addEventListener("focus", this._hostReFocusListener);
+ } else {
+ this.hostEl.removeEventListener("focus", this._hostReFocusListener);
+ }
+ }
+
set expandOnHover(bool) {
if (bool === true) {
this.hostEl.addEventListener("mouseenter", this._hostHoverListener);
@@ -213,14 +231,6 @@ export default class {
}
}
- set collapseOnHostFocus(bool) {
- if (bool === true) {
- this.contentEl.addEventListener("focusExit", this._focusExitListener);
- } else {
- this.contentEl.removeEventListener("focusExit", this._focusExitListener);
- }
- }
-
set collapseOnMouseOut(bool) {
if (bool === true) {
this.el.addEventListener("mouseleave", this._mouseLeaveListener);
@@ -274,6 +284,7 @@ export default class {
this.collapseOnClickOut = false;
this.collapseOnFocusOut = false;
this.collapseOnMouseOut = false;
+ this.collapseOnHostReFocus = false;
}
}
@@ -288,8 +299,10 @@ export default class {
this._documentTouchEndListener = null;
this._hostClickListener = null;
this._hostFocusListener = null;
+ this._hostReFocusListener = null;
this._hostHoverListener = null;
this._focusExitListener = null;
this._mouseLeaveListener = null;
+ this._widgetHasKeyboardFocus = null;
}
}
diff --git a/packages/core/makeup-expander/test/index.spec.js b/packages/core/makeup-expander/test/index.spec.js
new file mode 100644
index 00000000..63570d17
--- /dev/null
+++ b/packages/core/makeup-expander/test/index.spec.js
@@ -0,0 +1,326 @@
+import { test, expect } from "@playwright/test";
+
+test.describe("given an expander with auto collapse off", () => {
+ let containerEl;
+ let hostEl;
+ let contentEl;
+
+ test.beforeEach(async ({ page }) => {
+ await page.goto("/core/makeup-expander/index.html");
+
+ containerEl = page.locator(".expander--click-only").first();
+ hostEl = containerEl.locator(".expander__host");
+ contentEl = containerEl.locator(".expander__content");
+ });
+
+ test("should have the correct initial state", async () => {
+ expect(containerEl).toBeTruthy();
+ await expect(hostEl).toHaveAttribute("aria-expanded", "false");
+ await expect(contentEl).not.toBeVisible();
+ });
+
+ test("should expand on host click", async () => {
+ await hostEl.click();
+ await expect(hostEl).toHaveAttribute("aria-expanded", "true");
+ await expect(contentEl).toBeVisible();
+ });
+
+ test("should collapse on host clicking twice", async () => {
+ await hostEl.click();
+ await expect(hostEl).toHaveAttribute("aria-expanded", "true");
+ await expect(contentEl).toBeVisible();
+
+ await hostEl.click();
+ await expect(hostEl).toHaveAttribute("aria-expanded", "false");
+ await expect(contentEl).not.toBeVisible();
+ });
+
+ test("should expand on host using keyboard [Space] key", async () => {
+ await hostEl.focus();
+ await hostEl.press("Space");
+ await expect(hostEl).toHaveAttribute("aria-expanded", "true");
+ await expect(contentEl).toBeVisible();
+ });
+
+ test("should expand on host using keyboard [Enter] key", async () => {
+ await hostEl.focus();
+ await hostEl.press("Enter");
+ await expect(hostEl).toHaveAttribute("aria-expanded", "true");
+ await expect(contentEl).toBeVisible();
+ });
+});
+
+test.describe("given an expander with auto collapse on", () => {
+ test.describe("click-only expander", () => {
+ let containerEl;
+ let hostEl;
+ let contentEl;
+
+ test.beforeEach(async ({ page }) => {
+ await page.goto("/core/makeup-expander/index.html");
+ containerEl = page.locator(".expander--click-only.flyout").first();
+ hostEl = containerEl.locator(".expander__host");
+ contentEl = containerEl.locator(".expander__content");
+ });
+
+ test("should have the correct initial state", async () => {
+ expect(containerEl).toBeTruthy();
+ await expect(hostEl).toHaveAttribute("aria-expanded", "false");
+ await expect(contentEl).not.toBeVisible();
+ });
+
+ test("should expand on host click", async () => {
+ await hostEl.click();
+ await expect(hostEl).toHaveAttribute("aria-expanded", "true");
+ await expect(contentEl).toBeVisible();
+ });
+
+ test("should collapse on clickout", async ({ page }) => {
+ await hostEl.click();
+ await expect(hostEl).toHaveAttribute("aria-expanded", "true");
+
+ // Click outside the expander to trigger collapse
+ await page.click("body", { position: { x: 10, y: 10 } });
+ await expect(hostEl).toHaveAttribute("aria-expanded", "false");
+ await expect(contentEl).not.toBeVisible();
+ });
+ });
+
+ test.describe("focus-only expander", () => {
+ let containerEl;
+ let hostEl;
+ let contentEl;
+ let anotherEl;
+
+ test.beforeEach(async ({ page }) => {
+ await page.goto("/core/makeup-expander/index.html");
+ containerEl = page.locator(".expander--focus-only").first();
+ hostEl = containerEl.locator(".expander__host");
+ contentEl = containerEl.locator(".expander__content");
+ anotherEl = page.locator(".expander--click-only").first();
+ });
+
+ test("should have the correct initial state", async () => {
+ await expect(hostEl).toHaveAttribute("aria-expanded", "false");
+ await expect(contentEl).not.toBeVisible();
+ });
+
+ test("should expand on host focus", async () => {
+ await hostEl.focus();
+ await expect(hostEl).toHaveAttribute("aria-expanded", "true");
+ await expect(contentEl).toBeVisible();
+ });
+
+ test("should collapse on focus out", async ({ page }) => {
+ await hostEl.focus();
+ await expect(hostEl).toHaveAttribute("aria-expanded", "true");
+
+ // Focus something else to trigger focusout
+ await page.keyboard.press("Shift+Tab");
+ // await expect(hostEl).toHaveAttribute("aria-expanded", "false");
+ await expect(contentEl).not.toBeVisible();
+ });
+ });
+
+ test.describe("focus-and-hover expander", () => {
+ let containerEl;
+ let hostEl;
+ let contentEl;
+
+ test.beforeEach(async ({ page }) => {
+ await page.goto("/core/makeup-expander/index.html");
+ containerEl = page.locator(".expander--focus-and-hover").first();
+ hostEl = containerEl.locator(".expander__host");
+ contentEl = containerEl.locator(".expander__content");
+ });
+
+ test("should have the correct initial state", async () => {
+ await expect(hostEl).toHaveAttribute("aria-expanded", "false");
+ await expect(contentEl).not.toBeVisible();
+ });
+
+ test("should expand on host focus", async () => {
+ await hostEl.focus();
+ await expect(hostEl).toHaveAttribute("aria-expanded", "true");
+ await expect(contentEl).toBeVisible();
+ });
+
+ test("should expand on host hover", async () => {
+ await hostEl.hover();
+ await expect(hostEl).toHaveAttribute("aria-expanded", "true");
+ await expect(contentEl).toBeVisible();
+ });
+
+ test("should collapse on mouse out", async ({ page }) => {
+ await hostEl.hover();
+ await expect(hostEl).toHaveAttribute("aria-expanded", "true");
+
+ // Move mouse away to trigger mouseout
+ await page.mouse.move(10, 10);
+
+ // Wait for the timeout (300ms in the code)
+ await page.waitForTimeout(350);
+
+ await expect(hostEl).toHaveAttribute("aria-expanded", "false");
+ await expect(contentEl).not.toBeVisible();
+ });
+ });
+
+ test.describe("hover-only expander", () => {
+ let containerEl;
+ let hostEl;
+ let contentEl;
+
+ test.beforeEach(async ({ page }) => {
+ await page.goto("/core/makeup-expander/index.html");
+ containerEl = page.locator(".expander--hover-only").first();
+ hostEl = containerEl.locator(".expander__host").first();
+ contentEl = containerEl.locator(".expander__content");
+ });
+
+ test("should have the correct initial state", async () => {
+ await expect(hostEl).toHaveAttribute("aria-expanded", "false");
+ await expect(contentEl).not.toBeVisible();
+ });
+
+ test("should expand on host hover", async () => {
+ await hostEl.hover();
+ await expect(hostEl).toHaveAttribute("aria-expanded", "true");
+ });
+
+ test("should collapse on mouse out", async ({ page }) => {
+ await hostEl.hover();
+ await expect(hostEl).toHaveAttribute("aria-expanded", "true");
+
+ // Move mouse away to trigger mouseout
+ await page.mouse.move(10, 10);
+
+ // Wait for the timeout (300ms in the code)
+ await page.waitForTimeout(350);
+
+ await expect(hostEl).toHaveAttribute("aria-expanded", "false");
+ });
+ });
+
+ test.describe("click-and-spacebar expander", () => {
+ let containerEl;
+ let hostEl;
+ let contentEl;
+
+ test.beforeEach(async ({ page }) => {
+ await page.goto("/core/makeup-expander/index.html");
+ containerEl = page.locator(".expander--click-and-spacebar").first();
+ hostEl = containerEl.locator(".expander__host");
+ contentEl = containerEl.locator(".expander__content");
+ });
+
+ test("should have the correct initial state", async () => {
+ await expect(hostEl).toHaveAttribute("aria-expanded", "false");
+ await expect(contentEl).not.toBeVisible();
+ });
+
+ test("should expand on host click", async () => {
+ await hostEl.click();
+ await expect(hostEl).toHaveAttribute("aria-expanded", "true");
+ await expect(contentEl).toBeVisible();
+ });
+
+ test("should expand on spacebar when focused", async () => {
+ await hostEl.focus();
+ await hostEl.press("Space");
+ await expect(hostEl).toHaveAttribute("aria-expanded", "true");
+ await expect(contentEl).toBeVisible();
+ });
+ });
+
+ test.describe("stealth-only expander", () => {
+ let containerEl;
+ let hostEl;
+ let contentEl;
+
+ test.beforeEach(async ({ page }) => {
+ await page.goto("/core/makeup-expander/index.html");
+ containerEl = page.locator(".expander--stealth-only").first();
+ hostEl = containerEl.locator(".expander__host");
+ contentEl = containerEl.locator(".expander__content");
+ });
+
+ test("should have the correct initial state", async () => {
+ await expect(hostEl).toHaveAttribute("aria-expanded", "false");
+ await expect(contentEl).not.toBeVisible();
+ });
+
+ test("should expand on host click", async () => {
+ await hostEl.press("Space");
+ await expect(hostEl).toHaveAttribute("aria-expanded", "true");
+ await expect(contentEl).toBeVisible();
+ });
+ });
+});
+
+test.describe("given an expander event handling", () => {
+ let containerEl;
+ let hostEl;
+ let contentEl;
+
+ test.beforeEach(async ({ page }) => {
+ await page.goto("/core/makeup-expander/index.html");
+ containerEl = page.locator(".expander--click-only").first();
+ hostEl = containerEl.locator(".expander__host");
+ contentEl = containerEl.locator(".expander__content");
+ });
+
+ test("should emit expander-expand event on expansion", async ({ page }) => {
+ // Set up event listener
+ await page.evaluate(() => {
+ window.eventFired = false;
+ document.querySelector(".expander--click-only").addEventListener("expander-expand", () => {
+ window.eventFired = true;
+ });
+ });
+
+ await hostEl.click();
+
+ // Check if event was fired
+ const eventFired = await page.evaluate(() => window.eventFired);
+ expect(eventFired).toBe(true);
+ });
+
+ test("should emit expander-collapse event on collapse", async ({ page }) => {
+ // First expand
+ await hostEl.click();
+
+ // Set up event listener
+ await page.evaluate(() => {
+ window.eventFired = false;
+ document.querySelector(".expander--click-only").addEventListener("expander-collapse", () => {
+ window.eventFired = true;
+ });
+ });
+
+ // Collapse
+ await hostEl.click();
+
+ // Check if event was fired
+ const eventFired = await page.evaluate(() => window.eventFired);
+ expect(eventFired).toBe(true);
+ });
+});
+
+// test.describe("given an expander with focus management", () => {
+// test("should focus first focusable element when expanded with focusManagement='focusable'", async ({ page }) => {
+// // Setup a custom expander with focusManagement option
+// await page.goto("/core/makeup-expander/index.html");
+
+// const container = page.locator(".expander--hover-only").first();
+// const hostEl = container.locator(".expander__host").first();
+// await hostEl.focus();
+// await page.keyboard.press("Tab");
+// await page.keyboard.press("Enter");
+// const stealthHost = container.locator(".expander--stealth-only .expander__host").first();
+// const firstLink = stealthHost.locator(".expander__content a").first();
+// console.log(document.activeElement);
+// // Check if the first focusable element received focus
+// await expect(firstLink).toBeFocused();
+// });
+// });
diff --git a/packages/ui/makeup-listbox-button/dist/cjs/index.js b/packages/ui/makeup-listbox-button/dist/cjs/index.js
index cbafbb64..100b5211 100644
--- a/packages/ui/makeup-listbox-button/dist/cjs/index.js
+++ b/packages/ui/makeup-listbox-button/dist/cjs/index.js
@@ -52,7 +52,7 @@ class _default {
this._expander = new _makeupExpander.default(this.el, {
alwaysDoFocusManagement: true,
autoCollapse: true,
- collapseOnHostFocus: true,
+ collapseOnHostReFocus: true,
contentSelector: this._options.listboxSelector,
expandedClass: "listbox-button--expanded",
expandOnClick: true,
diff --git a/packages/ui/makeup-listbox-button/dist/mjs/index.js b/packages/ui/makeup-listbox-button/dist/mjs/index.js
index 391eb302..213bab35 100644
--- a/packages/ui/makeup-listbox-button/dist/mjs/index.js
+++ b/packages/ui/makeup-listbox-button/dist/mjs/index.js
@@ -44,7 +44,7 @@ class index_default {
this._expander = new Expander(this.el, {
alwaysDoFocusManagement: true,
autoCollapse: true,
- collapseOnHostFocus: true,
+ collapseOnHostReFocus: true,
contentSelector: this._options.listboxSelector,
expandedClass: "listbox-button--expanded",
expandOnClick: true,
diff --git a/packages/ui/makeup-listbox-button/src/index.js b/packages/ui/makeup-listbox-button/src/index.js
index a70d2977..0c6688fc 100644
--- a/packages/ui/makeup-listbox-button/src/index.js
+++ b/packages/ui/makeup-listbox-button/src/index.js
@@ -49,7 +49,7 @@ export default class {
this._expander = new Expander(this.el, {
alwaysDoFocusManagement: true,
autoCollapse: true,
- collapseOnHostFocus: true,
+ collapseOnHostReFocus: true,
contentSelector: this._options.listboxSelector,
expandedClass: "listbox-button--expanded",
expandOnClick: true,
diff --git a/packages/ui/makeup-listbox-button/test/index.spec.js b/packages/ui/makeup-listbox-button/test/index.spec.js
index 71ad414c..3d97f661 100644
--- a/packages/ui/makeup-listbox-button/test/index.spec.js
+++ b/packages/ui/makeup-listbox-button/test/index.spec.js
@@ -35,14 +35,14 @@ test.describe("given a listbox-button for manual selection", function () {
await expect(contentEl).toBeVisible();
});
- // test("should close on host clicking twice", async function () {
- // await hostBtn.click();
- // await expect(hostBtn).toHaveAttribute("aria-expanded", "true");
- // await expect(contentEl).toBeVisible();
- // await hostBtn.click();
- // await expect(hostBtn).toHaveAttribute("aria-expanded", "false");
- // await expect(contentEl).not.toBeVisible();
- // });
+ test("should close on host clicking twice", async function () {
+ await hostBtn.click();
+ await expect(hostBtn).toHaveAttribute("aria-expanded", "true");
+ await expect(contentEl).toBeVisible();
+ await hostBtn.click();
+ await expect(hostBtn).toHaveAttribute("aria-expanded", "false");
+ await expect(contentEl).not.toBeVisible();
+ });
test("should use valid aria on selection", async function () {
await hostBtn.click();
@@ -134,14 +134,14 @@ test.describe("given a listbox-button for automatic selection", function () {
await expect(contentEl).toBeVisible();
});
- // test("should close on host clicking twice", async function () {
- // await hostBtn.click();
- // await expect(hostBtn).toHaveAttribute("aria-expanded", "true");
- // await expect(contentEl).toBeVisible();
- // await hostBtn.click();
- // await expect(hostBtn).toHaveAttribute("aria-expanded", "false");
- // await expect(contentEl).not.toBeVisible();
- // });
+ test("should close on host clicking twice", async function () {
+ await hostBtn.click();
+ await expect(hostBtn).toHaveAttribute("aria-expanded", "true");
+ await expect(contentEl).toBeVisible();
+ await hostBtn.click();
+ await expect(hostBtn).toHaveAttribute("aria-expanded", "false");
+ await expect(contentEl).not.toBeVisible();
+ });
// TODO: shouldn't first item be selected by default in automatic?
test("should use valid aria on selection", async function () {
diff --git a/packages/ui/makeup-menu-button/dist/cjs/index.js b/packages/ui/makeup-menu-button/dist/cjs/index.js
index 81ee0c30..bd002805 100644
--- a/packages/ui/makeup-menu-button/dist/cjs/index.js
+++ b/packages/ui/makeup-menu-button/dist/cjs/index.js
@@ -32,7 +32,7 @@ class _default {
this._expander = new _makeupExpander.default(widgetEl, {
alwaysDoFocusManagement: true,
autoCollapse: true,
- collapseOnHostFocus: true,
+ collapseOnHostReFocus: true,
contentSelector: this._options.menuSelector,
expandedClass: this._options.expandedClass,
expandOnClick: true,
diff --git a/packages/ui/makeup-menu-button/dist/mjs/index.js b/packages/ui/makeup-menu-button/dist/mjs/index.js
index 09360a1e..f63c9ae5 100644
--- a/packages/ui/makeup-menu-button/dist/mjs/index.js
+++ b/packages/ui/makeup-menu-button/dist/mjs/index.js
@@ -24,7 +24,7 @@ class index_default {
this._expander = new Expander(widgetEl, {
alwaysDoFocusManagement: true,
autoCollapse: true,
- collapseOnHostFocus: true,
+ collapseOnHostReFocus: true,
contentSelector: this._options.menuSelector,
expandedClass: this._options.expandedClass,
expandOnClick: true,
diff --git a/packages/ui/makeup-menu-button/src/index.js b/packages/ui/makeup-menu-button/src/index.js
index 1e760145..844a438a 100644
--- a/packages/ui/makeup-menu-button/src/index.js
+++ b/packages/ui/makeup-menu-button/src/index.js
@@ -26,7 +26,7 @@ export default class {
this._expander = new Expander(widgetEl, {
alwaysDoFocusManagement: true,
autoCollapse: true,
- collapseOnHostFocus: true,
+ collapseOnHostReFocus: true,
contentSelector: this._options.menuSelector,
expandedClass: this._options.expandedClass,
expandOnClick: true,
diff --git a/playwright.config.js b/playwright.config.js
index 168cbdce..dd1d06c8 100644
--- a/playwright.config.js
+++ b/playwright.config.js
@@ -13,7 +13,7 @@ import { defineConfig, devices } from "@playwright/test";
* @see https://playwright.dev/docs/test-configuration
*/
export default defineConfig({
- testDir: "packages/ui/",
+ testDir: "packages/",
reporter: "html",
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {