@graupl/core 1.0.0-beta.14 → 1.0.0-beta.8
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/package.json +3 -41
- package/scss/base/button.scss +1 -1
- package/scss/base/form.scss +1 -1
- package/scss/base/link.scss +1 -1
- package/scss/base/table.scss +1 -1
- package/scss/base.scss +1 -1
- package/scss/component/accordion.scss +1 -1
- package/scss/component/alert.scss +1 -1
- package/scss/component/card.scss +1 -1
- package/scss/component/carousel.scss +1 -1
- package/scss/component/input-group.scss +1 -1
- package/scss/component/list.scss +1 -1
- package/scss/component/menu.scss +1 -1
- package/scss/component/navigation.scss +1 -1
- package/scss/component.scss +1 -1
- package/scss/graupl.scss +1 -1
- package/scss/init.scss +1 -1
- package/scss/layout/columns.scss +1 -1
- package/scss/layout/container.scss +1 -1
- package/scss/layout/flex-columns.scss +1 -1
- package/scss/layout.scss +1 -1
- package/scss/normalize.scss +1 -1
- package/scss/state/focus.scss +1 -1
- package/scss/state.scss +1 -1
- package/scss/theme/color.scss +1 -1
- package/scss/theme/typography.scss +1 -1
- package/scss/theme.scss +1 -1
- package/scss/utilities/alignment.scss +1 -1
- package/scss/utilities/background.scss +1 -1
- package/scss/utilities/border.scss +1 -1
- package/scss/utilities/color.scss +1 -1
- package/scss/utilities/container.scss +1 -1
- package/scss/utilities/display.scss +1 -1
- package/scss/utilities/flex.scss +1 -1
- package/scss/utilities/gradient.scss +1 -1
- package/scss/utilities/height.scss +1 -1
- package/scss/utilities/inset.scss +1 -1
- package/scss/utilities/justification.scss +1 -1
- package/scss/utilities/list.scss +1 -1
- package/scss/utilities/order.scss +1 -1
- package/scss/utilities/position.scss +1 -1
- package/scss/utilities/ratio.scss +1 -1
- package/scss/utilities/spacing.scss +1 -1
- package/scss/utilities/typography.scss +1 -1
- package/scss/utilities/visibility.scss +1 -1
- package/scss/utilities/visually-hidden.scss +1 -1
- package/scss/utilities/width.scss +1 -1
- package/scss/utilities/z-index.scss +1 -1
- package/scss/utilities.scss +1 -1
- package/src/js/accordion/Accordion.js +1 -1
- package/src/js/accordion/index.js +7 -2
- package/src/js/alert/index.js +8 -2
- package/src/js/carousel/index.js +7 -2
- package/src/js/domHelpers.js +0 -81
- package/src/js/navigation/index.js +33 -2
- package/src/js/validate.js +0 -141
- package/src/scss/_defaults.scss +1 -1
- package/src/scss/_index.scss +1 -1
- package/src/scss/_init.scss +1 -1
- package/src/scss/_normalize.scss +1 -1
- package/src/scss/_variables.scss +1 -1
- package/src/scss/base/_index.scss +1 -1
- package/src/scss/base/button/_defaults.scss +1 -1
- package/src/scss/base/button/_index.scss +1 -1
- package/src/scss/base/button/_mixins.scss +1 -6
- package/src/scss/base/button/_variables.scss +1 -1
- package/src/scss/base/form/_defaults.scss +1 -1
- package/src/scss/base/form/_index.scss +1 -1
- package/src/scss/base/form/_variables.scss +1 -1
- package/src/scss/base/link/_defaults.scss +1 -1
- package/src/scss/base/link/_index.scss +1 -1
- package/src/scss/base/link/_variables.scss +1 -1
- package/src/scss/base/table/_defaults.scss +1 -1
- package/src/scss/base/table/_index.scss +1 -1
- package/src/scss/base/table/_variables.scss +1 -1
- package/src/scss/component/_index.scss +1 -1
- package/src/scss/component/accordion/_defaults.scss +1 -1
- package/src/scss/component/accordion/_index.scss +1 -1
- package/src/scss/component/accordion/_variables.scss +1 -1
- package/src/scss/component/alert/_defaults.scss +1 -1
- package/src/scss/component/alert/_index.scss +1 -1
- package/src/scss/component/alert/_variables.scss +1 -1
- package/src/scss/component/card/_defaults.scss +1 -1
- package/src/scss/component/card/_index.scss +1 -1
- package/src/scss/component/card/_variables.scss +1 -1
- package/src/scss/component/carousel/_defaults.scss +1 -1
- package/src/scss/component/carousel/_index.scss +1 -1
- package/src/scss/component/carousel/_variables.scss +1 -1
- package/src/scss/component/input-group/_defaults.scss +1 -1
- package/src/scss/component/input-group/_index.scss +1 -1
- package/src/scss/component/input-group/_variables.scss +1 -1
- package/src/scss/component/list/_defaults.scss +1 -1
- package/src/scss/component/list/_index.scss +1 -1
- package/src/scss/component/list/_variables.scss +1 -1
- package/src/scss/component/menu/_defaults.scss +1 -1
- package/src/scss/component/menu/_index.scss +1 -1
- package/src/scss/component/menu/_variables.scss +1 -1
- package/src/scss/component/navigation/_defaults.scss +1 -1
- package/src/scss/component/navigation/_index.scss +1 -1
- package/src/scss/component/navigation/_variables.scss +1 -1
- package/src/scss/functions/_container.scss +1 -1
- package/src/scss/functions/_important.scss +1 -1
- package/src/scss/functions/_screen.scss +1 -1
- package/src/scss/functions/_theme.scss +1 -1
- package/src/scss/functions/_utility.scss +1 -1
- package/src/scss/layout/_index.scss +1 -1
- package/src/scss/layout/columns/_defaults.scss +1 -1
- package/src/scss/layout/columns/_index.scss +1 -1
- package/src/scss/layout/columns/_variables.scss +1 -1
- package/src/scss/layout/container/_defaults.scss +1 -1
- package/src/scss/layout/container/_index.scss +1 -1
- package/src/scss/layout/container/_variables.scss +1 -1
- package/src/scss/layout/flex-columns/_defaults.scss +1 -1
- package/src/scss/layout/flex-columns/_index.scss +1 -1
- package/src/scss/layout/flex-columns/_variables.scss +1 -1
- package/src/scss/mixins/_animation.scss +1 -1
- package/src/scss/mixins/_container.scss +1 -1
- package/src/scss/mixins/_layer.scss +1 -1
- package/src/scss/mixins/_screen.scss +1 -1
- package/src/scss/mixins/_state.scss +1 -1
- package/src/scss/mixins/_theme.scss +1 -1
- package/src/scss/mixins/_utility.scss +1 -1
- package/src/scss/mixins/_visually-hidden.scss +1 -1
- package/src/scss/state/_index.scss +1 -1
- package/src/scss/state/focus/_defaults.scss +1 -1
- package/src/scss/state/focus/_index.scss +1 -1
- package/src/scss/state/focus/_mixins.scss +1 -1
- package/src/scss/state/focus/_variables.scss +1 -1
- package/src/scss/theme/_index.scss +1 -1
- package/src/scss/theme/color/_defaults.scss +1 -1
- package/src/scss/theme/color/_index.scss +1 -1
- package/src/scss/theme/color/_variables.scss +1 -1
- package/src/scss/theme/typography/_defaults.scss +1 -1
- package/src/scss/theme/typography/_index.scss +1 -1
- package/src/scss/theme/typography/_variables.scss +1 -1
- package/src/scss/utilities/_index.scss +1 -1
- package/src/scss/utilities/_template/_defaults.scss +1 -1
- package/src/scss/utilities/_template/_index.scss +1 -1
- package/src/scss/utilities/_template/_variables.scss +1 -1
- package/src/scss/utilities/alignment/_defaults.scss +1 -1
- package/src/scss/utilities/alignment/_index.scss +1 -1
- package/src/scss/utilities/alignment/_variables.scss +1 -1
- package/src/scss/utilities/background/_defaults.scss +1 -1
- package/src/scss/utilities/background/_index.scss +1 -1
- package/src/scss/utilities/background/_variables.scss +1 -1
- package/src/scss/utilities/border/_defaults.scss +1 -1
- package/src/scss/utilities/border/_index.scss +1 -1
- package/src/scss/utilities/border/_variables.scss +1 -1
- package/src/scss/utilities/color/_defaults.scss +1 -1
- package/src/scss/utilities/color/_index.scss +1 -1
- package/src/scss/utilities/color/_variables.scss +1 -1
- package/src/scss/utilities/container/_defaults.scss +1 -1
- package/src/scss/utilities/container/_index.scss +1 -1
- package/src/scss/utilities/container/_variables.scss +1 -1
- package/src/scss/utilities/display/_defaults.scss +1 -1
- package/src/scss/utilities/display/_index.scss +1 -1
- package/src/scss/utilities/display/_variables.scss +1 -1
- package/src/scss/utilities/flex/_defaults.scss +1 -1
- package/src/scss/utilities/flex/_index.scss +1 -1
- package/src/scss/utilities/flex/_variables.scss +1 -1
- package/src/scss/utilities/gradient/_defaults.scss +1 -1
- package/src/scss/utilities/gradient/_index.scss +1 -1
- package/src/scss/utilities/gradient/_variables.scss +1 -1
- package/src/scss/utilities/height/_defaults.scss +1 -1
- package/src/scss/utilities/height/_index.scss +1 -1
- package/src/scss/utilities/height/_variables.scss +1 -1
- package/src/scss/utilities/inset/_defaults.scss +1 -1
- package/src/scss/utilities/inset/_index.scss +1 -1
- package/src/scss/utilities/inset/_variables.scss +1 -1
- package/src/scss/utilities/justification/_defaults.scss +1 -1
- package/src/scss/utilities/justification/_index.scss +1 -1
- package/src/scss/utilities/justification/_variables.scss +1 -1
- package/src/scss/utilities/list/_defaults.scss +1 -1
- package/src/scss/utilities/list/_index.scss +1 -1
- package/src/scss/utilities/list/_variables.scss +1 -1
- package/src/scss/utilities/order/_defaults.scss +1 -1
- package/src/scss/utilities/order/_index.scss +1 -1
- package/src/scss/utilities/order/_variables.scss +1 -1
- package/src/scss/utilities/position/_defaults.scss +1 -1
- package/src/scss/utilities/position/_index.scss +1 -1
- package/src/scss/utilities/position/_variables.scss +1 -1
- package/src/scss/utilities/ratio/_defaults.scss +1 -1
- package/src/scss/utilities/ratio/_index.scss +1 -1
- package/src/scss/utilities/ratio/_variables.scss +1 -1
- package/src/scss/utilities/spacing/_defaults.scss +1 -1
- package/src/scss/utilities/spacing/_index.scss +1 -1
- package/src/scss/utilities/spacing/_variables.scss +1 -1
- package/src/scss/utilities/typography/_defaults.scss +1 -1
- package/src/scss/utilities/typography/_index.scss +1 -1
- package/src/scss/utilities/typography/_variables.scss +1 -1
- package/src/scss/utilities/visibility/_defaults.scss +1 -1
- package/src/scss/utilities/visibility/_index.scss +1 -1
- package/src/scss/utilities/visibility/_variables.scss +1 -1
- package/src/scss/utilities/visually-hidden/_defaults.scss +1 -1
- package/src/scss/utilities/visually-hidden/_index.scss +1 -1
- package/src/scss/utilities/visually-hidden/_variables.scss +1 -1
- package/src/scss/utilities/width/_defaults.scss +1 -1
- package/src/scss/utilities/width/_index.scss +1 -1
- package/src/scss/utilities/width/_variables.scss +1 -1
- package/src/scss/utilities/z-index/_defaults.scss +1 -1
- package/src/scss/utilities/z-index/_index.scss +1 -1
- package/src/scss/utilities/z-index/_variables.scss +1 -1
- package/README.md +0 -3
- package/dist/js/accordion.js +0 -5
- package/dist/js/accordion.js.map +0 -1
- package/dist/js/alert.js +0 -5
- package/dist/js/alert.js.map +0 -1
- package/dist/js/carousel.js +0 -5
- package/dist/js/carousel.js.map +0 -1
- package/dist/js/component/accordion.cjs.js +0 -5
- package/dist/js/component/accordion.cjs.js.map +0 -1
- package/dist/js/component/accordion.es.js +0 -5
- package/dist/js/component/accordion.es.js.map +0 -1
- package/dist/js/component/accordion.iife.js +0 -5
- package/dist/js/component/accordion.iife.js.map +0 -1
- package/dist/js/component/alert.cjs.js +0 -5
- package/dist/js/component/alert.cjs.js.map +0 -1
- package/dist/js/component/alert.es.js +0 -5
- package/dist/js/component/alert.es.js.map +0 -1
- package/dist/js/component/alert.iife.js +0 -5
- package/dist/js/component/alert.iife.js.map +0 -1
- package/dist/js/component/carousel.cjs.js +0 -5
- package/dist/js/component/carousel.cjs.js.map +0 -1
- package/dist/js/component/carousel.es.js +0 -5
- package/dist/js/component/carousel.es.js.map +0 -1
- package/dist/js/component/carousel.iife.js +0 -5
- package/dist/js/component/carousel.iife.js.map +0 -1
- package/dist/js/generator/accordion.cjs.js +0 -5
- package/dist/js/generator/accordion.cjs.js.map +0 -1
- package/dist/js/generator/accordion.es.js +0 -5
- package/dist/js/generator/accordion.es.js.map +0 -1
- package/dist/js/generator/accordion.iife.js +0 -5
- package/dist/js/generator/accordion.iife.js.map +0 -1
- package/dist/js/generator/alert.cjs.js +0 -5
- package/dist/js/generator/alert.cjs.js.map +0 -1
- package/dist/js/generator/alert.es.js +0 -5
- package/dist/js/generator/alert.es.js.map +0 -1
- package/dist/js/generator/alert.iife.js +0 -5
- package/dist/js/generator/alert.iife.js.map +0 -1
- package/dist/js/generator/carousel.cjs.js +0 -5
- package/dist/js/generator/carousel.cjs.js.map +0 -1
- package/dist/js/generator/carousel.es.js +0 -5
- package/dist/js/generator/carousel.es.js.map +0 -1
- package/dist/js/generator/carousel.iife.js +0 -5
- package/dist/js/generator/carousel.iife.js.map +0 -1
- package/dist/js/generator/navigation.cjs.js +0 -3
- package/dist/js/generator/navigation.cjs.js.map +0 -1
- package/dist/js/generator/navigation.es.js +0 -3
- package/dist/js/generator/navigation.es.js.map +0 -1
- package/dist/js/generator/navigation.iife.js +0 -3
- package/dist/js/generator/navigation.iife.js.map +0 -1
- package/dist/js/graupl.js +0 -9
- package/dist/js/graupl.js.map +0 -1
- package/dist/js/navigation.js +0 -3
- package/dist/js/navigation.js.map +0 -1
- package/src/js/accordion/generator.js +0 -27
- package/src/js/alert/generator.js +0 -29
- package/src/js/carousel/generator.js +0 -27
- package/src/js/main.js +0 -11
- package/src/js/navigation/generator.js +0 -49
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"carousel.cjs.js","names":["addClass","className","element","length","classList","add","removeClass","remove","selectAllFocusableElements","context","document","querySelector","elements","Array","from","querySelectorAll","tabbableElements","filter","check","getAttribute","selectFirstFocusableElement","selectLastFocusableElement","selectNextFocusableElement","index","indexOf","selectPreviousFocusableElement","keyPress","event","key","keyCode","keys","Enter","Space","Escape","ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End","Tab","Object","find","preventEvent","preventDefault","stopPropagation","isValidInstance","contructor","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","isValidType","initializeStorage","type","window","Graupl","getStorage","setStorage","data","clearStorage","pushToStorage","key","value","getFromStorage","removeFromStorage","addClass","removeClass","preventEvent","keyPress","storage","isQuerySelector","isTag","isValidClassList","isValidInstance","isValidType","Carousel","_dom","carousel","carouselItems","carouselItemContainer","carouselControls","carouselControlContainer","carouselTabs","carouselTabContainer","autoplay","next","previous","_selectors","_activeClass","_previousClass","_nextClass","_playClass","_pauseClass","_currentItem","_autoplay","_transitionDelay","_transitionDuration","_playText","_pauseText","_currentAction","_autoplayInterval","_prefix","_key","_errors","constructor","carouselElement","carouselItemSelector","carouselItemContainerSelector","carouselControlSelector","carouselControlContainerSelector","carouselTabSelector","carouselTabContainerSelector","autoplaySelector","nextSelector","previousSelector","activeClass","previousClass","nextClass","playClass","pauseClass","transitionDelay","transitionDuration","playText","pauseText","prefix","key","initialize","_validate","Error","errors","join","_generateKey","_setDOMElements","_setIds","_setAriaAttributes","activateFirstItem","_handleAutoplay","_handleFocus","_handleClick","_handleHover","_handleKeydown","_handleKeyup","_setTransitionDuration","initializeStorage","pushToStorage","dom","id","error","console","selectors","currentItem","currentCarouselItem","currentCarouselTab","currentAction","value","length","tabs","querySelectorAll","carouselTab","forEach","item","index","setAttribute","check","htmlElementChecks","HTMLElement","push","message","querySelectorChecks","carouselItemsSelector","carouselControlsSelector","carouselTabsSelector","autoplayChecks","delayCheck","durationCheck","activeClassChecks","previousClassChecks","nextClassChecks","playClassChecks","pauseClassChecks","playTextChecks","pauseTextChecks","prefixChecks","_setDOMElementType","elementType","base","overwrite","Array","isArray","domElements","from","filteredElements","filter","parentElement","domElement","querySelector","_resetDOMElementType","regenerate","Math","random","toString","replace","substring","tab","getAttribute","_setInterval","_clearInterval","setInterval","activateNextItem","clearInterval","addEventListener","activatePreviousItem","toggleAutoplay","activateItem","control","event","style","setProperty","activateCurrentItem","deactivateCurrentItem","currentIndex","dataset","grauplAction","requestAnimationFrame","setTimeout","activateLastItem"],"sources":["../../../src/js/domHelpers.js","../../../src/js/eventHandlers.js","../../../src/js/validate.js","../../../src/js/storage.js","../../../src/js/carousel/Carousel.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 * @return {HTMLElement[]}\n */\nexport function selectAllFocusableElements(context = document) {\n const querySelector =\n \"a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),[tabindex]\";\n const elements = Array.from(context.querySelectorAll(querySelector));\n\n const tabbableElements = elements.filter((element) => {\n let check = true;\n\n if (element.getAttribute(\"tabindex\") === \"-1\") check = false;\n\n return check;\n });\n\n return tabbableElements;\n}\n\n/**\n * Select the first focusable element within a given context.\n *\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @return {HTMLElement|boolean} - The first focusable element or false if none found.\n */\nexport function selectFirstFocusableElement(context = document) {\n const tabbableElements = selectAllFocusableElements(context);\n\n return tabbableElements[0] || false;\n}\n\n/**\n * Select the last focusable element within a given context.\n *\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @return {HTMLElement|boolean} - The last focusable element or false if none found.\n */\nexport function selectLastFocusableElement(context = document) {\n const tabbableElements = selectAllFocusableElements(context);\n\n return tabbableElements[tabbableElements.length - 1] || false;\n}\n\n/**\n * Select the next focusable element relative to the given element within a context.\n *\n * @param {HTMLElement} element - The reference element.\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @return {HTMLElement|boolean} - The next focusable element or false if none found.\n */\nexport function selectNextFocusableElement(element, context = document) {\n const tabbableElements = selectAllFocusableElements(context);\n const index = tabbableElements.indexOf(element);\n\n return index === tabbableElements.length - 1\n ? false\n : tabbableElements[index + 1];\n}\n\n/**\n * Select the previous focusable element relative to the given element within a context.\n *\n * @param {HTMLElement} element - The reference element.\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @return {HTMLElement|boolean} - The previous focusable element or false if none found.\n */\nexport function selectPreviousFocusableElement(element, context = document) {\n const tabbableElements = selectAllFocusableElements(context);\n const index = tabbableElements.indexOf(element);\n\n return index === 0 ? false : tabbableElements[index - 1];\n}\n","/**\n * 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 * Check to see if the provided elements have a specific contructor.\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} contructor - 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(contructor, 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 contructor)) {\n const elementType = typeof elements[key];\n throw new TypeError(\n `${key} must be an instance of ${contructor.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 * @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 carousel class.\n */\n\nimport { addClass, removeClass } from \"../domHelpers.js\";\nimport { preventEvent, keyPress } from \"../eventHandlers.js\";\nimport storage from \"../storage.js\";\nimport {\n isQuerySelector,\n isTag,\n isValidClassList,\n isValidInstance,\n isValidType,\n} from \"../validate.js\";\n\nclass Carousel {\n /**\n * The DOM elements within the carousel.\n *\n * @protected\n *\n * @type {Object<HTMLElement, HTMLElement[]>}\n *\n * @property {HTMLElement} carousel - The carousel element.\n * @property {HTMLElement[]} carouselItems - The carousel items.\n * @property {HTMLElement} carouselItemContainer - The carousel item container.\n * @property {HTMLElement[]} carouselControls - The carousel controls.\n * @property {HTMLElement} carouselControlContainer - The carousel control container.\n * @property {HTMLElement[]} carouselTabs - The carousel tabs.\n * @property {HTMLElement} carouselTabContainer - The carousel tab container.\n * @property {HTMLElement} autoplay - The autoplay button.\n * @property {HTMLElement} next - The next button.\n * @property {HTMLElement} previous - The previous button.\n */\n _dom = {\n carousel: null,\n carouselItems: [],\n carouselItemContainer: null,\n carouselControls: [],\n carouselControlContainer: null,\n carouselTabs: [],\n carouselTabContainer: null,\n autoplay: null,\n next: null,\n previous: null,\n };\n\n /**\n * The query selectors used by the carousel to populate the dom.\n *\n * @protected\n *\n * @type {Object<string>}\n *\n * @property {string} carouselItems - The query selector string for carousel items.\n * @property {string} carouselItemContainer - The query selector string for the carousel item container.\n * @property {string} carouselControls - The query selector string for carousel controls.\n * @property {string} carouselControlContainer - The query selector string for carousel control container.\n * @property {string} carouselTabs - The query selector string for the carousel tabs.\n * @property {string} carouselTabContainer - The query selector string for the carousel tab container.\n * @property {string} autoplay - The query selector string for the autoplay button.\n * @property {string} next - The query selector string for the next button.\n * @property {string} previous - The query selector string for the previous button.\n */\n _selectors = {\n carouselItems: \"\",\n carouselItemContainer: \"\",\n carouselControls: \"\",\n carouselControlContainer: \"\",\n carouselTabs: \"\",\n carouselTabContainer: \"\",\n autoplay: \"\",\n next: \"\",\n previous: \"\",\n };\n\n /**\n * The class(es) to apply when a carousel item is active.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _activeClass = \"active\";\n\n /**\n * The class(es) to apply to a carousel item that is the previously active item.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _previousClass = \"previous\";\n\n /**\n * The class(es) to apply to a carousel item that is the next active item.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _nextClass = \"next\";\n\n /**\n * The class(es) to apply to the autoplay button when the carousel is paused.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _playClass = \"play\";\n\n /**\n * The class(es) to apply to the autoplay button when the carousel is playing.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _pauseClass = \"pause\";\n\n /**\n * The index of the currently active carousel item.\n *\n * @protected\n *\n * @type {number}\n */\n _currentItem = 0;\n\n /**\n * A flag to indicate if the carousel is currently playing.\n *\n * @protected\n *\n * @type {boolean}\n */\n _autoplay = true;\n\n /**\n * A variable to delay transition slides in milliseconds.\n *\n * @protected\n *\n * @type {number}\n */\n _transitionDelay = 10000;\n\n /**\n * The duration time (in milliseconds) for the transition between carousel items.\n *\n * @protected\n *\n * @type {number}\n */\n _transitionDuration = 500;\n\n /**\n * The label for the autoplay button when the carousel is paused.\n *\n * @protected\n *\n * @type {string}\n */\n _playText = \"Play\";\n\n /**\n * The label for the autoplay button when the carousel is playing.\n *\n * @protected\n *\n * @type {string}\n */\n _pauseText = \"Pause\";\n\n /**\n * The current action being performed by the carousel.\n *\n * @protected\n *\n * @type {string}\n */\n _currentAction = \"next\";\n\n /**\n * The stored interval callback for autoplaying the carousel.\n *\n * @protected\n *\n * @type {?Function}\n */\n _autoplayInterval = null;\n\n /**\n * The prefix to use for CSS custom properties.\n *\n * @protected\n *\n * @type {string}\n */\n _prefix = \"graupl-\";\n\n /**\n * The key used to generate IDs throughout the carousel.\n *\n * @protected\n *\n * @type {string}\n */\n _key = \"\";\n\n /**\n * An array of error messages generated by the carousel.\n *\n * @protected\n *\n * @type {string[]}\n */\n _errors = [];\n\n /**\n * Contructs a new `Carousel`.\n *\n * @param {object} options - The options for the generated carousel.\n * @param {HTMLElement} options.carouselElement - The carousel element in the DOM.\n * @param {string} [options.carouselItemSelector = .carousel-item] - The query selector string for carousel items.\n * @param {string} [options.carouselItemContainerSelector = .carousel-item-container] - The query selector string for the carousel item container.\n * @param {string} [options.carouselControlSelector = .carousel-control] - The query selector string for carousel controls.\n * @param {string} [options.carouselControlContainerSelector = .carousel-control-container] - The query selector string for carousel control container.\n * @param {string} [options.carouselTabSelector = .carousel-tab] - The query selector string for carousel tabs.\n * @param {string} [options.carouselTabContainerSelector = .carousel-tab-container] - The query selector string for the carousel tab container.\n * @param {string} [options.autoplaySelector = .autoplay] - The query selector string for the autoplay button.\n * @param {string} [options.nextSelector = .next] - The query selector string for the next button.\n * @param {string} [options.previousSelector = .previous] - The query selector string for the previous button.\n * @param {?(string|string[])} [options.activeClass = active] - The class(es) to apply when a carousel item is active.\n * @param {?(string|string[])} [options.previousClass = previous] - The class(es) to apply to a carousel item that is the previously active item.\n * @param {?(string|string[])} [options.nextClass = next] - The class(es) to apply to a carousel item that is the next active item.\n * @param {?(string|string[])} [options.playClass = play] - The class(es) to apply to the autoplay button when the carousel is paused.\n * @param {?(string|string[])} [options.pauseClass = pause] - The class(es) to apply to the autoplay button when the carousel is playing.\n * @param {boolean} [options.autoplay = true] - A flag to indicate if the carousel should autoplay.\n * @param {number} [options.transitionDelay = 10000] - A flag to initialize the carousel immediately upon creation.\n * @param {number} [options.transitionDuration = 500] - The duration time (in milliseconds) for the transition between carousel items.\n * @param {?string} [options.playText = Play] - The text to use for the play button.\n * @param {?string} [options.pauseText = Pause] - The text to use for the pause button.\n * @param {?string} [options.prefix = graupl-] - The prefix to use for CSS custom properties.\n * @param {?string} [options.key = null] - The key used to generate IDs throughout the carousel.\n * @param {boolean} [options.initialize = false] - A flag to initialize the carousel immediately upon creation.\n */\n constructor({\n carouselElement,\n carouselItemSelector = \".carousel-item\",\n carouselItemContainerSelector = \".carousel-item-container\",\n carouselControlSelector = \".carousel-control\",\n carouselControlContainerSelector = \".carousel-control-container\",\n carouselTabSelector = \".carousel-tab\",\n carouselTabContainerSelector = \".carousel-tab-container\",\n autoplaySelector = \".autoplay\",\n nextSelector = \".next\",\n previousSelector = \".previous\",\n activeClass = \"active\",\n previousClass = \"previous\",\n nextClass = \"next\",\n playClass = \"play\",\n pauseClass = \"pause\",\n autoplay = true,\n transitionDelay = 10000,\n transitionDuration = 500,\n playText = \"Play\",\n pauseText = \"Pause\",\n prefix = \"graupl-\",\n key = null,\n initialize = false,\n }) {\n // Set DOM elements.\n this._dom.carousel = carouselElement;\n\n // Set query selectors.\n this._selectors.carouselItems = carouselItemSelector;\n this._selectors.carouselItemContainer = carouselItemContainerSelector;\n this._selectors.carouselControls = carouselControlSelector;\n this._selectors.carouselControlContainer = carouselControlContainerSelector;\n this._selectors.carouselTabs = carouselTabSelector;\n this._selectors.carouselTabContainer = carouselTabContainerSelector;\n this._selectors.autoplay = autoplaySelector;\n this._selectors.next = nextSelector;\n this._selectors.previous = previousSelector;\n\n // Set class names.\n this._activeClass = activeClass || \"\";\n this._previousClass = previousClass || \"\";\n this._nextClass = nextClass || \"\";\n this._playClass = playClass || \"\";\n this._pauseClass = pauseClass || \"\";\n\n // Set flags.\n this._autoplay = autoplay;\n\n // Set transition options.\n this._transitionDelay = transitionDelay;\n this._transitionDuration = transitionDuration;\n\n // Set labels.\n this._playText = playText || \"\";\n this._pauseText = pauseText || \"\";\n\n // Set prefix.\n this._prefix = prefix || \"\";\n\n // Set the key.\n this._key = key || \"\";\n\n if (initialize) {\n this.initialize();\n }\n }\n\n /**\n * Initializes the carousel.\n */\n initialize() {\n try {\n if (!this._validate()) {\n throw new Error(\n `Graupl Carousel: cannot initialize carousel. The following errors have been found:\\n - ${this.errors.join(\n \"\\n - \"\n )}`\n );\n }\n\n // Set up the DOM.\n this._generateKey();\n this._setDOMElements();\n this._setIds();\n this._setAriaAttributes();\n\n // Activate the first item.\n this.activateFirstItem();\n\n // Handle events.\n this._handleAutoplay();\n this._handleFocus();\n this._handleClick();\n this._handleHover();\n this._handleKeydown();\n this._handleKeyup();\n\n // Set the custom props.\n this._setTransitionDuration();\n\n // Set up the storage.\n storage.initializeStorage(\"carousels\");\n storage.pushToStorage(\"carousels\", this.dom.carousel.id, this);\n } catch (error) {\n console.error(error);\n }\n }\n\n /**\n * The HTML elements for the carousel in the DOM.\n *\n * @readonly\n *\n * @type {Object<HTMLElement>}\n *\n * @see _dom\n */\n get dom() {\n return this._dom;\n }\n\n /**\n * The query selectors used by the carousel to populate the dom.\n *\n * @readonly\n *\n * @type {Object<string>}\n *\n * @see _selectors\n */\n get selectors() {\n return this._selectors;\n }\n\n /**\n * The class(es) to apply when a carousel item is active.\n *\n * @type {string|string[]}\n *\n * @see _activeClass\n */\n get activeClass() {\n return this._activeClass;\n }\n\n /**\n * The class(es) to apply to a carousel item that is the next active item.\n *\n * @type {string|string[]}\n *\n * @see _previousClass\n */\n get previousClass() {\n return this._previousClass;\n }\n\n /**\n * The class(es) to apply to a carousel item that is the next active item.\n *\n * @type {string|string[]}\n *\n * @see _nextClass\n */\n get nextClass() {\n return this._nextClass;\n }\n\n /**\n * The class(es) to apply to the autoplay button when the carousel is paused.\n *\n * @type {string|string[]}\n *\n * @see _playClass\n */\n get playClass() {\n return this._playClass;\n }\n\n /**\n * The class(es) to apply to the autoplay button when the carousel is playing.\n *\n * @type {string|string[]}\n *\n * @see _pauseClass\n */\n get pauseClass() {\n return this._pauseClass;\n }\n\n /**\n * The index of the currently active carousel item.\n *\n * @type {number}\n *\n * @see _currentItem\n */\n get currentItem() {\n return this._currentItem;\n }\n\n /**\n * The currently active carousel item.\n *\n * @readonly\n *\n * @type {HTMLElement}\n */\n get currentCarouselItem() {\n return this.dom.carouselItems[this.currentItem];\n }\n\n /**\n * The currently active carousel tab.\n *\n * @readonly\n *\n * @type {HTMLElement}\n */\n get currentCarouselTab() {\n return this.dom.carouselTabs[this.currentItem];\n }\n\n /**\n * A flag to indicate if the carousel is currently playing.\n *\n * @type {boolean}\n *\n * @see _autoplay\n */\n get autoplay() {\n return this._autoplay;\n }\n\n /**\n * The delay in milliseconds before transitioning slides.\n *\n * @type {number}\n *\n * @see _transitionDelay\n */\n get transitionDelay() {\n return this._transitionDelay;\n }\n\n /**\n * The duration time (in milliseconds) for the transition between carousel items.\n *\n * @type {number}\n *\n * @see _transitionDuration\n */\n get transitionDuration() {\n return this._transitionDuration;\n }\n\n /**\n * The label for the autoplay button when the carousel is paused.\n *\n * @type {string}\n *\n * @see _playText\n */\n get playText() {\n return this._playText;\n }\n\n /**\n * The label for the autoplay button when the carousel is playing.\n *\n * @type {string}\n *\n * @see _pauseText\n */\n get pauseText() {\n return this._pauseText;\n }\n\n /**\n * The prefix to use for CSS custom properties.\n *\n * @type {string}\n *\n * @see _prefix\n */\n get prefix() {\n return this._prefix;\n }\n\n /**\n * The key used to generate IDs throughout the accordion.\n *\n * @type {string}\n *\n * @see _key\n */\n get key() {\n return this._key;\n }\n\n /**\n * The current action being performed by the carousel.\n *\n * @type {string}\n *\n * @see _currentAction\n */\n get currentAction() {\n return this._currentAction;\n }\n\n /**\n * An array of error messages generated by the carousel.\n *\n * @readonly\n *\n * @type {string[]}\n *\n * @see _errors\n */\n get errors() {\n return this._errors;\n }\n\n set currentItem(value) {\n isValidType(\"number\", { value });\n\n if (value === this.currentItem) {\n return;\n }\n\n if (value < 0) {\n this._currentItem = 0;\n } else if (value >= this.dom.carouselItems.length) {\n this._currentItem = this.dom.carouselItems.length - 1;\n } else {\n this._currentItem = value;\n }\n\n // Keep the aria selected in sync with the current item.\n const tabs = this._dom.carousel.querySelectorAll(\n this.selectors.carouselTab\n );\n if (tabs) {\n this.dom.carouselItems.forEach((item, index) => {\n item.setAttribute(\"aria-selected\", index === this._currentItem);\n });\n }\n }\n\n set autoplay(value) {\n isValidType(\"boolean\", { value });\n\n if (this._autoplay !== value) {\n this._autoplay = value;\n }\n }\n\n set activeClass(value) {\n isValidClassList({ activeClass: value });\n\n if (this._activeClass !== value) {\n this._activeClass = value;\n }\n }\n\n set previousClass(value) {\n isValidClassList({ previousClass: value });\n\n if (this._previousClass !== value) {\n this._previousClass = value;\n }\n }\n\n set nextClass(value) {\n isValidClassList({ nextClass: value });\n\n if (this._nextClass !== value) {\n this._nextClass = value;\n }\n }\n\n set playClass(value) {\n isValidClassList({ playClass: value });\n\n if (this._playClass !== value) {\n this._playClass = value;\n }\n }\n\n set pauseClass(value) {\n isValidClassList({ pauseClass: value });\n\n if (this._pauseClass !== value) {\n this._pauseClass = value;\n }\n }\n\n set transitionDelay(value) {\n isValidType(\"number\", { value });\n\n if (value !== this.transitionDelay && value >= 0) {\n this._currentItem = value;\n }\n }\n\n set transitionDuration(value) {\n isValidType(\"number\", { value });\n\n if (this._transitionDuration !== value && value >= 0) {\n this._transitionDuration = value;\n this._setTransitionDuration();\n }\n }\n\n set playText(value) {\n isValidType(\"string\", { value });\n\n if (this._playText !== value) {\n this._playText = value;\n }\n }\n\n set pauseText(value) {\n isValidType(\"string\", { value });\n\n if (this._pauseText !== value) {\n this._pauseText = value;\n }\n }\n\n set prefix(value) {\n isValidType(\"string\", { value });\n\n if (this._prefix !== value) {\n this._prefix = value;\n }\n }\n\n set key(value) {\n isValidType(\"string\", { value });\n\n if (this._key !== value) {\n this._key = value;\n }\n }\n\n /**\n * Validates all aspects of the carousel to ensure proper functionality.\n *\n * @protected\n *\n * @return {boolean} - The results of the validation.\n */\n _validate() {\n let check = true;\n\n // HTML element checks.\n const htmlElementChecks = isValidInstance(HTMLElement, {\n carousel: this.dom.carousel,\n });\n\n if (!htmlElementChecks) {\n this._errors.push(htmlElementChecks.message);\n check = false;\n }\n\n // Query selector checks.\n const querySelectorChecks = isQuerySelector({\n carouselItemsSelector: this._selectors.carouselItems,\n carouselItemContainerSelector: this._selectors.carouselItemContainer,\n carouselControlsSelector: this._selectors.carouselControls,\n carouselControlContainerSelector:\n this._selectors.carouselControlContainer,\n carouselTabsSelector: this._selectors.carouselTabs,\n carouselTabContainerSelector: this._selectors.carouselTabContainer,\n autoplaySelector: this._selectors.autoplay,\n nextSelector: this._selectors.next,\n previousSelector: this._selectors.previous,\n });\n\n if (!querySelectorChecks) {\n this._errors.push(querySelectorChecks.message);\n check = false;\n }\n\n // Autoplay checks.\n const autoplayChecks = isValidType(\"boolean\", { autoplay: this.autoplay });\n\n if (!autoplayChecks) {\n this._errors.push(autoplayChecks.message);\n check = false;\n }\n\n // Check delay is a valid value.\n const delayCheck = isValidType(\"number\", {\n transitionDelay: this._transitionDelay,\n });\n\n if (!delayCheck) {\n this._errors.push(delayCheck.message);\n check = false;\n }\n\n // Check duration is a valid value.\n const durationCheck = isValidType(\"number\", {\n transitionDuration: this._transitionDuration,\n });\n\n if (!durationCheck) {\n this._errors.push(durationCheck.message);\n check = false;\n }\n\n // Active class checks.\n if (this._activeClass !== \"\") {\n const activeClassChecks = isValidClassList({\n activeClass: this._activeClass,\n });\n\n if (!activeClassChecks) {\n this._errors.push(activeClassChecks.message);\n check = false;\n }\n }\n\n // Previous class checks.\n if (this._previousClass !== \"\") {\n const previousClassChecks = isValidClassList({\n previousClass: this._previousClass,\n });\n\n if (!previousClassChecks) {\n this._errors.push(previousClassChecks.message);\n check = false;\n }\n }\n\n // Next class checks.\n if (this._nextClass !== \"\") {\n const nextClassChecks = isValidClassList({\n nextClass: this._nextClass,\n });\n\n if (!nextClassChecks) {\n this._errors.push(nextClassChecks.message);\n check = false;\n }\n }\n\n // Play class checks.\n if (this._playClass !== \"\") {\n const playClassChecks = isValidClassList({\n playClass: this._playClass,\n });\n\n if (!playClassChecks) {\n this._errors.push(playClassChecks.message);\n check = false;\n }\n }\n\n // Pause class checks.\n if (this._pauseClass !== \"\") {\n const pauseClassChecks = isValidClassList({\n pauseClass: this._pauseClass,\n });\n\n if (!pauseClassChecks) {\n this._errors.push(pauseClassChecks.message);\n check = false;\n }\n }\n\n // Play text checks.\n if (this._playText !== \"\") {\n const playTextChecks = isValidType(\"string\", {\n playText: this._playText,\n });\n\n if (!playTextChecks) {\n this._errors.push(playTextChecks.message);\n check = false;\n }\n }\n\n // Pause text checks.\n if (this._pauseText !== \"\") {\n const pauseTextChecks = isValidType(\"string\", {\n pauseText: this._pauseText,\n });\n\n if (!pauseTextChecks) {\n this._errors.push(pauseTextChecks.message);\n check = false;\n }\n }\n\n // Prefix checks.\n const prefixChecks = isValidType(\"string\", { prefix: this._prefix });\n\n if (!prefixChecks) {\n this._errors.push(prefixChecks.message);\n check = false;\n }\n\n return check;\n }\n\n /**\n * Sets DOM elements within the carousel.\n *\n * The carousel element _cannot_ be set through this method.\n *\n * @protected\n *\n * @param {string} elementType - The type of element to populate.\n * @param {HTMLElement} [base = this.dom.carousel] - The element used as the base for the querySelector.\n * @param {boolean} [overwrite = true] - A flag to set if the existing elements will be overwritten.\n */\n _setDOMElementType(elementType, base = this.dom.carousel, overwrite = true) {\n if (typeof this.selectors[elementType] === \"string\") {\n if (elementType === \"carousel\") {\n throw new Error(\n `Graupl Carousel: \"${elementType}\" element cannot be set through _setDOMElementType.`\n );\n }\n\n if (base !== this.dom.carousel) isValidInstance(HTMLElement, { base });\n\n if (Array.isArray(this._dom[elementType])) {\n // Get all the elements matching the selector in the base.\n const domElements = Array.from(\n base.querySelectorAll(this.selectors[elementType])\n );\n\n // Filter the elements so only direct children of the base are kept.\n const filteredElements = domElements.filter(\n (item) => item.parentElement === base\n );\n\n if (overwrite) {\n this._dom[elementType] = filteredElements;\n } else {\n this._dom[elementType] = [\n ...this._dom[elementType],\n ...filteredElements,\n ];\n }\n } else {\n // Get the single element matching the selector in the base.\n const domElement = base.querySelector(this.selectors[elementType]);\n\n // Ensure the element is a direct child of the base.\n if (domElement && domElement.parentElement !== base) {\n return;\n }\n\n if (overwrite) {\n this._dom[elementType] = domElement;\n }\n }\n } else {\n throw new Error(\n `Graupl Carousel: \"${elementType}\" is not a valid element type within the carousel.`\n );\n }\n }\n\n /**\n * Resets DOM elements within the menu.\n *\n * The carousel element _cannot_ be reset through this method.\n *\n * @protected\n *\n * @param {string} elementType - The type of element to clear.\n */\n _resetDOMElementType(elementType) {\n if (typeof this.selectors[elementType] === \"string\") {\n if (elementType === \"carousel\") {\n throw new Error(\n `Graupl Carousel: \"${elementType}\" element cannot be reset through _resetDOMElementType.`\n );\n }\n\n if (Array.isArray(this._dom[elementType])) {\n this._dom[elementType] = [];\n } else {\n this._dom[elementType] = null;\n }\n } else {\n throw new Error(\n `Graupl Carousel: \"${elementType}\" is not a valid element type within the carousel.`\n );\n }\n }\n\n /**\n * Sets all DOM elements within the carousel.\n *\n * Utilizes _setDOMElementType and _resetDOMElementType.\n *\n * @protected\n */\n _setDOMElements() {\n this._setDOMElementType(\"carouselItemContainer\");\n this._setDOMElementType(\"carouselControlContainer\");\n this._setDOMElementType(\"carouselTabContainer\");\n\n if (this.dom.carouselItemContainer) {\n this._setDOMElementType(\"carouselItems\", this.dom.carouselItemContainer);\n }\n if (this.dom.carouselControlContainer) {\n this._setDOMElementType(\n \"carouselControls\",\n this.dom.carouselControlContainer\n );\n this._setDOMElementType(\"autoplay\", this.dom.carouselControlContainer);\n this._setDOMElementType(\"next\", this.dom.carouselControlContainer);\n this._setDOMElementType(\"previous\", this.dom.carouselControlContainer);\n }\n\n if (this._dom.carouselTabContainer) {\n this._setDOMElementType(\"carouselTabs\", this.dom.carouselTabContainer);\n }\n }\n\n /**\n * Generates a key for the carousel.\n *\n * @param {boolean} [regenerate = false] - A flag to determine if the key should be regenerated.\n */\n _generateKey(regenerate = false) {\n if (this.key === \"\" || regenerate) {\n this.key = Math.random()\n .toString(36)\n .replace(/[^a-z]+/g, \"\")\n .substring(0, 10);\n }\n }\n\n /**\n * Sets the IDs of the carousel and it's children if they do not already exist.\n *\n * The generated IDs use the key and follow the format:\n * - carousel: `carousel-${key}`\n * - carousel items: `carousel-item-${key}-${index}`\n * - carousel tabs: `carousel-tab-${key}-${index}`\n */\n _setIds() {\n this.dom.carousel.id = this.dom.carousel.id || `carousel-${this.key}`;\n\n this.dom.carouselItems.forEach((item, index) => {\n item.id = item.id || `carousel-item-${this.key}-${index}`;\n });\n\n this.dom.carouselTabs.forEach((tab, index) => {\n tab.id = tab.id || `carousel-tab-${this.key}-${index}`;\n });\n }\n\n /**\n * Sets the aria attributes for the carousel.\n */\n _setAriaAttributes() {\n // Make sure the carousel has a proper role.\n // Sections and role=\"region\" are acceptable in certain cases, so\n // we only need to fallback to role=\"group\" if neither of those are present.\n if (\n !isTag(\"section\", { carousel: this.dom.carousel }) &&\n !this.dom.carousel.getAttribute(\"role\") !== \"region\"\n ) {\n this.dom.carousel.setAttribute(\"role\", \"group\");\n }\n\n // Set the role description for the carousel.\n this._dom.carousel.setAttribute(\"aria-roledescription\", \"carousel\");\n\n if (this.dom.carouselTabContainer) {\n this.dom.carouselTabContainer.setAttribute(\"role\", \"tablist\");\n }\n\n this.dom.carouselTabs.forEach((tab, index) => {\n if (!isTag(\"button\", { tab: tab })) {\n tab.setAttribute(\"role\", \"button\");\n }\n\n tab.setAttribute(\"aria-selected\", index === 0);\n tab.setAttribute(\"aria-controls\", this.dom.carouselItems[index].id);\n });\n }\n\n /**\n * Sets the interval for autoplaying the carousel.\n *\n * @protected\n */\n _setInterval() {\n this._clearInterval();\n\n this._autoplayInterval = setInterval(() => {\n this.activateNextItem();\n }, this.transitionDelay);\n }\n\n /**\n * Clears the interval for autoplaying the carousel.\n *\n * @protected\n */\n _clearInterval() {\n clearInterval(this._autoplayInterval);\n }\n\n /**\n * Handles the autoplay functionality of the carousel.\n *\n * - Adds the appropriate class to the autoplay button.\n * - Removes the appropriate class from the autoplay button.\n * - Sets the appropriate aria-label for the autoplay button.\n * - Sets the appropriate aria-live for the carousel.\n * - Sets/clears the interval for autoplaying the carousel.\n *\n * @protected\n */\n _handleAutoplay() {\n if (this.autoplay) {\n addClass(this.pauseClass, this.dom.autoplay);\n removeClass(this.playClass, this.dom.autoplay);\n\n this.dom.autoplay.setAttribute(\"aria-label\", this.pauseText);\n this.dom.carousel.setAttribute(\"aria-live\", \"off\");\n\n this._setInterval();\n } else {\n addClass(this.playClass, this.dom.autoplay);\n removeClass(this.pauseClass, this.dom.autoplay);\n\n this.dom.autoplay.setAttribute(\"aria-label\", this.playText);\n this.dom.carousel.setAttribute(\"aria-live\", \"polite\");\n\n this._clearInterval();\n }\n }\n\n /**\n * Handles the focus events throughout the carousel for proper use.\n *\n * - Adds a `focusin` listener to the carousel element to pause autoplay.\n * - Adds a `focusout` listener to the carousel element to resume autoplay.\n */\n _handleFocus() {\n // Pause autoplay when anything in the carousel is focused.\n this.dom.carousel.addEventListener(\"focusin\", () => {\n if (this.autoplay) {\n this._clearInterval();\n }\n });\n\n this.dom.carousel.addEventListener(\"focusout\", () => {\n if (this.autoplay) {\n this._setInterval();\n }\n });\n }\n\n /**\n * Handles the click events throughout the carousel.\n *\n * - Adds a `pointerup` listener to the next control to activate the next item.\n * - Adds a `pointerup` listener to the previous control to activate the previous item.\n * - Adds a `pointerup` listener to the autoplay control to toggle autoplay.\n * - Adds a `pointerup` listener to each tab control to activate the corresponding item.\n */\n _handleClick() {\n this.dom.next.addEventListener(\"pointerup\", () => {\n this.activateNextItem();\n });\n\n this.dom.previous.addEventListener(\"pointerup\", () => {\n this.activatePreviousItem();\n });\n\n this.dom.autoplay.addEventListener(\"pointerup\", () => {\n this.toggleAutoplay();\n });\n\n this.dom.carouselTabs.forEach((tab, index) => {\n tab.addEventListener(\"pointerup\", () => {\n if (this.currentItem > index) {\n this._currentAction = \"previous\";\n } else {\n this._currentAction = \"next\";\n }\n\n this.activateItem(index);\n });\n });\n }\n\n /**\n * Handles the hover events throughout the carousel for proper use.\n *\n * - Adds a `pointerover` listener to the carousel to pause autoplay.\n * - Adds a `pointerleave` listener to the carousel to resume autoplay.\n */\n _handleHover() {\n // Pause autoplay when anything in the carousel is hovered.\n this.dom.carousel.addEventListener(\"pointerover\", () => {\n if (this.autoplay) {\n this._clearInterval();\n }\n });\n\n this.dom.carousel.addEventListener(\"pointerleave\", () => {\n if (this.autoplay) {\n this._setInterval();\n }\n });\n }\n\n /**\n * Handles keydown events throughout the carousel item for proper use.\n *\n * - Adds a `keydown` listener to all control elements.\n * - Prevents Space and Enter key events.\n * - Adds a `keydown` listener to all tab elements.\n * - Prevents Space and Enter key events.\n */\n _handleKeydown() {\n this.dom.carouselControls.forEach((control) => {\n control.addEventListener(\"keydown\", (event) => {\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n // Prevent the default action of the event.\n preventEvent(event);\n\n break;\n }\n });\n });\n\n this.dom.carouselTabs.forEach((tab) => {\n tab.addEventListener(\"keydown\", (event) => {\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n // Prevent the default action of the event.\n preventEvent(event);\n\n break;\n }\n });\n });\n }\n\n /**\n * Handles keyup events throughout the carousel item for proper use.\n *\n * - Adds a `keyup` listener to all control elements.\n * - Activates the next/previous item depending on which control is pressed.\n * - Toggles autoplay if the autoplay control is pressed.\n *\n */\n _handleKeyup() {\n // Activate the next item if the space or enter key on the next control.\n this.dom.next.addEventListener(\"keyup\", (event) => {\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n this.activateNextItem();\n\n // Prevent the default action of the event.\n preventEvent(event);\n\n break;\n }\n });\n\n // Activate the previous item if the space or enter key on the previous control.\n this.dom.previous.addEventListener(\"keyup\", (event) => {\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n this.activatePreviousItem();\n\n // Prevent the default action of the event.\n preventEvent(event);\n\n break;\n }\n });\n\n // Toggle autoplay if the space or enter key on the autoplay control.\n this.dom.autoplay.addEventListener(\"keyup\", (event) => {\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n this.toggleAutoplay();\n\n // Prevent the default action of the event.\n preventEvent(event);\n\n break;\n }\n });\n\n // Activate the item if the space or enter key on the tab control.\n this.dom.carouselTabs.forEach((tab, index) => {\n tab.addEventListener(\"keyup\", (event) => {\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n this.activateItem(index);\n\n // Prevent the default action of the event.\n preventEvent(event);\n\n break;\n }\n });\n });\n }\n\n /**\n * Sets the transition duration for the carousel as a CSS custom property.\n *\n * The custom property is set as `--graupl-carousel-transition-duration`.\n *\n * @protected\n */\n _setTransitionDuration() {\n this.dom.carousel.style.setProperty(\n `--${this.prefix}carousel-transition-duration`,\n `${this.transitionDuration}ms`\n );\n }\n\n /**\n * Activates the current carousel item.\n *\n * @public\n */\n activateCurrentItem() {\n addClass(this.activeClass, this.currentCarouselItem);\n\n if (this.currentCarouselTab) {\n this.currentCarouselTab.setAttribute(\"aria-selected\", true);\n addClass(this.activeClass, this.currentCarouselTab);\n }\n }\n\n /**\n * Deactivates the current carousel item.\n *\n * @public\n */\n deactivateCurrentItem() {\n removeClass(this.activeClass, this.currentCarouselItem);\n\n if (this.currentCarouselTab) {\n this.currentCarouselTab.setAttribute(\"aria-selected\", false);\n removeClass(this.activeClass, this.currentCarouselTab);\n }\n }\n\n /**\n * Activates the carousel item at a given index.\n *\n * @public\n *\n * @param {number} index - The index of the carousel item to activate.\n */\n activateItem(index) {\n const currentIndex = this.currentItem;\n\n this.dom.carousel.dataset.grauplAction = this._currentAction;\n\n if (this.autoplay) {\n this._clearInterval();\n }\n\n addClass(this.previousClass, this.currentCarouselItem);\n addClass(this.nextClass, this.dom.carouselItems[index]);\n\n requestAnimationFrame(() => {\n this.deactivateCurrentItem();\n this.currentItem = index;\n this.activateCurrentItem();\n\n requestAnimationFrame(() => {\n setTimeout(() => {\n removeClass(this.previousClass, this.dom.carouselItems[currentIndex]);\n removeClass(this.nextClass, this.currentCarouselItem);\n }, this.transitionDuration);\n });\n });\n\n if (this.autoplay) {\n this._setInterval();\n }\n }\n\n /**\n * Activates the first carousel item.\n *\n * @public\n */\n activateFirstItem() {\n this.activateItem(0);\n }\n\n /**\n * Activates the last carousel item.\n *\n * @public\n */\n activateLastItem() {\n this.activateItem(this.dom.carouselItems.length - 1);\n }\n\n /**\n * Activates the next carousel item.\n *\n * @public\n */\n activateNextItem() {\n this._currentAction = \"next\";\n\n if (this.currentItem + 1 >= this.dom.carouselItems.length) {\n this.activateFirstItem();\n } else {\n this.activateItem(this.currentItem + 1);\n }\n }\n\n /**\n * Activates the previous carousel item.\n *\n * @public\n */\n activatePreviousItem() {\n this._currentAction = \"previous\";\n\n if (this.currentItem - 1 < 0) {\n this.activateLastItem();\n } else {\n this.activateItem(this.currentItem - 1);\n }\n }\n\n /**\n * Toggles autoplay on the carousel.\n *\n * @public\n */\n toggleAutoplay() {\n this.autoplay = !this.autoplay;\n\n this._handleAutoplay();\n }\n}\n\nexport default Carousel;\n"],"mappings":"AAMA,SAAgBmG,EAASlG,EAAWC,EAAS,CAEvCD,IAAc,IAAMA,EAAU4L,SAAW,IAI7C,OAAW5L,GAAc,SACvBC,EAAQE,UAAUC,IAAIJ,CAAAA,EAEtBC,EAAQE,UAAUC,IAAI,GAAGJ,CAAAA,EAE7B,CAQA,SAAgBmG,EAAYnG,EAAWC,EAAS,CAE1CD,IAAc,IAAMA,EAAU4L,SAAW,IAI7C,OAAW5L,GAAc,SACvBC,EAAQE,UAAUG,OAAON,CAAAA,EAEzBC,EAAQE,UAAUG,OAAO,GAAGN,CAAAA,EAEhC,CC9BA,SAAgBqG,EAASmJ,EAAO,CAC9B,GAAI,CAEF,MAAM1F,EAAM0F,EAAM1F,KAAO0F,EAAM5N,QACzBC,EAAO,CACXC,MAAOgI,IAAQ,SAAWA,IAAQ,GAClC/H,MAAO+H,IAAQ,KAAOA,IAAQ,YAAcA,IAAQ,GACpD9H,OAAQ8H,IAAQ,UAAYA,IAAQ,OAASA,IAAQ,GACrD7H,QAAS6H,IAAQ,WAAaA,IAAQ,MAAQA,IAAQ,GACtD5H,WAAY4H,IAAQ,cAAgBA,IAAQ,SAAWA,IAAQ,GAC/D3H,UAAW2H,IAAQ,aAAeA,IAAQ,QAAUA,IAAQ,GAC5D1H,UAAW0H,IAAQ,aAAeA,IAAQ,QAAUA,IAAQ,GA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Ac8I,CAAAA,CAAAA,EACvD1J,EAAY,KAAKmD,UAAW,KAAKkC,mBAAAA,CAClC,EAAE,KAAK9B,kBAAAA,CACT,CAAA,CACF,CAAA,EAEG,KAAKrC,UACP,KAAKyH,aAAAA,CAET,CAOAtE,mBAAoB,CAClB,KAAK8E,aAAa,CAAA,CACpB,CAOAY,kBAAmB,CACjB,KAAKZ,aAAa,KAAKpE,IAAInE,cAAc6E,OAAS,CAAA,CACpD,CAOAqD,kBAAmB,CACjB,KAAK7G,eAAiB,OAElB,KAAKmD,YAAc,GAAK,KAAKL,IAAInE,cAAc6E,OACjD,KAAKpB,kBAAAA,EAEL,KAAK8E,aAAa,KAAK/D,YAAc,CAAA,CAEzC,CAOA6D,sBAAuB,CACrB,KAAKhH,eAAiB,WAElB,KAAKmD,YAAc,EAAI,EACzB,KAAK2E,iBAAAA,EAEL,KAAKZ,aAAa,KAAK/D,YAAc,CAAA,CAEzC,CAOA8D,gBAAiB,CACf,KAAKhI,SAAAA,CAAY,KAAKA,SAEtB,KAAKoD,gBAAAA,CACP,CACF,EAEA,EAAe7D"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
function u(t,e){t===""||t.length===0||(typeof t=="string"?e.classList.add(t):e.classList.add(...t))}function c(t,e){t===""||t.length===0||(typeof t=="string"?e.classList.remove(t):e.classList.remove(...t))}function h(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(r=>s[r]===!0)||""}catch{return""}}function p(t){t.preventDefault(),t.stopPropagation()}function m(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 r=typeof e[s];throw new TypeError(`${s} must be an instance of ${t.name}. "${r}" given.`)}return{status:!0,error:null}}catch(s){return{status:!1,error:s}}}function i(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 r=typeof e[s];if(r!==t)throw new TypeError(`${s} must be a ${t}. "${r}" given.`)}return{status:!0,error:null}}catch(s){return{status:!1,error:s}}}function _(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 o(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(r=>{if(typeof r!="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 r={};r[e]=t[e],_(r)}}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function d(t,e){if(i("string",{tagName:t}).status&&m(HTMLElement,e).status){const s=t.toLowerCase();let r=!0;for(const n in e)e[n].tagName.toLowerCase()!==s&&(r=!1);return r}else return!1}function M(t=null){window.Graupl=window.Graupl||{},i("string",{type:t})&&(window.Graupl[t]=window.Graupl[t]||{})}function G(t=null){return i("string",{type:t})?window.Graupl[t]:window.Graupl}function O(t,e={}){i("string",{type:t})&&i("object",{data:e})&&(window.Graupl[t]=e)}function j(t){i("string",{type:t})&&(window.Graupl[t]={})}function P(t,e,s){i("string",{type:t,key:e})&&(window.Graupl[t][e]=s)}function F(t,e){return i("string",{type:t,key:e})?window.Graupl[t][e]:null}function V(t,e){i("string",{type:t,key:e})&&delete window.Graupl[t][e]}var y={initializeStorage:M,getStorage:G,setStorage:O,clearStorage:j,pushToStorage:P,getFromStorage:F,removeFromStorage:V},q=class{_dom={carousel:null,carouselItems:[],carouselItemContainer:null,carouselControls:[],carouselControlContainer:null,carouselTabs:[],carouselTabContainer:null,autoplay:null,next:null,previous:null};_selectors={carouselItems:"",carouselItemContainer:"",carouselControls:"",carouselControlContainer:"",carouselTabs:"",carouselTabContainer:"",autoplay:"",next:"",previous:""};_activeClass="active";_previousClass="previous";_nextClass="next";_playClass="play";_pauseClass="pause";_currentItem=0;_autoplay=!0;_transitionDelay=1e4;_transitionDuration=500;_playText="Play";_pauseText="Pause";_currentAction="next";_autoplayInterval=null;_prefix="graupl-";_key="";_errors=[];constructor({carouselElement:t,carouselItemSelector:e=".carousel-item",carouselItemContainerSelector:s=".carousel-item-container",carouselControlSelector:r=".carousel-control",carouselControlContainerSelector:n=".carousel-control-container",carouselTabSelector:l=".carousel-tab",carouselTabContainerSelector:f=".carousel-tab-container",autoplaySelector:a=".autoplay",nextSelector:C=".next",previousSelector:g=".previous",activeClass:I="active",previousClass:b="previous",nextClass:v="next",playClass:T="play",pauseClass:E="pause",autoplay:w=!0,transitionDelay:x=1e4,transitionDuration:k=500,playText:A="Play",pauseText:D="Pause",prefix:S="graupl-",key:L=null,initialize:$=!1}){this._dom.carousel=t,this._selectors.carouselItems=e,this._selectors.carouselItemContainer=s,this._selectors.carouselControls=r,this._selectors.carouselControlContainer=n,this._selectors.carouselTabs=l,this._selectors.carouselTabContainer=f,this._selectors.autoplay=a,this._selectors.next=C,this._selectors.previous=g,this._activeClass=I||"",this._previousClass=b||"",this._nextClass=v||"",this._playClass=T||"",this._pauseClass=E||"",this._autoplay=w,this._transitionDelay=x,this._transitionDuration=k,this._playText=A||"",this._pauseText=D||"",this._prefix=S||"",this._key=L||"",$&&this.initialize()}initialize(){try{if(!this._validate())throw new Error(`Graupl Carousel: cannot initialize carousel. The following errors have been found:
|
|
2
|
-
- ${this.errors.join(`
|
|
3
|
-
- `)}`);this._generateKey(),this._setDOMElements(),this._setIds(),this._setAriaAttributes(),this.activateFirstItem(),this._handleAutoplay(),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup(),this._setTransitionDuration(),y.initializeStorage("carousels"),y.pushToStorage("carousels",this.dom.carousel.id,this)}catch(t){console.error(t)}}get dom(){return this._dom}get selectors(){return this._selectors}get activeClass(){return this._activeClass}get previousClass(){return this._previousClass}get nextClass(){return this._nextClass}get playClass(){return this._playClass}get pauseClass(){return this._pauseClass}get currentItem(){return this._currentItem}get currentCarouselItem(){return this.dom.carouselItems[this.currentItem]}get currentCarouselTab(){return this.dom.carouselTabs[this.currentItem]}get autoplay(){return this._autoplay}get transitionDelay(){return this._transitionDelay}get transitionDuration(){return this._transitionDuration}get playText(){return this._playText}get pauseText(){return this._pauseText}get prefix(){return this._prefix}get key(){return this._key}get currentAction(){return this._currentAction}get errors(){return this._errors}set currentItem(t){if(i("number",{value:t}),t===this.currentItem)return;t<0?this._currentItem=0:t>=this.dom.carouselItems.length?this._currentItem=this.dom.carouselItems.length-1:this._currentItem=t,this._dom.carousel.querySelectorAll(this.selectors.carouselTab)&&this.dom.carouselItems.forEach((s,r)=>{s.setAttribute("aria-selected",r===this._currentItem)})}set autoplay(t){i("boolean",{value:t}),this._autoplay!==t&&(this._autoplay=t)}set activeClass(t){o({activeClass:t}),this._activeClass!==t&&(this._activeClass=t)}set previousClass(t){o({previousClass:t}),this._previousClass!==t&&(this._previousClass=t)}set nextClass(t){o({nextClass:t}),this._nextClass!==t&&(this._nextClass=t)}set playClass(t){o({playClass:t}),this._playClass!==t&&(this._playClass=t)}set pauseClass(t){o({pauseClass:t}),this._pauseClass!==t&&(this._pauseClass=t)}set transitionDelay(t){i("number",{value:t}),t!==this.transitionDelay&&t>=0&&(this._currentItem=t)}set transitionDuration(t){i("number",{value:t}),this._transitionDuration!==t&&t>=0&&(this._transitionDuration=t,this._setTransitionDuration())}set playText(t){i("string",{value:t}),this._playText!==t&&(this._playText=t)}set pauseText(t){i("string",{value:t}),this._pauseText!==t&&(this._pauseText=t)}set prefix(t){i("string",{value:t}),this._prefix!==t&&(this._prefix=t)}set key(t){i("string",{value:t}),this._key!==t&&(this._key=t)}_validate(){let t=!0;const e=m(HTMLElement,{carousel:this.dom.carousel});e||(this._errors.push(e.message),t=!1);const s=_({carouselItemsSelector:this._selectors.carouselItems,carouselItemContainerSelector:this._selectors.carouselItemContainer,carouselControlsSelector:this._selectors.carouselControls,carouselControlContainerSelector:this._selectors.carouselControlContainer,carouselTabsSelector:this._selectors.carouselTabs,carouselTabContainerSelector:this._selectors.carouselTabContainer,autoplaySelector:this._selectors.autoplay,nextSelector:this._selectors.next,previousSelector:this._selectors.previous});s||(this._errors.push(s.message),t=!1);const r=i("boolean",{autoplay:this.autoplay});r||(this._errors.push(r.message),t=!1);const n=i("number",{transitionDelay:this._transitionDelay});n||(this._errors.push(n.message),t=!1);const l=i("number",{transitionDuration:this._transitionDuration});if(l||(this._errors.push(l.message),t=!1),this._activeClass!==""){const a=o({activeClass:this._activeClass});a||(this._errors.push(a.message),t=!1)}if(this._previousClass!==""){const a=o({previousClass:this._previousClass});a||(this._errors.push(a.message),t=!1)}if(this._nextClass!==""){const a=o({nextClass:this._nextClass});a||(this._errors.push(a.message),t=!1)}if(this._playClass!==""){const a=o({playClass:this._playClass});a||(this._errors.push(a.message),t=!1)}if(this._pauseClass!==""){const a=o({pauseClass:this._pauseClass});a||(this._errors.push(a.message),t=!1)}if(this._playText!==""){const a=i("string",{playText:this._playText});a||(this._errors.push(a.message),t=!1)}if(this._pauseText!==""){const a=i("string",{pauseText:this._pauseText});a||(this._errors.push(a.message),t=!1)}const f=i("string",{prefix:this._prefix});return f||(this._errors.push(f.message),t=!1),t}_setDOMElementType(t,e=this.dom.carousel,s=!0){if(typeof this.selectors[t]=="string"){if(t==="carousel")throw new Error(`Graupl Carousel: "${t}" element cannot be set through _setDOMElementType.`);if(e!==this.dom.carousel&&m(HTMLElement,{base:e}),Array.isArray(this._dom[t])){const n=Array.from(e.querySelectorAll(this.selectors[t])).filter(l=>l.parentElement===e);s?this._dom[t]=n:this._dom[t]=[...this._dom[t],...n]}else{const r=e.querySelector(this.selectors[t]);if(r&&r.parentElement!==e)return;s&&(this._dom[t]=r)}}else throw new Error(`Graupl Carousel: "${t}" is not a valid element type within the carousel.`)}_resetDOMElementType(t){if(typeof this.selectors[t]=="string"){if(t==="carousel")throw new Error(`Graupl Carousel: "${t}" element cannot be reset through _resetDOMElementType.`);Array.isArray(this._dom[t])?this._dom[t]=[]:this._dom[t]=null}else throw new Error(`Graupl Carousel: "${t}" is not a valid element type within the carousel.`)}_setDOMElements(){this._setDOMElementType("carouselItemContainer"),this._setDOMElementType("carouselControlContainer"),this._setDOMElementType("carouselTabContainer"),this.dom.carouselItemContainer&&this._setDOMElementType("carouselItems",this.dom.carouselItemContainer),this.dom.carouselControlContainer&&(this._setDOMElementType("carouselControls",this.dom.carouselControlContainer),this._setDOMElementType("autoplay",this.dom.carouselControlContainer),this._setDOMElementType("next",this.dom.carouselControlContainer),this._setDOMElementType("previous",this.dom.carouselControlContainer)),this._dom.carouselTabContainer&&this._setDOMElementType("carouselTabs",this.dom.carouselTabContainer)}_generateKey(t=!1){(this.key===""||t)&&(this.key=Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,10))}_setIds(){this.dom.carousel.id=this.dom.carousel.id||`carousel-${this.key}`,this.dom.carouselItems.forEach((t,e)=>{t.id=t.id||`carousel-item-${this.key}-${e}`}),this.dom.carouselTabs.forEach((t,e)=>{t.id=t.id||`carousel-tab-${this.key}-${e}`})}_setAriaAttributes(){!d("section",{carousel:this.dom.carousel})&&!this.dom.carousel.getAttribute("role")!=="region"&&this.dom.carousel.setAttribute("role","group"),this._dom.carousel.setAttribute("aria-roledescription","carousel"),this.dom.carouselTabContainer&&this.dom.carouselTabContainer.setAttribute("role","tablist"),this.dom.carouselTabs.forEach((t,e)=>{d("button",{tab:t})||t.setAttribute("role","button"),t.setAttribute("aria-selected",e===0),t.setAttribute("aria-controls",this.dom.carouselItems[e].id)})}_setInterval(){this._clearInterval(),this._autoplayInterval=setInterval(()=>{this.activateNextItem()},this.transitionDelay)}_clearInterval(){clearInterval(this._autoplayInterval)}_handleAutoplay(){this.autoplay?(u(this.pauseClass,this.dom.autoplay),c(this.playClass,this.dom.autoplay),this.dom.autoplay.setAttribute("aria-label",this.pauseText),this.dom.carousel.setAttribute("aria-live","off"),this._setInterval()):(u(this.playClass,this.dom.autoplay),c(this.pauseClass,this.dom.autoplay),this.dom.autoplay.setAttribute("aria-label",this.playText),this.dom.carousel.setAttribute("aria-live","polite"),this._clearInterval())}_handleFocus(){this.dom.carousel.addEventListener("focusin",()=>{this.autoplay&&this._clearInterval()}),this.dom.carousel.addEventListener("focusout",()=>{this.autoplay&&this._setInterval()})}_handleClick(){this.dom.next.addEventListener("pointerup",()=>{this.activateNextItem()}),this.dom.previous.addEventListener("pointerup",()=>{this.activatePreviousItem()}),this.dom.autoplay.addEventListener("pointerup",()=>{this.toggleAutoplay()}),this.dom.carouselTabs.forEach((t,e)=>{t.addEventListener("pointerup",()=>{this.currentItem>e?this._currentAction="previous":this._currentAction="next",this.activateItem(e)})})}_handleHover(){this.dom.carousel.addEventListener("pointerover",()=>{this.autoplay&&this._clearInterval()}),this.dom.carousel.addEventListener("pointerleave",()=>{this.autoplay&&this._setInterval()})}_handleKeydown(){this.dom.carouselControls.forEach(t=>{t.addEventListener("keydown",e=>{switch(h(e)){case"Space":case"Enter":p(e);break}})}),this.dom.carouselTabs.forEach(t=>{t.addEventListener("keydown",e=>{switch(h(e)){case"Space":case"Enter":p(e);break}})})}_handleKeyup(){this.dom.next.addEventListener("keyup",t=>{switch(h(t)){case"Space":case"Enter":this.activateNextItem(),p(t);break}}),this.dom.previous.addEventListener("keyup",t=>{switch(h(t)){case"Space":case"Enter":this.activatePreviousItem(),p(t);break}}),this.dom.autoplay.addEventListener("keyup",t=>{switch(h(t)){case"Space":case"Enter":this.toggleAutoplay(),p(t);break}}),this.dom.carouselTabs.forEach((t,e)=>{t.addEventListener("keyup",s=>{switch(h(s)){case"Space":case"Enter":this.activateItem(e),p(s);break}})})}_setTransitionDuration(){this.dom.carousel.style.setProperty(`--${this.prefix}carousel-transition-duration`,`${this.transitionDuration}ms`)}activateCurrentItem(){u(this.activeClass,this.currentCarouselItem),this.currentCarouselTab&&(this.currentCarouselTab.setAttribute("aria-selected",!0),u(this.activeClass,this.currentCarouselTab))}deactivateCurrentItem(){c(this.activeClass,this.currentCarouselItem),this.currentCarouselTab&&(this.currentCarouselTab.setAttribute("aria-selected",!1),c(this.activeClass,this.currentCarouselTab))}activateItem(t){const e=this.currentItem;this.dom.carousel.dataset.grauplAction=this._currentAction,this.autoplay&&this._clearInterval(),u(this.previousClass,this.currentCarouselItem),u(this.nextClass,this.dom.carouselItems[t]),requestAnimationFrame(()=>{this.deactivateCurrentItem(),this.currentItem=t,this.activateCurrentItem(),requestAnimationFrame(()=>{setTimeout(()=>{c(this.previousClass,this.dom.carouselItems[e]),c(this.nextClass,this.currentCarouselItem)},this.transitionDuration)})}),this.autoplay&&this._setInterval()}activateFirstItem(){this.activateItem(0)}activateLastItem(){this.activateItem(this.dom.carouselItems.length-1)}activateNextItem(){this._currentAction="next",this.currentItem+1>=this.dom.carouselItems.length?this.activateFirstItem():this.activateItem(this.currentItem+1)}activatePreviousItem(){this._currentAction="previous",this.currentItem-1<0?this.activateLastItem():this.activateItem(this.currentItem-1)}toggleAutoplay(){this.autoplay=!this.autoplay,this._handleAutoplay()}},H=q;export{H as default};
|
|
4
|
-
|
|
5
|
-
//# sourceMappingURL=carousel.es.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"carousel.es.js","names":["addClass","className","element","length","classList","add","removeClass","remove","selectAllFocusableElements","context","document","querySelector","elements","Array","from","querySelectorAll","tabbableElements","filter","check","getAttribute","selectFirstFocusableElement","selectLastFocusableElement","selectNextFocusableElement","index","indexOf","selectPreviousFocusableElement","keyPress","event","key","keyCode","keys","Enter","Space","Escape","ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End","Tab","Object","find","preventEvent","preventDefault","stopPropagation","isValidInstance","contructor","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","isValidType","initializeStorage","type","window","Graupl","getStorage","setStorage","data","clearStorage","pushToStorage","key","value","getFromStorage","removeFromStorage","addClass","removeClass","preventEvent","keyPress","storage","isQuerySelector","isTag","isValidClassList","isValidInstance","isValidType","Carousel","_dom","carousel","carouselItems","carouselItemContainer","carouselControls","carouselControlContainer","carouselTabs","carouselTabContainer","autoplay","next","previous","_selectors","_activeClass","_previousClass","_nextClass","_playClass","_pauseClass","_currentItem","_autoplay","_transitionDelay","_transitionDuration","_playText","_pauseText","_currentAction","_autoplayInterval","_prefix","_key","_errors","constructor","carouselElement","carouselItemSelector","carouselItemContainerSelector","carouselControlSelector","carouselControlContainerSelector","carouselTabSelector","carouselTabContainerSelector","autoplaySelector","nextSelector","previousSelector","activeClass","previousClass","nextClass","playClass","pauseClass","transitionDelay","transitionDuration","playText","pauseText","prefix","key","initialize","_validate","Error","errors","join","_generateKey","_setDOMElements","_setIds","_setAriaAttributes","activateFirstItem","_handleAutoplay","_handleFocus","_handleClick","_handleHover","_handleKeydown","_handleKeyup","_setTransitionDuration","initializeStorage","pushToStorage","dom","id","error","console","selectors","currentItem","currentCarouselItem","currentCarouselTab","currentAction","value","length","tabs","querySelectorAll","carouselTab","forEach","item","index","setAttribute","check","htmlElementChecks","HTMLElement","push","message","querySelectorChecks","carouselItemsSelector","carouselControlsSelector","carouselTabsSelector","autoplayChecks","delayCheck","durationCheck","activeClassChecks","previousClassChecks","nextClassChecks","playClassChecks","pauseClassChecks","playTextChecks","pauseTextChecks","prefixChecks","_setDOMElementType","elementType","base","overwrite","Array","isArray","domElements","from","filteredElements","filter","parentElement","domElement","querySelector","_resetDOMElementType","regenerate","Math","random","toString","replace","substring","tab","getAttribute","_setInterval","_clearInterval","setInterval","activateNextItem","clearInterval","addEventListener","activatePreviousItem","toggleAutoplay","activateItem","control","event","style","setProperty","activateCurrentItem","deactivateCurrentItem","currentIndex","dataset","grauplAction","requestAnimationFrame","setTimeout","activateLastItem"],"sources":["../../../src/js/domHelpers.js","../../../src/js/eventHandlers.js","../../../src/js/validate.js","../../../src/js/storage.js","../../../src/js/carousel/Carousel.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 * @return {HTMLElement[]}\n */\nexport function selectAllFocusableElements(context = document) {\n const querySelector =\n \"a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),[tabindex]\";\n const elements = Array.from(context.querySelectorAll(querySelector));\n\n const tabbableElements = elements.filter((element) => {\n let check = true;\n\n if (element.getAttribute(\"tabindex\") === \"-1\") check = false;\n\n return check;\n });\n\n return tabbableElements;\n}\n\n/**\n * Select the first focusable element within a given context.\n *\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @return {HTMLElement|boolean} - The first focusable element or false if none found.\n */\nexport function selectFirstFocusableElement(context = document) {\n const tabbableElements = selectAllFocusableElements(context);\n\n return tabbableElements[0] || false;\n}\n\n/**\n * Select the last focusable element within a given context.\n *\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @return {HTMLElement|boolean} - The last focusable element or false if none found.\n */\nexport function selectLastFocusableElement(context = document) {\n const tabbableElements = selectAllFocusableElements(context);\n\n return tabbableElements[tabbableElements.length - 1] || false;\n}\n\n/**\n * Select the next focusable element relative to the given element within a context.\n *\n * @param {HTMLElement} element - The reference element.\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @return {HTMLElement|boolean} - The next focusable element or false if none found.\n */\nexport function selectNextFocusableElement(element, context = document) {\n const tabbableElements = selectAllFocusableElements(context);\n const index = tabbableElements.indexOf(element);\n\n return index === tabbableElements.length - 1\n ? false\n : tabbableElements[index + 1];\n}\n\n/**\n * Select the previous focusable element relative to the given element within a context.\n *\n * @param {HTMLElement} element - The reference element.\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @return {HTMLElement|boolean} - The previous focusable element or false if none found.\n */\nexport function selectPreviousFocusableElement(element, context = document) {\n const tabbableElements = selectAllFocusableElements(context);\n const index = tabbableElements.indexOf(element);\n\n return index === 0 ? false : tabbableElements[index - 1];\n}\n","/**\n * 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 * Check to see if the provided elements have a specific contructor.\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} contructor - 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(contructor, 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 contructor)) {\n const elementType = typeof elements[key];\n throw new TypeError(\n `${key} must be an instance of ${contructor.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 * @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 carousel class.\n */\n\nimport { addClass, removeClass } from \"../domHelpers.js\";\nimport { preventEvent, keyPress } from \"../eventHandlers.js\";\nimport storage from \"../storage.js\";\nimport {\n isQuerySelector,\n isTag,\n isValidClassList,\n isValidInstance,\n isValidType,\n} from \"../validate.js\";\n\nclass Carousel {\n /**\n * The DOM elements within the carousel.\n *\n * @protected\n *\n * @type {Object<HTMLElement, HTMLElement[]>}\n *\n * @property {HTMLElement} carousel - The carousel element.\n * @property {HTMLElement[]} carouselItems - The carousel items.\n * @property {HTMLElement} carouselItemContainer - The carousel item container.\n * @property {HTMLElement[]} carouselControls - The carousel controls.\n * @property {HTMLElement} carouselControlContainer - The carousel control container.\n * @property {HTMLElement[]} carouselTabs - The carousel tabs.\n * @property {HTMLElement} carouselTabContainer - The carousel tab container.\n * @property {HTMLElement} autoplay - The autoplay button.\n * @property {HTMLElement} next - The next button.\n * @property {HTMLElement} previous - The previous button.\n */\n _dom = {\n carousel: null,\n carouselItems: [],\n carouselItemContainer: null,\n carouselControls: [],\n carouselControlContainer: null,\n carouselTabs: [],\n carouselTabContainer: null,\n autoplay: null,\n next: null,\n previous: null,\n };\n\n /**\n * The query selectors used by the carousel to populate the dom.\n *\n * @protected\n *\n * @type {Object<string>}\n *\n * @property {string} carouselItems - The query selector string for carousel items.\n * @property {string} carouselItemContainer - The query selector string for the carousel item container.\n * @property {string} carouselControls - The query selector string for carousel controls.\n * @property {string} carouselControlContainer - The query selector string for carousel control container.\n * @property {string} carouselTabs - The query selector string for the carousel tabs.\n * @property {string} carouselTabContainer - The query selector string for the carousel tab container.\n * @property {string} autoplay - The query selector string for the autoplay button.\n * @property {string} next - The query selector string for the next button.\n * @property {string} previous - The query selector string for the previous button.\n */\n _selectors = {\n carouselItems: \"\",\n carouselItemContainer: \"\",\n carouselControls: \"\",\n carouselControlContainer: \"\",\n carouselTabs: \"\",\n carouselTabContainer: \"\",\n autoplay: \"\",\n next: \"\",\n previous: \"\",\n };\n\n /**\n * The class(es) to apply when a carousel item is active.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _activeClass = \"active\";\n\n /**\n * The class(es) to apply to a carousel item that is the previously active item.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _previousClass = \"previous\";\n\n /**\n * The class(es) to apply to a carousel item that is the next active item.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _nextClass = \"next\";\n\n /**\n * The class(es) to apply to the autoplay button when the carousel is paused.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _playClass = \"play\";\n\n /**\n * The class(es) to apply to the autoplay button when the carousel is playing.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _pauseClass = \"pause\";\n\n /**\n * The index of the currently active carousel item.\n *\n * @protected\n *\n * @type {number}\n */\n _currentItem = 0;\n\n /**\n * A flag to indicate if the carousel is currently playing.\n *\n * @protected\n *\n * @type {boolean}\n */\n _autoplay = true;\n\n /**\n * A variable to delay transition slides in milliseconds.\n *\n * @protected\n *\n * @type {number}\n */\n _transitionDelay = 10000;\n\n /**\n * The duration time (in milliseconds) for the transition between carousel items.\n *\n * @protected\n *\n * @type {number}\n */\n _transitionDuration = 500;\n\n /**\n * The label for the autoplay button when the carousel is paused.\n *\n * @protected\n *\n * @type {string}\n */\n _playText = \"Play\";\n\n /**\n * The label for the autoplay button when the carousel is playing.\n *\n * @protected\n *\n * @type {string}\n */\n _pauseText = \"Pause\";\n\n /**\n * The current action being performed by the carousel.\n *\n * @protected\n *\n * @type {string}\n */\n _currentAction = \"next\";\n\n /**\n * The stored interval callback for autoplaying the carousel.\n *\n * @protected\n *\n * @type {?Function}\n */\n _autoplayInterval = null;\n\n /**\n * The prefix to use for CSS custom properties.\n *\n * @protected\n *\n * @type {string}\n */\n _prefix = \"graupl-\";\n\n /**\n * The key used to generate IDs throughout the carousel.\n *\n * @protected\n *\n * @type {string}\n */\n _key = \"\";\n\n /**\n * An array of error messages generated by the carousel.\n *\n * @protected\n *\n * @type {string[]}\n */\n _errors = [];\n\n /**\n * Contructs a new `Carousel`.\n *\n * @param {object} options - The options for the generated carousel.\n * @param {HTMLElement} options.carouselElement - The carousel element in the DOM.\n * @param {string} [options.carouselItemSelector = .carousel-item] - The query selector string for carousel items.\n * @param {string} [options.carouselItemContainerSelector = .carousel-item-container] - The query selector string for the carousel item container.\n * @param {string} [options.carouselControlSelector = .carousel-control] - The query selector string for carousel controls.\n * @param {string} [options.carouselControlContainerSelector = .carousel-control-container] - The query selector string for carousel control container.\n * @param {string} [options.carouselTabSelector = .carousel-tab] - The query selector string for carousel tabs.\n * @param {string} [options.carouselTabContainerSelector = .carousel-tab-container] - The query selector string for the carousel tab container.\n * @param {string} [options.autoplaySelector = .autoplay] - The query selector string for the autoplay button.\n * @param {string} [options.nextSelector = .next] - The query selector string for the next button.\n * @param {string} [options.previousSelector = .previous] - The query selector string for the previous button.\n * @param {?(string|string[])} [options.activeClass = active] - The class(es) to apply when a carousel item is active.\n * @param {?(string|string[])} [options.previousClass = previous] - The class(es) to apply to a carousel item that is the previously active item.\n * @param {?(string|string[])} [options.nextClass = next] - The class(es) to apply to a carousel item that is the next active item.\n * @param {?(string|string[])} [options.playClass = play] - The class(es) to apply to the autoplay button when the carousel is paused.\n * @param {?(string|string[])} [options.pauseClass = pause] - The class(es) to apply to the autoplay button when the carousel is playing.\n * @param {boolean} [options.autoplay = true] - A flag to indicate if the carousel should autoplay.\n * @param {number} [options.transitionDelay = 10000] - A flag to initialize the carousel immediately upon creation.\n * @param {number} [options.transitionDuration = 500] - The duration time (in milliseconds) for the transition between carousel items.\n * @param {?string} [options.playText = Play] - The text to use for the play button.\n * @param {?string} [options.pauseText = Pause] - The text to use for the pause button.\n * @param {?string} [options.prefix = graupl-] - The prefix to use for CSS custom properties.\n * @param {?string} [options.key = null] - The key used to generate IDs throughout the carousel.\n * @param {boolean} [options.initialize = false] - A flag to initialize the carousel immediately upon creation.\n */\n constructor({\n carouselElement,\n carouselItemSelector = \".carousel-item\",\n carouselItemContainerSelector = \".carousel-item-container\",\n carouselControlSelector = \".carousel-control\",\n carouselControlContainerSelector = \".carousel-control-container\",\n carouselTabSelector = \".carousel-tab\",\n carouselTabContainerSelector = \".carousel-tab-container\",\n autoplaySelector = \".autoplay\",\n nextSelector = \".next\",\n previousSelector = \".previous\",\n activeClass = \"active\",\n previousClass = \"previous\",\n nextClass = \"next\",\n playClass = \"play\",\n pauseClass = \"pause\",\n autoplay = true,\n transitionDelay = 10000,\n transitionDuration = 500,\n playText = \"Play\",\n pauseText = \"Pause\",\n prefix = \"graupl-\",\n key = null,\n initialize = false,\n }) {\n // Set DOM elements.\n this._dom.carousel = carouselElement;\n\n // Set query selectors.\n this._selectors.carouselItems = carouselItemSelector;\n this._selectors.carouselItemContainer = carouselItemContainerSelector;\n this._selectors.carouselControls = carouselControlSelector;\n this._selectors.carouselControlContainer = carouselControlContainerSelector;\n this._selectors.carouselTabs = carouselTabSelector;\n this._selectors.carouselTabContainer = carouselTabContainerSelector;\n this._selectors.autoplay = autoplaySelector;\n this._selectors.next = nextSelector;\n this._selectors.previous = previousSelector;\n\n // Set class names.\n this._activeClass = activeClass || \"\";\n this._previousClass = previousClass || \"\";\n this._nextClass = nextClass || \"\";\n this._playClass = playClass || \"\";\n this._pauseClass = pauseClass || \"\";\n\n // Set flags.\n this._autoplay = autoplay;\n\n // Set transition options.\n this._transitionDelay = transitionDelay;\n this._transitionDuration = transitionDuration;\n\n // Set labels.\n this._playText = playText || \"\";\n this._pauseText = pauseText || \"\";\n\n // Set prefix.\n this._prefix = prefix || \"\";\n\n // Set the key.\n this._key = key || \"\";\n\n if (initialize) {\n this.initialize();\n }\n }\n\n /**\n * Initializes the carousel.\n */\n initialize() {\n try {\n if (!this._validate()) {\n throw new Error(\n `Graupl Carousel: cannot initialize carousel. The following errors have been found:\\n - ${this.errors.join(\n \"\\n - \"\n )}`\n );\n }\n\n // Set up the DOM.\n this._generateKey();\n this._setDOMElements();\n this._setIds();\n this._setAriaAttributes();\n\n // Activate the first item.\n this.activateFirstItem();\n\n // Handle events.\n this._handleAutoplay();\n this._handleFocus();\n this._handleClick();\n this._handleHover();\n this._handleKeydown();\n this._handleKeyup();\n\n // Set the custom props.\n this._setTransitionDuration();\n\n // Set up the storage.\n storage.initializeStorage(\"carousels\");\n storage.pushToStorage(\"carousels\", this.dom.carousel.id, this);\n } catch (error) {\n console.error(error);\n }\n }\n\n /**\n * The HTML elements for the carousel in the DOM.\n *\n * @readonly\n *\n * @type {Object<HTMLElement>}\n *\n * @see _dom\n */\n get dom() {\n return this._dom;\n }\n\n /**\n * The query selectors used by the carousel to populate the dom.\n *\n * @readonly\n *\n * @type {Object<string>}\n *\n * @see _selectors\n */\n get selectors() {\n return this._selectors;\n }\n\n /**\n * The class(es) to apply when a carousel item is active.\n *\n * @type {string|string[]}\n *\n * @see _activeClass\n */\n get activeClass() {\n return this._activeClass;\n }\n\n /**\n * The class(es) to apply to a carousel item that is the next active item.\n *\n * @type {string|string[]}\n *\n * @see _previousClass\n */\n get previousClass() {\n return this._previousClass;\n }\n\n /**\n * The class(es) to apply to a carousel item that is the next active item.\n *\n * @type {string|string[]}\n *\n * @see _nextClass\n */\n get nextClass() {\n return this._nextClass;\n }\n\n /**\n * The class(es) to apply to the autoplay button when the carousel is paused.\n *\n * @type {string|string[]}\n *\n * @see _playClass\n */\n get playClass() {\n return this._playClass;\n }\n\n /**\n * The class(es) to apply to the autoplay button when the carousel is playing.\n *\n * @type {string|string[]}\n *\n * @see _pauseClass\n */\n get pauseClass() {\n return this._pauseClass;\n }\n\n /**\n * The index of the currently active carousel item.\n *\n * @type {number}\n *\n * @see _currentItem\n */\n get currentItem() {\n return this._currentItem;\n }\n\n /**\n * The currently active carousel item.\n *\n * @readonly\n *\n * @type {HTMLElement}\n */\n get currentCarouselItem() {\n return this.dom.carouselItems[this.currentItem];\n }\n\n /**\n * The currently active carousel tab.\n *\n * @readonly\n *\n * @type {HTMLElement}\n */\n get currentCarouselTab() {\n return this.dom.carouselTabs[this.currentItem];\n }\n\n /**\n * A flag to indicate if the carousel is currently playing.\n *\n * @type {boolean}\n *\n * @see _autoplay\n */\n get autoplay() {\n return this._autoplay;\n }\n\n /**\n * The delay in milliseconds before transitioning slides.\n *\n * @type {number}\n *\n * @see _transitionDelay\n */\n get transitionDelay() {\n return this._transitionDelay;\n }\n\n /**\n * The duration time (in milliseconds) for the transition between carousel items.\n *\n * @type {number}\n *\n * @see _transitionDuration\n */\n get transitionDuration() {\n return this._transitionDuration;\n }\n\n /**\n * The label for the autoplay button when the carousel is paused.\n *\n * @type {string}\n *\n * @see _playText\n */\n get playText() {\n return this._playText;\n }\n\n /**\n * The label for the autoplay button when the carousel is playing.\n *\n * @type {string}\n *\n * @see _pauseText\n */\n get pauseText() {\n return this._pauseText;\n }\n\n /**\n * The prefix to use for CSS custom properties.\n *\n * @type {string}\n *\n * @see _prefix\n */\n get prefix() {\n return this._prefix;\n }\n\n /**\n * The key used to generate IDs throughout the accordion.\n *\n * @type {string}\n *\n * @see _key\n */\n get key() {\n return this._key;\n }\n\n /**\n * The current action being performed by the carousel.\n *\n * @type {string}\n *\n * @see _currentAction\n */\n get currentAction() {\n return this._currentAction;\n }\n\n /**\n * An array of error messages generated by the carousel.\n *\n * @readonly\n *\n * @type {string[]}\n *\n * @see _errors\n */\n get errors() {\n return this._errors;\n }\n\n set currentItem(value) {\n isValidType(\"number\", { value });\n\n if (value === this.currentItem) {\n return;\n }\n\n if (value < 0) {\n this._currentItem = 0;\n } else if (value >= this.dom.carouselItems.length) {\n this._currentItem = this.dom.carouselItems.length - 1;\n } else {\n this._currentItem = value;\n }\n\n // Keep the aria selected in sync with the current item.\n const tabs = this._dom.carousel.querySelectorAll(\n this.selectors.carouselTab\n );\n if (tabs) {\n this.dom.carouselItems.forEach((item, index) => {\n item.setAttribute(\"aria-selected\", index === this._currentItem);\n });\n }\n }\n\n set autoplay(value) {\n isValidType(\"boolean\", { value });\n\n if (this._autoplay !== value) {\n this._autoplay = value;\n }\n }\n\n set activeClass(value) {\n isValidClassList({ activeClass: value });\n\n if (this._activeClass !== value) {\n this._activeClass = value;\n }\n }\n\n set previousClass(value) {\n isValidClassList({ previousClass: value });\n\n if (this._previousClass !== value) {\n this._previousClass = value;\n }\n }\n\n set nextClass(value) {\n isValidClassList({ nextClass: value });\n\n if (this._nextClass !== value) {\n this._nextClass = value;\n }\n }\n\n set playClass(value) {\n isValidClassList({ playClass: value });\n\n if (this._playClass !== value) {\n this._playClass = value;\n }\n }\n\n set pauseClass(value) {\n isValidClassList({ pauseClass: value });\n\n if (this._pauseClass !== value) {\n this._pauseClass = value;\n }\n }\n\n set transitionDelay(value) {\n isValidType(\"number\", { value });\n\n if (value !== this.transitionDelay && value >= 0) {\n this._currentItem = value;\n }\n }\n\n set transitionDuration(value) {\n isValidType(\"number\", { value });\n\n if (this._transitionDuration !== value && value >= 0) {\n this._transitionDuration = value;\n this._setTransitionDuration();\n }\n }\n\n set playText(value) {\n isValidType(\"string\", { value });\n\n if (this._playText !== value) {\n this._playText = value;\n }\n }\n\n set pauseText(value) {\n isValidType(\"string\", { value });\n\n if (this._pauseText !== value) {\n this._pauseText = value;\n }\n }\n\n set prefix(value) {\n isValidType(\"string\", { value });\n\n if (this._prefix !== value) {\n this._prefix = value;\n }\n }\n\n set key(value) {\n isValidType(\"string\", { value });\n\n if (this._key !== value) {\n this._key = value;\n }\n }\n\n /**\n * Validates all aspects of the carousel to ensure proper functionality.\n *\n * @protected\n *\n * @return {boolean} - The results of the validation.\n */\n _validate() {\n let check = true;\n\n // HTML element checks.\n const htmlElementChecks = isValidInstance(HTMLElement, {\n carousel: this.dom.carousel,\n });\n\n if (!htmlElementChecks) {\n this._errors.push(htmlElementChecks.message);\n check = false;\n }\n\n // Query selector checks.\n const querySelectorChecks = isQuerySelector({\n carouselItemsSelector: this._selectors.carouselItems,\n carouselItemContainerSelector: this._selectors.carouselItemContainer,\n carouselControlsSelector: this._selectors.carouselControls,\n carouselControlContainerSelector:\n this._selectors.carouselControlContainer,\n carouselTabsSelector: this._selectors.carouselTabs,\n carouselTabContainerSelector: this._selectors.carouselTabContainer,\n autoplaySelector: this._selectors.autoplay,\n nextSelector: this._selectors.next,\n previousSelector: this._selectors.previous,\n });\n\n if (!querySelectorChecks) {\n this._errors.push(querySelectorChecks.message);\n check = false;\n }\n\n // Autoplay checks.\n const autoplayChecks = isValidType(\"boolean\", { autoplay: this.autoplay });\n\n if (!autoplayChecks) {\n this._errors.push(autoplayChecks.message);\n check = false;\n }\n\n // Check delay is a valid value.\n const delayCheck = isValidType(\"number\", {\n transitionDelay: this._transitionDelay,\n });\n\n if (!delayCheck) {\n this._errors.push(delayCheck.message);\n check = false;\n }\n\n // Check duration is a valid value.\n const durationCheck = isValidType(\"number\", {\n transitionDuration: this._transitionDuration,\n });\n\n if (!durationCheck) {\n this._errors.push(durationCheck.message);\n check = false;\n }\n\n // Active class checks.\n if (this._activeClass !== \"\") {\n const activeClassChecks = isValidClassList({\n activeClass: this._activeClass,\n });\n\n if (!activeClassChecks) {\n this._errors.push(activeClassChecks.message);\n check = false;\n }\n }\n\n // Previous class checks.\n if (this._previousClass !== \"\") {\n const previousClassChecks = isValidClassList({\n previousClass: this._previousClass,\n });\n\n if (!previousClassChecks) {\n this._errors.push(previousClassChecks.message);\n check = false;\n }\n }\n\n // Next class checks.\n if (this._nextClass !== \"\") {\n const nextClassChecks = isValidClassList({\n nextClass: this._nextClass,\n });\n\n if (!nextClassChecks) {\n this._errors.push(nextClassChecks.message);\n check = false;\n }\n }\n\n // Play class checks.\n if (this._playClass !== \"\") {\n const playClassChecks = isValidClassList({\n playClass: this._playClass,\n });\n\n if (!playClassChecks) {\n this._errors.push(playClassChecks.message);\n check = false;\n }\n }\n\n // Pause class checks.\n if (this._pauseClass !== \"\") {\n const pauseClassChecks = isValidClassList({\n pauseClass: this._pauseClass,\n });\n\n if (!pauseClassChecks) {\n this._errors.push(pauseClassChecks.message);\n check = false;\n }\n }\n\n // Play text checks.\n if (this._playText !== \"\") {\n const playTextChecks = isValidType(\"string\", {\n playText: this._playText,\n });\n\n if (!playTextChecks) {\n this._errors.push(playTextChecks.message);\n check = false;\n }\n }\n\n // Pause text checks.\n if (this._pauseText !== \"\") {\n const pauseTextChecks = isValidType(\"string\", {\n pauseText: this._pauseText,\n });\n\n if (!pauseTextChecks) {\n this._errors.push(pauseTextChecks.message);\n check = false;\n }\n }\n\n // Prefix checks.\n const prefixChecks = isValidType(\"string\", { prefix: this._prefix });\n\n if (!prefixChecks) {\n this._errors.push(prefixChecks.message);\n check = false;\n }\n\n return check;\n }\n\n /**\n * Sets DOM elements within the carousel.\n *\n * The carousel element _cannot_ be set through this method.\n *\n * @protected\n *\n * @param {string} elementType - The type of element to populate.\n * @param {HTMLElement} [base = this.dom.carousel] - The element used as the base for the querySelector.\n * @param {boolean} [overwrite = true] - A flag to set if the existing elements will be overwritten.\n */\n _setDOMElementType(elementType, base = this.dom.carousel, overwrite = true) {\n if (typeof this.selectors[elementType] === \"string\") {\n if (elementType === \"carousel\") {\n throw new Error(\n `Graupl Carousel: \"${elementType}\" element cannot be set through _setDOMElementType.`\n );\n }\n\n if (base !== this.dom.carousel) isValidInstance(HTMLElement, { base });\n\n if (Array.isArray(this._dom[elementType])) {\n // Get all the elements matching the selector in the base.\n const domElements = Array.from(\n base.querySelectorAll(this.selectors[elementType])\n );\n\n // Filter the elements so only direct children of the base are kept.\n const filteredElements = domElements.filter(\n (item) => item.parentElement === base\n );\n\n if (overwrite) {\n this._dom[elementType] = filteredElements;\n } else {\n this._dom[elementType] = [\n ...this._dom[elementType],\n ...filteredElements,\n ];\n }\n } else {\n // Get the single element matching the selector in the base.\n const domElement = base.querySelector(this.selectors[elementType]);\n\n // Ensure the element is a direct child of the base.\n if (domElement && domElement.parentElement !== base) {\n return;\n }\n\n if (overwrite) {\n this._dom[elementType] = domElement;\n }\n }\n } else {\n throw new Error(\n `Graupl Carousel: \"${elementType}\" is not a valid element type within the carousel.`\n );\n }\n }\n\n /**\n * Resets DOM elements within the menu.\n *\n * The carousel element _cannot_ be reset through this method.\n *\n * @protected\n *\n * @param {string} elementType - The type of element to clear.\n */\n _resetDOMElementType(elementType) {\n if (typeof this.selectors[elementType] === \"string\") {\n if (elementType === \"carousel\") {\n throw new Error(\n `Graupl Carousel: \"${elementType}\" element cannot be reset through _resetDOMElementType.`\n );\n }\n\n if (Array.isArray(this._dom[elementType])) {\n this._dom[elementType] = [];\n } else {\n this._dom[elementType] = null;\n }\n } else {\n throw new Error(\n `Graupl Carousel: \"${elementType}\" is not a valid element type within the carousel.`\n );\n }\n }\n\n /**\n * Sets all DOM elements within the carousel.\n *\n * Utilizes _setDOMElementType and _resetDOMElementType.\n *\n * @protected\n */\n _setDOMElements() {\n this._setDOMElementType(\"carouselItemContainer\");\n this._setDOMElementType(\"carouselControlContainer\");\n this._setDOMElementType(\"carouselTabContainer\");\n\n if (this.dom.carouselItemContainer) {\n this._setDOMElementType(\"carouselItems\", this.dom.carouselItemContainer);\n }\n if (this.dom.carouselControlContainer) {\n this._setDOMElementType(\n \"carouselControls\",\n this.dom.carouselControlContainer\n );\n this._setDOMElementType(\"autoplay\", this.dom.carouselControlContainer);\n this._setDOMElementType(\"next\", this.dom.carouselControlContainer);\n this._setDOMElementType(\"previous\", this.dom.carouselControlContainer);\n }\n\n if (this._dom.carouselTabContainer) {\n this._setDOMElementType(\"carouselTabs\", this.dom.carouselTabContainer);\n }\n }\n\n /**\n * Generates a key for the carousel.\n *\n * @param {boolean} [regenerate = false] - A flag to determine if the key should be regenerated.\n */\n _generateKey(regenerate = false) {\n if (this.key === \"\" || regenerate) {\n this.key = Math.random()\n .toString(36)\n .replace(/[^a-z]+/g, \"\")\n .substring(0, 10);\n }\n }\n\n /**\n * Sets the IDs of the carousel and it's children if they do not already exist.\n *\n * The generated IDs use the key and follow the format:\n * - carousel: `carousel-${key}`\n * - carousel items: `carousel-item-${key}-${index}`\n * - carousel tabs: `carousel-tab-${key}-${index}`\n */\n _setIds() {\n this.dom.carousel.id = this.dom.carousel.id || `carousel-${this.key}`;\n\n this.dom.carouselItems.forEach((item, index) => {\n item.id = item.id || `carousel-item-${this.key}-${index}`;\n });\n\n this.dom.carouselTabs.forEach((tab, index) => {\n tab.id = tab.id || `carousel-tab-${this.key}-${index}`;\n });\n }\n\n /**\n * Sets the aria attributes for the carousel.\n */\n _setAriaAttributes() {\n // Make sure the carousel has a proper role.\n // Sections and role=\"region\" are acceptable in certain cases, so\n // we only need to fallback to role=\"group\" if neither of those are present.\n if (\n !isTag(\"section\", { carousel: this.dom.carousel }) &&\n !this.dom.carousel.getAttribute(\"role\") !== \"region\"\n ) {\n this.dom.carousel.setAttribute(\"role\", \"group\");\n }\n\n // Set the role description for the carousel.\n this._dom.carousel.setAttribute(\"aria-roledescription\", \"carousel\");\n\n if (this.dom.carouselTabContainer) {\n this.dom.carouselTabContainer.setAttribute(\"role\", \"tablist\");\n }\n\n this.dom.carouselTabs.forEach((tab, index) => {\n if (!isTag(\"button\", { tab: tab })) {\n tab.setAttribute(\"role\", \"button\");\n }\n\n tab.setAttribute(\"aria-selected\", index === 0);\n tab.setAttribute(\"aria-controls\", this.dom.carouselItems[index].id);\n });\n }\n\n /**\n * Sets the interval for autoplaying the carousel.\n *\n * @protected\n */\n _setInterval() {\n this._clearInterval();\n\n this._autoplayInterval = setInterval(() => {\n this.activateNextItem();\n }, this.transitionDelay);\n }\n\n /**\n * Clears the interval for autoplaying the carousel.\n *\n * @protected\n */\n _clearInterval() {\n clearInterval(this._autoplayInterval);\n }\n\n /**\n * Handles the autoplay functionality of the carousel.\n *\n * - Adds the appropriate class to the autoplay button.\n * - Removes the appropriate class from the autoplay button.\n * - Sets the appropriate aria-label for the autoplay button.\n * - Sets the appropriate aria-live for the carousel.\n * - Sets/clears the interval for autoplaying the carousel.\n *\n * @protected\n */\n _handleAutoplay() {\n if (this.autoplay) {\n addClass(this.pauseClass, this.dom.autoplay);\n removeClass(this.playClass, this.dom.autoplay);\n\n this.dom.autoplay.setAttribute(\"aria-label\", this.pauseText);\n this.dom.carousel.setAttribute(\"aria-live\", \"off\");\n\n this._setInterval();\n } else {\n addClass(this.playClass, this.dom.autoplay);\n removeClass(this.pauseClass, this.dom.autoplay);\n\n this.dom.autoplay.setAttribute(\"aria-label\", this.playText);\n this.dom.carousel.setAttribute(\"aria-live\", \"polite\");\n\n this._clearInterval();\n }\n }\n\n /**\n * Handles the focus events throughout the carousel for proper use.\n *\n * - Adds a `focusin` listener to the carousel element to pause autoplay.\n * - Adds a `focusout` listener to the carousel element to resume autoplay.\n */\n _handleFocus() {\n // Pause autoplay when anything in the carousel is focused.\n this.dom.carousel.addEventListener(\"focusin\", () => {\n if (this.autoplay) {\n this._clearInterval();\n }\n });\n\n this.dom.carousel.addEventListener(\"focusout\", () => {\n if (this.autoplay) {\n this._setInterval();\n }\n });\n }\n\n /**\n * Handles the click events throughout the carousel.\n *\n * - Adds a `pointerup` listener to the next control to activate the next item.\n * - Adds a `pointerup` listener to the previous control to activate the previous item.\n * - Adds a `pointerup` listener to the autoplay control to toggle autoplay.\n * - Adds a `pointerup` listener to each tab control to activate the corresponding item.\n */\n _handleClick() {\n this.dom.next.addEventListener(\"pointerup\", () => {\n this.activateNextItem();\n });\n\n this.dom.previous.addEventListener(\"pointerup\", () => {\n this.activatePreviousItem();\n });\n\n this.dom.autoplay.addEventListener(\"pointerup\", () => {\n this.toggleAutoplay();\n });\n\n this.dom.carouselTabs.forEach((tab, index) => {\n tab.addEventListener(\"pointerup\", () => {\n if (this.currentItem > index) {\n this._currentAction = \"previous\";\n } else {\n this._currentAction = \"next\";\n }\n\n this.activateItem(index);\n });\n });\n }\n\n /**\n * Handles the hover events throughout the carousel for proper use.\n *\n * - Adds a `pointerover` listener to the carousel to pause autoplay.\n * - Adds a `pointerleave` listener to the carousel to resume autoplay.\n */\n _handleHover() {\n // Pause autoplay when anything in the carousel is hovered.\n this.dom.carousel.addEventListener(\"pointerover\", () => {\n if (this.autoplay) {\n this._clearInterval();\n }\n });\n\n this.dom.carousel.addEventListener(\"pointerleave\", () => {\n if (this.autoplay) {\n this._setInterval();\n }\n });\n }\n\n /**\n * Handles keydown events throughout the carousel item for proper use.\n *\n * - Adds a `keydown` listener to all control elements.\n * - Prevents Space and Enter key events.\n * - Adds a `keydown` listener to all tab elements.\n * - Prevents Space and Enter key events.\n */\n _handleKeydown() {\n this.dom.carouselControls.forEach((control) => {\n control.addEventListener(\"keydown\", (event) => {\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n // Prevent the default action of the event.\n preventEvent(event);\n\n break;\n }\n });\n });\n\n this.dom.carouselTabs.forEach((tab) => {\n tab.addEventListener(\"keydown\", (event) => {\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n // Prevent the default action of the event.\n preventEvent(event);\n\n break;\n }\n });\n });\n }\n\n /**\n * Handles keyup events throughout the carousel item for proper use.\n *\n * - Adds a `keyup` listener to all control elements.\n * - Activates the next/previous item depending on which control is pressed.\n * - Toggles autoplay if the autoplay control is pressed.\n *\n */\n _handleKeyup() {\n // Activate the next item if the space or enter key on the next control.\n this.dom.next.addEventListener(\"keyup\", (event) => {\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n this.activateNextItem();\n\n // Prevent the default action of the event.\n preventEvent(event);\n\n break;\n }\n });\n\n // Activate the previous item if the space or enter key on the previous control.\n this.dom.previous.addEventListener(\"keyup\", (event) => {\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n this.activatePreviousItem();\n\n // Prevent the default action of the event.\n preventEvent(event);\n\n break;\n }\n });\n\n // Toggle autoplay if the space or enter key on the autoplay control.\n this.dom.autoplay.addEventListener(\"keyup\", (event) => {\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n this.toggleAutoplay();\n\n // Prevent the default action of the event.\n preventEvent(event);\n\n break;\n }\n });\n\n // Activate the item if the space or enter key on the tab control.\n this.dom.carouselTabs.forEach((tab, index) => {\n tab.addEventListener(\"keyup\", (event) => {\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n this.activateItem(index);\n\n // Prevent the default action of the event.\n preventEvent(event);\n\n break;\n }\n });\n });\n }\n\n /**\n * Sets the transition duration for the carousel as a CSS custom property.\n *\n * The custom property is set as `--graupl-carousel-transition-duration`.\n *\n * @protected\n */\n _setTransitionDuration() {\n this.dom.carousel.style.setProperty(\n `--${this.prefix}carousel-transition-duration`,\n `${this.transitionDuration}ms`\n );\n }\n\n /**\n * Activates the current carousel item.\n *\n * @public\n */\n activateCurrentItem() {\n addClass(this.activeClass, this.currentCarouselItem);\n\n if (this.currentCarouselTab) {\n this.currentCarouselTab.setAttribute(\"aria-selected\", true);\n addClass(this.activeClass, this.currentCarouselTab);\n }\n }\n\n /**\n * Deactivates the current carousel item.\n *\n * @public\n */\n deactivateCurrentItem() {\n removeClass(this.activeClass, this.currentCarouselItem);\n\n if (this.currentCarouselTab) {\n this.currentCarouselTab.setAttribute(\"aria-selected\", false);\n removeClass(this.activeClass, this.currentCarouselTab);\n }\n }\n\n /**\n * Activates the carousel item at a given index.\n *\n * @public\n *\n * @param {number} index - The index of the carousel item to activate.\n */\n activateItem(index) {\n const currentIndex = this.currentItem;\n\n this.dom.carousel.dataset.grauplAction = this._currentAction;\n\n if (this.autoplay) {\n this._clearInterval();\n }\n\n addClass(this.previousClass, this.currentCarouselItem);\n addClass(this.nextClass, this.dom.carouselItems[index]);\n\n requestAnimationFrame(() => {\n this.deactivateCurrentItem();\n this.currentItem = index;\n this.activateCurrentItem();\n\n requestAnimationFrame(() => {\n setTimeout(() => {\n removeClass(this.previousClass, this.dom.carouselItems[currentIndex]);\n removeClass(this.nextClass, this.currentCarouselItem);\n }, this.transitionDuration);\n });\n });\n\n if (this.autoplay) {\n this._setInterval();\n }\n }\n\n /**\n * Activates the first carousel item.\n *\n * @public\n */\n activateFirstItem() {\n this.activateItem(0);\n }\n\n /**\n * Activates the last carousel item.\n *\n * @public\n */\n activateLastItem() {\n this.activateItem(this.dom.carouselItems.length - 1);\n }\n\n /**\n * Activates the next carousel item.\n *\n * @public\n */\n activateNextItem() {\n this._currentAction = \"next\";\n\n if (this.currentItem + 1 >= this.dom.carouselItems.length) {\n this.activateFirstItem();\n } else {\n this.activateItem(this.currentItem + 1);\n }\n }\n\n /**\n * Activates the previous carousel item.\n *\n * @public\n */\n activatePreviousItem() {\n this._currentAction = \"previous\";\n\n if (this.currentItem - 1 < 0) {\n this.activateLastItem();\n } else {\n this.activateItem(this.currentItem - 1);\n }\n }\n\n /**\n * Toggles autoplay on the carousel.\n *\n * @public\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eAAiB,OAElB,KAAKmD,YAAc,GAAK,KAAKL,IAAInE,cAAc6E,OACjD,KAAKpB,kBAAAA,EAEL,KAAK8E,aAAa,KAAK/D,YAAc,CAAA,CAEzC,CAOA6D,sBAAuB,CACrB,KAAKhH,eAAiB,WAElB,KAAKmD,YAAc,EAAI,EACzB,KAAK2E,iBAAAA,EAEL,KAAKZ,aAAa,KAAK/D,YAAc,CAAA,CAEzC,CAOA8D,gBAAiB,CACf,KAAKhI,SAAAA,CAAY,KAAKA,SAEtB,KAAKoD,gBAAAA,CACP,CACF,EAEA,EAAe7D"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
var Carousel=function(){function l(t,e){t===""||t.length===0||(typeof t=="string"?e.classList.add(t):e.classList.add(...t))}function u(t,e){t===""||t.length===0||(typeof t=="string"?e.classList.remove(t):e.classList.remove(...t))}function c(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(r=>s[r]===!0)||""}catch{return""}}function h(t){t.preventDefault(),t.stopPropagation()}function m(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 r=typeof e[s];throw new TypeError(`${s} must be an instance of ${t.name}. "${r}" given.`)}return{status:!0,error:null}}catch(s){return{status:!1,error:s}}}function i(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 r=typeof e[s];if(r!==t)throw new TypeError(`${s} must be a ${t}. "${r}" given.`)}return{status:!0,error:null}}catch(s){return{status:!1,error:s}}}function _(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 o(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(r=>{if(typeof r!="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 r={};r[e]=t[e],_(r)}}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function d(t,e){if(i("string",{tagName:t}).status&&m(HTMLElement,e).status){const s=t.toLowerCase();let r=!0;for(const n in e)e[n].tagName.toLowerCase()!==s&&(r=!1);return r}else return!1}function C(t=null){window.Graupl=window.Graupl||{},i("string",{type:t})&&(window.Graupl[t]=window.Graupl[t]||{})}function g(t=null){return i("string",{type:t})?window.Graupl[t]:window.Graupl}function I(t,e={}){i("string",{type:t})&&i("object",{data:e})&&(window.Graupl[t]=e)}function b(t){i("string",{type:t})&&(window.Graupl[t]={})}function v(t,e,s){i("string",{type:t,key:e})&&(window.Graupl[t][e]=s)}function T(t,e){return i("string",{type:t,key:e})?window.Graupl[t][e]:null}function E(t,e){i("string",{type:t,key:e})&&delete window.Graupl[t][e]}var y={initializeStorage:C,getStorage:g,setStorage:I,clearStorage:b,pushToStorage:v,getFromStorage:T,removeFromStorage:E},w=class{_dom={carousel:null,carouselItems:[],carouselItemContainer:null,carouselControls:[],carouselControlContainer:null,carouselTabs:[],carouselTabContainer:null,autoplay:null,next:null,previous:null};_selectors={carouselItems:"",carouselItemContainer:"",carouselControls:"",carouselControlContainer:"",carouselTabs:"",carouselTabContainer:"",autoplay:"",next:"",previous:""};_activeClass="active";_previousClass="previous";_nextClass="next";_playClass="play";_pauseClass="pause";_currentItem=0;_autoplay=!0;_transitionDelay=1e4;_transitionDuration=500;_playText="Play";_pauseText="Pause";_currentAction="next";_autoplayInterval=null;_prefix="graupl-";_key="";_errors=[];constructor({carouselElement:t,carouselItemSelector:e=".carousel-item",carouselItemContainerSelector:s=".carousel-item-container",carouselControlSelector:r=".carousel-control",carouselControlContainerSelector:n=".carousel-control-container",carouselTabSelector:p=".carousel-tab",carouselTabContainerSelector:f=".carousel-tab-container",autoplaySelector:a=".autoplay",nextSelector:k=".next",previousSelector:A=".previous",activeClass:D="active",previousClass:S="previous",nextClass:L="next",playClass:$="play",pauseClass:M="pause",autoplay:G=!0,transitionDelay:O=1e4,transitionDuration:j=500,playText:P="Play",pauseText:F="Pause",prefix:V="graupl-",key:q=null,initialize:H=!1}){this._dom.carousel=t,this._selectors.carouselItems=e,this._selectors.carouselItemContainer=s,this._selectors.carouselControls=r,this._selectors.carouselControlContainer=n,this._selectors.carouselTabs=p,this._selectors.carouselTabContainer=f,this._selectors.autoplay=a,this._selectors.next=k,this._selectors.previous=A,this._activeClass=D||"",this._previousClass=S||"",this._nextClass=L||"",this._playClass=$||"",this._pauseClass=M||"",this._autoplay=G,this._transitionDelay=O,this._transitionDuration=j,this._playText=P||"",this._pauseText=F||"",this._prefix=V||"",this._key=q||"",H&&this.initialize()}initialize(){try{if(!this._validate())throw new Error(`Graupl Carousel: cannot initialize carousel. The following errors have been found:
|
|
2
|
-
- ${this.errors.join(`
|
|
3
|
-
- `)}`);this._generateKey(),this._setDOMElements(),this._setIds(),this._setAriaAttributes(),this.activateFirstItem(),this._handleAutoplay(),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup(),this._setTransitionDuration(),y.initializeStorage("carousels"),y.pushToStorage("carousels",this.dom.carousel.id,this)}catch(t){console.error(t)}}get dom(){return this._dom}get selectors(){return this._selectors}get activeClass(){return this._activeClass}get previousClass(){return this._previousClass}get nextClass(){return this._nextClass}get playClass(){return this._playClass}get pauseClass(){return this._pauseClass}get currentItem(){return this._currentItem}get currentCarouselItem(){return this.dom.carouselItems[this.currentItem]}get currentCarouselTab(){return this.dom.carouselTabs[this.currentItem]}get autoplay(){return this._autoplay}get transitionDelay(){return this._transitionDelay}get transitionDuration(){return this._transitionDuration}get playText(){return this._playText}get pauseText(){return this._pauseText}get prefix(){return this._prefix}get key(){return this._key}get currentAction(){return this._currentAction}get errors(){return this._errors}set currentItem(t){if(i("number",{value:t}),t===this.currentItem)return;t<0?this._currentItem=0:t>=this.dom.carouselItems.length?this._currentItem=this.dom.carouselItems.length-1:this._currentItem=t,this._dom.carousel.querySelectorAll(this.selectors.carouselTab)&&this.dom.carouselItems.forEach((s,r)=>{s.setAttribute("aria-selected",r===this._currentItem)})}set autoplay(t){i("boolean",{value:t}),this._autoplay!==t&&(this._autoplay=t)}set activeClass(t){o({activeClass:t}),this._activeClass!==t&&(this._activeClass=t)}set previousClass(t){o({previousClass:t}),this._previousClass!==t&&(this._previousClass=t)}set nextClass(t){o({nextClass:t}),this._nextClass!==t&&(this._nextClass=t)}set playClass(t){o({playClass:t}),this._playClass!==t&&(this._playClass=t)}set pauseClass(t){o({pauseClass:t}),this._pauseClass!==t&&(this._pauseClass=t)}set transitionDelay(t){i("number",{value:t}),t!==this.transitionDelay&&t>=0&&(this._currentItem=t)}set transitionDuration(t){i("number",{value:t}),this._transitionDuration!==t&&t>=0&&(this._transitionDuration=t,this._setTransitionDuration())}set playText(t){i("string",{value:t}),this._playText!==t&&(this._playText=t)}set pauseText(t){i("string",{value:t}),this._pauseText!==t&&(this._pauseText=t)}set prefix(t){i("string",{value:t}),this._prefix!==t&&(this._prefix=t)}set key(t){i("string",{value:t}),this._key!==t&&(this._key=t)}_validate(){let t=!0;const e=m(HTMLElement,{carousel:this.dom.carousel});e||(this._errors.push(e.message),t=!1);const s=_({carouselItemsSelector:this._selectors.carouselItems,carouselItemContainerSelector:this._selectors.carouselItemContainer,carouselControlsSelector:this._selectors.carouselControls,carouselControlContainerSelector:this._selectors.carouselControlContainer,carouselTabsSelector:this._selectors.carouselTabs,carouselTabContainerSelector:this._selectors.carouselTabContainer,autoplaySelector:this._selectors.autoplay,nextSelector:this._selectors.next,previousSelector:this._selectors.previous});s||(this._errors.push(s.message),t=!1);const r=i("boolean",{autoplay:this.autoplay});r||(this._errors.push(r.message),t=!1);const n=i("number",{transitionDelay:this._transitionDelay});n||(this._errors.push(n.message),t=!1);const p=i("number",{transitionDuration:this._transitionDuration});if(p||(this._errors.push(p.message),t=!1),this._activeClass!==""){const a=o({activeClass:this._activeClass});a||(this._errors.push(a.message),t=!1)}if(this._previousClass!==""){const a=o({previousClass:this._previousClass});a||(this._errors.push(a.message),t=!1)}if(this._nextClass!==""){const a=o({nextClass:this._nextClass});a||(this._errors.push(a.message),t=!1)}if(this._playClass!==""){const a=o({playClass:this._playClass});a||(this._errors.push(a.message),t=!1)}if(this._pauseClass!==""){const a=o({pauseClass:this._pauseClass});a||(this._errors.push(a.message),t=!1)}if(this._playText!==""){const a=i("string",{playText:this._playText});a||(this._errors.push(a.message),t=!1)}if(this._pauseText!==""){const a=i("string",{pauseText:this._pauseText});a||(this._errors.push(a.message),t=!1)}const f=i("string",{prefix:this._prefix});return f||(this._errors.push(f.message),t=!1),t}_setDOMElementType(t,e=this.dom.carousel,s=!0){if(typeof this.selectors[t]=="string"){if(t==="carousel")throw new Error(`Graupl Carousel: "${t}" element cannot be set through _setDOMElementType.`);if(e!==this.dom.carousel&&m(HTMLElement,{base:e}),Array.isArray(this._dom[t])){const n=Array.from(e.querySelectorAll(this.selectors[t])).filter(p=>p.parentElement===e);s?this._dom[t]=n:this._dom[t]=[...this._dom[t],...n]}else{const r=e.querySelector(this.selectors[t]);if(r&&r.parentElement!==e)return;s&&(this._dom[t]=r)}}else throw new Error(`Graupl Carousel: "${t}" is not a valid element type within the carousel.`)}_resetDOMElementType(t){if(typeof this.selectors[t]=="string"){if(t==="carousel")throw new Error(`Graupl Carousel: "${t}" element cannot be reset through _resetDOMElementType.`);Array.isArray(this._dom[t])?this._dom[t]=[]:this._dom[t]=null}else throw new Error(`Graupl Carousel: "${t}" is not a valid element type within the carousel.`)}_setDOMElements(){this._setDOMElementType("carouselItemContainer"),this._setDOMElementType("carouselControlContainer"),this._setDOMElementType("carouselTabContainer"),this.dom.carouselItemContainer&&this._setDOMElementType("carouselItems",this.dom.carouselItemContainer),this.dom.carouselControlContainer&&(this._setDOMElementType("carouselControls",this.dom.carouselControlContainer),this._setDOMElementType("autoplay",this.dom.carouselControlContainer),this._setDOMElementType("next",this.dom.carouselControlContainer),this._setDOMElementType("previous",this.dom.carouselControlContainer)),this._dom.carouselTabContainer&&this._setDOMElementType("carouselTabs",this.dom.carouselTabContainer)}_generateKey(t=!1){(this.key===""||t)&&(this.key=Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,10))}_setIds(){this.dom.carousel.id=this.dom.carousel.id||`carousel-${this.key}`,this.dom.carouselItems.forEach((t,e)=>{t.id=t.id||`carousel-item-${this.key}-${e}`}),this.dom.carouselTabs.forEach((t,e)=>{t.id=t.id||`carousel-tab-${this.key}-${e}`})}_setAriaAttributes(){!d("section",{carousel:this.dom.carousel})&&!this.dom.carousel.getAttribute("role")!=="region"&&this.dom.carousel.setAttribute("role","group"),this._dom.carousel.setAttribute("aria-roledescription","carousel"),this.dom.carouselTabContainer&&this.dom.carouselTabContainer.setAttribute("role","tablist"),this.dom.carouselTabs.forEach((t,e)=>{d("button",{tab:t})||t.setAttribute("role","button"),t.setAttribute("aria-selected",e===0),t.setAttribute("aria-controls",this.dom.carouselItems[e].id)})}_setInterval(){this._clearInterval(),this._autoplayInterval=setInterval(()=>{this.activateNextItem()},this.transitionDelay)}_clearInterval(){clearInterval(this._autoplayInterval)}_handleAutoplay(){this.autoplay?(l(this.pauseClass,this.dom.autoplay),u(this.playClass,this.dom.autoplay),this.dom.autoplay.setAttribute("aria-label",this.pauseText),this.dom.carousel.setAttribute("aria-live","off"),this._setInterval()):(l(this.playClass,this.dom.autoplay),u(this.pauseClass,this.dom.autoplay),this.dom.autoplay.setAttribute("aria-label",this.playText),this.dom.carousel.setAttribute("aria-live","polite"),this._clearInterval())}_handleFocus(){this.dom.carousel.addEventListener("focusin",()=>{this.autoplay&&this._clearInterval()}),this.dom.carousel.addEventListener("focusout",()=>{this.autoplay&&this._setInterval()})}_handleClick(){this.dom.next.addEventListener("pointerup",()=>{this.activateNextItem()}),this.dom.previous.addEventListener("pointerup",()=>{this.activatePreviousItem()}),this.dom.autoplay.addEventListener("pointerup",()=>{this.toggleAutoplay()}),this.dom.carouselTabs.forEach((t,e)=>{t.addEventListener("pointerup",()=>{this.currentItem>e?this._currentAction="previous":this._currentAction="next",this.activateItem(e)})})}_handleHover(){this.dom.carousel.addEventListener("pointerover",()=>{this.autoplay&&this._clearInterval()}),this.dom.carousel.addEventListener("pointerleave",()=>{this.autoplay&&this._setInterval()})}_handleKeydown(){this.dom.carouselControls.forEach(t=>{t.addEventListener("keydown",e=>{switch(c(e)){case"Space":case"Enter":h(e);break}})}),this.dom.carouselTabs.forEach(t=>{t.addEventListener("keydown",e=>{switch(c(e)){case"Space":case"Enter":h(e);break}})})}_handleKeyup(){this.dom.next.addEventListener("keyup",t=>{switch(c(t)){case"Space":case"Enter":this.activateNextItem(),h(t);break}}),this.dom.previous.addEventListener("keyup",t=>{switch(c(t)){case"Space":case"Enter":this.activatePreviousItem(),h(t);break}}),this.dom.autoplay.addEventListener("keyup",t=>{switch(c(t)){case"Space":case"Enter":this.toggleAutoplay(),h(t);break}}),this.dom.carouselTabs.forEach((t,e)=>{t.addEventListener("keyup",s=>{switch(c(s)){case"Space":case"Enter":this.activateItem(e),h(s);break}})})}_setTransitionDuration(){this.dom.carousel.style.setProperty(`--${this.prefix}carousel-transition-duration`,`${this.transitionDuration}ms`)}activateCurrentItem(){l(this.activeClass,this.currentCarouselItem),this.currentCarouselTab&&(this.currentCarouselTab.setAttribute("aria-selected",!0),l(this.activeClass,this.currentCarouselTab))}deactivateCurrentItem(){u(this.activeClass,this.currentCarouselItem),this.currentCarouselTab&&(this.currentCarouselTab.setAttribute("aria-selected",!1),u(this.activeClass,this.currentCarouselTab))}activateItem(t){const e=this.currentItem;this.dom.carousel.dataset.grauplAction=this._currentAction,this.autoplay&&this._clearInterval(),l(this.previousClass,this.currentCarouselItem),l(this.nextClass,this.dom.carouselItems[t]),requestAnimationFrame(()=>{this.deactivateCurrentItem(),this.currentItem=t,this.activateCurrentItem(),requestAnimationFrame(()=>{setTimeout(()=>{u(this.previousClass,this.dom.carouselItems[e]),u(this.nextClass,this.currentCarouselItem)},this.transitionDuration)})}),this.autoplay&&this._setInterval()}activateFirstItem(){this.activateItem(0)}activateLastItem(){this.activateItem(this.dom.carouselItems.length-1)}activateNextItem(){this._currentAction="next",this.currentItem+1>=this.dom.carouselItems.length?this.activateFirstItem():this.activateItem(this.currentItem+1)}activatePreviousItem(){this._currentAction="previous",this.currentItem-1<0?this.activateLastItem():this.activateItem(this.currentItem-1)}toggleAutoplay(){this.autoplay=!this.autoplay,this._handleAutoplay()}},x=w;return x}();
|
|
4
|
-
|
|
5
|
-
//# sourceMappingURL=carousel.iife.js.map
|