@graupl/core 1.0.0-beta.22 → 1.0.0-beta.24
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/base/button.css +2 -2
- package/dist/css/base/button.css.map +1 -1
- package/dist/css/base/form.css +2 -2
- package/dist/css/base/form.css.map +1 -1
- package/dist/css/base/link.css +2 -2
- package/dist/css/base/link.css.map +1 -1
- package/dist/css/base/table.css +2 -2
- package/dist/css/base/table.css.map +1 -1
- package/dist/css/base.css +2 -2
- package/dist/css/base.css.map +1 -1
- package/dist/css/component/accordion.css +2 -5
- package/dist/css/component/accordion.css.map +1 -1
- package/dist/css/component/alert.css +2 -2
- package/dist/css/component/alert.css.map +1 -1
- package/dist/css/component/badge.css +2 -2
- package/dist/css/component/badge.css.map +1 -1
- package/dist/css/component/card.css +2 -2
- package/dist/css/component/card.css.map +1 -1
- package/dist/css/component/carousel.css +2 -2
- package/dist/css/component/carousel.css.map +1 -1
- package/dist/css/component/disclosure.css +2 -2
- package/dist/css/component/disclosure.css.map +1 -1
- package/dist/css/component/input-group.css +2 -2
- package/dist/css/component/input-group.css.map +1 -1
- package/dist/css/component/list.css +2 -2
- package/dist/css/component/list.css.map +1 -1
- package/dist/css/component/menu.css +2 -2
- package/dist/css/component/menu.css.map +1 -1
- package/dist/css/component/navigation.css +2 -2
- package/dist/css/component/navigation.css.map +1 -1
- package/dist/css/component.css +2 -5
- package/dist/css/component.css.map +1 -1
- package/dist/css/graupl.css +2 -5
- package/dist/css/graupl.css.map +1 -1
- package/dist/css/init.css +2 -2
- package/dist/css/init.css.map +1 -1
- package/dist/css/layout/columns.css +2 -2
- package/dist/css/layout/columns.css.map +1 -1
- package/dist/css/layout/container.css +2 -2
- package/dist/css/layout/container.css.map +1 -1
- package/dist/css/layout/flex-columns.css +2 -2
- package/dist/css/layout/flex-columns.css.map +1 -1
- package/dist/css/layout.css +2 -5
- package/dist/css/layout.css.map +1 -1
- package/dist/css/normalize.css +2 -2
- package/dist/css/normalize.css.map +1 -1
- package/dist/css/state/focus.css +2 -2
- package/dist/css/state/focus.css.map +1 -1
- package/dist/css/state.css +2 -2
- package/dist/css/state.css.map +1 -1
- package/dist/css/theme/color.css +2 -2
- package/dist/css/theme/color.css.map +1 -1
- package/dist/css/theme/typography.css +2 -2
- package/dist/css/theme/typography.css.map +1 -1
- package/dist/css/theme.css +2 -2
- package/dist/css/theme.css.map +1 -1
- package/dist/css/utilities/alignment.css +1 -1
- package/dist/css/utilities/alignment.css.map +1 -1
- package/dist/css/utilities/background.css +2 -2
- package/dist/css/utilities/background.css.map +1 -1
- package/dist/css/utilities/border.css +2 -2
- package/dist/css/utilities/border.css.map +1 -1
- package/dist/css/utilities/color.css +2 -2
- package/dist/css/utilities/color.css.map +1 -1
- package/dist/css/utilities/container.css +1 -1
- package/dist/css/utilities/container.css.map +1 -1
- package/dist/css/utilities/display.css +2 -2
- package/dist/css/utilities/display.css.map +1 -1
- package/dist/css/utilities/flex.css +2 -2
- package/dist/css/utilities/flex.css.map +1 -1
- package/dist/css/utilities/gradient.css +2 -2
- package/dist/css/utilities/gradient.css.map +1 -1
- package/dist/css/utilities/height.css +2 -2
- package/dist/css/utilities/height.css.map +1 -1
- package/dist/css/utilities/inset.css +2 -2
- package/dist/css/utilities/inset.css.map +1 -1
- package/dist/css/utilities/justification.css +1 -1
- package/dist/css/utilities/justification.css.map +1 -1
- package/dist/css/utilities/list.css +1 -1
- package/dist/css/utilities/list.css.map +1 -1
- package/dist/css/utilities/order.css +2 -2
- package/dist/css/utilities/order.css.map +1 -1
- package/dist/css/utilities/position.css +2 -2
- package/dist/css/utilities/position.css.map +1 -1
- package/dist/css/utilities/ratio.css +2 -2
- package/dist/css/utilities/ratio.css.map +1 -1
- package/dist/css/utilities/spacing.css +2 -2
- package/dist/css/utilities/spacing.css.map +1 -1
- package/dist/css/utilities/typography.css +2 -2
- package/dist/css/utilities/typography.css.map +1 -1
- package/dist/css/utilities/visibility.css +2 -2
- package/dist/css/utilities/visibility.css.map +1 -1
- package/dist/css/utilities/visually-hidden.css +2 -2
- package/dist/css/utilities/visually-hidden.css.map +1 -1
- package/dist/css/utilities/width.css +2 -2
- package/dist/css/utilities/width.css.map +1 -1
- package/dist/css/utilities/z-index.css +1 -1
- package/dist/css/utilities/z-index.css.map +1 -1
- package/dist/css/utilities.css +2 -2
- package/dist/css/utilities.css.map +1 -1
- package/dist/js/accordion.js.map +1 -1
- package/dist/js/alert.js.map +1 -1
- package/dist/js/carousel.js.map +1 -1
- package/dist/js/component/accordion.cjs.js.map +1 -1
- package/dist/js/component/accordion.es.js.map +1 -1
- package/dist/js/component/accordion.iife.js.map +1 -1
- package/dist/js/component/alert.cjs.js.map +1 -1
- package/dist/js/component/alert.es.js.map +1 -1
- package/dist/js/component/alert.iife.js.map +1 -1
- package/dist/js/component/carousel.cjs.js.map +1 -1
- package/dist/js/component/carousel.es.js.map +1 -1
- package/dist/js/component/carousel.iife.js.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/component/tabs.cjs.js +5 -0
- package/dist/js/component/tabs.cjs.js.map +1 -0
- package/dist/js/component/tabs.es.js +5 -0
- package/dist/js/component/tabs.es.js.map +1 -0
- package/dist/js/component/tabs.iife.js +5 -0
- package/dist/js/component/tabs.iife.js.map +1 -0
- package/dist/js/disclosure.js +2 -2
- package/dist/js/disclosure.js.map +1 -1
- package/dist/js/generator/accordion.cjs.js.map +1 -1
- package/dist/js/generator/accordion.es.js.map +1 -1
- package/dist/js/generator/accordion.iife.js.map +1 -1
- package/dist/js/generator/alert.cjs.js.map +1 -1
- package/dist/js/generator/alert.es.js.map +1 -1
- package/dist/js/generator/alert.iife.js.map +1 -1
- package/dist/js/generator/carousel.cjs.js.map +1 -1
- package/dist/js/generator/carousel.es.js.map +1 -1
- package/dist/js/generator/carousel.iife.js.map +1 -1
- 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/generator/navigation.cjs.js.map +1 -1
- package/dist/js/generator/navigation.es.js.map +1 -1
- package/dist/js/generator/navigation.iife.js.map +1 -1
- package/dist/js/generator/tabs.cjs.js +5 -0
- package/dist/js/generator/tabs.cjs.js.map +1 -0
- package/dist/js/generator/tabs.es.js +5 -0
- package/dist/js/generator/tabs.es.js.map +1 -0
- package/dist/js/generator/tabs.iife.js +5 -0
- package/dist/js/generator/tabs.iife.js.map +1 -0
- package/dist/js/graupl.js +5 -5
- package/dist/js/graupl.js.map +1 -1
- package/dist/js/navigation.js.map +1 -1
- package/dist/js/tabs.js +5 -0
- package/dist/js/tabs.js.map +1 -0
- package/package.json +4 -3
- package/src/js/disclosure/Disclosure.js +25 -45
- package/src/js/domHelpers.js +39 -22
- package/src/js/tabs/TabToggle.js +378 -0
- package/src/js/tabs/Tabs.js +1091 -0
- package/src/js/tabs/generator.js +32 -0
- package/src/js/tabs/index.js +5 -0
- package/src/scss/_defaults.scss +21 -88
- package/src/scss/_variables.scss +70 -0
- package/src/scss/base/button/_defaults.scss +2 -24
- package/src/scss/base/button/_index.scss +53 -52
- package/src/scss/base/button/_mixins.scss +24 -58
- package/src/scss/base/button/_variables.scss +139 -0
- package/src/scss/base/form/_defaults.scss +72 -2
- package/src/scss/base/form/_index.scss +196 -70
- package/src/scss/base/form/_variables.scss +166 -0
- package/src/scss/base/link/_defaults.scss +31 -0
- package/src/scss/base/link/_index.scss +177 -172
- package/src/scss/base/link/_variables.scss +215 -0
- package/src/scss/base/table/_defaults.scss +1 -11
- package/src/scss/base/table/_index.scss +126 -117
- package/src/scss/base/table/_variables.scss +214 -3
- package/src/scss/component/_index.scss +1 -0
- package/src/scss/component/accordion/_defaults.scss +73 -22
- package/src/scss/component/accordion/_index.scss +437 -62
- package/src/scss/component/accordion/_variables.scss +527 -101
- package/src/scss/component/alert/_defaults.scss +23 -32
- package/src/scss/component/alert/_index.scss +236 -30
- package/src/scss/component/alert/_variables.scss +155 -6
- package/src/scss/component/badge/_defaults.scss +1 -0
- package/src/scss/component/badge/_index.scss +25 -28
- package/src/scss/component/badge/_variables.scss +66 -2
- package/src/scss/component/card/_defaults.scss +64 -13
- package/src/scss/component/card/_index.scss +276 -30
- package/src/scss/component/card/_variables.scss +132 -0
- package/src/scss/component/carousel/_defaults.scss +73 -15
- package/src/scss/component/carousel/_index.scss +357 -41
- package/src/scss/component/carousel/_variables.scss +391 -0
- package/src/scss/component/disclosure/_index.scss +4 -4
- package/src/scss/component/disclosure/_variables.scss +127 -2
- package/src/scss/component/input-group/_defaults.scss +10 -3
- package/src/scss/component/input-group/_index.scss +72 -4
- package/src/scss/component/input-group/_variables.scss +37 -0
- package/src/scss/component/list/_defaults.scss +35 -2
- package/src/scss/component/list/_index.scss +159 -5
- package/src/scss/component/list/_variables.scss +152 -0
- package/src/scss/component/menu/_defaults.scss +49 -7
- package/src/scss/component/menu/_index.scss +325 -99
- package/src/scss/component/menu/_variables.scss +484 -1
- package/src/scss/component/navigation/_defaults.scss +45 -3
- package/src/scss/component/navigation/_index.scss +249 -98
- package/src/scss/component/navigation/_variables.scss +334 -5
- package/src/scss/component/tabs/_defaults.scss +82 -0
- package/src/scss/component/tabs/_index.scss +497 -0
- package/src/scss/component/tabs/_variables.scss +974 -0
- package/src/scss/layout/columns/_defaults.scss +5 -3
- package/src/scss/layout/columns/_index.scss +27 -21
- package/src/scss/layout/columns/_variables.scss +13 -0
- package/src/scss/layout/container/_defaults.scss +28 -11
- package/src/scss/layout/container/_index.scss +305 -161
- package/src/scss/layout/container/_variables.scss +148 -15
- package/src/scss/layout/flex-columns/_defaults.scss +5 -3
- package/src/scss/layout/flex-columns/_index.scss +28 -20
- package/src/scss/layout/flex-columns/_variables.scss +9 -0
- package/src/scss/mixins/_state.scss +37 -0
- package/src/scss/mixins/_theme.scss +36 -1
- package/src/scss/state/focus/_index.scss +17 -12
- package/src/scss/state/focus/_variables.scss +30 -4
- package/src/scss/theme/color/_defaults.scss +6 -35
- package/src/scss/theme/color/_index.scss +167 -1
- package/src/scss/theme/color/_variables.scss +155 -0
- package/src/scss/theme/typography/_defaults.scss +26 -19
- package/src/scss/theme/typography/_index.scss +176 -20
- package/src/scss/theme/typography/_variables.scss +186 -0
- package/src/scss/utilities/_template/_index.scss +0 -1
- package/src/scss/utilities/alignment/_defaults.scss +0 -33
- package/src/scss/utilities/alignment/_index.scss +24 -25
- package/src/scss/utilities/background/_defaults.scss +0 -77
- package/src/scss/utilities/background/_index.scss +32 -37
- package/src/scss/utilities/border/_defaults.scss +0 -33
- package/src/scss/utilities/border/_index.scss +25 -26
- package/src/scss/utilities/color/_defaults.scss +0 -19
- package/src/scss/utilities/color/_index.scss +22 -22
- package/src/scss/utilities/container/_defaults.scss +0 -11
- package/src/scss/utilities/container/_index.scss +20 -19
- package/src/scss/utilities/display/_defaults.scss +0 -11
- package/src/scss/utilities/display/_index.scss +20 -19
- package/src/scss/utilities/flex/_defaults.scss +0 -55
- package/src/scss/utilities/flex/_index.scss +28 -31
- package/src/scss/utilities/gradient/_defaults.scss +0 -28
- package/src/scss/utilities/gradient/_index.scss +27 -28
- package/src/scss/utilities/gradient/_variables.scss +15 -0
- package/src/scss/utilities/height/_defaults.scss +0 -8
- package/src/scss/utilities/height/_index.scss +22 -21
- package/src/scss/utilities/inset/_defaults.scss +0 -16
- package/src/scss/utilities/inset/_index.scss +20 -20
- package/src/scss/utilities/justification/_defaults.scss +0 -33
- package/src/scss/utilities/justification/_index.scss +24 -25
- package/src/scss/utilities/list/_defaults.scss +0 -22
- package/src/scss/utilities/list/_index.scss +22 -22
- package/src/scss/utilities/order/_defaults.scss +0 -8
- package/src/scss/utilities/order/_index.scss +20 -19
- package/src/scss/utilities/position/_defaults.scss +0 -11
- package/src/scss/utilities/position/_index.scss +20 -19
- package/src/scss/utilities/ratio/_defaults.scss +0 -8
- package/src/scss/utilities/ratio/_index.scss +22 -21
- package/src/scss/utilities/ratio/_variables.scss +6 -0
- package/src/scss/utilities/spacing/_defaults.scss +0 -11
- package/src/scss/utilities/spacing/_index.scss +18 -17
- package/src/scss/utilities/typography/_defaults.scss +0 -22
- package/src/scss/utilities/typography/_index.scss +27 -26
- package/src/scss/utilities/visibility/_defaults.scss +0 -11
- package/src/scss/utilities/visibility/_index.scss +19 -18
- package/src/scss/utilities/visually-hidden/_index.scss +19 -17
- package/src/scss/utilities/width/_defaults.scss +0 -8
- package/src/scss/utilities/width/_index.scss +21 -20
- package/src/scss/utilities/z-index/_defaults.scss +0 -11
- package/src/scss/utilities/z-index/_index.scss +19 -18
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.cjs.js","names":["addClass","className","element","length","classList","add","removeClass","remove","selectAllFocusableElements","context","document","fn","querySelector","elements","Array","from","querySelectorAll","tabbableElements","filter","check","getAttribute","selectFirstFocusableElement","selectLastFocusableElement","selectNextFocusableElement","index","indexOf","selectPreviousFocusableElement","TransactionalValue","constructor","initialValue","options","_equals","equals","Object","is","_current","_committed","value","val","committed","isDirty","commit","reset","update","fn","addClass","removeClass","TransactionalValue","TabToggle","_dom","toggle","content","_elements","parent","_active","_activateEvent","CustomEvent","bubbles","detail","item","_deactivateEvent","constructor","toggleElement","contentElement","parentTab","initialize","_setIds","_setAriaAttributes","dom","getAttribute","show","_deactivate","emit","transition","elements","isActive","value","key","index","tabToggle","indexOf","id","setAttribute","_activate","closeClass","openClass","transitionClass","openDuration","requestAnimationFrame","setTimeout","dispatchEvent","closeDuration","force","preserveState","focusState","commit","deactivateSiblings","hide","focus","blur","forEach","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","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","TabToggle","isValidInstance","isValidType","isValidClassList","isQuerySelector","isValidState","isValidEvent","addClass","removeClass","keyPress","preventEvent","storage","Tabs","_dom","tabs","tabList","tabToggle","tabContent","_domLock","_selectors","_elements","_classes","open","close","transition","initialize","_durations","_focusState","_currentEvent","_automatic","_currentChild","_prefix","_key","_errors","constructor","tabsElement","tabListSelector","tabToggleSelector","tabContentSelector","openClass","closeClass","transitionClass","transitionDuration","openDuration","closeDuration","automaticActivation","prefix","key","initializeClass","_validate","Error","errors","join","dom","_generateKey","_setDOMElements","_setIds","_setAriaAttributes","_createChildElements","_handleFocus","_handleClick","_handleKeydown","_handleKeyup","_setTransitionDurations","initializeStorage","pushToStorage","id","elements","filter","toggle","isActive","length","show","requestAnimationFrame","error","console","selectors","value","isAutomatic","currentChild","currentTabToggle","focusState","currentEvent","check","htmlElementChecks","HTMLElement","push","message","querySelectors","querySelector","Object","keys","querySelectorChecks","classes","className","classListChecks","status","durations","durationName","durationChecks","booleanCheck","keyCheck","prefixCheck","regenerate","Math","random","toString","replace","substring","setAttribute","style","setProperty","_setDOMElementType","elementType","base","overwrite","strict","includes","name","domElements","Array","from","querySelectorAll","filteredElements","item","parentElement","isArray","_resetDOMElementType","forEach","index","toggleElement","contentElement","parentTab","addEventListener","event","ToggleKeys","focusFirstChild","focusLastChild","focusNextChild","focusPreviousChild","focusCurrentChild","focus","focusChild","blurCurrentChild","blur"],"sources":["../../../src/js/domHelpers.js","../../../src/js/TransactionalValue.js","../../../src/js/tabs/TabToggle.js","../../../src/js/validate.js","../../../src/js/eventHandlers.js","../../../src/js/storage.js","../../../src/js/tabs/Tabs.js"],"sourcesContent":["/**\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 * @param {?function(HTMLElement): boolean} [fn = null] - An optional addition filter function to process out focusable elements.\n * @return {HTMLElement[]} - An array of focusable elements.\n */\nexport function selectAllFocusableElements(context = document, fn = null) {\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 if (fn !== null) {\n return tabbableElements.filter(fn);\n } else {\n return tabbableElements;\n }\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 * @param {?function(HTMLElement): boolean} [fn = null] - An optional addition filter function to process out focusable elements.\n * @return {HTMLElement|boolean} - The first focusable element or false if none found.\n */\nexport function selectFirstFocusableElement(context = document, fn = null) {\n const tabbableElements = selectAllFocusableElements(context, fn);\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 * @param {?function(HTMLElement): boolean} [fn = null] - An optional addition filter function to process out focusable elements.\n * @return {HTMLElement|boolean} - The last focusable element or false if none found.\n */\nexport function selectLastFocusableElement(context = document, fn = null) {\n const tabbableElements = selectAllFocusableElements(context, fn);\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 * @param {?function(HTMLElement): boolean} [fn = null] - An optional addition filter function to process out focusable elements.\n * @return {HTMLElement|boolean} - The next focusable element or false if none found.\n */\nexport function selectNextFocusableElement(\n element,\n context = document,\n fn = null\n) {\n const tabbableElements = selectAllFocusableElements(context, fn);\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 * @param {?function(HTMLElement): boolean} [fn = null] - An optional addition filter function to process out focusable elements.\n * @return {HTMLElement|boolean} - The previous focusable element or false if none found.\n */\nexport function selectPreviousFocusableElement(\n element,\n context = document,\n fn = null\n) {\n const tabbableElements = selectAllFocusableElements(context, fn);\n const index = tabbableElements.indexOf(element);\n\n return index === 0 ? false : tabbableElements[index - 1];\n}\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","/* global Tabs */\n\nimport { addClass, removeClass } from \"@graupl/core/src/domHelpers.js\";\nimport { TransactionalValue } from \"../TransactionalValue.js\";\n\nclass TabToggle {\n /**\n * The DOM elements within the tab toggle.\n *\n * @protected\n *\n * @type {Object<HTMLElement>}\n *\n * @property {HTMLElement} toggle - The toggle element.\n * @property {HTMLElement} content - The content element.\n */\n _dom = {\n toggle: null,\n content: null,\n };\n\n /**\n * The declared elements within the tab toggle.\n *\n * @protected\n *\n * @type {Object<Tabs>}\n *\n * @property {Tabs} parent - The parent tabs element.\n */\n _elements = {\n parent: null,\n };\n\n /**\n * The active state of the tab toggle.\n *\n * @protected\n *\n * @type {TransactionalValue}\n */\n _active = new TransactionalValue(false);\n\n /**\n * The event that is triggered when the tab toggle is shown.\n *\n * @protected\n *\n * @event grauplTabToggleActivate\n *\n * @type {CustomEvent}\n *\n * @property {boolean} bubbles - A flag to bubble the event.\n * @property {Object<TabToggle>} detail - The details object containing the Accordion item itself.\n */\n _activateEvent = new CustomEvent(\"grauplTabToggleActivate\", {\n bubbles: true,\n detail: { item: this },\n });\n\n /**\n * The event that is triggered when the tab toggle is hidden.\n *\n * @protected\n *\n * @event grauplTabToggleDeactivate\n *\n * @type {CustomEvent}\n *\n * @property {boolean} bubbles - A flag to bubble the event.\n * @property {Object<TabToggle>} detail - The details object containing the Accordion item itself.\n */\n _deactivateEvent = new CustomEvent(\"grauplTabToggleDeactivate\", {\n bubbles: true,\n detail: { item: this },\n });\n\n constructor({ toggleElement, contentElement, parentTab }) {\n // Set DOM elements.\n this._dom.toggle = toggleElement;\n this._dom.content = contentElement;\n\n // Set the parent tab instance.\n this._elements.parent = parentTab;\n }\n\n /**\n * Initializes the tab toggle.\n */\n initialize() {\n // Set up the DOM.\n this._setIds();\n this._setAriaAttributes();\n\n if (this.dom.toggle.getAttribute(\"aria-selected\") === \"true\") {\n this.show();\n } else {\n this._deactivate({ emit: false, transition: false });\n }\n }\n\n /**\n * The DOM elements of the tab toggle.\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 declared elements in the tab toggle.\n *\n * @protected\n *\n * @type {Object<Tabs>}\n *\n * @see _elements\n */\n get elements() {\n return this._elements;\n }\n\n /**\n * The active state of the tab toggle.\n *\n * @readonly\n *\n * @type {TransactionalValue}\n *\n * @see _active\n */\n get isActive() {\n return this._active.value;\n }\n\n /**\n * Sets the IDs of the tab toggle and it's content if they do not already exist.\n *\n * The generated IDs use the following format:\n * - toggle: `tab-toggle-${key}-${index}`\n * - content: `tab-content-${key}-${index}`\n *\n * Where `${key}` is the parent's key and `${index}` is the toggles index in the list of the parent's toggles.\n *\n * @protected\n */\n _setIds() {\n // Get the required information for IDs.\n const { key } = this.elements.parent;\n const index = this.elements.parent.dom.tabToggle.indexOf(this.dom.toggle);\n\n this.dom.toggle.id = this.dom.toggle.id || `tab-toggle-${key}-${index}`;\n this.dom.content.id = this.dom.content.id || `tab-content-${key}-${index}`;\n }\n\n /**\n * Sets the ARIA attributes on the disclosure and it's content.\n */\n _setAriaAttributes() {\n // Set the ARIA attributes for the tab item toggle.\n this.dom.toggle.setAttribute(\"role\", \"tab\");\n\n // If aria-selected is not explicitly set to \"true\", then set it to \"false\".\n if (this.dom.toggle.getAttribute(\"aria-selected\") !== \"true\") {\n this.dom.toggle.setAttribute(\"aria-selected\", \"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 role for the content.\n this.dom.content.setAttribute(\"role\", \"tabpanel\");\n }\n\n /**\n * Activate the toggle.\n *\n * Sets the toggles's `aria-selected` to \"true\", adds the\n * open class to the content, and removes the closed class from the content.\n *\n * @protected\n *\n * @fires grauplTabToggleActivate\n *\n * @param {Object<boolean>} [options = {}] - Options for activating the toggle.\n * @param {boolean} [options.emit = true] - Emit the activat event once activated.\n * @param {boolean} [options.transition = true] - Respect the transition class.\n */\n _activate({ emit = true, transition = true } = {}) {\n const { closeClass, openClass, transitionClass, openDuration } =\n this.elements.parent;\n\n // Set aria-selected to true when hiding accordion item.\n this.dom.toggle.setAttribute(\"aria-selected\", \"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.content);\n\n requestAnimationFrame(() => {\n removeClass(closeClass, this.dom.content);\n\n requestAnimationFrame(() => {\n addClass(openClass, this.dom.content);\n\n requestAnimationFrame(() => {\n setTimeout(() => {\n removeClass(transitionClass, this.dom.content);\n }, openDuration);\n });\n });\n });\n } else {\n // Add the show class\n addClass(openClass, this.dom.content);\n\n // Remove the hide class.\n removeClass(closeClass, this.dom.content);\n }\n\n if (emit) {\n this.dom.toggle.dispatchEvent(this._activateEvent);\n }\n }\n\n /**\n * Deactivates the disclosure.\n *\n * Sets the toggles's `aria-expanded` to \"false\", adds the\n * close class to the content, and removes the open class from the content.\n *\n * @protected\n *\n * @fires grauplTabToggleDeactivate\n *\n * @param {Object<boolean>} [options = {}] - Options for collapsing the toggle.\n * @param {boolean} [options.emit = true] - Emit the deactivate event once deactivated.\n * @param {boolean} [options.transition = true] - Respect the transition class.\n */\n _deactivate({ emit = true, transition = true } = {}) {\n const { closeClass, openClass, transitionClass, closeDuration } =\n this.elements.parent;\n\n // Set aria-selected to false when hiding accordion item.\n this.dom.toggle.setAttribute(\"aria-selected\", \"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.content);\n\n requestAnimationFrame(() => {\n removeClass(openClass, this.dom.content);\n\n requestAnimationFrame(() => {\n addClass(closeClass, this.dom.content);\n\n requestAnimationFrame(() => {\n setTimeout(() => {\n removeClass(transitionClass, this.dom.content);\n }, closeDuration);\n });\n });\n });\n } else {\n // Add the hide class\n addClass(closeClass, this.dom.content);\n\n // Remove the show class.\n removeClass(openClass, this.dom.content);\n }\n\n if (emit) {\n this.dom.toggle.dispatchEvent(this._deactivateEvent);\n }\n }\n\n /**\n * Shows the tab toggle's content.\n *\n * @param {Object<boolean>} [options = {}] - Options for showing the toggle.\n * @param {boolean} [options.force = false] - Whether to force the show action.\n * @param {boolean} [options.preserveState = false] - Whether to preserve the active state.\n */\n show({ force = false, preserveState = false } = {}) {\n if (this.isActive && !force) return;\n\n // Set the focus state of the parent tabs element.\n this.elements.parent.focusState = \"self\";\n\n // Activate the toggle.\n this._activate();\n\n // Set the active state\n this._active.value = true;\n\n if (!preserveState) {\n this._active.commit();\n }\n\n // Set the tabindex to 0 so it can be focused.\n this.dom.toggle.setAttribute(\"tabindex\", \"0\");\n\n // Deactivate all sibling tab toggles.\n this.deactivateSiblings();\n }\n\n /**\n * Hides the tab toggle's content.\n *\n * @param {Object<boolean>} [options = {}] - Options for hiding the toggle.\n * @param {boolean} [options.force = false] - Whether to force the show action.\n * @param {boolean} [options.preserveState = false] - Whether to preserve the active state.\n */\n hide({ force = false, preserveState = false } = {}) {\n if (!this.isActive && !force) return;\n\n // Set the focus state of the parent tabs element.\n this.elements.parent.focusState = \"none\";\n\n // Deactivate the toggle.\n this._deactivate();\n\n // Set the active state\n this._active.value = false;\n\n if (!preserveState) {\n this._active.commit();\n }\n\n // Set the tabindex to -1.\n this.dom.toggle.setAttribute(\"tabindex\", \"-1\");\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 deactivateSiblings() {\n if (this.elements.parent) {\n this.elements.parent.elements.tabToggle.forEach((toggle) => {\n if (toggle !== this) {\n toggle.hide();\n }\n });\n }\n }\n}\n\nexport default TabToggle;\n","/**\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 * 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 Tab class.\n */\n\nimport TabToggle from \"./TabToggle.js\";\nimport {\n isValidInstance,\n isValidType,\n isValidClassList,\n isQuerySelector,\n isValidState,\n isValidEvent,\n} from \"../validate.js\";\nimport { addClass, removeClass } from \"../domHelpers.js\";\nimport { keyPress, preventEvent } from \"../eventHandlers.js\";\nimport storage from \"../storage.js\";\n\nclass Tabs {\n /**\n * The DOM elements within the tab.\n *\n * @protected\n *\n * @type {Object<HTMLElement, HTMLElement[]>}\n *\n * @property {HTMLElement} tabs - The tabs element.\n * @property {HTMLElement} tabList - The tab list element.\n * @property {HTMLElement[]} tabToggle - An array of tab item toggles.\n * @property {HTMLElement[]} tabContent - An array of tab item contents.\n */\n _dom = {\n tabs: null,\n tabList: null,\n tabToggle: [],\n tabContent: [],\n };\n\n /**\n * The DOM elements within the tab that cannot be reset or generated by the tab.\n *\n * @protected\n *\n * @type {string[]}\n */\n _domLock = [\"tab\"];\n\n /**\n * The query selectors used by the tab.\n *\n * @protected\n *\n * @type {Object<string>}\n *\n * @property {string} tabList - The query selector for the tab list.\n * @property {string} tabToggle - The query selector for tab toggles.\n * @property {string} tabContent - The query selector for tab contents.\n */\n _selectors = {\n tabList: \"\",\n tabToggle: \"\",\n tabContent: \"\",\n };\n\n /**\n * The declared elements within the tabs.\n *\n * @protected\n *\n * @type {Object<TabToggle[]>}\n *\n * @property {TabToggle[]} tabToggle - The list of tab items.\n */\n _elements = {\n tabToggle: [],\n };\n\n /**\n * The classes to apply when the tabs are 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 tab is open.\n * @property {string|string[]} close - The class(es) to apply when the tab is closed.\n * @property {string|string[]} transition - The class(es) to apply when the tab is transitioning between states.\n * @property {string|string[]} initialize - The class(es) to apply when the tab 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 tabs.\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: 250,\n open: -1,\n close: -1,\n };\n\n /**\n * The current state of the tab's focus.\n *\n * @protected\n *\n * @type {string}\n */\n _focusState = \"none\";\n\n /**\n * This last event triggered on the tab.\n *\n * @protected\n *\n * @type {string}\n */\n _currentEvent = \"none\";\n\n /**\n * A flag to set if focusing a tab item toggle will automatically activate it.\n *\n * @protected\n *\n * @type {boolean}\n */\n _automatic = false;\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 tab.\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 `Tab`.\n *\n * @param {object} options - The options for generating the tab.\n * @param {HTMLElement} [options.tabsElement] - The tab element in the DOM.\n * @param {string} [options.tabListSelector = .tab-list] - The query selector string for the tab list.\n * @param {string} [options.tabToggleSelector = .tab-toggle] - The query selector string for tab toggle.\n * @param {string} [options.tabContentSelector = .tab-content] - The query selector string for tab content.\n * @param {?(string|string[])} [options.openClass = show] - The class to apply when a tab is \"open\".\n * @param {?(string|string[])} [options.closeClass = hide] - The class to apply when a tab is \"closed\".\n * @param {?(string|string[])} [options.transitionClass = null] - The class to apply when a tab 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.automaticActivation = false] - A flag to set if focusing a tab item toggle will automatically activate it.\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 tab.\n * @param {?(string|string[])} [options.initializeClass = initializing] - The class to apply when a tabs are initialzing.\n * @param {boolean} [options.initialize = false] - A flag to initialize the tab immediately upon creation.\n */\n constructor({\n tabsElement,\n tabListSelector = \".tab-list\",\n tabToggleSelector = \".tab-toggle\",\n tabContentSelector = \".tab-content\",\n openClass = \"show\",\n closeClass = \"hide\",\n transitionClass = null,\n transitionDuration = 300,\n openDuration = -1,\n closeDuration = -1,\n automaticActivation = false,\n prefix = \"graupl-\",\n key = null,\n initializeClass = \"initializing\",\n initialize = false,\n }) {\n // Set DOM elements.\n this._dom.tabs = tabsElement;\n\n // Set DOM selectors.\n this._selectors.tabList = tabListSelector;\n this._selectors.tabToggle = tabToggleSelector;\n this._selectors.tabContent = tabContentSelector;\n\n // Set open/close classes.\n this._classes.open = openClass || \"\";\n this._classes.close = closeClass || \"\";\n this._classes.transition = transitionClass || \"\";\n this._classes.initialize = initializeClass || \"\";\n\n // Set transition duration.\n this._durations.transition = transitionDuration;\n this._durations.open = openDuration;\n this._durations.close = closeDuration;\n\n // Set automatic activation.\n this._automatic = automaticActivation;\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 tabs.\n */\n initialize() {\n try {\n if (!this._validate()) {\n throw new Error(\n `Graupl Tab: cannot initialize tab. The following errors have been found:\\n - ${this.errors.join(\n \"\\n - \"\n )}`\n );\n }\n\n addClass(this._classes.initialize, this.dom.tabs);\n\n // Set up the DOM.\n this._generateKey();\n this._setDOMElements();\n this._setIds();\n this._setAriaAttributes();\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(\"tabs\");\n storage.pushToStorage(\"tabs\", this.dom.tabs.id, this);\n\n if (\n this.elements.tabToggle.filter((toggle) => toggle.isActive).length === 0\n ) {\n this.elements.tabToggle[0].show();\n }\n\n requestAnimationFrame(() => {\n removeClass(this._classes.initialize, this.dom.tabs);\n });\n } catch (error) {\n console.error(error);\n }\n }\n\n /**\n * The DOM elements of the tab.\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 elements of the tabs.\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 tab and tab items.\n *\n * @readonly\n *\n * @type {boolean}\n *\n * @see _selectors\n */\n get selectors() {\n return this._selectors;\n }\n\n /**\n * The class(es) to apply when the tab 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 tab 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 tab 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 duration time (in milliseconds) for the transition between open and closed states.\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 will be used instead.\n *\n * @type {number}\n *\n * @see _durations.open\n */\n get openDuration() {\n return this._durations.open === -1\n ? this.transitionDuration\n : 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 will be used instead.\n *\n * @type {number}\n *\n * @see _durations.close\n */\n get closeDuration() {\n return this._durations.close === -1\n ? this.transitionDuration\n : 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 * A flag to set if focusing a tab item toggle will automatically activate it.\n *\n * @type {boolean}\n *\n * @see _automatic\n */\n get isAutomatic() {\n return this._automatic;\n }\n\n set isAutomatic(value) {\n isValidType(\"boolean\", { value });\n\n if (this._automatic !== value) {\n this._automatic = value;\n }\n }\n\n /**\n * The current index of the tab item.\n *\n * @readonly\n *\n * @type {number}\n *\n * @see _currentChild\n */\n get currentChild() {\n return this._currentChild;\n }\n\n set currentChild(value) {\n isValidType(\"number\", { value });\n\n if (\n this._currentChild !== value &&\n value >= 0 &&\n value < this.elements.tabToggle.length\n ) {\n this._currentChild = value;\n }\n }\n /**\n * The currently selected tab item.\n *\n * @readonly\n *\n * @type {TabToggle}\n */\n get currentTabToggle() {\n return this.elements.tabToggle[this.currentChild];\n }\n\n /**\n * The current state of the tab'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 tabs.\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 }\n }\n\n /**\n * The key used to generate IDs throughout the tab.\n *\n * @readonly\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 /**\n * Validates all aspects of the tabs 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 tabsElement: this.dom.tabs,\n });\n\n if (!htmlElementChecks) {\n this._errors.push(htmlElementChecks.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 // Boolean checks.\n const booleanCheck = isValidType(\"boolean\", {\n automaticActivation: this._automatic,\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 * 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 tab and it's children if they do not already exist.\n *\n * The generated IDs use the key and follow the format:\n * - tabs: `tabs-${key}`\n * - tab-list: `tab-list-${key}`\n *\n * @protected\n */\n _setIds() {\n this.dom.tabs.id = this.dom.tabs.id || `tabs-${this.key}`;\n this.dom.tabList.id = this.dom.tabList.id || `tab-list-${this.key}`;\n }\n\n /**\n * Sets the ARIA attributes for the tablist.\n *\n * @protected\n */\n _setAriaAttributes() {\n this.dom.tabList.setAttribute(\"role\", \"tablist\");\n }\n\n /**\n * Sets the transition durations of the tab as a CSS custom properties.\n *\n * The custom properties are:\n * - `--graupl-tabs-transition-duration`,\n * - `--graupl-tabs-open-transition-duration`, and\n * - `--graupl-tabs-close-transition-duration`.\n *\n * The prefix of `graupl-` can be changed by setting the tab's prefix value.\n *\n * @protected\n */\n _setTransitionDurations() {\n this.dom.tabs.style.setProperty(\n `--${this.prefix}tabs-transition-duration`,\n `${this.transitionDuration}ms`\n );\n\n this.dom.tabs.style.setProperty(\n `--${this.prefix}tabs-open-transition-duration`,\n `${this.openDuration}ms`\n );\n\n this.dom.tabs.style.setProperty(\n `--${this.prefix}tabs-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.tabs] - 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.tabs, 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.tabs) 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 tab.\n *\n * Utilizes _setDOMElementType and\n * _resetDOMElementType.\n *\n * @protected\n */\n _setDOMElements() {\n this._resetDOMElementType(\"tabList\");\n this._setDOMElementType(\"tabList\");\n\n if (this.dom.tabList) {\n this._resetDOMElementType(\"tabToggle\");\n this._setDOMElementType(\"tabToggle\", { base: this.dom.tabList });\n }\n\n this._resetDOMElementType(\"tabContent\");\n this._setDOMElementType(\"tabContent\");\n }\n\n /**\n * Creates and initializes all tab toggles.\n *\n * @protected\n */\n _createChildElements() {\n this.dom.tabToggle.forEach((tabToggle, index) => {\n const toggle = new TabToggle({\n toggleElement: tabToggle,\n contentElement: this.dom.tabContent[index],\n parentTab: this,\n });\n\n toggle.initialize();\n\n this._elements.tabToggle.push(toggle);\n });\n }\n\n /**\n * Handles focus events throughout the tab for proper use.\n *\n * - Adds a `focus` listener to every tab item so when it gains focus,\n * it will set the tab's current child to the index of the item.\n *\n * @protected\n */\n _handleFocus() {\n this.elements.tabToggle.forEach((toggle, index) => {\n toggle.dom.toggle.addEventListener(\"focus\", () => {\n this.currentChild = index;\n\n if (this.isAutomatic) {\n this.currentTabToggle.show();\n }\n });\n });\n }\n\n /**\n * Handles click events throughout the tab item for proper use.\n *\n * - Adds a `pointerup` listener to the tab item toggles that will toggle each tab item.\n *\n * @protected\n */\n _handleClick() {\n this.elements.tabToggle.forEach((toggle, index) => {\n toggle.dom.toggle.addEventListener(\"pointerup\", () => {\n this.currentChild = index;\n toggle.show();\n });\n });\n }\n\n /**\n * Handles keydown events throughout the tab item for proper use.\n *\n * This method exists to assist the _handleKeyup method.\n *\n * - Adds a `keydown` listener to all tab item toggles.\n * - Blocks propagation on \"Space\", \"Enter\", \"ArrowRight\", \"ArrowLeft\", \"Home\", and \"End\" keys.\n */\n _handleKeydown() {\n this.dom.tabToggle.forEach((tabToggle) => {\n tabToggle.addEventListener(\"keydown\", (event) => {\n const key = keyPress(event);\n const ToggleKeys = [\n \"Space\",\n \"Enter\",\n \"ArrowRight\",\n \"ArrowLeft\",\n \"Home\",\n \"End\",\n ];\n\n // Prevent default behavior for space and enter keys.\n if (ToggleKeys.includes(key)) {\n preventEvent(event);\n }\n });\n });\n }\n\n /**\n * Handles keyup events throughout the tab item for proper use.\n *\n * Adds the follow keybindings (explanations are taken from the WAI ARIA Practices Guide Tab Pattern):\n *\n * - `Enter` or `Space`:\n * - When focus is on the tab link 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 tab link 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 tab are included in the page `Tab` sequence.\n * - `Shift + Tab`: Moves focus to the previous focusable element; all focusable elements in the tab are included in the page `Tab` sequence.\n * - `Down Arrow` (Optional): If focus is on an tab link, moves focus to the next tab link. If focus is on the last tab link, either does nothing or moves focus to the first tab link.\n * - `Up Arrow` (Optional): If focus is on an tab link, moves focus to the previous tab link. If focus is on the first tab link, either does nothing or moves focus to the last tab link.\n * - `Home` (Optional): When focus is on an tab link, moves focus to the first tab link.\n * - `End` (Optional): When focus is on an tab link, moves focus to the last tab link.\n *\n * Note: When the above explanations mention \"tab link\", they are referring to the tab item toggle.\n */\n _handleKeyup() {\n this.dom.tabToggle.forEach((tabToggle) => {\n tabToggle.addEventListener(\"keyup\", (event) => {\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n preventEvent(event);\n this.currentTabToggle.show();\n\n break;\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 \"ArrowRight\":\n preventEvent(event);\n this.focusNextChild();\n\n break;\n case \"ArrowLeft\":\n preventEvent(event);\n this.focusPreviousChild();\n\n break;\n }\n });\n });\n }\n\n /**\n * Focus the tab's current child.\n *\n * @public\n */\n focusCurrentChild() {\n if (this.currentChild !== -1) {\n this.currentTabToggle.focus();\n }\n }\n\n /**\n * Focuses the tab'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 tab's first child.\n *\n * @public\n */\n focusFirstChild() {\n this.focusChild(0);\n }\n\n /**\n * Focus the tab's last child.\n *\n * @public\n */\n focusLastChild() {\n this.focusChild(this.elements.tabToggle.length - 1);\n }\n\n /**\n * Focus the tab's next child.\n *\n * @public\n */\n focusNextChild() {\n if (this.currentChild < this.elements.tabToggle.length - 1) {\n this.focusChild(this.currentChild + 1);\n } else {\n this.focusFirstChild();\n }\n }\n\n /**\n * Focus the tab's previous child.\n *\n * @public\n */\n focusPreviousChild() {\n if (this.currentChild > 0) {\n this.focusChild(this.currentChild - 1);\n } else {\n this.focusLastChild();\n }\n }\n\n /**\n * Blurs the tab's current child.\n *\n * @public\n */\n blurCurrentChild() {\n if (this.currentChild !== -1) {\n this.currentTabToggle.blur();\n }\n }\n}\n\nexport default Tabs;\n"],"mappings":"AAMA,SAAgBA,EAASC,EAAWC,EAAS,CAEvCD,IAAc,IAAMA,EAAUE,SAAW,IAIzC,OAAOF,GAAc,SACvBC,EAAQE,UAAUC,IAAIJ,CAAAA,EAEtBC,EAAQE,UAAUC,IAAI,GAAGJ,CAAAA,GAU7B,SAAgBK,EAAYL,EAAWC,EAAS,CAE1CD,IAAc,IAAMA,EAAUE,SAAW,IAIzC,OAAOF,GAAc,SACvBC,EAAQE,UAAUG,OAAON,CAAAA,EAEzBC,EAAQE,UAAUG,OAAO,GAAGN,CAAAA,GCXhC,IAAa0B,EAAb,KAAgC,CAQ9BC,YAAYC,EAAcC,EAAU,CAAA,EAAI,CAStC,KAAKC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ACb,KAAKI,eAAAA,EAEL,MACF,IAAK,YACHhI,EAAa4H,CAAAA,EACb,KAAKK,mBAAAA,EAEL,WAWVC,mBAAoB,CACd,KAAK7D,eAAiB,IACxB,KAAKC,iBAAiB6D,MAAAA,EAW1BC,WAAWb,EAAO,CAChB,KAAKc,iBAAAA,EACL,KAAKhE,aAAekD,EACpB,KAAKW,kBAAAA,EAQPJ,iBAAkB,CAChB,KAAKM,WAAW,CAAA,EAQlBL,gBAAiB,CACf,KAAKK,WAAW,KAAK3E,SAASnD,UAAUuD,OAAS,CAAA,EAQnDmE,gBAAiB,CACX,KAAK3D,aAAe,KAAKZ,SAASnD,UAAUuD,OAAS,EACvD,KAAKuE,WAAW,KAAK/D,aAAe,CAAA,EAEpC,KAAKyD,gBAAAA,EASTG,oBAAqB,CACf,KAAK5D,aAAe,EACtB,KAAK+D,WAAW,KAAK/D,aAAe,CAAA,EAEpC,KAAK0D,eAAAA,EASTM,kBAAmB,CACb,KAAKhE,eAAiB,IACxB,KAAKC,iBAAiBgE,KAAAA,IAK5B,EAAepI"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
function h(t,e){t===""||t.length===0||(typeof t=="string"?e.classList.add(t):e.classList.add(...t))}function l(t,e){t===""||t.length===0||(typeof t=="string"?e.classList.remove(t):e.classList.remove(...t))}var A=class{constructor(t,e={}){this._equals=e.equals||Object.is,this._current=t,this._committed=t}get value(){return this._current}set value(t){this._current=t}get committed(){return this._committed}get isDirty(){return!this._equals(this._current,this._committed)}commit(){return this._committed=this._current,this}reset(){return this._current=this._committed,this}update(t){return this._current=t(this._current),this}},k=class{_dom={toggle:null,content:null};_elements={parent:null};_active=new A(!1);_activateEvent=new CustomEvent("grauplTabToggleActivate",{bubbles:!0,detail:{item:this}});_deactivateEvent=new CustomEvent("grauplTabToggleDeactivate",{bubbles:!0,detail:{item:this}});constructor({toggleElement:t,contentElement:e,parentTab:s}){this._dom.toggle=t,this._dom.content=e,this._elements.parent=s}initialize(){this._setIds(),this._setAriaAttributes(),this.dom.toggle.getAttribute("aria-selected")==="true"?this.show():this._deactivate({emit:!1,transition:!1})}get dom(){return this._dom}get elements(){return this._elements}get isActive(){return this._active.value}_setIds(){const{key:t}=this.elements.parent,e=this.elements.parent.dom.tabToggle.indexOf(this.dom.toggle);this.dom.toggle.id=this.dom.toggle.id||`tab-toggle-${t}-${e}`,this.dom.content.id=this.dom.content.id||`tab-content-${t}-${e}`}_setAriaAttributes(){this.dom.toggle.setAttribute("role","tab"),this.dom.toggle.getAttribute("aria-selected")!=="true"&&this.dom.toggle.setAttribute("aria-selected","false"),this.dom.toggle.setAttribute("aria-controls",this.dom.content.id),this.dom.content.setAttribute("role","tabpanel")}_activate({emit:t=!0,transition:e=!0}={}){const{closeClass:s,openClass:i,transitionClass:o,openDuration:a}=this.elements.parent;this.dom.toggle.setAttribute("aria-selected","true"),e&&o!==""?(h(o,this.dom.content),requestAnimationFrame(()=>{l(s,this.dom.content),requestAnimationFrame(()=>{h(i,this.dom.content),requestAnimationFrame(()=>{setTimeout(()=>{l(o,this.dom.content)},a)})})})):(h(i,this.dom.content),l(s,this.dom.content)),t&&this.dom.toggle.dispatchEvent(this._activateEvent)}_deactivate({emit:t=!0,transition:e=!0}={}){const{closeClass:s,openClass:i,transitionClass:o,closeDuration:a}=this.elements.parent;this.dom.toggle.setAttribute("aria-selected","false"),e&&o!==""?(h(o,this.dom.content),requestAnimationFrame(()=>{l(i,this.dom.content),requestAnimationFrame(()=>{h(s,this.dom.content),requestAnimationFrame(()=>{setTimeout(()=>{l(o,this.dom.content)},a)})})})):(h(s,this.dom.content),l(i,this.dom.content)),t&&this.dom.toggle.dispatchEvent(this._deactivateEvent)}show({force:t=!1,preserveState:e=!1}={}){this.isActive&&!t||(this.elements.parent.focusState="self",this._activate(),this._active.value=!0,e||this._active.commit(),this.dom.toggle.setAttribute("tabindex","0"),this.deactivateSiblings())}hide({force:t=!1,preserveState:e=!1}={}){!this.isActive&&!t||(this.elements.parent.focusState="none",this._deactivate(),this._active.value=!1,e||this._active.commit(),this.dom.toggle.setAttribute("tabindex","-1"))}focus(){this.dom.toggle.focus()}blur(){this.dom.toggle.blur()}deactivateSiblings(){this.elements.parent&&this.elements.parent.elements.tabToggle.forEach(t=>{t!==this&&t.hide()})}},$=k;function _(t,e){try{if(typeof e!="object"){const s=typeof e;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${s}" given.`)}for(const s in e)if(!(e[s]instanceof t)){const i=typeof e[s];throw new TypeError(`${s} must be an instance of ${t.name}. "${i}" given.`)}return{status:!0,error:null}}catch(s){return{status:!1,error:s}}}function r(t,e){try{if(typeof e!="object"){const s=typeof e;throw new TypeError(`Values given to isValidType() must be inside of an object. "${s}" given.`)}for(const s in e){const i=typeof e[s];if(i!==t)throw new TypeError(`${s} must be a ${t}. "${i}" given.`)}return{status:!0,error:null}}catch(s){return{status:!1,error:s}}}function b(t){try{if(typeof t!="object"){const e=typeof t;throw new TypeError(`Values given to isQuerySelector() must be inside of an object. "${e}" given.`)}for(const e in t)try{if(t[e]===null)throw new Error;document.querySelector(t[e])}catch{throw new TypeError(`${e} must be a valid query selector. "${t[e]}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function m(t){try{if(typeof t!="object"||Array.isArray(t)){const e=typeof t;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${e}" given.`)}for(const e in t){const s=typeof t[e];if(s!=="string")if(Array.isArray(t[e]))t[e].forEach(i=>{if(typeof i!="string")throw new TypeError(`${e} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${e} must be a string or an array of strings. "${s}" given.`);else{const i={};i[e]=t[e],b(i)}}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function v(t){try{if(typeof t!="object"){const s=typeof t;throw new TypeError(`Values given to isValidState() must be inside of an object. "${s}" given.`)}const e=["none","self","child"];for(const s in t)if(!e.includes(t[s]))throw new TypeError(`${s} must be one of the following values: ${e.join(", ")}. "${t[s]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function D(t){try{if(typeof t!="object"){const s=typeof t;throw new TypeError(`Values given to isValidEvent() must be inside of an object. "${s}" given.`)}const e=["none","mouse","keyboard","character"];for(const s in t)if(!e.includes(t[s]))throw new TypeError(`${s} must be one of the following values: ${e.join(", ")}. "${t[s]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function p(t){try{const e=t.key||t.keyCode,s={Enter:e==="Enter"||e===13,Space:e===" "||e==="Spacebar"||e===32,Escape:e==="Escape"||e==="Esc"||e===27,ArrowUp:e==="ArrowUp"||e==="Up"||e===38,ArrowRight:e==="ArrowRight"||e==="Right"||e===39,ArrowDown:e==="ArrowDown"||e==="Down"||e===40,ArrowLeft:e==="ArrowLeft"||e==="Left"||e===37,Home:e==="Home"||e===36,End:e==="End"||e===35,Tab:e==="Tab"||e===9};return Object.keys(s).find(i=>s[i]===!0)||""}catch{return""}}function c(t){t.preventDefault(),t.stopPropagation()}function S(t=null){window.Graupl=window.Graupl||{},r("string",{type:t})&&(window.Graupl[t]=window.Graupl[t]||{})}function L(t=null){return r("string",{type:t})?window.Graupl[t]:window.Graupl}function j(t,e={}){r("string",{type:t})&&r("object",{data:e})&&(window.Graupl[t]=e)}function x(t){r("string",{type:t})&&(window.Graupl[t]={})}function O(t,e,s){r("string",{type:t,key:e})&&(window.Graupl[t][e]=s)}function q(t,e){return r("string",{type:t,key:e})?window.Graupl[t][e]:null}function G(t,e){r("string",{type:t,key:e})&&delete window.Graupl[t][e]}var y={initializeStorage:S,getStorage:L,setStorage:j,clearStorage:x,pushToStorage:O,getFromStorage:q,removeFromStorage:G},M=class{_dom={tabs:null,tabList:null,tabToggle:[],tabContent:[]};_domLock=["tab"];_selectors={tabList:"",tabToggle:"",tabContent:""};_elements={tabToggle:[]};_classes={open:"show",close:"hide",transition:"transitioning",initialize:"initializing"};_durations={transition:250,open:-1,close:-1};_focusState="none";_currentEvent="none";_automatic=!1;_currentChild=0;_prefix="graupl-";_key="";_errors=[];constructor({tabsElement:t,tabListSelector:e=".tab-list",tabToggleSelector:s=".tab-toggle",tabContentSelector:i=".tab-content",openClass:o="show",closeClass:a="hide",transitionClass:u=null,transitionDuration:d=300,openDuration:f=-1,closeDuration:g=-1,automaticActivation:n=!1,prefix:w="graupl-",key:E=null,initializeClass:C="initializing",initialize:T=!1}){this._dom.tabs=t,this._selectors.tabList=e,this._selectors.tabToggle=s,this._selectors.tabContent=i,this._classes.open=o||"",this._classes.close=a||"",this._classes.transition=u||"",this._classes.initialize=C||"",this._durations.transition=d,this._durations.open=f,this._durations.close=g,this._automatic=n,this._prefix=w||"",this._key=E||"",T&&this.initialize()}initialize(){try{if(!this._validate())throw new Error(`Graupl Tab: cannot initialize tab. The following errors have been found:
|
|
2
|
+
- ${this.errors.join(`
|
|
3
|
+
- `)}`);h(this._classes.initialize,this.dom.tabs),this._generateKey(),this._setDOMElements(),this._setIds(),this._setAriaAttributes(),this._createChildElements(),this._handleFocus(),this._handleClick(),this._handleKeydown(),this._handleKeyup(),this._setTransitionDurations(),y.initializeStorage("tabs"),y.pushToStorage("tabs",this.dom.tabs.id,this),this.elements.tabToggle.filter(t=>t.isActive).length===0&&this.elements.tabToggle[0].show(),requestAnimationFrame(()=>{l(this._classes.initialize,this.dom.tabs)})}catch(t){console.error(t)}}get dom(){return this._dom}get elements(){return this._elements}get selectors(){return this._selectors}get openClass(){return this._classes.open}set openClass(t){m({openClass:t}),this._classes.open!==t&&(this._classes.open=t)}get closeClass(){return this._classes.close}set closeClass(t){m({closeClass:t}),this._classes.close!==t&&(this._classes.close=t)}get transitionClass(){return this._classes.transition}set transitionClass(t){m({transitionClass:t}),this._classes.transition!==t&&(this._classes.transition=t)}get transitionDuration(){return this._durations.transition}set transitionDuration(t){r("number",{value:t}),this._durations.transition!==t&&(this._durations.transition=t,this._setTransitionDurations())}get openDuration(){return this._durations.open===-1?this.transitionDuration:this._durations.open}set openDuration(t){r("number",{value:t}),this._durations.open!==t&&(this._durations.open=t,this._setTransitionDurations())}get closeDuration(){return this._durations.close===-1?this.transitionDuration:this._durations.close}set closeDuration(t){r("number",{value:t}),this._durations.close!==t&&(this._durations.close=t,this._setTransitionDurations())}get isAutomatic(){return this._automatic}set isAutomatic(t){r("boolean",{value:t}),this._automatic!==t&&(this._automatic=t)}get currentChild(){return this._currentChild}set currentChild(t){r("number",{value:t}),this._currentChild!==t&&t>=0&&t<this.elements.tabToggle.length&&(this._currentChild=t)}get currentTabToggle(){return this.elements.tabToggle[this.currentChild]}get focusState(){return this._focusState}set focusState(t){v({value:t}),this._focusState!==t&&(this._focusState=t)}get currentEvent(){return this._currentEvent}set currentEvent(t){D({value:t}),this._currentEvent!==t&&(this._currentEvent=t)}get prefix(){return this._prefix}set prefix(t){r("string",{value:t}),this._prefix!==t&&(this._prefix=t)}get key(){return this._key}get errors(){return this._errors}_validate(){let t=!0;const e=_(HTMLElement,{tabsElement:this.dom.tabs});e||(this._errors.push(e.message),t=!1);const s={};for(const n of Object.keys(this._selectors))s[`${n}Selector`]=this._selectors[n];const i=b(s);i||(this._errors.push(i.message),t=!1);const o={};for(const n of Object.keys(this._classes))this._classes[n]!==""&&(o[`${n}Class`]=this._classes[n]);const a=m(o);a.status||(this._errors.push(a.error.message),t=!1);const u={};for(const n of Object.keys(this._durations))u[`${n}Duration`]=this._durations[n];const d=r("number",u);d.status||(this._errors.push(d.error.message),t=!1);const f=r("boolean",{automaticActivation:this._automatic});if(f.status||(this._errors.push(f.error.message),t=!1),this._key!==""){const n=r("string",{key:this._key});n.status||(this._errors.push(n.error.message),t=!1)}const g=r("string",{prefix:this._prefix});return g.status||(this._errors.push(g.error.message),t=!1),t}_generateKey({regenerate:t=!1}={}){(this.key===""||t)&&(this._key=Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,10))}_setIds(){this.dom.tabs.id=this.dom.tabs.id||`tabs-${this.key}`,this.dom.tabList.id=this.dom.tabList.id||`tab-list-${this.key}`}_setAriaAttributes(){this.dom.tabList.setAttribute("role","tablist")}_setTransitionDurations(){this.dom.tabs.style.setProperty(`--${this.prefix}tabs-transition-duration`,`${this.transitionDuration}ms`),this.dom.tabs.style.setProperty(`--${this.prefix}tabs-open-transition-duration`,`${this.openDuration}ms`),this.dom.tabs.style.setProperty(`--${this.prefix}tabs-close-transition-duration`,`${this.closeDuration}ms`)}_setDOMElementType(t,{base:e=this.dom.tabs,overwrite:s=!0,strict:i=!0}={}){if(typeof this.selectors[t]=="string"){if(this._domLock.includes(t))throw new Error(`Graupl ${this.constructor.name}: "${t}" element cannot be set through _setDOMElementType.`);e!==this.dom.tabs&&_(HTMLElement,{base:e});const o=Array.from(e.querySelectorAll(this.selectors[t])).filter(a=>i?a.parentElement===e:!0);s?Array.isArray(this._dom[t])?this._dom[t]=o:this._dom[t]=o[0]||null:Array.isArray(this._dom[t])?this._dom[t]=[...this._dom[t],...o]:this._dom[t]=o[0]||null}else throw new Error(`Graupl ${this.constructor.name}: "${t}" is not a valid element type.`)}_resetDOMElementType(t){if(typeof this.selectors[t]=="string"){if(this._domLock.includes(t))throw new Error(`Graupl ${this.constructor.name}: "${t}" element cannot be reset through _resetDOMElementType.`);Array.isArray(this._dom[t])?this._dom[t]=[]:this._dom[t]=null}else throw new Error(`Graupl ${this.constructor.name}: "${t}" is not a valid element type.`)}_setDOMElements(){this._resetDOMElementType("tabList"),this._setDOMElementType("tabList"),this.dom.tabList&&(this._resetDOMElementType("tabToggle"),this._setDOMElementType("tabToggle",{base:this.dom.tabList})),this._resetDOMElementType("tabContent"),this._setDOMElementType("tabContent")}_createChildElements(){this.dom.tabToggle.forEach((t,e)=>{const s=new $({toggleElement:t,contentElement:this.dom.tabContent[e],parentTab:this});s.initialize(),this._elements.tabToggle.push(s)})}_handleFocus(){this.elements.tabToggle.forEach((t,e)=>{t.dom.toggle.addEventListener("focus",()=>{this.currentChild=e,this.isAutomatic&&this.currentTabToggle.show()})})}_handleClick(){this.elements.tabToggle.forEach((t,e)=>{t.dom.toggle.addEventListener("pointerup",()=>{this.currentChild=e,t.show()})})}_handleKeydown(){this.dom.tabToggle.forEach(t=>{t.addEventListener("keydown",e=>{const s=p(e);["Space","Enter","ArrowRight","ArrowLeft","Home","End"].includes(s)&&c(e)})})}_handleKeyup(){this.dom.tabToggle.forEach(t=>{t.addEventListener("keyup",e=>{switch(p(e)){case"Space":case"Enter":c(e),this.currentTabToggle.show();break;case"Home":c(e),this.focusFirstChild();break;case"End":c(e),this.focusLastChild();break;case"ArrowRight":c(e),this.focusNextChild();break;case"ArrowLeft":c(e),this.focusPreviousChild();break}})})}focusCurrentChild(){this.currentChild!==-1&&this.currentTabToggle.focus()}focusChild(t){this.blurCurrentChild(),this.currentChild=t,this.focusCurrentChild()}focusFirstChild(){this.focusChild(0)}focusLastChild(){this.focusChild(this.elements.tabToggle.length-1)}focusNextChild(){this.currentChild<this.elements.tabToggle.length-1?this.focusChild(this.currentChild+1):this.focusFirstChild()}focusPreviousChild(){this.currentChild>0?this.focusChild(this.currentChild-1):this.focusLastChild()}blurCurrentChild(){this.currentChild!==-1&&this.currentTabToggle.blur()}},V=M;export{V as default};
|
|
4
|
+
|
|
5
|
+
//# sourceMappingURL=tabs.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.es.js","names":["addClass","className","element","length","classList","add","removeClass","remove","selectAllFocusableElements","context","document","fn","querySelector","elements","Array","from","querySelectorAll","tabbableElements","filter","check","getAttribute","selectFirstFocusableElement","selectLastFocusableElement","selectNextFocusableElement","index","indexOf","selectPreviousFocusableElement","TransactionalValue","constructor","initialValue","options","_equals","equals","Object","is","_current","_committed","value","val","committed","isDirty","commit","reset","update","fn","addClass","removeClass","TransactionalValue","TabToggle","_dom","toggle","content","_elements","parent","_active","_activateEvent","CustomEvent","bubbles","detail","item","_deactivateEvent","constructor","toggleElement","contentElement","parentTab","initialize","_setIds","_setAriaAttributes","dom","getAttribute","show","_deactivate","emit","transition","elements","isActive","value","key","index","tabToggle","indexOf","id","setAttribute","_activate","closeClass","openClass","transitionClass","openDuration","requestAnimationFrame","setTimeout","dispatchEvent","closeDuration","force","preserveState","focusState","commit","deactivateSiblings","hide","focus","blur","forEach","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","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","TabToggle","isValidInstance","isValidType","isValidClassList","isQuerySelector","isValidState","isValidEvent","addClass","removeClass","keyPress","preventEvent","storage","Tabs","_dom","tabs","tabList","tabToggle","tabContent","_domLock","_selectors","_elements","_classes","open","close","transition","initialize","_durations","_focusState","_currentEvent","_automatic","_currentChild","_prefix","_key","_errors","constructor","tabsElement","tabListSelector","tabToggleSelector","tabContentSelector","openClass","closeClass","transitionClass","transitionDuration","openDuration","closeDuration","automaticActivation","prefix","key","initializeClass","_validate","Error","errors","join","dom","_generateKey","_setDOMElements","_setIds","_setAriaAttributes","_createChildElements","_handleFocus","_handleClick","_handleKeydown","_handleKeyup","_setTransitionDurations","initializeStorage","pushToStorage","id","elements","filter","toggle","isActive","length","show","requestAnimationFrame","error","console","selectors","value","isAutomatic","currentChild","currentTabToggle","focusState","currentEvent","check","htmlElementChecks","HTMLElement","push","message","querySelectors","querySelector","Object","keys","querySelectorChecks","classes","className","classListChecks","status","durations","durationName","durationChecks","booleanCheck","keyCheck","prefixCheck","regenerate","Math","random","toString","replace","substring","setAttribute","style","setProperty","_setDOMElementType","elementType","base","overwrite","strict","includes","name","domElements","Array","from","querySelectorAll","filteredElements","item","parentElement","isArray","_resetDOMElementType","forEach","index","toggleElement","contentElement","parentTab","addEventListener","event","ToggleKeys","focusFirstChild","focusLastChild","focusNextChild","focusPreviousChild","focusCurrentChild","focus","focusChild","blurCurrentChild","blur"],"sources":["../../../src/js/domHelpers.js","../../../src/js/TransactionalValue.js","../../../src/js/tabs/TabToggle.js","../../../src/js/validate.js","../../../src/js/eventHandlers.js","../../../src/js/storage.js","../../../src/js/tabs/Tabs.js"],"sourcesContent":["/**\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 * @param {?function(HTMLElement): boolean} [fn = null] - An optional addition filter function to process out focusable elements.\n * @return {HTMLElement[]} - An array of focusable elements.\n */\nexport function selectAllFocusableElements(context = document, fn = null) {\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 if (fn !== null) {\n return tabbableElements.filter(fn);\n } else {\n return tabbableElements;\n }\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 * @param {?function(HTMLElement): boolean} [fn = null] - An optional addition filter function to process out focusable elements.\n * @return {HTMLElement|boolean} - The first focusable element or false if none found.\n */\nexport function selectFirstFocusableElement(context = document, fn = null) {\n const tabbableElements = selectAllFocusableElements(context, fn);\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 * @param {?function(HTMLElement): boolean} [fn = null] - An optional addition filter function to process out focusable elements.\n * @return {HTMLElement|boolean} - The last focusable element or false if none found.\n */\nexport function selectLastFocusableElement(context = document, fn = null) {\n const tabbableElements = selectAllFocusableElements(context, fn);\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 * @param {?function(HTMLElement): boolean} [fn = null] - An optional addition filter function to process out focusable elements.\n * @return {HTMLElement|boolean} - The next focusable element or false if none found.\n */\nexport function selectNextFocusableElement(\n element,\n context = document,\n fn = null\n) {\n const tabbableElements = selectAllFocusableElements(context, fn);\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 * @param {?function(HTMLElement): boolean} [fn = null] - An optional addition filter function to process out focusable elements.\n * @return {HTMLElement|boolean} - The previous focusable element or false if none found.\n */\nexport function selectPreviousFocusableElement(\n element,\n context = document,\n fn = null\n) {\n const tabbableElements = selectAllFocusableElements(context, fn);\n const index = tabbableElements.indexOf(element);\n\n return index === 0 ? false : tabbableElements[index - 1];\n}\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","/* global Tabs */\n\nimport { addClass, removeClass } from \"@graupl/core/src/domHelpers.js\";\nimport { TransactionalValue } from \"../TransactionalValue.js\";\n\nclass TabToggle {\n /**\n * The DOM elements within the tab toggle.\n *\n * @protected\n *\n * @type {Object<HTMLElement>}\n *\n * @property {HTMLElement} toggle - The toggle element.\n * @property {HTMLElement} content - The content element.\n */\n _dom = {\n toggle: null,\n content: null,\n };\n\n /**\n * The declared elements within the tab toggle.\n *\n * @protected\n *\n * @type {Object<Tabs>}\n *\n * @property {Tabs} parent - The parent tabs element.\n */\n _elements = {\n parent: null,\n };\n\n /**\n * The active state of the tab toggle.\n *\n * @protected\n *\n * @type {TransactionalValue}\n */\n _active = new TransactionalValue(false);\n\n /**\n * The event that is triggered when the tab toggle is shown.\n *\n * @protected\n *\n * @event grauplTabToggleActivate\n *\n * @type {CustomEvent}\n *\n * @property {boolean} bubbles - A flag to bubble the event.\n * @property {Object<TabToggle>} detail - The details object containing the Accordion item itself.\n */\n _activateEvent = new CustomEvent(\"grauplTabToggleActivate\", {\n bubbles: true,\n detail: { item: this },\n });\n\n /**\n * The event that is triggered when the tab toggle is hidden.\n *\n * @protected\n *\n * @event grauplTabToggleDeactivate\n *\n * @type {CustomEvent}\n *\n * @property {boolean} bubbles - A flag to bubble the event.\n * @property {Object<TabToggle>} detail - The details object containing the Accordion item itself.\n */\n _deactivateEvent = new CustomEvent(\"grauplTabToggleDeactivate\", {\n bubbles: true,\n detail: { item: this },\n });\n\n constructor({ toggleElement, contentElement, parentTab }) {\n // Set DOM elements.\n this._dom.toggle = toggleElement;\n this._dom.content = contentElement;\n\n // Set the parent tab instance.\n this._elements.parent = parentTab;\n }\n\n /**\n * Initializes the tab toggle.\n */\n initialize() {\n // Set up the DOM.\n this._setIds();\n this._setAriaAttributes();\n\n if (this.dom.toggle.getAttribute(\"aria-selected\") === \"true\") {\n this.show();\n } else {\n this._deactivate({ emit: false, transition: false });\n }\n }\n\n /**\n * The DOM elements of the tab toggle.\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 declared elements in the tab toggle.\n *\n * @protected\n *\n * @type {Object<Tabs>}\n *\n * @see _elements\n */\n get elements() {\n return this._elements;\n }\n\n /**\n * The active state of the tab toggle.\n *\n * @readonly\n *\n * @type {TransactionalValue}\n *\n * @see _active\n */\n get isActive() {\n return this._active.value;\n }\n\n /**\n * Sets the IDs of the tab toggle and it's content if they do not already exist.\n *\n * The generated IDs use the following format:\n * - toggle: `tab-toggle-${key}-${index}`\n * - content: `tab-content-${key}-${index}`\n *\n * Where `${key}` is the parent's key and `${index}` is the toggles index in the list of the parent's toggles.\n *\n * @protected\n */\n _setIds() {\n // Get the required information for IDs.\n const { key } = this.elements.parent;\n const index = this.elements.parent.dom.tabToggle.indexOf(this.dom.toggle);\n\n this.dom.toggle.id = this.dom.toggle.id || `tab-toggle-${key}-${index}`;\n this.dom.content.id = this.dom.content.id || `tab-content-${key}-${index}`;\n }\n\n /**\n * Sets the ARIA attributes on the disclosure and it's content.\n */\n _setAriaAttributes() {\n // Set the ARIA attributes for the tab item toggle.\n this.dom.toggle.setAttribute(\"role\", \"tab\");\n\n // If aria-selected is not explicitly set to \"true\", then set it to \"false\".\n if (this.dom.toggle.getAttribute(\"aria-selected\") !== \"true\") {\n this.dom.toggle.setAttribute(\"aria-selected\", \"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 role for the content.\n this.dom.content.setAttribute(\"role\", \"tabpanel\");\n }\n\n /**\n * Activate the toggle.\n *\n * Sets the toggles's `aria-selected` to \"true\", adds the\n * open class to the content, and removes the closed class from the content.\n *\n * @protected\n *\n * @fires grauplTabToggleActivate\n *\n * @param {Object<boolean>} [options = {}] - Options for activating the toggle.\n * @param {boolean} [options.emit = true] - Emit the activat event once activated.\n * @param {boolean} [options.transition = true] - Respect the transition class.\n */\n _activate({ emit = true, transition = true } = {}) {\n const { closeClass, openClass, transitionClass, openDuration } =\n this.elements.parent;\n\n // Set aria-selected to true when hiding accordion item.\n this.dom.toggle.setAttribute(\"aria-selected\", \"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.content);\n\n requestAnimationFrame(() => {\n removeClass(closeClass, this.dom.content);\n\n requestAnimationFrame(() => {\n addClass(openClass, this.dom.content);\n\n requestAnimationFrame(() => {\n setTimeout(() => {\n removeClass(transitionClass, this.dom.content);\n }, openDuration);\n });\n });\n });\n } else {\n // Add the show class\n addClass(openClass, this.dom.content);\n\n // Remove the hide class.\n removeClass(closeClass, this.dom.content);\n }\n\n if (emit) {\n this.dom.toggle.dispatchEvent(this._activateEvent);\n }\n }\n\n /**\n * Deactivates the disclosure.\n *\n * Sets the toggles's `aria-expanded` to \"false\", adds the\n * close class to the content, and removes the open class from the content.\n *\n * @protected\n *\n * @fires grauplTabToggleDeactivate\n *\n * @param {Object<boolean>} [options = {}] - Options for collapsing the toggle.\n * @param {boolean} [options.emit = true] - Emit the deactivate event once deactivated.\n * @param {boolean} [options.transition = true] - Respect the transition class.\n */\n _deactivate({ emit = true, transition = true } = {}) {\n const { closeClass, openClass, transitionClass, closeDuration } =\n this.elements.parent;\n\n // Set aria-selected to false when hiding accordion item.\n this.dom.toggle.setAttribute(\"aria-selected\", \"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.content);\n\n requestAnimationFrame(() => {\n removeClass(openClass, this.dom.content);\n\n requestAnimationFrame(() => {\n addClass(closeClass, this.dom.content);\n\n requestAnimationFrame(() => {\n setTimeout(() => {\n removeClass(transitionClass, this.dom.content);\n }, closeDuration);\n });\n });\n });\n } else {\n // Add the hide class\n addClass(closeClass, this.dom.content);\n\n // Remove the show class.\n removeClass(openClass, this.dom.content);\n }\n\n if (emit) {\n this.dom.toggle.dispatchEvent(this._deactivateEvent);\n }\n }\n\n /**\n * Shows the tab toggle's content.\n *\n * @param {Object<boolean>} [options = {}] - Options for showing the toggle.\n * @param {boolean} [options.force = false] - Whether to force the show action.\n * @param {boolean} [options.preserveState = false] - Whether to preserve the active state.\n */\n show({ force = false, preserveState = false } = {}) {\n if (this.isActive && !force) return;\n\n // Set the focus state of the parent tabs element.\n this.elements.parent.focusState = \"self\";\n\n // Activate the toggle.\n this._activate();\n\n // Set the active state\n this._active.value = true;\n\n if (!preserveState) {\n this._active.commit();\n }\n\n // Set the tabindex to 0 so it can be focused.\n this.dom.toggle.setAttribute(\"tabindex\", \"0\");\n\n // Deactivate all sibling tab toggles.\n this.deactivateSiblings();\n }\n\n /**\n * Hides the tab toggle's content.\n *\n * @param {Object<boolean>} [options = {}] - Options for hiding the toggle.\n * @param {boolean} [options.force = false] - Whether to force the show action.\n * @param {boolean} [options.preserveState = false] - Whether to preserve the active state.\n */\n hide({ force = false, preserveState = false } = {}) {\n if (!this.isActive && !force) return;\n\n // Set the focus state of the parent tabs element.\n this.elements.parent.focusState = \"none\";\n\n // Deactivate the toggle.\n this._deactivate();\n\n // Set the active state\n this._active.value = false;\n\n if (!preserveState) {\n this._active.commit();\n }\n\n // Set the tabindex to -1.\n this.dom.toggle.setAttribute(\"tabindex\", \"-1\");\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 deactivateSiblings() {\n if (this.elements.parent) {\n this.elements.parent.elements.tabToggle.forEach((toggle) => {\n if (toggle !== this) {\n toggle.hide();\n }\n });\n }\n }\n}\n\nexport default TabToggle;\n","/**\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 * 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 Tab class.\n */\n\nimport TabToggle from \"./TabToggle.js\";\nimport {\n isValidInstance,\n isValidType,\n isValidClassList,\n isQuerySelector,\n isValidState,\n isValidEvent,\n} from \"../validate.js\";\nimport { addClass, removeClass } from \"../domHelpers.js\";\nimport { keyPress, preventEvent } from \"../eventHandlers.js\";\nimport storage from \"../storage.js\";\n\nclass Tabs {\n /**\n * The DOM elements within the tab.\n *\n * @protected\n *\n * @type {Object<HTMLElement, HTMLElement[]>}\n *\n * @property {HTMLElement} tabs - The tabs element.\n * @property {HTMLElement} tabList - The tab list element.\n * @property {HTMLElement[]} tabToggle - An array of tab item toggles.\n * @property {HTMLElement[]} tabContent - An array of tab item contents.\n */\n _dom = {\n tabs: null,\n tabList: null,\n tabToggle: [],\n tabContent: [],\n };\n\n /**\n * The DOM elements within the tab that cannot be reset or generated by the tab.\n *\n * @protected\n *\n * @type {string[]}\n */\n _domLock = [\"tab\"];\n\n /**\n * The query selectors used by the tab.\n *\n * @protected\n *\n * @type {Object<string>}\n *\n * @property {string} tabList - The query selector for the tab list.\n * @property {string} tabToggle - The query selector for tab toggles.\n * @property {string} tabContent - The query selector for tab contents.\n */\n _selectors = {\n tabList: \"\",\n tabToggle: \"\",\n tabContent: \"\",\n };\n\n /**\n * The declared elements within the tabs.\n *\n * @protected\n *\n * @type {Object<TabToggle[]>}\n *\n * @property {TabToggle[]} tabToggle - The list of tab items.\n */\n _elements = {\n tabToggle: [],\n };\n\n /**\n * The classes to apply when the tabs are 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 tab is open.\n * @property {string|string[]} close - The class(es) to apply when the tab is closed.\n * @property {string|string[]} transition - The class(es) to apply when the tab is transitioning between states.\n * @property {string|string[]} initialize - The class(es) to apply when the tab 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 tabs.\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: 250,\n open: -1,\n close: -1,\n };\n\n /**\n * The current state of the tab's focus.\n *\n * @protected\n *\n * @type {string}\n */\n _focusState = \"none\";\n\n /**\n * This last event triggered on the tab.\n *\n * @protected\n *\n * @type {string}\n */\n _currentEvent = \"none\";\n\n /**\n * A flag to set if focusing a tab item toggle will automatically activate it.\n *\n * @protected\n *\n * @type {boolean}\n */\n _automatic = false;\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 tab.\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 `Tab`.\n *\n * @param {object} options - The options for generating the tab.\n * @param {HTMLElement} [options.tabsElement] - The tab element in the DOM.\n * @param {string} [options.tabListSelector = .tab-list] - The query selector string for the tab list.\n * @param {string} [options.tabToggleSelector = .tab-toggle] - The query selector string for tab toggle.\n * @param {string} [options.tabContentSelector = .tab-content] - The query selector string for tab content.\n * @param {?(string|string[])} [options.openClass = show] - The class to apply when a tab is \"open\".\n * @param {?(string|string[])} [options.closeClass = hide] - The class to apply when a tab is \"closed\".\n * @param {?(string|string[])} [options.transitionClass = null] - The class to apply when a tab 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.automaticActivation = false] - A flag to set if focusing a tab item toggle will automatically activate it.\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 tab.\n * @param {?(string|string[])} [options.initializeClass = initializing] - The class to apply when a tabs are initialzing.\n * @param {boolean} [options.initialize = false] - A flag to initialize the tab immediately upon creation.\n */\n constructor({\n tabsElement,\n tabListSelector = \".tab-list\",\n tabToggleSelector = \".tab-toggle\",\n tabContentSelector = \".tab-content\",\n openClass = \"show\",\n closeClass = \"hide\",\n transitionClass = null,\n transitionDuration = 300,\n openDuration = -1,\n closeDuration = -1,\n automaticActivation = false,\n prefix = \"graupl-\",\n key = null,\n initializeClass = \"initializing\",\n initialize = false,\n }) {\n // Set DOM elements.\n this._dom.tabs = tabsElement;\n\n // Set DOM selectors.\n this._selectors.tabList = tabListSelector;\n this._selectors.tabToggle = tabToggleSelector;\n this._selectors.tabContent = tabContentSelector;\n\n // Set open/close classes.\n this._classes.open = openClass || \"\";\n this._classes.close = closeClass || \"\";\n this._classes.transition = transitionClass || \"\";\n this._classes.initialize = initializeClass || \"\";\n\n // Set transition duration.\n this._durations.transition = transitionDuration;\n this._durations.open = openDuration;\n this._durations.close = closeDuration;\n\n // Set automatic activation.\n this._automatic = automaticActivation;\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 tabs.\n */\n initialize() {\n try {\n if (!this._validate()) {\n throw new Error(\n `Graupl Tab: cannot initialize tab. The following errors have been found:\\n - ${this.errors.join(\n \"\\n - \"\n )}`\n );\n }\n\n addClass(this._classes.initialize, this.dom.tabs);\n\n // Set up the DOM.\n this._generateKey();\n this._setDOMElements();\n this._setIds();\n this._setAriaAttributes();\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(\"tabs\");\n storage.pushToStorage(\"tabs\", this.dom.tabs.id, this);\n\n if (\n this.elements.tabToggle.filter((toggle) => toggle.isActive).length === 0\n ) {\n this.elements.tabToggle[0].show();\n }\n\n requestAnimationFrame(() => {\n removeClass(this._classes.initialize, this.dom.tabs);\n });\n } catch (error) {\n console.error(error);\n }\n }\n\n /**\n * The DOM elements of the tab.\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 elements of the tabs.\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 tab and tab items.\n *\n * @readonly\n *\n * @type {boolean}\n *\n * @see _selectors\n */\n get selectors() {\n return this._selectors;\n }\n\n /**\n * The class(es) to apply when the tab 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 tab 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 tab 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 duration time (in milliseconds) for the transition between open and closed states.\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 will be used instead.\n *\n * @type {number}\n *\n * @see _durations.open\n */\n get openDuration() {\n return this._durations.open === -1\n ? this.transitionDuration\n : 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 will be used instead.\n *\n * @type {number}\n *\n * @see _durations.close\n */\n get closeDuration() {\n return this._durations.close === -1\n ? this.transitionDuration\n : 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 * A flag to set if focusing a tab item toggle will automatically activate it.\n *\n * @type {boolean}\n *\n * @see _automatic\n */\n get isAutomatic() {\n return this._automatic;\n }\n\n set isAutomatic(value) {\n isValidType(\"boolean\", { value });\n\n if (this._automatic !== value) {\n this._automatic = value;\n }\n }\n\n /**\n * The current index of the tab item.\n *\n * @readonly\n *\n * @type {number}\n *\n * @see _currentChild\n */\n get currentChild() {\n return this._currentChild;\n }\n\n set currentChild(value) {\n isValidType(\"number\", { value });\n\n if (\n this._currentChild !== value &&\n value >= 0 &&\n value < this.elements.tabToggle.length\n ) {\n this._currentChild = value;\n }\n }\n /**\n * The currently selected tab item.\n *\n * @readonly\n *\n * @type {TabToggle}\n */\n get currentTabToggle() {\n return this.elements.tabToggle[this.currentChild];\n }\n\n /**\n * The current state of the tab'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 tabs.\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 }\n }\n\n /**\n * The key used to generate IDs throughout the tab.\n *\n * @readonly\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 /**\n * Validates all aspects of the tabs 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 tabsElement: this.dom.tabs,\n });\n\n if (!htmlElementChecks) {\n this._errors.push(htmlElementChecks.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 // Boolean checks.\n const booleanCheck = isValidType(\"boolean\", {\n automaticActivation: this._automatic,\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 * 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 tab and it's children if they do not already exist.\n *\n * The generated IDs use the key and follow the format:\n * - tabs: `tabs-${key}`\n * - tab-list: `tab-list-${key}`\n *\n * @protected\n */\n _setIds() {\n this.dom.tabs.id = this.dom.tabs.id || `tabs-${this.key}`;\n this.dom.tabList.id = this.dom.tabList.id || `tab-list-${this.key}`;\n }\n\n /**\n * Sets the ARIA attributes for the tablist.\n *\n * @protected\n */\n _setAriaAttributes() {\n this.dom.tabList.setAttribute(\"role\", \"tablist\");\n }\n\n /**\n * Sets the transition durations of the tab as a CSS custom properties.\n *\n * The custom properties are:\n * - `--graupl-tabs-transition-duration`,\n * - `--graupl-tabs-open-transition-duration`, and\n * - `--graupl-tabs-close-transition-duration`.\n *\n * The prefix of `graupl-` can be changed by setting the tab's prefix value.\n *\n * @protected\n */\n _setTransitionDurations() {\n this.dom.tabs.style.setProperty(\n `--${this.prefix}tabs-transition-duration`,\n `${this.transitionDuration}ms`\n );\n\n this.dom.tabs.style.setProperty(\n `--${this.prefix}tabs-open-transition-duration`,\n `${this.openDuration}ms`\n );\n\n this.dom.tabs.style.setProperty(\n `--${this.prefix}tabs-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.tabs] - 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.tabs, 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.tabs) 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 tab.\n *\n * Utilizes _setDOMElementType and\n * _resetDOMElementType.\n *\n * @protected\n */\n _setDOMElements() {\n this._resetDOMElementType(\"tabList\");\n this._setDOMElementType(\"tabList\");\n\n if (this.dom.tabList) {\n this._resetDOMElementType(\"tabToggle\");\n this._setDOMElementType(\"tabToggle\", { base: this.dom.tabList });\n }\n\n this._resetDOMElementType(\"tabContent\");\n this._setDOMElementType(\"tabContent\");\n }\n\n /**\n * Creates and initializes all tab toggles.\n *\n * @protected\n */\n _createChildElements() {\n this.dom.tabToggle.forEach((tabToggle, index) => {\n const toggle = new TabToggle({\n toggleElement: tabToggle,\n contentElement: this.dom.tabContent[index],\n parentTab: this,\n });\n\n toggle.initialize();\n\n this._elements.tabToggle.push(toggle);\n });\n }\n\n /**\n * Handles focus events throughout the tab for proper use.\n *\n * - Adds a `focus` listener to every tab item so when it gains focus,\n * it will set the tab's current child to the index of the item.\n *\n * @protected\n */\n _handleFocus() {\n this.elements.tabToggle.forEach((toggle, index) => {\n toggle.dom.toggle.addEventListener(\"focus\", () => {\n this.currentChild = index;\n\n if (this.isAutomatic) {\n this.currentTabToggle.show();\n }\n });\n });\n }\n\n /**\n * Handles click events throughout the tab item for proper use.\n *\n * - Adds a `pointerup` listener to the tab item toggles that will toggle each tab item.\n *\n * @protected\n */\n _handleClick() {\n this.elements.tabToggle.forEach((toggle, index) => {\n toggle.dom.toggle.addEventListener(\"pointerup\", () => {\n this.currentChild = index;\n toggle.show();\n });\n });\n }\n\n /**\n * Handles keydown events throughout the tab item for proper use.\n *\n * This method exists to assist the _handleKeyup method.\n *\n * - Adds a `keydown` listener to all tab item toggles.\n * - Blocks propagation on \"Space\", \"Enter\", \"ArrowRight\", \"ArrowLeft\", \"Home\", and \"End\" keys.\n */\n _handleKeydown() {\n this.dom.tabToggle.forEach((tabToggle) => {\n tabToggle.addEventListener(\"keydown\", (event) => {\n const key = keyPress(event);\n const ToggleKeys = [\n \"Space\",\n \"Enter\",\n \"ArrowRight\",\n \"ArrowLeft\",\n \"Home\",\n \"End\",\n ];\n\n // Prevent default behavior for space and enter keys.\n if (ToggleKeys.includes(key)) {\n preventEvent(event);\n }\n });\n });\n }\n\n /**\n * Handles keyup events throughout the tab item for proper use.\n *\n * Adds the follow keybindings (explanations are taken from the WAI ARIA Practices Guide Tab Pattern):\n *\n * - `Enter` or `Space`:\n * - When focus is on the tab link 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 tab link 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 tab are included in the page `Tab` sequence.\n * - `Shift + Tab`: Moves focus to the previous focusable element; all focusable elements in the tab are included in the page `Tab` sequence.\n * - `Down Arrow` (Optional): If focus is on an tab link, moves focus to the next tab link. If focus is on the last tab link, either does nothing or moves focus to the first tab link.\n * - `Up Arrow` (Optional): If focus is on an tab link, moves focus to the previous tab link. If focus is on the first tab link, either does nothing or moves focus to the last tab link.\n * - `Home` (Optional): When focus is on an tab link, moves focus to the first tab link.\n * - `End` (Optional): When focus is on an tab link, moves focus to the last tab link.\n *\n * Note: When the above explanations mention \"tab link\", they are referring to the tab item toggle.\n */\n _handleKeyup() {\n this.dom.tabToggle.forEach((tabToggle) => {\n tabToggle.addEventListener(\"keyup\", (event) => {\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n preventEvent(event);\n this.currentTabToggle.show();\n\n break;\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 \"ArrowRight\":\n preventEvent(event);\n this.focusNextChild();\n\n break;\n case \"ArrowLeft\":\n preventEvent(event);\n this.focusPreviousChild();\n\n break;\n }\n });\n });\n }\n\n /**\n * Focus the tab's current child.\n *\n * @public\n */\n focusCurrentChild() {\n if (this.currentChild !== -1) {\n this.currentTabToggle.focus();\n }\n }\n\n /**\n * Focuses the tab'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 tab's first child.\n *\n * @public\n */\n focusFirstChild() {\n this.focusChild(0);\n }\n\n /**\n * Focus the tab's last child.\n *\n * @public\n */\n focusLastChild() {\n this.focusChild(this.elements.tabToggle.length - 1);\n }\n\n /**\n * Focus the tab's next child.\n *\n * @public\n */\n focusNextChild() {\n if (this.currentChild < this.elements.tabToggle.length - 1) {\n this.focusChild(this.currentChild + 1);\n } else {\n this.focusFirstChild();\n }\n }\n\n /**\n * Focus the tab's previous child.\n *\n * @public\n */\n focusPreviousChild() {\n if (this.currentChild > 0) {\n this.focusChild(this.currentChild - 1);\n } else {\n this.focusLastChild();\n }\n }\n\n /**\n * Blurs the tab's current child.\n *\n * @public\n */\n blurCurrentChild() {\n if (this.currentChild !== -1) {\n this.currentTabToggle.blur();\n }\n }\n}\n\nexport default Tabs;\n"],"mappings":"AAMA,SAAgBA,EAASC,EAAWC,EAAS,CAEvCD,IAAc,IAAMA,EAAUE,SAAW,IAIzC,OAAOF,GAAc,SACvBC,EAAQE,UAAUC,IAAIJ,CAAAA,EAEtBC,EAAQE,UAAUC,IAAI,GAAGJ,CAAAA,GAU7B,SAAgBK,EAAYL,EAAWC,EAAS,CAE1CD,IAAc,IAAMA,EAAUE,SAAW,IAIzC,OAAOF,GAAc,SACvBC,EAAQE,UAAUG,OAAON,CAAAA,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AAAA,EACb,KAAKE,gBAAAA,EAEL,MACF,IAAK,MACH9H,EAAa4H,CAAAA,EACb,KAAKG,eAAAA,EAEL,MACF,IAAK,aACH/H,EAAa4H,CAAAA,EACb,KAAKI,eAAAA,EAEL,MACF,IAAK,YACHhI,EAAa4H,CAAAA,EACb,KAAKK,mBAAAA,EAEL,WAWVC,mBAAoB,CACd,KAAK7D,eAAiB,IACxB,KAAKC,iBAAiB6D,MAAAA,EAW1BC,WAAWb,EAAO,CAChB,KAAKc,iBAAAA,EACL,KAAKhE,aAAekD,EACpB,KAAKW,kBAAAA,EAQPJ,iBAAkB,CAChB,KAAKM,WAAW,CAAA,EAQlBL,gBAAiB,CACf,KAAKK,WAAW,KAAK3E,SAASnD,UAAUuD,OAAS,CAAA,EAQnDmE,gBAAiB,CACX,KAAK3D,aAAe,KAAKZ,SAASnD,UAAUuD,OAAS,EACvD,KAAKuE,WAAW,KAAK/D,aAAe,CAAA,EAEpC,KAAKyD,gBAAAA,EASTG,oBAAqB,CACf,KAAK5D,aAAe,EACtB,KAAK+D,WAAW,KAAK/D,aAAe,CAAA,EAEpC,KAAK0D,eAAAA,EASTM,kBAAmB,CACb,KAAKhE,eAAiB,IACxB,KAAKC,iBAAiBgE,KAAAA,IAK5B,EAAepI"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var Tabs=(function(){function h(t,e){t===""||t.length===0||(typeof t=="string"?e.classList.add(t):e.classList.add(...t))}function l(t,e){t===""||t.length===0||(typeof t=="string"?e.classList.remove(t):e.classList.remove(...t))}var w=class{constructor(t,e={}){this._equals=e.equals||Object.is,this._current=t,this._committed=t}get value(){return this._current}set value(t){this._current=t}get committed(){return this._committed}get isDirty(){return!this._equals(this._current,this._committed)}commit(){return this._committed=this._current,this}reset(){return this._current=this._committed,this}update(t){return this._current=t(this._current),this}},E=class{_dom={toggle:null,content:null};_elements={parent:null};_active=new w(!1);_activateEvent=new CustomEvent("grauplTabToggleActivate",{bubbles:!0,detail:{item:this}});_deactivateEvent=new CustomEvent("grauplTabToggleDeactivate",{bubbles:!0,detail:{item:this}});constructor({toggleElement:t,contentElement:e,parentTab:s}){this._dom.toggle=t,this._dom.content=e,this._elements.parent=s}initialize(){this._setIds(),this._setAriaAttributes(),this.dom.toggle.getAttribute("aria-selected")==="true"?this.show():this._deactivate({emit:!1,transition:!1})}get dom(){return this._dom}get elements(){return this._elements}get isActive(){return this._active.value}_setIds(){const{key:t}=this.elements.parent,e=this.elements.parent.dom.tabToggle.indexOf(this.dom.toggle);this.dom.toggle.id=this.dom.toggle.id||`tab-toggle-${t}-${e}`,this.dom.content.id=this.dom.content.id||`tab-content-${t}-${e}`}_setAriaAttributes(){this.dom.toggle.setAttribute("role","tab"),this.dom.toggle.getAttribute("aria-selected")!=="true"&&this.dom.toggle.setAttribute("aria-selected","false"),this.dom.toggle.setAttribute("aria-controls",this.dom.content.id),this.dom.content.setAttribute("role","tabpanel")}_activate({emit:t=!0,transition:e=!0}={}){const{closeClass:s,openClass:i,transitionClass:o,openDuration:a}=this.elements.parent;this.dom.toggle.setAttribute("aria-selected","true"),e&&o!==""?(h(o,this.dom.content),requestAnimationFrame(()=>{l(s,this.dom.content),requestAnimationFrame(()=>{h(i,this.dom.content),requestAnimationFrame(()=>{setTimeout(()=>{l(o,this.dom.content)},a)})})})):(h(i,this.dom.content),l(s,this.dom.content)),t&&this.dom.toggle.dispatchEvent(this._activateEvent)}_deactivate({emit:t=!0,transition:e=!0}={}){const{closeClass:s,openClass:i,transitionClass:o,closeDuration:a}=this.elements.parent;this.dom.toggle.setAttribute("aria-selected","false"),e&&o!==""?(h(o,this.dom.content),requestAnimationFrame(()=>{l(i,this.dom.content),requestAnimationFrame(()=>{h(s,this.dom.content),requestAnimationFrame(()=>{setTimeout(()=>{l(o,this.dom.content)},a)})})})):(h(s,this.dom.content),l(i,this.dom.content)),t&&this.dom.toggle.dispatchEvent(this._deactivateEvent)}show({force:t=!1,preserveState:e=!1}={}){this.isActive&&!t||(this.elements.parent.focusState="self",this._activate(),this._active.value=!0,e||this._active.commit(),this.dom.toggle.setAttribute("tabindex","0"),this.deactivateSiblings())}hide({force:t=!1,preserveState:e=!1}={}){!this.isActive&&!t||(this.elements.parent.focusState="none",this._deactivate(),this._active.value=!1,e||this._active.commit(),this.dom.toggle.setAttribute("tabindex","-1"))}focus(){this.dom.toggle.focus()}blur(){this.dom.toggle.blur()}deactivateSiblings(){this.elements.parent&&this.elements.parent.elements.tabToggle.forEach(t=>{t!==this&&t.hide()})}},C=E;function _(t,e){try{if(typeof e!="object"){const s=typeof e;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${s}" given.`)}for(const s in e)if(!(e[s]instanceof t)){const i=typeof e[s];throw new TypeError(`${s} must be an instance of ${t.name}. "${i}" given.`)}return{status:!0,error:null}}catch(s){return{status:!1,error:s}}}function r(t,e){try{if(typeof e!="object"){const s=typeof e;throw new TypeError(`Values given to isValidType() must be inside of an object. "${s}" given.`)}for(const s in e){const i=typeof e[s];if(i!==t)throw new TypeError(`${s} must be a ${t}. "${i}" given.`)}return{status:!0,error:null}}catch(s){return{status:!1,error:s}}}function b(t){try{if(typeof t!="object"){const e=typeof t;throw new TypeError(`Values given to isQuerySelector() must be inside of an object. "${e}" given.`)}for(const e in t)try{if(t[e]===null)throw new Error;document.querySelector(t[e])}catch{throw new TypeError(`${e} must be a valid query selector. "${t[e]}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function u(t){try{if(typeof t!="object"||Array.isArray(t)){const e=typeof t;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${e}" given.`)}for(const e in t){const s=typeof t[e];if(s!=="string")if(Array.isArray(t[e]))t[e].forEach(i=>{if(typeof i!="string")throw new TypeError(`${e} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${e} must be a string or an array of strings. "${s}" given.`);else{const i={};i[e]=t[e],b(i)}}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function T(t){try{if(typeof t!="object"){const s=typeof t;throw new TypeError(`Values given to isValidState() must be inside of an object. "${s}" given.`)}const e=["none","self","child"];for(const s in t)if(!e.includes(t[s]))throw new TypeError(`${s} must be one of the following values: ${e.join(", ")}. "${t[s]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function A(t){try{if(typeof t!="object"){const s=typeof t;throw new TypeError(`Values given to isValidEvent() must be inside of an object. "${s}" given.`)}const e=["none","mouse","keyboard","character"];for(const s in t)if(!e.includes(t[s]))throw new TypeError(`${s} must be one of the following values: ${e.join(", ")}. "${t[s]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function p(t){try{const e=t.key||t.keyCode,s={Enter:e==="Enter"||e===13,Space:e===" "||e==="Spacebar"||e===32,Escape:e==="Escape"||e==="Esc"||e===27,ArrowUp:e==="ArrowUp"||e==="Up"||e===38,ArrowRight:e==="ArrowRight"||e==="Right"||e===39,ArrowDown:e==="ArrowDown"||e==="Down"||e===40,ArrowLeft:e==="ArrowLeft"||e==="Left"||e===37,Home:e==="Home"||e===36,End:e==="End"||e===35,Tab:e==="Tab"||e===9};return Object.keys(s).find(i=>s[i]===!0)||""}catch{return""}}function c(t){t.preventDefault(),t.stopPropagation()}function k(t=null){window.Graupl=window.Graupl||{},r("string",{type:t})&&(window.Graupl[t]=window.Graupl[t]||{})}function $(t=null){return r("string",{type:t})?window.Graupl[t]:window.Graupl}function v(t,e={}){r("string",{type:t})&&r("object",{data:e})&&(window.Graupl[t]=e)}function D(t){r("string",{type:t})&&(window.Graupl[t]={})}function S(t,e,s){r("string",{type:t,key:e})&&(window.Graupl[t][e]=s)}function L(t,e){return r("string",{type:t,key:e})?window.Graupl[t][e]:null}function j(t,e){r("string",{type:t,key:e})&&delete window.Graupl[t][e]}var y={initializeStorage:k,getStorage:$,setStorage:v,clearStorage:D,pushToStorage:S,getFromStorage:L,removeFromStorage:j},x=class{_dom={tabs:null,tabList:null,tabToggle:[],tabContent:[]};_domLock=["tab"];_selectors={tabList:"",tabToggle:"",tabContent:""};_elements={tabToggle:[]};_classes={open:"show",close:"hide",transition:"transitioning",initialize:"initializing"};_durations={transition:250,open:-1,close:-1};_focusState="none";_currentEvent="none";_automatic=!1;_currentChild=0;_prefix="graupl-";_key="";_errors=[];constructor({tabsElement:t,tabListSelector:e=".tab-list",tabToggleSelector:s=".tab-toggle",tabContentSelector:i=".tab-content",openClass:o="show",closeClass:a="hide",transitionClass:d=null,transitionDuration:f=300,openDuration:g=-1,closeDuration:m=-1,automaticActivation:n=!1,prefix:q="graupl-",key:G=null,initializeClass:M="initializing",initialize:V=!1}){this._dom.tabs=t,this._selectors.tabList=e,this._selectors.tabToggle=s,this._selectors.tabContent=i,this._classes.open=o||"",this._classes.close=a||"",this._classes.transition=d||"",this._classes.initialize=M||"",this._durations.transition=f,this._durations.open=g,this._durations.close=m,this._automatic=n,this._prefix=q||"",this._key=G||"",V&&this.initialize()}initialize(){try{if(!this._validate())throw new Error(`Graupl Tab: cannot initialize tab. The following errors have been found:
|
|
2
|
+
- ${this.errors.join(`
|
|
3
|
+
- `)}`);h(this._classes.initialize,this.dom.tabs),this._generateKey(),this._setDOMElements(),this._setIds(),this._setAriaAttributes(),this._createChildElements(),this._handleFocus(),this._handleClick(),this._handleKeydown(),this._handleKeyup(),this._setTransitionDurations(),y.initializeStorage("tabs"),y.pushToStorage("tabs",this.dom.tabs.id,this),this.elements.tabToggle.filter(t=>t.isActive).length===0&&this.elements.tabToggle[0].show(),requestAnimationFrame(()=>{l(this._classes.initialize,this.dom.tabs)})}catch(t){console.error(t)}}get dom(){return this._dom}get elements(){return this._elements}get selectors(){return this._selectors}get openClass(){return this._classes.open}set openClass(t){u({openClass:t}),this._classes.open!==t&&(this._classes.open=t)}get closeClass(){return this._classes.close}set closeClass(t){u({closeClass:t}),this._classes.close!==t&&(this._classes.close=t)}get transitionClass(){return this._classes.transition}set transitionClass(t){u({transitionClass:t}),this._classes.transition!==t&&(this._classes.transition=t)}get transitionDuration(){return this._durations.transition}set transitionDuration(t){r("number",{value:t}),this._durations.transition!==t&&(this._durations.transition=t,this._setTransitionDurations())}get openDuration(){return this._durations.open===-1?this.transitionDuration:this._durations.open}set openDuration(t){r("number",{value:t}),this._durations.open!==t&&(this._durations.open=t,this._setTransitionDurations())}get closeDuration(){return this._durations.close===-1?this.transitionDuration:this._durations.close}set closeDuration(t){r("number",{value:t}),this._durations.close!==t&&(this._durations.close=t,this._setTransitionDurations())}get isAutomatic(){return this._automatic}set isAutomatic(t){r("boolean",{value:t}),this._automatic!==t&&(this._automatic=t)}get currentChild(){return this._currentChild}set currentChild(t){r("number",{value:t}),this._currentChild!==t&&t>=0&&t<this.elements.tabToggle.length&&(this._currentChild=t)}get currentTabToggle(){return this.elements.tabToggle[this.currentChild]}get focusState(){return this._focusState}set focusState(t){T({value:t}),this._focusState!==t&&(this._focusState=t)}get currentEvent(){return this._currentEvent}set currentEvent(t){A({value:t}),this._currentEvent!==t&&(this._currentEvent=t)}get prefix(){return this._prefix}set prefix(t){r("string",{value:t}),this._prefix!==t&&(this._prefix=t)}get key(){return this._key}get errors(){return this._errors}_validate(){let t=!0;const e=_(HTMLElement,{tabsElement:this.dom.tabs});e||(this._errors.push(e.message),t=!1);const s={};for(const n of Object.keys(this._selectors))s[`${n}Selector`]=this._selectors[n];const i=b(s);i||(this._errors.push(i.message),t=!1);const o={};for(const n of Object.keys(this._classes))this._classes[n]!==""&&(o[`${n}Class`]=this._classes[n]);const a=u(o);a.status||(this._errors.push(a.error.message),t=!1);const d={};for(const n of Object.keys(this._durations))d[`${n}Duration`]=this._durations[n];const f=r("number",d);f.status||(this._errors.push(f.error.message),t=!1);const g=r("boolean",{automaticActivation:this._automatic});if(g.status||(this._errors.push(g.error.message),t=!1),this._key!==""){const n=r("string",{key:this._key});n.status||(this._errors.push(n.error.message),t=!1)}const m=r("string",{prefix:this._prefix});return m.status||(this._errors.push(m.error.message),t=!1),t}_generateKey({regenerate:t=!1}={}){(this.key===""||t)&&(this._key=Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,10))}_setIds(){this.dom.tabs.id=this.dom.tabs.id||`tabs-${this.key}`,this.dom.tabList.id=this.dom.tabList.id||`tab-list-${this.key}`}_setAriaAttributes(){this.dom.tabList.setAttribute("role","tablist")}_setTransitionDurations(){this.dom.tabs.style.setProperty(`--${this.prefix}tabs-transition-duration`,`${this.transitionDuration}ms`),this.dom.tabs.style.setProperty(`--${this.prefix}tabs-open-transition-duration`,`${this.openDuration}ms`),this.dom.tabs.style.setProperty(`--${this.prefix}tabs-close-transition-duration`,`${this.closeDuration}ms`)}_setDOMElementType(t,{base:e=this.dom.tabs,overwrite:s=!0,strict:i=!0}={}){if(typeof this.selectors[t]=="string"){if(this._domLock.includes(t))throw new Error(`Graupl ${this.constructor.name}: "${t}" element cannot be set through _setDOMElementType.`);e!==this.dom.tabs&&_(HTMLElement,{base:e});const o=Array.from(e.querySelectorAll(this.selectors[t])).filter(a=>i?a.parentElement===e:!0);s?Array.isArray(this._dom[t])?this._dom[t]=o:this._dom[t]=o[0]||null:Array.isArray(this._dom[t])?this._dom[t]=[...this._dom[t],...o]:this._dom[t]=o[0]||null}else throw new Error(`Graupl ${this.constructor.name}: "${t}" is not a valid element type.`)}_resetDOMElementType(t){if(typeof this.selectors[t]=="string"){if(this._domLock.includes(t))throw new Error(`Graupl ${this.constructor.name}: "${t}" element cannot be reset through _resetDOMElementType.`);Array.isArray(this._dom[t])?this._dom[t]=[]:this._dom[t]=null}else throw new Error(`Graupl ${this.constructor.name}: "${t}" is not a valid element type.`)}_setDOMElements(){this._resetDOMElementType("tabList"),this._setDOMElementType("tabList"),this.dom.tabList&&(this._resetDOMElementType("tabToggle"),this._setDOMElementType("tabToggle",{base:this.dom.tabList})),this._resetDOMElementType("tabContent"),this._setDOMElementType("tabContent")}_createChildElements(){this.dom.tabToggle.forEach((t,e)=>{const s=new C({toggleElement:t,contentElement:this.dom.tabContent[e],parentTab:this});s.initialize(),this._elements.tabToggle.push(s)})}_handleFocus(){this.elements.tabToggle.forEach((t,e)=>{t.dom.toggle.addEventListener("focus",()=>{this.currentChild=e,this.isAutomatic&&this.currentTabToggle.show()})})}_handleClick(){this.elements.tabToggle.forEach((t,e)=>{t.dom.toggle.addEventListener("pointerup",()=>{this.currentChild=e,t.show()})})}_handleKeydown(){this.dom.tabToggle.forEach(t=>{t.addEventListener("keydown",e=>{const s=p(e);["Space","Enter","ArrowRight","ArrowLeft","Home","End"].includes(s)&&c(e)})})}_handleKeyup(){this.dom.tabToggle.forEach(t=>{t.addEventListener("keyup",e=>{switch(p(e)){case"Space":case"Enter":c(e),this.currentTabToggle.show();break;case"Home":c(e),this.focusFirstChild();break;case"End":c(e),this.focusLastChild();break;case"ArrowRight":c(e),this.focusNextChild();break;case"ArrowLeft":c(e),this.focusPreviousChild();break}})})}focusCurrentChild(){this.currentChild!==-1&&this.currentTabToggle.focus()}focusChild(t){this.blurCurrentChild(),this.currentChild=t,this.focusCurrentChild()}focusFirstChild(){this.focusChild(0)}focusLastChild(){this.focusChild(this.elements.tabToggle.length-1)}focusNextChild(){this.currentChild<this.elements.tabToggle.length-1?this.focusChild(this.currentChild+1):this.focusFirstChild()}focusPreviousChild(){this.currentChild>0?this.focusChild(this.currentChild-1):this.focusLastChild()}blurCurrentChild(){this.currentChild!==-1&&this.currentTabToggle.blur()}},O=x;return O})();
|
|
4
|
+
|
|
5
|
+
//# sourceMappingURL=tabs.iife.js.map
|