1 |
- {"version":3,"file":"dropdown.cjs","sources":["../../src/strings/dropdownComponent.ts","../../src/strings/dropdownMenuClass.ts","../../src/util/isEmptyAnchor.ts","../../src/components/dropdown.ts"],"sourcesContent":["/** @type {string} */\nconst dropdownComponent = \"Dropdown\";\nexport default dropdownComponent;\n","/**\n * Global namespace for `.dropdown-menu`.\n */\nconst dropdownMenuClass = \"dropdown-menu\";\nexport default dropdownMenuClass;\n","import { closest, getAttribute, hasAttribute } from \"@thednp/shorty\";\n\n/**\n * Checks if an *event.target* or its parent has an `href=\"#\"` value.\n * We need to prevent jumping around onclick, don't we?\n *\n * @param element the target element\n * @returns the query result\n */\nconst isEmptyAnchor = (element: HTMLElement) => {\n // `EventTarget` must be `HTMLElement`\n const parentAnchor = closest(element, \"A\");\n return (\n (element.tagName === \"A\" &&\n // anchor href starts with #\n hasAttribute(element, \"href\") &&\n (getAttribute(element, \"href\"))?.slice(-1) === \"#\") ||\n // OR a child of an anchor with href starts with #\n (parentAnchor &&\n hasAttribute(parentAnchor, \"href\") &&\n (getAttribute(parentAnchor, \"href\"))?.slice(-1) === \"#\")\n );\n};\nexport default isEmptyAnchor;\n","/* Native JavaScript for Bootstrap 5 | Dropdown\n----------------------------------------------- */\nimport {\n addClass,\n ariaExpanded,\n closest,\n createCustomEvent,\n CSS4Declaration,\n dispatchEvent,\n focus,\n focusEvent,\n getAttribute,\n getBoundingClientRect,\n getDocument,\n getDocumentElement,\n getElementsByClassName,\n getElementStyle,\n getInstance,\n hasClass,\n isHTMLElement,\n isRTL,\n keyArrowDown,\n keyArrowUp,\n KeyboardEvent,\n keydownEvent,\n keyEscape,\n keyupEvent,\n mouseclickEvent,\n mousedownEvent,\n MouseEvent,\n ObjectAssign,\n removeClass,\n setAttribute,\n setElementStyle,\n} from \"@thednp/shorty\";\n\nimport { addListener, removeListener } from \"@thednp/event-listener\";\nimport PositionObserver from \"@thednp/position-observer\";\n\nimport showClass from \"~/strings/showClass\";\nimport dataBsToggle from \"~/strings/dataBsToggle\";\nimport dropdownClasses from \"~/strings/dropdownClasses\";\nimport dropdownComponent from \"~/strings/dropdownComponent\";\nimport dropdownMenuClass from \"~/strings/dropdownMenuClass\";\nimport isEmptyAnchor from \"~/util/isEmptyAnchor\";\nimport isDisabled from \"~/util/isDisabled\";\nimport BaseComponent from \"./base-component\";\nimport type { DropdownEvent, DropdownOptions } from \"~/interface/dropdown\";\n\n// DROPDOWN PRIVATE GC\n// ===================\nconst [dropdownString, dropupString, dropstartString, dropendString] =\n dropdownClasses;\nconst dropdownSelector = `[${dataBsToggle}=\"${dropdownString}\"]`;\n\n/**\n * Static method which returns an existing `Dropdown` instance associated\n * to a target `Element`.\n */\nconst getDropdownInstance = (element: Element) =>\n getInstance<Dropdown>(element, dropdownComponent);\n\n/**\n * A `Dropdown` initialization callback.\n */\nconst dropdownInitCallback = (element: Element) => new Dropdown(element);\n\n// DROPDOWN PRIVATE GC\n// ===================\n// const dropdownMenuStartClass = `${dropdownMenuClass}-start`;\nconst dropdownMenuEndClass = `${dropdownMenuClass}-end`;\nconst verticalClass = [dropdownString, dropupString];\nconst horizontalClass = [dropstartString, dropendString];\nconst menuFocusTags = [\"A\", \"BUTTON\"];\n\nconst dropdownDefaults = {\n offset: 5, // [number] 5(px)\n display: \"dynamic\", // [dynamic|static]\n};\n\ntype DropdownEventProps = { relatedTarget: Element & EventTarget };\n\n// DROPDOWN CUSTOM EVENTS\n// ======================\nconst showDropdownEvent = createCustomEvent<DropdownEventProps, DropdownEvent>(\n `show.bs.${dropdownString}`,\n);\nconst shownDropdownEvent = createCustomEvent<DropdownEventProps, DropdownEvent>(\n `shown.bs.${dropdownString}`,\n);\nconst hideDropdownEvent = createCustomEvent<DropdownEventProps, DropdownEvent>(\n `hide.bs.${dropdownString}`,\n);\nconst hiddenDropdownEvent = createCustomEvent<\n DropdownEventProps,\n DropdownEvent\n>(`hidden.bs.${dropdownString}`);\nconst updatedDropdownEvent = createCustomEvent<\n DropdownEventProps,\n DropdownEvent\n>(`updated.bs.${dropdownString}`);\n\n// DROPDOWN PRIVATE METHODS\n// ========================\n/**\n * Apply specific style or class names to a `.dropdown-menu` to automatically\n * accomodate the layout and the page scroll.\n *\n * @param self the `Dropdown` instance\n */\nconst styleDropdown = (self: Dropdown) => {\n const { element, menu, parentElement, options } = self;\n const { offset } = options;\n // don't apply any style on mobile view\n // istanbul ignore if @preserve: this test requires a navbar\n if (getElementStyle(menu, \"position\") === \"static\") return;\n\n const RTL = isRTL(element);\n const menuEnd = hasClass(menu, dropdownMenuEndClass);\n\n // reset menu offset and position\n const resetProps = [\"margin\", \"top\", \"bottom\", \"left\", \"right\"];\n resetProps.forEach((p) => {\n const style: { [key: string]: string } = {};\n style[p] = \"\";\n setElementStyle(menu, style);\n });\n\n // set initial position class\n // take into account .btn-group parent as .dropdown\n // this requires navbar/btn-group/input-group\n let positionClass = dropdownClasses.find((c) => hasClass(parentElement, c)) ||\n /* istanbul ignore next @preserve: fallback position */\n dropdownString;\n\n const dropdownMargin: { [key: string]: number[] } = {\n dropdown: [offset, 0, 0],\n dropup: [0, 0, offset],\n dropstart: RTL ? [-1, 0, 0, offset] : [-1, offset, 0],\n dropend: RTL ? [-1, offset, 0] : [-1, 0, 0, offset],\n };\n\n const dropdownPosition: { [key: string]: Partial<CSS4Declaration> } = {\n dropdown: { top: \"100%\" },\n dropup: { top: \"auto\", bottom: \"100%\" },\n dropstart: RTL\n ? { left: \"100%\", right: \"auto\" }\n : { left: \"auto\", right: \"100%\" },\n dropend: RTL\n ? { left: \"auto\", right: \"100%\" }\n : { left: \"100%\", right: \"auto\" },\n menuStart: RTL\n ? { right: \"0\", left: \"auto\" }\n : { right: \"auto\", left: \"0\" },\n menuEnd: RTL ? { right: \"auto\", left: \"0\" } : { right: \"0\", left: \"auto\" },\n };\n\n const { offsetWidth: menuWidth, offsetHeight: menuHeight } = menu;\n\n const { clientWidth, clientHeight } = getDocumentElement(element);\n const {\n left: targetLeft,\n top: targetTop,\n width: targetWidth,\n height: targetHeight,\n } = getBoundingClientRect(element);\n\n // dropstart | dropend\n const leftFullExceed = targetLeft - menuWidth - offset < 0;\n // dropend\n const rightFullExceed =\n targetLeft + menuWidth + targetWidth + offset >= clientWidth;\n // dropstart | dropend\n const bottomExceed = targetTop + menuHeight + offset >= clientHeight;\n // dropdown\n const bottomFullExceed =\n targetTop + menuHeight + targetHeight + offset >= clientHeight;\n // dropup\n const topExceed = targetTop - menuHeight - offset < 0;\n // dropdown / dropup\n const leftExceed = ((!RTL && menuEnd) || (RTL && !menuEnd)) &&\n targetLeft + targetWidth - menuWidth < 0;\n const rightExceed = ((RTL && menuEnd) || (!RTL && !menuEnd)) &&\n targetLeft + menuWidth >= clientWidth;\n\n // recompute position\n // handle RTL as well\n if (\n horizontalClass.includes(positionClass) && leftFullExceed &&\n rightFullExceed\n ) {\n positionClass = dropdownString;\n }\n if (\n positionClass === dropstartString &&\n (!RTL ? leftFullExceed : rightFullExceed)\n ) {\n positionClass = dropendString;\n }\n if (\n positionClass === dropendString &&\n (RTL ? leftFullExceed : rightFullExceed)\n ) {\n positionClass = dropstartString;\n }\n if (positionClass === dropupString && topExceed && !bottomFullExceed) {\n positionClass = dropdownString;\n }\n if (positionClass === dropdownString && bottomFullExceed && !topExceed) {\n positionClass = dropupString;\n }\n\n // override position for horizontal classes\n if (horizontalClass.includes(positionClass) && bottomExceed) {\n ObjectAssign(dropdownPosition[positionClass], {\n top: \"auto\",\n bottom: 0,\n });\n }\n\n // override position for vertical classes\n if (verticalClass.includes(positionClass) && (leftExceed || rightExceed)) {\n // don't realign when menu is wider than window\n // in both RTL and non-RTL readability is KING\n let posAjust:\n | { left: \"auto\" | number; right: \"auto\" | number }\n | undefined = { left: \"auto\", right: \"auto\" };\n /* istanbul ignore else @preserve */\n if (!leftExceed && rightExceed && !RTL) {\n posAjust = { left: \"auto\", right: 0 };\n }\n /* istanbul ignore else @preserve */\n if (leftExceed && !rightExceed && RTL) {\n posAjust = { left: 0, right: \"auto\" };\n }\n /* istanbul ignore else @preserve */\n if (posAjust) {\n ObjectAssign(dropdownPosition[positionClass], posAjust);\n }\n }\n\n const margins: number[] = dropdownMargin[positionClass];\n setElementStyle(menu, {\n ...dropdownPosition[positionClass],\n margin: `${margins.map((x) => (x ? `${x}px` : x)).join(\" \")}`,\n });\n\n // override dropdown-menu-start | dropdown-menu-end\n if (verticalClass.includes(positionClass) && menuEnd) {\n // istanbul ignore else @preserve\n if (menuEnd) {\n const endAdjust = (!RTL && leftExceed) || (RTL && rightExceed)\n ? \"menuStart\"\n : /* istanbul ignore next @preserve */ \"menuEnd\";\n setElementStyle(menu, dropdownPosition[endAdjust]);\n }\n }\n // trigger updated event\n dispatchEvent(parentElement, updatedDropdownEvent);\n};\n\n/**\n * Returns an `Array` of focusable items in the given dropdown-menu.\n *\n * @param menu the target menu\n * @returns all children of the dropdown menu\n */\nconst getMenuItems = (menu: HTMLElement) => {\n return Array.from(menu.children)\n .map((c) => {\n if (c && menuFocusTags.includes(c.tagName)) return c as HTMLElement;\n const { firstElementChild } = c;\n if (\n firstElementChild && menuFocusTags.includes(firstElementChild.tagName)\n ) {\n return firstElementChild as HTMLElement;\n }\n return null;\n })\n .filter((c) => c);\n};\n\n/**\n * Toggles on/off the listeners for the events that close the dropdown\n * as well as event that request a new position for the dropdown.\n *\n * @param {Dropdown} self the `Dropdown` instance\n */\nconst toggleDropdownDismiss = (self: Dropdown) => {\n const { element, options, menu } = self;\n const action = self.open ? addListener : removeListener;\n const doc = getDocument(element);\n\n action(doc, mouseclickEvent, dropdownDismissHandler);\n action(doc, focusEvent, dropdownDismissHandler);\n action(doc, keydownEvent, dropdownPreventScroll);\n action(doc, keyupEvent, dropdownKeyHandler);\n\n // istanbul ignore else @preserve\n if (options.display === \"dynamic\") {\n if (self.open) self._observer.observe(menu);\n else self._observer.disconnect();\n }\n};\n\n/**\n * Returns the currently open `.dropdown` element.\n *\n * @param element target\n * @returns the query result\n */\nconst getCurrentOpenDropdown = (\n element: Element,\n): Element | undefined => {\n const currentParent = [...dropdownClasses, \"btn-group\", \"input-group\"]\n .map((c) =>\n getElementsByClassName(`${c} ${showClass}`, getDocument(element))\n )\n .find((x) => x.length);\n\n if (currentParent && currentParent.length) {\n return [...(currentParent[0].children as HTMLCollectionOf<Element>)]\n .find((x) =>\n dropdownClasses.some((c) => c === getAttribute(x, dataBsToggle))\n );\n }\n return undefined;\n};\n\n// DROPDOWN EVENT HANDLERS\n// =======================\n/**\n * Handles the `click` event for the `Dropdown` instance.\n *\n * @param e event object\n */\nconst dropdownDismissHandler = (e: MouseEvent) => {\n const { target, type } = e;\n\n // istanbul ignore if @preserve\n if (!isHTMLElement(target)) return;\n\n // some weird FF bug #409\n const element = getCurrentOpenDropdown(target);\n const self = element && getDropdownInstance(element);\n\n // istanbul ignore if @preserve\n if (!self) return;\n\n const { parentElement, menu } = self;\n\n const isForm = parentElement &&\n parentElement.contains(target) &&\n (target.tagName === \"form\" || closest(target, \"form\") !== null);\n\n if (\n [mouseclickEvent, mousedownEvent].includes(type) &&\n isEmptyAnchor(target)\n ) {\n e.preventDefault();\n }\n\n // istanbul ignore else @preserve\n if (\n !isForm && type !== focusEvent && target !== element && target !== menu\n ) {\n self.hide();\n }\n};\n\n/**\n * Handles `click` event listener for `Dropdown`.\n *\n * @param e event object\n */\nfunction dropdownClickHandler(this: HTMLElement, e: MouseEvent<HTMLElement>) {\n const self = getDropdownInstance(this);\n\n // istanbul ignore if @preserve\n if (isDisabled(this)) return;\n // istanbul ignore if @preserve\n if (!self) return;\n\n e.stopPropagation();\n self.toggle();\n // istanbul ignore else @preserve\n if (isEmptyAnchor(this)) e.preventDefault();\n}\n\n/**\n * Prevents scroll when dropdown-menu is visible.\n *\n * @param e event object\n */\nconst dropdownPreventScroll = (e: KeyboardEvent) => {\n // istanbul ignore else @preserve\n if ([keyArrowDown, keyArrowUp].includes(e.code)) e.preventDefault();\n};\n\n/**\n * Handles keyboard `keydown` events for `Dropdown`.\n *\n * @param e keyboard key\n */\nfunction dropdownKeyHandler(this: Element, e: KeyboardEvent) {\n const { code } = e;\n const element = getCurrentOpenDropdown(this) as HTMLElement;\n /* istanbul ignore if @preserve */\n if (!element) return;\n\n const self = getDropdownInstance(element);\n const { activeElement } = getDocument(element) as Document & {\n activeElement: HTMLElement;\n };\n\n // istanbul ignore if @preserve\n if (!self || !activeElement) return;\n\n const { menu, open } = self;\n const menuItems = getMenuItems(menu);\n\n // arrow up & down\n if (\n menuItems && menuItems.length && [keyArrowDown, keyArrowUp].includes(code)\n ) {\n let idx = menuItems.indexOf(activeElement);\n // istanbul ignore else @preserve\n if (activeElement === element) {\n idx = 0;\n } else if (code === keyArrowUp) {\n idx = idx > 1 ? idx - 1 : 0;\n } else if (code === keyArrowDown) {\n idx = idx < menuItems.length - 1 ? idx + 1 : idx;\n }\n // istanbul ignore else @preserve\n if (menuItems[idx]) focus(menuItems[idx] as HTMLElement);\n }\n\n if (keyEscape === code && open) {\n self.toggle();\n focus(element);\n }\n}\n\n// DROPDOWN DEFINITION\n// ===================\n/** Returns a new Dropdown instance. */\nexport default class Dropdown extends BaseComponent {\n static selector = dropdownSelector;\n static init = dropdownInitCallback;\n static getInstance = getDropdownInstance;\n declare element: HTMLElement;\n declare options: DropdownOptions;\n declare open: boolean;\n declare parentElement: HTMLElement;\n declare menu: HTMLElement;\n declare _observer: PositionObserver;\n\n /**\n * @param target Element or string selector\n * @param config the instance options\n */\n constructor(target: Element | string, config?: Partial<DropdownOptions>) {\n super(target, config);\n\n // initialization element\n const { parentElement } = this.element;\n const [menu] = getElementsByClassName<HTMLElement>(\n dropdownMenuClass,\n parentElement as ParentNode,\n );\n\n // invalidate when dropdown-menu is missing\n // istanbul ignore if @preserve\n if (!menu) return;\n\n // set targets\n this.parentElement = parentElement as HTMLElement;\n this.menu = menu;\n this._observer = new PositionObserver(\n () => styleDropdown(this),\n );\n\n // add event listener\n this._toggleEventListeners(true);\n }\n\n /**\n * Returns component name string.\n */\n get name() {\n return dropdownComponent;\n }\n /**\n * Returns component default options.\n */\n get defaults() {\n return dropdownDefaults;\n }\n\n // DROPDOWN PUBLIC METHODS\n // =======================\n /** Shows/hides the dropdown menu to the user. */\n toggle() {\n if (this.open) this.hide();\n else this.show();\n }\n\n /** Shows the dropdown menu to the user. */\n show() {\n const { element, open, menu, parentElement } = this;\n\n // istanbul ignore if @preserve\n if (open) return;\n const currentElement = getCurrentOpenDropdown(element);\n const currentInstance = currentElement &&\n getDropdownInstance(currentElement);\n if (currentInstance) currentInstance.hide();\n\n // dispatch event\n [showDropdownEvent, shownDropdownEvent, updatedDropdownEvent].forEach(\n (e) => {\n e.relatedTarget = element;\n },\n );\n\n dispatchEvent(parentElement, showDropdownEvent);\n // istanbul ignore if @preserve\n if (showDropdownEvent.defaultPrevented) return;\n\n addClass(menu, showClass);\n addClass(parentElement, showClass);\n setAttribute(element, ariaExpanded, \"true\");\n\n // change menu position\n styleDropdown(this);\n\n this.open = !open;\n\n focus(element); // focus the element\n toggleDropdownDismiss(this);\n dispatchEvent(parentElement, shownDropdownEvent);\n }\n\n /** Hides the dropdown menu from the user. */\n hide() {\n const { element, open, menu, parentElement } = this;\n\n // istanbul ignore if @preserve\n if (!open) return;\n\n [hideDropdownEvent, hiddenDropdownEvent].forEach((e) => {\n e.relatedTarget = element as HTMLElement;\n });\n\n dispatchEvent(parentElement, hideDropdownEvent);\n // istanbul ignore if @preserve\n if (hideDropdownEvent.defaultPrevented) return;\n\n removeClass(menu, showClass);\n removeClass(parentElement, showClass);\n setAttribute(element, ariaExpanded, \"false\");\n\n this.open = !open;\n // only re-attach handler if the instance is not disposed\n toggleDropdownDismiss(this);\n dispatchEvent(parentElement, hiddenDropdownEvent);\n }\n\n /**\n * Toggles on/off the `click` event listener of the `Dropdown`.\n *\n * @param add when `true`, it will add the event listener\n */\n _toggleEventListeners = (add?: boolean) => {\n const action = add ? addListener : removeListener;\n action(this.element, mouseclickEvent, dropdownClickHandler);\n };\n\n /** Removes the `Dropdown` component from the target element. */\n dispose() {\n if (this.open) this.hide();\n\n this._toggleEventListeners();\n super.dispose();\n }\n}\n"],"names":["dropdownComponent","dropdownMenuClass","isEmptyAnchor","element","parentAnchor","closest","hasAttribute","getAttribute","dropdownString","dropupString","dropstartString","dropendString","dropdownClasses","dropdownSelector","dataBsToggle","getDropdownInstance","getInstance","dropdownInitCallback","Dropdown","dropdownMenuEndClass","verticalClass","horizontalClass","menuFocusTags","dropdownDefaults","showDropdownEvent","createCustomEvent","shownDropdownEvent","hideDropdownEvent","hiddenDropdownEvent","updatedDropdownEvent","styleDropdown","self","menu","parentElement","options","offset","getElementStyle","RTL","isRTL","menuEnd","hasClass","p","style","setElementStyle","positionClass","c","dropdownMargin","dropdownPosition","menuWidth","menuHeight","clientWidth","clientHeight","getDocumentElement","targetLeft","targetTop","targetWidth","targetHeight","getBoundingClientRect","leftFullExceed","rightFullExceed","bottomExceed","bottomFullExceed","topExceed","leftExceed","rightExceed","ObjectAssign","posAjust","margins","x","endAdjust","dispatchEvent","getMenuItems","firstElementChild","toggleDropdownDismiss","action","addListener","removeListener","doc","getDocument","mouseclickEvent","dropdownDismissHandler","focusEvent","keydownEvent","dropdownPreventScroll","keyupEvent","dropdownKeyHandler","getCurrentOpenDropdown","currentParent","getElementsByClassName","showClass","e","target","type","isHTMLElement","isForm","mousedownEvent","dropdownClickHandler","isDisabled","keyArrowDown","keyArrowUp","code","activeElement","open","menuItems","idx","focus","keyEscape","BaseComponent","config","PositionObserver","currentElement","currentInstance","addClass","setAttribute","ariaExpanded","removeClass","add"],"mappings":"8PACMA,EAAoB,WCApBC,EAAoB,gBCEpBC,EAAiBC,GAAyB,CAExC,MAAAC,EAAeC,EAAAA,GAAQF,EAAS,GAAG,EAEtC,OAAAA,EAAQ,UAAY,KAEnBG,EAAa,GAAAH,EAAS,MAAM,GAC3BI,EAAa,EAAAJ,EAAS,MAAM,GAAI,MAAM,EAAE,IAAM,KAEhDC,GACCE,EAAAA,GAAaF,EAAc,MAAM,GAChCG,EAAAA,EAAaH,EAAc,MAAM,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