@graupl/core 1.0.0-beta.21 → 1.0.0-beta.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/component/card.css +1 -1
- package/dist/css/component/card.css.map +1 -1
- package/dist/css/component/input-group.css +1 -1
- package/dist/css/component/input-group.css.map +1 -1
- package/dist/css/component/navigation.css +1 -1
- package/dist/css/component/navigation.css.map +1 -1
- package/dist/css/component.css +1 -1
- package/dist/css/component.css.map +1 -1
- package/dist/css/graupl.css +2 -2
- package/dist/css/graupl.css.map +1 -1
- package/dist/css/layout/columns.css +1 -1
- package/dist/css/layout/columns.css.map +1 -1
- package/dist/css/layout/container.css +1 -1
- package/dist/css/layout/container.css.map +1 -1
- package/dist/css/layout/flex-columns.css +1 -1
- package/dist/css/layout/flex-columns.css.map +1 -1
- package/dist/css/layout.css +2 -2
- package/dist/css/layout.css.map +1 -1
- package/dist/css/utilities/display.css +1 -1
- package/dist/css/utilities/display.css.map +1 -1
- package/dist/css/utilities/inset.css +1 -1
- package/dist/css/utilities/inset.css.map +1 -1
- package/dist/css/utilities/order.css +1 -1
- package/dist/css/utilities/order.css.map +1 -1
- package/dist/css/utilities/position.css +1 -1
- package/dist/css/utilities/position.css.map +1 -1
- package/dist/css/utilities/ratio.css +1 -1
- package/dist/css/utilities/ratio.css.map +1 -1
- package/dist/css/utilities/spacing.css +1 -1
- package/dist/css/utilities/spacing.css.map +1 -1
- package/dist/css/utilities/visibility.css +1 -1
- package/dist/css/utilities/visibility.css.map +1 -1
- package/dist/css/utilities.css +1 -1
- package/dist/css/utilities.css.map +1 -1
- package/dist/js/component/disclosure.cjs.js +2 -2
- package/dist/js/component/disclosure.cjs.js.map +1 -1
- package/dist/js/component/disclosure.es.js +2 -2
- package/dist/js/component/disclosure.es.js.map +1 -1
- package/dist/js/component/disclosure.iife.js +2 -2
- package/dist/js/component/disclosure.iife.js.map +1 -1
- package/dist/js/disclosure.js +5 -0
- package/dist/js/disclosure.js.map +1 -0
- package/dist/js/generator/disclosure.cjs.js +2 -2
- package/dist/js/generator/disclosure.cjs.js.map +1 -1
- package/dist/js/generator/disclosure.es.js +2 -2
- package/dist/js/generator/disclosure.es.js.map +1 -1
- package/dist/js/generator/disclosure.iife.js +2 -2
- package/dist/js/generator/disclosure.iife.js.map +1 -1
- package/dist/js/graupl.js +5 -5
- package/dist/js/graupl.js.map +1 -1
- package/package.json +1 -1
- package/src/js/disclosure/Disclosure.js +45 -41
- package/src/scss/_defaults.scss +7 -4
package/dist/js/graupl.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graupl.js","names":["isValidInstance","constructor","elements","elementsType","TypeError","key","elementType","name","status","error","isValidType","type","values","valuesType","valueType","isQuerySelector","Error","document","querySelector","isValidClassList","Array","isArray","forEach","value","obj","isValidHoverType","validTypes","includes","join","isTag","tagName","HTMLElement","tag","toLowerCase","check","isValidState","validStates","isValidEvent","validEvents","addClass","className","element","length","classList","add","removeClass","remove","selectAllFocusableElements","context","document","querySelector","elements","Array","from","querySelectorAll","tabbableElements","filter","check","getAttribute","selectFirstFocusableElement","selectLastFocusableElement","selectNextFocusableElement","index","indexOf","selectPreviousFocusableElement","isTag","isValidType","addClass","removeClass","AccordionItem","_dom","item","toggle","header","content","_elements","parentAccordion","_open","_locked","_expandEvent","CustomEvent","bubbles","detail","_collapseEvent","constructor","accordionItemElement","accordionItemToggleElement","accordionItemHeaderElement","accordionItemContentElement","initialize","_setIds","_setAriaAttributes","dom","getAttribute","show","hide","elements","isOpen","isLocked","value","key","index","accordionItems","indexOf","id","setAttribute","emit","transition","closeClass","openClass","transitionClass","openDuration","requestAnimationFrame","style","height","getBoundingClientRect","setTimeout","allowMultipleExpand","unlockSiblings","closeSiblings","allowNoExpand","openAccordionItems","length","lock","dispatchEvent","closeDuration","focus","blur","unlock","removeAttribute","forEach","keyPress","event","key","keyCode","keys","Enter","Space","Escape","ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End","Tab","Object","find","preventEvent","preventDefault","stopPropagation","isValidType","initializeStorage","type","window","Graupl","getStorage","setStorage","data","clearStorage","pushToStorage","key","value","getFromStorage","removeFromStorage","AccordionItem","keyPress","preventEvent","isValidInstance","isValidType","isValidClassList","isQuerySelector","storage","Accordion","_dom","accordion","accordionItems","accordionItemToggles","accordionItemHeaders","accordionItemContents","_domLock","_selectors","_elements","_openClass","_closeClass","_transitionClass","_transitionDuration","_openDuration","_closeDuration","_optionalKeySupport","_allowMultipleExpand","_allowNoExpand","_currentChild","_prefix","_key","_errors","constructor","accordionElement","accordionItemSelector","accordionItemToggleSelector","accordionItemHeaderSelector","accordionItemContentSelector","openClass","closeClass","transitionClass","transitionDuration","openDuration","closeDuration","optionalKeySupport","allowMultipleExpand","allowNoExpand","prefix","key","initialize","_validate","Error","errors","join","_generateKey","_setDOMElements","_setIds","_createChildElements","_handleFocus","_handleClick","_handleKeydown","_handleKeyup","_setTransitionDurations","initializeStorage","pushToStorage","dom","id","error","console","currentChild","elements","selectors","currentAccordionItem","openAccordionItems","filter","item","isOpen","value","length","isArray","every","_accordionItems","_setDOMElementType","elementType","base","overwrite","strict","includes","name","HTMLElement","domElements","Array","from","querySelectorAll","filteredElements","parentElement","_resetDOMElementType","forEach","accordionItem","regenerate","Math","random","toString","replace","substring","index","accordionItemElement","accordionItemToggleElement","accordionItemHeaderElement","accordionItemContentElement","parentAccordion","push","check","htmlElementChecks","message","querySelectorChecks","openClassCheck","status","closeClassCheck","transitionClassCheck","transitionDurationCheck","openDurationCheck","closeDurationCheck","booleanCheck","keyCheck","prefixCheck","toggle","addEventListener","accordionToggle","event","ToggleKeys","optionalKeys","focusFirstChild","focusLastChild","focusNextChild","focusPreviousChild","style","setProperty","focusCurrentChild","focus","focusChild","blurCurrentChild","blur","openChildren","show","closeChildren","hide","wsRE","attrName","doc","document","attr","element","op","value","attrSelector","id","TypeError","test","RangeError","checkElement","itemToCheck","Element","getElements","selector","context","elements","Document","DocumentFragment","querySelectorAll","Array","prototype","slice","call","filterAndModify","apply","filter","selected","matches","updateAttribute","add","remove","result","trim","split","forEach","item","indexOf","push","attribute","join","once","find","Accordion","once","generate","options","context","document","accordionSelector","forEach","accordionElement","accordionOptions","dataset","grauplAccordionOptions","JSON","parse","replace","initialize","isValidClassList","isValidInstance","isValidType","addClass","removeClass","keyPress","preventEvent","storage","Alert","_dom","alert","controller","_hidden","_showClass","_hideClass","_transitionClass","_transitionTimer","_key","_errors","_showEvent","CustomEvent","bubbles","detail","_hideEvent","constructor","alertElement","controllerElement","showClass","hideClass","transitionClass","transitionTimer","isHidden","key","initialize","_validate","Error","errors","join","_generateKey","_setIds","_handleClick","_handleKeydown","_handleKeyup","initializeStorage","pushToStorage","dom","id","error","console","value","check","htmlElementChecks","HTMLElement","status","push","message","showClassCheck","hideClassCheck","transitionClassCheck","transitionTimerCheck","hiddenCheck","regenerate","Math","random","toString","replace","substring","show","emit","requestAnimationFrame","dispatchEvent","hide","setTimeout","addEventListener","event","Alert","once","generate","options","context","document","alertSelector","forEach","alertElement","alertOptions","dataset","grauplAlertOptions","JSON","parse","replace","controllerElement","querySelector","initialize","addClass","removeClass","preventEvent","keyPress","storage","isQuerySelector","isTag","isValidClassList","isValidInstance","isValidType","Carousel","_dom","carousel","carouselItems","carouselItemContainer","carouselControls","carouselControlContainer","carouselTabs","carouselTabContainer","autoplay","next","previous","_selectors","_activeClass","_previousClass","_nextClass","_playClass","_pauseClass","_currentItem","_autoplay","_transitionDelay","_transitionDuration","_playText","_pauseText","_currentAction","_autoplayInterval","_prefix","_key","_errors","constructor","carouselElement","carouselItemSelector","carouselItemContainerSelector","carouselControlSelector","carouselControlContainerSelector","carouselTabSelector","carouselTabContainerSelector","autoplaySelector","nextSelector","previousSelector","activeClass","previousClass","nextClass","playClass","pauseClass","transitionDelay","transitionDuration","playText","pauseText","prefix","key","initialize","_validate","Error","errors","join","_generateKey","_setDOMElements","_setIds","_setAriaAttributes","activateFirstItem","_handleAutoplay","_handleFocus","_handleClick","_handleHover","_handleKeydown","_handleKeyup","_setTransitionDuration","initializeStorage","pushToStorage","dom","id","error","console","selectors","currentItem","currentCarouselItem","currentCarouselTab","currentAction","value","length","tabs","querySelectorAll","carouselTab","forEach","item","index","setAttribute","check","htmlElementChecks","HTMLElement","push","message","querySelectorChecks","carouselItemsSelector","carouselControlsSelector","carouselTabsSelector","autoplayChecks","delayCheck","durationCheck","activeClassChecks","previousClassChecks","nextClassChecks","playClassChecks","pauseClassChecks","playTextChecks","pauseTextChecks","prefixChecks","_setDOMElementType","elementType","base","overwrite","Array","isArray","domElements","from","filteredElements","filter","parentElement","domElement","querySelector","_resetDOMElementType","regenerate","Math","random","toString","replace","substring","tab","getAttribute","_setInterval","_clearInterval","setInterval","activateNextItem","clearInterval","addEventListener","activatePreviousItem","toggleAutoplay","activateItem","control","event","style","setProperty","activateCurrentItem","deactivateCurrentItem","currentIndex","dataset","grauplAction","requestAnimationFrame","setTimeout","activateLastItem","Carousel","once","generate","options","context","document","carouselSelector","forEach","carouselElement","carouselOptions","dataset","grauplCarouselOptions","JSON","parse","replace","initialize","storage","once","generate","options","context","document","navigationSelector","forEach","navigationElement","MenuConstructor","dataset","grauplMenuType","DisclosureMenu","window","undefined","console","warn","menuOptions","grauplMenuOptions","JSON","parse","replace","menuElement","querySelector","controllerElement","containerElement","menu","menuItemSelector","menuLinkSelector","submenuItemSelector","submenuToggleSelector","initializeStorage","pushToStorage","dom","id","TransactionalValue","constructor","initialValue","options","_equals","equals","Object","is","_current","_committed","value","val","committed","isDirty","commit","reset","update","fn","isValidInstance","isValidClassList","isValidType","isValidState","isValidEvent","isTag","isQuerySelector","addClass","removeClass","keyPress","preventEvent","storage","TransactionalValue","Disclosure","_dom","controller","disclosure","content","_domLock","_selectors","_classes","open","close","transition","initialize","_durations","_focusState","_currentEvent","_open","_shouldOpen","_closeOnBlur","_breakpointWidth","_observer","_expandEvent","CustomEvent","bubbles","detail","_collapseEvent","_prefix","_errors","constructor","disclosureElement","controllerElement","disclosureContentSelector","openClass","closeClass","transitionClass","transitionDuration","openDuration","closeDuration","closeOnBlur","minWidth","autoOpen","prefix","initializeClass","_validate","Error","errors","join","dom","_generateKey","_setDOMElements","_setIds","_setAriaAttributes","_handleFocus","_handleClick","_handleKeydown","_handleKeyup","_handleResize","_setTransitionDurations","initializeStorage","pushToStorage","id","getAttribute","shouldOpen","window","matchMedia","openQuery","matches","_expand","_collapse","requestAnimationFrame","error","console","selectors","value","focusState","currentEvent","isOpen","hasOpened","committed","closeQuery","shouldFocus","check","htmlElementChecks","HTMLElement","status","push","message","querySelectorChecks","classes","className","Object","keys","classListChecks","durations","durationName","durationChecks","prefixCheck","regenerate","key","Math","random","toString","replace","substring","setAttribute","style","setProperty","_setDOMElementType","elementType","base","overwrite","strict","includes","name","domElements","Array","from","querySelectorAll","filteredElements","filter","item","parentElement","isArray","_resetDOMElementType","emit","transitionlass","setTimeout","removeAttribute","dispatchEvent","innert","width","ResizeObserver","entries","entry","boxSize","contentBoxSize","inlineSize","contentRect","belowBreakpoint","aboveBreakpoint","preserveState","observe","document","body","addEventListener","event","relatedTarget","contains","button","toggle","target","force","commit","preview","Disclosure","once","generate","options","context","document","disclosureSelector","controllerSelector","forEach","disclosureElement","disclosureOptions","dataset","grauplDisclosureOptions","JSON","parse","replace","targettedControllerSelector","id","controllerElement","console","warn","remove","initialize","accordionGenerator","alertGenerator","carouselGenerator","navigationGenerator","disclosureGenerator","document","addEventListener"],"sources":["../../src/js/validate.js","../../src/js/domHelpers.js","../../src/js/accordion/AccordionItem.js","../../src/js/eventHandlers.js","../../src/js/storage.js","../../src/js/accordion/Accordion.js","../../../../node_modules/@drupal/once/src/once.js","../../src/js/accordion/generator.js","../../src/js/alert/Alert.js","../../src/js/alert/generator.js","../../src/js/carousel/Carousel.js","../../src/js/carousel/generator.js","../../src/js/navigation/generator.js","../../src/js/TransactionalValue.js","../../src/js/disclosure/Disclosure.js","../../src/js/disclosure/generator.js","../../src/js/main.js"],"sourcesContent":["/**\n * Check to see if the provided elements have a specific constructor.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * This is essentially just a wrapper function around checking instanceof with\n * more descriptive error message to help debugging.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {object} constructor - The constructor to check for.\n * @param {object} elements - The element(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidInstance(constructor, elements) {\n try {\n if (typeof elements !== \"object\") {\n const elementsType = typeof elements;\n\n throw new TypeError(\n `Elements given to isValidInstance() must be inside of an object. \"${elementsType}\" given.`\n );\n }\n\n for (const key in elements) {\n if (!(elements[key] instanceof constructor)) {\n const elementType = typeof elements[key];\n throw new TypeError(\n `${key} must be an instance of ${constructor.name}. \"${elementType}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Check to see if the provided values are of a specific type.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * This is essentially just a wrapper function around checking typeof with\n * more descriptive error message to help debugging.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {string} type - The type to check for.\n * @param {object} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidType(type, values) {\n try {\n if (typeof values !== \"object\") {\n const valuesType = typeof values;\n\n throw new TypeError(\n `Values given to isValidType() must be inside of an object. \"${valuesType}\" given.`\n );\n }\n\n for (const key in values) {\n const valueType = typeof values[key];\n\n if (valueType !== type) {\n throw new TypeError(`${key} must be a ${type}. \"${valueType}\" given.`);\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Checks to see if the provided values are valid query selectors.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isQuerySelector(values) {\n try {\n if (typeof values !== \"object\") {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isQuerySelector() must be inside of an object. \"${type}\" given.`\n );\n }\n\n for (const key in values) {\n try {\n if (values[key] === null) {\n throw new Error();\n }\n\n document.querySelector(values[key]);\n } catch {\n throw new TypeError(\n `${key} must be a valid query selector. \"${values[key]}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Checks to see if the provided value is either a string or an array of strings.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string, string[]>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidClassList(values) {\n try {\n if (typeof values !== \"object\" || Array.isArray(values)) {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isValidClassList() must be inside of an object. \"${type}\" given.`\n );\n }\n\n for (const key in values) {\n const type = typeof values[key];\n\n if (type !== \"string\") {\n if (Array.isArray(values[key])) {\n values[key].forEach((value) => {\n if (typeof value !== \"string\") {\n throw new TypeError(\n `${key} must be a string or an array of strings. An array containing non-strings given.`\n );\n }\n });\n } else {\n throw new TypeError(\n `${key} must be a string or an array of strings. \"${type}\" given.`\n );\n }\n } else {\n const obj = {};\n obj[key] = values[key];\n\n isQuerySelector(obj);\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Check to see if the provided values are valid hover types.\n *\n * Available types are: `\"off\"`, `\"on\"`, and `\"dynamic\"`.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidHoverType(values) {\n try {\n if (typeof values !== \"object\") {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isValidHoverType() must be inside of an object. \"${type}\" given.`\n );\n }\n\n const validTypes = [\"off\", \"on\", \"dynamic\"];\n\n for (const key in values) {\n if (!validTypes.includes(values[key])) {\n throw new TypeError(\n `${key} must be one of the following values: ${validTypes.join(\n \", \"\n )}. \"${values[key]}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Checks to see if the provided elements are using a specific tag.\n *\n * The elements must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `true` if the check is successful.\n *\n * @param {string} tagName - The name of the tag.\n * @param {Object<HTMLElement>} elements - The element(s) to check.\n * @return {boolean} - The result of the check.\n */\nexport function isTag(tagName, elements) {\n if (\n isValidType(\"string\", { tagName }).status &&\n isValidInstance(HTMLElement, elements).status\n ) {\n const tag = tagName.toLowerCase();\n let check = true;\n\n for (const key in elements) {\n if (elements[key].tagName.toLowerCase() !== tag) check = false;\n }\n\n return check;\n } else {\n return false;\n }\n}\n\n/**\n * Check to see if the provided values are valid focus states for a menu.\n *\n * Available states are: `\"none\"`, `\"self\"`, and `\"child\"`.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidState(values) {\n try {\n if (typeof values !== \"object\") {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isValidState() must be inside of an object. \"${type}\" given.`\n );\n }\n\n const validStates = [\"none\", \"self\", \"child\"];\n\n for (const key in values) {\n if (!validStates.includes(values[key])) {\n throw new TypeError(\n `${key} must be one of the following values: ${validStates.join(\n \", \"\n )}. \"${values[key]}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Check to see if the provided values are valid event types for a menu.\n *\n * Available events are: `\"none\"`, `\"mouse\"`, `\"keyboard\"`, and `\"character\"`.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidEvent(values) {\n try {\n if (typeof values !== \"object\") {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isValidEvent() must be inside of an object. \"${type}\" given.`\n );\n }\n\n const validEvents = [\"none\", \"mouse\", \"keyboard\", \"character\"];\n\n for (const key in values) {\n if (!validEvents.includes(values[key])) {\n throw new TypeError(\n `${key} must be one of the following values: ${validEvents.join(\n \", \"\n )}. \"${values[key]}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n","/**\n * Add a class or array of classes to an element.\n *\n * @param {string|string[]} className - The class or classes to add.\n * @param {HTMLElement} element - The element to add the class to.\n */\nexport function addClass(className, element) {\n // Gracefully handle empty strings or arrays.\n if (className === \"\" || className.length === 0) {\n return;\n }\n\n if (typeof className === \"string\") {\n element.classList.add(className);\n } else {\n element.classList.add(...className);\n }\n}\n\n/**\n * Remove a class or array of classes from an element.\n *\n * @param {string|string[]} className - The class or classes to remove.\n * @param {HTMLElement} element - The element to remove the class from.\n */\nexport function removeClass(className, element) {\n // Gracefully handle empty strings or arrays.\n if (className === \"\" || className.length === 0) {\n return;\n }\n\n if (typeof className === \"string\") {\n element.classList.remove(className);\n } else {\n element.classList.remove(...className);\n }\n}\n\n/**\n * Select all focusable elements within a given context.\n *\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @return {HTMLElement[]} - An array of focusable elements.\n */\nexport function selectAllFocusableElements(context = document) {\n const querySelector =\n \"a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),[tabindex]\";\n const elements = Array.from(context.querySelectorAll(querySelector));\n\n const tabbableElements = elements.filter((element) => {\n let check = true;\n\n if (element.getAttribute(\"tabindex\") === \"-1\") check = false;\n\n return check;\n });\n\n return tabbableElements;\n}\n\n/**\n * Select the first focusable element within a given context.\n *\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @return {HTMLElement|boolean} - The first focusable element or false if none found.\n */\nexport function selectFirstFocusableElement(context = document) {\n const tabbableElements = selectAllFocusableElements(context);\n\n return tabbableElements[0] || false;\n}\n\n/**\n * Select the last focusable element within a given context.\n *\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @return {HTMLElement|boolean} - The last focusable element or false if none found.\n */\nexport function selectLastFocusableElement(context = document) {\n const tabbableElements = selectAllFocusableElements(context);\n\n return tabbableElements[tabbableElements.length - 1] || false;\n}\n\n/**\n * Select the next focusable element relative to the given element within a context.\n *\n * @param {HTMLElement} element - The reference element.\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @return {HTMLElement|boolean} - The next focusable element or false if none found.\n */\nexport function selectNextFocusableElement(element, context = document) {\n const tabbableElements = selectAllFocusableElements(context);\n const index = tabbableElements.indexOf(element);\n\n return index === tabbableElements.length - 1\n ? false\n : tabbableElements[index + 1];\n}\n\n/**\n * Select the previous focusable element relative to the given element within a context.\n *\n * @param {HTMLElement} element - The reference element.\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @return {HTMLElement|boolean} - The previous focusable element or false if none found.\n */\nexport function selectPreviousFocusableElement(element, context = document) {\n const tabbableElements = selectAllFocusableElements(context);\n const index = tabbableElements.indexOf(element);\n\n return index === 0 ? false : tabbableElements[index - 1];\n}\n","/**\n * @file\n * The Accordion Item class.\n */\n\n/* global Accordion */\n\nimport { isTag, isValidType } from \"../validate.js\";\nimport { addClass, removeClass } from \"../domHelpers.js\";\n\n/**\n * Creates a new accordion item.\n *\n * @class\n */\nclass AccordionItem {\n /**\n * The HTML elements for the accordion item in the DOM.\n *\n * @protected\n *\n * @type {Object<HTMLElement>}\n *\n * @property {HTMLElement} item - The accordion item element.\n * @property {HTMLElement} toggle - The controller element.\n * @property {HTMLElement} header - The header element.\n * @property {HTMLElement} content - The content element.\n */\n _dom = {\n item: null,\n toggle: null,\n header: null,\n content: null,\n };\n\n /**\n * The declared graupl accordion elements within the accordion item.\n *\n * @protected\n *\n * @type {Object<Accordion>}\n *\n * @property {Accordion} parentAccordion - The parent accordion containing this item.\n */\n _elements = {\n parentAccordion: null,\n };\n\n /**\n * The open state of the accordion.\n *\n * @protected\n *\n * @type {boolean}\n */\n _open = false;\n\n /**\n * The locked state of the accordions item.\n *\n * If locked, the accordion item cannot be closed.\n *\n * @protected\n *\n * @type {boolean}\n */\n _locked = false;\n\n /**\n * The event that is triggered when the accordion item is shown.\n *\n * @protected\n *\n * @event grauplAccordionItemExpand\n *\n * @type {CustomEvent}\n *\n * @property {boolean} bubbles - A flag to bubble the event.\n * @property {Object<AccordionItem>} detail - The details object containing the Accordion item itself.\n */\n _expandEvent = new CustomEvent(\"grauplAccordionItemExpand\", {\n bubbles: true,\n detail: { item: this },\n });\n\n /**\n * The event that is triggered when the accordion item is hidden.\n *\n * @protected\n *\n * @event grauplAccordionItemCollapse\n *\n * @type {CustomEvent}\n *\n * @property {boolean} bubbles - A flag to bubble the event.\n * @property {Object<AccordionItem>} detail - The details object containing the Accordion item itself.\n */\n _collapseEvent = new CustomEvent(\"grauplAccordionItemCollapse\", {\n bubbles: true,\n detail: { item: this },\n });\n\n /**\n * Constructs a new Accordion item object.\n *\n * @class\n *\n * @param {object} options - The options object.\n * @param {HTMLElement} options.accordionItemElement - The accordion item element.\n * @param {HTMLElement} options.accordionItemToggleElement - The toggle element.\n * @param {HTMLElement} options.accordionItemHeaderElement - The header element.\n * @param {HTMLElement} options.accordionItemContentElement - The content element.\n * @param {Accordion} [options.parentAccordion = null] - The accordion containing this item.\n */\n constructor({\n accordionItemElement,\n accordionItemToggleElement,\n accordionItemHeaderElement,\n accordionItemContentElement,\n parentAccordion = null,\n }) {\n // Set DOM elements.\n this._dom.item = accordionItemElement;\n this._dom.toggle = accordionItemToggleElement;\n this._dom.header = accordionItemHeaderElement;\n this._dom.content = accordionItemContentElement;\n\n // Set the accordion elements.\n this._elements.parentAccordion = parentAccordion;\n }\n\n /**\n * Initializes the accordion item.\n */\n initialize() {\n // Set the IDs for the accordion item and it's elements if they don't exist.\n this._setIds();\n\n // Set the ARIA attributes for the accordion item and it's elements.\n this._setAriaAttributes();\n\n // Set the initial state of the accordion item.\n if (this.dom.toggle.getAttribute(\"aria-expanded\") === \"true\") {\n this.show(false, false);\n } else {\n this.hide(false, false);\n }\n }\n\n /**\n * The HTML elements for the accordion item in the DOM.\n *\n * @readonly\n *\n * @type {object}\n *\n * @see _dom\n */\n get dom() {\n return this._dom;\n }\n\n /**\n * The declared graupl accordion elements within the accordion item.\n *\n * @readonly\n *\n * @type {Object<Accordion>}\n *\n * @see _elements\n */\n get elements() {\n return this._elements;\n }\n\n /**\n * The open state of the accordion.\n *\n * @readonly\n *\n * @type {object}\n *\n * @see _open\n */\n get isOpen() {\n return this._open;\n }\n\n /**\n * The locked state of the accordions item.\n *\n * If locked, the accordion item cannot be closed.\n *\n * @readonly\n *\n * @type {boolean}\n *\n * @see _locked\n */\n get isLocked() {\n return this._locked;\n }\n\n set isOpen(value) {\n isValidType(\"boolean\", { value });\n\n if (this._open !== value) {\n this._open = value;\n }\n }\n\n /**\n * Sets the IDs for the accordion item and it's elements if they don't exist.\n *\n * The generated IDs use the parent accordion's key and follows the pattern:\n * - Accordion item: `accordion-item-{key}-{index}`\n * - Accordion item toggle: `accordion-item-toggle-{key}-{index}`\n * - Accordion item content: `accordion-item-content-{key}-{index}`\n */\n _setIds() {\n // Get the required information for IDs.\n const { key } = this.elements.parentAccordion;\n const index = this.elements.parentAccordion.dom.accordionItems.indexOf(\n this.dom.item\n );\n\n this.dom.item.id = this.dom.item.id || `accordion-item-${key}-${index}`;\n this.dom.toggle.id =\n this.dom.toggle.id || `accordion-item-toggle-${key}-${index}`;\n this.dom.header.id =\n this.dom.header.id || `accordion-item-header-${key}-${index}`;\n this.dom.content.id =\n this.dom.content.id || `accordion-item-content-${key}-${index}`;\n }\n\n /**\n * Sets the ARIA attributes for the accordion item and it's elements.\n */\n _setAriaAttributes() {\n // Set the ARIA attributes for the accordion item toggle.\n // If the toggle is not a button, then set the role to \"button\".\n if (!isTag(\"button\", { toggle: this.dom.toggle })) {\n this.dom.toggle.setAttribute(\"role\", \"button\");\n }\n\n // If aria-expanded is not explicitly set to \"true\", then set it to \"false\".\n if (this.dom.toggle.getAttribute(\"aria-expanded\") !== \"true\") {\n this.dom.toggle.setAttribute(\"aria-expanded\", \"false\");\n }\n\n // Set the aria-controls attribute for the toggle.\n this.dom.toggle.setAttribute(\"aria-controls\", this.dom.content.id);\n\n // Set the ARIA attributes for the accordion item content.\n // If the content is not a section, then set the role to \"region\".\n if (!isTag(\"section\", { content: this.dom.content })) {\n this.dom.content.setAttribute(\"role\", \"region\");\n }\n\n // Set the aria-labelledby attribute for the content.\n this.dom.content.setAttribute(\"aria-labelledby\", this.dom.toggle.id);\n }\n\n /**\n * Shows the accordion item.\n *\n * @public\n *\n * @fires grauplAccordionItemExpand\n *\n * @param {boolean} [emit = true] - Emit the show event once shown.\n * @param {boolean} [transition = true] - Respect the transition class.\n */\n show(emit = true, transition = true) {\n if (this._open) {\n return;\n }\n\n const { closeClass, openClass, transitionClass, openDuration } =\n this.elements.parentAccordion;\n\n // Set aria-expanded to true when hiding accordion item.\n this.dom.toggle.setAttribute(\"aria-expanded\", \"true\");\n\n // If we're dealing with transition classes, then we need to utilize\n // requestAnimationFrame to add the transition class, remove the hide class,\n // add the show class, and finally remove the transition class.\n //\n // If `transition` is false, then it doesn't matter if the transition class\n // is set. Do not use the transition.\n if (transition && transitionClass !== \"\") {\n addClass(transitionClass, this.dom.item);\n\n requestAnimationFrame(() => {\n removeClass(closeClass, this.dom.item);\n\n this.dom.item.style.height = `${this.dom.header.getBoundingClientRect().height}px`;\n\n requestAnimationFrame(() => {\n addClass(openClass, this.dom.item);\n\n this.dom.item.style.height = `${this.dom.header.getBoundingClientRect().height + this.dom.content.getBoundingClientRect().height}px`;\n\n requestAnimationFrame(() => {\n setTimeout(() => {\n removeClass(transitionClass, this.dom.item);\n\n this.dom.item.style.height = \"\";\n }, openDuration);\n });\n });\n });\n } else {\n // Add the show class\n addClass(openClass, this.dom.item);\n\n // Remove the hide class.\n removeClass(closeClass, this.dom.item);\n }\n\n this._open = true;\n\n // If the parent accordion only allows a single item to be open at a time,\n // then close all other items.\n if (!this.elements.parentAccordion.allowMultipleExpand) {\n this.unlockSiblings();\n this.closeSiblings();\n }\n\n // If the parent accordion requires at least one item to be open, and this\n // is the only open item, then lock it. Otherwise, unlock all siblings.\n if (!this.elements.parentAccordion.allowNoExpand) {\n if (this.elements.parentAccordion.openAccordionItems.length <= 1) {\n this.lock();\n } else {\n this.unlockSiblings();\n }\n }\n\n if (emit) {\n this.dom.item.dispatchEvent(this._expandEvent);\n }\n }\n\n /**\n * Hides the accordion item.\n *\n * @public\n *\n * @fires grauplAccordionItemCollapse\n *\n * @param {boolean} [emit = true] - Emit the show event once shown.\n * @param {boolean} [transition = true] - Respect the transition class.\n */\n hide(emit = true, transition = true) {\n if (!this._open) {\n return;\n }\n\n if (\n !this.elements.parentAccordion.allowNoExpand &&\n this.elements.parentAccordion.openAccordionItems.length <= 1\n ) {\n return;\n }\n\n const { closeClass, openClass, transitionClass, closeDuration } =\n this.elements.parentAccordion;\n\n // Set aria-expanded to false when hiding accordion item.\n this.dom.toggle.setAttribute(\"aria-expanded\", \"false\");\n\n // If we're dealing with transition classes, then we need to utilize\n // requestAnimationFrame to add the transition class, remove the show class,\n // add the hide class, and finally remove the transition class.\n //\n // If `transition` is false, then it doesn't matter if the transition class\n // is set. Do not use the transition.\n if (transition && transitionClass !== \"\") {\n addClass(transitionClass, this.dom.item);\n this.dom.item.style.height = `${this.dom.item.getBoundingClientRect().height}px`;\n\n requestAnimationFrame(() => {\n removeClass(openClass, this.dom.item);\n this.dom.item.style.height = `${this.dom.header.getBoundingClientRect().height}px`;\n\n requestAnimationFrame(() => {\n addClass(closeClass, this.dom.item);\n\n requestAnimationFrame(() => {\n setTimeout(() => {\n removeClass(transitionClass, this.dom.item);\n\n this.dom.item.style.height = \"\";\n }, closeDuration);\n });\n });\n });\n } else {\n // Add the hide class\n addClass(closeClass, this.dom.item);\n\n // Remove the show class.\n removeClass(openClass, this.dom.item);\n }\n\n this._open = false;\n\n // If the parent accordion requires at least one item to be open, and this was\n // the second to last open item, then lock to last open item.\n if (\n !this.elements.parentAccordion.allowNoExpand &&\n this.elements.parentAccordion.openAccordionItems.length === 1\n ) {\n this.elements.parentAccordion.openAccordionItems[0].lock();\n }\n\n if (emit) {\n this.dom.item.dispatchEvent(this._collapseEvent);\n }\n }\n\n /**\n * Toggle the accordion item.\n *\n * @public\n */\n toggle() {\n this.isOpen ? this.hide() : this.show();\n }\n\n /**\n * Focuses the accordion item.\n *\n * @public\n */\n focus() {\n this.dom.toggle.focus();\n }\n\n /**\n * Blurs the accordion item.\n *\n * @public\n */\n blur() {\n this.dom.toggle.blur();\n }\n\n /**\n * Locks the accordion item.\n *\n * @public\n */\n lock() {\n this._locked = true;\n this.dom.toggle.setAttribute(\"disabled\", \"true\");\n }\n\n /**\n * Unlocks the accordion item.\n *\n * @public\n */\n unlock() {\n this._locked = false;\n this.dom.toggle.removeAttribute(\"disabled\");\n }\n\n closeSiblings() {\n if (this.elements.parentAccordion) {\n this.elements.parentAccordion.elements.accordionItems.forEach((item) => {\n if (item !== this) {\n item.hide();\n }\n });\n }\n }\n\n /**\n * Unlocks the siblings of the accordion item.\n *\n * @public\n */\n unlockSiblings() {\n if (this.elements.parentAccordion) {\n this.elements.parentAccordion.elements.accordionItems.forEach((item) => {\n if (item !== this) {\n item.unlock();\n }\n });\n }\n }\n}\n\nexport default AccordionItem;\n","/**\n * Retrieves the pressed key from an event.\n *\n * @param {KeyboardEvent} event - The keyboard event.\n * @return {string} - The name of the key or an empty string.\n */\nexport function keyPress(event) {\n try {\n // Use event.key or event.keyCode to support older browsers.\n const key = event.key || event.keyCode;\n const keys = {\n Enter: key === \"Enter\" || key === 13,\n Space: key === \" \" || key === \"Spacebar\" || key === 32,\n Escape: key === \"Escape\" || key === \"Esc\" || key === 27,\n ArrowUp: key === \"ArrowUp\" || key === \"Up\" || key === 38,\n ArrowRight: key === \"ArrowRight\" || key === \"Right\" || key === 39,\n ArrowDown: key === \"ArrowDown\" || key === \"Down\" || key === 40,\n ArrowLeft: key === \"ArrowLeft\" || key === \"Left\" || key === 37,\n Home: key === \"Home\" || key === 36,\n End: key === \"End\" || key === 35,\n Tab: key === \"Tab\" || key === 9,\n };\n\n return Object.keys(keys).find((key) => keys[key] === true) || \"\";\n } catch {\n // Return an empty string if something goes wrong.\n return \"\";\n }\n}\n\n/**\n * Stops an event from taking action.\n *\n * @param {Event} event - The event.\n */\nexport function preventEvent(event) {\n event.preventDefault();\n event.stopPropagation();\n}\n","/**\n * @file\n * Provides a system to get and store Graupl data in the browser.\n */\n\nimport { isValidType } from \"./validate.js\";\n\n/**\n * Initializes the storage system.\n *\n * @param {?string} [type = null] - The type of storage to initialize.\n */\nexport function initializeStorage(type = null) {\n window.Graupl = window.Graupl || {};\n\n if (isValidType(\"string\", { type })) {\n window.Graupl[type] = window.Graupl[type] || {};\n }\n}\n\n/**\n * Get the storage object.\n *\n * @param {?string} type - The type of storage to get.\n * @return {object} - The storage object.\n */\nexport function getStorage(type = null) {\n if (isValidType(\"string\", { type })) {\n return window.Graupl[type];\n }\n\n return window.Graupl;\n}\n\n/**\n * Set the storage object of a given type.\n *\n * @param {string} type - The type of storage to set.\n * @param {object} data - The data to set.\n */\nexport function setStorage(type, data = {}) {\n if (isValidType(\"string\", { type }) && isValidType(\"object\", { data })) {\n window.Graupl[type] = data;\n }\n}\n\n/**\n * Clear the storage object of a given type.\n *\n * @param {string} type - The type of storage to clear.\n */\nexport function clearStorage(type) {\n if (isValidType(\"string\", { type })) {\n window.Graupl[type] = {};\n }\n}\n\n/**\n * Push a value to the storage object.\n *\n * @param {string} type - The type of storage to push to.\n * @param {string} key - The key to use for the value.\n * @param {*} value - The value to store.\n */\nexport function pushToStorage(type, key, value) {\n if (isValidType(\"string\", { type, key })) {\n window.Graupl[type][key] = value;\n }\n}\n\n/**\n * Get a value from the storage object.\n *\n * @param {string }type - The type of storage to get from.\n * @param {string }key - The key to get the value from.\n * @return {*} - The value from the storage object.\n */\nexport function getFromStorage(type, key) {\n if (isValidType(\"string\", { type, key })) {\n return window.Graupl[type][key];\n }\n\n return null;\n}\n\n/**\n * Remove a value from the storage object.\n *\n * @param {string} type - The type of storage to remove from.\n * @param {string} key - The key to remove the value from.\n */\nexport function removeFromStorage(type, key) {\n if (isValidType(\"string\", { type, key })) {\n delete window.Graupl[type][key];\n }\n}\n\nexport default {\n initializeStorage,\n getStorage,\n setStorage,\n clearStorage,\n pushToStorage,\n getFromStorage,\n removeFromStorage,\n};\n","/**\n * @file\n * The Accordion class.\n */\n\nimport AccordionItem from \"./AccordionItem.js\";\nimport { keyPress, preventEvent } from \"../eventHandlers.js\";\nimport {\n isValidInstance,\n isValidType,\n isValidClassList,\n isQuerySelector,\n} from \"../validate.js\";\nimport storage from \"../storage.js\";\n\nclass Accordion {\n /**\n * The DOM elements within the accordion.\n *\n * @protected\n *\n * @type {Object<HTMLElement, HTMLElement[]>}\n *\n * @property {HTMLElement} accordion - The accordion element.\n * @property {HTMLElement[]} accordionItems - An array of accordion items.\n * @property {HTMLElement[]} accordionItemToggles - An array of accordion item toggles.\n * @property {HTMLElement[]} accordionItemHeaders - An array of accordion headers.\n * @property {HTMLElement[]} accordionItemContents - An array of accordion item contents.\n */\n _dom = {\n accordion: null,\n accordionItems: [],\n accordionItemToggles: [],\n accordionItemHeaders: [],\n accordionItemContents: [],\n };\n\n /**\n * The DOM elements within the accordion that cannot be reset or generated by the accordion.\n *\n * @protected\n *\n * @type {string[]}\n */\n _domLock = [\"accordion\"];\n\n /**\n * The query selectors used by the accordion.\n *\n * @protected\n *\n * @type {Object<string>}\n *\n * @property {string} accordionItems - The query selector for accordion items.\n * @property {string} accordionItemToggles - The query selector for accordion toggles.\n * @property {string} accordionItemHeaders - The query selector for accordion headers.\n * @property {string} accordionItemContents - The query selector for accordion contents.\n */\n _selectors = {\n accordionItems: \"\",\n accordionItemToggles: \"\",\n accordionItemHeaders: \"\",\n accordionItemContents: \"\",\n };\n\n /**\n * The list of accordion items.\n *\n * @protected\n *\n * @type {Object<AccordionItem[]>}\n *\n * @property {AccordionItem[]} accordionItems - The list of accordion items.\n */\n _elements = {\n accordionItems: [],\n };\n\n /**\n * The class(es) to apply when the accordion is open.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _openClass = \"show\";\n\n /**\n * The class(es) to apply when the accordion is closed.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _closeClass = \"hide\";\n\n /**\n * The class(es) to apply when the accordion is transitioning between states.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _transitionClass = \"transitioning\";\n\n /**\n * The duration time (in milliseconds) for the transition between open and closed states.\n *\n * @protected\n *\n * @type {number}\n */\n _transitionDuration = 300;\n\n /**\n * The duration time (in milliseconds) for the transition from closed to open states.\n *\n * @protected\n *\n * @type {number}\n */\n _openDuration = -1;\n\n /**\n * The duration time (in milliseconds) for the transition from open to closed states.\n *\n * @protected\n *\n * @type {number}\n */\n _closeDuration = -1;\n\n /**\n * A flag to decide if the accordion items can be navigated by arrows.\n *\n * @protected\n *\n * @type {boolean}\n */\n _optionalKeySupport = true;\n\n /**\n * A flag to decide if multiple accordions can be open at the same time.\n *\n * If set to false, only one accordion can be open at a time.\n *\n * @protected\n *\n * @type {boolean}\n */\n _allowMultipleExpand = true;\n\n /**\n * A flag to decide if no accordions can be opened at the same time.\n *\n * If set to false, at least one accordion must be open at all times.\n *\n * @protected\n *\n * @type {boolean}\n */\n _allowNoExpand = true;\n\n /**\n * The index of the current child node.\n *\n * @protected\n *\n * @type {number}\n */\n _currentChild = 0;\n\n /**\n * The prefix to use for CSS custom properties.\n *\n * @protected\n *\n * @type {string}\n */\n _prefix = \"graupl-\";\n\n /**\n * The key used to generate IDs throughout the accordion.\n *\n * @protected\n *\n * @type {string}\n */\n _key = \"\";\n\n /**\n * errors - The list of errors found during validation.\n *\n * @protected\n *\n * @type {string[]}\n */\n _errors = [];\n\n /**\n * Constructs a new `Accordion`.\n *\n * @param {object} options - The options for generating the accordion.\n * @param {HTMLElement} [options.accordionElement] - The accordion element in the DOM.\n * @param {string} [options.accordionItemSelector = .accordion-item] - The query selector string for accordion items.\n * @param {string} [options.accordionItemToggleSelector = .accordion-item-toggle] - The query selector string for accordion toggle.\n * @param {string} [options.accordionItemHeaderSelector = .accordion-item-header] - The query selector string for accordion header.\n * @param {string} [options.accordionItemContentSelector = .accordion-item-content] - The query selector string for accordion content.\n * @param {?(string|string[])} [options.openClass = show] - The class to apply when a accordion is \"open\".\n * @param {?(string|string[])} [options.closeClass = hide] - The class to apply when a accordion is \"closed\".\n * @param {?(string|string[])} [options.transitionClass = transitioning] - The class to apply when a accordion is transitioning between \"open\" and \"closed\" states.\n * @param {number} [options.transitionDuration = 300] - The duration of the transition between \"open\" and \"closed\" states (in milliseconds).\n * @param {number} [options.openDuration = -1] - The duration of the transition from \"closed\" to \"open\" states (in milliseconds).\n * @param {number} [options.closeDuration = -1] - The duration of the transition from \"open\" to \"closed\" states (in milliseconds).\n * @param {boolean} [options.optionalKeySupport = false] - A flag to determine if accordions can be navigated with arrows.\n * @param {boolean} [options.allowMultipleExpand = true] - A flag to determine if multiple accordions can be open at the same time.\n * @param {boolean} [options.allowNoExpand = true] - A flag to determine if no accordions can be open at the same time.\n * @param {?string} [options.prefix = graupl-] - The prefix to use for CSS custom properties.\n * @param {?string} [options.key = null] - The key used to generate IDs throughout the accordion.\n * @param {boolean} [options.initialize = false] - A flag to initialize the accordion immediately upon creation.\n */\n constructor({\n accordionElement,\n accordionItemSelector = \".accordion-item\",\n accordionItemToggleSelector = \".accordion-item-toggle\",\n accordionItemHeaderSelector = \".accordion-item-header\",\n accordionItemContentSelector = \".accordion-item-content\",\n openClass = \"show\",\n closeClass = \"hide\",\n transitionClass = \"transitioning\",\n transitionDuration = 300,\n openDuration = -1,\n closeDuration = -1,\n optionalKeySupport = false,\n allowMultipleExpand = true,\n allowNoExpand = true,\n prefix = \"graupl-\",\n key = null,\n initialize = false,\n }) {\n // Set DOM elements.\n this._dom.accordion = accordionElement;\n\n // Set DOM selectors.\n this._selectors.accordionItems = accordionItemSelector;\n this._selectors.accordionItemToggles = accordionItemToggleSelector;\n this._selectors.accordionItemHeaders = accordionItemHeaderSelector;\n this._selectors.accordionItemContents = accordionItemContentSelector;\n\n // Set open/close classes.\n this._openClass = openClass || \"\";\n this._closeClass = closeClass || \"\";\n this._transitionClass = transitionClass || \"\";\n\n // Set transition duration.\n this._transitionDuration = transitionDuration;\n this._openDuration = openDuration;\n this._closeDuration = closeDuration;\n\n // Set optional key support.\n this._optionalKeySupport = optionalKeySupport;\n\n // Set expand rules.\n this._allowMultipleExpand = allowMultipleExpand;\n this._allowNoExpand = allowNoExpand;\n\n // Set prefix.\n this._prefix = prefix || \"\";\n\n // Set the key.\n this._key = key || \"\";\n\n if (initialize) {\n this.initialize();\n }\n }\n\n /**\n * Initializes the accordion.\n */\n initialize() {\n try {\n if (!this._validate()) {\n throw new Error(\n `Graupl Accordion: cannot initialize accordion. The following errors have been found:\\n - ${this.errors.join(\n \"\\n - \"\n )}`\n );\n }\n\n // Set up the DOM.\n this._generateKey();\n this._setDOMElements();\n this._setIds();\n\n // Create the child elements.\n this._createChildElements();\n\n // Handle events.\n this._handleFocus();\n this._handleClick();\n this._handleKeydown();\n this._handleKeyup();\n\n // Set the custom props.\n this._setTransitionDurations();\n\n // Set up the storage.\n storage.initializeStorage(\"accordions\");\n storage.pushToStorage(\"accordions\", this.dom.accordion.id, this);\n } catch (error) {\n console.error(error);\n }\n }\n\n /**\n * The class(es) to apply when the accordion is open.\n *\n * @type {string|string[]}\n *\n * @see _openClass\n */\n get openClass() {\n return this._openClass;\n }\n\n /**\n * The class(es) to apply when the accordion is closed.\n *\n * @type {string|string[]}\n *\n * @see _closeClass\n */\n get closeClass() {\n return this._closeClass;\n }\n\n /**\n * The class(es) to apply when the accordion is transitioning between open and closed.\n *\n * @type {string|string[]}\n *\n * @see _transitionClass\n */\n get transitionClass() {\n return this._transitionClass;\n }\n\n /**\n * The duration time (in milliseconds) for the transition between open and closed states.\n *\n * @type {number}\n *\n * @see _transitionDuration\n */\n get transitionDuration() {\n return this._transitionDuration;\n }\n\n /**\n * The duration time (in milliseconds) for the transition from closed to open states.\n *\n * If openDuration is set to -1, the transitionDuration will be used instead.\n *\n * @type {number}\n *\n * @see _openDuration\n */\n get openDuration() {\n return this._openDuration === -1\n ? this.transitionDuration\n : this._openDuration;\n }\n\n /**\n * The duration time (in milliseconds) for the transition from open to closed states.\n *\n * If closeDuration is set to -1, the transitionDuration will be used instead.\n *\n * @type {number}\n *\n * @see _closeDuration\n */\n get closeDuration() {\n return this._closeDuration === -1\n ? this.transitionDuration\n : this._closeDuration;\n }\n\n /**\n * The current index of the accordion item.\n *\n * @readonly\n *\n * @type {number}\n *\n * @see _currentChild\n */\n get currentChild() {\n return this._currentChild;\n }\n\n /**\n * The dom elements of the accordion.\n *\n * @readonly\n *\n * @type {object}\n *\n * @see _dom\n */\n get dom() {\n return this._dom;\n }\n\n /**\n * The elements of the accordion.\n *\n * @readonly\n *\n * @type {object}\n *\n * @see _elements\n */\n get elements() {\n return this._elements;\n }\n\n /**\n * The selectors used for the accordion and accordion items.\n *\n * @readonly\n *\n * @type {boolean}\n *\n * @see _selectors\n */\n get selectors() {\n return this._selectors;\n }\n\n /**\n * A flag to decide if the accordion items can be navigated by arrows.\n *\n * @readonly\n *\n * @type {boolean}\n *\n * @see _optionalKeySupport\n */\n get optionalKeySupport() {\n return this._optionalKeySupport;\n }\n\n /**\n * The currently selected accordion item.\n *\n * @readonly\n *\n * @type {AccordionItem}\n */\n get currentAccordionItem() {\n return this.elements.accordionItems[this.currentChild];\n }\n\n /**\n * The currently open accordion items.\n *\n * @readonly\n *\n * @type {AccordionItem[]}\n */\n get openAccordionItems() {\n return this.elements.accordionItems.filter((item) => item.isOpen);\n }\n\n /**\n * A flag to decide if multiple accordions can be open at the same time.\n *\n * @type {boolean}\n *\n * @see _allowMultipleExpand\n */\n get allowMultipleExpand() {\n return this._allowMultipleExpand;\n }\n\n /**\n * A flag to decide if no accordions can be opened at the same time.\n *\n * @type {boolean}\n *\n * @see _allowNoExpand\n */\n get allowNoExpand() {\n return this._allowNoExpand;\n }\n\n /**\n * The prefix to use for CSS custom properties.\n *\n * @type {string}\n *\n * @see _prefix\n */\n get prefix() {\n return this._prefix;\n }\n\n /**\n * The key used to generate IDs throughout the accordion.\n *\n * @type {string}\n *\n * @see _key\n */\n get key() {\n return this._key;\n }\n\n /**\n * An array to hold error messages.\n *\n * @readonly\n *\n * @type {string[]}\n *\n * @see _errors\n */\n get errors() {\n return this._errors;\n }\n\n set openClass(value) {\n isValidClassList({ openClass: value });\n\n if (this._openClass !== value) {\n this._openClass = value;\n }\n }\n\n set closeClass(value) {\n isValidClassList({ closeClass: value });\n\n if (this._closeClass !== value) {\n this._closeClass = value;\n }\n }\n\n set transitionClass(value) {\n isValidClassList({ transitionClass: value });\n\n if (this._transitionClass !== value) {\n this._transitionClass = value;\n }\n }\n\n set transitionDuration(value) {\n isValidType(\"number\", { value });\n\n if (this._transitionDuration !== value) {\n this._transitionDuration = value;\n this._setTransitionDurations();\n }\n }\n\n set openDuration(value) {\n isValidType(\"number\", { value });\n\n if (this._openDuration !== value) {\n this._openDuration = value;\n this._setTransitionDurations();\n }\n }\n\n set closeDuration(value) {\n isValidType(\"number\", { value });\n\n if (this._closeDuration !== value) {\n this._closeDuration = value;\n this._setTransitionDurations();\n }\n }\n\n set currentChild(value) {\n isValidType(\"number\", { value });\n\n if (\n this._currentChild !== value &&\n value >= 0 &&\n value < this.elements.accordionItems.length\n ) {\n this._currentChild = value;\n }\n }\n\n set accordionItems(value) {\n isValidType(\"object\", { value });\n\n if (\n value?.isArray() &&\n value.every((item) => item instanceof AccordionItem)\n ) {\n this._accordionItems = value;\n }\n }\n\n set allowMultipleExpand(value) {\n isValidType(\"boolean\", { value });\n\n if (this._allowMultipleExpand !== value) {\n this._allowMultipleExpand = value;\n }\n }\n\n set allowNoExpand(value) {\n isValidType(\"boolean\", { value });\n\n if (this._allowNoExpand !== value) {\n this._allowNoExpand = value;\n }\n }\n\n set prefix(value) {\n isValidType(\"string\", { value });\n\n if (this._prefix !== value) {\n this._prefix = value;\n }\n }\n\n set key(value) {\n isValidType(\"string\", { value });\n\n if (this._key !== value) {\n this._key = value;\n }\n }\n\n /**\n * Sets DOM elements.\n *\n * Elements listed in _domLock cannot be set using this method.\n *\n * @protected\n *\n * @param {string} elementType - The type of element to populate.\n * @param {HTMLElement} [base = this.dom.accordion] - The element used as the base for the querySelect.\n * @param {boolean} [overwrite = true] - A flag to set if the existing elements will be overwritten.\n * @param {boolean} [strict = false] - A flag to set if the elements must be direct children of the base.\n */\n _setDOMElementType(\n elementType,\n base = this.dom.accordion,\n overwrite = true,\n strict = false\n ) {\n if (typeof this.selectors[elementType] === \"string\") {\n if (this._domLock.includes(elementType)) {\n throw new Error(\n `Graupl ${this.constructor.name}: \"${elementType}\" element cannot be set through _setDOMElementType.`\n );\n }\n\n if (base !== this.dom.accordion) isValidInstance(HTMLElement, { base });\n\n // Get the all elements matching the selector in the base.\n const domElements = Array.from(\n base.querySelectorAll(this.selectors[elementType])\n );\n\n // Filter the elements so only direct children of the base are kept.\n const filteredElements = domElements.filter((item) =>\n strict ? item.parentElement === base : true\n );\n\n if (overwrite) {\n this._dom[elementType] = filteredElements;\n } else {\n this._dom[elementType] = [\n ...this._dom[elementType],\n ...filteredElements,\n ];\n }\n } else {\n throw new Error(\n `Graupl ${this.constructor.name}: \"${elementType}\" is not a valid element type.`\n );\n }\n }\n\n /**\n * Resets DOM elements.\n *\n * Elements listed in _domLock cannot be reset using this method.\n *\n * @protected\n *\n * @param {string} elementType - The type of element to clear.\n */\n _resetDOMElementType(elementType) {\n if (typeof this.selectors[elementType] === \"string\") {\n if (this._domLock.includes(elementType)) {\n throw new Error(\n `Graupl ${this.constructor.name}: \"${elementType}\" element cannot be reset through _resetDOMElementType.`\n );\n }\n\n if (Array.isArray(this._dom[elementType])) {\n this._dom[elementType] = [];\n } else {\n this._dom[elementType] = null;\n }\n } else {\n throw new Error(\n `Graupl ${this.constructor.name}: \"${elementType}\" is not a valid element type.`\n );\n }\n }\n\n /**\n * Sets all DOM elements within the accordion.\n *\n * Utilizes _setDOMElementType and\n * _resetDOMElementType.\n *\n * @protected\n */\n _setDOMElements() {\n this._setDOMElementType(\"accordionItems\");\n this._resetDOMElementType(\"accordionItemToggles\");\n\n this.dom.accordionItems.forEach((accordionItem) => {\n this._setDOMElementType(\"accordionItemToggles\", accordionItem, false);\n this._setDOMElementType(\"accordionItemHeaders\", accordionItem, false);\n this._setDOMElementType(\"accordionItemContents\", accordionItem, false);\n });\n }\n\n /**\n * Generates a key for the accordion.\n *\n * @param {boolean} [regenerate = false] - A flag to determine if the key should be regenerated.\n */\n _generateKey(regenerate = false) {\n if (this.key === \"\" || regenerate) {\n this.key = Math.random()\n .toString(36)\n .replace(/[^a-z]+/g, \"\")\n .substring(0, 10);\n }\n }\n\n /**\n * Sets the IDs of the accordion and it's children if they do not already exist.\n *\n * The generated IDs use the key and follow the format:\n * - accordion: `accordion-${key}`\n *\n * @protected\n */\n _setIds() {\n this.dom.accordion.id = this.dom.accordion.id || `accordion-${this.key}`;\n }\n\n /**\n * Creates and initializes all accordion items.\n *\n * @protected\n */\n _createChildElements() {\n this.dom.accordionItems.forEach((accordionItem, index) => {\n const item = new AccordionItem({\n accordionItemElement: accordionItem,\n accordionItemToggleElement: this.dom.accordionItemToggles[index],\n accordionItemHeaderElement: this.dom.accordionItemHeaders[index],\n accordionItemContentElement: this.dom.accordionItemContents[index],\n parentAccordion: this,\n });\n\n item.initialize();\n\n this.elements.accordionItems.push(item);\n });\n }\n\n /**\n * Validates all aspects of the accordion item to ensure proper functionality.\n *\n * @protected\n *\n * @return {boolean} - The result of the validation.\n */\n _validate() {\n let check = true;\n\n // HTML element checks.\n const htmlElementChecks = isValidInstance(HTMLElement, {\n accordionElement: this.dom.accordion,\n });\n\n if (!htmlElementChecks) {\n this._errors.push(htmlElementChecks.message);\n check = false;\n }\n\n // Query selector checks.\n const querySelectorChecks = isQuerySelector({\n accordionItemSelector: this._selectors.accordionItems,\n accordionItemToggleSelector: this._selectors.accordionItemToggles,\n accordionItemHeaderSelector: this._selectors.accordionItemHeaders,\n accordionItemContentSelector: this._selectors.accordionItemContents,\n });\n\n if (!querySelectorChecks) {\n this._errors.push(querySelectorChecks.message);\n check = false;\n }\n\n // Class list checks.\n if (this._openClass !== \"\") {\n const openClassCheck = isValidClassList({ openClass: this._openClass });\n\n if (!openClassCheck.status) {\n this._errors.push(openClassCheck.error.message);\n check = false;\n }\n }\n\n if (this._closeClass !== \"\") {\n const closeClassCheck = isValidClassList({\n closeClass: this._closeClass,\n });\n\n if (!closeClassCheck.status) {\n this._errors.push(closeClassCheck.error.message);\n check = false;\n }\n }\n\n if (this._transitionClass !== \"\") {\n const transitionClassCheck = isValidClassList({\n transitionClass: this._transitionClass,\n });\n\n if (!transitionClassCheck.status) {\n this._errors.push(transitionClassCheck.error.message);\n check = false;\n }\n }\n\n // Transition duration check.\n const transitionDurationCheck = isValidType(\"number\", {\n transitionDuration: this._transitionDuration,\n });\n\n if (!transitionDurationCheck.status) {\n this._errors.push(transitionDurationCheck.error.message);\n check = false;\n }\n\n // Open duration check.\n const openDurationCheck = isValidType(\"number\", {\n openDuration: this._openDuration,\n });\n\n if (!openDurationCheck.status) {\n this._errors.push(openDurationCheck.error.message);\n check = false;\n }\n\n // Close duration check.\n const closeDurationCheck = isValidType(\"number\", {\n closeDuration: this._closeDuration,\n });\n\n if (!closeDurationCheck.status) {\n this._errors.push(closeDurationCheck.error.message);\n check = false;\n }\n\n // Boolean checks.\n const booleanCheck = isValidType(\"boolean\", {\n optionalKeySupport: this._optionalKeySupport,\n allowMultipleExpand: this._allowMultipleExpand,\n allowNoExpand: this._allowNoExpand,\n });\n\n if (!booleanCheck.status) {\n this._errors.push(booleanCheck.error.message);\n check = false;\n }\n\n // Key check.\n if (this._key !== \"\") {\n const keyCheck = isValidType(\"string\", { key: this._key });\n\n if (!keyCheck.status) {\n this._errors.push(keyCheck.error.message);\n check = false;\n }\n }\n\n // Prefix check.\n const prefixCheck = isValidType(\"string\", { prefix: this._prefix });\n\n if (!prefixCheck.status) {\n this._errors.push(prefixCheck.error.message);\n check = false;\n }\n\n return check;\n }\n\n /**\n * Handles focus events throughout the accordion for proper use.\n *\n * - Adds a `focus` listener to every accordion item so when it gains focus,\n * it will set the accordion's current child to the index of the item.\n *\n * @protected\n */\n _handleFocus() {\n this.elements.accordionItems.forEach((accordionItem, index) => {\n accordionItem.dom.toggle.addEventListener(\"focus\", () => {\n this.currentChild = index;\n });\n });\n }\n\n /**\n * Handles click events throughout the accordion item for proper use.\n *\n * - Adds a `pointerup` listener to the accordion item toggles that will toggle each accordion item.\n *\n * @protected\n */\n _handleClick() {\n this.elements.accordionItems.forEach((accordionItem, index) => {\n accordionItem.dom.toggle.addEventListener(\"pointerup\", () => {\n this.currentChild = index;\n accordionItem.toggle();\n });\n });\n }\n\n /**\n * Handles keydown events throughout the accordion item for proper use.\n *\n * This method exists to assist the _handleKeyup method.\n *\n * - Adds a `keydown` listener to all accordion item toggles.\n * - Blocks propagation on \"Space\" and \"Enter\" keys.\n * - _If_ optionalKeySupport is enabled, blocks propagation on the following keys:\n * - \"ArrowDown\", \"ArrowUp\", \"Home\", and \"End\".\n */\n _handleKeydown() {\n this.dom.accordionItemToggles.forEach((accordionToggle) => {\n accordionToggle.addEventListener(\"keydown\", (event) => {\n const key = keyPress(event);\n const ToggleKeys = [\"Space\", \"Enter\"];\n\n // Prevent default behavior for space and enter keys.\n if (ToggleKeys.includes(key)) {\n preventEvent(event);\n } else if (this.optionalKeySupport) {\n const optionalKeys = [\"ArrowDown\", \"ArrowUp\", \"Home\", \"End\"];\n\n if (optionalKeys.includes(key)) {\n preventEvent(event);\n }\n }\n });\n });\n }\n\n /**\n * Handles keyup events throughout the accordion item for proper use.\n *\n * Adds the follow keybindings (explanations are taken from the WAI ARIA Practices Guide Accordion Pattern):\n *\n * - `Enter` or `Space`:\n * - When focus is on the accordion header for a collapsed panel, expands the associated panel. If the implementation allows only one panel to be expanded, and if another panel is expanded, collapses that panel.\n * - When focus is on the accordion header for an expanded panel, collapses the panel if the implementation supports collapsing. Some implementations require one panel to be expanded at all times and allow only one panel to be expanded; so, they do not support a collapse function.\n * - `Tab`: Moves focus to the next focusable element; all focusable elements in the accordion are included in the page `Tab` sequence.\n * - `Shift + Tab`: Moves focus to the previous focusable element; all focusable elements in the accordion are included in the page `Tab` sequence.\n * - `Down Arrow` (Optional): If focus is on an accordion header, moves focus to the next accordion header. If focus is on the last accordion header, either does nothing or moves focus to the first accordion header.\n * - `Up Arrow` (Optional): If focus is on an accordion header, moves focus to the previous accordion header. If focus is on the first accordion header, either does nothing or moves focus to the last accordion header.\n * - `Home` (Optional): When focus is on an accordion header, moves focus to the first accordion header.\n * - `End` (Optional): When focus is on an accordion header, moves focus to the last accordion header.\n *\n * Note: When the above explanations mention \"accordion header\", they are referring to the accordion item toggle.\n */\n _handleKeyup() {\n this.dom.accordionItemToggles.forEach((accordionToggle) => {\n accordionToggle.addEventListener(\"keyup\", (event) => {\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n preventEvent(event);\n this.currentAccordionItem.toggle();\n\n break;\n }\n\n if (this.optionalKeySupport) {\n switch (key) {\n case \"Home\":\n preventEvent(event);\n this.focusFirstChild();\n\n break;\n case \"End\":\n preventEvent(event);\n this.focusLastChild();\n\n break;\n case \"ArrowDown\":\n preventEvent(event);\n this.focusNextChild();\n\n break;\n case \"ArrowUp\":\n preventEvent(event);\n this.focusPreviousChild();\n\n break;\n }\n }\n });\n });\n }\n\n /**\n * Sets the transition durations of the accordion as a CSS custom properties.\n *\n * The custom properties are:\n * - `--graupl-accordion-transition-duration`,\n * - `--graupl-accordion-open-transition-duration`, and\n * - `--graupl-accordion-close-transition-duration`.\n *\n * The prefix of `graupl-` can be changed by setting the accordion's prefix value.\n *\n * @protected\n */\n _setTransitionDurations() {\n this.dom.accordion.style.setProperty(\n `--${this.prefix}accordion-transition-duration`,\n `${this.transitionDuration}ms`\n );\n\n this.dom.accordion.style.setProperty(\n `--${this.prefix}accordion-open-transition-duration`,\n `${this.openDuration}ms`\n );\n\n this.dom.accordion.style.setProperty(\n `--${this.prefix}accordion-close-transition-duration`,\n `${this.closeDuration}ms`\n );\n }\n\n /**\n * Focus the accordion's current child.\n *\n * @public\n */\n focusCurrentChild() {\n if (this.currentChild !== -1) {\n this.currentAccordionItem.focus();\n }\n }\n\n /**\n * Focuses the accordion's child at a given index.\n *\n * @public\n *\n * @param {number} index - The index of the child to focus.\n */\n focusChild(index) {\n this.blurCurrentChild();\n this.currentChild = index;\n this.focusCurrentChild();\n }\n\n /**\n * Focuses the accordion's first child.\n *\n * @public\n */\n focusFirstChild() {\n this.focusChild(0);\n }\n\n /**\n * Focus the accordion's last child.\n *\n * @public\n */\n focusLastChild() {\n this.focusChild(this.elements.accordionItems.length - 1);\n }\n\n /**\n * Focus the accordion's next child.\n *\n * @public\n */\n focusNextChild() {\n if (this.currentChild < this.elements.accordionItems.length - 1) {\n this.focusChild(this.currentChild + 1);\n } else {\n this.focusCurrentChild();\n }\n }\n\n /**\n * Focus the accordion's previous child.\n *\n * @public\n */\n focusPreviousChild() {\n if (this.currentChild > 0) {\n this.focusChild(this.currentChild - 1);\n } else {\n this.focusCurrentChild();\n }\n }\n\n /**\n * Blurs the accordion's current child.\n *\n * @public\n */\n blurCurrentChild() {\n if (this.currentChild !== -1) {\n this.currentAccordionItem.blur();\n }\n }\n\n /**\n * Open all accordion items.\n *\n * @public\n */\n openChildren() {\n this.elements.accordionItems.forEach((item) => item.show());\n }\n\n /**\n * Close all accordion items.\n *\n * @public\n */\n closeChildren() {\n this.elements.accordionItems.forEach((item) => item.hide());\n }\n}\n\nexport default Accordion;\n","/**\n * Mark DOM elements as processed to prevent multiple initializations.\n *\n * @module @drupal/once\n *\n * @example <!-- Use as a module -->\n * <script type=\"module\">\n * import once from 'https://unpkg.com/@drupal/once/src/once.js';\n * const elements = once('my-once-id', 'div');\n * // Initialize elements.\n * elements.forEach(el => el.innerHTML = 'processed');\n * </script>\n *\n * @example <!-- Use as a regular script -->\n * <script src=\"https://unpkg.com/@drupal/once\"></script>\n * <script>\n * const elements = once('my-once-id', 'div');\n * // Initialize elements.\n * elements.forEach(el => el.innerHTML = 'processed');\n * </script>\n * @example <!-- Using a single element as input-->\n * <script src=\"https://unpkg.com/@drupal/once\"></script>\n * <script>\n * // once methods always return an array, to simplify the use with a single\n * // element use destructuring or the shift method.\n * const [myElement] = once('my-once-id', document.body);\n * const myElement = once('my-once-id', document.body).shift();\n * </script>\n */\n\n/**\n * Illegal spaces in ids.\n *\n * @private\n *\n * @type {RegExp}\n */\nconst wsRE = /[\\11\\12\\14\\15\\40]+/;\n\n/**\n * Name of the HTML attribute containing an element's once ids.\n *\n * @private\n *\n * @type {string}\n */\nconst attrName = 'data-once';\n\n/**\n * Shortcut to access the html element.\n *\n * @private\n *\n * @type {HTMLElement}\n */\nconst doc = document;\n\n/**\n * Helper to access element attributes.\n *\n * @private\n *\n * @param {Element} element\n * The Element to access the data-once attribute from.\n * @param {string} op\n * The action to take on the element.\n * @param {string} [value]\n * Optional value for setAttribute.\n *\n * @return {string|undefined|null|boolean}\n * Result of the attribute method.\n */\nfunction attr(element, op, value) {\n return element[`${op}Attribute`](attrName, value);\n}\n\n/**\n * Return the attribute selector.\n *\n * @private\n *\n * @param {string} id\n * The id passed by a call to a once() function.\n *\n * @return {string}\n * The full CSS attribute selector.\n *\n * @throws {TypeError|RangeError}\n */\nfunction attrSelector(id) {\n // Verify the validity of the once id.\n if (typeof id !== 'string') {\n throw new TypeError('once ID must be a string');\n }\n if (id === '' || wsRE.test(id)) {\n throw new RangeError('once ID must not be empty or contain spaces');\n }\n // The id is valid, return the full CSS selector.\n return `[${attrName}~=\"${id}\"]`;\n}\n\n/**\n * Verifies that an item is an instance of Element.\n *\n * This function is used during filtering to ensure only DOM elements are\n * processed. once() makes use of get/setAttribute, which are methods\n * inherited from the Element object, so only of Element can be used.\n *\n * @private\n *\n * @param {*} itemToCheck\n * The item to check.\n *\n * @return {boolean}\n * True if the item is an instance of Element\n *\n * @throws {TypeError}\n */\nfunction checkElement(itemToCheck) {\n if (!(itemToCheck instanceof Element)) {\n throw new TypeError('The element must be an instance of Element');\n }\n return true;\n}\n\n/**\n * Process arguments, query the DOM if necessary.\n *\n * @private\n *\n * @param {NodeList|Array.<Element>|Element|string} selector\n * A NodeList or array of elements.\n * @param {Document|DocumentFragment|Element} [context=document]\n * An element or document object to use as context for querySelectorAll.\n *\n * @return {Array.<Element>}\n * An array with the processed Id and the list of elements to process.\n */\nfunction getElements(selector, context = doc) {\n // Assume selector is an array-like value.\n let elements = selector;\n\n // If selector is null it is most likely because of a call to querySelector\n // that didn't return a result.\n if (selector === null) {\n elements = [];\n }\n // The selector is undefined, error out.\n else if (!selector) {\n throw new TypeError('Selector must not be empty');\n }\n // Context doesn't implement querySelectorAll, error out.\n else if (\n !(\n context instanceof Document ||\n context instanceof DocumentFragment ||\n context instanceof Element\n )\n ) {\n throw new TypeError(\n 'Context must be an object of type \"Document\", \"DocumentFragment\", or \"Element\".',\n );\n }\n // This is a selector, query the elements.\n else if (typeof selector === 'string') {\n elements = context.querySelectorAll(selector);\n }\n // This is a single element.\n else if (selector instanceof Element) {\n elements = [selector];\n }\n\n // Make sure an array is returned and not a NodeList or an Array-like object.\n return Array.prototype.slice.call(elements);\n}\n\n/**\n * A helper for applying DOM changes to a filtered set of elements.\n *\n * This makes it possible to filter items that are not instances of Element,\n * then modify their DOM attributes in a single array traversal.\n *\n * @private\n *\n * @param {string} selector\n * A CSS selector to check against to each element in the array.\n * @param {Array.<Element>} elements\n * A NodeList or array of elements passed by a call to a once() function.\n * @param {function} [apply]\n * An optional function to apply on all matched elements.\n *\n * @return {Array.<Element>}\n * The array of elements that match the CSS selector.\n */\nfunction filterAndModify(selector, elements, apply) {\n return elements.filter((element) => {\n const selected = checkElement(element) && element.matches(selector);\n if (selected && apply) {\n apply(element);\n }\n return selected;\n });\n}\n\n/**\n * Add or remove an item from a list of once values.\n *\n * This function removes duplicates while adding or removing a once id in a\n * single array traversal.\n *\n * @private\n *\n * @param {Element} element\n * A space separated string of once ids from a data-drupal-once attribute.\n * @param {string} [add]\n * The once id to add to the list of values.\n * @param {string} [remove]\n * The once id to remove from the list of values.\n *\n * @return {undefined}\n * Nothing to return this is a callback in a foreach.\n */\nfunction updateAttribute(element, { add, remove }) {\n const result = [];\n if (attr(element, 'has')) {\n attr(element, 'get')\n .trim()\n .split(wsRE)\n .forEach((item) => {\n if (result.indexOf(item) < 0 && item !== remove) {\n result.push(item);\n }\n });\n }\n if (add) {\n result.push(add);\n }\n const attribute = result.join(' ');\n attr(element, attribute === '' ? 'remove' : 'set', attribute);\n}\n\n/**\n * Ensures a JavaScript callback is only executed once on a set of elements.\n *\n * Filters a NodeList or array of elements, removing those already processed\n * by a callback with a given id.\n * This method adds a `data-once` attribute on DOM elements. The value of\n * this attribute identifies if a given callback has been executed on that\n * element.\n *\n * @global\n *\n * @example <caption>Basic usage</caption>\n * const elements = once('my-once-id', '[data-myelement]');\n * @example <caption>Input parameters accepted</caption>\n * // NodeList.\n * once('my-once-id', document.querySelectorAll('[data-myelement]'));\n * // Array or Array-like of Element.\n * once('my-once-id', jQuery('[data-myelement]'));\n * // A CSS selector without a context.\n * once('my-once-id', '[data-myelement]');\n * // A CSS selector with a context.\n * once('my-once-id', '[data-myelement]', document.head);\n * // Single Element.\n * once('my-once-id', document.querySelector('#some-id'));\n * @example <caption>Using a single element</caption>\n * // Once always returns an array, even when passing a single element. Some\n * // forms that can be used to keep code readable.\n * // Destructuring:\n * const [myElement] = once('my-once-id', document.body);\n * // By changing the resulting array, es5 compatible.\n * const myElement = once('my-once-id', document.body).shift();\n *\n * @param {string} id\n * The id of the once call.\n * @param {NodeList|Array.<Element>|Element|string} selector\n * A NodeList or array of elements.\n * @param {Document|DocumentFragment|Element} [context=document]\n * An element or document object to use as context for querySelectorAll.\n *\n * @return {Array.<Element>}\n * An array of elements that have not yet been processed by a once call\n * with a given id.\n */\nfunction once(id, selector, context) {\n return filterAndModify(\n `:not(${attrSelector(id)})`,\n getElements(selector, context),\n (element) => updateAttribute(element, { add: id }),\n );\n}\n\n/**\n * Removes a once id from an element's data-drupal-once attribute value.\n *\n * If a once id is removed from an element's data-drupal-once attribute value,\n * the JavaScript callback associated with that id can be executed on that\n * element again.\n *\n * @method once.remove\n *\n * @example <caption>Basic usage</caption>\n * const elements = once.remove('my-once-id', '[data-myelement]');\n * @example <caption>Input parameters accepted</caption>\n * // NodeList.\n * once.remove('my-once-id', document.querySelectorAll('[data-myelement]'));\n * // Array or Array-like of Element.\n * once.remove('my-once-id', jQuery('[data-myelement]'));\n * // A CSS selector without a context.\n * once.remove('my-once-id', '[data-myelement]');\n * // A CSS selector with a context.\n * once.remove('my-once-id', '[data-myelement]', document.head);\n * // Single Element.\n * once.remove('my-once-id', document.querySelector('#some-id'));\n *\n * @param {string} id\n * The id of a once call.\n * @param {NodeList|Array.<Element>|Element|string} selector\n * A NodeList or array of elements to remove the once id from.\n * @param {Document|Element} [context=document]\n * An element to use as context for querySelectorAll.\n *\n * @return {Array.<Element>}\n * A filtered array of elements that had been processed by the provided id,\n * and are now able to be processed again.\n */\nonce.remove = (id, selector, context) => {\n return filterAndModify(\n attrSelector(id),\n getElements(selector, context),\n (element) => updateAttribute(element, { remove: id }),\n );\n};\n\n/**\n * Finds elements that have been processed by a given once id.\n *\n * Behaves like {@link once} and {@link once.remove} without changing the DOM.\n * To select all DOM nodes processed by a given id, use {@link once.find}.\n *\n * @method once.filter\n *\n * @example <caption>Basic usage</caption>\n * const filteredElements = once.filter('my-once-id', '[data-myelement]');\n * @example <caption>Input parameters accepted</caption>\n * // NodeList.\n * once.filter('my-once-id', document.querySelectorAll('[data-myelement]'));\n * // Array or Array-like of Element.\n * once.filter('my-once-id', jQuery('[data-myelement]'));\n * // A CSS selector without a context.\n * once.filter('my-once-id', '[data-myelement]');\n * // A CSS selector with a context.\n * once.filter('my-once-id', '[data-myelement]', document.head);\n * // Single Element.\n * once.filter('my-once-id', document.querySelector('#some-id'));\n *\n * @param {string} id\n * The id of the once call.\n * @param {NodeList|Array.<Element>|Element|string} selector\n * A NodeList or array of elements to remove the once id from.\n * @param {Document|Element} [context=document]\n * An element to use as context for querySelectorAll.\n *\n * @return {Array.<Element>}\n * A filtered array of elements that have already been processed by the\n * provided once id.\n */\nonce.filter = (id, selector, context) =>\n filterAndModify(attrSelector(id), getElements(selector, context));\n\n/**\n * Finds elements that have been processed by a given once id.\n *\n * Query the 'context' element for elements that already have the\n * corresponding once id value.\n *\n * @method once.find\n *\n * @example <caption>Basic usage</caption>\n * const oncedElements = once.find('my-once-id');\n * @example <caption>Input parameters accepted</caption>\n * // Call without parameters, return all elements with a `data-once` attribute.\n * once.find();\n * // Call without a context.\n * once.find('my-once-id');\n * // Call with a context.\n * once.find('my-once-id', document.head);\n *\n * @param {string} [id]\n * The id of the once call.\n * @param {Document|DocumentFragment|Element} [context=document]\n * Scope of the search for matching elements.\n *\n * @return {Array.<Element>}\n * A filtered array of elements that have already been processed by the\n * provided once id.\n */\nonce.find = (id, context) =>\n getElements(!id ? `[${attrName}]` : attrSelector(id), context);\n\nexport default once;\n","import Accordion from \"./Accordion.js\";\nimport once from \"@drupal/once\";\n\nconst generate = (\n options = {},\n context = document,\n accordionSelector = \".accordion\"\n) => {\n once(\"graupl-accordion-generator\", accordionSelector, context).forEach(\n (accordionElement) => {\n const accordionOptions = accordionElement.dataset.grauplAccordionOptions\n ? JSON.parse(\n accordionElement.dataset.grauplAccordionOptions.replace(/'/g, '\"')\n ) || {}\n : {};\n\n new Accordion({\n accordionElement,\n initialize: true,\n ...options,\n ...accordionOptions,\n });\n }\n );\n};\n\nexport default generate;\n","/**\n * @file\n * The alert class.\n */\n\nimport { isValidClassList, isValidInstance, isValidType } from \"../validate.js\";\nimport { addClass, removeClass } from \"../domHelpers.js\";\nimport { keyPress, preventEvent } from \"../eventHandlers.js\";\nimport storage from \"../storage.js\";\n\nclass Alert {\n /**\n * The HTML elements for the alert in the DOM.\n *\n * @protected\n *\n * @type {Object<HTMLElement>}\n */\n _dom = {\n alert: null,\n controller: null,\n };\n\n /**\n * A flag to determine if the alert is hidden.\n *\n * @protected\n *\n * @type {boolean}\n */\n _hidden = false;\n\n /**\n * The class to use to show the alert.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _showClass = \"\";\n\n /**\n * The class to use to hide the alert.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _hideClass = \"\";\n\n /**\n * The class to use when transitioning the alert.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _transitionClass = \"\";\n\n /**\n * The time in milliseconds the transition will take.\n *\n * @protected\n *\n * @type {number}\n */\n _transitionTimer = 150;\n\n /**\n * The key used to generate IDs throughout the carousel.\n *\n * @protected\n *\n * @type {string}\n */\n _key = \"\";\n\n /**\n * An array of error messages generated by the alert.\n *\n * @protected\n *\n * @type {string[]}\n */\n _errors = [];\n\n /**\n * The event that is triggered when the alert is shown.\n *\n * @protected\n *\n * @event grauplAlertShow\n *\n * @type {CustomEvent}\n *\n * @property {boolean} bubbles - A flag to bubble the event.\n * @property {Object<Alert>} detail - The details object container the Alert itself.\n */\n _showEvent = new CustomEvent(\"grauplAlertShow\", {\n bubbles: true,\n detail: { alert: this },\n });\n\n /**\n * The event that is triggered when the alert is hidden.\n *\n * @protected\n *\n * @event grauplAlertHide\n *\n * @type {CustomEvent}\n *\n * @property {boolean} bubbles - A flag to bubble the event.\n * @property {Object<Alert>} detail - The details object containing the Alert itself.\n */\n _hideEvent = new CustomEvent(\"grauplAlertHide\", {\n bubbles: true,\n detail: { alert: this },\n });\n\n /**\n * Constructs a new `Alert`.\n *\n * @param {object} options - The options object.\n * @param {HTMLElement} options.alertElement - The alert element.\n * @param {?HTMLElement} [options.controllerElement = null] - The controller element.\n * @param {string|string[]|null} [options.showClass = show] - The class to add when the alert is shown.\n * @param {string|string[]|null} [options.hideClass = hide] - The class to add when\n * @param {string|string[]|null} [options.transitionClass = transitioning] - The class to add when the alert is transitioning between shown and hidden.\n * @param {number} [options.transitionTimer = 150] - The time in milliseconds the transition will take.\n * @param {boolean} [options.isHidden = false] - A flag to determine the initial state of the alert.\n * @param {?string} [options.key = null] - The key used to generate IDs throughout the alert.\n * @param {boolean} [options.initialize = false] - AA flag to initialize the alert immediately upon creation.\n */\n constructor({\n alertElement,\n controllerElement = null,\n showClass = \"show\",\n hideClass = \"hide\",\n transitionClass = \"transitioning\",\n transitionTimer = 150,\n isHidden = false,\n key = null,\n initialize = false,\n }) {\n this._dom.alert = alertElement;\n this._dom.controller = controllerElement;\n this._showClass = showClass || \"\";\n this._hideClass = hideClass || \"\";\n this._transitionClass = transitionClass || \"\";\n this._transitionTimer = transitionTimer;\n this._hidden = isHidden;\n\n // Set the key.\n this._key = key || \"\";\n\n if (initialize) {\n this.initialize();\n }\n }\n\n /**\n * Initializes the alert.\n */\n initialize() {\n try {\n if (!this._validate()) {\n throw new Error(\n `Graupl Alert: cannot initialize alert. The following errors have been found:\\n - ${this.errors.join(\n \"\\n - \"\n )}`\n );\n }\n\n // Set up the DOM.\n this._generateKey();\n this._setIds();\n\n // Handle events.\n this._handleClick();\n this._handleKeydown();\n this._handleKeyup();\n\n // Set up the storage.\n storage.initializeStorage(\"alerts\");\n storage.pushToStorage(\"alerts\", this.dom.alert.id, this);\n } catch (error) {\n console.error(error);\n }\n }\n\n /**\n * The HTML elements for the alert in the DOM.\n *\n * @readonly\n *\n * @see _dom\n *\n * @type {object}\n */\n get dom() {\n return this._dom;\n }\n\n /**\n * The class to use the show the alert.\n *\n * @type {string|string[]}\n *\n * @see _showClass\n */\n get showClass() {\n return this._showClass;\n }\n\n /**\n * The class to use to hide the alert.\n *\n * @type {string|string[]}\n *\n * @see _hideClass\n */\n get hideClass() {\n return this._hideClass;\n }\n\n /**\n * The class to use when transitioning the alert.\n *\n * @type {string|string[]}\n *\n * @see _transitionClass\n */\n get transitionClass() {\n return this._transitionClass;\n }\n\n /**\n * The time in milliseconds the transition will take.\n *\n * @type {number}\n *\n * @see _transitionTimer\n */\n get transitionTimer() {\n return this._transitionTimer;\n }\n\n /**\n * The key used to generate IDs throughout the accordion.\n *\n * @type {string}\n *\n * @see _key\n */\n get key() {\n return this._key;\n }\n\n set showClass(value) {\n isValidClassList({ showClass: value });\n\n if (this._showClass !== value) {\n this._showClass = value;\n }\n }\n\n set hideClass(value) {\n isValidClassList({ hideClass: value });\n\n if (this._hideClass !== value) {\n this._hideClass = value;\n }\n }\n\n set transitionClass(value) {\n isValidClassList({ transitionClass: value });\n\n if (this._transitionClass !== value) {\n this._transitionClass = value;\n }\n }\n\n set transitionTimer(value) {\n isValidType(\"number\", { transitionTimer: value });\n\n if (this._transitionTimer !== value) {\n this._transitionTimer = value;\n }\n }\n\n set key(value) {\n isValidType(\"string\", { value });\n\n if (this._key !== value) {\n this._key = value;\n }\n }\n\n /**\n * Validates all aspects of the alert to ensure proper functionality.\n *\n * @protected\n *\n * @return {boolean} - The result of the validation.\n */\n _validate() {\n let check = true;\n\n // HTML element checks.\n let htmlElementChecks;\n\n if (this._dom.controller !== null) {\n htmlElementChecks = isValidInstance(HTMLElement, {\n alertElement: this._dom.alert,\n controllerElement: this._dom.controller,\n });\n } else {\n htmlElementChecks = isValidInstance(HTMLElement, {\n alertElement: this._dom.alert,\n });\n }\n\n if (!htmlElementChecks.status) {\n this._errors.push(htmlElementChecks.message);\n check = false;\n }\n\n // Class list checks.\n if (this._showClass !== \"\") {\n const showClassCheck = isValidClassList({ showClass: this._showClass });\n\n if (!showClassCheck.status) {\n this._errors.push(showClassCheck.message);\n check = false;\n }\n }\n\n if (this._hideClass !== \"\") {\n const hideClassCheck = isValidClassList({ hideClass: this._hideClass });\n\n if (!hideClassCheck.status) {\n this._errors.push(hideClassCheck.message);\n check = false;\n }\n }\n\n if (this._transitionClass !== \"\") {\n const transitionClassCheck = isValidClassList({\n transitionClass: this._transitionClass,\n });\n\n if (!transitionClassCheck.status) {\n this._errors.push(transitionClassCheck.message);\n check = false;\n }\n }\n\n // Transition timer check.\n const transitionTimerCheck = isValidType(\"number\", {\n transitionTimer: this._transitionTimer,\n });\n\n if (!transitionTimerCheck.status) {\n this._errors.push(transitionTimerCheck.message);\n check = false;\n }\n\n // Hidden check.\n const hiddenCheck = isValidType(\"boolean\", { isHidden: this._hidden });\n\n if (!hiddenCheck.status) {\n this._errors.push(hiddenCheck.message);\n check = false;\n }\n\n return check;\n }\n\n /**\n * Generates a key for the alert.\n *\n * @param {boolean} [regenerate = false] - A flag to determine if the key should be regenerated.\n */\n _generateKey(regenerate = false) {\n if (this.key === \"\" || regenerate) {\n this.key = Math.random()\n .toString(36)\n .replace(/[^a-z]+/g, \"\")\n .substring(0, 10);\n }\n }\n\n /**\n * Sets the IDs of the alert and it's children if they do not already exist.\n *\n * The generated IDs use the key and follow the format:\n * - alert: `alert-${key}`\n * - controller: `alert-controller-${key}`\n */\n _setIds() {\n this.dom.alert.id = this.dom.alert.id || `alert-${this.key}`;\n this.dom.controller.id =\n this.dom.controller.id || `alert-controller-${this.key}`;\n }\n\n /**\n * Shows the alert.\n *\n * @fires grauplAlertShow\n *\n * @param {boolean} [emit = true] - A toggle to emit the show event once shown.\n */\n show(emit = true) {\n if (!this._hidden) {\n return;\n }\n\n // If we're dealing with transition classes, then we need to utilize\n // requestAnimationFrame to add the transition class, remove the hide class,\n // add the show class, and finally remove the transition class.\n if (this.transitionClass !== \"\") {\n addClass(this.transitionClass, this.dom.alert);\n\n requestAnimationFrame(() => {\n if (this.hideClass !== \"\") {\n removeClass(this.hideClass, this.dom.alert);\n }\n\n requestAnimationFrame(() => {\n if (this.showClass !== \"\") {\n addClass(this.showClass, this.dom.alert);\n }\n\n requestAnimationFrame(() => {\n removeClass(this.transitionClass, this.dom.alert);\n });\n });\n });\n } else {\n // Add the show class\n if (this.showClass !== \"\") {\n addClass(this.showClass, this.dom.alert);\n }\n\n // Remove the hide class.\n if (this.hideClass !== \"\") {\n removeClass(this.hideClass, this.dom.alert);\n }\n }\n\n this._hidden = false;\n\n if (emit) {\n this.dom.alert.dispatchEvent(this._hideEvent);\n }\n }\n\n /**\n * Hides the alert.\n *\n * @fires grauplAlertHide\n *\n * @param {boolean} [emit = true] - A toggle to emit the hide event once shown.\n */\n hide(emit = true) {\n if (this._hidden) {\n return;\n }\n // If we're dealing with transition classes, then we need to utilize\n // requestAnimationFrame to add the transition class, remove the show class,\n // add the hide class, and finally remove the transition class.\n if (this.transitionClass !== \"\") {\n addClass(this.transitionClass, this.dom.alert);\n\n requestAnimationFrame(() => {\n if (this.showClass !== \"\") {\n removeClass(this.showClass, this.dom.alert);\n }\n\n requestAnimationFrame(() => {\n if (this.transitionTimer > 0) {\n setTimeout(() => {\n if (this.hideClass !== \"\") {\n addClass(this.hideClass, this.dom.alert);\n }\n\n requestAnimationFrame(() => {\n removeClass(this.transitionClass, this.dom.alert);\n });\n }, this.transitionTimer);\n } else {\n if (this.hideClass !== \"\") {\n addClass(this.hideClass, this.dom.alert);\n }\n\n requestAnimationFrame(() => {\n removeClass(this.transitionClass, this.dom.alert);\n });\n }\n });\n });\n } else {\n // Add the hide class\n if (this.hideClass !== \"\") {\n addClass(this.hideClass, this.dom.alert);\n }\n\n // Remove the show class.\n if (this.showClass !== \"\") {\n removeClass(this.showClass, this.dom.alert);\n }\n }\n\n this._hidden = true;\n\n if (emit) {\n this.dom.alert.dispatchEvent(this._hideEvent);\n }\n }\n\n /**\n * Handles click events throughout the alert for proper use.\n *\n * - Adds a `pointerup` listener to the controller that will hide the alert.\n *\n * @protected\n */\n _handleClick() {\n if (this.dom.controller === null) {\n return;\n }\n\n this.dom.controller.addEventListener(\"pointerup\", () => this.hide());\n }\n\n /**\n * Handles keydown events throughout the alert for proper use.\n *\n * This method exists to assist the _handleKeyup method.\n *\n * - Adds a `keydown` listener to the controller (if it exists).\n * - Blocks propagation on \"Space\" and \"Enter\" keys.\n */\n _handleKeydown() {\n if (this.dom.controller === null) {\n return;\n }\n\n this.dom.controller.addEventListener(\"keydown\", (event) => {\n const key = keyPress(event);\n\n // Prevent default behavior for space and enter keys.\n if (key === \"Space\" || key === \"Enter\") {\n preventEvent(event);\n }\n });\n }\n\n /**\n * Handles keyup events throughout the alert for proper use.\n *\n * - Adds a `keyup` listener to the controller (if it exists).\n * - Hides the alert when the user hits \"Space\" or \"Enter\".\n */\n _handleKeyup() {\n if (this.dom.controller === null) {\n return;\n }\n\n this.dom.controller.addEventListener(\"keyup\", (event) => {\n const key = keyPress(event);\n\n if (key === \"Space\" || key === \"Enter\") {\n this.hide();\n }\n });\n }\n}\n\nexport default Alert;\n","import Alert from \"./Alert.js\";\nimport once from \"@drupal/once\";\n\nconst generate = (\n options = {},\n context = document,\n alertSelector = \".alert\"\n) => {\n once(\"graupl-alert-generator\", alertSelector, context).forEach(\n (alertElement) => {\n const alertOptions = alertElement.dataset.grauplAlertOptions\n ? JSON.parse(\n alertElement.dataset.grauplAlertOptions.replace(/'/g, '\"')\n ) || {}\n : {};\n\n new Alert({\n alertElement,\n controllerElement:\n alertElement.querySelector(\".alert-dismisser\") || null,\n initialize: true,\n ...options,\n ...alertOptions,\n });\n }\n );\n};\n\nexport default generate;\n","/**\n * @file\n * The carousel class.\n */\n\nimport { addClass, removeClass } from \"../domHelpers.js\";\nimport { preventEvent, keyPress } from \"../eventHandlers.js\";\nimport storage from \"../storage.js\";\nimport {\n isQuerySelector,\n isTag,\n isValidClassList,\n isValidInstance,\n isValidType,\n} from \"../validate.js\";\n\nclass Carousel {\n /**\n * The DOM elements within the carousel.\n *\n * @protected\n *\n * @type {Object<HTMLElement, HTMLElement[]>}\n *\n * @property {HTMLElement} carousel - The carousel element.\n * @property {HTMLElement[]} carouselItems - The carousel items.\n * @property {HTMLElement} carouselItemContainer - The carousel item container.\n * @property {HTMLElement[]} carouselControls - The carousel controls.\n * @property {HTMLElement} carouselControlContainer - The carousel control container.\n * @property {HTMLElement[]} carouselTabs - The carousel tabs.\n * @property {HTMLElement} carouselTabContainer - The carousel tab container.\n * @property {HTMLElement} autoplay - The autoplay button.\n * @property {HTMLElement} next - The next button.\n * @property {HTMLElement} previous - The previous button.\n */\n _dom = {\n carousel: null,\n carouselItems: [],\n carouselItemContainer: null,\n carouselControls: [],\n carouselControlContainer: null,\n carouselTabs: [],\n carouselTabContainer: null,\n autoplay: null,\n next: null,\n previous: null,\n };\n\n /**\n * The query selectors used by the carousel to populate the dom.\n *\n * @protected\n *\n * @type {Object<string>}\n *\n * @property {string} carouselItems - The query selector string for carousel items.\n * @property {string} carouselItemContainer - The query selector string for the carousel item container.\n * @property {string} carouselControls - The query selector string for carousel controls.\n * @property {string} carouselControlContainer - The query selector string for carousel control container.\n * @property {string} carouselTabs - The query selector string for the carousel tabs.\n * @property {string} carouselTabContainer - The query selector string for the carousel tab container.\n * @property {string} autoplay - The query selector string for the autoplay button.\n * @property {string} next - The query selector string for the next button.\n * @property {string} previous - The query selector string for the previous button.\n */\n _selectors = {\n carouselItems: \"\",\n carouselItemContainer: \"\",\n carouselControls: \"\",\n carouselControlContainer: \"\",\n carouselTabs: \"\",\n carouselTabContainer: \"\",\n autoplay: \"\",\n next: \"\",\n previous: \"\",\n };\n\n /**\n * The class(es) to apply when a carousel item is active.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _activeClass = \"active\";\n\n /**\n * The class(es) to apply to a carousel item that is the previously active item.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _previousClass = \"previous\";\n\n /**\n * The class(es) to apply to a carousel item that is the next active item.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _nextClass = \"next\";\n\n /**\n * The class(es) to apply to the autoplay button when the carousel is paused.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _playClass = \"play\";\n\n /**\n * The class(es) to apply to the autoplay button when the carousel is playing.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _pauseClass = \"pause\";\n\n /**\n * The index of the currently active carousel item.\n *\n * @protected\n *\n * @type {number}\n */\n _currentItem = 0;\n\n /**\n * A flag to indicate if the carousel is currently playing.\n *\n * @protected\n *\n * @type {boolean}\n */\n _autoplay = true;\n\n /**\n * A variable to delay transition slides in milliseconds.\n *\n * @protected\n *\n * @type {number}\n */\n _transitionDelay = 10000;\n\n /**\n * The duration time (in milliseconds) for the transition between carousel items.\n *\n * @protected\n *\n * @type {number}\n */\n _transitionDuration = 500;\n\n /**\n * The label for the autoplay button when the carousel is paused.\n *\n * @protected\n *\n * @type {string}\n */\n _playText = \"Play\";\n\n /**\n * The label for the autoplay button when the carousel is playing.\n *\n * @protected\n *\n * @type {string}\n */\n _pauseText = \"Pause\";\n\n /**\n * The current action being performed by the carousel.\n *\n * @protected\n *\n * @type {string}\n */\n _currentAction = \"next\";\n\n /**\n * The stored interval callback for autoplaying the carousel.\n *\n * @protected\n *\n * @type {?Function}\n */\n _autoplayInterval = null;\n\n /**\n * The prefix to use for CSS custom properties.\n *\n * @protected\n *\n * @type {string}\n */\n _prefix = \"graupl-\";\n\n /**\n * The key used to generate IDs throughout the carousel.\n *\n * @protected\n *\n * @type {string}\n */\n _key = \"\";\n\n /**\n * An array of error messages generated by the carousel.\n *\n * @protected\n *\n * @type {string[]}\n */\n _errors = [];\n\n /**\n * Constructs a new `Carousel`.\n *\n * @param {object} options - The options for the generated carousel.\n * @param {HTMLElement} options.carouselElement - The carousel element in the DOM.\n * @param {string} [options.carouselItemSelector = .carousel-item] - The query selector string for carousel items.\n * @param {string} [options.carouselItemContainerSelector = .carousel-item-container] - The query selector string for the carousel item container.\n * @param {string} [options.carouselControlSelector = .carousel-control] - The query selector string for carousel controls.\n * @param {string} [options.carouselControlContainerSelector = .carousel-control-container] - The query selector string for carousel control container.\n * @param {string} [options.carouselTabSelector = .carousel-tab] - The query selector string for carousel tabs.\n * @param {string} [options.carouselTabContainerSelector = .carousel-tab-container] - The query selector string for the carousel tab container.\n * @param {string} [options.autoplaySelector = .autoplay] - The query selector string for the autoplay button.\n * @param {string} [options.nextSelector = .next] - The query selector string for the next button.\n * @param {string} [options.previousSelector = .previous] - The query selector string for the previous button.\n * @param {?(string|string[])} [options.activeClass = active] - The class(es) to apply when a carousel item is active.\n * @param {?(string|string[])} [options.previousClass = previous] - The class(es) to apply to a carousel item that is the previously active item.\n * @param {?(string|string[])} [options.nextClass = next] - The class(es) to apply to a carousel item that is the next active item.\n * @param {?(string|string[])} [options.playClass = play] - The class(es) to apply to the autoplay button when the carousel is paused.\n * @param {?(string|string[])} [options.pauseClass = pause] - The class(es) to apply to the autoplay button when the carousel is playing.\n * @param {boolean} [options.autoplay = true] - A flag to indicate if the carousel should autoplay.\n * @param {number} [options.transitionDelay = 10000] - A flag to initialize the carousel immediately upon creation.\n * @param {number} [options.transitionDuration = 500] - The duration time (in milliseconds) for the transition between carousel items.\n * @param {?string} [options.playText = Play] - The text to use for the play button.\n * @param {?string} [options.pauseText = Pause] - The text to use for the pause button.\n * @param {?string} [options.prefix = graupl-] - The prefix to use for CSS custom properties.\n * @param {?string} [options.key = null] - The key used to generate IDs throughout the carousel.\n * @param {boolean} [options.initialize = false] - A flag to initialize the carousel immediately upon creation.\n */\n constructor({\n carouselElement,\n carouselItemSelector = \".carousel-item\",\n carouselItemContainerSelector = \".carousel-item-container\",\n carouselControlSelector = \".carousel-control\",\n carouselControlContainerSelector = \".carousel-control-container\",\n carouselTabSelector = \".carousel-tab\",\n carouselTabContainerSelector = \".carousel-tab-container\",\n autoplaySelector = \".autoplay\",\n nextSelector = \".next\",\n previousSelector = \".previous\",\n activeClass = \"active\",\n previousClass = \"previous\",\n nextClass = \"next\",\n playClass = \"play\",\n pauseClass = \"pause\",\n autoplay = true,\n transitionDelay = 10000,\n transitionDuration = 500,\n playText = \"Play\",\n pauseText = \"Pause\",\n prefix = \"graupl-\",\n key = null,\n initialize = false,\n }) {\n // Set DOM elements.\n this._dom.carousel = carouselElement;\n\n // Set query selectors.\n this._selectors.carouselItems = carouselItemSelector;\n this._selectors.carouselItemContainer = carouselItemContainerSelector;\n this._selectors.carouselControls = carouselControlSelector;\n this._selectors.carouselControlContainer = carouselControlContainerSelector;\n this._selectors.carouselTabs = carouselTabSelector;\n this._selectors.carouselTabContainer = carouselTabContainerSelector;\n this._selectors.autoplay = autoplaySelector;\n this._selectors.next = nextSelector;\n this._selectors.previous = previousSelector;\n\n // Set class names.\n this._activeClass = activeClass || \"\";\n this._previousClass = previousClass || \"\";\n this._nextClass = nextClass || \"\";\n this._playClass = playClass || \"\";\n this._pauseClass = pauseClass || \"\";\n\n // Set flags.\n this._autoplay = autoplay;\n\n // Set transition options.\n this._transitionDelay = transitionDelay;\n this._transitionDuration = transitionDuration;\n\n // Set labels.\n this._playText = playText || \"\";\n this._pauseText = pauseText || \"\";\n\n // Set prefix.\n this._prefix = prefix || \"\";\n\n // Set the key.\n this._key = key || \"\";\n\n if (initialize) {\n this.initialize();\n }\n }\n\n /**\n * Initializes the carousel.\n */\n initialize() {\n try {\n if (!this._validate()) {\n throw new Error(\n `Graupl Carousel: cannot initialize carousel. The following errors have been found:\\n - ${this.errors.join(\n \"\\n - \"\n )}`\n );\n }\n\n // Set up the DOM.\n this._generateKey();\n this._setDOMElements();\n this._setIds();\n this._setAriaAttributes();\n\n // Activate the first item.\n this.activateFirstItem();\n\n // Handle events.\n this._handleAutoplay();\n this._handleFocus();\n this._handleClick();\n this._handleHover();\n this._handleKeydown();\n this._handleKeyup();\n\n // Set the custom props.\n this._setTransitionDuration();\n\n // Set up the storage.\n storage.initializeStorage(\"carousels\");\n storage.pushToStorage(\"carousels\", this.dom.carousel.id, this);\n } catch (error) {\n console.error(error);\n }\n }\n\n /**\n * The HTML elements for the carousel in the DOM.\n *\n * @readonly\n *\n * @type {Object<HTMLElement>}\n *\n * @see _dom\n */\n get dom() {\n return this._dom;\n }\n\n /**\n * The query selectors used by the carousel to populate the dom.\n *\n * @readonly\n *\n * @type {Object<string>}\n *\n * @see _selectors\n */\n get selectors() {\n return this._selectors;\n }\n\n /**\n * The class(es) to apply when a carousel item is active.\n *\n * @type {string|string[]}\n *\n * @see _activeClass\n */\n get activeClass() {\n return this._activeClass;\n }\n\n /**\n * The class(es) to apply to a carousel item that is the next active item.\n *\n * @type {string|string[]}\n *\n * @see _previousClass\n */\n get previousClass() {\n return this._previousClass;\n }\n\n /**\n * The class(es) to apply to a carousel item that is the next active item.\n *\n * @type {string|string[]}\n *\n * @see _nextClass\n */\n get nextClass() {\n return this._nextClass;\n }\n\n /**\n * The class(es) to apply to the autoplay button when the carousel is paused.\n *\n * @type {string|string[]}\n *\n * @see _playClass\n */\n get playClass() {\n return this._playClass;\n }\n\n /**\n * The class(es) to apply to the autoplay button when the carousel is playing.\n *\n * @type {string|string[]}\n *\n * @see _pauseClass\n */\n get pauseClass() {\n return this._pauseClass;\n }\n\n /**\n * The index of the currently active carousel item.\n *\n * @type {number}\n *\n * @see _currentItem\n */\n get currentItem() {\n return this._currentItem;\n }\n\n /**\n * The currently active carousel item.\n *\n * @readonly\n *\n * @type {HTMLElement}\n */\n get currentCarouselItem() {\n return this.dom.carouselItems[this.currentItem];\n }\n\n /**\n * The currently active carousel tab.\n *\n * @readonly\n *\n * @type {HTMLElement}\n */\n get currentCarouselTab() {\n return this.dom.carouselTabs[this.currentItem];\n }\n\n /**\n * A flag to indicate if the carousel is currently playing.\n *\n * @type {boolean}\n *\n * @see _autoplay\n */\n get autoplay() {\n return this._autoplay;\n }\n\n /**\n * The delay in milliseconds before transitioning slides.\n *\n * @type {number}\n *\n * @see _transitionDelay\n */\n get transitionDelay() {\n return this._transitionDelay;\n }\n\n /**\n * The duration time (in milliseconds) for the transition between carousel items.\n *\n * @type {number}\n *\n * @see _transitionDuration\n */\n get transitionDuration() {\n return this._transitionDuration;\n }\n\n /**\n * The label for the autoplay button when the carousel is paused.\n *\n * @type {string}\n *\n * @see _playText\n */\n get playText() {\n return this._playText;\n }\n\n /**\n * The label for the autoplay button when the carousel is playing.\n *\n * @type {string}\n *\n * @see _pauseText\n */\n get pauseText() {\n return this._pauseText;\n }\n\n /**\n * The prefix to use for CSS custom properties.\n *\n * @type {string}\n *\n * @see _prefix\n */\n get prefix() {\n return this._prefix;\n }\n\n /**\n * The key used to generate IDs throughout the accordion.\n *\n * @type {string}\n *\n * @see _key\n */\n get key() {\n return this._key;\n }\n\n /**\n * The current action being performed by the carousel.\n *\n * @type {string}\n *\n * @see _currentAction\n */\n get currentAction() {\n return this._currentAction;\n }\n\n /**\n * An array of error messages generated by the carousel.\n *\n * @readonly\n *\n * @type {string[]}\n *\n * @see _errors\n */\n get errors() {\n return this._errors;\n }\n\n set currentItem(value) {\n isValidType(\"number\", { value });\n\n if (value === this.currentItem) {\n return;\n }\n\n if (value < 0) {\n this._currentItem = 0;\n } else if (value >= this.dom.carouselItems.length) {\n this._currentItem = this.dom.carouselItems.length - 1;\n } else {\n this._currentItem = value;\n }\n\n // Keep the aria selected in sync with the current item.\n const tabs = this._dom.carousel.querySelectorAll(\n this.selectors.carouselTab\n );\n if (tabs) {\n this.dom.carouselItems.forEach((item, index) => {\n item.setAttribute(\"aria-selected\", index === this._currentItem);\n });\n }\n }\n\n set autoplay(value) {\n isValidType(\"boolean\", { value });\n\n if (this._autoplay !== value) {\n this._autoplay = value;\n }\n }\n\n set activeClass(value) {\n isValidClassList({ activeClass: value });\n\n if (this._activeClass !== value) {\n this._activeClass = value;\n }\n }\n\n set previousClass(value) {\n isValidClassList({ previousClass: value });\n\n if (this._previousClass !== value) {\n this._previousClass = value;\n }\n }\n\n set nextClass(value) {\n isValidClassList({ nextClass: value });\n\n if (this._nextClass !== value) {\n this._nextClass = value;\n }\n }\n\n set playClass(value) {\n isValidClassList({ playClass: value });\n\n if (this._playClass !== value) {\n this._playClass = value;\n }\n }\n\n set pauseClass(value) {\n isValidClassList({ pauseClass: value });\n\n if (this._pauseClass !== value) {\n this._pauseClass = value;\n }\n }\n\n set transitionDelay(value) {\n isValidType(\"number\", { value });\n\n if (value !== this.transitionDelay && value >= 0) {\n this._currentItem = value;\n }\n }\n\n set transitionDuration(value) {\n isValidType(\"number\", { value });\n\n if (this._transitionDuration !== value && value >= 0) {\n this._transitionDuration = value;\n this._setTransitionDuration();\n }\n }\n\n set playText(value) {\n isValidType(\"string\", { value });\n\n if (this._playText !== value) {\n this._playText = value;\n }\n }\n\n set pauseText(value) {\n isValidType(\"string\", { value });\n\n if (this._pauseText !== value) {\n this._pauseText = value;\n }\n }\n\n set prefix(value) {\n isValidType(\"string\", { value });\n\n if (this._prefix !== value) {\n this._prefix = value;\n }\n }\n\n set key(value) {\n isValidType(\"string\", { value });\n\n if (this._key !== value) {\n this._key = value;\n }\n }\n\n /**\n * Validates all aspects of the carousel to ensure proper functionality.\n *\n * @protected\n *\n * @return {boolean} - The results of the validation.\n */\n _validate() {\n let check = true;\n\n // HTML element checks.\n const htmlElementChecks = isValidInstance(HTMLElement, {\n carousel: this.dom.carousel,\n });\n\n if (!htmlElementChecks) {\n this._errors.push(htmlElementChecks.message);\n check = false;\n }\n\n // Query selector checks.\n const querySelectorChecks = isQuerySelector({\n carouselItemsSelector: this._selectors.carouselItems,\n carouselItemContainerSelector: this._selectors.carouselItemContainer,\n carouselControlsSelector: this._selectors.carouselControls,\n carouselControlContainerSelector:\n this._selectors.carouselControlContainer,\n carouselTabsSelector: this._selectors.carouselTabs,\n carouselTabContainerSelector: this._selectors.carouselTabContainer,\n autoplaySelector: this._selectors.autoplay,\n nextSelector: this._selectors.next,\n previousSelector: this._selectors.previous,\n });\n\n if (!querySelectorChecks) {\n this._errors.push(querySelectorChecks.message);\n check = false;\n }\n\n // Autoplay checks.\n const autoplayChecks = isValidType(\"boolean\", { autoplay: this.autoplay });\n\n if (!autoplayChecks) {\n this._errors.push(autoplayChecks.message);\n check = false;\n }\n\n // Check delay is a valid value.\n const delayCheck = isValidType(\"number\", {\n transitionDelay: this._transitionDelay,\n });\n\n if (!delayCheck) {\n this._errors.push(delayCheck.message);\n check = false;\n }\n\n // Check duration is a valid value.\n const durationCheck = isValidType(\"number\", {\n transitionDuration: this._transitionDuration,\n });\n\n if (!durationCheck) {\n this._errors.push(durationCheck.message);\n check = false;\n }\n\n // Active class checks.\n if (this._activeClass !== \"\") {\n const activeClassChecks = isValidClassList({\n activeClass: this._activeClass,\n });\n\n if (!activeClassChecks) {\n this._errors.push(activeClassChecks.message);\n check = false;\n }\n }\n\n // Previous class checks.\n if (this._previousClass !== \"\") {\n const previousClassChecks = isValidClassList({\n previousClass: this._previousClass,\n });\n\n if (!previousClassChecks) {\n this._errors.push(previousClassChecks.message);\n check = false;\n }\n }\n\n // Next class checks.\n if (this._nextClass !== \"\") {\n const nextClassChecks = isValidClassList({\n nextClass: this._nextClass,\n });\n\n if (!nextClassChecks) {\n this._errors.push(nextClassChecks.message);\n check = false;\n }\n }\n\n // Play class checks.\n if (this._playClass !== \"\") {\n const playClassChecks = isValidClassList({\n playClass: this._playClass,\n });\n\n if (!playClassChecks) {\n this._errors.push(playClassChecks.message);\n check = false;\n }\n }\n\n // Pause class checks.\n if (this._pauseClass !== \"\") {\n const pauseClassChecks = isValidClassList({\n pauseClass: this._pauseClass,\n });\n\n if (!pauseClassChecks) {\n this._errors.push(pauseClassChecks.message);\n check = false;\n }\n }\n\n // Play text checks.\n if (this._playText !== \"\") {\n const playTextChecks = isValidType(\"string\", {\n playText: this._playText,\n });\n\n if (!playTextChecks) {\n this._errors.push(playTextChecks.message);\n check = false;\n }\n }\n\n // Pause text checks.\n if (this._pauseText !== \"\") {\n const pauseTextChecks = isValidType(\"string\", {\n pauseText: this._pauseText,\n });\n\n if (!pauseTextChecks) {\n this._errors.push(pauseTextChecks.message);\n check = false;\n }\n }\n\n // Prefix checks.\n const prefixChecks = isValidType(\"string\", { prefix: this._prefix });\n\n if (!prefixChecks) {\n this._errors.push(prefixChecks.message);\n check = false;\n }\n\n return check;\n }\n\n /**\n * Sets DOM elements within the carousel.\n *\n * The carousel element _cannot_ be set through this method.\n *\n * @protected\n *\n * @param {string} elementType - The type of element to populate.\n * @param {HTMLElement} [base = this.dom.carousel] - The element used as the base for the querySelector.\n * @param {boolean} [overwrite = true] - A flag to set if the existing elements will be overwritten.\n */\n _setDOMElementType(elementType, base = this.dom.carousel, overwrite = true) {\n if (typeof this.selectors[elementType] === \"string\") {\n if (elementType === \"carousel\") {\n throw new Error(\n `Graupl Carousel: \"${elementType}\" element cannot be set through _setDOMElementType.`\n );\n }\n\n if (base !== this.dom.carousel) isValidInstance(HTMLElement, { base });\n\n if (Array.isArray(this._dom[elementType])) {\n // Get all the elements matching the selector in the base.\n const domElements = Array.from(\n base.querySelectorAll(this.selectors[elementType])\n );\n\n // Filter the elements so only direct children of the base are kept.\n const filteredElements = domElements.filter(\n (item) => item.parentElement === base\n );\n\n if (overwrite) {\n this._dom[elementType] = filteredElements;\n } else {\n this._dom[elementType] = [\n ...this._dom[elementType],\n ...filteredElements,\n ];\n }\n } else {\n // Get the single element matching the selector in the base.\n const domElement = base.querySelector(this.selectors[elementType]);\n\n // Ensure the element is a direct child of the base.\n if (domElement && domElement.parentElement !== base) {\n return;\n }\n\n if (overwrite) {\n this._dom[elementType] = domElement;\n }\n }\n } else {\n throw new Error(\n `Graupl Carousel: \"${elementType}\" is not a valid element type within the carousel.`\n );\n }\n }\n\n /**\n * Resets DOM elements within the menu.\n *\n * The carousel element _cannot_ be reset through this method.\n *\n * @protected\n *\n * @param {string} elementType - The type of element to clear.\n */\n _resetDOMElementType(elementType) {\n if (typeof this.selectors[elementType] === \"string\") {\n if (elementType === \"carousel\") {\n throw new Error(\n `Graupl Carousel: \"${elementType}\" element cannot be reset through _resetDOMElementType.`\n );\n }\n\n if (Array.isArray(this._dom[elementType])) {\n this._dom[elementType] = [];\n } else {\n this._dom[elementType] = null;\n }\n } else {\n throw new Error(\n `Graupl Carousel: \"${elementType}\" is not a valid element type within the carousel.`\n );\n }\n }\n\n /**\n * Sets all DOM elements within the carousel.\n *\n * Utilizes _setDOMElementType and _resetDOMElementType.\n *\n * @protected\n */\n _setDOMElements() {\n this._setDOMElementType(\"carouselItemContainer\");\n this._setDOMElementType(\"carouselControlContainer\");\n this._setDOMElementType(\"carouselTabContainer\");\n\n if (this.dom.carouselItemContainer) {\n this._setDOMElementType(\"carouselItems\", this.dom.carouselItemContainer);\n }\n if (this.dom.carouselControlContainer) {\n this._setDOMElementType(\n \"carouselControls\",\n this.dom.carouselControlContainer\n );\n this._setDOMElementType(\"autoplay\", this.dom.carouselControlContainer);\n this._setDOMElementType(\"next\", this.dom.carouselControlContainer);\n this._setDOMElementType(\"previous\", this.dom.carouselControlContainer);\n }\n\n if (this._dom.carouselTabContainer) {\n this._setDOMElementType(\"carouselTabs\", this.dom.carouselTabContainer);\n }\n }\n\n /**\n * Generates a key for the carousel.\n *\n * @param {boolean} [regenerate = false] - A flag to determine if the key should be regenerated.\n */\n _generateKey(regenerate = false) {\n if (this.key === \"\" || regenerate) {\n this.key = Math.random()\n .toString(36)\n .replace(/[^a-z]+/g, \"\")\n .substring(0, 10);\n }\n }\n\n /**\n * Sets the IDs of the carousel and it's children if they do not already exist.\n *\n * The generated IDs use the key and follow the format:\n * - carousel: `carousel-${key}`\n * - carousel items: `carousel-item-${key}-${index}`\n * - carousel tabs: `carousel-tab-${key}-${index}`\n */\n _setIds() {\n this.dom.carousel.id = this.dom.carousel.id || `carousel-${this.key}`;\n\n this.dom.carouselItems.forEach((item, index) => {\n item.id = item.id || `carousel-item-${this.key}-${index}`;\n });\n\n this.dom.carouselTabs.forEach((tab, index) => {\n tab.id = tab.id || `carousel-tab-${this.key}-${index}`;\n });\n }\n\n /**\n * Sets the aria attributes for the carousel.\n */\n _setAriaAttributes() {\n // Make sure the carousel has a proper role.\n // Sections and role=\"region\" are acceptable in certain cases, so\n // we only need to fallback to role=\"group\" if neither of those are present.\n if (\n !isTag(\"section\", { carousel: this.dom.carousel }) &&\n !this.dom.carousel.getAttribute(\"role\") !== \"region\"\n ) {\n this.dom.carousel.setAttribute(\"role\", \"group\");\n }\n\n // Set the role description for the carousel.\n this._dom.carousel.setAttribute(\"aria-roledescription\", \"carousel\");\n\n if (this.dom.carouselTabContainer) {\n this.dom.carouselTabContainer.setAttribute(\"role\", \"tablist\");\n }\n\n this.dom.carouselTabs.forEach((tab, index) => {\n if (!isTag(\"button\", { tab: tab })) {\n tab.setAttribute(\"role\", \"button\");\n }\n\n tab.setAttribute(\"aria-selected\", index === 0);\n tab.setAttribute(\"aria-controls\", this.dom.carouselItems[index].id);\n });\n }\n\n /**\n * Sets the interval for autoplaying the carousel.\n *\n * @protected\n */\n _setInterval() {\n this._clearInterval();\n\n this._autoplayInterval = setInterval(() => {\n this.activateNextItem();\n }, this.transitionDelay);\n }\n\n /**\n * Clears the interval for autoplaying the carousel.\n *\n * @protected\n */\n _clearInterval() {\n clearInterval(this._autoplayInterval);\n }\n\n /**\n * Handles the autoplay functionality of the carousel.\n *\n * - Adds the appropriate class to the autoplay button.\n * - Removes the appropriate class from the autoplay button.\n * - Sets the appropriate aria-label for the autoplay button.\n * - Sets the appropriate aria-live for the carousel.\n * - Sets/clears the interval for autoplaying the carousel.\n *\n * @protected\n */\n _handleAutoplay() {\n if (this.autoplay) {\n addClass(this.pauseClass, this.dom.autoplay);\n removeClass(this.playClass, this.dom.autoplay);\n\n this.dom.autoplay.setAttribute(\"aria-label\", this.pauseText);\n this.dom.carousel.setAttribute(\"aria-live\", \"off\");\n\n this._setInterval();\n } else {\n addClass(this.playClass, this.dom.autoplay);\n removeClass(this.pauseClass, this.dom.autoplay);\n\n this.dom.autoplay.setAttribute(\"aria-label\", this.playText);\n this.dom.carousel.setAttribute(\"aria-live\", \"polite\");\n\n this._clearInterval();\n }\n }\n\n /**\n * Handles the focus events throughout the carousel for proper use.\n *\n * - Adds a `focusin` listener to the carousel element to pause autoplay.\n * - Adds a `focusout` listener to the carousel element to resume autoplay.\n */\n _handleFocus() {\n // Pause autoplay when anything in the carousel is focused.\n this.dom.carousel.addEventListener(\"focusin\", () => {\n if (this.autoplay) {\n this._clearInterval();\n }\n });\n\n this.dom.carousel.addEventListener(\"focusout\", () => {\n if (this.autoplay) {\n this._setInterval();\n }\n });\n }\n\n /**\n * Handles the click events throughout the carousel.\n *\n * - Adds a `pointerup` listener to the next control to activate the next item.\n * - Adds a `pointerup` listener to the previous control to activate the previous item.\n * - Adds a `pointerup` listener to the autoplay control to toggle autoplay.\n * - Adds a `pointerup` listener to each tab control to activate the corresponding item.\n */\n _handleClick() {\n this.dom.next.addEventListener(\"pointerup\", () => {\n this.activateNextItem();\n });\n\n this.dom.previous.addEventListener(\"pointerup\", () => {\n this.activatePreviousItem();\n });\n\n this.dom.autoplay.addEventListener(\"pointerup\", () => {\n this.toggleAutoplay();\n });\n\n this.dom.carouselTabs.forEach((tab, index) => {\n tab.addEventListener(\"pointerup\", () => {\n if (this.currentItem > index) {\n this._currentAction = \"previous\";\n } else {\n this._currentAction = \"next\";\n }\n\n this.activateItem(index);\n });\n });\n }\n\n /**\n * Handles the hover events throughout the carousel for proper use.\n *\n * - Adds a `pointerover` listener to the carousel to pause autoplay.\n * - Adds a `pointerleave` listener to the carousel to resume autoplay.\n */\n _handleHover() {\n // Pause autoplay when anything in the carousel is hovered.\n this.dom.carousel.addEventListener(\"pointerover\", () => {\n if (this.autoplay) {\n this._clearInterval();\n }\n });\n\n this.dom.carousel.addEventListener(\"pointerleave\", () => {\n if (this.autoplay) {\n this._setInterval();\n }\n });\n }\n\n /**\n * Handles keydown events throughout the carousel item for proper use.\n *\n * - Adds a `keydown` listener to all control elements.\n * - Prevents Space and Enter key events.\n * - Adds a `keydown` listener to all tab elements.\n * - Prevents Space and Enter key events.\n */\n _handleKeydown() {\n this.dom.carouselControls.forEach((control) => {\n control.addEventListener(\"keydown\", (event) => {\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n // Prevent the default action of the event.\n preventEvent(event);\n\n break;\n }\n });\n });\n\n this.dom.carouselTabs.forEach((tab) => {\n tab.addEventListener(\"keydown\", (event) => {\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n // Prevent the default action of the event.\n preventEvent(event);\n\n break;\n }\n });\n });\n }\n\n /**\n * Handles keyup events throughout the carousel item for proper use.\n *\n * - Adds a `keyup` listener to all control elements.\n * - Activates the next/previous item depending on which control is pressed.\n * - Toggles autoplay if the autoplay control is pressed.\n *\n */\n _handleKeyup() {\n // Activate the next item if the space or enter key on the next control.\n this.dom.next.addEventListener(\"keyup\", (event) => {\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n this.activateNextItem();\n\n // Prevent the default action of the event.\n preventEvent(event);\n\n break;\n }\n });\n\n // Activate the previous item if the space or enter key on the previous control.\n this.dom.previous.addEventListener(\"keyup\", (event) => {\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n this.activatePreviousItem();\n\n // Prevent the default action of the event.\n preventEvent(event);\n\n break;\n }\n });\n\n // Toggle autoplay if the space or enter key on the autoplay control.\n this.dom.autoplay.addEventListener(\"keyup\", (event) => {\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n this.toggleAutoplay();\n\n // Prevent the default action of the event.\n preventEvent(event);\n\n break;\n }\n });\n\n // Activate the item if the space or enter key on the tab control.\n this.dom.carouselTabs.forEach((tab, index) => {\n tab.addEventListener(\"keyup\", (event) => {\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n this.activateItem(index);\n\n // Prevent the default action of the event.\n preventEvent(event);\n\n break;\n }\n });\n });\n }\n\n /**\n * Sets the transition duration for the carousel as a CSS custom property.\n *\n * The custom property is set as `--graupl-carousel-transition-duration`.\n *\n * @protected\n */\n _setTransitionDuration() {\n this.dom.carousel.style.setProperty(\n `--${this.prefix}carousel-transition-duration`,\n `${this.transitionDuration}ms`\n );\n }\n\n /**\n * Activates the current carousel item.\n *\n * @public\n */\n activateCurrentItem() {\n addClass(this.activeClass, this.currentCarouselItem);\n\n if (this.currentCarouselTab) {\n this.currentCarouselTab.setAttribute(\"aria-selected\", true);\n addClass(this.activeClass, this.currentCarouselTab);\n }\n }\n\n /**\n * Deactivates the current carousel item.\n *\n * @public\n */\n deactivateCurrentItem() {\n removeClass(this.activeClass, this.currentCarouselItem);\n\n if (this.currentCarouselTab) {\n this.currentCarouselTab.setAttribute(\"aria-selected\", false);\n removeClass(this.activeClass, this.currentCarouselTab);\n }\n }\n\n /**\n * Activates the carousel item at a given index.\n *\n * @public\n *\n * @param {number} index - The index of the carousel item to activate.\n */\n activateItem(index) {\n const currentIndex = this.currentItem;\n\n this.dom.carousel.dataset.grauplAction = this._currentAction;\n\n if (this.autoplay) {\n this._clearInterval();\n }\n\n addClass(this.previousClass, this.currentCarouselItem);\n addClass(this.nextClass, this.dom.carouselItems[index]);\n\n requestAnimationFrame(() => {\n this.deactivateCurrentItem();\n this.currentItem = index;\n this.activateCurrentItem();\n\n requestAnimationFrame(() => {\n setTimeout(() => {\n removeClass(this.previousClass, this.dom.carouselItems[currentIndex]);\n removeClass(this.nextClass, this.currentCarouselItem);\n }, this.transitionDuration);\n });\n });\n\n if (this.autoplay) {\n this._setInterval();\n }\n }\n\n /**\n * Activates the first carousel item.\n *\n * @public\n */\n activateFirstItem() {\n this.activateItem(0);\n }\n\n /**\n * Activates the last carousel item.\n *\n * @public\n */\n activateLastItem() {\n this.activateItem(this.dom.carouselItems.length - 1);\n }\n\n /**\n * Activates the next carousel item.\n *\n * @public\n */\n activateNextItem() {\n this._currentAction = \"next\";\n\n if (this.currentItem + 1 >= this.dom.carouselItems.length) {\n this.activateFirstItem();\n } else {\n this.activateItem(this.currentItem + 1);\n }\n }\n\n /**\n * Activates the previous carousel item.\n *\n * @public\n */\n activatePreviousItem() {\n this._currentAction = \"previous\";\n\n if (this.currentItem - 1 < 0) {\n this.activateLastItem();\n } else {\n this.activateItem(this.currentItem - 1);\n }\n }\n\n /**\n * Toggles autoplay on the carousel.\n *\n * @public\n */\n toggleAutoplay() {\n this.autoplay = !this.autoplay;\n\n this._handleAutoplay();\n }\n}\n\nexport default Carousel;\n","import Carousel from \"./Carousel.js\";\nimport once from \"@drupal/once\";\n\nconst generate = (\n options = {},\n context = document,\n carouselSelector = \".carousel\"\n) => {\n once(\"graupl-carousel-generator\", carouselSelector, context).forEach(\n (carouselElement) => {\n const carouselOptions = carouselElement.dataset.grauplCarouselOptions\n ? JSON.parse(\n carouselElement.dataset.grauplCarouselOptions.replace(/'/g, '\"')\n ) || {}\n : {};\n\n new Carousel({\n carouselElement,\n initialize: true,\n ...options,\n ...carouselOptions,\n });\n }\n );\n};\n\nexport default generate;\n","import storage from \"../storage.js\";\nimport once from \"@drupal/once\";\n\nconst generate = (\n options = {},\n context = document,\n navigationSelector = \".navigation\"\n) => {\n once(\"graupl-navigation-generator\", navigationSelector, context).forEach(\n (navigationElement) => {\n const MenuConstructor =\n navigationElement.dataset.grauplMenuType || DisclosureMenu;\n\n if (window[MenuConstructor] === undefined) {\n console.warn(\n `Graupl navigation requires accessible-menu's ${MenuConstructor}. Please make sure to include it on this page.`\n );\n\n return;\n }\n\n const menuOptions = navigationElement.dataset.grauplMenuOptions\n ? JSON.parse(\n navigationElement.dataset.grauplMenuOptions.replace(/'/g, '\"')\n ) || {}\n : {};\n const menuElement = navigationElement.querySelector(\".menu\");\n const controllerElement =\n navigationElement.querySelector(\".navigation-toggle\") || null;\n const containerElement = controllerElement ? navigationElement : null;\n const menu = new window[MenuConstructor]({\n menuElement,\n menuItemSelector: \".menu-item\",\n menuLinkSelector: \".menu-link\",\n submenuItemSelector: \".submenu-item\",\n submenuToggleSelector: \".submenu-toggle\",\n controllerElement,\n containerElement,\n ...options,\n ...menuOptions,\n });\n\n storage.initializeStorage(\"menus\");\n storage.pushToStorage(\"menus\", menu.dom.menu.id, menu);\n }\n );\n};\n\nexport default generate;\n","/**\n * A utility class that maintains a \"current\" value and a \"committed\" value.\n *\n * Useful when you need to:\n * - Track in-progress edits and revert to the last saved state.\n * - Compare pending and committed states.\n * - Know if a value has changed since last commit.\n *\n * @example\n * // Managing a form field\n * const username = new TransactionalValue(\"Nick\");\n * username.value = \"NickDJM\";\n * if (username.isDirty) {\n * console.log(\"Unsaved changes detected\");\n * username.commit(); // saves the new value\n * }\n *\n * @example\n * // Reverting edits\n * const counter = new TransactionalValue(10);\n * counter.value = 15;\n * counter.reset(); // reverts to 10\n */\nexport class TransactionalValue {\n /**\n * Creates a new TransactionalValue instance.\n *\n * @param {*} initialValue - The starting (and initially committed) value.\n * @param {{ equals?: function(*, *): boolean }} [options] - Optional config.\n * @param {function(*, *): boolean} [options.equals] - Custom equality comparator. Defaults to `Object.is`.\n */\n constructor(initialValue, options = {}) {\n /**\n * A comparator function used to check equality between\n * the current and committed values.\n *\n * @private\n *\n * @type {function(*, *): boolean}\n */\n this._equals = options.equals || Object.is;\n\n /**\n * The current, editable value.\n *\n * @private\n *\n * @type {*}\n */\n this._current = initialValue;\n\n /**\n * The last committed (baseline) value.\n *\n * @private\n *\n * @type {*}\n */\n this._committed = initialValue;\n }\n\n /**\n * Gets the current editable value.\n *\n * @return {*} The current value.\n *\n * @see _current\n */\n get value() {\n return this._current;\n }\n\n /**\n * Sets the current editable value.\n *\n * @param {*} val - The new value.\n */\n set value(val) {\n this._current = val;\n }\n\n /**\n * Gets the last committed (baseline) value.\n *\n * @readonly\n *\n * @return {*} The last committed value.\n *\n * @see _committed\n */\n get committed() {\n return this._committed;\n }\n\n /**\n * Checks whether the current value differs from the committed one.\n *\n * @readonly\n *\n * @return {boolean} `true` if current and committed values differ.\n */\n get isDirty() {\n return !this._equals(this._current, this._committed);\n }\n\n /**\n * Commits the current value, setting it as the new baseline.\n *\n * @return {TransactionalValue} The current instance.\n */\n commit() {\n this._committed = this._current;\n return this;\n }\n\n /**\n * Resets the current value to the committed baseline.\n *\n * @return {TransactionalValue} The current instance.\n */\n reset() {\n this._current = this._committed;\n return this;\n }\n\n /**\n * Applies a functional update to the current value.\n *\n * @param {function(*): *} fn - A function that receives the previous value and returns the new one.\n * @return {TransactionalValue} The current instance.\n *\n * @example\n * const t = new TransactionalValue(1);\n * t.update(n => n + 1); // 2\n */\n update(fn) {\n this._current = fn(this._current);\n return this;\n }\n}\n","/**\n * @file\n * The Disclosure class.\n */\n\nimport {\n isValidInstance,\n isValidClassList,\n isValidType,\n isValidState,\n isValidEvent,\n isTag,\n isQuerySelector,\n} from \"../validate.js\";\nimport { addClass, removeClass } from \"../domHelpers.js\";\nimport { keyPress, preventEvent } from \"../eventHandlers.js\";\nimport storage from \"../storage.js\";\nimport { TransactionalValue } from \"../TransactionalValue.js\";\n\nclass Disclosure {\n /**\n * The DOM elements within the disclosure.\n *\n * @protected\n *\n * @type {Object<HTMLElement>}\n *\n * @property {HTMLElement} controller - The disclosure toggle element.\n * @property {HTMLElement} disclosure - The disclosure element.\n * @property {HTMLElement} content - The disclosure content element.\n */\n _dom = {\n controller: null,\n disclosure: null,\n content: null,\n };\n\n /**\n * The DOM elements within the disclosure that cannot be reset or generated by the disclosure itself.\n *\n * @protected\n *\n * @type {string[]}\n */\n _domLock = [\"controller\", \"disclosure\"];\n\n /**\n * The query selectors used by the disclosure.\n *\n * @protected\n *\n * @type {Object<string>}\n *\n * @property {string} content - The query selector for the disclosure content.\n */\n _selectors = {\n content: \"\",\n };\n\n /**\n * The classes to apply when the disclosure is in various states.\n *\n * @protected\n *\n * @type {Object<string, string[]>}\n *\n * @property {string|string[]} open - The class(es) to apply when the disclosure is open.\n * @property {string|string[]} close - The class(es) to apply when the disclousre is closed.\n * @property {string|string[]} tranistion - The class(es) to apply when the disclosure is transitioning between states.\n * @property {string|string[]} initialize - The class(es) to apply when the disclosure is initializing.\n */\n _classes = {\n open: \"show\",\n close: \"hide\",\n transition: \"transitioning\",\n initialize: \"initializing\",\n };\n\n /**\n * The duration times (in milliseconds) for various things throughout the disclosure.\n *\n * @protected\n *\n * @type {Object<number>}\n *\n * @property {number} transition - The duration time (in milliseconds) for the transition between open and closed states.\n * @property {number} open - The duration time (in milliseconds) for the transition from closed to open states.\n * @property {number} close - The duration time (in milliseconds) for the transition from open to closed states.\n */\n _durations = {\n transition: 5000,\n open: -1,\n close: -1,\n };\n\n /**\n * The current state of the disclosure's focus.\n *\n * @protected\n *\n * @type {string}\n */\n _focusState = \"none\";\n\n /**\n * This last event triggered on the disclosure.\n *\n * @protected\n *\n * @type {string}\n */\n _currentEvent = \"none\";\n\n /**\n * The open state of the disclosure.\n *\n * @protected\n *\n * @type {TransactionalValue<boolean>}\n */\n _open = new TransactionalValue(false);\n\n /**\n * A value to force the disclosure open when the breakpoint width is passed.\n *\n * @protected\n *\n * @type {boolean}\n */\n _shouldOpen = false;\n\n /**\n * Whether or not to close the disclosure when it loses focus in the DOM.\n *\n * @protected\n *\n * @type {boolean}\n */\n _closeOnBlur = false;\n\n /**\n * The width of the screen (in pixels) that the disclosure will automatically open/close itself.\n *\n * @protected\n *\n * @type {number}\n */\n _breakpointWidth = -1;\n\n /**\n * This ResizeObserver for the disclosure.\n *\n * @protected\n *\n * @type {ResizeObserver|null}\n */\n _observer = null;\n\n /**\n * The event that is triggered when the disclosure expands.\n *\n * @protected\n *\n * @event grauplDisclosureExpand\n *\n * @type {CustomEvent}\n *\n * @property {boolean} bubbles - A flag to bubble the event.\n * @property {Object<Disclosure>} details - The details object containing the Disclosure itself.\n */\n _expandEvent = new CustomEvent(\"grauplDisclosureExpand\", {\n bubbles: true,\n detail: { disclosure: this },\n });\n\n /**\n * The event that is triggered when the disclosure collapses.\n *\n * @protected\n *\n * @event grauplDisclosureCollapse\n *\n * @type {CustomEvent}\n *\n * @property {boolean} bubbles - A flag to bubble the event.\n * @property {Object<Disclosure>} details - The details object containing the Disclosure itself.\n */\n _collapseEvent = new CustomEvent(\"grauplDisclosureCollapse\", {\n bubbles: true,\n detail: { disclosure: this },\n });\n\n /**\n * The prefix to use for CSS custom properties.\n *\n * @protected\n *\n * @type {string}\n */\n _prefix = \"graupl-\";\n\n /**\n * An array of error messages generated by the disclosure.\n *\n * @protected\n *\n * @type {string[]}\n */\n _errors = [];\n\n /**\n * Constructs a new `Disclosure`.\n *\n * @param {object} options - The options for generating the disclosure.\n * @param {HTMLElement} options.disclosureElement - The disclosure element in the DOM.\n * @param {HTMLElement} options.controllerElement - The disclosure toggle element in the DOM.\n * @param {string} [options.disclosureContentSelector = .disclosure-content] - The query selector string for the disclosure content.\n * @param {?(string|string[])} [options.openClass = show] - The class to apply when a disclosure is \"open\".\n * @param {?(string|string[])} [options.closeClass = hide] - The class to apply when a disclosure is \"closed\".\n * @param {?(string|string[])} [options.transitionClass = transitioning] - The class to apply when a disclosure is transitioning between \"open\" and \"closed\" states.\n * @param {number} [options.transitionDuration = 250] - The duration of the transition between \"open\" and \"closed\" states (in milliseconds).\n * @param {boolean} [options.openDuration = -1] - The duration of the transition from \"closed\" to \"open\" states (in milliseconds).\n * @param {boolean} [options.closeDuration = -1] - The duration of the transition from \"open\" to \"closed\" states (in milliseconds).\n * @param {boolean} [options.closeOnBlur = false] - Whether to close the disclosure when it loses focus in the dom.\n * @param {boolean} [options.minWidth = -1] - The width of the screen (in pixels) that the disclosure will automatically open/close itself.\n * @param {boolean} [options.autoOpen = false] - Whether to automatically open when above the minWidth.\n * @param {?string} [options.prefix = graupl-] - The prefix to use for CSS custom properties.\n * @param {?(string|string[])} [options.initializeClass = initializing] - The class to apply when a disclosure is initialzing.\n * @param {boolean} [options.initialize = false] - Whether to initialize the disclosure upon construction.\n */\n constructor({\n disclosureElement,\n controllerElement,\n disclosureContentSelector = \".disclosure-content\",\n openClass = \"show\",\n closeClass = \"hide\",\n transitionClass = \"transitioning\",\n transitionDuration = 250,\n openDuration = -1,\n closeDuration = -1,\n closeOnBlur = false,\n minWidth = -1,\n autoOpen = false,\n prefix = \"graupl-\",\n initializeClass = \"initializing\",\n initialize = false,\n }) {\n // Set the DOM elements.\n this._dom.disclosure = disclosureElement;\n this._dom.controller = controllerElement;\n\n // Set the DOM selectors.\n this._selectors.content = disclosureContentSelector;\n\n // Set the classes.\n this._classes.open = openClass || \"\";\n this._classes.close = closeClass || \"\";\n this._classes.transition = transitionClass || \"\";\n this._classes.initialize = initializeClass || \"\";\n\n // Set the transition durations.\n this._durations.transition = transitionDuration;\n this._durations.open = openDuration;\n this._durations.close = closeDuration;\n\n // Set close on blur.\n this._closeOnBlur = closeOnBlur;\n\n // Set collapse width and auto open functionality.\n this._breakpointWidth = minWidth;\n this._shouldOpen = autoOpen;\n\n // Set the prefix.\n this._prefix = prefix;\n\n if (initialize) {\n this.initialize();\n }\n }\n\n /**\n * Initializes the disclosure.\n */\n initialize() {\n try {\n if (!this._validate()) {\n throw new Error(\n `Graupl Disclosure: cannot initialize disclosure. The following errors have been found:\\n - ${this.errors.join(\n \"\\n - \"\n )}`\n );\n }\n\n addClass(this._classes.initialize, this.dom.disclosure);\n\n // Set up the DOM.\n this._generateKey();\n this._setDOMElements();\n this._setIds();\n this._setAriaAttributes();\n\n // Handle events.\n this._handleFocus();\n this._handleClick();\n this._handleKeydown();\n this._handleKeyup();\n this._handleResize();\n\n // Set the custom props.\n this._setTransitionDurations();\n\n // Set up the storage.\n storage.initializeStorage(\"disclosures\");\n storage.initializeStorage(\"disclosures\");\n storage.pushToStorage(\"disclosures\", this.dom.disclosure.id, this);\n\n if (\n this.dom.controller.getAttribute(\"aria-expanded\") === \"true\" ||\n (this.shouldOpen && window.matchMedia(this.openQuery).matches)\n ) {\n this._expand(false, false);\n } else {\n this._collapse(false, false);\n }\n\n requestAnimationFrame(() => {\n removeClass(this._classes.initialize, this.dom.disclosure);\n });\n } catch (error) {\n console.error(error);\n }\n }\n\n /**\n * The DOM elements within the disclosure.\n *\n * @readonly\n *\n * @type {Object<HTMLElement>}\n *\n * @see _dom\n */\n get dom() {\n return this._dom;\n }\n\n /**\n * The query selectors used by the disclosure.\n *\n * @readonly\n *\n * @type {Object<string>}\n *\n * @see _selectors\n */\n get selectors() {\n return this._selectors;\n }\n\n /**\n * The class(es) to apply when the disclosure is open.\n *\n * @type {string|string[]}\n *\n * @see _classes.open\n */\n get openClass() {\n return this._classes.open;\n }\n\n set openClass(value) {\n isValidClassList({ openClass: value });\n\n if (this._classes.open !== value) {\n this._classes.open = value;\n }\n }\n\n /**\n * The class(es) to apply when the disclosure is closed.\n *\n * @type {string|string[]}\n *\n * @see _classes.close\n */\n get closeClass() {\n return this._classes.close;\n }\n\n set closeClass(value) {\n isValidClassList({ closeClass: value });\n\n if (this._classes.close !== value) {\n this._classes.close = value;\n }\n }\n\n /**\n * The class(es) to apply when the disclosure is transitioning between open and closed.\n *\n * @type {string|string[]}\n *\n * @see _classes.transition\n */\n get transitionClass() {\n return this._classes.transition;\n }\n\n set transitionClass(value) {\n isValidClassList({ transitionClass: value });\n\n if (this._classes.transition !== value) {\n this._classes.transition = value;\n }\n }\n\n /**\n * The class(es) to apply to the shelf when the disclosure is initializing.\n *\n * @type {string|string[]}\n *\n * @see _classes\n */\n get initializeClass() {\n return this._classes.initialize;\n }\n\n set initializeClass(value) {\n isValidClassList({ initializeClass: value });\n\n if (this._classes.initialize !== value) {\n this._classes.initialize = value;\n }\n }\n\n /**\n * The duration time (in milliseconds) for the transition between open and closed states.\n *\n * Setting this value will also set the --graupl-transition-duration CSS custom property on the disclosure.\n *\n * @type {number}\n *\n * @see _durations.transition\n */\n get transitionDuration() {\n return this._durations.transition;\n }\n\n set transitionDuration(value) {\n isValidType(\"number\", { value });\n\n if (this._durations.transition !== value) {\n this._durations.transition = value;\n this._setTransitionDurations();\n }\n }\n\n /**\n * The duration time (in milliseconds) for the transition from closed to open states.\n *\n * If openDuration is set to -1, the transitionDuration value will be used instead.\n *\n * Setting this value will also set the --graupl-open-transition-duration CSS custom property on the disclosure.\n *\n * @type {number}\n *\n * @see _durations.open\n */\n get openDuration() {\n if (this._durations.open === -1) return this.transitionDuration;\n\n return this._durations.open;\n }\n\n set openDuration(value) {\n isValidType(\"number\", { value });\n\n if (this._durations.open !== value) {\n this._durations.open = value;\n this._setTransitionDurations();\n }\n }\n\n /**\n * The duration time (in milliseconds) for the transition from open to closed states.\n *\n * If closeDuration is set to -1, the transitionDuration value will be used instead.\n *\n * Setting this value will also set the --graupl-close-transition-duration CSS custom property on the disclosure.\n *\n * @type {number}\n *\n * @see _durations.close\n */\n get closeDuration() {\n if (this._durations.close === -1) return this.transitionDuration;\n\n return this._durations.close;\n }\n\n set closeDuration(value) {\n isValidType(\"number\", { value });\n\n if (this._durations.close !== value) {\n this._durations.close = value;\n this._setTransitionDurations();\n }\n }\n\n /**\n * The width of the screen (in pixels) that the disclosure will automatically open/close itself.\n *\n * @type {number}\n *\n * @see _breakpointWidth\n */\n get minWidth() {\n return this._breakpointWidth;\n }\n\n set minWidth(value) {\n isValidType(\"number\", { value });\n\n if (this._breakpointWidth !== value) {\n this._breakpointWidth = value;\n }\n }\n\n /**\n * Whether to close the disclosure when it loses focus in the DOM.\n *\n * @type {boolean}\n *\n * @see _closeOnBlur\n */\n get closeOnBlur() {\n return this._closeOnBlur;\n }\n\n set closeOnBlur(value) {\n isValidType(\"boolean\", { value });\n\n if (this._closeOnBlur !== value) {\n this._closeOnBlur = value;\n }\n }\n\n /**\n * The current state of the disclosure's focus.\n *\n * @type {string}\n *\n * @see _focusState\n */\n get focusState() {\n return this._focusState;\n }\n\n set focusState(value) {\n isValidState({ value });\n\n if (this._focusState !== value) {\n this._focusState = value;\n }\n }\n\n /**\n * The last event triggered on the disclosure.\n *\n * @type {string}\n *\n * @see _currentEvent\n */\n get currentEvent() {\n return this._currentEvent;\n }\n\n set currentEvent(value) {\n isValidEvent({ value });\n\n if (this._currentEvent !== value) {\n this._currentEvent = value;\n }\n }\n\n /**\n * The prefix to use for CSS custom properties.\n *\n * @type {string}\n *\n * @see _prefix\n */\n get prefix() {\n return this._prefix;\n }\n\n set prefix(value) {\n isValidType(\"string\", { value });\n\n if (this._prefix !== value) {\n this._prefix = value;\n this._setTransitionDurations();\n }\n }\n\n /**\n * The open state of the disclosure.\n *\n * @readonly\n *\n * @type {boolean}\n *\n * @see _open\n */\n get isOpen() {\n return this._open.value;\n }\n\n /**\n * The open state of the disclosure that the user specifically triggered.\n *\n * @readonly\n *\n * @type {boolean}\n *\n * @see _open\n */\n get hasOpened() {\n return this._open.committed;\n }\n\n /**\n * A value to force opening reguardless of user interaction.\n *\n * @type {boolean}\n *\n * @see _shouldOpen\n */\n get shouldOpen() {\n return this._shouldOpen;\n }\n\n set shouldOpen(value) {\n isValidType(\"boolean\", { value });\n\n if (this._shouldOpen !== value) {\n this._shouldOpen = value;\n }\n }\n\n /**\n * A media query for when the disclosure should open.\n *\n * Will return an empty string if no min width is set.\n *\n * @readonly\n *\n * @type {string}\n */\n get openQuery() {\n if (this.minWidth === -1) {\n return \"\";\n }\n\n return `(width > ${this.minWidth}px)`;\n }\n\n /**\n * A media query for when the disclosure should close.\n *\n * Will return an empty string if no min width is set.\n *\n * @readonly\n *\n * @type {string}\n */\n get closeQuery() {\n if (this.minWidth === -1) {\n return \"\";\n }\n\n return `(width <= ${this.minWidth}px)`;\n }\n\n /**\n * A flag to check if the disclosure's focus methods should _actually_ move the focus in the DOM.\n *\n * This will be `false` unless any of the following criteria are met:\n * - The disclosure's current event is \"keyboard\".\n *\n * @readonly\n *\n * @type {boolean}\n */\n get shouldFocus() {\n let check = false;\n\n if (this.currentEvent === \"keyboard\") {\n check = true;\n }\n\n return check;\n }\n\n /**\n * An array of error messages generated by the disclosure.\n *\n * @readonly\n *\n * @type {string[]}\n *\n * @see _errors\n */\n get errors() {\n return this._errors;\n }\n\n /**\n * Validates all aspects on the disclosure to ensure proper functionality.\n *\n * @protected\n *\n * @return {boolean} - The result of the validation.\n */\n _validate() {\n let check = true;\n\n // HTML element checks.\n const htmlElementChecks = isValidInstance(HTMLElement, {\n disclosureElement: this._dom.disclosure,\n controllerElement: this._dom.controller,\n });\n\n if (!htmlElementChecks.status) {\n this._errors.push(htmlElementChecks.error.message);\n check = false;\n }\n\n // Query selector checks.\n const querySelectorChecks = isQuerySelector({\n disclosureContentSelector: this._selectors.content,\n });\n\n if (!querySelectorChecks.status) {\n this._errors.push(querySelectorChecks.error.message);\n check = false;\n }\n\n // Class list checks.\n const classes = {};\n\n for (const className of Object.keys(this._classes)) {\n if (this._classes[className] === \"\") {\n continue;\n }\n\n classes[`${className}Class`] = this._classes[className];\n }\n\n const classListChecks = isValidClassList(classes);\n\n if (!classListChecks.status) {\n this._errors.push(classListChecks.error.message);\n check = false;\n }\n\n // Duration checks.\n const durations = {};\n\n for (const durationName of Object.keys(this._durations)) {\n durations[`${durationName}Duration`] = this._durations[durationName];\n }\n\n const durationChecks = isValidType(\"number\", durations);\n\n if (!durationChecks.status) {\n this._errors.push(durationChecks.error.message);\n check = false;\n }\n\n // Prefix check.\n const prefixCheck = isValidType(\"string\", { prefix: this._prefix });\n\n if (!prefixCheck.status) {\n this._errors.push(prefixCheck.error.message);\n check = false;\n }\n\n return check;\n }\n\n /**\n * Generates a key for the disclosure.\n *\n * @param {boolean} [regenerate = false] - A flag to determine if the key should be regenerated.\n */\n _generateKey(regenerate = false) {\n if (this.key === \"\" || regenerate) {\n this.key = Math.random()\n .toString(36)\n .replace(/[^a-z]+/g, \"\")\n .substring(0, 10);\n }\n }\n\n /**\n * Sets the IDs of the disclosure and it's controller if they do not already exist.\n *\n * The generated IDs use the key and follow the format:\n * - disclosure: `disclosure-${key}`\n * - controller: `disclosure-controller-${key}`\n *\n * @protected\n */\n _setIds() {\n this.dom.disclosure.id = this.dom.disclosure.id || `disclosure-${this.key}`;\n this.dom.controller.id =\n this.dom.controller.id || `disclosure-controller-${this.key}`;\n }\n\n /**\n * Sets the ARIA attributes on the disclosure and its controller.\n *\n * The first steps are to ensure that the controlled has `aria-expanded` set to \"false\"\n * if it's not already explicity set to \"true\".\n *\n * Then, set the `aria-controls` attribute on the controller to the disclosure's ID.\n *\n * Finally, ensure the controller element has a role of \"button\" if it is not a native button element.\n *\n * @protected\n */\n _setAriaAttributes() {\n // If the controller element doesn't have aria-expanded set to true, set it to false.\n if (this.dom.controller.getAttribute(\"aria-expanded\") !== \"true\") {\n this.dom.controller.setAttribute(\"aria-expanded\", \"false\");\n }\n\n // Set the aria-controls attribute on the controller to the disclosure's ID.\n this.dom.controller.setAttribute(\"aria-controls\", this.dom.disclosure.id);\n\n // If the controller element is not a button, set its role to button.\n if (!isTag(\"button\", { controller: this.dom.controller })) {\n this.dom.controller.setAttribute(\"role\", \"button\");\n }\n }\n\n /**\n * Sets the transition durations of the disclosure as a CSS custom properties.\n *\n * The custom properties are:\n * - `--graupl-disclosure-transition-duration`,\n * - `--graupl-disclosure-open-transition-duration`, and\n * - `--graupl-disclosure-close-transition-duration`.\n *\n * The prefix of `graupl-` can be changed by setting the disclosure's prefix value.\n *\n * @protected\n */\n _setTransitionDurations() {\n this.dom.disclosure.style.setProperty(\n `--${this.prefix}disclosure-transition-duration`,\n `${this.transitionDuration}ms`\n );\n\n this.dom.disclosure.style.setProperty(\n `--${this.prefix}disclosure-open-transition-duration`,\n `${this.openDuration}ms`\n );\n\n this.dom.disclosure.style.setProperty(\n `--${this.prefix}disclosure-close-transition-duration`,\n `${this.closeDuration}ms`\n );\n }\n\n /**\n * Sets DOM elements.\n *\n * Elements listed in _domLock cannot be set using this method.\n *\n * @protected\n *\n * @param {string} elementType - The type of element to populate.\n * @param {Object<HTMLElement,boolean>} [options = {}] - The options for setting the DOM element type.\n * @param {HTMLElement} [options.base = this.dom.disclosure] - The element used as the base for the querySelector.\n * @param {boolean} [options.overwrite = true] - A flag to set if the existing elements will be overwritten.\n * @param {boolean} [options.strict = true] - A flag to set if the elements must be direct children of the base.\n */\n _setDOMElementType(\n elementType,\n { base = this.dom.disclosure, overwrite = true, strict = true } = {}\n ) {\n if (typeof this.selectors[elementType] === \"string\") {\n if (this._domLock.includes(elementType)) {\n throw new Error(\n `Graupl ${this.constructor.name}: \"${elementType}\" element cannot be set through _setDOMElementType.`\n );\n }\n\n if (base !== this.dom.disclosure) isValidInstance(HTMLElement, { base });\n\n // Get the all elements matching the selector in the base.\n const domElements = Array.from(\n base.querySelectorAll(this.selectors[elementType])\n );\n\n // Filter the elements so only direct children of the base are kept.\n const filteredElements = domElements.filter((item) =>\n strict ? item.parentElement === base : true\n );\n\n if (overwrite) {\n if (Array.isArray(this._dom[elementType])) {\n this._dom[elementType] = filteredElements;\n } else {\n this._dom[elementType] = filteredElements[0] || null;\n }\n } else {\n if (Array.isArray(this._dom[elementType])) {\n this._dom[elementType] = [\n ...this._dom[elementType],\n ...filteredElements,\n ];\n } else {\n this._dom[elementType] = filteredElements[0] || null;\n }\n }\n } else {\n throw new Error(\n `Graupl ${this.constructor.name}: \"${elementType}\" is not a valid element type.`\n );\n }\n }\n\n /**\n * Resets DOM elements.\n *\n * Elements listed in _domLock cannot be reset using this method.\n *\n * @protected\n *\n * @param {string} elementType - The type of element to clear.\n */\n _resetDOMElementType(elementType) {\n if (typeof this.selectors[elementType] === \"string\") {\n if (this._domLock.includes(elementType)) {\n throw new Error(\n `Graupl ${this.constructor.name}: \"${elementType}\" element cannot be reset through _resetDOMElementType.`\n );\n }\n\n if (Array.isArray(this._dom[elementType])) {\n this._dom[elementType] = [];\n } else {\n this._dom[elementType] = null;\n }\n } else {\n throw new Error(\n `Graupl ${this.constructor.name}: \"${elementType}\" is not a valid element type.`\n );\n }\n }\n\n /**\n * Sets all DOM elements within the disclosure.\n *\n * Utilizes _setDOMElementType and\n * _resetDOMElementType.\n *\n * @protected\n */\n _setDOMElements() {\n this._resetDOMElementType(\"content\");\n this._setDOMElementType(\"content\");\n }\n\n /**\n * Expands the disclosure.\n *\n * Sets the controller's `aria-expanded` to \"true\", adds the\n * open class to the disclosure, and removes the closed class from the disclosure.\n *\n * @protected\n *\n * @fires grauplDisclosureExpand\n *\n * @param {boolean} [emit = true] - Emit the expand event once expanded.\n * @param {boolean} [transition = true] - Respect the transition class.\n */\n _expand(emit = true, transition = true) {\n this.dom.controller.setAttribute(\"aria-expanded\", \"true\");\n\n // If we're dealing with transition classes, then we need to utilize\n // requestAnimationFrame to add the transition class, remove the close class,\n // add the open class, and finally remove the transition class.\n if (transition && this.transitionlass !== \"\") {\n // this.dom.disclosure.style.height = `${this.dom.disclosure.getBoundingClientRect().height}px`;\n // console.log(this.dom.disclosure.style.height);\n addClass(this.transitionClass, this.dom.disclosure);\n\n requestAnimationFrame(() => {\n removeClass(this.closeClass, this.dom.disclosure);\n\n // this.dom.disclosure.style.height = `${this.dom.disclosure.getBoundingClientRect().height}px`;\n // console.log(this.dom.disclosure.style.height);\n\n requestAnimationFrame(() => {\n addClass(this.openClass, this.dom.disclosure);\n\n // this.dom.disclosure.style.height = `${this.dom.content.getBoundingClientRect().height}px`;\n // console.log(this.dom.disclosure.style.height);\n\n requestAnimationFrame(() => {\n setTimeout(() => {\n removeClass(this.transitionClass, this.dom.disclosure);\n\n // this.dom.disclosure.style.height = \"\";\n // console.log(this.dom.disclosure.style.height);\n }, this.openDuration);\n });\n });\n });\n } else {\n // Add the open class\n addClass(this.openClass, this.dom.disclosure);\n\n // Remove the close class.\n removeClass(this.closeClass, this.dom.disclosure);\n }\n\n this.dom.content.removeAttribute(\"inert\");\n\n if (emit) {\n this.dom.controller.dispatchEvent(this._expandEvent);\n }\n }\n\n /**\n * Collapses the disclosure.\n *\n * Sets the controller's `aria-expanded` to \"false\", adds the\n * close class to the disclosure, and removes the open class from the disclosure.\n *\n * @protected\n *\n * @fires grauplDisclosureCollapse\n *\n * @param {boolean} [emit = true] - Emit the collapse event once collapsed.\n * @param {boolean} [transition = true] - Respect the transition class.\n */\n _collapse(emit = true, transition = true) {\n this.dom.controller.setAttribute(\"aria-expanded\", \"false\");\n\n // If we're dealing with transition classes, then we need to utilize\n // requestAnimationFrame to add the transition class, remove the open class,\n // add the close class, and finally remove the transition class.\n if (transition && this.transitionClass !== \"\") {\n // this.dom.disclosure.style.height = `${this.dom.content.getBoundingClientRect().height}px`;\n // console.log(this.dom.disclosure.style.height);\n\n addClass(this.transitionClass, this.dom.disclosure);\n\n requestAnimationFrame(() => {\n removeClass(this.openClass, this.dom.disclosure);\n\n // this.dom.disclosure.style.height = `${this.dom.content.getBoundingClientRect().height}px`;\n // console.log(this.dom.disclosure.style.height);\n\n requestAnimationFrame(() => {\n addClass(this.closeClass, this.dom.disclosure);\n\n // this.dom.disclosure.style.height = `${this.dom.disclosure.getBoundingClientRect().height}px`;\n // console.log(this.dom.disclosure.style.height);\n\n requestAnimationFrame(() => {\n setTimeout(() => {\n removeClass(this.transitionClass, this.dom.disclosure);\n\n this.dom.content.innert = true;\n\n // this.dom.disclosure.style.height = \"\";\n // console.log(this.dom.disclosure.style.height);\n }, this.closeDuration);\n });\n });\n });\n } else {\n // Add the close class\n addClass(this.closeClass, this.dom.disclosure);\n\n // Remove the open class.\n removeClass(this.openClass, this.dom.disclosure);\n }\n\n this.dom.content.setAttribute(\"inert\", \"true\");\n\n if (emit) {\n this.dom.controller.dispatchEvent(this._collapseEvent);\n }\n }\n\n _handleResize() {\n if (this._breakpointWidth <= 0) {\n return;\n }\n\n let width = 0;\n\n this._observer = new ResizeObserver((entries) => {\n requestAnimationFrame(() => {\n for (const entry of entries) {\n const boxSize = Array.isArray(entry.contentBoxSize)\n ? entry.contentBoxSize[0]\n : entry.contentBoxSize;\n const inlineSize =\n boxSize && typeof boxSize.inlineSize === \"number\"\n ? boxSize.inlineSize\n : entry.contentRect.width;\n\n if (typeof inlineSize !== \"number\") continue;\n\n if (width === inlineSize) continue;\n\n const belowBreakpoint = inlineSize <= this.minWidth;\n const aboveBreakpoint = inlineSize > this.minWidth;\n\n if (belowBreakpoint && this.isOpen) {\n this.close({ preserveState: true });\n } else if (\n aboveBreakpoint &&\n !this.isOpen &&\n (this.hasOpened || this.shouldOpen)\n ) {\n this.open();\n }\n\n width = inlineSize;\n }\n });\n });\n this._observer.observe(document.body);\n }\n\n /**\n * Handles focus events throughout the disclosure.\n *\n * - Adds a `focusout` listener to the disclosure so when the disclosure loses focus it will close.\n */\n _handleFocus() {\n this.dom.disclosure.addEventListener(\"focusout\", (event) => {\n if (\n !this.closeOnBlur ||\n this.currentEvent !== \"keyboard\" ||\n event.relatedTarget === null ||\n this.dom.disclosure.contains(event.relatedTarget) ||\n this.dom.controller === event.relatedTarget\n ) {\n return;\n }\n\n this.close();\n });\n }\n\n /**\n * Handles click events throughout the disclosure.\n *\n * - Adds a `pointerup` listener to the controller that toggles the disclosure.\n * - Adds a `pointerup` listener to the `document` so if the user clicks outside the disclosure it will close.\n */\n _handleClick() {\n this.dom.controller.addEventListener(\"pointerup\", (event) => {\n this.currentEvent = \"mouse\";\n\n if (event.button !== 0) return;\n\n preventEvent(event);\n this.toggle();\n });\n\n document.addEventListener(\"pointerup\", (event) => {\n if (this.focusState !== \"self\" || !this.closeOnBlur) return;\n\n this.currentEvent = \"mouse\";\n\n if (\n !this.dom.disclosure.contains(event.target) &&\n this.dom.controller !== event.target\n ) {\n this.close();\n }\n });\n }\n\n /**\n * Handles keydown events throughout the disclosure.\n *\n * This method exists to assist the _handleKeyup method.\n *\n * - Adds a `keydown` listener to the controller.\n * - Blocks propagation on \"Space\" and \"Enter\" keys.\n * - Adds a `keydown` listener to the disclosure.\n * - Blocks propagation on \"Escape\" keys.\n */\n _handleKeydown() {\n this.dom.controller.addEventListener(\"keydown\", (event) => {\n this.currentEvent = \"keyboard\";\n\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n preventEvent(event);\n\n break;\n }\n });\n\n this.dom.disclosure.addEventListener(\"keydown\", (event) => {\n this.currentEvent = \"keyboard\";\n\n const key = keyPress(event);\n\n switch (key) {\n case \"Escape\":\n preventEvent(event);\n\n break;\n }\n });\n }\n\n /**\n * Handles keyup events throughout the disclosure.\n *\n * - Adds a `keyup` listener to the controller.\n * - Toggles the disclosure on \"Space\" and \"Enter\" keys.\n * - Adds a `keyup` listener to the disclosure.\n * - Closes the disclosure on \"Escape\" keys.\n */\n _handleKeyup() {\n this.dom.controller.addEventListener(\"keyup\", (event) => {\n this.currentEvent = \"keyboard\";\n\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n this.toggle();\n\n preventEvent(event);\n\n break;\n }\n });\n\n this.dom.disclosure.addEventListener(\"keyup\", (event) => {\n this.currentEvent = \"keyboard\";\n\n const key = keyPress(event);\n\n switch (key) {\n case \"Escape\":\n this.close();\n\n preventEvent(event);\n\n break;\n }\n });\n }\n\n /**\n * Opens the disclosure.\n *\n * Sets the disclosure's focus state to \"self\", calls expand, and sets isOpen to `true`.\n *\n * @public\n *\n * @param {Object<boolean>} [options = {}] - Options for opening the disclosure.\n * @param {boolean} [options.force = false] - Whether to force the open action.\n * @param {boolean} [options.preserveState = false] - Whether to preserve the open state.\n */\n open({ force = false, preserveState = false } = {}) {\n if (this.isOpen && !force) return;\n\n // Set the focus state.\n this.focusState = \"self\";\n\n // Expand the disclosure.\n this._expand();\n\n // Set the open state.\n this._open.value = true;\n\n if (!preserveState) {\n this._open.commit();\n }\n }\n\n /**\n * Opens the disclosure without entering it.\n *\n * Sets the disclosure's focus state to \"none\", calls expand, and sets isOpen to `true`.\n *\n * @public\n *\n * @param {Object<boolean>} [options = {}] - Options for previewing the disclosure.\n * @param {boolean} [options.force = false] - Whether to force the preview action.\n * @param {boolean} [options.preserveState = false] - Whether to preserve the open state.\n */\n preview({ force = false, preserveState = false } = {}) {\n if (this.isOpen && !force) return;\n\n // Set the focus state.\n this.focusState = \"none\";\n\n // Expand the disclosure.\n this._expand();\n\n // Set the open state.\n this._open.value = true;\n\n if (!preserveState) {\n this._open.commit();\n }\n }\n\n /**\n * Closes the disclosure.\n *\n * Sets the disclosure's focus state to \"none\", calls collapse, and sets isOpen to `false`.\n *\n * @public\n *\n * @param {Object<boolean>} [options = {}] - Options for closing the disclosure.\n * @param {boolean} [options.force = false] - Whether to force the close action.\n * @param {boolean} [options.preserveState = false] - Whether to preserve the open state.\n */\n close({ force = false, preserveState = false } = {}) {\n if (!this.isOpen && !force) return;\n\n // Set the focus state.\n this.focusState = \"none\";\n\n // Collapse the disclosure.\n this._collapse();\n\n // Set the open state.\n this._open.value = false;\n\n if (!preserveState) {\n this._open.commit();\n }\n }\n\n /**\n * Toggles the open state of the disclosure.\n *\n * @public\n *\n * @param {Object<boolean>} [options = {}] - Options for toggling the disclosure.\n * @param {boolean} [options.force = false] - Whether to force the open or close action.\n * @param {boolean} [options.preserveState = false] - Whether to preserve the open state.\n */\n toggle({ force = false, preserveState = false } = {}) {\n if (this.isOpen) {\n this.close({ force, preserveState });\n } else {\n this.open({ force, preserveState });\n }\n }\n}\n\nexport default Disclosure;\n","import Disclosure from \"./Disclosure.js\";\nimport once from \"@drupal/once\";\n\nconst generate = ({\n options = {},\n context = document,\n disclosureSelector = \".disclosure\",\n controllerSelector = \".disclosure-toggle\",\n} = {}) => {\n once(\"graupl-disclosure-generator\", disclosureSelector, context).forEach(\n (disclosureElement) => {\n const disclosureOptions = disclosureElement.dataset\n .grauplDisclosureOptions\n ? JSON.parse(\n disclosureElement.dataset.grauplDisclosureOptions.replace(/'/g, '\"')\n ) || {}\n : {};\n\n const targettedControllerSelector = `${controllerSelector}[data-graupl-disclosure-target=\"${disclosureElement.id}\"]`;\n const [controllerElement] = once(\n \"graupl-disclosure-generator\",\n targettedControllerSelector,\n context\n );\n\n if (!controllerElement) {\n console.warn(\n `No controller found for disclosure with ID \"${disclosureElement.id}\". Please ensure there is an element with the selector \"${targettedControllerSelector}\".`\n );\n\n once.remove(\"graupl-disclosure-generator\", disclosureElement);\n\n return;\n }\n\n new Disclosure({\n disclosureElement,\n controllerElement,\n initialize: true,\n ...options,\n ...disclosureOptions,\n });\n }\n );\n};\n\nexport default generate;\n","import accordionGenerator from \"./accordion/generator.js\";\nimport alertGenerator from \"./alert/generator.js\";\nimport carouselGenerator from \"./carousel/generator.js\";\nimport navigationGenerator from \"./navigation/generator.js\";\nimport disclosureGenerator from \"./disclosure/generator.js\";\n\ndocument.addEventListener(\"DOMContentLoaded\", () => {\n accordionGenerator();\n alertGenerator();\n carouselGenerator();\n navigationGenerator();\n disclosureGenerator();\n});\n"],"x_google_ignoreList":[6],"mappings":"YAeA,SAAgBwrB,EAAgBwC,EAAatZ,EAAU,CACrD,GAAI,CACF,GAAI,OAAOA,GAAa,SAAU,CAChC,MAAMvU,EAAe,OAAOuU,EAE5B,MAAM,IAAIT,UACR,qEAAqE9T,CAAAA,UAAY,EAIrF,UAAWmyB,KAAO5d,EAChB,GAAI,EAAEA,EAAS4d,CAAAA,YAAgBtE,GAAc,CAC3C,MAAMgF,EAAc,OAAOte,EAAS4d,CAAAA,EACpC,MAAM,IAAIre,UACR,GAAGqe,CAAAA,2BAA8BtE,EAAYqF,IAAAA,MAAUL,CAAAA,UAAW,EAKxE,MAAO,CACLxB,OAAQ,GACRd,MAAO,YAEFA,EAAO,CACd,MAAO,CACLc,OAAQ,GACRd,MAAAA,IAoBN,SAAgBhF,EAAYjiB,EAAM7I,EAAQ,CACxC,GAAI,CACF,GAAI,OAAOA,GAAW,SAAU,CAC9B,MAAMC,EAAa,OAAOD,EAE1B,MAAM,IAAIqT,UACR,+DAA+DpT,CAAAA,UAAU,EAI7E,UAAWyxB,KAAO1xB,EAAQ,CACxB,MAAME,EAAY,OAAOF,EAAO0xB,CAAAA,EAEhC,GAAIxxB,IAAc2I,EAChB,MAAM,IAAIwK,UAAU,GAAGqe,CAAAA,cAAiB7oB,CAAAA,MAAU3I,CAAAA,UAAS,EAI/D,MAAO,CACL0wB,OAAQ,GACRd,MAAO,YAEFA,EAAO,CACd,MAAO,CACLc,OAAQ,GACRd,MAAAA,IAgBN,SAAgB5E,EAAgBlrB,EAAQ,CACtC,GAAI,CACF,GAAI,OAAOA,GAAW,SAAU,CAC9B,MAAM6I,EAAO,OAAO7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EAASI,QAC9DC,GAAsB,CACrB,MAAMC,EAAoBD,EAAkBE,QACzCC,wBACCC,KAAKC,MACHL,EAAkBE,QAAQC,wBAAwBG,QAAQ,KAAM,GAAA,CAClE,GAAK,CAAA,EACL,CAAA,EAEEC,EAA8B,GAAGT,CAAAA,mCAAqDE,EAAkBQ,EAAAA,KACxG,CAACC,CAAAA,EAAqBjB,EAC1B,8BACAe,EACAZ,CAAAA,EAGF,GAAI,CAACc,EAAmB,CACtBC,QAAQC,KACN,+CAA+CX,EAAkBQ,EAAAA,2DAA6DD,CAAAA,IAA2B,EAG3Jf,EAAKoB,OAAO,8BAA+BZ,CAAAA,EAE3C,OAGF,IAAIT,GAAW,CACbS,kBAAAA,EACAS,kBAAAA,EACAI,WAAY,GACZ,GAAGnB,EACH,GAAGO,EACJ,KCnCPkB,SAASC,iBAAiB,mBAAA,IAA0B,CAClDN,EAAAA,EACAC,GAAAA,EACAC,GAAAA,EACAC,GAAAA,EACAC,GAAAA"}
|
|
1
|
+
{"version":3,"file":"graupl.js","names":["isValidInstance","constructor","elements","elementsType","TypeError","key","elementType","name","status","error","isValidType","type","values","valuesType","valueType","isQuerySelector","Error","document","querySelector","isValidClassList","Array","isArray","forEach","value","obj","isValidHoverType","validTypes","includes","join","isTag","tagName","HTMLElement","tag","toLowerCase","check","isValidState","validStates","isValidEvent","validEvents","addClass","className","element","length","classList","add","removeClass","remove","selectAllFocusableElements","context","document","querySelector","elements","Array","from","querySelectorAll","tabbableElements","filter","check","getAttribute","selectFirstFocusableElement","selectLastFocusableElement","selectNextFocusableElement","index","indexOf","selectPreviousFocusableElement","isTag","isValidType","addClass","removeClass","AccordionItem","_dom","item","toggle","header","content","_elements","parentAccordion","_open","_locked","_expandEvent","CustomEvent","bubbles","detail","_collapseEvent","constructor","accordionItemElement","accordionItemToggleElement","accordionItemHeaderElement","accordionItemContentElement","initialize","_setIds","_setAriaAttributes","dom","getAttribute","show","hide","elements","isOpen","isLocked","value","key","index","accordionItems","indexOf","id","setAttribute","emit","transition","closeClass","openClass","transitionClass","openDuration","requestAnimationFrame","style","height","getBoundingClientRect","setTimeout","allowMultipleExpand","unlockSiblings","closeSiblings","allowNoExpand","openAccordionItems","length","lock","dispatchEvent","closeDuration","focus","blur","unlock","removeAttribute","forEach","keyPress","event","key","keyCode","keys","Enter","Space","Escape","ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End","Tab","Object","find","preventEvent","preventDefault","stopPropagation","isValidType","initializeStorage","type","window","Graupl","getStorage","setStorage","data","clearStorage","pushToStorage","key","value","getFromStorage","removeFromStorage","AccordionItem","keyPress","preventEvent","isValidInstance","isValidType","isValidClassList","isQuerySelector","storage","Accordion","_dom","accordion","accordionItems","accordionItemToggles","accordionItemHeaders","accordionItemContents","_domLock","_selectors","_elements","_openClass","_closeClass","_transitionClass","_transitionDuration","_openDuration","_closeDuration","_optionalKeySupport","_allowMultipleExpand","_allowNoExpand","_currentChild","_prefix","_key","_errors","constructor","accordionElement","accordionItemSelector","accordionItemToggleSelector","accordionItemHeaderSelector","accordionItemContentSelector","openClass","closeClass","transitionClass","transitionDuration","openDuration","closeDuration","optionalKeySupport","allowMultipleExpand","allowNoExpand","prefix","key","initialize","_validate","Error","errors","join","_generateKey","_setDOMElements","_setIds","_createChildElements","_handleFocus","_handleClick","_handleKeydown","_handleKeyup","_setTransitionDurations","initializeStorage","pushToStorage","dom","id","error","console","currentChild","elements","selectors","currentAccordionItem","openAccordionItems","filter","item","isOpen","value","length","isArray","every","_accordionItems","_setDOMElementType","elementType","base","overwrite","strict","includes","name","HTMLElement","domElements","Array","from","querySelectorAll","filteredElements","parentElement","_resetDOMElementType","forEach","accordionItem","regenerate","Math","random","toString","replace","substring","index","accordionItemElement","accordionItemToggleElement","accordionItemHeaderElement","accordionItemContentElement","parentAccordion","push","check","htmlElementChecks","message","querySelectorChecks","openClassCheck","status","closeClassCheck","transitionClassCheck","transitionDurationCheck","openDurationCheck","closeDurationCheck","booleanCheck","keyCheck","prefixCheck","toggle","addEventListener","accordionToggle","event","ToggleKeys","optionalKeys","focusFirstChild","focusLastChild","focusNextChild","focusPreviousChild","style","setProperty","focusCurrentChild","focus","focusChild","blurCurrentChild","blur","openChildren","show","closeChildren","hide","wsRE","attrName","doc","document","attr","element","op","value","attrSelector","id","TypeError","test","RangeError","checkElement","itemToCheck","Element","getElements","selector","context","elements","Document","DocumentFragment","querySelectorAll","Array","prototype","slice","call","filterAndModify","apply","filter","selected","matches","updateAttribute","add","remove","result","trim","split","forEach","item","indexOf","push","attribute","join","once","find","Accordion","once","generate","options","context","document","accordionSelector","forEach","accordionElement","accordionOptions","dataset","grauplAccordionOptions","JSON","parse","replace","initialize","isValidClassList","isValidInstance","isValidType","addClass","removeClass","keyPress","preventEvent","storage","Alert","_dom","alert","controller","_hidden","_showClass","_hideClass","_transitionClass","_transitionTimer","_key","_errors","_showEvent","CustomEvent","bubbles","detail","_hideEvent","constructor","alertElement","controllerElement","showClass","hideClass","transitionClass","transitionTimer","isHidden","key","initialize","_validate","Error","errors","join","_generateKey","_setIds","_handleClick","_handleKeydown","_handleKeyup","initializeStorage","pushToStorage","dom","id","error","console","value","check","htmlElementChecks","HTMLElement","status","push","message","showClassCheck","hideClassCheck","transitionClassCheck","transitionTimerCheck","hiddenCheck","regenerate","Math","random","toString","replace","substring","show","emit","requestAnimationFrame","dispatchEvent","hide","setTimeout","addEventListener","event","Alert","once","generate","options","context","document","alertSelector","forEach","alertElement","alertOptions","dataset","grauplAlertOptions","JSON","parse","replace","controllerElement","querySelector","initialize","addClass","removeClass","preventEvent","keyPress","storage","isQuerySelector","isTag","isValidClassList","isValidInstance","isValidType","Carousel","_dom","carousel","carouselItems","carouselItemContainer","carouselControls","carouselControlContainer","carouselTabs","carouselTabContainer","autoplay","next","previous","_selectors","_activeClass","_previousClass","_nextClass","_playClass","_pauseClass","_currentItem","_autoplay","_transitionDelay","_transitionDuration","_playText","_pauseText","_currentAction","_autoplayInterval","_prefix","_key","_errors","constructor","carouselElement","carouselItemSelector","carouselItemContainerSelector","carouselControlSelector","carouselControlContainerSelector","carouselTabSelector","carouselTabContainerSelector","autoplaySelector","nextSelector","previousSelector","activeClass","previousClass","nextClass","playClass","pauseClass","transitionDelay","transitionDuration","playText","pauseText","prefix","key","initialize","_validate","Error","errors","join","_generateKey","_setDOMElements","_setIds","_setAriaAttributes","activateFirstItem","_handleAutoplay","_handleFocus","_handleClick","_handleHover","_handleKeydown","_handleKeyup","_setTransitionDuration","initializeStorage","pushToStorage","dom","id","error","console","selectors","currentItem","currentCarouselItem","currentCarouselTab","currentAction","value","length","tabs","querySelectorAll","carouselTab","forEach","item","index","setAttribute","check","htmlElementChecks","HTMLElement","push","message","querySelectorChecks","carouselItemsSelector","carouselControlsSelector","carouselTabsSelector","autoplayChecks","delayCheck","durationCheck","activeClassChecks","previousClassChecks","nextClassChecks","playClassChecks","pauseClassChecks","playTextChecks","pauseTextChecks","prefixChecks","_setDOMElementType","elementType","base","overwrite","Array","isArray","domElements","from","filteredElements","filter","parentElement","domElement","querySelector","_resetDOMElementType","regenerate","Math","random","toString","replace","substring","tab","getAttribute","_setInterval","_clearInterval","setInterval","activateNextItem","clearInterval","addEventListener","activatePreviousItem","toggleAutoplay","activateItem","control","event","style","setProperty","activateCurrentItem","deactivateCurrentItem","currentIndex","dataset","grauplAction","requestAnimationFrame","setTimeout","activateLastItem","Carousel","once","generate","options","context","document","carouselSelector","forEach","carouselElement","carouselOptions","dataset","grauplCarouselOptions","JSON","parse","replace","initialize","storage","once","generate","options","context","document","navigationSelector","forEach","navigationElement","MenuConstructor","dataset","grauplMenuType","DisclosureMenu","window","undefined","console","warn","menuOptions","grauplMenuOptions","JSON","parse","replace","menuElement","querySelector","controllerElement","containerElement","menu","menuItemSelector","menuLinkSelector","submenuItemSelector","submenuToggleSelector","initializeStorage","pushToStorage","dom","id","TransactionalValue","constructor","initialValue","options","_equals","equals","Object","is","_current","_committed","value","val","committed","isDirty","commit","reset","update","fn","isValidInstance","isValidClassList","isValidType","isValidState","isValidEvent","isTag","isQuerySelector","addClass","removeClass","keyPress","preventEvent","storage","TransactionalValue","Disclosure","_dom","controller","disclosure","content","_domLock","_selectors","_classes","open","close","transition","initialize","_durations","_focusState","_currentEvent","_open","_shouldOpen","_closeOnBlur","_breakpointWidth","_observer","_expandEvent","CustomEvent","bubbles","detail","_collapseEvent","_prefix","_key","_errors","constructor","disclosureElement","controllerElement","disclosureContentSelector","openClass","closeClass","transitionClass","transitionDuration","openDuration","closeDuration","closeOnBlur","minWidth","autoOpen","prefix","initializeClass","_validate","Error","errors","join","dom","_generateKey","_setDOMElements","_setIds","_setAriaAttributes","_handleFocus","_handleClick","_handleKeydown","_handleKeyup","_handleResize","_setTransitionDurations","initializeStorage","pushToStorage","id","getAttribute","shouldOpen","window","matchMedia","openQuery","matches","_expand","emit","_collapse","requestAnimationFrame","error","console","selectors","value","focusState","currentEvent","isOpen","hasOpened","committed","closeQuery","shouldFocus","check","key","htmlElementChecks","HTMLElement","status","push","message","querySelectors","querySelector","Object","keys","querySelectorChecks","classes","className","classListChecks","durations","durationName","durationChecks","prefixCheck","regenerate","Math","random","toString","replace","substring","setAttribute","style","setProperty","_setDOMElementType","elementType","base","overwrite","strict","includes","name","domElements","Array","from","querySelectorAll","filteredElements","filter","item","parentElement","isArray","_resetDOMElementType","transitionlass","setTimeout","removeAttribute","dispatchEvent","innert","width","ResizeObserver","entries","entry","boxSize","contentBoxSize","inlineSize","contentRect","belowBreakpoint","aboveBreakpoint","preserveState","observe","document","body","addEventListener","event","relatedTarget","contains","button","toggle","target","force","commit","preview","Disclosure","once","generate","options","context","document","disclosureSelector","controllerSelector","forEach","disclosureElement","disclosureOptions","dataset","grauplDisclosureOptions","JSON","parse","replace","targettedControllerSelector","id","controllerElement","console","warn","remove","initialize","accordionGenerator","alertGenerator","carouselGenerator","navigationGenerator","disclosureGenerator","document","addEventListener"],"sources":["../../src/js/validate.js","../../src/js/domHelpers.js","../../src/js/accordion/AccordionItem.js","../../src/js/eventHandlers.js","../../src/js/storage.js","../../src/js/accordion/Accordion.js","../../../../node_modules/@drupal/once/src/once.js","../../src/js/accordion/generator.js","../../src/js/alert/Alert.js","../../src/js/alert/generator.js","../../src/js/carousel/Carousel.js","../../src/js/carousel/generator.js","../../src/js/navigation/generator.js","../../src/js/TransactionalValue.js","../../src/js/disclosure/Disclosure.js","../../src/js/disclosure/generator.js","../../src/js/main.js"],"sourcesContent":["/**\n * Check to see if the provided elements have a specific constructor.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * This is essentially just a wrapper function around checking instanceof with\n * more descriptive error message to help debugging.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {object} constructor - The constructor to check for.\n * @param {object} elements - The element(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidInstance(constructor, elements) {\n try {\n if (typeof elements !== \"object\") {\n const elementsType = typeof elements;\n\n throw new TypeError(\n `Elements given to isValidInstance() must be inside of an object. \"${elementsType}\" given.`\n );\n }\n\n for (const key in elements) {\n if (!(elements[key] instanceof constructor)) {\n const elementType = typeof elements[key];\n throw new TypeError(\n `${key} must be an instance of ${constructor.name}. \"${elementType}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Check to see if the provided values are of a specific type.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * This is essentially just a wrapper function around checking typeof with\n * more descriptive error message to help debugging.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {string} type - The type to check for.\n * @param {object} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidType(type, values) {\n try {\n if (typeof values !== \"object\") {\n const valuesType = typeof values;\n\n throw new TypeError(\n `Values given to isValidType() must be inside of an object. \"${valuesType}\" given.`\n );\n }\n\n for (const key in values) {\n const valueType = typeof values[key];\n\n if (valueType !== type) {\n throw new TypeError(`${key} must be a ${type}. \"${valueType}\" given.`);\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Checks to see if the provided values are valid query selectors.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isQuerySelector(values) {\n try {\n if (typeof values !== \"object\") {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isQuerySelector() must be inside of an object. \"${type}\" given.`\n );\n }\n\n for (const key in values) {\n try {\n if (values[key] === null) {\n throw new Error();\n }\n\n document.querySelector(values[key]);\n } catch {\n throw new TypeError(\n `${key} must be a valid query selector. \"${values[key]}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Checks to see if the provided value is either a string or an array of strings.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string, string[]>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidClassList(values) {\n try {\n if (typeof values !== \"object\" || Array.isArray(values)) {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isValidClassList() must be inside of an object. \"${type}\" given.`\n );\n }\n\n for (const key in values) {\n const type = typeof values[key];\n\n if (type !== \"string\") {\n if (Array.isArray(values[key])) {\n values[key].forEach((value) => {\n if (typeof value !== \"string\") {\n throw new TypeError(\n `${key} must be a string or an array of strings. An array containing non-strings given.`\n );\n }\n });\n } else {\n throw new TypeError(\n `${key} must be a string or an array of strings. \"${type}\" given.`\n );\n }\n } else {\n const obj = {};\n obj[key] = values[key];\n\n isQuerySelector(obj);\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Check to see if the provided values are valid hover types.\n *\n * Available types are: `\"off\"`, `\"on\"`, and `\"dynamic\"`.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidHoverType(values) {\n try {\n if (typeof values !== \"object\") {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isValidHoverType() must be inside of an object. \"${type}\" given.`\n );\n }\n\n const validTypes = [\"off\", \"on\", \"dynamic\"];\n\n for (const key in values) {\n if (!validTypes.includes(values[key])) {\n throw new TypeError(\n `${key} must be one of the following values: ${validTypes.join(\n \", \"\n )}. \"${values[key]}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Checks to see if the provided elements are using a specific tag.\n *\n * The elements must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `true` if the check is successful.\n *\n * @param {string} tagName - The name of the tag.\n * @param {Object<HTMLElement>} elements - The element(s) to check.\n * @return {boolean} - The result of the check.\n */\nexport function isTag(tagName, elements) {\n if (\n isValidType(\"string\", { tagName }).status &&\n isValidInstance(HTMLElement, elements).status\n ) {\n const tag = tagName.toLowerCase();\n let check = true;\n\n for (const key in elements) {\n if (elements[key].tagName.toLowerCase() !== tag) check = false;\n }\n\n return check;\n } else {\n return false;\n }\n}\n\n/**\n * Check to see if the provided values are valid focus states for a menu.\n *\n * Available states are: `\"none\"`, `\"self\"`, and `\"child\"`.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidState(values) {\n try {\n if (typeof values !== \"object\") {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isValidState() must be inside of an object. \"${type}\" given.`\n );\n }\n\n const validStates = [\"none\", \"self\", \"child\"];\n\n for (const key in values) {\n if (!validStates.includes(values[key])) {\n throw new TypeError(\n `${key} must be one of the following values: ${validStates.join(\n \", \"\n )}. \"${values[key]}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Check to see if the provided values are valid event types for a menu.\n *\n * Available events are: `\"none\"`, `\"mouse\"`, `\"keyboard\"`, and `\"character\"`.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidEvent(values) {\n try {\n if (typeof values !== \"object\") {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isValidEvent() must be inside of an object. \"${type}\" given.`\n );\n }\n\n const validEvents = [\"none\", \"mouse\", \"keyboard\", \"character\"];\n\n for (const key in values) {\n if (!validEvents.includes(values[key])) {\n throw new TypeError(\n `${key} must be one of the following values: ${validEvents.join(\n \", \"\n )}. \"${values[key]}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n","/**\n * Add a class or array of classes to an element.\n *\n * @param {string|string[]} className - The class or classes to add.\n * @param {HTMLElement} element - The element to add the class to.\n */\nexport function addClass(className, element) {\n // Gracefully handle empty strings or arrays.\n if (className === \"\" || className.length === 0) {\n return;\n }\n\n if (typeof className === \"string\") {\n element.classList.add(className);\n } else {\n element.classList.add(...className);\n }\n}\n\n/**\n * Remove a class or array of classes from an element.\n *\n * @param {string|string[]} className - The class or classes to remove.\n * @param {HTMLElement} element - The element to remove the class from.\n */\nexport function removeClass(className, element) {\n // Gracefully handle empty strings or arrays.\n if (className === \"\" || className.length === 0) {\n return;\n }\n\n if (typeof className === \"string\") {\n element.classList.remove(className);\n } else {\n element.classList.remove(...className);\n }\n}\n\n/**\n * Select all focusable elements within a given context.\n *\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @return {HTMLElement[]} - An array of focusable elements.\n */\nexport function selectAllFocusableElements(context = document) {\n const querySelector =\n \"a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),[tabindex]\";\n const elements = Array.from(context.querySelectorAll(querySelector));\n\n const tabbableElements = elements.filter((element) => {\n let check = true;\n\n if (element.getAttribute(\"tabindex\") === \"-1\") check = false;\n\n return check;\n });\n\n return tabbableElements;\n}\n\n/**\n * Select the first focusable element within a given context.\n *\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @return {HTMLElement|boolean} - The first focusable element or false if none found.\n */\nexport function selectFirstFocusableElement(context = document) {\n const tabbableElements = selectAllFocusableElements(context);\n\n return tabbableElements[0] || false;\n}\n\n/**\n * Select the last focusable element within a given context.\n *\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @return {HTMLElement|boolean} - The last focusable element or false if none found.\n */\nexport function selectLastFocusableElement(context = document) {\n const tabbableElements = selectAllFocusableElements(context);\n\n return tabbableElements[tabbableElements.length - 1] || false;\n}\n\n/**\n * Select the next focusable element relative to the given element within a context.\n *\n * @param {HTMLElement} element - The reference element.\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @return {HTMLElement|boolean} - The next focusable element or false if none found.\n */\nexport function selectNextFocusableElement(element, context = document) {\n const tabbableElements = selectAllFocusableElements(context);\n const index = tabbableElements.indexOf(element);\n\n return index === tabbableElements.length - 1\n ? false\n : tabbableElements[index + 1];\n}\n\n/**\n * Select the previous focusable element relative to the given element within a context.\n *\n * @param {HTMLElement} element - The reference element.\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @return {HTMLElement|boolean} - The previous focusable element or false if none found.\n */\nexport function selectPreviousFocusableElement(element, context = document) {\n const tabbableElements = selectAllFocusableElements(context);\n const index = tabbableElements.indexOf(element);\n\n return index === 0 ? false : tabbableElements[index - 1];\n}\n","/**\n * @file\n * The Accordion Item class.\n */\n\n/* global Accordion */\n\nimport { isTag, isValidType } from \"../validate.js\";\nimport { addClass, removeClass } from \"../domHelpers.js\";\n\n/**\n * Creates a new accordion item.\n *\n * @class\n */\nclass AccordionItem {\n /**\n * The HTML elements for the accordion item in the DOM.\n *\n * @protected\n *\n * @type {Object<HTMLElement>}\n *\n * @property {HTMLElement} item - The accordion item element.\n * @property {HTMLElement} toggle - The controller element.\n * @property {HTMLElement} header - The header element.\n * @property {HTMLElement} content - The content element.\n */\n _dom = {\n item: null,\n toggle: null,\n header: null,\n content: null,\n };\n\n /**\n * The declared graupl accordion elements within the accordion item.\n *\n * @protected\n *\n * @type {Object<Accordion>}\n *\n * @property {Accordion} parentAccordion - The parent accordion containing this item.\n */\n _elements = {\n parentAccordion: null,\n };\n\n /**\n * The open state of the accordion.\n *\n * @protected\n *\n * @type {boolean}\n */\n _open = false;\n\n /**\n * The locked state of the accordions item.\n *\n * If locked, the accordion item cannot be closed.\n *\n * @protected\n *\n * @type {boolean}\n */\n _locked = false;\n\n /**\n * The event that is triggered when the accordion item is shown.\n *\n * @protected\n *\n * @event grauplAccordionItemExpand\n *\n * @type {CustomEvent}\n *\n * @property {boolean} bubbles - A flag to bubble the event.\n * @property {Object<AccordionItem>} detail - The details object containing the Accordion item itself.\n */\n _expandEvent = new CustomEvent(\"grauplAccordionItemExpand\", {\n bubbles: true,\n detail: { item: this },\n });\n\n /**\n * The event that is triggered when the accordion item is hidden.\n *\n * @protected\n *\n * @event grauplAccordionItemCollapse\n *\n * @type {CustomEvent}\n *\n * @property {boolean} bubbles - A flag to bubble the event.\n * @property {Object<AccordionItem>} detail - The details object containing the Accordion item itself.\n */\n _collapseEvent = new CustomEvent(\"grauplAccordionItemCollapse\", {\n bubbles: true,\n detail: { item: this },\n });\n\n /**\n * Constructs a new Accordion item object.\n *\n * @class\n *\n * @param {object} options - The options object.\n * @param {HTMLElement} options.accordionItemElement - The accordion item element.\n * @param {HTMLElement} options.accordionItemToggleElement - The toggle element.\n * @param {HTMLElement} options.accordionItemHeaderElement - The header element.\n * @param {HTMLElement} options.accordionItemContentElement - The content element.\n * @param {Accordion} [options.parentAccordion = null] - The accordion containing this item.\n */\n constructor({\n accordionItemElement,\n accordionItemToggleElement,\n accordionItemHeaderElement,\n accordionItemContentElement,\n parentAccordion = null,\n }) {\n // Set DOM elements.\n this._dom.item = accordionItemElement;\n this._dom.toggle = accordionItemToggleElement;\n this._dom.header = accordionItemHeaderElement;\n this._dom.content = accordionItemContentElement;\n\n // Set the accordion elements.\n this._elements.parentAccordion = parentAccordion;\n }\n\n /**\n * Initializes the accordion item.\n */\n initialize() {\n // Set the IDs for the accordion item and it's elements if they don't exist.\n this._setIds();\n\n // Set the ARIA attributes for the accordion item and it's elements.\n this._setAriaAttributes();\n\n // Set the initial state of the accordion item.\n if (this.dom.toggle.getAttribute(\"aria-expanded\") === \"true\") {\n this.show(false, false);\n } else {\n this.hide(false, false);\n }\n }\n\n /**\n * The HTML elements for the accordion item in the DOM.\n *\n * @readonly\n *\n * @type {object}\n *\n * @see _dom\n */\n get dom() {\n return this._dom;\n }\n\n /**\n * The declared graupl accordion elements within the accordion item.\n *\n * @readonly\n *\n * @type {Object<Accordion>}\n *\n * @see _elements\n */\n get elements() {\n return this._elements;\n }\n\n /**\n * The open state of the accordion.\n *\n * @readonly\n *\n * @type {object}\n *\n * @see _open\n */\n get isOpen() {\n return this._open;\n }\n\n /**\n * The locked state of the accordions item.\n *\n * If locked, the accordion item cannot be closed.\n *\n * @readonly\n *\n * @type {boolean}\n *\n * @see _locked\n */\n get isLocked() {\n return this._locked;\n }\n\n set isOpen(value) {\n isValidType(\"boolean\", { value });\n\n if (this._open !== value) {\n this._open = value;\n }\n }\n\n /**\n * Sets the IDs for the accordion item and it's elements if they don't exist.\n *\n * The generated IDs use the parent accordion's key and follows the pattern:\n * - Accordion item: `accordion-item-{key}-{index}`\n * - Accordion item toggle: `accordion-item-toggle-{key}-{index}`\n * - Accordion item content: `accordion-item-content-{key}-{index}`\n */\n _setIds() {\n // Get the required information for IDs.\n const { key } = this.elements.parentAccordion;\n const index = this.elements.parentAccordion.dom.accordionItems.indexOf(\n this.dom.item\n );\n\n this.dom.item.id = this.dom.item.id || `accordion-item-${key}-${index}`;\n this.dom.toggle.id =\n this.dom.toggle.id || `accordion-item-toggle-${key}-${index}`;\n this.dom.header.id =\n this.dom.header.id || `accordion-item-header-${key}-${index}`;\n this.dom.content.id =\n this.dom.content.id || `accordion-item-content-${key}-${index}`;\n }\n\n /**\n * Sets the ARIA attributes for the accordion item and it's elements.\n */\n _setAriaAttributes() {\n // Set the ARIA attributes for the accordion item toggle.\n // If the toggle is not a button, then set the role to \"button\".\n if (!isTag(\"button\", { toggle: this.dom.toggle })) {\n this.dom.toggle.setAttribute(\"role\", \"button\");\n }\n\n // If aria-expanded is not explicitly set to \"true\", then set it to \"false\".\n if (this.dom.toggle.getAttribute(\"aria-expanded\") !== \"true\") {\n this.dom.toggle.setAttribute(\"aria-expanded\", \"false\");\n }\n\n // Set the aria-controls attribute for the toggle.\n this.dom.toggle.setAttribute(\"aria-controls\", this.dom.content.id);\n\n // Set the ARIA attributes for the accordion item content.\n // If the content is not a section, then set the role to \"region\".\n if (!isTag(\"section\", { content: this.dom.content })) {\n this.dom.content.setAttribute(\"role\", \"region\");\n }\n\n // Set the aria-labelledby attribute for the content.\n this.dom.content.setAttribute(\"aria-labelledby\", this.dom.toggle.id);\n }\n\n /**\n * Shows the accordion item.\n *\n * @public\n *\n * @fires grauplAccordionItemExpand\n *\n * @param {boolean} [emit = true] - Emit the show event once shown.\n * @param {boolean} [transition = true] - Respect the transition class.\n */\n show(emit = true, transition = true) {\n if (this._open) {\n return;\n }\n\n const { closeClass, openClass, transitionClass, openDuration } =\n this.elements.parentAccordion;\n\n // Set aria-expanded to true when hiding accordion item.\n this.dom.toggle.setAttribute(\"aria-expanded\", \"true\");\n\n // If we're dealing with transition classes, then we need to utilize\n // requestAnimationFrame to add the transition class, remove the hide class,\n // add the show class, and finally remove the transition class.\n //\n // If `transition` is false, then it doesn't matter if the transition class\n // is set. Do not use the transition.\n if (transition && transitionClass !== \"\") {\n addClass(transitionClass, this.dom.item);\n\n requestAnimationFrame(() => {\n removeClass(closeClass, this.dom.item);\n\n this.dom.item.style.height = `${this.dom.header.getBoundingClientRect().height}px`;\n\n requestAnimationFrame(() => {\n addClass(openClass, this.dom.item);\n\n this.dom.item.style.height = `${this.dom.header.getBoundingClientRect().height + this.dom.content.getBoundingClientRect().height}px`;\n\n requestAnimationFrame(() => {\n setTimeout(() => {\n removeClass(transitionClass, this.dom.item);\n\n this.dom.item.style.height = \"\";\n }, openDuration);\n });\n });\n });\n } else {\n // Add the show class\n addClass(openClass, this.dom.item);\n\n // Remove the hide class.\n removeClass(closeClass, this.dom.item);\n }\n\n this._open = true;\n\n // If the parent accordion only allows a single item to be open at a time,\n // then close all other items.\n if (!this.elements.parentAccordion.allowMultipleExpand) {\n this.unlockSiblings();\n this.closeSiblings();\n }\n\n // If the parent accordion requires at least one item to be open, and this\n // is the only open item, then lock it. Otherwise, unlock all siblings.\n if (!this.elements.parentAccordion.allowNoExpand) {\n if (this.elements.parentAccordion.openAccordionItems.length <= 1) {\n this.lock();\n } else {\n this.unlockSiblings();\n }\n }\n\n if (emit) {\n this.dom.item.dispatchEvent(this._expandEvent);\n }\n }\n\n /**\n * Hides the accordion item.\n *\n * @public\n *\n * @fires grauplAccordionItemCollapse\n *\n * @param {boolean} [emit = true] - Emit the show event once shown.\n * @param {boolean} [transition = true] - Respect the transition class.\n */\n hide(emit = true, transition = true) {\n if (!this._open) {\n return;\n }\n\n if (\n !this.elements.parentAccordion.allowNoExpand &&\n this.elements.parentAccordion.openAccordionItems.length <= 1\n ) {\n return;\n }\n\n const { closeClass, openClass, transitionClass, closeDuration } =\n this.elements.parentAccordion;\n\n // Set aria-expanded to false when hiding accordion item.\n this.dom.toggle.setAttribute(\"aria-expanded\", \"false\");\n\n // If we're dealing with transition classes, then we need to utilize\n // requestAnimationFrame to add the transition class, remove the show class,\n // add the hide class, and finally remove the transition class.\n //\n // If `transition` is false, then it doesn't matter if the transition class\n // is set. Do not use the transition.\n if (transition && transitionClass !== \"\") {\n addClass(transitionClass, this.dom.item);\n this.dom.item.style.height = `${this.dom.item.getBoundingClientRect().height}px`;\n\n requestAnimationFrame(() => {\n removeClass(openClass, this.dom.item);\n this.dom.item.style.height = `${this.dom.header.getBoundingClientRect().height}px`;\n\n requestAnimationFrame(() => {\n addClass(closeClass, this.dom.item);\n\n requestAnimationFrame(() => {\n setTimeout(() => {\n removeClass(transitionClass, this.dom.item);\n\n this.dom.item.style.height = \"\";\n }, closeDuration);\n });\n });\n });\n } else {\n // Add the hide class\n addClass(closeClass, this.dom.item);\n\n // Remove the show class.\n removeClass(openClass, this.dom.item);\n }\n\n this._open = false;\n\n // If the parent accordion requires at least one item to be open, and this was\n // the second to last open item, then lock to last open item.\n if (\n !this.elements.parentAccordion.allowNoExpand &&\n this.elements.parentAccordion.openAccordionItems.length === 1\n ) {\n this.elements.parentAccordion.openAccordionItems[0].lock();\n }\n\n if (emit) {\n this.dom.item.dispatchEvent(this._collapseEvent);\n }\n }\n\n /**\n * Toggle the accordion item.\n *\n * @public\n */\n toggle() {\n this.isOpen ? this.hide() : this.show();\n }\n\n /**\n * Focuses the accordion item.\n *\n * @public\n */\n focus() {\n this.dom.toggle.focus();\n }\n\n /**\n * Blurs the accordion item.\n *\n * @public\n */\n blur() {\n this.dom.toggle.blur();\n }\n\n /**\n * Locks the accordion item.\n *\n * @public\n */\n lock() {\n this._locked = true;\n this.dom.toggle.setAttribute(\"disabled\", \"true\");\n }\n\n /**\n * Unlocks the accordion item.\n *\n * @public\n */\n unlock() {\n this._locked = false;\n this.dom.toggle.removeAttribute(\"disabled\");\n }\n\n closeSiblings() {\n if (this.elements.parentAccordion) {\n this.elements.parentAccordion.elements.accordionItems.forEach((item) => {\n if (item !== this) {\n item.hide();\n }\n });\n }\n }\n\n /**\n * Unlocks the siblings of the accordion item.\n *\n * @public\n */\n unlockSiblings() {\n if (this.elements.parentAccordion) {\n this.elements.parentAccordion.elements.accordionItems.forEach((item) => {\n if (item !== this) {\n item.unlock();\n }\n });\n }\n }\n}\n\nexport default AccordionItem;\n","/**\n * Retrieves the pressed key from an event.\n *\n * @param {KeyboardEvent} event - The keyboard event.\n * @return {string} - The name of the key or an empty string.\n */\nexport function keyPress(event) {\n try {\n // Use event.key or event.keyCode to support older browsers.\n const key = event.key || event.keyCode;\n const keys = {\n Enter: key === \"Enter\" || key === 13,\n Space: key === \" \" || key === \"Spacebar\" || key === 32,\n Escape: key === \"Escape\" || key === \"Esc\" || key === 27,\n ArrowUp: key === \"ArrowUp\" || key === \"Up\" || key === 38,\n ArrowRight: key === \"ArrowRight\" || key === \"Right\" || key === 39,\n ArrowDown: key === \"ArrowDown\" || key === \"Down\" || key === 40,\n ArrowLeft: key === \"ArrowLeft\" || key === \"Left\" || key === 37,\n Home: key === \"Home\" || key === 36,\n End: key === \"End\" || key === 35,\n Tab: key === \"Tab\" || key === 9,\n };\n\n return Object.keys(keys).find((key) => keys[key] === true) || \"\";\n } catch {\n // Return an empty string if something goes wrong.\n return \"\";\n }\n}\n\n/**\n * Stops an event from taking action.\n *\n * @param {Event} event - The event.\n */\nexport function preventEvent(event) {\n event.preventDefault();\n event.stopPropagation();\n}\n","/**\n * @file\n * Provides a system to get and store Graupl data in the browser.\n */\n\nimport { isValidType } from \"./validate.js\";\n\n/**\n * Initializes the storage system.\n *\n * @param {?string} [type = null] - The type of storage to initialize.\n */\nexport function initializeStorage(type = null) {\n window.Graupl = window.Graupl || {};\n\n if (isValidType(\"string\", { type })) {\n window.Graupl[type] = window.Graupl[type] || {};\n }\n}\n\n/**\n * Get the storage object.\n *\n * @param {?string} type - The type of storage to get.\n * @return {object} - The storage object.\n */\nexport function getStorage(type = null) {\n if (isValidType(\"string\", { type })) {\n return window.Graupl[type];\n }\n\n return window.Graupl;\n}\n\n/**\n * Set the storage object of a given type.\n *\n * @param {string} type - The type of storage to set.\n * @param {object} data - The data to set.\n */\nexport function setStorage(type, data = {}) {\n if (isValidType(\"string\", { type }) && isValidType(\"object\", { data })) {\n window.Graupl[type] = data;\n }\n}\n\n/**\n * Clear the storage object of a given type.\n *\n * @param {string} type - The type of storage to clear.\n */\nexport function clearStorage(type) {\n if (isValidType(\"string\", { type })) {\n window.Graupl[type] = {};\n }\n}\n\n/**\n * Push a value to the storage object.\n *\n * @param {string} type - The type of storage to push to.\n * @param {string} key - The key to use for the value.\n * @param {*} value - The value to store.\n */\nexport function pushToStorage(type, key, value) {\n if (isValidType(\"string\", { type, key })) {\n window.Graupl[type][key] = value;\n }\n}\n\n/**\n * Get a value from the storage object.\n *\n * @param {string }type - The type of storage to get from.\n * @param {string }key - The key to get the value from.\n * @return {*} - The value from the storage object.\n */\nexport function getFromStorage(type, key) {\n if (isValidType(\"string\", { type, key })) {\n return window.Graupl[type][key];\n }\n\n return null;\n}\n\n/**\n * Remove a value from the storage object.\n *\n * @param {string} type - The type of storage to remove from.\n * @param {string} key - The key to remove the value from.\n */\nexport function removeFromStorage(type, key) {\n if (isValidType(\"string\", { type, key })) {\n delete window.Graupl[type][key];\n }\n}\n\nexport default {\n initializeStorage,\n getStorage,\n setStorage,\n clearStorage,\n pushToStorage,\n getFromStorage,\n removeFromStorage,\n};\n","/**\n * @file\n * The Accordion class.\n */\n\nimport AccordionItem from \"./AccordionItem.js\";\nimport { keyPress, preventEvent } from \"../eventHandlers.js\";\nimport {\n isValidInstance,\n isValidType,\n isValidClassList,\n isQuerySelector,\n} from \"../validate.js\";\nimport storage from \"../storage.js\";\n\nclass Accordion {\n /**\n * The DOM elements within the accordion.\n *\n * @protected\n *\n * @type {Object<HTMLElement, HTMLElement[]>}\n *\n * @property {HTMLElement} accordion - The accordion element.\n * @property {HTMLElement[]} accordionItems - An array of accordion items.\n * @property {HTMLElement[]} accordionItemToggles - An array of accordion item toggles.\n * @property {HTMLElement[]} accordionItemHeaders - An array of accordion headers.\n * @property {HTMLElement[]} accordionItemContents - An array of accordion item contents.\n */\n _dom = {\n accordion: null,\n accordionItems: [],\n accordionItemToggles: [],\n accordionItemHeaders: [],\n accordionItemContents: [],\n };\n\n /**\n * The DOM elements within the accordion that cannot be reset or generated by the accordion.\n *\n * @protected\n *\n * @type {string[]}\n */\n _domLock = [\"accordion\"];\n\n /**\n * The query selectors used by the accordion.\n *\n * @protected\n *\n * @type {Object<string>}\n *\n * @property {string} accordionItems - The query selector for accordion items.\n * @property {string} accordionItemToggles - The query selector for accordion toggles.\n * @property {string} accordionItemHeaders - The query selector for accordion headers.\n * @property {string} accordionItemContents - The query selector for accordion contents.\n */\n _selectors = {\n accordionItems: \"\",\n accordionItemToggles: \"\",\n accordionItemHeaders: \"\",\n accordionItemContents: \"\",\n };\n\n /**\n * The list of accordion items.\n *\n * @protected\n *\n * @type {Object<AccordionItem[]>}\n *\n * @property {AccordionItem[]} accordionItems - The list of accordion items.\n */\n _elements = {\n accordionItems: [],\n };\n\n /**\n * The class(es) to apply when the accordion is open.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _openClass = \"show\";\n\n /**\n * The class(es) to apply when the accordion is closed.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _closeClass = \"hide\";\n\n /**\n * The class(es) to apply when the accordion is transitioning between states.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _transitionClass = \"transitioning\";\n\n /**\n * The duration time (in milliseconds) for the transition between open and closed states.\n *\n * @protected\n *\n * @type {number}\n */\n _transitionDuration = 300;\n\n /**\n * The duration time (in milliseconds) for the transition from closed to open states.\n *\n * @protected\n *\n * @type {number}\n */\n _openDuration = -1;\n\n /**\n * The duration time (in milliseconds) for the transition from open to closed states.\n *\n * @protected\n *\n * @type {number}\n */\n _closeDuration = -1;\n\n /**\n * A flag to decide if the accordion items can be navigated by arrows.\n *\n * @protected\n *\n * @type {boolean}\n */\n _optionalKeySupport = true;\n\n /**\n * A flag to decide if multiple accordions can be open at the same time.\n *\n * If set to false, only one accordion can be open at a time.\n *\n * @protected\n *\n * @type {boolean}\n */\n _allowMultipleExpand = true;\n\n /**\n * A flag to decide if no accordions can be opened at the same time.\n *\n * If set to false, at least one accordion must be open at all times.\n *\n * @protected\n *\n * @type {boolean}\n */\n _allowNoExpand = true;\n\n /**\n * The index of the current child node.\n *\n * @protected\n *\n * @type {number}\n */\n _currentChild = 0;\n\n /**\n * The prefix to use for CSS custom properties.\n *\n * @protected\n *\n * @type {string}\n */\n _prefix = \"graupl-\";\n\n /**\n * The key used to generate IDs throughout the accordion.\n *\n * @protected\n *\n * @type {string}\n */\n _key = \"\";\n\n /**\n * errors - The list of errors found during validation.\n *\n * @protected\n *\n * @type {string[]}\n */\n _errors = [];\n\n /**\n * Constructs a new `Accordion`.\n *\n * @param {object} options - The options for generating the accordion.\n * @param {HTMLElement} [options.accordionElement] - The accordion element in the DOM.\n * @param {string} [options.accordionItemSelector = .accordion-item] - The query selector string for accordion items.\n * @param {string} [options.accordionItemToggleSelector = .accordion-item-toggle] - The query selector string for accordion toggle.\n * @param {string} [options.accordionItemHeaderSelector = .accordion-item-header] - The query selector string for accordion header.\n * @param {string} [options.accordionItemContentSelector = .accordion-item-content] - The query selector string for accordion content.\n * @param {?(string|string[])} [options.openClass = show] - The class to apply when a accordion is \"open\".\n * @param {?(string|string[])} [options.closeClass = hide] - The class to apply when a accordion is \"closed\".\n * @param {?(string|string[])} [options.transitionClass = transitioning] - The class to apply when a accordion is transitioning between \"open\" and \"closed\" states.\n * @param {number} [options.transitionDuration = 300] - The duration of the transition between \"open\" and \"closed\" states (in milliseconds).\n * @param {number} [options.openDuration = -1] - The duration of the transition from \"closed\" to \"open\" states (in milliseconds).\n * @param {number} [options.closeDuration = -1] - The duration of the transition from \"open\" to \"closed\" states (in milliseconds).\n * @param {boolean} [options.optionalKeySupport = false] - A flag to determine if accordions can be navigated with arrows.\n * @param {boolean} [options.allowMultipleExpand = true] - A flag to determine if multiple accordions can be open at the same time.\n * @param {boolean} [options.allowNoExpand = true] - A flag to determine if no accordions can be open at the same time.\n * @param {?string} [options.prefix = graupl-] - The prefix to use for CSS custom properties.\n * @param {?string} [options.key = null] - The key used to generate IDs throughout the accordion.\n * @param {boolean} [options.initialize = false] - A flag to initialize the accordion immediately upon creation.\n */\n constructor({\n accordionElement,\n accordionItemSelector = \".accordion-item\",\n accordionItemToggleSelector = \".accordion-item-toggle\",\n accordionItemHeaderSelector = \".accordion-item-header\",\n accordionItemContentSelector = \".accordion-item-content\",\n openClass = \"show\",\n closeClass = \"hide\",\n transitionClass = \"transitioning\",\n transitionDuration = 300,\n openDuration = -1,\n closeDuration = -1,\n optionalKeySupport = false,\n allowMultipleExpand = true,\n allowNoExpand = true,\n prefix = \"graupl-\",\n key = null,\n initialize = false,\n }) {\n // Set DOM elements.\n this._dom.accordion = accordionElement;\n\n // Set DOM selectors.\n this._selectors.accordionItems = accordionItemSelector;\n this._selectors.accordionItemToggles = accordionItemToggleSelector;\n this._selectors.accordionItemHeaders = accordionItemHeaderSelector;\n this._selectors.accordionItemContents = accordionItemContentSelector;\n\n // Set open/close classes.\n this._openClass = openClass || \"\";\n this._closeClass = closeClass || \"\";\n this._transitionClass = transitionClass || \"\";\n\n // Set transition duration.\n this._transitionDuration = transitionDuration;\n this._openDuration = openDuration;\n this._closeDuration = closeDuration;\n\n // Set optional key support.\n this._optionalKeySupport = optionalKeySupport;\n\n // Set expand rules.\n this._allowMultipleExpand = allowMultipleExpand;\n this._allowNoExpand = allowNoExpand;\n\n // Set prefix.\n this._prefix = prefix || \"\";\n\n // Set the key.\n this._key = key || \"\";\n\n if (initialize) {\n this.initialize();\n }\n }\n\n /**\n * Initializes the accordion.\n */\n initialize() {\n try {\n if (!this._validate()) {\n throw new Error(\n `Graupl Accordion: cannot initialize accordion. The following errors have been found:\\n - ${this.errors.join(\n \"\\n - \"\n )}`\n );\n }\n\n // Set up the DOM.\n this._generateKey();\n this._setDOMElements();\n this._setIds();\n\n // Create the child elements.\n this._createChildElements();\n\n // Handle events.\n this._handleFocus();\n this._handleClick();\n this._handleKeydown();\n this._handleKeyup();\n\n // Set the custom props.\n this._setTransitionDurations();\n\n // Set up the storage.\n storage.initializeStorage(\"accordions\");\n storage.pushToStorage(\"accordions\", this.dom.accordion.id, this);\n } catch (error) {\n console.error(error);\n }\n }\n\n /**\n * The class(es) to apply when the accordion is open.\n *\n * @type {string|string[]}\n *\n * @see _openClass\n */\n get openClass() {\n return this._openClass;\n }\n\n /**\n * The class(es) to apply when the accordion is closed.\n *\n * @type {string|string[]}\n *\n * @see _closeClass\n */\n get closeClass() {\n return this._closeClass;\n }\n\n /**\n * The class(es) to apply when the accordion is transitioning between open and closed.\n *\n * @type {string|string[]}\n *\n * @see _transitionClass\n */\n get transitionClass() {\n return this._transitionClass;\n }\n\n /**\n * The duration time (in milliseconds) for the transition between open and closed states.\n *\n * @type {number}\n *\n * @see _transitionDuration\n */\n get transitionDuration() {\n return this._transitionDuration;\n }\n\n /**\n * The duration time (in milliseconds) for the transition from closed to open states.\n *\n * If openDuration is set to -1, the transitionDuration will be used instead.\n *\n * @type {number}\n *\n * @see _openDuration\n */\n get openDuration() {\n return this._openDuration === -1\n ? this.transitionDuration\n : this._openDuration;\n }\n\n /**\n * The duration time (in milliseconds) for the transition from open to closed states.\n *\n * If closeDuration is set to -1, the transitionDuration will be used instead.\n *\n * @type {number}\n *\n * @see _closeDuration\n */\n get closeDuration() {\n return this._closeDuration === -1\n ? this.transitionDuration\n : this._closeDuration;\n }\n\n /**\n * The current index of the accordion item.\n *\n * @readonly\n *\n * @type {number}\n *\n * @see _currentChild\n */\n get currentChild() {\n return this._currentChild;\n }\n\n /**\n * The dom elements of the accordion.\n *\n * @readonly\n *\n * @type {object}\n *\n * @see _dom\n */\n get dom() {\n return this._dom;\n }\n\n /**\n * The elements of the accordion.\n *\n * @readonly\n *\n * @type {object}\n *\n * @see _elements\n */\n get elements() {\n return this._elements;\n }\n\n /**\n * The selectors used for the accordion and accordion items.\n *\n * @readonly\n *\n * @type {boolean}\n *\n * @see _selectors\n */\n get selectors() {\n return this._selectors;\n }\n\n /**\n * A flag to decide if the accordion items can be navigated by arrows.\n *\n * @readonly\n *\n * @type {boolean}\n *\n * @see _optionalKeySupport\n */\n get optionalKeySupport() {\n return this._optionalKeySupport;\n }\n\n /**\n * The currently selected accordion item.\n *\n * @readonly\n *\n * @type {AccordionItem}\n */\n get currentAccordionItem() {\n return this.elements.accordionItems[this.currentChild];\n }\n\n /**\n * The currently open accordion items.\n *\n * @readonly\n *\n * @type {AccordionItem[]}\n */\n get openAccordionItems() {\n return this.elements.accordionItems.filter((item) => item.isOpen);\n }\n\n /**\n * A flag to decide if multiple accordions can be open at the same time.\n *\n * @type {boolean}\n *\n * @see _allowMultipleExpand\n */\n get allowMultipleExpand() {\n return this._allowMultipleExpand;\n }\n\n /**\n * A flag to decide if no accordions can be opened at the same time.\n *\n * @type {boolean}\n *\n * @see _allowNoExpand\n */\n get allowNoExpand() {\n return this._allowNoExpand;\n }\n\n /**\n * The prefix to use for CSS custom properties.\n *\n * @type {string}\n *\n * @see _prefix\n */\n get prefix() {\n return this._prefix;\n }\n\n /**\n * The key used to generate IDs throughout the accordion.\n *\n * @type {string}\n *\n * @see _key\n */\n get key() {\n return this._key;\n }\n\n /**\n * An array to hold error messages.\n *\n * @readonly\n *\n * @type {string[]}\n *\n * @see _errors\n */\n get errors() {\n return this._errors;\n }\n\n set openClass(value) {\n isValidClassList({ openClass: value });\n\n if (this._openClass !== value) {\n this._openClass = value;\n }\n }\n\n set closeClass(value) {\n isValidClassList({ closeClass: value });\n\n if (this._closeClass !== value) {\n this._closeClass = value;\n }\n }\n\n set transitionClass(value) {\n isValidClassList({ transitionClass: value });\n\n if (this._transitionClass !== value) {\n this._transitionClass = value;\n }\n }\n\n set transitionDuration(value) {\n isValidType(\"number\", { value });\n\n if (this._transitionDuration !== value) {\n this._transitionDuration = value;\n this._setTransitionDurations();\n }\n }\n\n set openDuration(value) {\n isValidType(\"number\", { value });\n\n if (this._openDuration !== value) {\n this._openDuration = value;\n this._setTransitionDurations();\n }\n }\n\n set closeDuration(value) {\n isValidType(\"number\", { value });\n\n if (this._closeDuration !== value) {\n this._closeDuration = value;\n this._setTransitionDurations();\n }\n }\n\n set currentChild(value) {\n isValidType(\"number\", { value });\n\n if (\n this._currentChild !== value &&\n value >= 0 &&\n value < this.elements.accordionItems.length\n ) {\n this._currentChild = value;\n }\n }\n\n set accordionItems(value) {\n isValidType(\"object\", { value });\n\n if (\n value?.isArray() &&\n value.every((item) => item instanceof AccordionItem)\n ) {\n this._accordionItems = value;\n }\n }\n\n set allowMultipleExpand(value) {\n isValidType(\"boolean\", { value });\n\n if (this._allowMultipleExpand !== value) {\n this._allowMultipleExpand = value;\n }\n }\n\n set allowNoExpand(value) {\n isValidType(\"boolean\", { value });\n\n if (this._allowNoExpand !== value) {\n this._allowNoExpand = value;\n }\n }\n\n set prefix(value) {\n isValidType(\"string\", { value });\n\n if (this._prefix !== value) {\n this._prefix = value;\n }\n }\n\n set key(value) {\n isValidType(\"string\", { value });\n\n if (this._key !== value) {\n this._key = value;\n }\n }\n\n /**\n * Sets DOM elements.\n *\n * Elements listed in _domLock cannot be set using this method.\n *\n * @protected\n *\n * @param {string} elementType - The type of element to populate.\n * @param {HTMLElement} [base = this.dom.accordion] - The element used as the base for the querySelect.\n * @param {boolean} [overwrite = true] - A flag to set if the existing elements will be overwritten.\n * @param {boolean} [strict = false] - A flag to set if the elements must be direct children of the base.\n */\n _setDOMElementType(\n elementType,\n base = this.dom.accordion,\n overwrite = true,\n strict = false\n ) {\n if (typeof this.selectors[elementType] === \"string\") {\n if (this._domLock.includes(elementType)) {\n throw new Error(\n `Graupl ${this.constructor.name}: \"${elementType}\" element cannot be set through _setDOMElementType.`\n );\n }\n\n if (base !== this.dom.accordion) isValidInstance(HTMLElement, { base });\n\n // Get the all elements matching the selector in the base.\n const domElements = Array.from(\n base.querySelectorAll(this.selectors[elementType])\n );\n\n // Filter the elements so only direct children of the base are kept.\n const filteredElements = domElements.filter((item) =>\n strict ? item.parentElement === base : true\n );\n\n if (overwrite) {\n this._dom[elementType] = filteredElements;\n } else {\n this._dom[elementType] = [\n ...this._dom[elementType],\n ...filteredElements,\n ];\n }\n } else {\n throw new Error(\n `Graupl ${this.constructor.name}: \"${elementType}\" is not a valid element type.`\n );\n }\n }\n\n /**\n * Resets DOM elements.\n *\n * Elements listed in _domLock cannot be reset using this method.\n *\n * @protected\n *\n * @param {string} elementType - The type of element to clear.\n */\n _resetDOMElementType(elementType) {\n if (typeof this.selectors[elementType] === \"string\") {\n if (this._domLock.includes(elementType)) {\n throw new Error(\n `Graupl ${this.constructor.name}: \"${elementType}\" element cannot be reset through _resetDOMElementType.`\n );\n }\n\n if (Array.isArray(this._dom[elementType])) {\n this._dom[elementType] = [];\n } else {\n this._dom[elementType] = null;\n }\n } else {\n throw new Error(\n `Graupl ${this.constructor.name}: \"${elementType}\" is not a valid element type.`\n );\n }\n }\n\n /**\n * Sets all DOM elements within the accordion.\n *\n * Utilizes _setDOMElementType and\n * _resetDOMElementType.\n *\n * @protected\n */\n _setDOMElements() {\n this._setDOMElementType(\"accordionItems\");\n this._resetDOMElementType(\"accordionItemToggles\");\n\n this.dom.accordionItems.forEach((accordionItem) => {\n this._setDOMElementType(\"accordionItemToggles\", accordionItem, false);\n this._setDOMElementType(\"accordionItemHeaders\", accordionItem, false);\n this._setDOMElementType(\"accordionItemContents\", accordionItem, false);\n });\n }\n\n /**\n * Generates a key for the accordion.\n *\n * @param {boolean} [regenerate = false] - A flag to determine if the key should be regenerated.\n */\n _generateKey(regenerate = false) {\n if (this.key === \"\" || regenerate) {\n this.key = Math.random()\n .toString(36)\n .replace(/[^a-z]+/g, \"\")\n .substring(0, 10);\n }\n }\n\n /**\n * Sets the IDs of the accordion and it's children if they do not already exist.\n *\n * The generated IDs use the key and follow the format:\n * - accordion: `accordion-${key}`\n *\n * @protected\n */\n _setIds() {\n this.dom.accordion.id = this.dom.accordion.id || `accordion-${this.key}`;\n }\n\n /**\n * Creates and initializes all accordion items.\n *\n * @protected\n */\n _createChildElements() {\n this.dom.accordionItems.forEach((accordionItem, index) => {\n const item = new AccordionItem({\n accordionItemElement: accordionItem,\n accordionItemToggleElement: this.dom.accordionItemToggles[index],\n accordionItemHeaderElement: this.dom.accordionItemHeaders[index],\n accordionItemContentElement: this.dom.accordionItemContents[index],\n parentAccordion: this,\n });\n\n item.initialize();\n\n this.elements.accordionItems.push(item);\n });\n }\n\n /**\n * Validates all aspects of the accordion item to ensure proper functionality.\n *\n * @protected\n *\n * @return {boolean} - The result of the validation.\n */\n _validate() {\n let check = true;\n\n // HTML element checks.\n const htmlElementChecks = isValidInstance(HTMLElement, {\n accordionElement: this.dom.accordion,\n });\n\n if (!htmlElementChecks) {\n this._errors.push(htmlElementChecks.message);\n check = false;\n }\n\n // Query selector checks.\n const querySelectorChecks = isQuerySelector({\n accordionItemSelector: this._selectors.accordionItems,\n accordionItemToggleSelector: this._selectors.accordionItemToggles,\n accordionItemHeaderSelector: this._selectors.accordionItemHeaders,\n accordionItemContentSelector: this._selectors.accordionItemContents,\n });\n\n if (!querySelectorChecks) {\n this._errors.push(querySelectorChecks.message);\n check = false;\n }\n\n // Class list checks.\n if (this._openClass !== \"\") {\n const openClassCheck = isValidClassList({ openClass: this._openClass });\n\n if (!openClassCheck.status) {\n this._errors.push(openClassCheck.error.message);\n check = false;\n }\n }\n\n if (this._closeClass !== \"\") {\n const closeClassCheck = isValidClassList({\n closeClass: this._closeClass,\n });\n\n if (!closeClassCheck.status) {\n this._errors.push(closeClassCheck.error.message);\n check = false;\n }\n }\n\n if (this._transitionClass !== \"\") {\n const transitionClassCheck = isValidClassList({\n transitionClass: this._transitionClass,\n });\n\n if (!transitionClassCheck.status) {\n this._errors.push(transitionClassCheck.error.message);\n check = false;\n }\n }\n\n // Transition duration check.\n const transitionDurationCheck = isValidType(\"number\", {\n transitionDuration: this._transitionDuration,\n });\n\n if (!transitionDurationCheck.status) {\n this._errors.push(transitionDurationCheck.error.message);\n check = false;\n }\n\n // Open duration check.\n const openDurationCheck = isValidType(\"number\", {\n openDuration: this._openDuration,\n });\n\n if (!openDurationCheck.status) {\n this._errors.push(openDurationCheck.error.message);\n check = false;\n }\n\n // Close duration check.\n const closeDurationCheck = isValidType(\"number\", {\n closeDuration: this._closeDuration,\n });\n\n if (!closeDurationCheck.status) {\n this._errors.push(closeDurationCheck.error.message);\n check = false;\n }\n\n // Boolean checks.\n const booleanCheck = isValidType(\"boolean\", {\n optionalKeySupport: this._optionalKeySupport,\n allowMultipleExpand: this._allowMultipleExpand,\n allowNoExpand: this._allowNoExpand,\n });\n\n if (!booleanCheck.status) {\n this._errors.push(booleanCheck.error.message);\n check = false;\n }\n\n // Key check.\n if (this._key !== \"\") {\n const keyCheck = isValidType(\"string\", { key: this._key });\n\n if (!keyCheck.status) {\n this._errors.push(keyCheck.error.message);\n check = false;\n }\n }\n\n // Prefix check.\n const prefixCheck = isValidType(\"string\", { prefix: this._prefix });\n\n if (!prefixCheck.status) {\n this._errors.push(prefixCheck.error.message);\n check = false;\n }\n\n return check;\n }\n\n /**\n * Handles focus events throughout the accordion for proper use.\n *\n * - Adds a `focus` listener to every accordion item so when it gains focus,\n * it will set the accordion's current child to the index of the item.\n *\n * @protected\n */\n _handleFocus() {\n this.elements.accordionItems.forEach((accordionItem, index) => {\n accordionItem.dom.toggle.addEventListener(\"focus\", () => {\n this.currentChild = index;\n });\n });\n }\n\n /**\n * Handles click events throughout the accordion item for proper use.\n *\n * - Adds a `pointerup` listener to the accordion item toggles that will toggle each accordion item.\n *\n * @protected\n */\n _handleClick() {\n this.elements.accordionItems.forEach((accordionItem, index) => {\n accordionItem.dom.toggle.addEventListener(\"pointerup\", () => {\n this.currentChild = index;\n accordionItem.toggle();\n });\n });\n }\n\n /**\n * Handles keydown events throughout the accordion item for proper use.\n *\n * This method exists to assist the _handleKeyup method.\n *\n * - Adds a `keydown` listener to all accordion item toggles.\n * - Blocks propagation on \"Space\" and \"Enter\" keys.\n * - _If_ optionalKeySupport is enabled, blocks propagation on the following keys:\n * - \"ArrowDown\", \"ArrowUp\", \"Home\", and \"End\".\n */\n _handleKeydown() {\n this.dom.accordionItemToggles.forEach((accordionToggle) => {\n accordionToggle.addEventListener(\"keydown\", (event) => {\n const key = keyPress(event);\n const ToggleKeys = [\"Space\", \"Enter\"];\n\n // Prevent default behavior for space and enter keys.\n if (ToggleKeys.includes(key)) {\n preventEvent(event);\n } else if (this.optionalKeySupport) {\n const optionalKeys = [\"ArrowDown\", \"ArrowUp\", \"Home\", \"End\"];\n\n if (optionalKeys.includes(key)) {\n preventEvent(event);\n }\n }\n });\n });\n }\n\n /**\n * Handles keyup events throughout the accordion item for proper use.\n *\n * Adds the follow keybindings (explanations are taken from the WAI ARIA Practices Guide Accordion Pattern):\n *\n * - `Enter` or `Space`:\n * - When focus is on the accordion header for a collapsed panel, expands the associated panel. If the implementation allows only one panel to be expanded, and if another panel is expanded, collapses that panel.\n * - When focus is on the accordion header for an expanded panel, collapses the panel if the implementation supports collapsing. Some implementations require one panel to be expanded at all times and allow only one panel to be expanded; so, they do not support a collapse function.\n * - `Tab`: Moves focus to the next focusable element; all focusable elements in the accordion are included in the page `Tab` sequence.\n * - `Shift + Tab`: Moves focus to the previous focusable element; all focusable elements in the accordion are included in the page `Tab` sequence.\n * - `Down Arrow` (Optional): If focus is on an accordion header, moves focus to the next accordion header. If focus is on the last accordion header, either does nothing or moves focus to the first accordion header.\n * - `Up Arrow` (Optional): If focus is on an accordion header, moves focus to the previous accordion header. If focus is on the first accordion header, either does nothing or moves focus to the last accordion header.\n * - `Home` (Optional): When focus is on an accordion header, moves focus to the first accordion header.\n * - `End` (Optional): When focus is on an accordion header, moves focus to the last accordion header.\n *\n * Note: When the above explanations mention \"accordion header\", they are referring to the accordion item toggle.\n */\n _handleKeyup() {\n this.dom.accordionItemToggles.forEach((accordionToggle) => {\n accordionToggle.addEventListener(\"keyup\", (event) => {\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n preventEvent(event);\n this.currentAccordionItem.toggle();\n\n break;\n }\n\n if (this.optionalKeySupport) {\n switch (key) {\n case \"Home\":\n preventEvent(event);\n this.focusFirstChild();\n\n break;\n case \"End\":\n preventEvent(event);\n this.focusLastChild();\n\n break;\n case \"ArrowDown\":\n preventEvent(event);\n this.focusNextChild();\n\n break;\n case \"ArrowUp\":\n preventEvent(event);\n this.focusPreviousChild();\n\n break;\n }\n }\n });\n });\n }\n\n /**\n * Sets the transition durations of the accordion as a CSS custom properties.\n *\n * The custom properties are:\n * - `--graupl-accordion-transition-duration`,\n * - `--graupl-accordion-open-transition-duration`, and\n * - `--graupl-accordion-close-transition-duration`.\n *\n * The prefix of `graupl-` can be changed by setting the accordion's prefix value.\n *\n * @protected\n */\n _setTransitionDurations() {\n this.dom.accordion.style.setProperty(\n `--${this.prefix}accordion-transition-duration`,\n `${this.transitionDuration}ms`\n );\n\n this.dom.accordion.style.setProperty(\n `--${this.prefix}accordion-open-transition-duration`,\n `${this.openDuration}ms`\n );\n\n this.dom.accordion.style.setProperty(\n `--${this.prefix}accordion-close-transition-duration`,\n `${this.closeDuration}ms`\n );\n }\n\n /**\n * Focus the accordion's current child.\n *\n * @public\n */\n focusCurrentChild() {\n if (this.currentChild !== -1) {\n this.currentAccordionItem.focus();\n }\n }\n\n /**\n * Focuses the accordion's child at a given index.\n *\n * @public\n *\n * @param {number} index - The index of the child to focus.\n */\n focusChild(index) {\n this.blurCurrentChild();\n this.currentChild = index;\n this.focusCurrentChild();\n }\n\n /**\n * Focuses the accordion's first child.\n *\n * @public\n */\n focusFirstChild() {\n this.focusChild(0);\n }\n\n /**\n * Focus the accordion's last child.\n *\n * @public\n */\n focusLastChild() {\n this.focusChild(this.elements.accordionItems.length - 1);\n }\n\n /**\n * Focus the accordion's next child.\n *\n * @public\n */\n focusNextChild() {\n if (this.currentChild < this.elements.accordionItems.length - 1) {\n this.focusChild(this.currentChild + 1);\n } else {\n this.focusCurrentChild();\n }\n }\n\n /**\n * Focus the accordion's previous child.\n *\n * @public\n */\n focusPreviousChild() {\n if (this.currentChild > 0) {\n this.focusChild(this.currentChild - 1);\n } else {\n this.focusCurrentChild();\n }\n }\n\n /**\n * Blurs the accordion's current child.\n *\n * @public\n */\n blurCurrentChild() {\n if (this.currentChild !== -1) {\n this.currentAccordionItem.blur();\n }\n }\n\n /**\n * Open all accordion items.\n *\n * @public\n */\n openChildren() {\n this.elements.accordionItems.forEach((item) => item.show());\n }\n\n /**\n * Close all accordion items.\n *\n * @public\n */\n closeChildren() {\n this.elements.accordionItems.forEach((item) => item.hide());\n }\n}\n\nexport default Accordion;\n","/**\n * Mark DOM elements as processed to prevent multiple initializations.\n *\n * @module @drupal/once\n *\n * @example <!-- Use as a module -->\n * <script type=\"module\">\n * import once from 'https://unpkg.com/@drupal/once/src/once.js';\n * const elements = once('my-once-id', 'div');\n * // Initialize elements.\n * elements.forEach(el => el.innerHTML = 'processed');\n * </script>\n *\n * @example <!-- Use as a regular script -->\n * <script src=\"https://unpkg.com/@drupal/once\"></script>\n * <script>\n * const elements = once('my-once-id', 'div');\n * // Initialize elements.\n * elements.forEach(el => el.innerHTML = 'processed');\n * </script>\n * @example <!-- Using a single element as input-->\n * <script src=\"https://unpkg.com/@drupal/once\"></script>\n * <script>\n * // once methods always return an array, to simplify the use with a single\n * // element use destructuring or the shift method.\n * const [myElement] = once('my-once-id', document.body);\n * const myElement = once('my-once-id', document.body).shift();\n * </script>\n */\n\n/**\n * Illegal spaces in ids.\n *\n * @private\n *\n * @type {RegExp}\n */\nconst wsRE = /[\\11\\12\\14\\15\\40]+/;\n\n/**\n * Name of the HTML attribute containing an element's once ids.\n *\n * @private\n *\n * @type {string}\n */\nconst attrName = 'data-once';\n\n/**\n * Shortcut to access the html element.\n *\n * @private\n *\n * @type {HTMLElement}\n */\nconst doc = document;\n\n/**\n * Helper to access element attributes.\n *\n * @private\n *\n * @param {Element} element\n * The Element to access the data-once attribute from.\n * @param {string} op\n * The action to take on the element.\n * @param {string} [value]\n * Optional value for setAttribute.\n *\n * @return {string|undefined|null|boolean}\n * Result of the attribute method.\n */\nfunction attr(element, op, value) {\n return element[`${op}Attribute`](attrName, value);\n}\n\n/**\n * Return the attribute selector.\n *\n * @private\n *\n * @param {string} id\n * The id passed by a call to a once() function.\n *\n * @return {string}\n * The full CSS attribute selector.\n *\n * @throws {TypeError|RangeError}\n */\nfunction attrSelector(id) {\n // Verify the validity of the once id.\n if (typeof id !== 'string') {\n throw new TypeError('once ID must be a string');\n }\n if (id === '' || wsRE.test(id)) {\n throw new RangeError('once ID must not be empty or contain spaces');\n }\n // The id is valid, return the full CSS selector.\n return `[${attrName}~=\"${id}\"]`;\n}\n\n/**\n * Verifies that an item is an instance of Element.\n *\n * This function is used during filtering to ensure only DOM elements are\n * processed. once() makes use of get/setAttribute, which are methods\n * inherited from the Element object, so only of Element can be used.\n *\n * @private\n *\n * @param {*} itemToCheck\n * The item to check.\n *\n * @return {boolean}\n * True if the item is an instance of Element\n *\n * @throws {TypeError}\n */\nfunction checkElement(itemToCheck) {\n if (!(itemToCheck instanceof Element)) {\n throw new TypeError('The element must be an instance of Element');\n }\n return true;\n}\n\n/**\n * Process arguments, query the DOM if necessary.\n *\n * @private\n *\n * @param {NodeList|Array.<Element>|Element|string} selector\n * A NodeList or array of elements.\n * @param {Document|DocumentFragment|Element} [context=document]\n * An element or document object to use as context for querySelectorAll.\n *\n * @return {Array.<Element>}\n * An array with the processed Id and the list of elements to process.\n */\nfunction getElements(selector, context = doc) {\n // Assume selector is an array-like value.\n let elements = selector;\n\n // If selector is null it is most likely because of a call to querySelector\n // that didn't return a result.\n if (selector === null) {\n elements = [];\n }\n // The selector is undefined, error out.\n else if (!selector) {\n throw new TypeError('Selector must not be empty');\n }\n // Context doesn't implement querySelectorAll, error out.\n else if (\n !(\n context instanceof Document ||\n context instanceof DocumentFragment ||\n context instanceof Element\n )\n ) {\n throw new TypeError(\n 'Context must be an object of type \"Document\", \"DocumentFragment\", or \"Element\".',\n );\n }\n // This is a selector, query the elements.\n else if (typeof selector === 'string') {\n elements = context.querySelectorAll(selector);\n }\n // This is a single element.\n else if (selector instanceof Element) {\n elements = [selector];\n }\n\n // Make sure an array is returned and not a NodeList or an Array-like object.\n return Array.prototype.slice.call(elements);\n}\n\n/**\n * A helper for applying DOM changes to a filtered set of elements.\n *\n * This makes it possible to filter items that are not instances of Element,\n * then modify their DOM attributes in a single array traversal.\n *\n * @private\n *\n * @param {string} selector\n * A CSS selector to check against to each element in the array.\n * @param {Array.<Element>} elements\n * A NodeList or array of elements passed by a call to a once() function.\n * @param {function} [apply]\n * An optional function to apply on all matched elements.\n *\n * @return {Array.<Element>}\n * The array of elements that match the CSS selector.\n */\nfunction filterAndModify(selector, elements, apply) {\n return elements.filter((element) => {\n const selected = checkElement(element) && element.matches(selector);\n if (selected && apply) {\n apply(element);\n }\n return selected;\n });\n}\n\n/**\n * Add or remove an item from a list of once values.\n *\n * This function removes duplicates while adding or removing a once id in a\n * single array traversal.\n *\n * @private\n *\n * @param {Element} element\n * A space separated string of once ids from a data-drupal-once attribute.\n * @param {string} [add]\n * The once id to add to the list of values.\n * @param {string} [remove]\n * The once id to remove from the list of values.\n *\n * @return {undefined}\n * Nothing to return this is a callback in a foreach.\n */\nfunction updateAttribute(element, { add, remove }) {\n const result = [];\n if (attr(element, 'has')) {\n attr(element, 'get')\n .trim()\n .split(wsRE)\n .forEach((item) => {\n if (result.indexOf(item) < 0 && item !== remove) {\n result.push(item);\n }\n });\n }\n if (add) {\n result.push(add);\n }\n const attribute = result.join(' ');\n attr(element, attribute === '' ? 'remove' : 'set', attribute);\n}\n\n/**\n * Ensures a JavaScript callback is only executed once on a set of elements.\n *\n * Filters a NodeList or array of elements, removing those already processed\n * by a callback with a given id.\n * This method adds a `data-once` attribute on DOM elements. The value of\n * this attribute identifies if a given callback has been executed on that\n * element.\n *\n * @global\n *\n * @example <caption>Basic usage</caption>\n * const elements = once('my-once-id', '[data-myelement]');\n * @example <caption>Input parameters accepted</caption>\n * // NodeList.\n * once('my-once-id', document.querySelectorAll('[data-myelement]'));\n * // Array or Array-like of Element.\n * once('my-once-id', jQuery('[data-myelement]'));\n * // A CSS selector without a context.\n * once('my-once-id', '[data-myelement]');\n * // A CSS selector with a context.\n * once('my-once-id', '[data-myelement]', document.head);\n * // Single Element.\n * once('my-once-id', document.querySelector('#some-id'));\n * @example <caption>Using a single element</caption>\n * // Once always returns an array, even when passing a single element. Some\n * // forms that can be used to keep code readable.\n * // Destructuring:\n * const [myElement] = once('my-once-id', document.body);\n * // By changing the resulting array, es5 compatible.\n * const myElement = once('my-once-id', document.body).shift();\n *\n * @param {string} id\n * The id of the once call.\n * @param {NodeList|Array.<Element>|Element|string} selector\n * A NodeList or array of elements.\n * @param {Document|DocumentFragment|Element} [context=document]\n * An element or document object to use as context for querySelectorAll.\n *\n * @return {Array.<Element>}\n * An array of elements that have not yet been processed by a once call\n * with a given id.\n */\nfunction once(id, selector, context) {\n return filterAndModify(\n `:not(${attrSelector(id)})`,\n getElements(selector, context),\n (element) => updateAttribute(element, { add: id }),\n );\n}\n\n/**\n * Removes a once id from an element's data-drupal-once attribute value.\n *\n * If a once id is removed from an element's data-drupal-once attribute value,\n * the JavaScript callback associated with that id can be executed on that\n * element again.\n *\n * @method once.remove\n *\n * @example <caption>Basic usage</caption>\n * const elements = once.remove('my-once-id', '[data-myelement]');\n * @example <caption>Input parameters accepted</caption>\n * // NodeList.\n * once.remove('my-once-id', document.querySelectorAll('[data-myelement]'));\n * // Array or Array-like of Element.\n * once.remove('my-once-id', jQuery('[data-myelement]'));\n * // A CSS selector without a context.\n * once.remove('my-once-id', '[data-myelement]');\n * // A CSS selector with a context.\n * once.remove('my-once-id', '[data-myelement]', document.head);\n * // Single Element.\n * once.remove('my-once-id', document.querySelector('#some-id'));\n *\n * @param {string} id\n * The id of a once call.\n * @param {NodeList|Array.<Element>|Element|string} selector\n * A NodeList or array of elements to remove the once id from.\n * @param {Document|Element} [context=document]\n * An element to use as context for querySelectorAll.\n *\n * @return {Array.<Element>}\n * A filtered array of elements that had been processed by the provided id,\n * and are now able to be processed again.\n */\nonce.remove = (id, selector, context) => {\n return filterAndModify(\n attrSelector(id),\n getElements(selector, context),\n (element) => updateAttribute(element, { remove: id }),\n );\n};\n\n/**\n * Finds elements that have been processed by a given once id.\n *\n * Behaves like {@link once} and {@link once.remove} without changing the DOM.\n * To select all DOM nodes processed by a given id, use {@link once.find}.\n *\n * @method once.filter\n *\n * @example <caption>Basic usage</caption>\n * const filteredElements = once.filter('my-once-id', '[data-myelement]');\n * @example <caption>Input parameters accepted</caption>\n * // NodeList.\n * once.filter('my-once-id', document.querySelectorAll('[data-myelement]'));\n * // Array or Array-like of Element.\n * once.filter('my-once-id', jQuery('[data-myelement]'));\n * // A CSS selector without a context.\n * once.filter('my-once-id', '[data-myelement]');\n * // A CSS selector with a context.\n * once.filter('my-once-id', '[data-myelement]', document.head);\n * // Single Element.\n * once.filter('my-once-id', document.querySelector('#some-id'));\n *\n * @param {string} id\n * The id of the once call.\n * @param {NodeList|Array.<Element>|Element|string} selector\n * A NodeList or array of elements to remove the once id from.\n * @param {Document|Element} [context=document]\n * An element to use as context for querySelectorAll.\n *\n * @return {Array.<Element>}\n * A filtered array of elements that have already been processed by the\n * provided once id.\n */\nonce.filter = (id, selector, context) =>\n filterAndModify(attrSelector(id), getElements(selector, context));\n\n/**\n * Finds elements that have been processed by a given once id.\n *\n * Query the 'context' element for elements that already have the\n * corresponding once id value.\n *\n * @method once.find\n *\n * @example <caption>Basic usage</caption>\n * const oncedElements = once.find('my-once-id');\n * @example <caption>Input parameters accepted</caption>\n * // Call without parameters, return all elements with a `data-once` attribute.\n * once.find();\n * // Call without a context.\n * once.find('my-once-id');\n * // Call with a context.\n * once.find('my-once-id', document.head);\n *\n * @param {string} [id]\n * The id of the once call.\n * @param {Document|DocumentFragment|Element} [context=document]\n * Scope of the search for matching elements.\n *\n * @return {Array.<Element>}\n * A filtered array of elements that have already been processed by the\n * provided once id.\n */\nonce.find = (id, context) =>\n getElements(!id ? `[${attrName}]` : attrSelector(id), context);\n\nexport default once;\n","import Accordion from \"./Accordion.js\";\nimport once from \"@drupal/once\";\n\nconst generate = (\n options = {},\n context = document,\n accordionSelector = \".accordion\"\n) => {\n once(\"graupl-accordion-generator\", accordionSelector, context).forEach(\n (accordionElement) => {\n const accordionOptions = accordionElement.dataset.grauplAccordionOptions\n ? JSON.parse(\n accordionElement.dataset.grauplAccordionOptions.replace(/'/g, '\"')\n ) || {}\n : {};\n\n new Accordion({\n accordionElement,\n initialize: true,\n ...options,\n ...accordionOptions,\n });\n }\n );\n};\n\nexport default generate;\n","/**\n * @file\n * The alert class.\n */\n\nimport { isValidClassList, isValidInstance, isValidType } from \"../validate.js\";\nimport { addClass, removeClass } from \"../domHelpers.js\";\nimport { keyPress, preventEvent } from \"../eventHandlers.js\";\nimport storage from \"../storage.js\";\n\nclass Alert {\n /**\n * The HTML elements for the alert in the DOM.\n *\n * @protected\n *\n * @type {Object<HTMLElement>}\n */\n _dom = {\n alert: null,\n controller: null,\n };\n\n /**\n * A flag to determine if the alert is hidden.\n *\n * @protected\n *\n * @type {boolean}\n */\n _hidden = false;\n\n /**\n * The class to use to show the alert.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _showClass = \"\";\n\n /**\n * The class to use to hide the alert.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _hideClass = \"\";\n\n /**\n * The class to use when transitioning the alert.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _transitionClass = \"\";\n\n /**\n * The time in milliseconds the transition will take.\n *\n * @protected\n *\n * @type {number}\n */\n _transitionTimer = 150;\n\n /**\n * The key used to generate IDs throughout the carousel.\n *\n * @protected\n *\n * @type {string}\n */\n _key = \"\";\n\n /**\n * An array of error messages generated by the alert.\n *\n * @protected\n *\n * @type {string[]}\n */\n _errors = [];\n\n /**\n * The event that is triggered when the alert is shown.\n *\n * @protected\n *\n * @event grauplAlertShow\n *\n * @type {CustomEvent}\n *\n * @property {boolean} bubbles - A flag to bubble the event.\n * @property {Object<Alert>} detail - The details object container the Alert itself.\n */\n _showEvent = new CustomEvent(\"grauplAlertShow\", {\n bubbles: true,\n detail: { alert: this },\n });\n\n /**\n * The event that is triggered when the alert is hidden.\n *\n * @protected\n *\n * @event grauplAlertHide\n *\n * @type {CustomEvent}\n *\n * @property {boolean} bubbles - A flag to bubble the event.\n * @property {Object<Alert>} detail - The details object containing the Alert itself.\n */\n _hideEvent = new CustomEvent(\"grauplAlertHide\", {\n bubbles: true,\n detail: { alert: this },\n });\n\n /**\n * Constructs a new `Alert`.\n *\n * @param {object} options - The options object.\n * @param {HTMLElement} options.alertElement - The alert element.\n * @param {?HTMLElement} [options.controllerElement = null] - The controller element.\n * @param {string|string[]|null} [options.showClass = show] - The class to add when the alert is shown.\n * @param {string|string[]|null} [options.hideClass = hide] - The class to add when\n * @param {string|string[]|null} [options.transitionClass = transitioning] - The class to add when the alert is transitioning between shown and hidden.\n * @param {number} [options.transitionTimer = 150] - The time in milliseconds the transition will take.\n * @param {boolean} [options.isHidden = false] - A flag to determine the initial state of the alert.\n * @param {?string} [options.key = null] - The key used to generate IDs throughout the alert.\n * @param {boolean} [options.initialize = false] - AA flag to initialize the alert immediately upon creation.\n */\n constructor({\n alertElement,\n controllerElement = null,\n showClass = \"show\",\n hideClass = \"hide\",\n transitionClass = \"transitioning\",\n transitionTimer = 150,\n isHidden = false,\n key = null,\n initialize = false,\n }) {\n this._dom.alert = alertElement;\n this._dom.controller = controllerElement;\n this._showClass = showClass || \"\";\n this._hideClass = hideClass || \"\";\n this._transitionClass = transitionClass || \"\";\n this._transitionTimer = transitionTimer;\n this._hidden = isHidden;\n\n // Set the key.\n this._key = key || \"\";\n\n if (initialize) {\n this.initialize();\n }\n }\n\n /**\n * Initializes the alert.\n */\n initialize() {\n try {\n if (!this._validate()) {\n throw new Error(\n `Graupl Alert: cannot initialize alert. The following errors have been found:\\n - ${this.errors.join(\n \"\\n - \"\n )}`\n );\n }\n\n // Set up the DOM.\n this._generateKey();\n this._setIds();\n\n // Handle events.\n this._handleClick();\n this._handleKeydown();\n this._handleKeyup();\n\n // Set up the storage.\n storage.initializeStorage(\"alerts\");\n storage.pushToStorage(\"alerts\", this.dom.alert.id, this);\n } catch (error) {\n console.error(error);\n }\n }\n\n /**\n * The HTML elements for the alert in the DOM.\n *\n * @readonly\n *\n * @see _dom\n *\n * @type {object}\n */\n get dom() {\n return this._dom;\n }\n\n /**\n * The class to use the show the alert.\n *\n * @type {string|string[]}\n *\n * @see _showClass\n */\n get showClass() {\n return this._showClass;\n }\n\n /**\n * The class to use to hide the alert.\n *\n * @type {string|string[]}\n *\n * @see _hideClass\n */\n get hideClass() {\n return this._hideClass;\n }\n\n /**\n * The class to use when transitioning the alert.\n *\n * @type {string|string[]}\n *\n * @see _transitionClass\n */\n get transitionClass() {\n return this._transitionClass;\n }\n\n /**\n * The time in milliseconds the transition will take.\n *\n * @type {number}\n *\n * @see _transitionTimer\n */\n get transitionTimer() {\n return this._transitionTimer;\n }\n\n /**\n * The key used to generate IDs throughout the accordion.\n *\n * @type {string}\n *\n * @see _key\n */\n get key() {\n return this._key;\n }\n\n set showClass(value) {\n isValidClassList({ showClass: value });\n\n if (this._showClass !== value) {\n this._showClass = value;\n }\n }\n\n set hideClass(value) {\n isValidClassList({ hideClass: value });\n\n if (this._hideClass !== value) {\n this._hideClass = value;\n }\n }\n\n set transitionClass(value) {\n isValidClassList({ transitionClass: value });\n\n if (this._transitionClass !== value) {\n this._transitionClass = value;\n }\n }\n\n set transitionTimer(value) {\n isValidType(\"number\", { transitionTimer: value });\n\n if (this._transitionTimer !== value) {\n this._transitionTimer = value;\n }\n }\n\n set key(value) {\n isValidType(\"string\", { value });\n\n if (this._key !== value) {\n this._key = value;\n }\n }\n\n /**\n * Validates all aspects of the alert to ensure proper functionality.\n *\n * @protected\n *\n * @return {boolean} - The result of the validation.\n */\n _validate() {\n let check = true;\n\n // HTML element checks.\n let htmlElementChecks;\n\n if (this._dom.controller !== null) {\n htmlElementChecks = isValidInstance(HTMLElement, {\n alertElement: this._dom.alert,\n controllerElement: this._dom.controller,\n });\n } else {\n htmlElementChecks = isValidInstance(HTMLElement, {\n alertElement: this._dom.alert,\n });\n }\n\n if (!htmlElementChecks.status) {\n this._errors.push(htmlElementChecks.message);\n check = false;\n }\n\n // Class list checks.\n if (this._showClass !== \"\") {\n const showClassCheck = isValidClassList({ showClass: this._showClass });\n\n if (!showClassCheck.status) {\n this._errors.push(showClassCheck.message);\n check = false;\n }\n }\n\n if (this._hideClass !== \"\") {\n const hideClassCheck = isValidClassList({ hideClass: this._hideClass });\n\n if (!hideClassCheck.status) {\n this._errors.push(hideClassCheck.message);\n check = false;\n }\n }\n\n if (this._transitionClass !== \"\") {\n const transitionClassCheck = isValidClassList({\n transitionClass: this._transitionClass,\n });\n\n if (!transitionClassCheck.status) {\n this._errors.push(transitionClassCheck.message);\n check = false;\n }\n }\n\n // Transition timer check.\n const transitionTimerCheck = isValidType(\"number\", {\n transitionTimer: this._transitionTimer,\n });\n\n if (!transitionTimerCheck.status) {\n this._errors.push(transitionTimerCheck.message);\n check = false;\n }\n\n // Hidden check.\n const hiddenCheck = isValidType(\"boolean\", { isHidden: this._hidden });\n\n if (!hiddenCheck.status) {\n this._errors.push(hiddenCheck.message);\n check = false;\n }\n\n return check;\n }\n\n /**\n * Generates a key for the alert.\n *\n * @param {boolean} [regenerate = false] - A flag to determine if the key should be regenerated.\n */\n _generateKey(regenerate = false) {\n if (this.key === \"\" || regenerate) {\n this.key = Math.random()\n .toString(36)\n .replace(/[^a-z]+/g, \"\")\n .substring(0, 10);\n }\n }\n\n /**\n * Sets the IDs of the alert and it's children if they do not already exist.\n *\n * The generated IDs use the key and follow the format:\n * - alert: `alert-${key}`\n * - controller: `alert-controller-${key}`\n */\n _setIds() {\n this.dom.alert.id = this.dom.alert.id || `alert-${this.key}`;\n this.dom.controller.id =\n this.dom.controller.id || `alert-controller-${this.key}`;\n }\n\n /**\n * Shows the alert.\n *\n * @fires grauplAlertShow\n *\n * @param {boolean} [emit = true] - A toggle to emit the show event once shown.\n */\n show(emit = true) {\n if (!this._hidden) {\n return;\n }\n\n // If we're dealing with transition classes, then we need to utilize\n // requestAnimationFrame to add the transition class, remove the hide class,\n // add the show class, and finally remove the transition class.\n if (this.transitionClass !== \"\") {\n addClass(this.transitionClass, this.dom.alert);\n\n requestAnimationFrame(() => {\n if (this.hideClass !== \"\") {\n removeClass(this.hideClass, this.dom.alert);\n }\n\n requestAnimationFrame(() => {\n if (this.showClass !== \"\") {\n addClass(this.showClass, this.dom.alert);\n }\n\n requestAnimationFrame(() => {\n removeClass(this.transitionClass, this.dom.alert);\n });\n });\n });\n } else {\n // Add the show class\n if (this.showClass !== \"\") {\n addClass(this.showClass, this.dom.alert);\n }\n\n // Remove the hide class.\n if (this.hideClass !== \"\") {\n removeClass(this.hideClass, this.dom.alert);\n }\n }\n\n this._hidden = false;\n\n if (emit) {\n this.dom.alert.dispatchEvent(this._hideEvent);\n }\n }\n\n /**\n * Hides the alert.\n *\n * @fires grauplAlertHide\n *\n * @param {boolean} [emit = true] - A toggle to emit the hide event once shown.\n */\n hide(emit = true) {\n if (this._hidden) {\n return;\n }\n // If we're dealing with transition classes, then we need to utilize\n // requestAnimationFrame to add the transition class, remove the show class,\n // add the hide class, and finally remove the transition class.\n if (this.transitionClass !== \"\") {\n addClass(this.transitionClass, this.dom.alert);\n\n requestAnimationFrame(() => {\n if (this.showClass !== \"\") {\n removeClass(this.showClass, this.dom.alert);\n }\n\n requestAnimationFrame(() => {\n if (this.transitionTimer > 0) {\n setTimeout(() => {\n if (this.hideClass !== \"\") {\n addClass(this.hideClass, this.dom.alert);\n }\n\n requestAnimationFrame(() => {\n removeClass(this.transitionClass, this.dom.alert);\n });\n }, this.transitionTimer);\n } else {\n if (this.hideClass !== \"\") {\n addClass(this.hideClass, this.dom.alert);\n }\n\n requestAnimationFrame(() => {\n removeClass(this.transitionClass, this.dom.alert);\n });\n }\n });\n });\n } else {\n // Add the hide class\n if (this.hideClass !== \"\") {\n addClass(this.hideClass, this.dom.alert);\n }\n\n // Remove the show class.\n if (this.showClass !== \"\") {\n removeClass(this.showClass, this.dom.alert);\n }\n }\n\n this._hidden = true;\n\n if (emit) {\n this.dom.alert.dispatchEvent(this._hideEvent);\n }\n }\n\n /**\n * Handles click events throughout the alert for proper use.\n *\n * - Adds a `pointerup` listener to the controller that will hide the alert.\n *\n * @protected\n */\n _handleClick() {\n if (this.dom.controller === null) {\n return;\n }\n\n this.dom.controller.addEventListener(\"pointerup\", () => this.hide());\n }\n\n /**\n * Handles keydown events throughout the alert for proper use.\n *\n * This method exists to assist the _handleKeyup method.\n *\n * - Adds a `keydown` listener to the controller (if it exists).\n * - Blocks propagation on \"Space\" and \"Enter\" keys.\n */\n _handleKeydown() {\n if (this.dom.controller === null) {\n return;\n }\n\n this.dom.controller.addEventListener(\"keydown\", (event) => {\n const key = keyPress(event);\n\n // Prevent default behavior for space and enter keys.\n if (key === \"Space\" || key === \"Enter\") {\n preventEvent(event);\n }\n });\n }\n\n /**\n * Handles keyup events throughout the alert for proper use.\n *\n * - Adds a `keyup` listener to the controller (if it exists).\n * - Hides the alert when the user hits \"Space\" or \"Enter\".\n */\n _handleKeyup() {\n if (this.dom.controller === null) {\n return;\n }\n\n this.dom.controller.addEventListener(\"keyup\", (event) => {\n const key = keyPress(event);\n\n if (key === \"Space\" || key === \"Enter\") {\n this.hide();\n }\n });\n }\n}\n\nexport default Alert;\n","import Alert from \"./Alert.js\";\nimport once from \"@drupal/once\";\n\nconst generate = (\n options = {},\n context = document,\n alertSelector = \".alert\"\n) => {\n once(\"graupl-alert-generator\", alertSelector, context).forEach(\n (alertElement) => {\n const alertOptions = alertElement.dataset.grauplAlertOptions\n ? JSON.parse(\n alertElement.dataset.grauplAlertOptions.replace(/'/g, '\"')\n ) || {}\n : {};\n\n new Alert({\n alertElement,\n controllerElement:\n alertElement.querySelector(\".alert-dismisser\") || null,\n initialize: true,\n ...options,\n ...alertOptions,\n });\n }\n );\n};\n\nexport default generate;\n","/**\n * @file\n * The carousel class.\n */\n\nimport { addClass, removeClass } from \"../domHelpers.js\";\nimport { preventEvent, keyPress } from \"../eventHandlers.js\";\nimport storage from \"../storage.js\";\nimport {\n isQuerySelector,\n isTag,\n isValidClassList,\n isValidInstance,\n isValidType,\n} from \"../validate.js\";\n\nclass Carousel {\n /**\n * The DOM elements within the carousel.\n *\n * @protected\n *\n * @type {Object<HTMLElement, HTMLElement[]>}\n *\n * @property {HTMLElement} carousel - The carousel element.\n * @property {HTMLElement[]} carouselItems - The carousel items.\n * @property {HTMLElement} carouselItemContainer - The carousel item container.\n * @property {HTMLElement[]} carouselControls - The carousel controls.\n * @property {HTMLElement} carouselControlContainer - The carousel control container.\n * @property {HTMLElement[]} carouselTabs - The carousel tabs.\n * @property {HTMLElement} carouselTabContainer - The carousel tab container.\n * @property {HTMLElement} autoplay - The autoplay button.\n * @property {HTMLElement} next - The next button.\n * @property {HTMLElement} previous - The previous button.\n */\n _dom = {\n carousel: null,\n carouselItems: [],\n carouselItemContainer: null,\n carouselControls: [],\n carouselControlContainer: null,\n carouselTabs: [],\n carouselTabContainer: null,\n autoplay: null,\n next: null,\n previous: null,\n };\n\n /**\n * The query selectors used by the carousel to populate the dom.\n *\n * @protected\n *\n * @type {Object<string>}\n *\n * @property {string} carouselItems - The query selector string for carousel items.\n * @property {string} carouselItemContainer - The query selector string for the carousel item container.\n * @property {string} carouselControls - The query selector string for carousel controls.\n * @property {string} carouselControlContainer - The query selector string for carousel control container.\n * @property {string} carouselTabs - The query selector string for the carousel tabs.\n * @property {string} carouselTabContainer - The query selector string for the carousel tab container.\n * @property {string} autoplay - The query selector string for the autoplay button.\n * @property {string} next - The query selector string for the next button.\n * @property {string} previous - The query selector string for the previous button.\n */\n _selectors = {\n carouselItems: \"\",\n carouselItemContainer: \"\",\n carouselControls: \"\",\n carouselControlContainer: \"\",\n carouselTabs: \"\",\n carouselTabContainer: \"\",\n autoplay: \"\",\n next: \"\",\n previous: \"\",\n };\n\n /**\n * The class(es) to apply when a carousel item is active.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _activeClass = \"active\";\n\n /**\n * The class(es) to apply to a carousel item that is the previously active item.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _previousClass = \"previous\";\n\n /**\n * The class(es) to apply to a carousel item that is the next active item.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _nextClass = \"next\";\n\n /**\n * The class(es) to apply to the autoplay button when the carousel is paused.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _playClass = \"play\";\n\n /**\n * The class(es) to apply to the autoplay button when the carousel is playing.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _pauseClass = \"pause\";\n\n /**\n * The index of the currently active carousel item.\n *\n * @protected\n *\n * @type {number}\n */\n _currentItem = 0;\n\n /**\n * A flag to indicate if the carousel is currently playing.\n *\n * @protected\n *\n * @type {boolean}\n */\n _autoplay = true;\n\n /**\n * A variable to delay transition slides in milliseconds.\n *\n * @protected\n *\n * @type {number}\n */\n _transitionDelay = 10000;\n\n /**\n * The duration time (in milliseconds) for the transition between carousel items.\n *\n * @protected\n *\n * @type {number}\n */\n _transitionDuration = 500;\n\n /**\n * The label for the autoplay button when the carousel is paused.\n *\n * @protected\n *\n * @type {string}\n */\n _playText = \"Play\";\n\n /**\n * The label for the autoplay button when the carousel is playing.\n *\n * @protected\n *\n * @type {string}\n */\n _pauseText = \"Pause\";\n\n /**\n * The current action being performed by the carousel.\n *\n * @protected\n *\n * @type {string}\n */\n _currentAction = \"next\";\n\n /**\n * The stored interval callback for autoplaying the carousel.\n *\n * @protected\n *\n * @type {?Function}\n */\n _autoplayInterval = null;\n\n /**\n * The prefix to use for CSS custom properties.\n *\n * @protected\n *\n * @type {string}\n */\n _prefix = \"graupl-\";\n\n /**\n * The key used to generate IDs throughout the carousel.\n *\n * @protected\n *\n * @type {string}\n */\n _key = \"\";\n\n /**\n * An array of error messages generated by the carousel.\n *\n * @protected\n *\n * @type {string[]}\n */\n _errors = [];\n\n /**\n * Constructs a new `Carousel`.\n *\n * @param {object} options - The options for the generated carousel.\n * @param {HTMLElement} options.carouselElement - The carousel element in the DOM.\n * @param {string} [options.carouselItemSelector = .carousel-item] - The query selector string for carousel items.\n * @param {string} [options.carouselItemContainerSelector = .carousel-item-container] - The query selector string for the carousel item container.\n * @param {string} [options.carouselControlSelector = .carousel-control] - The query selector string for carousel controls.\n * @param {string} [options.carouselControlContainerSelector = .carousel-control-container] - The query selector string for carousel control container.\n * @param {string} [options.carouselTabSelector = .carousel-tab] - The query selector string for carousel tabs.\n * @param {string} [options.carouselTabContainerSelector = .carousel-tab-container] - The query selector string for the carousel tab container.\n * @param {string} [options.autoplaySelector = .autoplay] - The query selector string for the autoplay button.\n * @param {string} [options.nextSelector = .next] - The query selector string for the next button.\n * @param {string} [options.previousSelector = .previous] - The query selector string for the previous button.\n * @param {?(string|string[])} [options.activeClass = active] - The class(es) to apply when a carousel item is active.\n * @param {?(string|string[])} [options.previousClass = previous] - The class(es) to apply to a carousel item that is the previously active item.\n * @param {?(string|string[])} [options.nextClass = next] - The class(es) to apply to a carousel item that is the next active item.\n * @param {?(string|string[])} [options.playClass = play] - The class(es) to apply to the autoplay button when the carousel is paused.\n * @param {?(string|string[])} [options.pauseClass = pause] - The class(es) to apply to the autoplay button when the carousel is playing.\n * @param {boolean} [options.autoplay = true] - A flag to indicate if the carousel should autoplay.\n * @param {number} [options.transitionDelay = 10000] - A flag to initialize the carousel immediately upon creation.\n * @param {number} [options.transitionDuration = 500] - The duration time (in milliseconds) for the transition between carousel items.\n * @param {?string} [options.playText = Play] - The text to use for the play button.\n * @param {?string} [options.pauseText = Pause] - The text to use for the pause button.\n * @param {?string} [options.prefix = graupl-] - The prefix to use for CSS custom properties.\n * @param {?string} [options.key = null] - The key used to generate IDs throughout the carousel.\n * @param {boolean} [options.initialize = false] - A flag to initialize the carousel immediately upon creation.\n */\n constructor({\n carouselElement,\n carouselItemSelector = \".carousel-item\",\n carouselItemContainerSelector = \".carousel-item-container\",\n carouselControlSelector = \".carousel-control\",\n carouselControlContainerSelector = \".carousel-control-container\",\n carouselTabSelector = \".carousel-tab\",\n carouselTabContainerSelector = \".carousel-tab-container\",\n autoplaySelector = \".autoplay\",\n nextSelector = \".next\",\n previousSelector = \".previous\",\n activeClass = \"active\",\n previousClass = \"previous\",\n nextClass = \"next\",\n playClass = \"play\",\n pauseClass = \"pause\",\n autoplay = true,\n transitionDelay = 10000,\n transitionDuration = 500,\n playText = \"Play\",\n pauseText = \"Pause\",\n prefix = \"graupl-\",\n key = null,\n initialize = false,\n }) {\n // Set DOM elements.\n this._dom.carousel = carouselElement;\n\n // Set query selectors.\n this._selectors.carouselItems = carouselItemSelector;\n this._selectors.carouselItemContainer = carouselItemContainerSelector;\n this._selectors.carouselControls = carouselControlSelector;\n this._selectors.carouselControlContainer = carouselControlContainerSelector;\n this._selectors.carouselTabs = carouselTabSelector;\n this._selectors.carouselTabContainer = carouselTabContainerSelector;\n this._selectors.autoplay = autoplaySelector;\n this._selectors.next = nextSelector;\n this._selectors.previous = previousSelector;\n\n // Set class names.\n this._activeClass = activeClass || \"\";\n this._previousClass = previousClass || \"\";\n this._nextClass = nextClass || \"\";\n this._playClass = playClass || \"\";\n this._pauseClass = pauseClass || \"\";\n\n // Set flags.\n this._autoplay = autoplay;\n\n // Set transition options.\n this._transitionDelay = transitionDelay;\n this._transitionDuration = transitionDuration;\n\n // Set labels.\n this._playText = playText || \"\";\n this._pauseText = pauseText || \"\";\n\n // Set prefix.\n this._prefix = prefix || \"\";\n\n // Set the key.\n this._key = key || \"\";\n\n if (initialize) {\n this.initialize();\n }\n }\n\n /**\n * Initializes the carousel.\n */\n initialize() {\n try {\n if (!this._validate()) {\n throw new Error(\n `Graupl Carousel: cannot initialize carousel. The following errors have been found:\\n - ${this.errors.join(\n \"\\n - \"\n )}`\n );\n }\n\n // Set up the DOM.\n this._generateKey();\n this._setDOMElements();\n this._setIds();\n this._setAriaAttributes();\n\n // Activate the first item.\n this.activateFirstItem();\n\n // Handle events.\n this._handleAutoplay();\n this._handleFocus();\n this._handleClick();\n this._handleHover();\n this._handleKeydown();\n this._handleKeyup();\n\n // Set the custom props.\n this._setTransitionDuration();\n\n // Set up the storage.\n storage.initializeStorage(\"carousels\");\n storage.pushToStorage(\"carousels\", this.dom.carousel.id, this);\n } catch (error) {\n console.error(error);\n }\n }\n\n /**\n * The HTML elements for the carousel in the DOM.\n *\n * @readonly\n *\n * @type {Object<HTMLElement>}\n *\n * @see _dom\n */\n get dom() {\n return this._dom;\n }\n\n /**\n * The query selectors used by the carousel to populate the dom.\n *\n * @readonly\n *\n * @type {Object<string>}\n *\n * @see _selectors\n */\n get selectors() {\n return this._selectors;\n }\n\n /**\n * The class(es) to apply when a carousel item is active.\n *\n * @type {string|string[]}\n *\n * @see _activeClass\n */\n get activeClass() {\n return this._activeClass;\n }\n\n /**\n * The class(es) to apply to a carousel item that is the next active item.\n *\n * @type {string|string[]}\n *\n * @see _previousClass\n */\n get previousClass() {\n return this._previousClass;\n }\n\n /**\n * The class(es) to apply to a carousel item that is the next active item.\n *\n * @type {string|string[]}\n *\n * @see _nextClass\n */\n get nextClass() {\n return this._nextClass;\n }\n\n /**\n * The class(es) to apply to the autoplay button when the carousel is paused.\n *\n * @type {string|string[]}\n *\n * @see _playClass\n */\n get playClass() {\n return this._playClass;\n }\n\n /**\n * The class(es) to apply to the autoplay button when the carousel is playing.\n *\n * @type {string|string[]}\n *\n * @see _pauseClass\n */\n get pauseClass() {\n return this._pauseClass;\n }\n\n /**\n * The index of the currently active carousel item.\n *\n * @type {number}\n *\n * @see _currentItem\n */\n get currentItem() {\n return this._currentItem;\n }\n\n /**\n * The currently active carousel item.\n *\n * @readonly\n *\n * @type {HTMLElement}\n */\n get currentCarouselItem() {\n return this.dom.carouselItems[this.currentItem];\n }\n\n /**\n * The currently active carousel tab.\n *\n * @readonly\n *\n * @type {HTMLElement}\n */\n get currentCarouselTab() {\n return this.dom.carouselTabs[this.currentItem];\n }\n\n /**\n * A flag to indicate if the carousel is currently playing.\n *\n * @type {boolean}\n *\n * @see _autoplay\n */\n get autoplay() {\n return this._autoplay;\n }\n\n /**\n * The delay in milliseconds before transitioning slides.\n *\n * @type {number}\n *\n * @see _transitionDelay\n */\n get transitionDelay() {\n return this._transitionDelay;\n }\n\n /**\n * The duration time (in milliseconds) for the transition between carousel items.\n *\n * @type {number}\n *\n * @see _transitionDuration\n */\n get transitionDuration() {\n return this._transitionDuration;\n }\n\n /**\n * The label for the autoplay button when the carousel is paused.\n *\n * @type {string}\n *\n * @see _playText\n */\n get playText() {\n return this._playText;\n }\n\n /**\n * The label for the autoplay button when the carousel is playing.\n *\n * @type {string}\n *\n * @see _pauseText\n */\n get pauseText() {\n return this._pauseText;\n }\n\n /**\n * The prefix to use for CSS custom properties.\n *\n * @type {string}\n *\n * @see _prefix\n */\n get prefix() {\n return this._prefix;\n }\n\n /**\n * The key used to generate IDs throughout the accordion.\n *\n * @type {string}\n *\n * @see _key\n */\n get key() {\n return this._key;\n }\n\n /**\n * The current action being performed by the carousel.\n *\n * @type {string}\n *\n * @see _currentAction\n */\n get currentAction() {\n return this._currentAction;\n }\n\n /**\n * An array of error messages generated by the carousel.\n *\n * @readonly\n *\n * @type {string[]}\n *\n * @see _errors\n */\n get errors() {\n return this._errors;\n }\n\n set currentItem(value) {\n isValidType(\"number\", { value });\n\n if (value === this.currentItem) {\n return;\n }\n\n if (value < 0) {\n this._currentItem = 0;\n } else if (value >= this.dom.carouselItems.length) {\n this._currentItem = this.dom.carouselItems.length - 1;\n } else {\n this._currentItem = value;\n }\n\n // Keep the aria selected in sync with the current item.\n const tabs = this._dom.carousel.querySelectorAll(\n this.selectors.carouselTab\n );\n if (tabs) {\n this.dom.carouselItems.forEach((item, index) => {\n item.setAttribute(\"aria-selected\", index === this._currentItem);\n });\n }\n }\n\n set autoplay(value) {\n isValidType(\"boolean\", { value });\n\n if (this._autoplay !== value) {\n this._autoplay = value;\n }\n }\n\n set activeClass(value) {\n isValidClassList({ activeClass: value });\n\n if (this._activeClass !== value) {\n this._activeClass = value;\n }\n }\n\n set previousClass(value) {\n isValidClassList({ previousClass: value });\n\n if (this._previousClass !== value) {\n this._previousClass = value;\n }\n }\n\n set nextClass(value) {\n isValidClassList({ nextClass: value });\n\n if (this._nextClass !== value) {\n this._nextClass = value;\n }\n }\n\n set playClass(value) {\n isValidClassList({ playClass: value });\n\n if (this._playClass !== value) {\n this._playClass = value;\n }\n }\n\n set pauseClass(value) {\n isValidClassList({ pauseClass: value });\n\n if (this._pauseClass !== value) {\n this._pauseClass = value;\n }\n }\n\n set transitionDelay(value) {\n isValidType(\"number\", { value });\n\n if (value !== this.transitionDelay && value >= 0) {\n this._currentItem = value;\n }\n }\n\n set transitionDuration(value) {\n isValidType(\"number\", { value });\n\n if (this._transitionDuration !== value && value >= 0) {\n this._transitionDuration = value;\n this._setTransitionDuration();\n }\n }\n\n set playText(value) {\n isValidType(\"string\", { value });\n\n if (this._playText !== value) {\n this._playText = value;\n }\n }\n\n set pauseText(value) {\n isValidType(\"string\", { value });\n\n if (this._pauseText !== value) {\n this._pauseText = value;\n }\n }\n\n set prefix(value) {\n isValidType(\"string\", { value });\n\n if (this._prefix !== value) {\n this._prefix = value;\n }\n }\n\n set key(value) {\n isValidType(\"string\", { value });\n\n if (this._key !== value) {\n this._key = value;\n }\n }\n\n /**\n * Validates all aspects of the carousel to ensure proper functionality.\n *\n * @protected\n *\n * @return {boolean} - The results of the validation.\n */\n _validate() {\n let check = true;\n\n // HTML element checks.\n const htmlElementChecks = isValidInstance(HTMLElement, {\n carousel: this.dom.carousel,\n });\n\n if (!htmlElementChecks) {\n this._errors.push(htmlElementChecks.message);\n check = false;\n }\n\n // Query selector checks.\n const querySelectorChecks = isQuerySelector({\n carouselItemsSelector: this._selectors.carouselItems,\n carouselItemContainerSelector: this._selectors.carouselItemContainer,\n carouselControlsSelector: this._selectors.carouselControls,\n carouselControlContainerSelector:\n this._selectors.carouselControlContainer,\n carouselTabsSelector: this._selectors.carouselTabs,\n carouselTabContainerSelector: this._selectors.carouselTabContainer,\n autoplaySelector: this._selectors.autoplay,\n nextSelector: this._selectors.next,\n previousSelector: this._selectors.previous,\n });\n\n if (!querySelectorChecks) {\n this._errors.push(querySelectorChecks.message);\n check = false;\n }\n\n // Autoplay checks.\n const autoplayChecks = isValidType(\"boolean\", { autoplay: this.autoplay });\n\n if (!autoplayChecks) {\n this._errors.push(autoplayChecks.message);\n check = false;\n }\n\n // Check delay is a valid value.\n const delayCheck = isValidType(\"number\", {\n transitionDelay: this._transitionDelay,\n });\n\n if (!delayCheck) {\n this._errors.push(delayCheck.message);\n check = false;\n }\n\n // Check duration is a valid value.\n const durationCheck = isValidType(\"number\", {\n transitionDuration: this._transitionDuration,\n });\n\n if (!durationCheck) {\n this._errors.push(durationCheck.message);\n check = false;\n }\n\n // Active class checks.\n if (this._activeClass !== \"\") {\n const activeClassChecks = isValidClassList({\n activeClass: this._activeClass,\n });\n\n if (!activeClassChecks) {\n this._errors.push(activeClassChecks.message);\n check = false;\n }\n }\n\n // Previous class checks.\n if (this._previousClass !== \"\") {\n const previousClassChecks = isValidClassList({\n previousClass: this._previousClass,\n });\n\n if (!previousClassChecks) {\n this._errors.push(previousClassChecks.message);\n check = false;\n }\n }\n\n // Next class checks.\n if (this._nextClass !== \"\") {\n const nextClassChecks = isValidClassList({\n nextClass: this._nextClass,\n });\n\n if (!nextClassChecks) {\n this._errors.push(nextClassChecks.message);\n check = false;\n }\n }\n\n // Play class checks.\n if (this._playClass !== \"\") {\n const playClassChecks = isValidClassList({\n playClass: this._playClass,\n });\n\n if (!playClassChecks) {\n this._errors.push(playClassChecks.message);\n check = false;\n }\n }\n\n // Pause class checks.\n if (this._pauseClass !== \"\") {\n const pauseClassChecks = isValidClassList({\n pauseClass: this._pauseClass,\n });\n\n if (!pauseClassChecks) {\n this._errors.push(pauseClassChecks.message);\n check = false;\n }\n }\n\n // Play text checks.\n if (this._playText !== \"\") {\n const playTextChecks = isValidType(\"string\", {\n playText: this._playText,\n });\n\n if (!playTextChecks) {\n this._errors.push(playTextChecks.message);\n check = false;\n }\n }\n\n // Pause text checks.\n if (this._pauseText !== \"\") {\n const pauseTextChecks = isValidType(\"string\", {\n pauseText: this._pauseText,\n });\n\n if (!pauseTextChecks) {\n this._errors.push(pauseTextChecks.message);\n check = false;\n }\n }\n\n // Prefix checks.\n const prefixChecks = isValidType(\"string\", { prefix: this._prefix });\n\n if (!prefixChecks) {\n this._errors.push(prefixChecks.message);\n check = false;\n }\n\n return check;\n }\n\n /**\n * Sets DOM elements within the carousel.\n *\n * The carousel element _cannot_ be set through this method.\n *\n * @protected\n *\n * @param {string} elementType - The type of element to populate.\n * @param {HTMLElement} [base = this.dom.carousel] - The element used as the base for the querySelector.\n * @param {boolean} [overwrite = true] - A flag to set if the existing elements will be overwritten.\n */\n _setDOMElementType(elementType, base = this.dom.carousel, overwrite = true) {\n if (typeof this.selectors[elementType] === \"string\") {\n if (elementType === \"carousel\") {\n throw new Error(\n `Graupl Carousel: \"${elementType}\" element cannot be set through _setDOMElementType.`\n );\n }\n\n if (base !== this.dom.carousel) isValidInstance(HTMLElement, { base });\n\n if (Array.isArray(this._dom[elementType])) {\n // Get all the elements matching the selector in the base.\n const domElements = Array.from(\n base.querySelectorAll(this.selectors[elementType])\n );\n\n // Filter the elements so only direct children of the base are kept.\n const filteredElements = domElements.filter(\n (item) => item.parentElement === base\n );\n\n if (overwrite) {\n this._dom[elementType] = filteredElements;\n } else {\n this._dom[elementType] = [\n ...this._dom[elementType],\n ...filteredElements,\n ];\n }\n } else {\n // Get the single element matching the selector in the base.\n const domElement = base.querySelector(this.selectors[elementType]);\n\n // Ensure the element is a direct child of the base.\n if (domElement && domElement.parentElement !== base) {\n return;\n }\n\n if (overwrite) {\n this._dom[elementType] = domElement;\n }\n }\n } else {\n throw new Error(\n `Graupl Carousel: \"${elementType}\" is not a valid element type within the carousel.`\n );\n }\n }\n\n /**\n * Resets DOM elements within the menu.\n *\n * The carousel element _cannot_ be reset through this method.\n *\n * @protected\n *\n * @param {string} elementType - The type of element to clear.\n */\n _resetDOMElementType(elementType) {\n if (typeof this.selectors[elementType] === \"string\") {\n if (elementType === \"carousel\") {\n throw new Error(\n `Graupl Carousel: \"${elementType}\" element cannot be reset through _resetDOMElementType.`\n );\n }\n\n if (Array.isArray(this._dom[elementType])) {\n this._dom[elementType] = [];\n } else {\n this._dom[elementType] = null;\n }\n } else {\n throw new Error(\n `Graupl Carousel: \"${elementType}\" is not a valid element type within the carousel.`\n );\n }\n }\n\n /**\n * Sets all DOM elements within the carousel.\n *\n * Utilizes _setDOMElementType and _resetDOMElementType.\n *\n * @protected\n */\n _setDOMElements() {\n this._setDOMElementType(\"carouselItemContainer\");\n this._setDOMElementType(\"carouselControlContainer\");\n this._setDOMElementType(\"carouselTabContainer\");\n\n if (this.dom.carouselItemContainer) {\n this._setDOMElementType(\"carouselItems\", this.dom.carouselItemContainer);\n }\n if (this.dom.carouselControlContainer) {\n this._setDOMElementType(\n \"carouselControls\",\n this.dom.carouselControlContainer\n );\n this._setDOMElementType(\"autoplay\", this.dom.carouselControlContainer);\n this._setDOMElementType(\"next\", this.dom.carouselControlContainer);\n this._setDOMElementType(\"previous\", this.dom.carouselControlContainer);\n }\n\n if (this._dom.carouselTabContainer) {\n this._setDOMElementType(\"carouselTabs\", this.dom.carouselTabContainer);\n }\n }\n\n /**\n * Generates a key for the carousel.\n *\n * @param {boolean} [regenerate = false] - A flag to determine if the key should be regenerated.\n */\n _generateKey(regenerate = false) {\n if (this.key === \"\" || regenerate) {\n this.key = Math.random()\n .toString(36)\n .replace(/[^a-z]+/g, \"\")\n .substring(0, 10);\n }\n }\n\n /**\n * Sets the IDs of the carousel and it's children if they do not already exist.\n *\n * The generated IDs use the key and follow the format:\n * - carousel: `carousel-${key}`\n * - carousel items: `carousel-item-${key}-${index}`\n * - carousel tabs: `carousel-tab-${key}-${index}`\n */\n _setIds() {\n this.dom.carousel.id = this.dom.carousel.id || `carousel-${this.key}`;\n\n this.dom.carouselItems.forEach((item, index) => {\n item.id = item.id || `carousel-item-${this.key}-${index}`;\n });\n\n this.dom.carouselTabs.forEach((tab, index) => {\n tab.id = tab.id || `carousel-tab-${this.key}-${index}`;\n });\n }\n\n /**\n * Sets the aria attributes for the carousel.\n */\n _setAriaAttributes() {\n // Make sure the carousel has a proper role.\n // Sections and role=\"region\" are acceptable in certain cases, so\n // we only need to fallback to role=\"group\" if neither of those are present.\n if (\n !isTag(\"section\", { carousel: this.dom.carousel }) &&\n !this.dom.carousel.getAttribute(\"role\") !== \"region\"\n ) {\n this.dom.carousel.setAttribute(\"role\", \"group\");\n }\n\n // Set the role description for the carousel.\n this._dom.carousel.setAttribute(\"aria-roledescription\", \"carousel\");\n\n if (this.dom.carouselTabContainer) {\n this.dom.carouselTabContainer.setAttribute(\"role\", \"tablist\");\n }\n\n this.dom.carouselTabs.forEach((tab, index) => {\n if (!isTag(\"button\", { tab: tab })) {\n tab.setAttribute(\"role\", \"button\");\n }\n\n tab.setAttribute(\"aria-selected\", index === 0);\n tab.setAttribute(\"aria-controls\", this.dom.carouselItems[index].id);\n });\n }\n\n /**\n * Sets the interval for autoplaying the carousel.\n *\n * @protected\n */\n _setInterval() {\n this._clearInterval();\n\n this._autoplayInterval = setInterval(() => {\n this.activateNextItem();\n }, this.transitionDelay);\n }\n\n /**\n * Clears the interval for autoplaying the carousel.\n *\n * @protected\n */\n _clearInterval() {\n clearInterval(this._autoplayInterval);\n }\n\n /**\n * Handles the autoplay functionality of the carousel.\n *\n * - Adds the appropriate class to the autoplay button.\n * - Removes the appropriate class from the autoplay button.\n * - Sets the appropriate aria-label for the autoplay button.\n * - Sets the appropriate aria-live for the carousel.\n * - Sets/clears the interval for autoplaying the carousel.\n *\n * @protected\n */\n _handleAutoplay() {\n if (this.autoplay) {\n addClass(this.pauseClass, this.dom.autoplay);\n removeClass(this.playClass, this.dom.autoplay);\n\n this.dom.autoplay.setAttribute(\"aria-label\", this.pauseText);\n this.dom.carousel.setAttribute(\"aria-live\", \"off\");\n\n this._setInterval();\n } else {\n addClass(this.playClass, this.dom.autoplay);\n removeClass(this.pauseClass, this.dom.autoplay);\n\n this.dom.autoplay.setAttribute(\"aria-label\", this.playText);\n this.dom.carousel.setAttribute(\"aria-live\", \"polite\");\n\n this._clearInterval();\n }\n }\n\n /**\n * Handles the focus events throughout the carousel for proper use.\n *\n * - Adds a `focusin` listener to the carousel element to pause autoplay.\n * - Adds a `focusout` listener to the carousel element to resume autoplay.\n */\n _handleFocus() {\n // Pause autoplay when anything in the carousel is focused.\n this.dom.carousel.addEventListener(\"focusin\", () => {\n if (this.autoplay) {\n this._clearInterval();\n }\n });\n\n this.dom.carousel.addEventListener(\"focusout\", () => {\n if (this.autoplay) {\n this._setInterval();\n }\n });\n }\n\n /**\n * Handles the click events throughout the carousel.\n *\n * - Adds a `pointerup` listener to the next control to activate the next item.\n * - Adds a `pointerup` listener to the previous control to activate the previous item.\n * - Adds a `pointerup` listener to the autoplay control to toggle autoplay.\n * - Adds a `pointerup` listener to each tab control to activate the corresponding item.\n */\n _handleClick() {\n this.dom.next.addEventListener(\"pointerup\", () => {\n this.activateNextItem();\n });\n\n this.dom.previous.addEventListener(\"pointerup\", () => {\n this.activatePreviousItem();\n });\n\n this.dom.autoplay.addEventListener(\"pointerup\", () => {\n this.toggleAutoplay();\n });\n\n this.dom.carouselTabs.forEach((tab, index) => {\n tab.addEventListener(\"pointerup\", () => {\n if (this.currentItem > index) {\n this._currentAction = \"previous\";\n } else {\n this._currentAction = \"next\";\n }\n\n this.activateItem(index);\n });\n });\n }\n\n /**\n * Handles the hover events throughout the carousel for proper use.\n *\n * - Adds a `pointerover` listener to the carousel to pause autoplay.\n * - Adds a `pointerleave` listener to the carousel to resume autoplay.\n */\n _handleHover() {\n // Pause autoplay when anything in the carousel is hovered.\n this.dom.carousel.addEventListener(\"pointerover\", () => {\n if (this.autoplay) {\n this._clearInterval();\n }\n });\n\n this.dom.carousel.addEventListener(\"pointerleave\", () => {\n if (this.autoplay) {\n this._setInterval();\n }\n });\n }\n\n /**\n * Handles keydown events throughout the carousel item for proper use.\n *\n * - Adds a `keydown` listener to all control elements.\n * - Prevents Space and Enter key events.\n * - Adds a `keydown` listener to all tab elements.\n * - Prevents Space and Enter key events.\n */\n _handleKeydown() {\n this.dom.carouselControls.forEach((control) => {\n control.addEventListener(\"keydown\", (event) => {\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n // Prevent the default action of the event.\n preventEvent(event);\n\n break;\n }\n });\n });\n\n this.dom.carouselTabs.forEach((tab) => {\n tab.addEventListener(\"keydown\", (event) => {\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n // Prevent the default action of the event.\n preventEvent(event);\n\n break;\n }\n });\n });\n }\n\n /**\n * Handles keyup events throughout the carousel item for proper use.\n *\n * - Adds a `keyup` listener to all control elements.\n * - Activates the next/previous item depending on which control is pressed.\n * - Toggles autoplay if the autoplay control is pressed.\n *\n */\n _handleKeyup() {\n // Activate the next item if the space or enter key on the next control.\n this.dom.next.addEventListener(\"keyup\", (event) => {\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n this.activateNextItem();\n\n // Prevent the default action of the event.\n preventEvent(event);\n\n break;\n }\n });\n\n // Activate the previous item if the space or enter key on the previous control.\n this.dom.previous.addEventListener(\"keyup\", (event) => {\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n this.activatePreviousItem();\n\n // Prevent the default action of the event.\n preventEvent(event);\n\n break;\n }\n });\n\n // Toggle autoplay if the space or enter key on the autoplay control.\n this.dom.autoplay.addEventListener(\"keyup\", (event) => {\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n this.toggleAutoplay();\n\n // Prevent the default action of the event.\n preventEvent(event);\n\n break;\n }\n });\n\n // Activate the item if the space or enter key on the tab control.\n this.dom.carouselTabs.forEach((tab, index) => {\n tab.addEventListener(\"keyup\", (event) => {\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n this.activateItem(index);\n\n // Prevent the default action of the event.\n preventEvent(event);\n\n break;\n }\n });\n });\n }\n\n /**\n * Sets the transition duration for the carousel as a CSS custom property.\n *\n * The custom property is set as `--graupl-carousel-transition-duration`.\n *\n * @protected\n */\n _setTransitionDuration() {\n this.dom.carousel.style.setProperty(\n `--${this.prefix}carousel-transition-duration`,\n `${this.transitionDuration}ms`\n );\n }\n\n /**\n * Activates the current carousel item.\n *\n * @public\n */\n activateCurrentItem() {\n addClass(this.activeClass, this.currentCarouselItem);\n\n if (this.currentCarouselTab) {\n this.currentCarouselTab.setAttribute(\"aria-selected\", true);\n addClass(this.activeClass, this.currentCarouselTab);\n }\n }\n\n /**\n * Deactivates the current carousel item.\n *\n * @public\n */\n deactivateCurrentItem() {\n removeClass(this.activeClass, this.currentCarouselItem);\n\n if (this.currentCarouselTab) {\n this.currentCarouselTab.setAttribute(\"aria-selected\", false);\n removeClass(this.activeClass, this.currentCarouselTab);\n }\n }\n\n /**\n * Activates the carousel item at a given index.\n *\n * @public\n *\n * @param {number} index - The index of the carousel item to activate.\n */\n activateItem(index) {\n const currentIndex = this.currentItem;\n\n this.dom.carousel.dataset.grauplAction = this._currentAction;\n\n if (this.autoplay) {\n this._clearInterval();\n }\n\n addClass(this.previousClass, this.currentCarouselItem);\n addClass(this.nextClass, this.dom.carouselItems[index]);\n\n requestAnimationFrame(() => {\n this.deactivateCurrentItem();\n this.currentItem = index;\n this.activateCurrentItem();\n\n requestAnimationFrame(() => {\n setTimeout(() => {\n removeClass(this.previousClass, this.dom.carouselItems[currentIndex]);\n removeClass(this.nextClass, this.currentCarouselItem);\n }, this.transitionDuration);\n });\n });\n\n if (this.autoplay) {\n this._setInterval();\n }\n }\n\n /**\n * Activates the first carousel item.\n *\n * @public\n */\n activateFirstItem() {\n this.activateItem(0);\n }\n\n /**\n * Activates the last carousel item.\n *\n * @public\n */\n activateLastItem() {\n this.activateItem(this.dom.carouselItems.length - 1);\n }\n\n /**\n * Activates the next carousel item.\n *\n * @public\n */\n activateNextItem() {\n this._currentAction = \"next\";\n\n if (this.currentItem + 1 >= this.dom.carouselItems.length) {\n this.activateFirstItem();\n } else {\n this.activateItem(this.currentItem + 1);\n }\n }\n\n /**\n * Activates the previous carousel item.\n *\n * @public\n */\n activatePreviousItem() {\n this._currentAction = \"previous\";\n\n if (this.currentItem - 1 < 0) {\n this.activateLastItem();\n } else {\n this.activateItem(this.currentItem - 1);\n }\n }\n\n /**\n * Toggles autoplay on the carousel.\n *\n * @public\n */\n toggleAutoplay() {\n this.autoplay = !this.autoplay;\n\n this._handleAutoplay();\n }\n}\n\nexport default Carousel;\n","import Carousel from \"./Carousel.js\";\nimport once from \"@drupal/once\";\n\nconst generate = (\n options = {},\n context = document,\n carouselSelector = \".carousel\"\n) => {\n once(\"graupl-carousel-generator\", carouselSelector, context).forEach(\n (carouselElement) => {\n const carouselOptions = carouselElement.dataset.grauplCarouselOptions\n ? JSON.parse(\n carouselElement.dataset.grauplCarouselOptions.replace(/'/g, '\"')\n ) || {}\n : {};\n\n new Carousel({\n carouselElement,\n initialize: true,\n ...options,\n ...carouselOptions,\n });\n }\n );\n};\n\nexport default generate;\n","import storage from \"../storage.js\";\nimport once from \"@drupal/once\";\n\nconst generate = (\n options = {},\n context = document,\n navigationSelector = \".navigation\"\n) => {\n once(\"graupl-navigation-generator\", navigationSelector, context).forEach(\n (navigationElement) => {\n const MenuConstructor =\n navigationElement.dataset.grauplMenuType || DisclosureMenu;\n\n if (window[MenuConstructor] === undefined) {\n console.warn(\n `Graupl navigation requires accessible-menu's ${MenuConstructor}. Please make sure to include it on this page.`\n );\n\n return;\n }\n\n const menuOptions = navigationElement.dataset.grauplMenuOptions\n ? JSON.parse(\n navigationElement.dataset.grauplMenuOptions.replace(/'/g, '\"')\n ) || {}\n : {};\n const menuElement = navigationElement.querySelector(\".menu\");\n const controllerElement =\n navigationElement.querySelector(\".navigation-toggle\") || null;\n const containerElement = controllerElement ? navigationElement : null;\n const menu = new window[MenuConstructor]({\n menuElement,\n menuItemSelector: \".menu-item\",\n menuLinkSelector: \".menu-link\",\n submenuItemSelector: \".submenu-item\",\n submenuToggleSelector: \".submenu-toggle\",\n controllerElement,\n containerElement,\n ...options,\n ...menuOptions,\n });\n\n storage.initializeStorage(\"menus\");\n storage.pushToStorage(\"menus\", menu.dom.menu.id, menu);\n }\n );\n};\n\nexport default generate;\n","/**\n * A utility class that maintains a \"current\" value and a \"committed\" value.\n *\n * Useful when you need to:\n * - Track in-progress edits and revert to the last saved state.\n * - Compare pending and committed states.\n * - Know if a value has changed since last commit.\n *\n * @example\n * // Managing a form field\n * const username = new TransactionalValue(\"Nick\");\n * username.value = \"NickDJM\";\n * if (username.isDirty) {\n * console.log(\"Unsaved changes detected\");\n * username.commit(); // saves the new value\n * }\n *\n * @example\n * // Reverting edits\n * const counter = new TransactionalValue(10);\n * counter.value = 15;\n * counter.reset(); // reverts to 10\n */\nexport class TransactionalValue {\n /**\n * Creates a new TransactionalValue instance.\n *\n * @param {*} initialValue - The starting (and initially committed) value.\n * @param {{ equals?: function(*, *): boolean }} [options] - Optional config.\n * @param {function(*, *): boolean} [options.equals] - Custom equality comparator. Defaults to `Object.is`.\n */\n constructor(initialValue, options = {}) {\n /**\n * A comparator function used to check equality between\n * the current and committed values.\n *\n * @private\n *\n * @type {function(*, *): boolean}\n */\n this._equals = options.equals || Object.is;\n\n /**\n * The current, editable value.\n *\n * @private\n *\n * @type {*}\n */\n this._current = initialValue;\n\n /**\n * The last committed (baseline) value.\n *\n * @private\n *\n * @type {*}\n */\n this._committed = initialValue;\n }\n\n /**\n * Gets the current editable value.\n *\n * @return {*} The current value.\n *\n * @see _current\n */\n get value() {\n return this._current;\n }\n\n /**\n * Sets the current editable value.\n *\n * @param {*} val - The new value.\n */\n set value(val) {\n this._current = val;\n }\n\n /**\n * Gets the last committed (baseline) value.\n *\n * @readonly\n *\n * @return {*} The last committed value.\n *\n * @see _committed\n */\n get committed() {\n return this._committed;\n }\n\n /**\n * Checks whether the current value differs from the committed one.\n *\n * @readonly\n *\n * @return {boolean} `true` if current and committed values differ.\n */\n get isDirty() {\n return !this._equals(this._current, this._committed);\n }\n\n /**\n * Commits the current value, setting it as the new baseline.\n *\n * @return {TransactionalValue} The current instance.\n */\n commit() {\n this._committed = this._current;\n return this;\n }\n\n /**\n * Resets the current value to the committed baseline.\n *\n * @return {TransactionalValue} The current instance.\n */\n reset() {\n this._current = this._committed;\n return this;\n }\n\n /**\n * Applies a functional update to the current value.\n *\n * @param {function(*): *} fn - A function that receives the previous value and returns the new one.\n * @return {TransactionalValue} The current instance.\n *\n * @example\n * const t = new TransactionalValue(1);\n * t.update(n => n + 1); // 2\n */\n update(fn) {\n this._current = fn(this._current);\n return this;\n }\n}\n","/**\n * @file\n * The Disclosure class.\n */\n\nimport {\n isValidInstance,\n isValidClassList,\n isValidType,\n isValidState,\n isValidEvent,\n isTag,\n isQuerySelector,\n} from \"../validate.js\";\nimport { addClass, removeClass } from \"../domHelpers.js\";\nimport { keyPress, preventEvent } from \"../eventHandlers.js\";\nimport storage from \"../storage.js\";\nimport { TransactionalValue } from \"../TransactionalValue.js\";\n\nclass Disclosure {\n /**\n * The DOM elements within the disclosure.\n *\n * @protected\n *\n * @type {Object<HTMLElement>}\n *\n * @property {HTMLElement} controller - The disclosure toggle element.\n * @property {HTMLElement} disclosure - The disclosure element.\n * @property {HTMLElement} content - The disclosure content element.\n */\n _dom = {\n controller: null,\n disclosure: null,\n content: null,\n };\n\n /**\n * The DOM elements within the disclosure that cannot be reset or generated by the disclosure itself.\n *\n * @protected\n *\n * @type {string[]}\n */\n _domLock = [\"controller\", \"disclosure\"];\n\n /**\n * The query selectors used by the disclosure.\n *\n * @protected\n *\n * @type {Object<string>}\n *\n * @property {string} content - The query selector for the disclosure content.\n */\n _selectors = {\n content: \"\",\n };\n\n /**\n * The classes to apply when the disclosure is in various states.\n *\n * @protected\n *\n * @type {Object<string, string[]>}\n *\n * @property {string|string[]} open - The class(es) to apply when the disclosure is open.\n * @property {string|string[]} close - The class(es) to apply when the disclousre is closed.\n * @property {string|string[]} tranistion - The class(es) to apply when the disclosure is transitioning between states.\n * @property {string|string[]} initialize - The class(es) to apply when the disclosure is initializing.\n */\n _classes = {\n open: \"show\",\n close: \"hide\",\n transition: \"transitioning\",\n initialize: \"initializing\",\n };\n\n /**\n * The duration times (in milliseconds) for various things throughout the disclosure.\n *\n * @protected\n *\n * @type {Object<number>}\n *\n * @property {number} transition - The duration time (in milliseconds) for the transition between open and closed states.\n * @property {number} open - The duration time (in milliseconds) for the transition from closed to open states.\n * @property {number} close - The duration time (in milliseconds) for the transition from open to closed states.\n */\n _durations = {\n transition: 5000,\n open: -1,\n close: -1,\n };\n\n /**\n * The current state of the disclosure's focus.\n *\n * @protected\n *\n * @type {string}\n */\n _focusState = \"none\";\n\n /**\n * This last event triggered on the disclosure.\n *\n * @protected\n *\n * @type {string}\n */\n _currentEvent = \"none\";\n\n /**\n * The open state of the disclosure.\n *\n * @protected\n *\n * @type {TransactionalValue<boolean>}\n */\n _open = new TransactionalValue(false);\n\n /**\n * A value to force the disclosure open when the breakpoint width is passed.\n *\n * @protected\n *\n * @type {boolean}\n */\n _shouldOpen = false;\n\n /**\n * Whether or not to close the disclosure when it loses focus in the DOM.\n *\n * @protected\n *\n * @type {boolean}\n */\n _closeOnBlur = false;\n\n /**\n * The width of the screen (in pixels) that the disclosure will automatically open/close itself.\n *\n * @protected\n *\n * @type {number}\n */\n _breakpointWidth = -1;\n\n /**\n * This ResizeObserver for the disclosure.\n *\n * @protected\n *\n * @type {ResizeObserver|null}\n */\n _observer = null;\n\n /**\n * The event that is triggered when the disclosure expands.\n *\n * @protected\n *\n * @event grauplDisclosureExpand\n *\n * @type {CustomEvent}\n *\n * @property {boolean} bubbles - A flag to bubble the event.\n * @property {Object<Disclosure>} details - The details object containing the Disclosure itself.\n */\n _expandEvent = new CustomEvent(\"grauplDisclosureExpand\", {\n bubbles: true,\n detail: { disclosure: this },\n });\n\n /**\n * The event that is triggered when the disclosure collapses.\n *\n * @protected\n *\n * @event grauplDisclosureCollapse\n *\n * @type {CustomEvent}\n *\n * @property {boolean} bubbles - A flag to bubble the event.\n * @property {Object<Disclosure>} details - The details object containing the Disclosure itself.\n */\n _collapseEvent = new CustomEvent(\"grauplDisclosureCollapse\", {\n bubbles: true,\n detail: { disclosure: this },\n });\n\n /**\n * The prefix to use for CSS custom properties.\n *\n * @protected\n *\n * @type {string}\n */\n _prefix = \"graupl-\";\n\n /**\n * The key used to generate IDs throughout the disclosure.\n *\n * @protected\n *\n * @type {string}\n */\n _key = \"\";\n\n /**\n * An array of error messages generated by the disclosure.\n *\n * @protected\n *\n * @type {string[]}\n */\n _errors = [];\n\n /**\n * Constructs a new `Disclosure`.\n *\n * @param {object} options - The options for generating the disclosure.\n * @param {HTMLElement} options.disclosureElement - The disclosure element in the DOM.\n * @param {HTMLElement} options.controllerElement - The disclosure toggle element in the DOM.\n * @param {string} [options.disclosureContentSelector = .disclosure-content] - The query selector string for the disclosure content.\n * @param {?(string|string[])} [options.openClass = show] - The class to apply when a disclosure is \"open\".\n * @param {?(string|string[])} [options.closeClass = hide] - The class to apply when a disclosure is \"closed\".\n * @param {?(string|string[])} [options.transitionClass = transitioning] - The class to apply when a disclosure is transitioning between \"open\" and \"closed\" states.\n * @param {number} [options.transitionDuration = 250] - The duration of the transition between \"open\" and \"closed\" states (in milliseconds).\n * @param {boolean} [options.openDuration = -1] - The duration of the transition from \"closed\" to \"open\" states (in milliseconds).\n * @param {boolean} [options.closeDuration = -1] - The duration of the transition from \"open\" to \"closed\" states (in milliseconds).\n * @param {boolean} [options.closeOnBlur = false] - Whether to close the disclosure when it loses focus in the dom.\n * @param {boolean} [options.minWidth = -1] - The width of the screen (in pixels) that the disclosure will automatically open/close itself.\n * @param {boolean} [options.autoOpen = false] - Whether to automatically open when above the minWidth.\n * @param {?string} [options.prefix = graupl-] - The prefix to use for CSS custom properties.\n * @param {?(string|string[])} [options.initializeClass = initializing] - The class to apply when a disclosure is initialzing.\n * @param {boolean} [options.initialize = false] - Whether to initialize the disclosure upon construction.\n */\n constructor({\n disclosureElement,\n controllerElement,\n disclosureContentSelector = \".disclosure-content\",\n openClass = \"show\",\n closeClass = \"hide\",\n transitionClass = \"transitioning\",\n transitionDuration = 250,\n openDuration = -1,\n closeDuration = -1,\n closeOnBlur = false,\n minWidth = -1,\n autoOpen = false,\n prefix = \"graupl-\",\n initializeClass = \"initializing\",\n initialize = false,\n }) {\n // Set the DOM elements.\n this._dom.disclosure = disclosureElement;\n this._dom.controller = controllerElement;\n\n // Set the DOM selectors.\n this._selectors.content = disclosureContentSelector;\n\n // Set the classes.\n this._classes.open = openClass || \"\";\n this._classes.close = closeClass || \"\";\n this._classes.transition = transitionClass || \"\";\n this._classes.initialize = initializeClass || \"\";\n\n // Set the transition durations.\n this._durations.transition = transitionDuration;\n this._durations.open = openDuration;\n this._durations.close = closeDuration;\n\n // Set close on blur.\n this._closeOnBlur = closeOnBlur;\n\n // Set collapse width and auto open functionality.\n this._breakpointWidth = minWidth;\n this._shouldOpen = autoOpen;\n\n // Set the prefix.\n this._prefix = prefix;\n\n if (initialize) {\n this.initialize();\n }\n }\n\n /**\n * Initializes the disclosure.\n */\n initialize() {\n try {\n if (!this._validate()) {\n throw new Error(\n `Graupl Disclosure: cannot initialize disclosure. The following errors have been found:\\n - ${this.errors.join(\n \"\\n - \"\n )}`\n );\n }\n\n addClass(this._classes.initialize, this.dom.disclosure);\n\n // Set up the DOM.\n this._generateKey();\n this._setDOMElements();\n this._setIds();\n this._setAriaAttributes();\n\n // Handle events.\n this._handleFocus();\n this._handleClick();\n this._handleKeydown();\n this._handleKeyup();\n this._handleResize();\n\n // Set the custom props.\n this._setTransitionDurations();\n\n // Set up the storage.\n storage.initializeStorage(\"disclosures\");\n storage.pushToStorage(\"disclosures\", this.dom.disclosure.id, this);\n\n if (\n this.dom.controller.getAttribute(\"aria-expanded\") === \"true\" ||\n (this.shouldOpen && window.matchMedia(this.openQuery).matches)\n ) {\n this._expand({ emit: false, transition: false });\n } else {\n this._collapse({ emit: false, transition: false });\n }\n\n requestAnimationFrame(() => {\n removeClass(this._classes.initialize, this.dom.disclosure);\n });\n } catch (error) {\n console.error(error);\n }\n }\n\n /**\n * The DOM elements within the disclosure.\n *\n * @readonly\n *\n * @type {Object<HTMLElement>}\n *\n * @see _dom\n */\n get dom() {\n return this._dom;\n }\n\n /**\n * The query selectors used by the disclosure.\n *\n * @readonly\n *\n * @type {Object<string>}\n *\n * @see _selectors\n */\n get selectors() {\n return this._selectors;\n }\n\n /**\n * The class(es) to apply when the disclosure is open.\n *\n * @type {string|string[]}\n *\n * @see _classes.open\n */\n get openClass() {\n return this._classes.open;\n }\n\n set openClass(value) {\n isValidClassList({ openClass: value });\n\n if (this._classes.open !== value) {\n this._classes.open = value;\n }\n }\n\n /**\n * The class(es) to apply when the disclosure is closed.\n *\n * @type {string|string[]}\n *\n * @see _classes.close\n */\n get closeClass() {\n return this._classes.close;\n }\n\n set closeClass(value) {\n isValidClassList({ closeClass: value });\n\n if (this._classes.close !== value) {\n this._classes.close = value;\n }\n }\n\n /**\n * The class(es) to apply when the disclosure is transitioning between open and closed.\n *\n * @type {string|string[]}\n *\n * @see _classes.transition\n */\n get transitionClass() {\n return this._classes.transition;\n }\n\n set transitionClass(value) {\n isValidClassList({ transitionClass: value });\n\n if (this._classes.transition !== value) {\n this._classes.transition = value;\n }\n }\n\n /**\n * The class(es) to apply to the shelf when the disclosure is initializing.\n *\n * @type {string|string[]}\n *\n * @see _classes\n */\n get initializeClass() {\n return this._classes.initialize;\n }\n\n set initializeClass(value) {\n isValidClassList({ initializeClass: value });\n\n if (this._classes.initialize !== value) {\n this._classes.initialize = value;\n }\n }\n\n /**\n * The duration time (in milliseconds) for the transition between open and closed states.\n *\n * Setting this value will also set the --graupl-transition-duration CSS custom property on the disclosure.\n *\n * @type {number}\n *\n * @see _durations.transition\n */\n get transitionDuration() {\n return this._durations.transition;\n }\n\n set transitionDuration(value) {\n isValidType(\"number\", { value });\n\n if (this._durations.transition !== value) {\n this._durations.transition = value;\n this._setTransitionDurations();\n }\n }\n\n /**\n * The duration time (in milliseconds) for the transition from closed to open states.\n *\n * If openDuration is set to -1, the transitionDuration value will be used instead.\n *\n * Setting this value will also set the --graupl-open-transition-duration CSS custom property on the disclosure.\n *\n * @type {number}\n *\n * @see _durations.open\n */\n get openDuration() {\n if (this._durations.open === -1) return this.transitionDuration;\n\n return this._durations.open;\n }\n\n set openDuration(value) {\n isValidType(\"number\", { value });\n\n if (this._durations.open !== value) {\n this._durations.open = value;\n this._setTransitionDurations();\n }\n }\n\n /**\n * The duration time (in milliseconds) for the transition from open to closed states.\n *\n * If closeDuration is set to -1, the transitionDuration value will be used instead.\n *\n * Setting this value will also set the --graupl-close-transition-duration CSS custom property on the disclosure.\n *\n * @type {number}\n *\n * @see _durations.close\n */\n get closeDuration() {\n if (this._durations.close === -1) return this.transitionDuration;\n\n return this._durations.close;\n }\n\n set closeDuration(value) {\n isValidType(\"number\", { value });\n\n if (this._durations.close !== value) {\n this._durations.close = value;\n this._setTransitionDurations();\n }\n }\n\n /**\n * The width of the screen (in pixels) that the disclosure will automatically open/close itself.\n *\n * @type {number}\n *\n * @see _breakpointWidth\n */\n get minWidth() {\n return this._breakpointWidth;\n }\n\n set minWidth(value) {\n isValidType(\"number\", { value });\n\n if (this._breakpointWidth !== value) {\n this._breakpointWidth = value;\n }\n }\n\n /**\n * Whether to close the disclosure when it loses focus in the DOM.\n *\n * @type {boolean}\n *\n * @see _closeOnBlur\n */\n get closeOnBlur() {\n return this._closeOnBlur;\n }\n\n set closeOnBlur(value) {\n isValidType(\"boolean\", { value });\n\n if (this._closeOnBlur !== value) {\n this._closeOnBlur = value;\n }\n }\n\n /**\n * The current state of the disclosure's focus.\n *\n * @type {string}\n *\n * @see _focusState\n */\n get focusState() {\n return this._focusState;\n }\n\n set focusState(value) {\n isValidState({ value });\n\n if (this._focusState !== value) {\n this._focusState = value;\n }\n }\n\n /**\n * The last event triggered on the disclosure.\n *\n * @type {string}\n *\n * @see _currentEvent\n */\n get currentEvent() {\n return this._currentEvent;\n }\n\n set currentEvent(value) {\n isValidEvent({ value });\n\n if (this._currentEvent !== value) {\n this._currentEvent = value;\n }\n }\n\n /**\n * The prefix to use for CSS custom properties.\n *\n * @type {string}\n *\n * @see _prefix\n */\n get prefix() {\n return this._prefix;\n }\n\n set prefix(value) {\n isValidType(\"string\", { value });\n\n if (this._prefix !== value) {\n this._prefix = value;\n this._setTransitionDurations();\n }\n }\n\n /**\n * The open state of the disclosure.\n *\n * @readonly\n *\n * @type {boolean}\n *\n * @see _open\n */\n get isOpen() {\n return this._open.value;\n }\n\n /**\n * The open state of the disclosure that the user specifically triggered.\n *\n * @readonly\n *\n * @type {boolean}\n *\n * @see _open\n */\n get hasOpened() {\n return this._open.committed;\n }\n\n /**\n * A value to force opening reguardless of user interaction.\n *\n * @type {boolean}\n *\n * @see _shouldOpen\n */\n get shouldOpen() {\n return this._shouldOpen;\n }\n\n set shouldOpen(value) {\n isValidType(\"boolean\", { value });\n\n if (this._shouldOpen !== value) {\n this._shouldOpen = value;\n }\n }\n\n /**\n * A media query for when the disclosure should open.\n *\n * Will return an empty string if no min width is set.\n *\n * @readonly\n *\n * @type {string}\n */\n get openQuery() {\n if (this.minWidth === -1) {\n return \"\";\n }\n\n return `(width > ${this.minWidth}px)`;\n }\n\n /**\n * A media query for when the disclosure should close.\n *\n * Will return an empty string if no min width is set.\n *\n * @readonly\n *\n * @type {string}\n */\n get closeQuery() {\n if (this.minWidth === -1) {\n return \"\";\n }\n\n return `(width <= ${this.minWidth}px)`;\n }\n\n /**\n * A flag to check if the disclosure's focus methods should _actually_ move the focus in the DOM.\n *\n * This will be `false` unless any of the following criteria are met:\n * - The disclosure's current event is \"keyboard\".\n *\n * @readonly\n *\n * @type {boolean}\n */\n get shouldFocus() {\n let check = false;\n\n if (this.currentEvent === \"keyboard\") {\n check = true;\n }\n\n return check;\n }\n\n /**\n * The key used to generate IDs throughout the disclosure.\n *\n * @type {string}\n *\n * @see _key\n */\n get key() {\n return this._key;\n }\n\n /**\n * An array of error messages generated by the disclosure.\n *\n * @readonly\n *\n * @type {string[]}\n *\n * @see _errors\n */\n get errors() {\n return this._errors;\n }\n\n /**\n * Validates all aspects on the disclosure to ensure proper functionality.\n *\n * @protected\n *\n * @return {boolean} - The result of the validation.\n */\n _validate() {\n let check = true;\n\n // HTML element checks.\n const htmlElementChecks = isValidInstance(HTMLElement, {\n disclosureElement: this._dom.disclosure,\n controllerElement: this._dom.controller,\n });\n\n if (!htmlElementChecks.status) {\n this._errors.push(htmlElementChecks.error.message);\n check = false;\n }\n\n // Query selector checks.\n const querySelectors = {};\n\n for (const querySelector of Object.keys(this._selectors)) {\n querySelectors[`${querySelector}Selector`] =\n this._selectors[querySelector];\n }\n\n const querySelectorChecks = isQuerySelector(querySelectors);\n\n if (!querySelectorChecks) {\n this._errors.push(querySelectorChecks.message);\n check = false;\n }\n\n // Class list checks.\n const classes = {};\n\n for (const className of Object.keys(this._classes)) {\n if (this._classes[className] === \"\") {\n continue;\n }\n\n classes[`${className}Class`] = this._classes[className];\n }\n\n const classListChecks = isValidClassList(classes);\n\n if (!classListChecks.status) {\n this._errors.push(classListChecks.error.message);\n check = false;\n }\n\n // Duration checks.\n const durations = {};\n\n for (const durationName of Object.keys(this._durations)) {\n durations[`${durationName}Duration`] = this._durations[durationName];\n }\n\n const durationChecks = isValidType(\"number\", durations);\n\n if (!durationChecks.status) {\n this._errors.push(durationChecks.error.message);\n check = false;\n }\n\n // Prefix check.\n const prefixCheck = isValidType(\"string\", { prefix: this._prefix });\n\n if (!prefixCheck.status) {\n this._errors.push(prefixCheck.error.message);\n check = false;\n }\n\n return check;\n }\n\n /**\n * Generates a key for the tabs.\n *\n * @param {Object<boolean>} [options = {}] - Options for generating the key.\n * @param {boolean} [options.regenerate = false] - A flag to determine if the key should be regenerated.\n */\n _generateKey({ regenerate = false } = {}) {\n if (this.key === \"\" || regenerate) {\n this._key = Math.random()\n .toString(36)\n .replace(/[^a-z]+/g, \"\")\n .substring(0, 10);\n }\n }\n\n /**\n * Sets the IDs of the disclosure and it's controller if they do not already exist.\n *\n * The generated IDs use the key and follow the format:\n * - disclosure: `disclosure-${key}`\n * - controller: `disclosure-controller-${key}`\n *\n * @protected\n */\n _setIds() {\n this.dom.disclosure.id = this.dom.disclosure.id || `disclosure-${this.key}`;\n this.dom.controller.id =\n this.dom.controller.id || `disclosure-controller-${this.key}`;\n }\n\n /**\n * Sets the ARIA attributes on the disclosure and its controller.\n *\n * The first steps are to ensure that the controlled has `aria-expanded` set to \"false\"\n * if it's not already explicity set to \"true\".\n *\n * Then, set the `aria-controls` attribute on the controller to the disclosure's ID.\n *\n * Finally, ensure the controller element has a role of \"button\" if it is not a native button element.\n *\n * @protected\n */\n _setAriaAttributes() {\n // If the controller element doesn't have aria-expanded set to true, set it to false.\n if (this.dom.controller.getAttribute(\"aria-expanded\") !== \"true\") {\n this.dom.controller.setAttribute(\"aria-expanded\", \"false\");\n }\n\n // Set the aria-controls attribute on the controller to the disclosure's ID.\n this.dom.controller.setAttribute(\"aria-controls\", this.dom.disclosure.id);\n\n // If the controller element is not a button, set its role to button.\n if (!isTag(\"button\", { controller: this.dom.controller })) {\n this.dom.controller.setAttribute(\"role\", \"button\");\n }\n }\n\n /**\n * Sets the transition durations of the disclosure as a CSS custom properties.\n *\n * The custom properties are:\n * - `--graupl-disclosure-transition-duration`,\n * - `--graupl-disclosure-open-transition-duration`, and\n * - `--graupl-disclosure-close-transition-duration`.\n *\n * The prefix of `graupl-` can be changed by setting the disclosure's prefix value.\n *\n * @protected\n */\n _setTransitionDurations() {\n this.dom.disclosure.style.setProperty(\n `--${this.prefix}disclosure-transition-duration`,\n `${this.transitionDuration}ms`\n );\n\n this.dom.disclosure.style.setProperty(\n `--${this.prefix}disclosure-open-transition-duration`,\n `${this.openDuration}ms`\n );\n\n this.dom.disclosure.style.setProperty(\n `--${this.prefix}disclosure-close-transition-duration`,\n `${this.closeDuration}ms`\n );\n }\n\n /**\n * Sets DOM elements.\n *\n * Elements listed in _domLock cannot be set using this method.\n *\n * @protected\n *\n * @param {string} elementType - The type of element to populate.\n * @param {Object<HTMLElement,boolean>} [options = {}] - The options for setting the DOM element type.\n * @param {HTMLElement} [options.base = this.dom.disclosure] - The element used as the base for the querySelector.\n * @param {boolean} [options.overwrite = true] - A flag to set if the existing elements will be overwritten.\n * @param {boolean} [options.strict = true] - A flag to set if the elements must be direct children of the base.\n */\n _setDOMElementType(\n elementType,\n { base = this.dom.disclosure, overwrite = true, strict = true } = {}\n ) {\n if (typeof this.selectors[elementType] === \"string\") {\n if (this._domLock.includes(elementType)) {\n throw new Error(\n `Graupl ${this.constructor.name}: \"${elementType}\" element cannot be set through _setDOMElementType.`\n );\n }\n\n if (base !== this.dom.disclosure) isValidInstance(HTMLElement, { base });\n\n // Get the all elements matching the selector in the base.\n const domElements = Array.from(\n base.querySelectorAll(this.selectors[elementType])\n );\n\n // Filter the elements so only direct children of the base are kept.\n const filteredElements = domElements.filter((item) =>\n strict ? item.parentElement === base : true\n );\n\n if (overwrite) {\n if (Array.isArray(this._dom[elementType])) {\n this._dom[elementType] = filteredElements;\n } else {\n this._dom[elementType] = filteredElements[0] || null;\n }\n } else {\n if (Array.isArray(this._dom[elementType])) {\n this._dom[elementType] = [\n ...this._dom[elementType],\n ...filteredElements,\n ];\n } else {\n this._dom[elementType] = filteredElements[0] || null;\n }\n }\n } else {\n throw new Error(\n `Graupl ${this.constructor.name}: \"${elementType}\" is not a valid element type.`\n );\n }\n }\n\n /**\n * Resets DOM elements.\n *\n * Elements listed in _domLock cannot be reset using this method.\n *\n * @protected\n *\n * @param {string} elementType - The type of element to clear.\n */\n _resetDOMElementType(elementType) {\n if (typeof this.selectors[elementType] === \"string\") {\n if (this._domLock.includes(elementType)) {\n throw new Error(\n `Graupl ${this.constructor.name}: \"${elementType}\" element cannot be reset through _resetDOMElementType.`\n );\n }\n\n if (Array.isArray(this._dom[elementType])) {\n this._dom[elementType] = [];\n } else {\n this._dom[elementType] = null;\n }\n } else {\n throw new Error(\n `Graupl ${this.constructor.name}: \"${elementType}\" is not a valid element type.`\n );\n }\n }\n\n /**\n * Sets all DOM elements within the disclosure.\n *\n * Utilizes _setDOMElementType and\n * _resetDOMElementType.\n *\n * @protected\n */\n _setDOMElements() {\n this._resetDOMElementType(\"content\");\n this._setDOMElementType(\"content\");\n }\n\n /**\n * Expands the disclosure.\n *\n * Sets the controller's `aria-expanded` to \"true\", adds the\n * open class to the disclosure, and removes the closed class from the disclosure.\n *\n * @protected\n *\n * @fires grauplDisclosureExpand\n *\n * @param {Object<boolean>} [options = {}] - Options for expanding the disclosure.\n * @param {boolean} [options.emit = true] - Emit the expand event once expanded.\n * @param {boolean} [options.transition = true] - Respect the transition class.\n */\n _expand({ emit = true, transition = true } = {}) {\n this.dom.controller.setAttribute(\"aria-expanded\", \"true\");\n\n // If we're dealing with transition classes, then we need to utilize\n // requestAnimationFrame to add the transition class, remove the close class,\n // add the open class, and finally remove the transition class.\n if (transition && this.transitionlass !== \"\") {\n addClass(this.transitionClass, this.dom.disclosure);\n\n requestAnimationFrame(() => {\n removeClass(this.closeClass, this.dom.disclosure);\n\n requestAnimationFrame(() => {\n addClass(this.openClass, this.dom.disclosure);\n\n requestAnimationFrame(() => {\n setTimeout(() => {\n removeClass(this.transitionClass, this.dom.disclosure);\n }, this.openDuration);\n });\n });\n });\n } else {\n // Add the open class\n addClass(this.openClass, this.dom.disclosure);\n\n // Remove the close class.\n removeClass(this.closeClass, this.dom.disclosure);\n }\n\n this.dom.content.removeAttribute(\"inert\");\n\n if (emit) {\n this.dom.controller.dispatchEvent(this._expandEvent);\n }\n }\n\n /**\n * Collapses the disclosure.\n *\n * Sets the controller's `aria-expanded` to \"false\", adds the\n * close class to the disclosure, and removes the open class from the disclosure.\n *\n * @protected\n *\n * @fires grauplDisclosureCollapse\n *\n * @param {Object<boolean>} [options = {}] - Options for collapsing the disclosure.\n * @param {boolean} [options.emit = true] - Emit the collapse event once collapsed.\n * @param {boolean} [options.transition = true] - Respect the transition class.\n */\n _collapse({ emit = true, transition = true } = {}) {\n this.dom.controller.setAttribute(\"aria-expanded\", \"false\");\n\n // If we're dealing with transition classes, then we need to utilize\n // requestAnimationFrame to add the transition class, remove the open class,\n // add the close class, and finally remove the transition class.\n if (transition && this.transitionClass !== \"\") {\n addClass(this.transitionClass, this.dom.disclosure);\n\n requestAnimationFrame(() => {\n removeClass(this.openClass, this.dom.disclosure);\n\n requestAnimationFrame(() => {\n addClass(this.closeClass, this.dom.disclosure);\n\n requestAnimationFrame(() => {\n setTimeout(() => {\n removeClass(this.transitionClass, this.dom.disclosure);\n\n this.dom.content.innert = true;\n }, this.closeDuration);\n });\n });\n });\n } else {\n // Add the close class\n addClass(this.closeClass, this.dom.disclosure);\n\n // Remove the open class.\n removeClass(this.openClass, this.dom.disclosure);\n }\n\n this.dom.content.setAttribute(\"inert\", \"true\");\n\n if (emit) {\n this.dom.controller.dispatchEvent(this._collapseEvent);\n }\n }\n\n _handleResize() {\n if (this._breakpointWidth <= 0) {\n return;\n }\n\n let width = 0;\n\n this._observer = new ResizeObserver((entries) => {\n requestAnimationFrame(() => {\n for (const entry of entries) {\n const boxSize = Array.isArray(entry.contentBoxSize)\n ? entry.contentBoxSize[0]\n : entry.contentBoxSize;\n const inlineSize =\n boxSize && typeof boxSize.inlineSize === \"number\"\n ? boxSize.inlineSize\n : entry.contentRect.width;\n\n if (typeof inlineSize !== \"number\") continue;\n\n if (width === inlineSize) continue;\n\n const belowBreakpoint = inlineSize <= this.minWidth;\n const aboveBreakpoint = inlineSize > this.minWidth;\n\n if (belowBreakpoint && this.isOpen) {\n this.close({ preserveState: true });\n } else if (\n aboveBreakpoint &&\n !this.isOpen &&\n (this.hasOpened || this.shouldOpen)\n ) {\n this.open();\n }\n\n width = inlineSize;\n }\n });\n });\n this._observer.observe(document.body);\n }\n\n /**\n * Handles focus events throughout the disclosure.\n *\n * - Adds a `focusout` listener to the disclosure so when the disclosure loses focus it will close.\n */\n _handleFocus() {\n this.dom.disclosure.addEventListener(\"focusout\", (event) => {\n if (\n !this.closeOnBlur ||\n this.currentEvent !== \"keyboard\" ||\n event.relatedTarget === null ||\n this.dom.disclosure.contains(event.relatedTarget) ||\n this.dom.controller === event.relatedTarget\n ) {\n return;\n }\n\n this.close();\n });\n }\n\n /**\n * Handles click events throughout the disclosure.\n *\n * - Adds a `pointerup` listener to the controller that toggles the disclosure.\n * - Adds a `pointerup` listener to the `document` so if the user clicks outside the disclosure it will close.\n */\n _handleClick() {\n this.dom.controller.addEventListener(\"pointerup\", (event) => {\n this.currentEvent = \"mouse\";\n\n if (event.button !== 0) return;\n\n preventEvent(event);\n this.toggle();\n });\n\n document.addEventListener(\"pointerup\", (event) => {\n if (this.focusState !== \"self\" || !this.closeOnBlur) return;\n\n this.currentEvent = \"mouse\";\n\n if (\n !this.dom.disclosure.contains(event.target) &&\n this.dom.controller !== event.target\n ) {\n this.close();\n }\n });\n }\n\n /**\n * Handles keydown events throughout the disclosure.\n *\n * This method exists to assist the _handleKeyup method.\n *\n * - Adds a `keydown` listener to the controller.\n * - Blocks propagation on \"Space\" and \"Enter\" keys.\n * - Adds a `keydown` listener to the disclosure.\n * - Blocks propagation on \"Escape\" keys.\n */\n _handleKeydown() {\n this.dom.controller.addEventListener(\"keydown\", (event) => {\n this.currentEvent = \"keyboard\";\n\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n preventEvent(event);\n\n break;\n }\n });\n\n this.dom.disclosure.addEventListener(\"keydown\", (event) => {\n this.currentEvent = \"keyboard\";\n\n const key = keyPress(event);\n\n switch (key) {\n case \"Escape\":\n preventEvent(event);\n\n break;\n }\n });\n }\n\n /**\n * Handles keyup events throughout the disclosure.\n *\n * - Adds a `keyup` listener to the controller.\n * - Toggles the disclosure on \"Space\" and \"Enter\" keys.\n * - Adds a `keyup` listener to the disclosure.\n * - Closes the disclosure on \"Escape\" keys.\n */\n _handleKeyup() {\n this.dom.controller.addEventListener(\"keyup\", (event) => {\n this.currentEvent = \"keyboard\";\n\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n this.toggle();\n\n preventEvent(event);\n\n break;\n }\n });\n\n this.dom.disclosure.addEventListener(\"keyup\", (event) => {\n this.currentEvent = \"keyboard\";\n\n const key = keyPress(event);\n\n switch (key) {\n case \"Escape\":\n this.close();\n\n preventEvent(event);\n\n break;\n }\n });\n }\n\n /**\n * Opens the disclosure.\n *\n * Sets the disclosure's focus state to \"self\", calls expand, and sets isOpen to `true`.\n *\n * @public\n *\n * @param {Object<boolean>} [options = {}] - Options for opening the disclosure.\n * @param {boolean} [options.force = false] - Whether to force the open action.\n * @param {boolean} [options.preserveState = false] - Whether to preserve the open state.\n */\n open({ force = false, preserveState = false } = {}) {\n if (this.isOpen && !force) return;\n\n // Set the focus state.\n this.focusState = \"self\";\n\n // Expand the disclosure.\n this._expand();\n\n // Set the open state.\n this._open.value = true;\n\n if (!preserveState) {\n this._open.commit();\n }\n }\n\n /**\n * Opens the disclosure without entering it.\n *\n * Sets the disclosure's focus state to \"none\", calls expand, and sets isOpen to `true`.\n *\n * @public\n *\n * @param {Object<boolean>} [options = {}] - Options for previewing the disclosure.\n * @param {boolean} [options.force = false] - Whether to force the preview action.\n * @param {boolean} [options.preserveState = false] - Whether to preserve the open state.\n */\n preview({ force = false, preserveState = false } = {}) {\n if (this.isOpen && !force) return;\n\n // Set the focus state.\n this.focusState = \"none\";\n\n // Expand the disclosure.\n this._expand();\n\n // Set the open state.\n this._open.value = true;\n\n if (!preserveState) {\n this._open.commit();\n }\n }\n\n /**\n * Closes the disclosure.\n *\n * Sets the disclosure's focus state to \"none\", calls collapse, and sets isOpen to `false`.\n *\n * @public\n *\n * @param {Object<boolean>} [options = {}] - Options for closing the disclosure.\n * @param {boolean} [options.force = false] - Whether to force the close action.\n * @param {boolean} [options.preserveState = false] - Whether to preserve the open state.\n */\n close({ force = false, preserveState = false } = {}) {\n if (!this.isOpen && !force) return;\n\n // Set the focus state.\n this.focusState = \"none\";\n\n // Collapse the disclosure.\n this._collapse();\n\n // Set the open state.\n this._open.value = false;\n\n if (!preserveState) {\n this._open.commit();\n }\n }\n\n /**\n * Toggles the open state of the disclosure.\n *\n * @public\n *\n * @param {Object<boolean>} [options = {}] - Options for toggling the disclosure.\n * @param {boolean} [options.force = false] - Whether to force the open or close action.\n * @param {boolean} [options.preserveState = false] - Whether to preserve the open state.\n */\n toggle({ force = false, preserveState = false } = {}) {\n if (this.isOpen) {\n this.close({ force, preserveState });\n } else {\n this.open({ force, preserveState });\n }\n }\n}\n\nexport default Disclosure;\n","import Disclosure from \"./Disclosure.js\";\nimport once from \"@drupal/once\";\n\nconst generate = ({\n options = {},\n context = document,\n disclosureSelector = \".disclosure\",\n controllerSelector = \".disclosure-toggle\",\n} = {}) => {\n once(\"graupl-disclosure-generator\", disclosureSelector, context).forEach(\n (disclosureElement) => {\n const disclosureOptions = disclosureElement.dataset\n .grauplDisclosureOptions\n ? JSON.parse(\n disclosureElement.dataset.grauplDisclosureOptions.replace(/'/g, '\"')\n ) || {}\n : {};\n\n const targettedControllerSelector = `${controllerSelector}[data-graupl-disclosure-target=\"${disclosureElement.id}\"]`;\n const [controllerElement] = once(\n \"graupl-disclosure-generator\",\n targettedControllerSelector,\n context\n );\n\n if (!controllerElement) {\n console.warn(\n `No controller found for disclosure with ID \"${disclosureElement.id}\". Please ensure there is an element with the selector \"${targettedControllerSelector}\".`\n );\n\n once.remove(\"graupl-disclosure-generator\", disclosureElement);\n\n return;\n }\n\n new Disclosure({\n disclosureElement,\n controllerElement,\n initialize: true,\n ...options,\n ...disclosureOptions,\n });\n }\n );\n};\n\nexport default generate;\n","import accordionGenerator from \"./accordion/generator.js\";\nimport alertGenerator from \"./alert/generator.js\";\nimport carouselGenerator from \"./carousel/generator.js\";\nimport navigationGenerator from \"./navigation/generator.js\";\nimport disclosureGenerator from \"./disclosure/generator.js\";\n\ndocument.addEventListener(\"DOMContentLoaded\", () => {\n accordionGenerator();\n alertGenerator();\n carouselGenerator();\n navigationGenerator();\n disclosureGenerator();\n});\n"],"x_google_ignoreList":[6],"mappings":"YAeA,SAAgBwrB,EAAgByC,EAAavZ,EAAU,CACrD,GAAI,CACF,GAAI,OAAOA,GAAa,SAAU,CAChC,MAAMvU,EAAe,OAAOuU,EAE5B,MAAM,IAAIT,UACR,qEAAqE9T,CAAAA,UAAY,EAIrF,UAAWqxB,KAAO9c,EAChB,GAAI,EAAEA,EAAS8c,CAAAA,YAAgBvD,GAAc,CAC3C,MAAMmF,EAAc,OAAO1e,EAAS8c,CAAAA,EACpC,MAAM,IAAIvd,UACR,GAAGud,CAAAA,2BAA8BvD,EAAYwF,IAAAA,MAAUL,CAAAA,UAAW,EAKxE,MAAO,CACLzB,OAAQ,GACRf,MAAO,YAEFA,EAAO,CACd,MAAO,CACLe,OAAQ,GACRf,MAAAA,IAoBN,SAAgBlF,EAAYjiB,EAAM7I,EAAQ,CACxC,GAAI,CACF,GAAI,OAAOA,GAAW,SAAU,CAC9B,MAAMC,EAAa,OAAOD,EAE1B,MAAM,IAAIqT,UACR,+DAA+DpT,CAAAA,UAAU,EAI7E,UAAW2wB,KAAO5wB,EAAQ,CACxB,MAAME,EAAY,OAAOF,EAAO4wB,CAAAA,EAEhC,GAAI1wB,IAAc2I,EAChB,MAAM,IAAIwK,UAAU,GAAGud,CAAAA,cAAiB/nB,CAAAA,MAAU3I,CAAAA,UAAS,EAI/D,MAAO,CACL6wB,OAAQ,GACRf,MAAO,YAEFA,EAAO,CACd,MAAO,CACLe,OAAQ,GACRf,MAAAA,IAgBN,SAAgB9E,EAAgBlrB,EAAQ,CACtC,GAAI,CACF,GAAI,OAAOA,GAAW,SA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