@graupl/graupl 1.0.0-beta.44 → 1.0.0-beta.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/component/breadcrumb.css +1 -1
- package/dist/css/component/breadcrumb.css.map +1 -1
- package/dist/css/component/tabs.css +1 -1
- package/dist/css/component/tabs.css.map +1 -1
- package/dist/css/component/tooltip.css +2 -0
- package/dist/css/component/tooltip.css.map +1 -0
- package/dist/css/component.css +1 -1
- package/dist/css/component.css.map +1 -1
- package/dist/css/graupl.css +1 -1
- package/dist/css/graupl.css.map +1 -1
- package/dist/js/breadcrumb.js +2 -2
- package/dist/js/breadcrumb.js.map +1 -1
- package/dist/js/carousel.js +2 -2
- package/dist/js/carousel.js.map +1 -1
- package/dist/js/component/breadcrumb.cjs.js +2 -2
- package/dist/js/component/breadcrumb.cjs.js.map +1 -1
- package/dist/js/component/breadcrumb.es.js +2 -2
- package/dist/js/component/breadcrumb.es.js.map +1 -1
- package/dist/js/component/breadcrumb.iife.js +2 -2
- package/dist/js/component/breadcrumb.iife.js.map +1 -1
- package/dist/js/component/carousel.cjs.js +2 -2
- package/dist/js/component/carousel.cjs.js.map +1 -1
- package/dist/js/component/carousel.es.js +2 -2
- package/dist/js/component/carousel.es.js.map +1 -1
- package/dist/js/component/carousel.iife.js +2 -2
- package/dist/js/component/carousel.iife.js.map +1 -1
- package/dist/js/component/disclosure.cjs.js +2 -2
- package/dist/js/component/disclosure.cjs.js.map +1 -1
- package/dist/js/component/disclosure.es.js +2 -2
- package/dist/js/component/disclosure.es.js.map +1 -1
- package/dist/js/component/disclosure.iife.js +2 -2
- package/dist/js/component/disclosure.iife.js.map +1 -1
- package/dist/js/component/tooltip.cjs.js +5 -0
- package/dist/js/component/tooltip.cjs.js.map +1 -0
- package/dist/js/component/tooltip.es.js +5 -0
- package/dist/js/component/tooltip.es.js.map +1 -0
- package/dist/js/component/tooltip.iife.js +5 -0
- package/dist/js/component/tooltip.iife.js.map +1 -0
- package/dist/js/disclosure.js +2 -2
- package/dist/js/disclosure.js.map +1 -1
- package/dist/js/generator/breadcrumb.cjs.js +2 -2
- package/dist/js/generator/breadcrumb.cjs.js.map +1 -1
- package/dist/js/generator/breadcrumb.es.js +2 -2
- package/dist/js/generator/breadcrumb.es.js.map +1 -1
- package/dist/js/generator/breadcrumb.iife.js +2 -2
- package/dist/js/generator/breadcrumb.iife.js.map +1 -1
- package/dist/js/generator/carousel.cjs.js +2 -2
- package/dist/js/generator/carousel.cjs.js.map +1 -1
- package/dist/js/generator/carousel.es.js +2 -2
- package/dist/js/generator/carousel.es.js.map +1 -1
- package/dist/js/generator/carousel.iife.js +2 -2
- package/dist/js/generator/carousel.iife.js.map +1 -1
- package/dist/js/generator/disclosure.cjs.js +2 -2
- package/dist/js/generator/disclosure.cjs.js.map +1 -1
- package/dist/js/generator/disclosure.es.js +2 -2
- package/dist/js/generator/disclosure.es.js.map +1 -1
- package/dist/js/generator/disclosure.iife.js +2 -2
- package/dist/js/generator/disclosure.iife.js.map +1 -1
- package/dist/js/generator/tooltip.cjs.js +5 -0
- package/dist/js/generator/tooltip.cjs.js.map +1 -0
- package/dist/js/generator/tooltip.es.js +5 -0
- package/dist/js/generator/tooltip.es.js.map +1 -0
- package/dist/js/generator/tooltip.iife.js +5 -0
- package/dist/js/generator/tooltip.iife.js.map +1 -0
- package/dist/js/graupl.js +2 -2
- package/dist/js/graupl.js.map +1 -1
- package/dist/js/tooltip.js +5 -0
- package/dist/js/tooltip.js.map +1 -0
- package/package.json +1 -1
- package/scss/component/tooltip.scss +3 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltip.iife.js","names":["isValidInstance","contructor","elements","shouldThrow","result","status","errors","elementsType","TypeError","key","elementType","name","error","push","isValidType","type","values","valuesType","valueType","isQuerySelector","Error","document","querySelector","isValidClassList","Array","isArray","forEach","value","obj","isValidState","validStates","includes","join","isValidEvent","validEvents","isValidHoverType","validTypes","isTag","tagName","HTMLElement","tag","toLowerCase","isValidEventType","eventType","component","Object","prototype","hasOwnProperty","call","events","constructor","keys","hasValidRootDOMElement","_dom","_rootDOMElement","addClass","className","element","length","classList","add","removeClass","remove","selectAllFocusableElements","context","document","fn","querySelector","elements","Array","from","querySelectorAll","tabbableElements","filter","check","getAttribute","selectFirstFocusableElement","selectLastFocusableElement","selectNextFocusableElement","index","indexOf","selectPreviousFocusableElement","keyPress","event","key","keyCode","keys","Enter","Space","Escape","ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End","Character","isNaN","match","Tab","Asterisk","Object","find","preventEvent","preventDefault","stopPropagation","isValidType","isValidInstance","StorageManager","_scope","_type","_storage","_crush","constructor","scope","type","crush","initialize","window","storage","shouldThrow","status","get","key","typeCheck","Error","message","keyCheck","set","data","dataCheck","clear","dispose","isValidInstance","isValidType","isValidClassList","isQuerySelector","isValidState","isValidEvent","isValidEventType","hasValidRootDOMElement","StorageManager","addClass","removeClass","Component","_dom","_rootDOMElement","_protectedDOMElements","_selectors","_elements","_classes","initialize","_durations","_delays","_focusState","_currentEvent","_breakpoint","_mediaQueryString","_mediaQueryList","_mediaQueryListEventCallback","event","matches","_intervals","_timeouts","_listeners","_events","CustomEvent","detail","component","preinitialize","postinitialize","validate","prevalidate","postvalidate","_prefix","_key","_name","_storageKey","_shouldStore","_id","_valid","_initialized","_errors","constructor","prefix","key","initializeClass","_validate","Error","name","errors","map","error","message","join","rootDOMElement","_dispatchEvent","_generateKey","_setDOMElements","_setIds","_setAriaAttributes","_setCustomProps","_createChildElements","_handleMediaMatch","_handleFocus","_handleHover","_handleClick","_handleKeydown","_handleKeyup","_store","console","init","dom","document","documentElement","selectors","elements","classes","durations","delays","intervals","timeouts","listeners","events","value","focusState","currentEvent","shouldFocus","check","breakpoint","mediaQuery","id","isValid","isInitialized","rootDOMElementCheck","shouldThrow","status","Object","keys","length","domElements","domKey","Array","isArray","forEach","element","index","domChecks","HTMLElement","querySelectors","querySelector","querySelectorChecks","className","classListChecks","durationName","durationChecks","delayName","delayChecks","strings","elementType","stringChecks","regenerate","Math","random","toString","replace","substring","_setDOMElementType","context","overwrite","strict","includes","from","querySelectorAll","filteredElements","filter","item","parentElement","_resetDOMElementType","window","matchMedia","_addEventListener","storage","GrauplStorage","scope","set","type","data","_unstore","clear","_setInterval","callback","delay","_clearInterval","setInterval","clearInterval","_clearIntervals","_setTimeout","_clearTimeout","setTimeout","clearTimeout","_clearTimeouts","_registerEvent","bubbles","eventName","charAt","toUpperCase","slice","eventType","dispatchEvent","listener","options","addEventListener","push","_removeEventListener","removeEventListener","registeredListener","i","JSON","stringify","splice","_removeEventListeners","focus","blur","dispose","isValidClassList","isValidHoverType","isValidType","addClass","removeClass","keyPress","preventEvent","Component","Tooltip","_rootDOMElement","_softLocked","_hoverType","_open","_storageKey","_openOnFocus","_closeOnBlur","_name","constructor","tooltipElement","tooltipToggleElement","tooltipDescriptionElement","showClass","hideClass","transitionClass","transitionDelay","transitionDuration","showDuration","hideDuration","openOnFocus","closeOnBlur","hoverType","hoverDelay","enterDelay","leaveDelay","prefix","key","initializeClass","initialize","_dom","tooltip","tooltipToggle","tooltipDescription","_classes","show","hide","transition","_durations","_delays","hover","enter","leave","_registerEvent","detail","_addEventListener","rootDOMElement","force","booleans","isOpen","booleanChecks","shouldThrow","status","_errors","errors","_valid","hoverTypeCheck","value","_setCustomProps","_setIds","dom","id","_id","_setAriaAttributes","setAttribute","_reveal","emit","requestAnimationFrame","_setTimeout","_dispatchEvent","_conceal","isSoftLocked","style","setProperty","_handleClick","event","currentEvent","button","toggle","focusState","document","target","contains","_handleFocus","relatedTarget","_handleKeydown","_handleKeyup","_handleHover","pointerType","_clearTimeout","isInitialized"],"sources":["../../../packages/core/src/js/validate.js","../../../packages/core/src/js/domHelpers.js","../../../packages/core/src/js/eventHandlers.js","../../../packages/core/src/js/storage/StorageManager.js","../../../packages/core/src/js/Component.js","../../../packages/core/src/js/tooltip/Tooltip.js"],"sourcesContent":["/**\n * @file\n * Validation helper functions.\n */\n\n/* global Component */\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 * @param {object} [options = {}] - Additional options.\n * @param {boolean} [options.shouldThrow = true ] - Whether to throw on error or return it.\n * @return {Object<boolean, Error[]>} - The result of the check.\n */\nexport function isValidInstance(\n contructor,\n elements,\n { shouldThrow = true } = {}\n) {\n const result = {\n status: true,\n errors: [],\n };\n\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 try {\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 } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n\n if (shouldThrow && !result.status) {\n throw result.errors[0];\n }\n\n return result;\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 * @param {object} [options = {}] - Additional options.\n * @param {boolean} [options.shouldThrow = true ] - Whether to throw on error or return it.\n * @return {Object<boolean, Error[]>} - The result of the check.\n */\nexport function isValidType(type, values, { shouldThrow = true } = {}) {\n const result = {\n status: true,\n errors: [],\n };\n\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 try {\n const valueType = typeof values[key];\n\n if (valueType !== type) {\n throw new TypeError(\n `${key} must be a ${type}. \"${valueType}\" given.`\n );\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n\n if (shouldThrow && !result.status) {\n throw result.errors[0];\n }\n\n return result;\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 * @param {object} [options = {}] - Additional options.\n * @param {boolean} [options.shouldThrow = true ] - Whether to throw on error or return it.\n * @return {Object<boolean, Error[]>} - The result of the check.\n */\nexport function isQuerySelector(values, { shouldThrow = true } = {}) {\n const result = {\n status: true,\n errors: [],\n };\n\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 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 } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n\n if (shouldThrow && !result.status) {\n throw result.errors[0];\n }\n\n return result;\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 * @param {object} [options = {}] - Additional options.\n * @param {boolean} [options.shouldThrow = true ] - Whether to throw on error or return it.\n * @return {Object<boolean, Error[]>} - The result of the check.\n */\nexport function isValidClassList(values, { shouldThrow = true } = {}) {\n const result = {\n status: true,\n errors: [],\n };\n\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 try {\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 } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n\n if (shouldThrow && !result.status) {\n throw result.errors[0];\n }\n\n return result;\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 * @param {object} [options = {}] - Additional options.\n * @param {boolean} [options.shouldThrow = true ] - Whether to throw on error or return it.\n * @return {Object<boolean, Error[]>} - The result of the check.\n */\nexport function isValidState(values, { shouldThrow = true } = {}) {\n const result = {\n status: true,\n errors: [],\n };\n\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 try {\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 } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n\n if (shouldThrow && !result.status) {\n throw result.errors[0];\n }\n\n return result;\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 * @param {object} [options = {}] - Additional options.\n * @param {boolean} [options.shouldThrow = true ] - Whether to throw on error or return it.\n * @return {Object<boolean, Error[]>} - The result of the check.\n */\nexport function isValidEvent(values, { shouldThrow = true } = {}) {\n const result = {\n status: true,\n errors: [],\n };\n\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 try {\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 } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n\n if (shouldThrow && !result.status) {\n throw result.errors[0];\n }\n\n return result;\n}\n\n/**\n * Check to see if the provided values are valid hover types for a menu.\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 * @param {object} [options = {}] - Additional options.\n * @param {boolean} [options.shouldThrow = true ] - Whether to throw on error or return it.\n * @return {Object<boolean, Error[]>} - The result of the check.\n */\nexport function isValidHoverType(values, { shouldThrow = true } = {}) {\n const result = {\n status: true,\n errors: [],\n };\n\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 try {\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 } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n\n if (shouldThrow && !result.status) {\n throw result.errors[0];\n }\n\n return result;\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 `{ status: 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 * @param {object} [options = {}] - Additional options.\n * @param {boolean} [options.shouldThrow = true ] - Whether to throw on error or return it.\n * @return {Object<boolean, Error[]>} - The result of the check.\n */\nexport function isTag(tagName, elements, { shouldThrow = true } = {}) {\n const result = {\n status: true,\n errors: [],\n };\n\n try {\n if (\n isValidType(\"string\", { tagName }, { shouldThrow: true }).status &&\n isValidInstance(HTMLElement, elements, { shouldThrow: true }).status\n ) {\n const tag = tagName.toLowerCase();\n\n for (const key in elements) {\n try {\n if (elements[key].tagName.toLowerCase() !== tag) {\n throw new TypeError(\n `${key} must be a <${tag}> element. <${elements[\n key\n ].tagName.toLowerCase()}> given.`\n );\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n }\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n\n if (shouldThrow && !result.status) {\n throw result.errors[0];\n }\n\n return result;\n}\n\n/**\n * Check to see if the provided event type is valid for dispatching.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {string} eventType - The event type to check.\n * @param {Component} component - The component to check.\n * @param {object} [options = {}] - Additional options.\n * @param {boolean} [options.shouldThrow = true ] - Whether to throw on error or return it.\n * @return {Object<boolean, Error[]>} - The result of the check.\n */\nexport function isValidEventType(\n eventType,\n component,\n { shouldThrow = true } = {}\n) {\n const result = {\n status: true,\n errors: [],\n };\n\n try {\n if (!Object.prototype.hasOwnProperty.call(component.events, eventType)) {\n throw new TypeError(\n `Event type \"${eventType}\" is not valid for ${component.constructor.name}. Valid event types are: \"${Object.keys(component.events).join('\", ')}\".`\n );\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n\n if (shouldThrow && !result.status) {\n throw result.errors[0];\n }\n\n return result;\n}\n\n/**\n * Check to see if the component has a valid root DOM element.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Component} component - The component to check.\n * @param {object} [options = {}] - Additional options.\n * @param {boolean} [options.shouldThrow=true] - Whether to throw on error or return it.\n * @return {Object<boolean, Error[]>} - The result of the check.\n */\nexport function hasValidRootDOMElement(component, { shouldThrow = true } = {}) {\n const result = {\n status: true,\n errors: [],\n };\n\n try {\n // Check to make sure the root DOM element exists in _dom.\n if (\n !Object.prototype.hasOwnProperty.call(\n component._dom,\n component._rootDOMElement\n )\n ) {\n throw new Error(\n `The root DOM element \"${component._rootDOMElement}\" does not exist in the ${component.constructor.name}'s _dom property. It must be one of the following: \"${Object.keys(\n component._dom\n ).join('\", \"')}\".`\n );\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n\n if (shouldThrow && !result.status) {\n throw result.errors[0];\n }\n\n return result;\n}\n","/**\n * Add a class or array of classes to an element.\n *\n * @param {string|string[]} className - The class or classes to add.\n * @param {HTMLElement} element - The element to add the class to.\n */\nexport function addClass(className, element) {\n // Gracefully handle empty strings or arrays.\n if (className === \"\" || className.length === 0) {\n return;\n }\n\n if (typeof className === \"string\") {\n element.classList.add(className);\n } else {\n element.classList.add(...className);\n }\n}\n\n/**\n * Remove a class or array of classes from an element.\n *\n * @param {string|string[]} className - The class or classes to remove.\n * @param {HTMLElement} element - The element to remove the class from.\n */\nexport function removeClass(className, element) {\n // Gracefully handle empty strings or arrays.\n if (className === \"\" || className.length === 0) {\n return;\n }\n\n if (typeof className === \"string\") {\n element.classList.remove(className);\n } else {\n element.classList.remove(...className);\n }\n}\n\n/**\n * Select all focusable elements within a given context.\n *\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @param {?function(HTMLElement): boolean} [fn = null] - An optional addition filter function to process out focusable elements.\n * @return {HTMLElement[]} - An array of focusable elements.\n */\nexport function selectAllFocusableElements(context = document, fn = null) {\n const querySelector =\n \"a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),[tabindex]\";\n const elements = Array.from(context.querySelectorAll(querySelector));\n\n const tabbableElements = elements.filter((element) => {\n let check = true;\n\n if (element.getAttribute(\"tabindex\") === \"-1\") check = false;\n\n return check;\n });\n\n if (fn !== null) {\n return tabbableElements.filter(fn);\n } else {\n return tabbableElements;\n }\n}\n\n/**\n * Select the first focusable element within a given context.\n *\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @param {?function(HTMLElement): boolean} [fn = null] - An optional addition filter function to process out focusable elements.\n * @return {HTMLElement|boolean} - The first focusable element or false if none found.\n */\nexport function selectFirstFocusableElement(context = document, fn = null) {\n const tabbableElements = selectAllFocusableElements(context, fn);\n\n return tabbableElements[0] || false;\n}\n\n/**\n * Select the last focusable element within a given context.\n *\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @param {?function(HTMLElement): boolean} [fn = null] - An optional addition filter function to process out focusable elements.\n * @return {HTMLElement|boolean} - The last focusable element or false if none found.\n */\nexport function selectLastFocusableElement(context = document, fn = null) {\n const tabbableElements = selectAllFocusableElements(context, fn);\n\n return tabbableElements[tabbableElements.length - 1] || false;\n}\n\n/**\n * Select the next focusable element relative to the given element within a context.\n *\n * @param {HTMLElement} element - The reference element.\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @param {?function(HTMLElement): boolean} [fn = null] - An optional addition filter function to process out focusable elements.\n * @return {HTMLElement|boolean} - The next focusable element or false if none found.\n */\nexport function selectNextFocusableElement(\n element,\n context = document,\n fn = null\n) {\n const tabbableElements = selectAllFocusableElements(context, fn);\n const index = tabbableElements.indexOf(element);\n\n return index === tabbableElements.length - 1\n ? false\n : tabbableElements[index + 1];\n}\n\n/**\n * Select the previous focusable element relative to the given element within a context.\n *\n * @param {HTMLElement} element - The reference element.\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @param {?function(HTMLElement): boolean} [fn = null] - An optional addition filter function to process out focusable elements.\n * @return {HTMLElement|boolean} - The previous focusable element or false if none found.\n */\nexport function selectPreviousFocusableElement(\n element,\n context = document,\n fn = null\n) {\n const tabbableElements = selectAllFocusableElements(context, fn);\n const index = tabbableElements.indexOf(element);\n\n return index === 0 ? false : tabbableElements[index - 1];\n}\n","/**\n * 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 Character: isNaN(key) && !!key.match(/^[a-zA-Z]{1}$/),\n Tab: key === \"Tab\" || key === 9,\n Asterisk: key === \"*\" || key === 56,\n };\n\n return Object.keys(keys).find((key) => keys[key] === true) || \"\";\n } catch {\n // Return an empty string if something goes wrong.\n return \"\";\n }\n}\n\n/**\n * Stops an event from taking action.\n *\n * @param {Event} event - The event.\n */\nexport function preventEvent(event) {\n event.preventDefault();\n event.stopPropagation();\n}\n","/**\n * @file\n * Provides a system to get and store data in the browser.\n */\n\nimport { isValidType, isValidInstance } from \"../validate.js\";\n\n/**\n * Class representing a storage system.\n */\nclass StorageManager {\n /**\n * The scope of the storage.\n *\n * @protected\n *\n * @type {string}\n */\n _scope;\n\n /**\n * The type of storage.\n *\n * @protected\n *\n * @type {string}\n */\n _type = \"_default\";\n\n /**\n * The storage object.\n *\n * @protected\n *\n * @type {object}\n */\n _storage = {};\n\n /**\n * Whether to crush the storage instance if it already exists.\n *\n * @protected\n *\n * @type {boolean}\n */\n _crush = false;\n\n /**\n * Creates a Storage instance.\n *\n * @param {object} [options = {}] - The options for the storage.\n * @param {string} options.scope - The scope of the storage.\n * @param {?string} [options.type = null] - The type of storage.\n * @param {boolean} [options.crush = false] - Whether to crush the storage instance if it already exists.\n * @param {boolean} [options.initialize = true] - Whether to initialize the storage.\n */\n constructor({ scope, type = null, crush = false, initialize = true } = {}) {\n this._scope = scope;\n this._type = type || \"_default\";\n this._crush = crush;\n\n if (initialize) {\n this.initialize();\n }\n }\n\n /**\n * Initialize the storage.\n */\n initialize() {\n // Try to make sure the storage instance won't crush other instances of StorageManager with the same scope.\n try {\n if (!this._crush && typeof window[this.scope] !== \"undefined\") {\n if (\n isValidInstance(\n StorageManager,\n { storage: window[this.scope] },\n { shouldThrow: false }\n ).status ||\n (typeof window[this.scope].storage !== \"undefined\" &&\n typeof window[this.scope].scope !== \"undefined\" &&\n typeof window[this.scope].type !== \"undefined\")\n ) {\n this._storage = window[this.scope].storage;\n }\n }\n } catch {\n // Do nothing.\n } finally {\n window[this.scope] = this;\n }\n }\n\n /**\n * The scope of the storage.\n *\n * @readonly\n *\n * @type {string}\n *\n * @see _scope\n */\n get scope() {\n return this._scope;\n }\n\n /**\n * The type of storage.\n *\n * @type {string}\n *\n * @see _type\n */\n get type() {\n return this._type;\n }\n\n set type(type) {\n if (isValidType(\"string\", { type })) {\n this._type = type;\n }\n }\n\n /**\n * The storage object.\n *\n * @readonly\n *\n * @type {object}\n *\n * @see _storage\n */\n get storage() {\n return this._storage;\n }\n\n /**\n * Get the storage object.\n *\n * @param {object} [options = {}] - The options for getting the storage.\n * @param {string} [options.type = this.type] - The type of storage to get.\n * @param {?string} [options.key = null] - The key to get the value from.\n * @return {object} - The storage object.\n */\n get({ type = this.type, key = null } = {}) {\n const typeCheck = isValidType(\"string\", { type });\n\n if (!typeCheck.status) {\n throw new Error(`StorageManager (${this.scope}): ${typeCheck.message}`);\n }\n\n if (!this.storage[type]) {\n throw new Error(\n `StorageManager (${this.scope}): Type \"${type}\" is not initialized.`\n );\n }\n\n if (key !== null) {\n const keyCheck = isValidType(\"string\", { key });\n\n if (!keyCheck.status) {\n throw new Error(`StorageManager (${this.scope}): ${keyCheck.message}`);\n }\n\n return this.storage[type][key];\n }\n\n return this.storage[type];\n }\n\n /**\n * Set the storage object.\n *\n * @param {object} [options = {}] - The options for setting the storage.\n * @param {string} [options.type = this.type] - The type of storage to set.\n * @param {?string} [options.key = null] - The key to set the value to.\n * @param {object} [options.data = {}] - The data to set.\n */\n set({ type = this.type, key = null, data = {} } = {}) {\n const typeCheck = isValidType(\"string\", { type });\n const dataCheck = isValidType(\"object\", { data });\n\n if (!typeCheck.status) {\n throw new Error(`StorageManager (${this.scope}): ${typeCheck.message}`);\n }\n\n if (!dataCheck.status) {\n throw new Error(`StorageManager (${this.scope}): ${dataCheck.message}`);\n }\n\n if (key !== null) {\n const keyCheck = isValidType(\"string\", { key });\n\n if (!keyCheck.status) {\n throw new Error(`StorageManager (${this.scope}): ${keyCheck.message}`);\n }\n\n if (!this._storage[type]) {\n this._storage[type] = {};\n }\n\n this._storage[type][key] = data;\n } else {\n this._storage[type] = data;\n }\n }\n\n /**\n * Remove a value from the storage object.\n *\n * @param {object} [options = {}] - The options for removing from storage.\n * @param {string} [options.type = this.type] - The type of storage to remove from.\n * @param {?string} [options.key = null] - The key to remove the value from.\n */\n clear({ type = this.type, key = null } = {}) {\n const typeCheck = isValidType(\"string\", { type });\n\n if (!typeCheck.status) {\n throw new Error(`StorageManager (${this.scope}): ${typeCheck.message}`);\n }\n\n if (key !== null) {\n const keyCheck = isValidType(\"string\", { key });\n\n if (!keyCheck.status) {\n throw new Error(`StorageManager (${this.scope}): ${keyCheck.message}`);\n }\n\n delete this.storage[type][key];\n } else {\n delete this.storage[type];\n }\n }\n\n dispose() {\n delete this._storage;\n delete this;\n }\n}\n\nexport default StorageManager;\n","/**\n * @file\n * A generic component class.\n */\n\nimport {\n isValidInstance,\n isValidType,\n isValidClassList,\n isQuerySelector,\n isValidState,\n isValidEvent,\n isValidEventType,\n hasValidRootDOMElement,\n} from \"./validate.js\";\nimport StorageManager from \"./storage/StorageManager.js\";\nimport { addClass, removeClass } from \"./domHelpers.js\";\n\nclass Component {\n /**\n * The DOM elements within the component.\n *\n * @protected\n *\n * @type {Object<HTMLElement, HTMLElement[]>}\n */\n _dom = {};\n\n /**\n * The root DOM element of the component.\n *\n * @protected\n *\n * @type {string}\n */\n _rootDOMElement = \"\";\n\n /**\n * The DOM elements within the component that cannot be reset or generated by the component itself.\n *\n * @protected\n *\n * @type {string[]}\n */\n _protectedDOMElements = [];\n\n /**\n * The query selectors used by the component.\n *\n * @protected\n *\n * @type {Object<string>}\n */\n _selectors = {};\n\n /**\n * The instantiated elements within the component.\n *\n * @protected\n *\n * @type {object}\n */\n _elements = {};\n\n /**\n * The CSS classes to apply when the component is in various states.\n *\n * @protected\n *\n * @type {Object<string, string[]>}\n */\n _classes = {\n initialize: \"\",\n };\n\n /**\n * The duration times (in milliseconds) for various aspects throughout the component.\n *\n * @protected\n *\n * @type {Object<number>}\n */\n _durations = {};\n\n /**\n * The delay times (in milliseconds) for various aspects throughout the component.\n *\n * @protected\n *\n * @type {Object<number>}\n */\n _delays = {};\n\n /**\n * The current state of the component's focus.\n *\n * @protected\n *\n * @type {string}\n */\n _focusState = \"none\";\n\n /**\n * The last type of event triggered within the component.\n *\n * @protected\n *\n * @type {string}\n */\n _currentEvent = \"none\";\n\n /**\n * The breakoint that the component will call media query list events.\n *\n * @protected\n *\n * @type {string}\n */\n _breakpoint = \"\";\n\n /**\n * The media query to use to trigger media query list events.\n *\n * @type {string}\n */\n _mediaQueryString = \"\";\n\n /**\n * This MediaQueryList for the component.\n *\n * @protected\n *\n * @type {MediaQueryList|null}\n */\n _mediaQueryList = null;\n\n /**\n * A callback for media query list events.\n *\n * @protected\n *\n * @type {Function}\n *\n * @param {MediaQueryListEvent} event - The event.\n */\n _mediaQueryListEventCallback = (event) => {\n // Add functionality to handle media matches.\n if (event.matches) {\n // Do something.\n } else {\n // Do something else.\n }\n };\n\n /**\n * Intervals throughout the component.\n *\n * @protected\n *\n * @type {Object<Function>}\n */\n _intervals = {};\n\n /**\n * Timeouts throughout the component.\n *\n * @protected\n *\n * @type {Object<Function>}\n */\n _timeouts = {};\n\n /**\n * Event listeners throughout the component.\n *\n * @protected\n *\n * @type {object[]}\n */\n _listeners = [];\n\n /**\n * Custom events that can be triggered throughout the component.\n *\n * @protected\n *\n * @type {Object<CustomEvent>}\n */\n _events = {\n initialize: new CustomEvent(\"grauplComponentInitialize\", {\n detail: { component: this },\n }),\n preinitialize: new CustomEvent(\"grauplComponentPreinitialize\", {\n detail: { component: this },\n }),\n postinitialize: new CustomEvent(\"grauplComponentPostinitialize\", {\n detail: { component: this },\n }),\n validate: new CustomEvent(\"grauplComponentValidate\", {\n detail: { component: this },\n }),\n prevalidate: new CustomEvent(\"grauplComponentPrevalidate\", {\n detail: { component: this },\n }),\n postvalidate: new CustomEvent(\"grauplComponentPostvalidate\", {\n detail: { component: this },\n }),\n };\n\n /**\n * The prefix used for CSS custom properties and attributes.\n *\n * @protected\n *\n * @type {string}\n */\n _prefix = \"graupl-\";\n\n /**\n * The key used to generate IDs throughout the component.\n *\n * @protected\n *\n * @type {string}\n */\n _key = \"\";\n\n /**\n * The component name of the component.\n *\n * @protected\n *\n * @type {string}\n */\n _name = \"Component\";\n\n /**\n * The key used for storage.\n *\n * @protected\n *\n * @type {string}\n */\n _storageKey = \"components\";\n\n /**\n * A flag to check if the component should be stored in the StorageManager.\n */\n _shouldStore = true;\n\n /**\n * The main ID of the component.\n *\n * @protected\n *\n * @type {string}\n */\n _id = \"\";\n\n /**\n * The validity state of the component.\n *\n * @protected\n *\n * @type {boolean}\n */\n _valid = true;\n\n /**\n * The initialized state of the component.\n *\n * @protected\n *\n * @type {boolean}\n */\n _initialized = false;\n\n /**\n * The errors found throughout the component.\n *\n * @protected\n *\n * @type {Error[]}\n */\n _errors = [];\n\n /**\n * Constructs a new component.\n *\n * @param {object} [options = {}] - The options for generating the component.\n * @param {?string} [options.prefix = graupl-] - The prefix used for CSS custom properties and attributes.\n * @param {?string} [options.key = null] - The key used to generate IDs throughout the component.\n * @param {?(string|string[])} [options.initializeClass = initializing] - The class(es) to apply when the component is initializing.\n */\n constructor({\n prefix = \"graupl-\",\n key = null,\n initializeClass = \"initializing\",\n } = {}) {\n // Set the classes.\n this._classes.initialize = initializeClass || \"\";\n\n // Set the prefix and key.\n this._prefix = prefix || \"\";\n this._key = key || \"\";\n }\n\n /**\n * Initialize the component.\n */\n initialize() {\n try {\n if (!this._validate()) {\n throw new Error(\n `Graupl ${this.name}: Cannot initialize component. The following errors have been found:\\n - ${this.errors\n .map((error) => error.message)\n .join(\"\\n - \")}`\n );\n }\n\n addClass(this.initializeClass, this.rootDOMElement);\n\n this._dispatchEvent(\"preinitialize\", this.rootDOMElement);\n\n // Generate the key.\n this._generateKey();\n\n // Set up the DOM.\n this._setDOMElements();\n this._setIds();\n this._setAriaAttributes();\n this._setCustomProps();\n\n // Set up child elements.\n this._createChildElements();\n\n // Handle events.\n this._handleMediaMatch();\n this._handleFocus();\n this._handleHover();\n this._handleClick();\n this._handleKeydown();\n this._handleKeyup();\n\n this._dispatchEvent(\"initialize\", this.rootDOMElement);\n\n // Store the component.\n this._store();\n\n removeClass(this.initializeClass, this.rootDOMElement);\n\n this._initialized = true;\n\n this._dispatchEvent(\"postinitialize\", this.rootDOMElement);\n } catch (error) {\n console.error(error);\n }\n }\n init() {\n this.initialize();\n }\n\n /**\n * The DOM elements within the component.\n *\n * @readonly\n *\n * @type {object}\n *\n * @see _dom\n */\n get dom() {\n return this._dom;\n }\n\n /**\n * The root DOM element of the component.\n *\n * @readonly\n *\n * @type {HTMLElement}\n *\n * @see _rootDOMElement\n */\n get rootDOMElement() {\n return this._dom[this._rootDOMElement] || document.documentElement;\n }\n\n /**\n * The query selectors used by the component.\n *\n * @readonly\n *\n * @type {object}\n *\n * @see _selectors\n */\n get selectors() {\n return this._selectors;\n }\n\n /**\n * The instantiated elements within the component.\n *\n * @readonly\n *\n * @type {object}\n *\n * @see _elements\n */\n get elements() {\n return this._elements;\n }\n\n /**\n * The CSS classes to apply when the component is in various states.\n *\n * @readonly\n *\n * @type {object}\n *\n * @see _classes\n */\n get classes() {\n return this._classes;\n }\n\n /**\n * The duration times (in milliseconds) for various aspects throughout the component.\n *\n * @readonly\n *\n * @type {object}\n *\n * @see _durations\n */\n get durations() {\n return this._durations;\n }\n\n /**\n * The delay times (in milliseconds) for various aspects throughout the component.\n *\n * @readonly\n *\n * @type {object}\n *\n * @see _delays\n */\n get delays() {\n return this._delays;\n }\n\n /**\n * Intervals throughout the component.\n *\n * @readonly\n *\n * @type {object}\n *\n * @see _intervals\n */\n get intervals() {\n return this._intervals;\n }\n\n /**\n * Timeouts throughout the component.\n *\n * @readonly\n *\n * @type {object}\n *\n * @see _timeouts\n */\n get timeouts() {\n return this._timeouts;\n }\n\n /**\n * Event listeners throughout the component.\n *\n * @readonly\n *\n * @type {object[]}\n *\n * @see _listeners\n */\n get listeners() {\n return this._listeners;\n }\n\n /**\n * Custom events that can be triggered throughout the component.\n *\n * @readonly\n *\n * @type {Error[]}\n *\n * @see _events\n */\n get events() {\n return this._events;\n }\n\n /**\n * The class(es) to apply when the component is initializing.\n *\n * @type {string|string[]}\n *\n * @see _classes.initialize\n */\n get initializeClass() {\n return this._classes.initialize;\n }\n\n set initializeClass(value) {\n isValidClassList({ initializeClass: value });\n\n if (this._classes.initialize !== value) {\n this._classes.initialize = value;\n }\n }\n\n /**\n * The current state of the component's focus.\n *\n * @type {string}\n *\n * @see _focusState\n */\n get focusState() {\n return this._focusState;\n }\n\n set focusState(value) {\n isValidState({ focusState: value });\n\n if (this._focusState !== value) {\n this._focusState = value;\n }\n }\n\n /**\n * The last type of event triggered within the component.\n *\n * @type {string}\n *\n * @see _currentEvent\n */\n get currentEvent() {\n return this._currentEvent;\n }\n\n set currentEvent(value) {\n isValidEvent({ currentEvent: value });\n\n if (this._currentEvent !== value) {\n this._currentEvent = value;\n }\n }\n\n /**\n * A flag to check if the disclosure's focus methods should _actually_ move the focus in the DOM.\n *\n * This will be `false` unless any of the following criteria are met:\n * - The disclosure's current event is \"keyboard\".\n *\n * @readonly\n *\n * @type {boolean}\n */\n get shouldFocus() {\n let check = false;\n\n if (this.currentEvent === \"keyboard\") {\n check = true;\n }\n\n return check;\n }\n\n /**\n * The breakoint that the component will call media query list events.\n *\n * @type {string}\n *\n * @see _breakpoint\n */\n get breakpoint() {\n return this._breakpoint;\n }\n\n set breakpoint(value) {\n isValidType(\"string\", { breakpoint: value });\n\n if (this._breakpoint !== value) {\n this._breakpoint = value;\n }\n }\n\n /**\n * The media query to use to trigger media query list events.\n *\n * @type {string}\n *\n * @see _mediaQueryString\n */\n get mediaQuery() {\n if (this._mediaQueryString !== \"\") {\n return this._mediaQueryString;\n }\n\n if (this._breakpoint === \"\") {\n return \"\";\n }\n\n return `(width <= ${this._breakpoint})`;\n }\n\n set mediaQuery(value) {\n isValidType(\"string\", { mediaQuery: value });\n\n if (this._mediaQueryString !== value) {\n this._mediaQueryString = value;\n }\n }\n\n /**\n * The prefix used for CSS custom properties and attributes.\n *\n * @readonly\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 component.\n *\n * @readonly\n *\n * @type {string}\n *\n * @see _key\n */\n get key() {\n return this._key;\n }\n\n /**\n * The component name of the component.\n *\n * @readonly\n *\n * @type {string}\n *\n * @see _name\n */\n get name() {\n return this._name;\n }\n\n /**\n * The main ID of the component.\n *\n * @readonly\n *\n * @type {string}\n *\n * @see _id\n */\n get id() {\n return this._id;\n }\n\n /**\n * The validity state of the component.\n *\n * @readonly\n *\n * @type {boolean}\n *\n * @see _valid\n */\n get isValid() {\n return this._valid;\n }\n\n /**\n * The initialized state of the component.\n *\n * @readonly\n *\n * @type {boolean}\n *\n * @see _initialized\n */\n get isInitialized() {\n return this._initialized;\n }\n\n /**\n * An array to hold error messages.\n *\n * @readonly\n *\n * @type {string[]}\n *\n * @see _errors\n */\n get errors() {\n return this._errors;\n }\n\n /**\n * Validates all aspects of the component to ensure proper functionality.\n *\n * Keys are altered to match the arguments passed in during creation where possible.\n *\n * @protected\n *\n * @return {boolean} - The result of the validation checks.\n */\n _validate() {\n this._dispatchEvent(\"prevalidate\", this.rootDOMElement);\n\n // _rootDOMElement check.\n const rootDOMElementCheck = hasValidRootDOMElement(this, {\n shouldThrow: false,\n });\n\n // Handle _rootDOMElement check failure.\n if (!rootDOMElementCheck.status) {\n this._errors = [...this._errors, ...rootDOMElementCheck.errors];\n this._valid = false;\n }\n\n // DOM checks.\n if (Object.keys(this._dom).length > 0) {\n const domElements = {};\n\n // Loop through and add \"Element\" to the end of each key in _dom.\n for (const domKey of Object.keys(this._dom)) {\n // If we're dealing with an array, we need to check each element in the array.\n if (Array.isArray(this._dom[domKey])) {\n this._dom[domKey].forEach((element, index) => {\n domElements[`${domKey}Element[${index}]`] = element;\n });\n } else if (this._dom[domKey] !== null) {\n domElements[`${domKey}Element`] = this._dom[domKey];\n }\n }\n\n // Check the DOM elements.\n const domChecks = isValidInstance(HTMLElement, domElements, {\n shouldThrow: false,\n });\n\n // Handle DOM check failure.\n if (!domChecks.status) {\n this._errors = [...this._errors, ...domChecks.errors];\n this._valid = false;\n }\n }\n\n // Query selector checks.\n if (Object.keys(this._selectors).length > 0) {\n const querySelectors = {};\n\n // Loop through and add \"Selector\" to the end of each key in _selectors.\n for (const querySelector of Object.keys(this._selectors)) {\n querySelectors[`${querySelector}Selector`] =\n this._selectors[querySelector];\n }\n\n // Check the query selectors.\n const querySelectorChecks = isQuerySelector(querySelectors, {\n shouldThrow: false,\n });\n\n // Handle query selector check failure.\n if (!querySelectorChecks.status) {\n this._errors = [...this._errors, ...querySelectorChecks.errors];\n this._valid = false;\n }\n }\n\n // Class list checks.\n if (Object.keys(this._classes).length > 0) {\n const classes = {};\n\n // Loop through and add \"Class\" to the end of each key in _classes.\n for (const className of Object.keys(this._classes)) {\n if (this._classes[className] === \"\") {\n continue;\n }\n\n classes[`${className}Class`] = this._classes[className];\n }\n\n // Check the class lists.\n const classListChecks = isValidClassList(classes, { shouldThrow: false });\n\n // Handle class list check failure.\n if (!classListChecks.status) {\n this._errors = [...this._errors, ...classListChecks.errors];\n this._valid = false;\n }\n }\n\n // Duration checks.\n if (Object.keys(this._durations).length > 0) {\n const durations = {};\n\n // Loop through and add \"Duration\" to the end of each key in _durations.\n for (const durationName of Object.keys(this._durations)) {\n durations[`${durationName}Duration`] = this._durations[durationName];\n }\n\n // Check the durations.\n const durationChecks = isValidType(\"number\", durations, {\n shouldThrow: false,\n });\n\n // Handle duration check failure.\n if (!durationChecks.status) {\n this._errors = [...this._errors, ...durationChecks.errors];\n this._valid = false;\n }\n }\n\n // Delay checks.\n if (Object.keys(this.delays).length > 0) {\n const delays = {};\n\n // Loop through and add \"Delay\" to the end of each key in delays.\n for (const delayName of Object.keys(this.delays)) {\n delays[`${delayName}Delay`] = this.delays[delayName];\n }\n\n // Check the delays.\n const delayChecks = isValidType(\"number\", delays, { shouldThrow: false });\n\n // Handle delay check failure.\n if (!delayChecks.status) {\n this._errors = [...this._errors, ...delayChecks.errors];\n this._valid = false;\n }\n }\n\n // String checks.\n const strings = {\n _storageKey: this._storageKey,\n key: this._key,\n prefix: this._prefix,\n mediaQuery: this._mediaQueryString,\n breakpoint: this._breakpoint,\n };\n\n this._protectedDOMElements.forEach((elementType) => {\n strings[`_protectedDOMElementType[${elementType}]`] = elementType;\n });\n // Check the strings.\n const stringChecks = isValidType(\"string\", strings, { shouldThrow: false });\n\n // Handle string check failure.\n if (!stringChecks.status) {\n this._errors = [...this._errors, ...stringChecks.errors];\n this._valid = false;\n }\n\n this._dispatchEvent(\"validate\", this.rootDOMElement);\n\n this._dispatchEvent(\"postvalidate\", this.rootDOMElement);\n\n return this._valid;\n }\n\n /**\n * Generates a key for the component.\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 IDs throughout the component.\n */\n _setIds() {\n // Add functionality to set IDs throughout the component.\n }\n\n /**\n * Sets ARIA attributes throughout the component.\n */\n _setAriaAttributes() {\n // Add functionality to set attributes throughout the component.\n }\n\n /**\n * Sets custom props throughout the component.\n */\n _setCustomProps() {\n // Add functionality to set custom props throughout the component.\n }\n\n /**\n * Sets DOM elements throughout the component.\n *\n * Elements listed in _protectedDOMElements cannot be set using this method.\n *\n * @protected\n *\n * @param {string} elementType - The type of element to populate.\n * @param {Object<HTMLElement,boolean>} [options = {}] - The options for setting the DOM element type.\n * @param {HTMLElement} [options.context] - The element used as the base context for the querySelector.\n * @param {boolean} [options.overwrite = true] - A flag to set if the existing elements will be overwritten.\n * @param {boolean} [options.strict = false] - A flag to set if the elements must be direct children of the base.\n */\n _setDOMElementType(\n elementType,\n { context, overwrite = true, strict = false } = {}\n ) {\n // Make sure the element type is valid.\n if (typeof this.selectors[elementType] !== \"string\") {\n throw new Error(\n `Graupl ${this.name}: \"${elementType}\" is not a valid element type.`\n );\n }\n\n // Make sure the element type can actually be set through this method.\n if (\n this._rootDOMElement === elementType ||\n this._protectedDOMElements.includes(elementType)\n ) {\n throw new Error(\n `Graupl ${this.name}: \"${elementType}\" element cannot be set through _setDOMElementType because it is a protected element.`\n );\n }\n\n // Make sure the context element is actually an HTMLELement.\n isValidInstance(HTMLElement, { context });\n\n // Get the all elements matching the selector in the context.\n const domElements = Array.from(\n context.querySelectorAll(this.selectors[elementType])\n );\n\n // Filter the elements so if `strict` is true, only direct children of the context are kept.\n const filteredElements = domElements.filter((item) =>\n strict ? item.parentElement === context : true\n );\n\n if (Array.isArray(this._dom[elementType])) {\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 this._dom[elementType] = filteredElements[0] || null;\n }\n }\n\n /**\n * Resets DOM elements throughout the component.\n *\n * Elements listed in _protectedDOMElements cannot be reset using this method.\n *\n * @protected\n *\n * @param {string} elementType - The type of element to clear.\n */\n _resetDOMElementType(elementType) {\n // Make sure the element type is valid.\n if (typeof this.selectors[elementType] !== \"string\") {\n throw new Error(\n `Graupl ${this.name}: \"${elementType}\" is not a valid element type.`\n );\n }\n\n // Make sure the element type can actually be reset through this method.\n if (\n this._rootDOMElement === elementType ||\n this._protectedDOMElements.includes(elementType)\n ) {\n throw new Error(\n `Graupl ${this.name}: \"${elementType}\" element cannot be reset through _resetDOMElementType because it is a protected element.`\n );\n }\n\n if (Array.isArray(this._dom[elementType])) {\n this._dom[elementType] = [];\n } else {\n this._dom[elementType] = null;\n }\n }\n\n /**\n * Sets all DOM elements throughout the component.\n *\n * Utilizes _setDOMElementType and _resetDOMElementType.\n *\n * @protected\n */\n _setDOMElements() {\n // Add functionality to set DOM Elements throughout the component.\n }\n\n /**\n * Creates and initializes child elements throughout the component.\n *\n * @protected\n */\n _createChildElements() {\n // Add functionality to handle creating child elements throughout the component.\n }\n\n /**\n * Handles media match events throughout the component.\n *\n * @protected\n */\n _handleMediaMatch() {\n if (this.mediaQuery === \"\") {\n return;\n }\n\n this._mediaQueryList = window.matchMedia(this.mediaQuery);\n this._addEventListener(\n \"change\",\n this._mediaQueryList,\n this._mediaQueryListEventCallback\n );\n this._mediaQueryListEventCallback(this._mediaQueryList);\n }\n\n /**\n * Handles focus events through the component.\n *\n * @protected\n */\n _handleFocus() {\n // Add functionality to handle focus events throughout the component.\n }\n\n /**\n * Handles click events through the component.\n *\n * @protected\n */\n _handleClick() {\n // Add functionality to handle click events throughout the component.\n }\n\n /**\n * Handles hover events through the component.\n *\n * @protected\n */\n _handleHover() {\n // Add functionality to handle hover events throughout the component.\n }\n\n /**\n * Handles keydown events through the component.\n *\n * @protected\n */\n _handleKeydown() {\n // Add functionality to handle keydown events throughout the component.\n }\n\n /**\n * Handles keyup events through the component.\n *\n * @protected\n */\n _handleKeyup() {\n // Add functionality to handle keyup events throughout the component.\n }\n\n /**\n * Stores the component into the global Graupl storage object.\n *\n * @protected\n */\n _store() {\n // Make sure the component should be stored.\n if (!this._shouldStore) {\n return;\n }\n\n // Set up the storage.\n if (\n !isValidInstance(\n StorageManager,\n { storage: window.GrauplStorage },\n { shouldThrow: false }\n ).status\n ) {\n new StorageManager({ scope: \"GrauplStorage\" });\n }\n\n // Store the menu\n window.GrauplStorage.set({\n key: this.id !== \"\" ? this.id : this.key,\n type: this._storageKey,\n data: this,\n });\n }\n\n /**\n * Removes the component from the global Graupl storage object.\n *\n * @protected\n */\n _unstore() {\n // Make sure the component should be stored.\n if (!this._shouldStore) {\n return;\n }\n\n if (\n !isValidInstance(\n StorageManager,\n { storage: window.GrauplStorage },\n { shouldThrow: false }\n ).status\n ) {\n return;\n }\n\n window.GrauplStorage.clear({\n key: this.id !== \"\" ? this.id : this.key,\n type: this._storageKey,\n });\n }\n\n /**\n * Sets an interval within the component.\n *\n * @protected\n *\n * @param {Function} [callback] - The callback function.\n * @param {number} [delay] - The time (in milliseconds) of the delay.\n * @param {string} [scope = _default] - The scope of the interval (used to store the interval in _intervals).\n */\n _setInterval(callback, delay, scope = \"_default\") {\n this._clearInterval(scope);\n\n this._intervals[scope] = setInterval(callback, delay);\n }\n\n /**\n * Clears an interval within the component.\n *\n * @protected\n *\n * @param {string} [scope = _default] - The scope of the interval (used to get the interval from _intervals).\n */\n _clearInterval(scope = \"_default\") {\n clearInterval(this._intervals[scope]);\n }\n\n /**\n * Clears all intervals within the component.\n *\n * @protected\n */\n _clearIntervals() {\n for (const scope of Object.keys(this._intervals)) {\n this._clearInterval(scope);\n }\n }\n\n /**\n * Sets a timeout within the component.\n *\n * @protected\n *\n * @param {Function} [callback] - The callback function.\n * @param {number} [delay] - The time (in milliseconds) of the delay.\n * @param {string} [scope = _default] - The scope of the timeout (used to store the timeout in _timeouts).\n */\n _setTimeout(callback, delay, scope = \"_default\") {\n this._clearTimeout(scope);\n\n this._timeouts[scope] = setTimeout(callback, delay);\n }\n\n /**\n * Clears a timeout within the component.\n *\n * @protected\n *\n * @param {string} [scope = _default] - The scope of the timeout (used to get the timeout from _timeouts).\n */\n _clearTimeout(scope = \"_default\") {\n clearTimeout(this._timeouts[scope]);\n }\n\n /**\n * Clears all timeouts within the component.\n *\n * @protected\n */\n _clearTimeouts() {\n for (const scope of Object.keys(this._timeouts)) {\n this._clearTimeout(scope);\n }\n }\n\n /**\n * Registers a new event type within the component.\n *\n * @protected\n *\n * @param {string} name - The name of the new event type.\n * @param {object} [options = {}] - The options for the new event type.\n * @param {boolean} [options.bubbles = true] - A flag to set if the event bubbles.\n * @param {object} [options.detail = {}] - Additional details to include in the event.\n */\n _registerEvent(name, { bubbles = true, detail = {} } = {}) {\n isValidType(\"string\", { name });\n isValidType(\"boolean\", { bubbles });\n isValidType(\"object\", { detail });\n\n const eventName = `graupl${this.name}${name.charAt(0).toUpperCase()}${name.slice(\n 1\n )}`;\n\n this._events[name] = new CustomEvent(eventName, {\n bubbles,\n detail: { component: this, ...detail },\n });\n }\n\n /**\n * Dispatch a custom event on an element in the DOM.\n *\n * @param {string} eventType - The type of the event to dispatch.\n * @param {HTMLElement} element - The element to dispatch the event on.\n */\n _dispatchEvent(eventType, element) {\n // Make sure the event type exists.\n isValidEventType(eventType, this);\n\n // Make sure the element is actually an HTML Element.\n isValidInstance(HTMLElement, { element });\n\n // Dispatch the event.\n element.dispatchEvent(this.events[eventType]);\n }\n\n /**\n * Add an event listener to an element and register it within the component.\n *\n * @param {string} type - The type of event to listen for.\n * @param {HTMLElement} element - The element to add the listener to.\n * @param {Function} listener - The listener callback.\n * @param {object|boolean} [options = {}] - Options to pass to the listener.\n */\n _addEventListener(type, element, listener, options = {}) {\n // Add the listener.\n element.addEventListener(type, listener, options);\n\n // Store it in the component.\n this._listeners.push({\n type,\n element,\n listener,\n options,\n });\n }\n\n /**\n * Remove an event listener from an element and unregister it within the component.\n *\n * @param {string} type - The type of event to remove.\n * @param {HTMLElement} element - The element to remove the listener from.\n * @param {Function} listener - The listener callback.\n * @param {object|boolean} [options = {}] - Options to pass to the listener.\n */\n _removeEventListener(type, element, listener, options = {}) {\n // Remove the listener.\n element.removeEventListener(type, listener, options);\n\n // Find the listener in the component's listener storage.\n let index = -1;\n\n this._listeners.forEach((registeredListener, i) => {\n if (\n registeredListener.type === type &&\n registeredListener.element === element &&\n registeredListener.listener === listener &&\n JSON.stringify(registeredListener.options) === JSON.stringify(options)\n ) {\n index = i;\n }\n });\n\n // Remove it from the component's listener storage.\n if (index !== -1) {\n this._listeners.splice(index, 1);\n }\n }\n\n /**\n * Removes all event listeners registered in the component.\n *\n * This can be filtered by type and/or element.\n *\n * @protected\n *\n * @param {object} [options = {}] - Options for removing listeners.\n * @param {?string} [options.type = null] - The type of event to remove. If null, all types are removed.\n * @param {?HTMLElement} [options.element = null] - The element to remove listeners from. If null, all elements are removed.\n */\n _removeEventListeners({ type = null, element = null } = {}) {\n const listeners = [...this._listeners];\n\n listeners.forEach((listener) => {\n if (type !== null && listener.type !== type) return;\n if (element !== null && listener.element !== element) return;\n\n this._removeEventListener(\n listener.type,\n listener.element,\n listener.listener,\n listener.options\n );\n });\n }\n\n /**\n * Focus the component.\n *\n * Sets the components's focus state to \"self\" and\n * focusses the component if the component's shouldFocus\n * value is `true`.\n */\n focus() {\n this.focusState = \"self\";\n\n if (this.shouldFocus) {\n this.rootDOMElement.focus();\n }\n }\n\n /**\n * Unfocus the component.\n *\n * Sets the component's focus state to \"none\"\n * and blurs the component if the component's shouldFocus\n * value is `true`.\n */\n blur() {\n this.focusState = \"none\";\n\n if (this.shouldFocus) {\n this.rootDOMElement.blur();\n }\n }\n\n /**\n * Disposes of the current instantiated component.\n *\n * Removes all timeouts and event listeners, removes the component from the global storage, and delete's the object.\n */\n dispose() {\n this._clearIntervals();\n this._clearTimeouts();\n this._removeEventListeners();\n this._unstore();\n\n delete this;\n }\n}\n\nexport default Component;\n","/**\n * @file\n * The Tooltip class.\n */\n\nimport {\n isValidClassList,\n isValidHoverType,\n isValidType,\n} from \"../validate.js\";\nimport { addClass, removeClass } from \"../domHelpers.js\";\nimport { keyPress, preventEvent } from \"../eventHandlers.js\";\nimport Component from \"../Component.js\";\n\n/**\n * @event grauplTooltipShow\n * Fired when the tooltip is shown.\n *\n * @type {CustomEvent}\n *\n * @property {boolean} bubbles - Whether the event bubbles.\n * @property {Object<Tooltip>} detail - The detail object.\n * @property {Tooltip} detail.tooltip - The tooltip that was shown.\n */\n\n/**\n * @event grauplTooltipHide\n * Fired when the tooltip is hidden.\n *\n * @type {CustomEvent}\n *\n * @property {boolean} bubbles - Whether the event bubbles.\n * @property {Object<Tooltip>} detail - The detail object.\n * @property {Tooltip} detail.tooltip - The tooltip that was hidden.\n */\n\n/**\n * The Tooltip component.\n *\n * @extends Component\n *\n * Protected fields are documented below.\n *\n * @property {Object<HTMLElement>} _dom - The DOM elements within the tooltip.\n * @property {HTMLElement} _dom.tooltip - The tooltip element.\n * @property {HTMLElement} _dom.tooltipToggle - The tooltip button element.\n * @property {HTMLElement} _dom.tooltipDescription - The tooltip description element.\n * @property {string} _rootDOMElement - The root DOM element of the tooltip.\n * @property {string[]} _protectedDOMElements - The DOM elements within the tooltip that cannot be reset or generated by the tooltip itself.\n * @property {Object<string, string[]>} _classes - The CSS classes to apply when the tooltip is in various states.\n * @property {string|string[]} _classes.show - The class(es) to apply when the tooltip is shown.\n * @property {string|string[]} _classes.hide - The class(es) to apply when the tooltip is hidden.\n * @property {string|string[]} _classes.transition - The class(es) to apply when the tooltip is transitioning between states.\n * @property {string|string[]} _classes.initialize - The class(es) to apply when the tooltip is initializing.\n * @property {Object<number>} _durations - The duration times (in milliseconds) for various aspects throughout the tooltip.\n * @property {number} _durations.transition - The duration time (in milliseconds) for the transition between shown and hidden states.\n * @property {number} _durations.show - The duration time (in milliseconds) for the transition from hidden to shown states.\n * @property {number} _durations.hide - The duration time (in milliseconds) for the transition from shown to hidden states.\n * @property {boolean} _open - The open state of the tooltip.\n * @property {Object<CustomEvent>} _events - Custom events that can be triggered throughout the tooltip.\n * @property {grauplTooltipShow} _events.show - The event triggered when the tooltip is shown.\n * @property {grauplTooltipHide} _events.hide - The event triggered when the tooltip is hidden.\n * @property {boolean} _closeOnBlur - Whether to close the tooltip when it loses focus in the DOM.\n * @property {boolean} _openOnFocus - Whether to open the tooltip when it gains focus in the DOM.\n * @property {string} _storageKey - The key used for storage.\n * @property {boolean} _shouldStore - A flag to check if the component should be stored in the StorageManager.\n * @property {Object<string>} _selectors - The query selectors used by the tooltip.\n * @property {Object<Tooltip>} _elements - The instantiated elements within the tooltip.\n * @property {?string} _hoverType - An indication of the tooltip's hoverType.\n * @property {Object<number>} _delays - The delay times (in milliseconds) for various aspects throughout the tooltip.\n * @property {string} _focusState - The current state of the tooltip's focus.\n * @property {string} _currentEvent - The last type of event triggered within the tooltip.\n * @property {string} _breakpoint - The breakpoint that the tooltip will call media query list events.\n * @property {string} _mediaQueryString - The media query to use to trigger media query list events.\n * @property {MediaQueryList|null} _mediaQueryList - The MediaQueryList for the tooltip.\n * @property {Function} _mediaQueryListEventCallback - The callback for media query list events.\n * @property {Object<Function>} _intervals - Intervals throughout the tooltip.\n * @property {Object<Function>} _timeouts - Timeouts throughout the tooltip.\n * @property {object[]} _listeners - Event listeners throughout the tooltip.\n * @property {string} _prefix - The prefix used for CSS custom properties and attributes.\n * @property {string} _key - The key used to generate IDs throughout the tooltip.\n * @property {string} _name - The component name of the tooltip.\n * @property {string} _id - The main ID of the tooltip.\n * @property {boolean} _valid - The validity state of the tooltip.\n * @property {boolean} _initialized - The initialized state of the tooltip.\n * @property {string[]} _errors - The errors found throughout the tooltip.\n */\n\nclass Tooltip extends Component {\n _rootDOMElement = \"tooltip\";\n _softLocked = false;\n _hoverType = \"off\";\n _open = false;\n _storageKey = \"tooltips\";\n _openOnFocus = false;\n _closeOnBlur = true;\n _name = \"Tooltip\";\n\n /**\n * Constructs a new `Tooltip`.\n *\n * @param {object} options - The options object.\n * @param {HTMLElement} [options.tooltipElement] - The tooltip element.\n * @param {HTMLElement} [options.tooltipToggleElement] - The button element.\n * @param {HTMLElement} [options.tooltipDescriptionElement] - The description element.\n * @param {string|string[]|null} [options.showClass = show] - The class(es) to apply when the tooltip is shown.\n * @param {string|string[]|null} [options.hideClass = hide] - The class(es) to apply when the tooltip is hidden.\n * @param {string|string[]|null} [options.transitionClass = transitioning] - The class(es) to apply when the tooltip is transitioning between states.\n * @param {number} [options.transitionDelay = 250] - A flag to initialize the tooltip immediately upon creation.\n * @param {number} [options.transitionDuration = 150] - The duration of the transition between \"shown\" and \"hidden\" states (in milliseconds).\n * @param {boolean} [options.showDuration = -1] - The duration of the transition from \"hidden\" to \"shown\" states (in milliseconds).\n * @param {boolean} [options.hideDuration = -1] - The duration of the transition from \"shown\" to \"hidden\" states (in milliseconds).\n * @param {?string} [options.hoverType = off] - An indication of the tooltip Description's hoverType.\n * @param {number} [options.hoverDelay = 250] - The delay time (in milliseconds) used for hover events.\n * @param {number} [options.enterDelay = -1] - The delay time (in milliseconds) used for pointerenter events.\n * @param {number} [options.leaveDelay = -1] - The delay time (in milliseconds) used for pointerleave events.\n * @param {boolean} [options.openOnFocus = false] - Whether to open the tooltip when it gains focus in the DOM.\n * @param {boolean} [options.closeOnBlur = true] - Whether to close the tooltip when it loses focus in the DOM.\n * @param {?string} [options.prefix = graupl-] - The prefix used for CSS custom properties and attributes.\n * @param {?string} [options.key = null] - The key used to generate IDs throughout the tooltip.\n * @param {?(string|string[])} [options.initializeClass = initializing] - The class(es) to apply when the tooltip is initializing.\n * @param {boolean} [options.initialize = false] - A flag to initialize the tooltip immediately upon creation.\n */\n constructor({\n tooltipElement,\n tooltipToggleElement,\n tooltipDescriptionElement,\n showClass = \"show\",\n hideClass = \"hide\",\n transitionClass = \"transitioning\",\n transitionDelay = 250,\n transitionDuration = 150,\n showDuration = -1,\n hideDuration = -1,\n openOnFocus = false,\n closeOnBlur = true,\n hoverType = \"off\",\n hoverDelay = 250,\n enterDelay = -1,\n leaveDelay = -1,\n prefix = \"graupl-\",\n key = null,\n initializeClass = \"initializing\",\n initialize = false,\n } = {}) {\n super({\n prefix,\n key,\n initializeClass,\n });\n\n // Set the DOM elements.\n this._dom.tooltip = tooltipElement;\n this._dom.tooltipToggle = tooltipToggleElement;\n this._dom.tooltipDescription = tooltipDescriptionElement;\n\n // Set the classes.\n this._classes.show = showClass || \"\";\n this._classes.hide = hideClass || \"\";\n this._classes.transition = transitionClass || \"\";\n\n // Set the durations.\n this._durations.transition = transitionDuration;\n this._durations.transitionDelay = transitionDelay;\n this._durations.show = showDuration;\n this._durations.hide = hideDuration;\n\n // Set focus settings.\n this._openOnFocus = openOnFocus;\n this._closeOnBlur = closeOnBlur;\n\n // Set hover settings.\n this._hoverType = hoverType;\n this._delays.hover = hoverDelay;\n this._delays.enter = enterDelay;\n this._delays.leave = leaveDelay;\n\n // Register custom events.\n this._registerEvent(\"show\", {\n detail: {\n tooltip: this,\n },\n });\n this._registerEvent(\"hide\", {\n detail: {\n tooltip: this,\n },\n });\n\n // Set up custom initialization.\n this._addEventListener(\n \"grauplComponentInitialize\",\n this.rootDOMElement,\n () => {\n this.hide({ force: true });\n }\n );\n\n // Set up custom validation.\n this._addEventListener(\n \"grauplComponentValidate\",\n this.rootDOMElement,\n () => {\n // Boolean checks.\n const booleans = {\n isOpen: this._open,\n };\n\n // Check the booleans.\n const booleanChecks = isValidType(\"boolean\", booleans, {\n shouldThrow: false,\n });\n\n // Handle boolean check failure.\n if (!booleanChecks.status) {\n this._errors = [...this._errors, ...booleanChecks.errors];\n this._valid = false;\n }\n\n // Hover type check.\n // Check the hover type.\n const hoverTypeCheck = isValidHoverType(\n { hoverType: this._hoverType },\n { shouldThrow: false }\n );\n\n // Handle hover type check failure.\n if (!hoverTypeCheck.status) {\n this._errors = [...this._errors, ...hoverTypeCheck.errors];\n this._valid = false;\n }\n }\n );\n\n if (initialize) {\n this.initialize();\n }\n }\n\n /**\n * The class to use to show the tooltip.\n *\n * @type {string|string[]}\n *\n * @see _classes.show\n */\n get showClass() {\n return this._classes.show;\n }\n\n set showClass(value) {\n isValidClassList({ showClass: value });\n\n if (this._classes.show !== value) {\n this._classes.show = value;\n }\n }\n\n /**\n * The class to use to hide the tooltip.\n *\n * @type {string|string[]}\n *\n * @see _classes.hide\n */\n get hideClass() {\n return this._classes.hide;\n }\n\n set hideClass(value) {\n isValidClassList({ hideClass: value });\n\n if (this._classes.hide !== value) {\n this._classes.hide = value;\n }\n }\n\n /**\n * The class to use when transitioning the tooltip.\n *\n * @type {string|string[]}\n *\n * @see _classes.transition\n */\n get transitionClass() {\n return this._classes.transition;\n }\n\n set transitionClass(value) {\n isValidClassList({ transitionClass: value });\n\n if (this._classes.transition !== value) {\n this._classes.transition = value;\n }\n }\n\n /**\n * The time in milliseconds the transition will take.\n *\n * @type {number}\n *\n * @see _durations.transition\n */\n get transitionDuration() {\n return this._durations.transition;\n }\n\n set transitionDuration(value) {\n isValidType(\"number\", { transitionDuration: value });\n\n if (this._durations.transition !== value) {\n this._durations.transition = value;\n this._setCustomProps();\n }\n }\n\n /**\n * The duration time (in milliseconds) for the transition from hidden to shown states.\n *\n * If showDuration is set to -1, the transitionDuration value will be used instead.\n *\n * Setting this value will also set the --graupl-show-transition-duration CSS custom property on the tooltip.\n *\n * @type {number}\n *\n * @see _durations.show\n */\n get showDuration() {\n if (this._durations.show === -1) return this.transitionDuration;\n\n return this._durations.show;\n }\n\n set showDuration(value) {\n isValidType(\"number\", { showDuration: value });\n\n if (this._durations.show !== value) {\n this._durations.show = value;\n this._setCustomProps();\n }\n }\n\n /**\n * The duration time (in milliseconds) for the transition from shown to hidden states.\n *\n * If hideDuration is set to -1, the transitionDuration value will be used instead.\n *\n * Setting this value will also set the --graupl-close-transition-duration CSS custom property on the tooltip.\n *\n * @type {number}\n *\n * @see _durations.hide\n */\n get hideDuration() {\n if (this._durations.hide === -1) return this.transitionDuration;\n\n return this._durations.hide;\n }\n\n set hideDuration(value) {\n isValidType(\"number\", { hideDuration: value });\n\n if (this._durations.hide !== value) {\n this._durations.hide = value;\n this._setCustomProps();\n }\n }\n\n /**\n * The open state of the tooltip.\n *\n * @readonly\n *\n * @type {boolean}\n *\n * @see _open\n */\n get isOpen() {\n return this._open;\n }\n\n /**\n * Sets the IDs of the tooltip and its children if they do not already exist.\n *\n * The generated IDs use the key and follow the format:\n * - tooltip: `tooltip-${key}`\n * - button: `tooltip-toggle-${key}`\n */\n _setIds() {\n this.dom.tooltip.id = this.dom.tooltip.id || `tooltip-${this.key}`;\n this.dom.tooltipToggle.id =\n this.dom.tooltipToggle.id || `tooltip-toggle-${this.key}`;\n this.dom.tooltipDescription.id =\n this.dom.tooltipDescription.id || `tooltip-description-${this.key}`;\n\n this._id = this.dom.tooltip.id;\n }\n\n /**\n * Sets ARIA attributes throughout the breadcrumb.\n *\n * The first steps are to ensure that the toggle has `aria-expanded` set to \"false\"\n * if it's not already explicitly set to \"true\".\n *\n * Then, set the `aria-controls` attribute on the toggle to the breadcrumb's ID.\n *\n * Finally, ensure the toggle element has a role of \"button\" if it is not a native button element.\n *\n * @protected\n */\n _setAriaAttributes() {\n if (!this.dom.tooltipToggle) return;\n\n // Set .tooltip to role tooltip\n this.dom.tooltip.setAttribute(\"role\", \"tooltip\");\n\n // Set .tooltip-toggle to role of button.\n this.dom.tooltipToggle.setAttribute(\"role\", \"button\");\n\n // Add aria-describedby to button\n if (this.dom.tooltipToggle) {\n this.dom.tooltipToggle.setAttribute(\n \"aria-describedby\",\n this.dom.tooltipDescription.id\n );\n }\n }\n\n /**\n * Reveals the tooltip.\n *\n * Adds the show class and removes the hide class from the tooltip.\n *\n * @protected\n *\n * @fires grauplTooltipShow\n *\n * @param {Object<boolean>} [options = {}] - Options for revealing the tooltip.\n * @param {boolean} [options.emit = true] - Emit the show event once revealed.\n * @param {boolean} [options.transition = true] - Respect the transition class.\n */\n _reveal({ emit = true, transition = true } = {}) {\n // If we're dealing with transition classes, then we need to utilize\n // requestAnimationFrame to add the transition class, remove the hide class,\n // add the show class, and finally remove the transition class.\n if (transition && this.transitionClass !== \"\") {\n addClass(this.transitionClass, this.dom.tooltipDescription);\n\n requestAnimationFrame(() => {\n removeClass(this.hideClass, this.dom.tooltipDescription);\n\n requestAnimationFrame(() => {\n addClass(this.showClass, this.dom.tooltipDescription);\n\n requestAnimationFrame(() => {\n this._setTimeout(\n () =>\n removeClass(this.transitionClass, this.dom.tooltipDescription),\n this.showDuration\n );\n });\n });\n });\n } else {\n // Add the show class\n addClass(this.showClass, this.dom.tooltipDescription);\n\n // Remove the hide class.\n removeClass(this.hideClass, this.dom.tooltipDescription);\n }\n\n if (emit) {\n this._dispatchEvent(\"show\", this.dom.tooltipDescription);\n }\n }\n\n /**\n * Conceals the tooltipDescription.\n *\n * Adds the hide class and removes the show class from the tooltip.\n *\n * @protected\n *\n * @fires grauplTooltipHide\n *\n * @param {Object<boolean>} [options = {}] - Options for concealing the tooltip.\n * @param {boolean} [options.emit = true] - Emit the show event once concealed.\n * @param {boolean} [options.transition = true] - Respect the transition class.\n */\n _conceal({ emit = true, transition = true } = {}) {\n // If we're dealing with transition classes, then we need to utilize\n // requestAnimationFrame to add the transition class, remove the show class,\n // add the hide class, and finally remove the transition class.\n\n this.isSoftLocked = false;\n\n if (transition && this.transitionClass !== \"\") {\n addClass(this.transitionClass, this.dom.tooltipDescription);\n\n requestAnimationFrame(() => {\n removeClass(this.showClass, this.dom.tooltipDescription);\n\n requestAnimationFrame(() => {\n addClass(this.hideClass, this.dom.tooltipDescription);\n\n requestAnimationFrame(() => {\n this._setTimeout(\n () =>\n removeClass(this.transitionClass, this.dom.tooltipDescription),\n this.hideDuration\n );\n });\n });\n });\n } else {\n // Add the hide class\n addClass(this.hideClass, this.dom.tooltipDescription);\n\n // Remove the show class.\n removeClass(this.showClass, this.dom.tooltipDescription);\n }\n\n if (emit) {\n this._dispatchEvent(\"hide\", this.dom.tooltipDescription);\n }\n }\n\n /**\n * A flag to indicate the tooltip's hoverType.\n *\n * @type {?string}\n *\n * @see _hoverType\n */\n get hoverType() {\n return this._hoverType;\n }\n\n set hoverType(value) {\n isValidHoverType({ hoverType: value });\n\n if (this._hoverType !== value) {\n this._hoverType = value;\n }\n }\n\n /**\n * The delay time (in milliseconds) used for pointerenter/pointerleave events to take place.\n *\n * @type {number}\n *\n * @see _delays\n */\n get hoverDelay() {\n return this._delays.hover;\n }\n\n set hoverDelay(value) {\n isValidType(\"number\", { hoverDelay: value });\n\n if (this._delays.hover !== value) {\n this._delays.hover = value;\n }\n }\n\n /**\n * The delay time (in milliseconds) used for pointerenter events to take place.\n *\n * If enterDelay is set to -1, the hoverDelay value will be used instead.\n *\n * @type {number}\n *\n * @see _delays\n */\n get enterDelay() {\n if (this._delays.enter === -1) return this.hoverDelay;\n\n return this._delays.enter;\n }\n\n set enterDelay(value) {\n isValidType(\"number\", { enterDelay: value });\n\n if (this._delays.enter !== value) {\n this._delays.enter = value;\n }\n }\n\n /**\n * The delay time (in milliseconds) used for pointerleave events to take place.\n *\n * If leaveDelay is set to -1, the hoverDelay value will be used instead.\n *\n * @type {number}\n *\n * @see _delays\n */\n get leaveDelay() {\n if (this._delays.leave === -1) return this.hoverDelay;\n\n return this._delays.leave;\n }\n\n set leaveDelay(value) {\n isValidType(\"number\", { leaveDelay: value });\n\n if (this._delays.leave !== value) {\n this._delays.leave = value;\n }\n }\n\n /**\n * A flag to check if the tooltipDescription can dynamically hover.\n *\n * @type {boolean}\n *\n * @see _softLocked\n */\n get isSoftLocked() {\n return this._softLocked;\n }\n\n set isSoftLocked(value) {\n isValidType(\"boolean\", { isSoftLocked: value });\n\n if (this._softLocked !== value) {\n this._softLocked = value;\n }\n }\n\n /**\n * Whether to open the breadcrumb when it gains focus in the DOM.\n *\n * @type {boolean}\n *\n * @see _openOnFocus\n */\n get openOnFocus() {\n return this._openOnFocus;\n }\n\n set openOnFocus(value) {\n isValidType(\"boolean\", { openOnFocus: value });\n\n if (this._openOnFocus !== value) {\n this._openOnFocus = value;\n }\n }\n\n /**\n * Whether to close the breadcrumb when it loses focus in the DOM.\n *\n * @type {boolean}\n *\n * @see _closeOnBlur\n */\n get closeOnBlur() {\n return this._closeOnBlur;\n }\n\n set closeOnBlur(value) {\n isValidType(\"boolean\", { closeOnBlur: value });\n\n if (this._closeOnBlur !== value) {\n this._closeOnBlur = value;\n }\n }\n\n /**\n * Sets custom props throughout the tooltip.\n *\n * The custom properties are:\n * - `--graupl-tooltip-transition-duration`,\n * - `--graupl-tooltip-show-transition-duration`, and\n * - `--graupl-tooltip-hide-transition-duration`.\n *\n * The prefix of `graupl-` can be changed by setting the tooltip's prefix value.\n *\n * @protected\n */\n _setCustomProps() {\n this.dom.tooltip.style.setProperty(\n `--${this.prefix}tooltip-transition-duration`,\n `${this.transitionDuration}ms`\n );\n\n this.dom.tooltip.style.setProperty(\n `--${this.prefix}tooltip-show-transition-duration`,\n `${this.showDuration}ms`\n );\n\n this.dom.tooltip.style.setProperty(\n `--${this.prefix}tooltip-hide-transition-duration`,\n `${this.hideDuration}ms`\n );\n }\n\n /**\n * Handles click events throughout the tooltip for proper use.\n *\n * - Adds a `click` listener to the button that will hide the tooltip.\n *\n * @protected\n */\n _handleClick() {\n this._addEventListener(\"click\", this.dom.tooltipToggle, (event) => {\n this.currentEvent = \"mouse\";\n\n if (event.button !== 0) return;\n\n preventEvent(event);\n this.isSoftLocked = true;\n this.toggle();\n });\n\n // Make sure event and focus states are updated when clicking on the description.\n this._addEventListener(\"click\", this.dom.tooltipDescription, (event) => {\n this.currentEvent = \"mouse\";\n\n if (event.button !== 0) return;\n\n this.focusState = \"self\";\n });\n\n // Close the tooltip if a click happens outside of it.\n this._addEventListener(\"click\", document, (event) => {\n if (this.focusState !== \"self\") return;\n if (!this.closeOnBlur) return;\n if (\n this.dom.tooltip === event.target ||\n this.dom.tooltip.contains(event.target)\n ) {\n return;\n }\n\n this.currentEvent = \"mouse\";\n this.hide();\n });\n }\n\n /**\n * Handles focus events throughout the tooltip.\n *\n * - Adds a `focus` listener to the tooltip so when the tooltip gains focus it will open.\n * - Adds a `focusout` listener to the tooltip so when the tooltip loses focus it will close.\n */\n _handleFocus() {\n this._addEventListener(\"focus\", this.dom.tooltip, () => {\n this.focusState = \"self\";\n });\n\n this._addEventListener(\"focusout\", this.dom.tooltip, (event) => {\n if (\n !this.closeOnBlur ||\n this.currentEvent !== \"keyboard\" ||\n event.relatedTarget === null ||\n this.dom.tooltip.contains(event.relatedTarget)\n ) {\n return;\n }\n\n this.hide();\n });\n }\n\n /**\n * Handles keydown events throughout the tooltip for proper use.\n *\n * This method exists to assist the _handleKeyup method.\n *\n * - Adds a `keydown` listener to the button.\n * - Blocks propagation on \"Space\" and \"Enter\" keys.\n * - Adds a `keydown` listener to the tooltip.\n * - Blocks propagation on \"Escape\" key.\n */\n _handleKeydown() {\n this._addEventListener(\"keydown\", this.dom.tooltipToggle, (event) => {\n this.currentEvent = \"keyboard\";\n const key = keyPress(event);\n\n // Prevent default behavior for space and enter keys.\n if (key === \"Space\" || key === \"Enter\") {\n preventEvent(event);\n }\n });\n\n this._addEventListener(\"keydown\", this.dom.tooltip, (event) => {\n this.currentEvent = \"keyboard\";\n const key = keyPress(event);\n\n // Prevent default behavior for escape key.\n if (key === \"Escape\") {\n preventEvent(event);\n }\n });\n }\n\n /**\n * Handles keyup events throughout the tooltip for proper use.\n *\n * - Adds a `keyup` listener to the button (if it exists).\n * - Hides the tooltip when the user hits \"Space\" or \"Enter\".\n */\n _handleKeyup() {\n this._addEventListener(\"keyup\", this.dom.tooltipToggle, (event) => {\n this.currentEvent = \"keyboard\";\n\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n preventEvent(event);\n this.toggle();\n\n break;\n case \"Tab\":\n if (this.openOnFocus) {\n preventEvent(event);\n this.show();\n }\n\n break;\n }\n });\n\n this._addEventListener(\"keyup\", this.dom.tooltip, (event) => {\n this.currentEvent = \"keyboard\";\n\n const key = keyPress(event);\n\n switch (key) {\n case \"Escape\":\n preventEvent(event);\n this.hide();\n\n break;\n }\n });\n\n this._addEventListener(\"keyup\", document, (event) => {\n const key = keyPress(event);\n\n switch (key) {\n case \"Escape\":\n if (this.hoverType !== \"on\" && this.focusState !== \"self\") return;\n\n this.currentEvent = \"keyboard\";\n this.hide();\n\n break;\n }\n });\n }\n\n /**\n * Handles the hover events throughout the tooltip for proper use.\n *\n * - Adds a `pointerenter` listener to the tooltip to show tooltip.\n * - Adds a `pointerleave` listener to the tooltip to hide tooltip.\n */\n _handleHover() {\n this._addEventListener(\"pointerenter\", this.dom.tooltip, (event) => {\n // Exit out of the event if it was not made by a mouse.\n if (event.pointerType === \"pen\" || event.pointerType === \"touch\") {\n return;\n }\n\n if (this.hoverType === \"off\") return;\n\n this.currentEvent = \"mouse\";\n\n if (this.enterDelay > 0) {\n this._clearTimeout();\n this._setTimeout(() => {\n this.show();\n }, this.enterDelay);\n } else {\n this.show();\n }\n });\n\n this._addEventListener(\"pointerleave\", this.dom.tooltip, (event) => {\n // Exit out of the event if it was not made by a mouse.\n if (event.pointerType === \"pen\" || event.pointerType === \"touch\") {\n return;\n }\n\n if (this.hoverType == \"off\") return;\n if (this.isSoftLocked) return;\n\n this.currentEvent = \"mouse\";\n\n if (this.leaveDelay > 0) {\n this._clearTimeout();\n this._setTimeout(() => {\n this.hide();\n }, this.leaveDelay);\n } else {\n this.hide();\n }\n });\n }\n\n /**\n * Shows the tooltip.\n *\n * Sets the tooltip's focus state to \"self\", calls reveal, and sets isOpen to `true`.\n *\n * @param {Object<boolean>} [options = {}] - Options for opening the tooltip.\n * @param {boolean} [options.force = false] - Whether to force the open action.\n * @param {boolean} [options.emit = this.isInitialized] - Whether to emit the expand event once opened.\n * @param {boolean} [options.transition = this.isInitialized] - Respect the transition class.\n */\n show({\n force = false,\n emit = this.isInitialized,\n transition = this.isInitialized,\n } = {}) {\n if (this.isOpen && !force) return;\n\n // Set the focus state.\n this.focusState = \"self\";\n\n // Reveal the tooltip.\n this._reveal({ emit, transition });\n\n // Set the open state.\n this._open = true;\n }\n\n /**\n * Hides the tooltip.\n *\n * Sets the tooltip's focus state to \"none\", calls conceal, and sets isOpen to `false`.\n *\n * @param {Object<boolean>} [options = {}] - Options for closing the disclosure.\n * @param {boolean} [options.force = false] - Whether to force the close action.\n * @param {boolean} [options.emit = this.isInitialized] - Whether to emit the collapse event once closed.\n * @param {boolean} [options.transition = this.isInitialized] - Respect the transition class.\n */\n hide({\n force = false,\n emit = this.isInitialized,\n transition = this.isInitialized,\n } = {}) {\n if (!this.isOpen && !force) return;\n\n // Set the focus state.\n this.focusState = \"none\";\n\n // Conceal the tooltip.\n this._conceal({ emit, transition });\n\n // Set the open state.\n this._open = false;\n }\n\n /**\n * Toggles the open state of the tooltip.\n *\n * @param {Object<boolean>} [options = {}] - Options for toggling the disclosure.\n * @param {boolean} [options.force = false] - Whether to force the open or close action.\n * @param {boolean} [options.emit = this.isInitialized] - Whether to emit the expand/collapse event once toggled.\n * @param {boolean} [options.transition = this.isInitialized] - Respect the transition class.\n */\n toggle({\n force = false,\n emit = this.isInitialized,\n transition = this.isInitialized,\n } = {}) {\n if (this.isOpen) {\n this.hide({ force, emit, transition });\n } else {\n this.show({ force, emit, transition });\n }\n }\n}\n\nexport default Tooltip;\n"],"mappings":"wBAwBA,SAAgBA,EACdC,EACAC,EACA,CAAEC,YAAAA,EAAc,EAAA,EAAS,CAAA,EACzB,CACA,MAAMC,EAAS,CACbC,OAAQ,GACRC,OAAQ,CAAA,GAGV,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Aa,KAAKqD,aAAAA,EAChB,CAAA,EAAI,CACF,KAAKzC,OACP,KAAKb,KAAK,CAAEW,MAAAA,EAAOmB,KAAAA,EAAM7B,WAAAA,EAAY,EAErC,KAAKF,KAAK,CAAEY,MAAAA,EAAOmB,KAAAA,EAAM7B,WAAAA,EAAY"}
|
package/dist/js/disclosure.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(function(){function c(t,e,{shouldThrow:i=!0}={}){const s={status:!0,errors:[]};try{if(typeof e!="object"){const r=typeof e;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${r}" given.`)}for(const r in e)try{if(!(e[r]instanceof t)){const o=typeof e[r];throw new TypeError(`${r} must be an instance of ${t.name}. "${o}" given.`)}}catch(o){s.status=!1,s.errors.push(o)}}catch(r){s.status=!1,s.errors.push(r)}if(i&&!s.status)throw s.errors[0];return s}function n(t,e,{shouldThrow:i=!0}={}){const s={status:!0,errors:[]};try{if(typeof e!="object"){const r=typeof e;throw new TypeError(`Values given to isValidType() must be inside of an object. "${r}" given.`)}for(const r in e)try{const o=typeof e[r];if(o!==t)throw new TypeError(`${r} must be a ${t}. "${o}" given.`)}catch(o){s.status=!1,s.errors.push(o)}}catch(r){s.status=!1,s.errors.push(r)}if(i&&!s.status)throw s.errors[0];return s}function
|
|
1
|
+
(function(){function c(t,e,{shouldThrow:i=!0}={}){const s={status:!0,errors:[]};try{if(typeof e!="object"){const r=typeof e;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${r}" given.`)}for(const r in e)try{if(!(e[r]instanceof t)){const o=typeof e[r];throw new TypeError(`${r} must be an instance of ${t.name}. "${o}" given.`)}}catch(o){s.status=!1,s.errors.push(o)}}catch(r){s.status=!1,s.errors.push(r)}if(i&&!s.status)throw s.errors[0];return s}function n(t,e,{shouldThrow:i=!0}={}){const s={status:!0,errors:[]};try{if(typeof e!="object"){const r=typeof e;throw new TypeError(`Values given to isValidType() must be inside of an object. "${r}" given.`)}for(const r in e)try{const o=typeof e[r];if(o!==t)throw new TypeError(`${r} must be a ${t}. "${o}" given.`)}catch(o){s.status=!1,s.errors.push(o)}}catch(r){s.status=!1,s.errors.push(r)}if(i&&!s.status)throw s.errors[0];return s}function v(t,{shouldThrow:e=!0}={}){const i={status:!0,errors:[]};try{if(typeof t!="object"){const s=typeof t;throw new TypeError(`Values given to isQuerySelector() must be inside of an object. "${s}" given.`)}for(const s in t)try{try{if(t[s]===null)throw new Error;document.querySelector(t[s])}catch{throw new TypeError(`${s} must be a valid query selector. "${t[s]}" given.`)}}catch(r){i.status=!1,i.errors.push(r)}}catch(s){i.status=!1,i.errors.push(s)}if(e&&!i.status)throw i.errors[0];return i}function u(t,{shouldThrow:e=!0}={}){const i={status:!0,errors:[]};try{if(typeof t!="object"||Array.isArray(t)){const s=typeof t;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${s}" given.`)}for(const s in t)try{const r=typeof t[s];if(r!=="string")if(Array.isArray(t[s]))t[s].forEach(o=>{if(typeof o!="string")throw new TypeError(`${s} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${s} must be a string or an array of strings. "${r}" given.`);else{const o={};o[s]=t[s],v(o)}}catch(r){i.status=!1,i.errors.push(r)}}catch(s){i.status=!1,i.errors.push(s)}if(e&&!i.status)throw i.errors[0];return i}function L(t,{shouldThrow:e=!0}={}){const i={status:!0,errors:[]};try{if(typeof t!="object"){const r=typeof t;throw new TypeError(`Values given to isValidState() must be inside of an object. "${r}" given.`)}const s=["none","self","child"];for(const r in t)try{if(!s.includes(t[r]))throw new TypeError(`${r} must be one of the following values: ${s.join(", ")}. "${t[r]}" given.`)}catch(o){i.status=!1,i.errors.push(o)}}catch(s){i.status=!1,i.errors.push(s)}if(e&&!i.status)throw i.errors[0];return i}function z(t,{shouldThrow:e=!0}={}){const i={status:!0,errors:[]};try{if(typeof t!="object"){const r=typeof t;throw new TypeError(`Values given to isValidEvent() must be inside of an object. "${r}" given.`)}const s=["none","mouse","keyboard","character"];for(const r in t)try{if(!s.includes(t[r]))throw new TypeError(`${r} must be one of the following values: ${s.join(", ")}. "${t[r]}" given.`)}catch(o){i.status=!1,i.errors.push(o)}}catch(s){i.status=!1,i.errors.push(s)}if(e&&!i.status)throw i.errors[0];return i}function A(t,e,{shouldThrow:i=!0}={}){const s={status:!0,errors:[]};try{if(n("string",{tagName:t},{shouldThrow:!0}).status&&c(HTMLElement,e,{shouldThrow:!0}).status){const r=t.toLowerCase();for(const o in e)try{if(e[o].tagName.toLowerCase()!==r)throw new TypeError(`${o} must be a <${r}> element. <${e[o].tagName.toLowerCase()}> given.`)}catch(a){s.status=!1,s.errors.push(a)}}}catch(r){s.status=!1,s.errors.push(r)}if(i&&!s.status)throw s.errors[0];return s}function j(t,e,{shouldThrow:i=!0}={}){const s={status:!0,errors:[]};try{if(!Object.prototype.hasOwnProperty.call(e.events,t))throw new TypeError(`Event type "${t}" is not valid for ${e.constructor.name}. Valid event types are: "${Object.keys(e.events).join('", ')}".`)}catch(r){s.status=!1,s.errors.push(r)}if(i&&!s.status)throw s.errors[0];return s}function Q(t,{shouldThrow:e=!0}={}){const i={status:!0,errors:[]};try{if(!Object.prototype.hasOwnProperty.call(t._dom,t._rootDOMElement))throw new Error(`The root DOM element "${t._rootDOMElement}" does not exist in the ${t.constructor.name}'s _dom property. It must be one of the following: "${Object.keys(t._dom).join('", "')}".`)}catch(s){i.status=!1,i.errors.push(s)}if(e&&!i.status)throw i.errors[0];return i}function l(t,e){t===""||t.length===0||(typeof t=="string"?e.classList.add(t):e.classList.add(...t))}function h(t,e){t===""||t.length===0||(typeof t=="string"?e.classList.remove(t):e.classList.remove(...t))}function p(t){try{const e=t.key||t.keyCode,i={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,Character:isNaN(e)&&!!e.match(/^[a-zA-Z]{1}$/),Tab:e==="Tab"||e===9,Asterisk:e==="*"||e===56};return Object.keys(i).find(s=>i[s]===!0)||""}catch{return""}}function d(t){t.preventDefault(),t.stopPropagation()}var C=class{_equals=Object.is;_current;_committed;constructor(t,{equals:e=Object.is}={}){this._equals=e||Object.is,this._current=t,this._committed=t}get value(){return this._current}set value(t){this._current=t}get committed(){return this._committed}get isDirty(){return!this._equals(this._current,this._committed)}commit(){return this._committed=this._current,this}reset(){return this._current=this._committed,this}update(t){return this._current=t(this._current),this}},y=class T{_scope;_type="_default";_storage={};_crush=!1;constructor({scope:e,type:i=null,crush:s=!1,initialize:r=!0}={}){this._scope=e,this._type=i||"_default",this._crush=s,r&&this.initialize()}initialize(){try{!this._crush&&typeof window[this.scope]<"u"&&(c(T,{storage:window[this.scope]},{shouldThrow:!1}).status||typeof window[this.scope].storage<"u"&&typeof window[this.scope].scope<"u"&&typeof window[this.scope].type<"u")&&(this._storage=window[this.scope].storage)}catch{}finally{window[this.scope]=this}}get scope(){return this._scope}get type(){return this._type}set type(e){n("string",{type:e})&&(this._type=e)}get storage(){return this._storage}get({type:e=this.type,key:i=null}={}){const s=n("string",{type:e});if(!s.status)throw new Error(`StorageManager (${this.scope}): ${s.message}`);if(!this.storage[e])throw new Error(`StorageManager (${this.scope}): Type "${e}" is not initialized.`);if(i!==null){const r=n("string",{key:i});if(!r.status)throw new Error(`StorageManager (${this.scope}): ${r.message}`);return this.storage[e][i]}return this.storage[e]}set({type:e=this.type,key:i=null,data:s={}}={}){const r=n("string",{type:e}),o=n("object",{data:s});if(!r.status)throw new Error(`StorageManager (${this.scope}): ${r.message}`);if(!o.status)throw new Error(`StorageManager (${this.scope}): ${o.message}`);if(i!==null){const a=n("string",{key:i});if(!a.status)throw new Error(`StorageManager (${this.scope}): ${a.message}`);this._storage[e]||(this._storage[e]={}),this._storage[e][i]=s}else this._storage[e]=s}clear({type:e=this.type,key:i=null}={}){const s=n("string",{type:e});if(!s.status)throw new Error(`StorageManager (${this.scope}): ${s.message}`);if(i!==null){const r=n("string",{key:i});if(!r.status)throw new Error(`StorageManager (${this.scope}): ${r.message}`);delete this.storage[e][i]}else delete this.storage[e]}dispose(){delete this._storage,delete this}},F=class{_dom={};_rootDOMElement="";_protectedDOMElements=[];_selectors={};_elements={};_classes={initialize:""};_durations={};_delays={};_focusState="none";_currentEvent="none";_breakpoint="";_mediaQueryString="";_mediaQueryList=null;_mediaQueryListEventCallback=t=>{t.matches};_intervals={};_timeouts={};_listeners=[];_events={initialize:new CustomEvent("grauplComponentInitialize",{detail:{component:this}}),preinitialize:new CustomEvent("grauplComponentPreinitialize",{detail:{component:this}}),postinitialize:new CustomEvent("grauplComponentPostinitialize",{detail:{component:this}}),validate:new CustomEvent("grauplComponentValidate",{detail:{component:this}}),prevalidate:new CustomEvent("grauplComponentPrevalidate",{detail:{component:this}}),postvalidate:new CustomEvent("grauplComponentPostvalidate",{detail:{component:this}})};_prefix="graupl-";_key="";_name="Component";_storageKey="components";_shouldStore=!0;_id="";_valid=!0;_initialized=!1;_errors=[];constructor({prefix:t="graupl-",key:e=null,initializeClass:i="initializing"}={}){this._classes.initialize=i||"",this._prefix=t||"",this._key=e||""}initialize(){try{if(!this._validate())throw new Error(`Graupl ${this.name}: Cannot initialize component. The following errors have been found:
|
|
2
2
|
- ${this.errors.map(t=>t.message).join(`
|
|
3
|
-
- `)}`);l(this.initializeClass,this.rootDOMElement),this._dispatchEvent("preinitialize",this.rootDOMElement),this._generateKey(),this._setDOMElements(),this._setIds(),this._setAriaAttributes(),this._setCustomProps(),this._createChildElements(),this._handleMediaMatch(),this._handleFocus(),this._handleHover(),this._handleClick(),this._handleKeydown(),this._handleKeyup(),this._dispatchEvent("initialize",this.rootDOMElement),this._store(),h(this.initializeClass,this.rootDOMElement),this._initialized=!0,this._dispatchEvent("postinitialize",this.rootDOMElement)}catch(t){console.error(t)}}init(){this.initialize()}get dom(){return this._dom}get rootDOMElement(){return this._dom[this._rootDOMElement]||document.documentElement}get selectors(){return this._selectors}get elements(){return this._elements}get classes(){return this._classes}get durations(){return this._durations}get delays(){return this._delays}get intervals(){return this._intervals}get timeouts(){return this._timeouts}get listeners(){return this._listeners}get events(){return this._events}get initializeClass(){return this._classes.initialize}set initializeClass(t){u({initializeClass:t}),this._classes.initialize!==t&&(this._classes.initialize=t)}get focusState(){return this._focusState}set focusState(t){z({focusState:t}),this._focusState!==t&&(this._focusState=t)}get currentEvent(){return this._currentEvent}set currentEvent(t){A({currentEvent:t}),this._currentEvent!==t&&(this._currentEvent=t)}get shouldFocus(){let t=!1;return this.currentEvent==="keyboard"&&(t=!0),t}get breakpoint(){return this._breakpoint}set breakpoint(t){n("string",{breakpoint:t}),this._breakpoint!==t&&(this._breakpoint=t)}get mediaQuery(){return this._mediaQueryString!==""?this._mediaQueryString:this._breakpoint===""?"":`(width <= ${this._breakpoint})`}set mediaQuery(t){n("string",{mediaQuery:t}),this._mediaQueryString!==t&&(this._mediaQueryString=t)}get prefix(){return this._prefix}get key(){return this._key}get name(){return this._name}get id(){return this._id}get isValid(){return this._valid}get isInitialized(){return this._initialized}get errors(){return this._errors}_validate(){this._dispatchEvent("prevalidate",this.rootDOMElement);const t=Q(this,{shouldThrow:!1});if(t.status||(this._errors=[...this._errors,...t.errors],this._valid=!1),Object.keys(this._dom).length>0){const s={};for(const o of Object.keys(this._dom))Array.isArray(this._dom[o])?this._dom[o].forEach((a,p)=>{s[`${o}Element[${p}]`]=a}):this._dom[o]!==null&&(s[`${o}Element`]=this._dom[o]);const r=c(HTMLElement,s,{shouldThrow:!1});r.status||(this._errors=[...this._errors,...r.errors],this._valid=!1)}if(Object.keys(this._selectors).length>0){const s={};for(const o of Object.keys(this._selectors))s[`${o}Selector`]=this._selectors[o];const r=C(s,{shouldThrow:!1});r.status||(this._errors=[...this._errors,...r.errors],this._valid=!1)}if(Object.keys(this._classes).length>0){const s={};for(const o of Object.keys(this._classes))this._classes[o]!==""&&(s[`${o}Class`]=this._classes[o]);const r=u(s,{shouldThrow:!1});r.status||(this._errors=[...this._errors,...r.errors],this._valid=!1)}if(Object.keys(this._durations).length>0){const s={};for(const o of Object.keys(this._durations))s[`${o}Duration`]=this._durations[o];const r=n("number",s,{shouldThrow:!1});r.status||(this._errors=[...this._errors,...r.errors],this._valid=!1)}if(Object.keys(this.delays).length>0){const s={};for(const o of Object.keys(this.delays))s[`${o}Delay`]=this.delays[o];const r=n("number",s,{shouldThrow:!1});r.status||(this._errors=[...this._errors,...r.errors],this._valid=!1)}const e={_storageKey:this._storageKey,key:this._key,prefix:this._prefix,mediaQuery:this._mediaQueryString,breakpoint:this._breakpoint};this._protectedDOMElements.forEach(s=>{e[`_protectedDOMElementType[${s}]`]=s});const i=n("string",e,{shouldThrow:!1});return i.status||(this._errors=[...this._errors,...i.errors],this._valid=!1),this._dispatchEvent("validate",this.rootDOMElement),this._dispatchEvent("postvalidate",this.rootDOMElement),this._valid}_generateKey(t=!1){(this._key===""||t)&&(this._key=Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,10))}_setIds(){}_setAriaAttributes(){}_setCustomProps(){}_setDOMElementType(t,{context:e,overwrite:i=!0,strict:s=!1}={}){if(typeof this.selectors[t]!="string")throw new Error(`Graupl ${this.name}: "${t}" is not a valid element type.`);if(this._rootDOMElement===t||this._protectedDOMElements.includes(t))throw new Error(`Graupl ${this.name}: "${t}" element cannot be set through _setDOMElementType because it is a protected element.`);c(HTMLElement,{context:e});const r=Array.from(e.querySelectorAll(this.selectors[t])).filter(o=>s?o.parentElement===e:!0);Array.isArray(this._dom[t])?i?this._dom[t]=r:this._dom[t]=[...this._dom[t],...r]:this._dom[t]=r[0]||null}_resetDOMElementType(t){if(typeof this.selectors[t]!="string")throw new Error(`Graupl ${this.name}: "${t}" is not a valid element type.`);if(this._rootDOMElement===t||this._protectedDOMElements.includes(t))throw new Error(`Graupl ${this.name}: "${t}" element cannot be reset through _resetDOMElementType because it is a protected element.`);Array.isArray(this._dom[t])?this._dom[t]=[]:this._dom[t]=null}_setDOMElements(){}_createChildElements(){}_handleMediaMatch(){this.mediaQuery!==""&&(this._mediaQueryList=window.matchMedia(this.mediaQuery),this._addEventListener("change",this._mediaQueryList,this._mediaQueryListEventCallback),this._mediaQueryListEventCallback(this._mediaQueryList))}_handleFocus(){}_handleClick(){}_handleHover(){}_handleKeydown(){}_handleKeyup(){}_store(){this._shouldStore&&(c(E,{storage:window.GrauplStorage},{shouldThrow:!1}).status||new E({scope:"GrauplStorage"}),window.GrauplStorage.set({key:this.id!==""?this.id:this.key,type:this._storageKey,data:this}))}_unstore(){this._shouldStore&&c(E,{storage:window.GrauplStorage},{shouldThrow:!1}).status&&window.GrauplStorage.clear({key:this.id!==""?this.id:this.key,type:this._storageKey})}_setInterval(t,e,i="_default"){this._clearInterval(i),this._intervals[i]=setInterval(t,e)}_clearInterval(t="_default"){clearInterval(this._intervals[t])}_clearIntervals(){for(const t of Object.keys(this._intervals))this._clearInterval(t)}_setTimeout(t,e,i="_default"){this._clearTimeout(i),this._timeouts[i]=setTimeout(t,e)}_clearTimeout(t="_default"){clearTimeout(this._timeouts[t])}_clearTimeouts(){for(const t of Object.keys(this._timeouts))this._clearTimeout(t)}_registerEvent(t,{bubbles:e=!0,detail:i={}}={}){n("string",{name:t}),n("boolean",{bubbles:e}),n("object",{detail:i});const s=`graupl${this.name}${t.charAt(0).toUpperCase()}${t.slice(1)}`;this._events[t]=new CustomEvent(s,{bubbles:e,detail:{component:this,...i}})}_dispatchEvent(t,e){j(t,this),c(HTMLElement,{element:e}),e.dispatchEvent(this.events[t])}_addEventListener(t,e,i,s={}){e.addEventListener(t,i,s),this._listeners.push({type:t,element:e,listener:i,options:s})}_removeEventListener(t,e,i,s={}){e.removeEventListener(t,i,s);let r=-1;this._listeners.forEach((o,a)=>{o.type===t&&o.element===e&&o.listener===i&&JSON.stringify(o.options)===JSON.stringify(s)&&(r=a)}),r!==-1&&this._listeners.splice(r,1)}_removeEventListeners({type:t=null,element:e=null}={}){[...this._listeners].forEach(i=>{t!==null&&i.type!==t||e!==null&&i.element!==e||this._removeEventListener(i.type,i.element,i.listener,i.options)})}focus(){this.focusState="self",this.shouldFocus&&this.rootDOMElement.focus()}blur(){this.focusState="none",this.shouldFocus&&this.rootDOMElement.blur()}dispose(){this._clearIntervals(),this._clearTimeouts(),this._removeEventListeners(),this._unstore(),delete this}},V=class extends P{_rootDOMElement="disclosure";_protectedDOMElements=["controller"];_open=new w(!1);_openInsideBreakpoint=!1;_openOutsideBreakpoint=!1;_closeInsideBreakpoint=!1;_closeOutsideBreakpoint=!1;_lockInsideBreakpoint=!1;_lockOutsideBreakpoint=!1;_unlockInsideBreakpoint=!1;_unlockOutsideBreakpoint=!1;_locked=new w(!1);_shouldOpen=!1;_closeOnBlur=!1;_storageKey="disclosures";_name="Disclosure";_mediaQueryListEventCallback=t=>{t.matches?(this.unlockInsideBreakpoint&&this.unlock(),this.isOpen&&this.closeInsideBreakpoint?(this.isLocked&&this.unlock(),this.close({preserveState:!0})):!this.isOpen&&this.openInsideBreakpoint&&(this.isLocked&&this.unlock(),this.open()),this.lockInsideBreakpoint&&this.lock()):(this.unlockOutsideBreakpoint&&this.unlock(),this.isOpen&&this.closeOutsideBreakpoint?(this.isLocked&&this.unlock(),this.close({preserveState:!0})):!this.isOpen&&this.openOutsideBreakpoint&&(this.isLocked&&this.unlock(),this.open()),this.lockOutsideBreakpoint&&this.lock())};constructor({disclosureElement:t,controllerElement:e,disclosureContentSelector:i=".disclosure-content",lockedClass:s="locked",unlockedClass:r="unlocked",openClass:o="show",closeClass:a="hide",transitionClass:p="transitioning",transitionDuration:F=250,openDuration:G=-1,closeDuration:H=-1,closeOnBlur:R=!1,minWidth:I="",breakpoint:g="",autoOpen:y=!1,openInsideBreakpoint:N=!1,openOutsideBreakpoint:D=!1,closeInsideBreakpoint:M=!1,closeOutsideBreakpoint:U=!1,lockInsideBreakpoint:W=!1,lockOutsideBreakpoint:J=!1,unlockInsideBreakpoint:Z=!1,unlockOutsideBreakpoint:X=!1,locked:Y=!1,mediaQuery:tt="",prefix:et="graupl-",key:st=null,initializeClass:it="initializing",initialize:rt=!1}={}){super({prefix:et,key:st,initializeClass:it}),this._dom.disclosure=t,this._dom.controller=e,this._selectors.content=i,this._classes.locked=s||"",this._classes.unlocked=r||"",this._classes.open=o||"",this._classes.close=a||"",this._classes.transition=p||"",this._durations.transition=F,this._durations.open=G,this._durations.close=H,this._closeOnBlur=R,I!==""&&(console.warn("`minWidth` is deprecated and will be removed in a future release. Please set `breakpoint` instead."),g===""&&(g=I)),y&&g!==""&&(console.warn("`autoOpen` is deprecated and will be removed in a future release. Please set `openOutsideBreakpoint` and `closeInsideBreakpoint` to `true` instead."),D=y,M=y),this._breakpoint=g||"",this._shouldOpen=y,this._openInsideBreakpoint=N,this._openOutsideBreakpoint=D,this._closeInsideBreakpoint=M,this._closeOutsideBreakpoint=U,this._lockInsideBreakpoint=W,this._lockOutsideBreakpoint=J,this._unlockInsideBreakpoint=Z,this._unlockOutsideBreakpoint=X,this._mediaQueryString=tt||"",this._locked=new w(Y),this._registerEvent("expand",{detail:{disclosure:this}}),this._registerEvent("collapse",{detail:{disclosure:this}}),this._registerEvent("lock",{detail:{disclosure:this}}),this._registerEvent("unlock",{detail:{disclosure:this}}),this._addEventListener("grauplComponentInitialize",this.rootDOMElement,()=>{this.dom.controller.getAttribute("aria-expanded")==="true"||this.openOutsideBreakpoint&&!window.matchMedia(this.mediaQuery).matches||this.openInsideBreakpoint&&window.matchMedia(this.mediaQuery).matches?this.open():this.close(),(this.isLocked||this.lockInsideBreakpoint&&window.matchMedia(this.mediaQuery).matches||this.lockOutsideBreakpoint&&!window.matchMedia(this.mediaQuery).matches)&&this.lock()}),this._addEventListener("grauplComponentValidate",this.rootDOMElement,()=>{const S=n("boolean",{closeOnBlur:this._closeOnBlur,openInsideBreakpoint:this._openInsideBreakpoint,openOutsideBreakpoint:this._openOutsideBreakpoint,closeInsideBreakpoint:this._closeInsideBreakpoint,closeOutsideBreakpoint:this._closeOutsideBreakpoint,lockInsideBreakpoint:this._lockInsideBreakpoint,lockOutsideBreakpoint:this._lockOutsideBreakpoint,unlockInsideBreakpoint:this._unlockInsideBreakpoint,unlockOutsideBreakpoint:this._unlockOutsideBreakpoint,locked:this._locked.value},{shouldThrow:!1});S.status||(this._errors=[...this._errors,...S.errors],this._valid=!1)}),rt&&this.initialize()}get lockedClass(){return this._classes.locked}set lockedClass(t){u({lockedClass:t}),this._classes.locked!==t&&(this._classes.locked=t)}get unlockedClass(){return this._classes.unlocked}set unlockedClass(t){u({unlockedClass:t}),this._classes.unlocked!==t&&(this._classes.unlocked=t)}get openClass(){return this._classes.open}set openClass(t){u({openClass:t}),this._classes.open!==t&&(this._classes.open=t)}get closeClass(){return this._classes.close}set closeClass(t){u({closeClass:t}),this._classes.close!==t&&(this._classes.close=t)}get transitionClass(){return this._classes.transition}set transitionClass(t){u({transitionClass:t}),this._classes.transition!==t&&(this._classes.transition=t)}get transitionDuration(){return this._durations.transition}set transitionDuration(t){n("number",{transitionDuration:t}),this._durations.transition!==t&&(this._durations.transition=t,this._setCustomProps())}get openDuration(){return this._durations.open===-1?this.transitionDuration:this._durations.open}set openDuration(t){n("number",{openDuration:t}),this._durations.open!==t&&(this._durations.open=t,this._setCustomProps())}get closeDuration(){return this._durations.close===-1?this.transitionDuration:this._durations.close}set closeDuration(t){n("number",{closeDuration:t}),this._durations.close!==t&&(this._durations.close=t,this._setCustomProps())}get minWidth(){return console.warn("`minWidth` is deprecated and will be removed in a future release. Please use `breakpoint` instead."),this.breakpoint}set minWidth(t){console.warn("`minWidth` is deprecated and will be removed in a future release. Please use `breakpoint` instead."),this.breakpoint=t}get closeOnBlur(){return this._closeOnBlur}set closeOnBlur(t){n("boolean",{closeOnBlur:t}),this._closeOnBlur!==t&&(this._closeOnBlur=t)}get isOpen(){return this._open.value}get hasOpened(){return this._open.committed}get shouldOpen(){return console.warn("`shouldOpen` is deprecated and will be removed in a future release. Please use `openOutsideBreakpoint` and `closeInsideBreakpoint` instead."),this._shouldOpen}set shouldOpen(t){console.warn("`shouldOpen` is deprecated and will be removed in a future release. Please use `openOutsideBreakpoint` and `closeInsideBreakpoint` instead."),n("boolean",{shouldOpen:t}),this._shouldOpen!==t&&(this._shouldOpen=t)}get openInsideBreakpoint(){return this._openInsideBreakpoint}set openInsideBreakpoint(t){n("boolean",{openInsideBreakpoint:t}),this._openInsideBreakpoint!==t&&(this._openInsideBreakpoint=t)}get openOutsideBreakpoint(){return this._openOutsideBreakpoint}set openOutsideBreakpoint(t){n("boolean",{openOutsideBreakpoint:t}),this._openOutsideBreakpoint!==t&&(this._openOutsideBreakpoint=t)}get closeInsideBreakpoint(){return this._closeInsideBreakpoint}set closeInsideBreakpoint(t){n("boolean",{closeInsideBreakpoint:t}),this._closeInsideBreakpoint!==t&&(this._closeInsideBreakpoint=t)}get closeOutsideBreakpoint(){return this._closeOutsideBreakpoint}set closeOutsideBreakpoint(t){n("boolean",{closeOutsideBreakpoint:t}),this._closeOutsideBreakpoint!==t&&(this._closeOutsideBreakpoint=t)}get lockInsideBreakpoint(){return this._lockInsideBreakpoint}set lockInsideBreakpoint(t){n("boolean",{lockInsideBreakpoint:t}),this._lockInsideBreakpoint!==t&&(this._lockInsideBreakpoint=t)}get lockOutsideBreakpoint(){return this._lockOutsideBreakpoint}set lockOutsideBreakpoint(t){n("boolean",{lockOutsideBreakpoint:t}),this._lockOutsideBreakpoint!==t&&(this._lockOutsideBreakpoint=t)}get isLocked(){return this._locked.value}get shouldBeLocked(){return this._locked.committed}_setIds(){this.dom.disclosure.id=this.dom.disclosure.id||`disclosure-${this.key}`,this.dom.controller.id=this.dom.controller.id||`disclosure-controller-${this.key}`,this._id=this.dom.disclosure.id}_setAriaAttributes(){this.dom.controller.getAttribute("aria-expanded")!=="true"&&this.dom.controller.setAttribute("aria-expanded","false"),this.dom.controller.setAttribute("aria-controls",this.dom.disclosure.id),T("button",{controller:this.dom.controller},{shouldThrow:!1}).status||this.dom.controller.setAttribute("role","button")}_setCustomProps(){this.dom.disclosure.style.setProperty(`--${this.prefix}disclosure-transition-duration`,`${this.transitionDuration}ms`),this.dom.disclosure.style.setProperty(`--${this.prefix}disclosure-open-transition-duration`,`${this.openDuration}ms`),this.dom.disclosure.style.setProperty(`--${this.prefix}disclosure-close-transition-duration`,`${this.closeDuration}ms`)}_setDOMElements(){this._resetDOMElementType("content"),this._setDOMElementType("content",{context:this.dom.disclosure})}_reveal({emit:t=this.isInitialized,transition:e=this.isInitialized}={}){this.dom.controller.setAttribute("aria-expanded","true"),e&&this.transitionlass!==""?(l(this.transitionClass,this.dom.disclosure),requestAnimationFrame(()=>{h(this.closeClass,this.dom.disclosure),requestAnimationFrame(()=>{l(this.openClass,this.dom.disclosure),requestAnimationFrame(()=>{setTimeout(()=>{h(this.transitionClass,this.dom.disclosure)},this.openDuration)})})})):(l(this.openClass,this.dom.disclosure),h(this.closeClass,this.dom.disclosure)),this.dom.content.removeAttribute("inert"),t&&this._dispatchEvent("expand",this.dom.controller)}_conceal({emit:t=this.isInitialized,transition:e=this.isInitialized}={}){this.dom.controller.setAttribute("aria-expanded","false"),e&&this.transitionClass!==""?(l(this.transitionClass,this.dom.disclosure),requestAnimationFrame(()=>{h(this.openClass,this.dom.disclosure),requestAnimationFrame(()=>{l(this.closeClass,this.dom.disclosure),requestAnimationFrame(()=>{setTimeout(()=>{h(this.transitionClass,this.dom.disclosure),this.dom.content.innert=!0},this.closeDuration)})})})):(l(this.closeClass,this.dom.disclosure),h(this.openClass,this.dom.disclosure)),this.dom.content.setAttribute("inert","true"),t&&this._dispatchEvent("collapse",this.dom.controller)}_lock({emit:t=this.isInitialized}={}){l(this.lockedClass,this.dom.disclosure),h(this.unlockedClass,this.dom.disclosure),this.dom.controller.setAttribute("disabled","true"),t&&this._dispatchEvent("lock",this.dom.disclosure)}_unlock({emit:t=this.isInitialized}={}){l(this.unlockedClass,this.dom.disclosure),h(this.lockedClass,this.dom.disclosure),this.dom.controller.removeAttribute("disabled"),t&&this._dispatchEvent("unlock",this.dom.disclosure)}_handleFocus(){this._addEventListener("focusout",this.dom.disclosure,t=>{!this.closeOnBlur||this.currentEvent!=="keyboard"||t.relatedTarget===null||this.dom.disclosure.contains(t.relatedTarget)||this.dom.controller===t.relatedTarget||this.close()})}_handleClick(){this._addEventListener("click",this.dom.controller,t=>{this.currentEvent="mouse",t.button===0&&(_(t),this.toggle())}),this._addEventListener("click",document,t=>{this.focusState!=="self"||!this.closeOnBlur||(this.currentEvent="mouse",!this.dom.disclosure.contains(t.target)&&this.dom.controller!==t.target&&this.close())})}_handleKeydown(){this._addEventListener("keydown",this.dom.controller,t=>{switch(this.currentEvent="keyboard",f(t)){case"Space":case"Enter":_(t);break}}),this._addEventListener("keydown",this.dom.disclosure,t=>{this.currentEvent="keyboard",f(t)==="Escape"&&_(t)})}_handleKeyup(){this._addEventListener("keyup",this.dom.controller,t=>{switch(this.currentEvent="keyboard",f(t)){case"Space":case"Enter":this.toggle(),_(t);break}}),this._addEventListener("keyup",this.dom.disclosure,t=>{this.currentEvent="keyboard",f(t)==="Escape"&&(this.close(),_(t))})}open({force:t=!1,emit:e=this.isInitialized,transition:i=this.isInitialized,preserveState:s=!1}={}){this.isOpen&&!t||this.isLocked||(this.focusState="self",this._reveal({emit:e,transition:i}),this._open.value=!0,s||this._open.commit())}preview({force:t=!1,emit:e=this.isInitialized,transition:i=this.isInitialized,preserveState:s=!1}={}){this.isOpen&&!t||this.isLocked||(this.focusState="none",this._reveal({emit:e,transition:i}),this._open.value=!0,s||this._open.commit())}close({force:t=!1,emit:e=this.isInitialized,transition:i=this.isInitialized,preserveState:s=!1}={}){!this.isOpen&&!t||this.isLocked||(this.focusState="none",this._conceal({emit:e,transition:i}),this._open.value=!1,s||this._open.commit())}toggle({force:t=!1,emit:e=this.isInitialized,transition:i=this.isInitialized,preserveState:s=!1}={}){this.isOpen?this.close({force:t,emit:e,transition:i,preserveState:s}):this.open({force:t,emit:e,transition:i,preserveState:s})}lock({force:t=!1,emit:e=this.isInitialized}={}){this.isLocked&&!t||(this._locked.value=!0,this._lock({emit:e}),this._locked.commit())}unlock({force:t=!1,emit:e=this.isInitialized}={}){!this.isLocked&&!t||(this._locked.value=!1,this._unlock({emit:e}),this._locked.commit())}toggleLock({force:t=!1,emit:e=this.isInitialized}={}){this.isLocked?this.unlock({force:t,emit:e}):this.lock({force:t,emit:e})}};const B=/[\11\12\14\15\40]+/,O="data-once",q=document;function b(t,e,i){return t[`${e}Attribute`](O,i)}function m(t){if(typeof t!="string")throw new TypeError("once ID must be a string");if(t===""||B.test(t))throw new RangeError("once ID must not be empty or contain spaces");return`[${O}~="${t}"]`}function x(t){if(!(t instanceof Element))throw new TypeError("The element must be an instance of Element");return!0}function k(t,e=q){let i=t;if(t===null)i=[];else if(t)if(e instanceof Document||e instanceof DocumentFragment||e instanceof Element)typeof t=="string"?i=e.querySelectorAll(t):t instanceof Element&&(i=[t]);else throw new TypeError('Context must be an object of type "Document", "DocumentFragment", or "Element".');else throw new TypeError("Selector must not be empty");return Array.prototype.slice.call(i)}function v(t,e,i){return e.filter(s=>{const r=x(s)&&s.matches(t);return r&&i&&i(s),r})}function $(t,{add:e,remove:i}){const s=[];b(t,"has")&&b(t,"get").trim().split(B).forEach(o=>{s.indexOf(o)<0&&o!==i&&s.push(o)}),e&&s.push(e);const r=s.join(" ");b(t,r===""?"remove":"set",r)}function d(t,e,i){return v(`:not(${m(t)})`,k(e,i),s=>$(s,{add:t}))}d.remove=(t,e,i)=>v(m(t),k(e,i),s=>$(s,{remove:t})),d.filter=(t,e,i)=>v(m(t),k(e,i)),d.find=(t,e)=>k(t?m(t):`[${O}]`,e);const K=({options:t={},context:e=document,disclosureSelector:i=".disclosure",controllerSelector:s=".disclosure-toggle"}={})=>{d("graupl-disclosure-generator",i,e).forEach(r=>{const o=r.dataset.grauplDisclosureOptions?JSON.parse(r.dataset.grauplDisclosureOptions.replace(/'/g,'"'))||{}:{},a=`${s}[data-graupl-disclosure-target="${r.id}"]`,[p]=d("graupl-disclosure-generator",a,e);if(!p){console.warn(`No controller found for disclosure with ID "${r.id}". Please ensure there is an element with the selector "${a}".`),d.remove("graupl-disclosure-generator",r);return}new V({disclosureElement:r,controllerElement:p,initialize:!0,...t,...o})})};document.addEventListener("DOMContentLoaded",()=>{K()})})();
|
|
3
|
+
- `)}`);l(this.initializeClass,this.rootDOMElement),this._dispatchEvent("preinitialize",this.rootDOMElement),this._generateKey(),this._setDOMElements(),this._setIds(),this._setAriaAttributes(),this._setCustomProps(),this._createChildElements(),this._handleMediaMatch(),this._handleFocus(),this._handleHover(),this._handleClick(),this._handleKeydown(),this._handleKeyup(),this._dispatchEvent("initialize",this.rootDOMElement),this._store(),h(this.initializeClass,this.rootDOMElement),this._initialized=!0,this._dispatchEvent("postinitialize",this.rootDOMElement)}catch(t){console.error(t)}}init(){this.initialize()}get dom(){return this._dom}get rootDOMElement(){return this._dom[this._rootDOMElement]||document.documentElement}get selectors(){return this._selectors}get elements(){return this._elements}get classes(){return this._classes}get durations(){return this._durations}get delays(){return this._delays}get intervals(){return this._intervals}get timeouts(){return this._timeouts}get listeners(){return this._listeners}get events(){return this._events}get initializeClass(){return this._classes.initialize}set initializeClass(t){u({initializeClass:t}),this._classes.initialize!==t&&(this._classes.initialize=t)}get focusState(){return this._focusState}set focusState(t){L({focusState:t}),this._focusState!==t&&(this._focusState=t)}get currentEvent(){return this._currentEvent}set currentEvent(t){z({currentEvent:t}),this._currentEvent!==t&&(this._currentEvent=t)}get shouldFocus(){let t=!1;return this.currentEvent==="keyboard"&&(t=!0),t}get breakpoint(){return this._breakpoint}set breakpoint(t){n("string",{breakpoint:t}),this._breakpoint!==t&&(this._breakpoint=t)}get mediaQuery(){return this._mediaQueryString!==""?this._mediaQueryString:this._breakpoint===""?"":`(width <= ${this._breakpoint})`}set mediaQuery(t){n("string",{mediaQuery:t}),this._mediaQueryString!==t&&(this._mediaQueryString=t)}get prefix(){return this._prefix}get key(){return this._key}get name(){return this._name}get id(){return this._id}get isValid(){return this._valid}get isInitialized(){return this._initialized}get errors(){return this._errors}_validate(){this._dispatchEvent("prevalidate",this.rootDOMElement);const t=Q(this,{shouldThrow:!1});if(t.status||(this._errors=[...this._errors,...t.errors],this._valid=!1),Object.keys(this._dom).length>0){const s={};for(const o of Object.keys(this._dom))Array.isArray(this._dom[o])?this._dom[o].forEach((a,_)=>{s[`${o}Element[${_}]`]=a}):this._dom[o]!==null&&(s[`${o}Element`]=this._dom[o]);const r=c(HTMLElement,s,{shouldThrow:!1});r.status||(this._errors=[...this._errors,...r.errors],this._valid=!1)}if(Object.keys(this._selectors).length>0){const s={};for(const o of Object.keys(this._selectors))s[`${o}Selector`]=this._selectors[o];const r=v(s,{shouldThrow:!1});r.status||(this._errors=[...this._errors,...r.errors],this._valid=!1)}if(Object.keys(this._classes).length>0){const s={};for(const o of Object.keys(this._classes))this._classes[o]!==""&&(s[`${o}Class`]=this._classes[o]);const r=u(s,{shouldThrow:!1});r.status||(this._errors=[...this._errors,...r.errors],this._valid=!1)}if(Object.keys(this._durations).length>0){const s={};for(const o of Object.keys(this._durations))s[`${o}Duration`]=this._durations[o];const r=n("number",s,{shouldThrow:!1});r.status||(this._errors=[...this._errors,...r.errors],this._valid=!1)}if(Object.keys(this.delays).length>0){const s={};for(const o of Object.keys(this.delays))s[`${o}Delay`]=this.delays[o];const r=n("number",s,{shouldThrow:!1});r.status||(this._errors=[...this._errors,...r.errors],this._valid=!1)}const e={_storageKey:this._storageKey,key:this._key,prefix:this._prefix,mediaQuery:this._mediaQueryString,breakpoint:this._breakpoint};this._protectedDOMElements.forEach(s=>{e[`_protectedDOMElementType[${s}]`]=s});const i=n("string",e,{shouldThrow:!1});return i.status||(this._errors=[...this._errors,...i.errors],this._valid=!1),this._dispatchEvent("validate",this.rootDOMElement),this._dispatchEvent("postvalidate",this.rootDOMElement),this._valid}_generateKey(t=!1){(this._key===""||t)&&(this._key=Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,10))}_setIds(){}_setAriaAttributes(){}_setCustomProps(){}_setDOMElementType(t,{context:e,overwrite:i=!0,strict:s=!1}={}){if(typeof this.selectors[t]!="string")throw new Error(`Graupl ${this.name}: "${t}" is not a valid element type.`);if(this._rootDOMElement===t||this._protectedDOMElements.includes(t))throw new Error(`Graupl ${this.name}: "${t}" element cannot be set through _setDOMElementType because it is a protected element.`);c(HTMLElement,{context:e});const r=Array.from(e.querySelectorAll(this.selectors[t])).filter(o=>s?o.parentElement===e:!0);Array.isArray(this._dom[t])?i?this._dom[t]=r:this._dom[t]=[...this._dom[t],...r]:this._dom[t]=r[0]||null}_resetDOMElementType(t){if(typeof this.selectors[t]!="string")throw new Error(`Graupl ${this.name}: "${t}" is not a valid element type.`);if(this._rootDOMElement===t||this._protectedDOMElements.includes(t))throw new Error(`Graupl ${this.name}: "${t}" element cannot be reset through _resetDOMElementType because it is a protected element.`);Array.isArray(this._dom[t])?this._dom[t]=[]:this._dom[t]=null}_setDOMElements(){}_createChildElements(){}_handleMediaMatch(){this.mediaQuery!==""&&(this._mediaQueryList=window.matchMedia(this.mediaQuery),this._addEventListener("change",this._mediaQueryList,this._mediaQueryListEventCallback),this._mediaQueryListEventCallback(this._mediaQueryList))}_handleFocus(){}_handleClick(){}_handleHover(){}_handleKeydown(){}_handleKeyup(){}_store(){this._shouldStore&&(c(y,{storage:window.GrauplStorage},{shouldThrow:!1}).status||new y({scope:"GrauplStorage"}),window.GrauplStorage.set({key:this.id!==""?this.id:this.key,type:this._storageKey,data:this}))}_unstore(){this._shouldStore&&c(y,{storage:window.GrauplStorage},{shouldThrow:!1}).status&&window.GrauplStorage.clear({key:this.id!==""?this.id:this.key,type:this._storageKey})}_setInterval(t,e,i="_default"){this._clearInterval(i),this._intervals[i]=setInterval(t,e)}_clearInterval(t="_default"){clearInterval(this._intervals[t])}_clearIntervals(){for(const t of Object.keys(this._intervals))this._clearInterval(t)}_setTimeout(t,e,i="_default"){this._clearTimeout(i),this._timeouts[i]=setTimeout(t,e)}_clearTimeout(t="_default"){clearTimeout(this._timeouts[t])}_clearTimeouts(){for(const t of Object.keys(this._timeouts))this._clearTimeout(t)}_registerEvent(t,{bubbles:e=!0,detail:i={}}={}){n("string",{name:t}),n("boolean",{bubbles:e}),n("object",{detail:i});const s=`graupl${this.name}${t.charAt(0).toUpperCase()}${t.slice(1)}`;this._events[t]=new CustomEvent(s,{bubbles:e,detail:{component:this,...i}})}_dispatchEvent(t,e){j(t,this),c(HTMLElement,{element:e}),e.dispatchEvent(this.events[t])}_addEventListener(t,e,i,s={}){e.addEventListener(t,i,s),this._listeners.push({type:t,element:e,listener:i,options:s})}_removeEventListener(t,e,i,s={}){e.removeEventListener(t,i,s);let r=-1;this._listeners.forEach((o,a)=>{o.type===t&&o.element===e&&o.listener===i&&JSON.stringify(o.options)===JSON.stringify(s)&&(r=a)}),r!==-1&&this._listeners.splice(r,1)}_removeEventListeners({type:t=null,element:e=null}={}){[...this._listeners].forEach(i=>{t!==null&&i.type!==t||e!==null&&i.element!==e||this._removeEventListener(i.type,i.element,i.listener,i.options)})}focus(){this.focusState="self",this.shouldFocus&&this.rootDOMElement.focus()}blur(){this.focusState="none",this.shouldFocus&&this.rootDOMElement.blur()}dispose(){this._clearIntervals(),this._clearTimeouts(),this._removeEventListeners(),this._unstore(),delete this}},V=class extends F{_rootDOMElement="disclosure";_protectedDOMElements=["controller"];_open=new C(!1);_locked=new C(!1);_openInsideBreakpoint=!1;_openOutsideBreakpoint=!1;_closeInsideBreakpoint=!1;_closeOutsideBreakpoint=!1;_lockInsideBreakpoint=!1;_lockOutsideBreakpoint=!1;_unlockInsideBreakpoint=!1;_unlockOutsideBreakpoint=!1;_openOnFocus=!1;_closeOnBlur=!1;_storageKey="disclosures";_name="Disclosure";_mediaQueryListEventCallback=t=>{t.matches?(this.unlockInsideBreakpoint&&this.unlock(),this.isOpen&&this.closeInsideBreakpoint?(this.isLocked&&this.unlock(),this.close({preserveState:!0})):!this.isOpen&&this.openInsideBreakpoint&&(this.isLocked&&this.unlock(),this.open()),this.lockInsideBreakpoint&&this.lock()):(this.unlockOutsideBreakpoint&&this.unlock(),this.isOpen&&this.closeOutsideBreakpoint?(this.isLocked&&this.unlock(),this.close({preserveState:!0})):!this.isOpen&&this.openOutsideBreakpoint&&(this.isLocked&&this.unlock(),this.open()),this.lockOutsideBreakpoint&&this.lock())};constructor({disclosureElement:t,controllerElement:e,disclosureContentSelector:i=".disclosure-content",lockedClass:s="locked",unlockedClass:r="unlocked",openClass:o="show",closeClass:a="hide",transitionClass:_="transitioning",transitionDuration:K=250,openDuration:G=-1,closeDuration:H=-1,openOnFocus:R=!1,closeOnBlur:N=!1,minWidth:I="",breakpoint:g="",autoOpen:b=!1,openInsideBreakpoint:U=!1,openOutsideBreakpoint:D=!1,closeInsideBreakpoint:M=!1,closeOutsideBreakpoint:J=!1,lockInsideBreakpoint:Z=!1,lockOutsideBreakpoint:W=!1,unlockInsideBreakpoint:X=!1,unlockOutsideBreakpoint:Y=!1,locked:tt=!1,mediaQuery:et="",prefix:st="graupl-",key:it=null,initializeClass:rt="initializing",initialize:ot=!1}={}){super({prefix:st,key:it,initializeClass:rt}),this._dom.disclosure=t,this._dom.controller=e,this._selectors.content=i,this._classes.locked=s||"",this._classes.unlocked=r||"",this._classes.open=o||"",this._classes.close=a||"",this._classes.transition=_||"",this._durations.transition=K,this._durations.open=G,this._durations.close=H,this._openOnFocus=R,this._closeOnBlur=N,I!==""&&(console.warn("`minWidth` is deprecated and will be removed in a future release. Please set `breakpoint` instead."),g===""&&(g=I)),b&&g!==""&&(console.warn("`autoOpen` is deprecated and will be removed in a future release. Please set `openOutsideBreakpoint` and `closeInsideBreakpoint` to `true` instead."),D=b,M=b),this._breakpoint=g||"",this._openInsideBreakpoint=U,this._openOutsideBreakpoint=D,this._closeInsideBreakpoint=M,this._closeOutsideBreakpoint=J,this._lockInsideBreakpoint=Z,this._lockOutsideBreakpoint=W,this._unlockInsideBreakpoint=X,this._unlockOutsideBreakpoint=Y,this._mediaQueryString=et||"",this._locked.value=tt,this._locked.commit(),this._registerEvent("expand",{detail:{disclosure:this}}),this._registerEvent("collapse",{detail:{disclosure:this}}),this._registerEvent("lock",{detail:{disclosure:this}}),this._registerEvent("unlock",{detail:{disclosure:this}}),this._addEventListener("grauplComponentInitialize",this.rootDOMElement,()=>{requestAnimationFrame(()=>{this.dom.controller.getAttribute("aria-expanded")==="true"||this.openOutsideBreakpoint&&!window.matchMedia(this.mediaQuery).matches||this.openInsideBreakpoint&&window.matchMedia(this.mediaQuery).matches?this.open({force:!0}):this.close({force:!0}),this.isLocked||this.lockInsideBreakpoint&&window.matchMedia(this.mediaQuery).matches||this.lockOutsideBreakpoint&&!window.matchMedia(this.mediaQuery).matches?this.lock({force:!0}):this.unlock({force:!0})})}),this._addEventListener("grauplComponentValidate",this.rootDOMElement,()=>{const S=n("boolean",{openOnFocus:this._openOnFocus,closeOnBlur:this._closeOnBlur,openInsideBreakpoint:this._openInsideBreakpoint,openOutsideBreakpoint:this._openOutsideBreakpoint,closeInsideBreakpoint:this._closeInsideBreakpoint,closeOutsideBreakpoint:this._closeOutsideBreakpoint,lockInsideBreakpoint:this._lockInsideBreakpoint,lockOutsideBreakpoint:this._lockOutsideBreakpoint,unlockInsideBreakpoint:this._unlockInsideBreakpoint,unlockOutsideBreakpoint:this._unlockOutsideBreakpoint,locked:this._locked.value},{shouldThrow:!1});S.status||(this._errors=[...this._errors,...S.errors],this._valid=!1)}),ot&&this.initialize()}get lockedClass(){return this._classes.locked}set lockedClass(t){u({lockedClass:t}),this._classes.locked!==t&&(this._classes.locked=t)}get unlockedClass(){return this._classes.unlocked}set unlockedClass(t){u({unlockedClass:t}),this._classes.unlocked!==t&&(this._classes.unlocked=t)}get openClass(){return this._classes.open}set openClass(t){u({openClass:t}),this._classes.open!==t&&(this._classes.open=t)}get closeClass(){return this._classes.close}set closeClass(t){u({closeClass:t}),this._classes.close!==t&&(this._classes.close=t)}get transitionClass(){return this._classes.transition}set transitionClass(t){u({transitionClass:t}),this._classes.transition!==t&&(this._classes.transition=t)}get transitionDuration(){return this._durations.transition}set transitionDuration(t){n("number",{transitionDuration:t}),this._durations.transition!==t&&(this._durations.transition=t,this._setCustomProps())}get openDuration(){return this._durations.open===-1?this.transitionDuration:this._durations.open}set openDuration(t){n("number",{openDuration:t}),this._durations.open!==t&&(this._durations.open=t,this._setCustomProps())}get closeDuration(){return this._durations.close===-1?this.transitionDuration:this._durations.close}set closeDuration(t){n("number",{closeDuration:t}),this._durations.close!==t&&(this._durations.close=t,this._setCustomProps())}get openOnFocus(){return this._openOnFocus}set openOnFocus(t){n("boolean",{openOnFocus:t}),this._openOnFocus!==t&&(this._openOnFocus=t)}get closeOnBlur(){return this._closeOnBlur}set closeOnBlur(t){n("boolean",{closeOnBlur:t}),this._closeOnBlur!==t&&(this._closeOnBlur=t)}get isOpen(){return this._open.value}get hasOpened(){return this._open.committed}get openInsideBreakpoint(){return this._openInsideBreakpoint}set openInsideBreakpoint(t){n("boolean",{openInsideBreakpoint:t}),this._openInsideBreakpoint!==t&&(this._openInsideBreakpoint=t)}get openOutsideBreakpoint(){return this._openOutsideBreakpoint}set openOutsideBreakpoint(t){n("boolean",{openOutsideBreakpoint:t}),this._openOutsideBreakpoint!==t&&(this._openOutsideBreakpoint=t)}get closeInsideBreakpoint(){return this._closeInsideBreakpoint}set closeInsideBreakpoint(t){n("boolean",{closeInsideBreakpoint:t}),this._closeInsideBreakpoint!==t&&(this._closeInsideBreakpoint=t)}get closeOutsideBreakpoint(){return this._closeOutsideBreakpoint}set closeOutsideBreakpoint(t){n("boolean",{closeOutsideBreakpoint:t}),this._closeOutsideBreakpoint!==t&&(this._closeOutsideBreakpoint=t)}get lockInsideBreakpoint(){return this._lockInsideBreakpoint}set lockInsideBreakpoint(t){n("boolean",{lockInsideBreakpoint:t}),this._lockInsideBreakpoint!==t&&(this._lockInsideBreakpoint=t)}get lockOutsideBreakpoint(){return this._lockOutsideBreakpoint}set lockOutsideBreakpoint(t){n("boolean",{lockOutsideBreakpoint:t}),this._lockOutsideBreakpoint!==t&&(this._lockOutsideBreakpoint=t)}get isLocked(){return this._locked.value}get shouldBeLocked(){return this._locked.committed}_setIds(){this.dom.disclosure.id=this.dom.disclosure.id||`disclosure-${this.key}`,this.dom.controller.id=this.dom.controller.id||`disclosure-controller-${this.key}`,this._id=this.dom.disclosure.id}_setAriaAttributes(){this.dom.controller.getAttribute("aria-expanded")!=="true"&&this.dom.controller.setAttribute("aria-expanded","false"),this.dom.controller.setAttribute("aria-controls",this.dom.disclosure.id),A("button",{controller:this.dom.controller},{shouldThrow:!1}).status||this.dom.controller.setAttribute("role","button")}_setCustomProps(){this.dom.disclosure.style.setProperty(`--${this.prefix}disclosure-transition-duration`,`${this.transitionDuration}ms`),this.dom.disclosure.style.setProperty(`--${this.prefix}disclosure-open-transition-duration`,`${this.openDuration}ms`),this.dom.disclosure.style.setProperty(`--${this.prefix}disclosure-close-transition-duration`,`${this.closeDuration}ms`)}_setDOMElements(){this._resetDOMElementType("content"),this._setDOMElementType("content",{context:this.dom.disclosure})}_reveal({emit:t=this.isInitialized,transition:e=this.isInitialized}={}){this.dom.controller.setAttribute("aria-expanded","true"),e&&this.transitionlass!==""?(l(this.transitionClass,this.dom.disclosure),requestAnimationFrame(()=>{h(this.closeClass,this.dom.disclosure),requestAnimationFrame(()=>{l(this.openClass,this.dom.disclosure),requestAnimationFrame(()=>{setTimeout(()=>{h(this.transitionClass,this.dom.disclosure)},this.openDuration)})})})):(l(this.openClass,this.dom.disclosure),h(this.closeClass,this.dom.disclosure)),this.dom.content.removeAttribute("inert"),t&&this._dispatchEvent("expand",this.dom.controller)}_conceal({emit:t=this.isInitialized,transition:e=this.isInitialized}={}){this.dom.controller.setAttribute("aria-expanded","false"),e&&this.transitionClass!==""?(l(this.transitionClass,this.dom.disclosure),requestAnimationFrame(()=>{h(this.openClass,this.dom.disclosure),requestAnimationFrame(()=>{l(this.closeClass,this.dom.disclosure),requestAnimationFrame(()=>{setTimeout(()=>{h(this.transitionClass,this.dom.disclosure),this.dom.content.innert=!0},this.closeDuration)})})})):(l(this.closeClass,this.dom.disclosure),h(this.openClass,this.dom.disclosure)),this.dom.content.setAttribute("inert","true"),t&&this._dispatchEvent("collapse",this.dom.controller)}_lock({emit:t=this.isInitialized}={}){l(this.lockedClass,this.dom.disclosure),h(this.unlockedClass,this.dom.disclosure),this.dom.controller.setAttribute("disabled","true"),t&&this._dispatchEvent("lock",this.dom.disclosure)}_unlock({emit:t=this.isInitialized}={}){l(this.unlockedClass,this.dom.disclosure),h(this.lockedClass,this.dom.disclosure),this.dom.controller.removeAttribute("disabled"),t&&this._dispatchEvent("unlock",this.dom.disclosure)}_handleFocus(){this._addEventListener("focusout",this.dom.disclosure,t=>{!this.closeOnBlur||this.currentEvent!=="keyboard"||t.relatedTarget===null||this.dom.disclosure.contains(t.relatedTarget)||this.dom.controller.contains(t.relatedTarget)||this.dom.controller===t.relatedTarget||this.dom.disclosure===t.relatedTarget||this.close()}),this._addEventListener("focusout",this.dom.controller,t=>{!this.closeOnBlur||this.currentEvent!=="keyboard"||t.relatedTarget===null||this.dom.disclosure.contains(t.relatedTarget)||this.dom.controller.contains(t.relatedTarget)||this.dom.controller===t.relatedTarget||this.dom.disclosure===t.relatedTarget||this.close()})}_handleClick(){this._addEventListener("click",this.dom.controller,t=>{this.currentEvent="mouse",t.button===0&&(d(t),this.toggle())}),this._addEventListener("click",document,t=>{this.focusState!=="self"||!this.closeOnBlur||(this.currentEvent="mouse",!this.dom.disclosure.contains(t.target)&&this.dom.controller!==t.target&&this.close())})}_handleKeydown(){this._addEventListener("keydown",this.dom.controller,t=>{switch(this.currentEvent="keyboard",p(t)){case"Space":case"Enter":d(t);break}}),this._addEventListener("keydown",this.dom.disclosure,t=>{this.currentEvent="keyboard",p(t)==="Escape"&&d(t)})}_handleKeyup(){this._addEventListener("keyup",this.dom.controller,t=>{switch(this.currentEvent="keyboard",p(t)){case"Space":case"Enter":this.toggle(),d(t);break;case"Tab":this.openOnFocus&&(d(t),this.open());break}}),this._addEventListener("keyup",this.dom.disclosure,t=>{this.currentEvent="keyboard",p(t)==="Escape"&&(this.close(),d(t))})}open({force:t=!1,emit:e=this.isInitialized,transition:i=this.isInitialized,preserveState:s=!1}={}){this.isOpen&&!t||this.isLocked&&!t||(this.focusState="self",this._reveal({emit:e,transition:i}),this._open.value=!0,s||this._open.commit())}preview({force:t=!1,emit:e=this.isInitialized,transition:i=this.isInitialized,preserveState:s=!1}={}){this.isOpen&&!t||this.isLocked&&!t||(this.focusState="none",this._reveal({emit:e,transition:i}),this._open.value=!0,s||this._open.commit())}close({force:t=!1,emit:e=this.isInitialized,transition:i=this.isInitialized,preserveState:s=!1}={}){!this.isOpen&&!t||this.isLocked&&!t||(this.focusState="none",this._conceal({emit:e,transition:i}),this._open.value=!1,s||this._open.commit())}toggle({force:t=!1,emit:e=this.isInitialized,transition:i=this.isInitialized,preserveState:s=!1}={}){this.isOpen?this.close({force:t,emit:e,transition:i,preserveState:s}):this.open({force:t,emit:e,transition:i,preserveState:s})}lock({force:t=!1,emit:e=this.isInitialized,preserveState:i=!1}={}){this.isLocked&&!t||(this._locked.value=!0,this._lock({emit:e}),i||this._locked.commit())}unlock({force:t=!1,emit:e=this.isInitialized,preserveState:i=!1}={}){!this.isLocked&&!t||(this._locked.value=!1,this._unlock({emit:e}),i||this._locked.commit())}toggleLock({force:t=!1,emit:e=this.isInitialized,preserveState:i=!1}={}){this.isLocked?this.unlock({force:t,emit:e,preserveState:i}):this.lock({force:t,emit:e,preserveState:i})}};const B=/[\11\12\14\15\40]+/,w="data-once",P=document;function E(t,e,i){return t[`${e}Attribute`](w,i)}function m(t){if(typeof t!="string")throw new TypeError("once ID must be a string");if(t===""||B.test(t))throw new RangeError("once ID must not be empty or contain spaces");return`[${w}~="${t}"]`}function q(t){if(!(t instanceof Element))throw new TypeError("The element must be an instance of Element");return!0}function k(t,e=P){let i=t;if(t===null)i=[];else if(t)if(e instanceof Document||e instanceof DocumentFragment||e instanceof Element)typeof t=="string"?i=e.querySelectorAll(t):t instanceof Element&&(i=[t]);else throw new TypeError('Context must be an object of type "Document", "DocumentFragment", or "Element".');else throw new TypeError("Selector must not be empty");return Array.prototype.slice.call(i)}function O(t,e,i){return e.filter(s=>{const r=q(s)&&s.matches(t);return r&&i&&i(s),r})}function $(t,{add:e,remove:i}){const s=[];E(t,"has")&&E(t,"get").trim().split(B).forEach(o=>{s.indexOf(o)<0&&o!==i&&s.push(o)}),e&&s.push(e);const r=s.join(" ");E(t,r===""?"remove":"set",r)}function f(t,e,i){return O(`:not(${m(t)})`,k(e,i),s=>$(s,{add:t}))}f.remove=(t,e,i)=>O(m(t),k(e,i),s=>$(s,{remove:t})),f.filter=(t,e,i)=>O(m(t),k(e,i)),f.find=(t,e)=>k(t?m(t):`[${w}]`,e);const x=({options:t={},context:e=document,disclosureSelector:i=".disclosure",controllerSelector:s=".disclosure-toggle"}={})=>{f("graupl-disclosure-generator",i,e).forEach(r=>{const o=r.dataset.grauplDisclosureOptions?JSON.parse(r.dataset.grauplDisclosureOptions.replace(/'/g,'"'))||{}:{},a=`${s}[data-graupl-disclosure-target="${r.id}"]`,[_]=f("graupl-disclosure-generator",a,e);if(!_){console.warn(`No controller found for disclosure with ID "${r.id}". Please ensure there is an element with the selector "${a}".`),f.remove("graupl-disclosure-generator",r);return}new V({disclosureElement:r,controllerElement:_,initialize:!0,...t,...o})})};document.addEventListener("DOMContentLoaded",()=>{x()})})();
|
|
4
4
|
|
|
5
5
|
//# sourceMappingURL=disclosure.js.map
|