Files

1 line
53 KiB
Plaintext

{"version":3,"file":"popover.mjs","names":["pkg.version"],"sources":["../../../src/strings/dataBsToggle.ts","../../../src/strings/popoverString.ts","../../../src/strings/popoverComponent.ts","../../../src/strings/tooltipString.ts","../../../src/util/getTipTemplate.ts","../../../src/util/tipClassPositions.ts","../../../src/util/styleTip.ts","../../../src/util/tooltipDefaults.ts","../../../src/strings/dataOriginalTitle.ts","../../../src/strings/showClass.ts","../../../src/strings/tooltipComponent.ts","../../../src/strings/modalString.ts","../../../src/strings/offcanvasString.ts","../../../src/strings/fadeClass.ts","../../../src/util/setHtml.ts","../../../src/util/createTip.ts","../../../src/util/popupContainer.ts","../../../src/util/getElementContainer.ts","../../../package.json","../../../src/version.ts","../../../src/components/base-component.ts","../../../src/components/tooltip.ts","../../../src/components/popover.ts"],"sourcesContent":["/**\n * Global namespace for most components `toggle` option.\n */\nconst dataBsToggle = \"data-bs-toggle\";\nexport default dataBsToggle;\n","/** @type {string} */\nconst popoverString = \"popover\";\nexport default popoverString;\n","/** @type {string} */\nconst popoverComponent = \"Popover\";\nexport default popoverComponent;\n","/** @type {string} */\nconst tooltipString = \"tooltip\";\nexport default tooltipString;\n","import tooltipString from \"../strings/tooltipString\";\n\n/**\n * Returns a template for Popover / Tooltip.\n *\n * @param tipType the expected markup type\n * @returns the template markup\n */\nconst getTipTemplate = (tipType: string) => {\n const isTooltip = tipType === tooltipString;\n const bodyClass = isTooltip ? `${tipType}-inner` : `${tipType}-body`;\n const header = !isTooltip ? `<h3 class=\"${tipType}-header\"></h3>` : \"\";\n const arrow = `<div class=\"${tipType}-arrow\"></div>`;\n const body = `<div class=\"${bodyClass}\"></div>`;\n return `<div class=\"${tipType}\" role=\"${tooltipString}\">${\n header + arrow + body\n }</div>`;\n};\n\nexport default getTipTemplate;\n","const tipClassPositions = {\n top: \"top\",\n bottom: \"bottom\",\n left: \"start\",\n right: \"end\",\n};\n\nexport default tipClassPositions;\n","import {\n createCustomEvent,\n dispatchEvent,\n getBoundingClientRect,\n getDocumentElement,\n getElementStyle,\n getNodeScroll,\n getRectRelativeToOffsetParent,\n isHTMLElement,\n isRTL,\n setElementStyle,\n toLowerCase,\n} from \"@thednp/shorty\";\n\nimport tipClassPositions from \"./tipClassPositions\";\nimport Tooltip from \"../components/tooltip\";\nimport type { TooltipEvent } from \"../interface/tooltip\";\nimport type { PopoverEvent } from \"../interface/popover\";\n\n/**\n * Style popovers and tooltips.\n *\n * @param self the `Popover` / `Tooltip` instance\n */\nconst styleTip = (self: Tooltip) => {\n requestAnimationFrame(() => {\n const tipClasses = /\\b(top|bottom|start|end)+/;\n const { element, tooltip, container, offsetParent, options, arrow } = self;\n\n // istanbul ignore if @preserve\n if (!tooltip) return;\n const RTL = isRTL(element);\n const { x: scrollLeft, y: scrollTop } = getNodeScroll(offsetParent);\n\n // reset tooltip style (top: 0, left: 0 works best)\n setElementStyle(tooltip, {\n top: \"\",\n left: \"\",\n right: \"\",\n bottom: \"\",\n });\n const { offsetWidth: tipWidth, offsetHeight: tipHeight } = tooltip;\n const { clientWidth: htmlcw, clientHeight: htmlch, offsetWidth: htmlow } =\n getDocumentElement(element);\n let { placement } = options;\n const { clientWidth: parentCWidth, offsetWidth: parentOWidth } = container;\n const parentPosition = getElementStyle(\n container,\n \"position\",\n );\n const fixedParent = parentPosition === \"fixed\";\n const scrollbarWidth = fixedParent\n ? Math.abs(parentCWidth - parentOWidth)\n : Math.abs(htmlcw - htmlow);\n /* istanbul ignore next @preserve */\n const leftBoundry = RTL && fixedParent ? scrollbarWidth : 0;\n const rightBoundry = htmlcw - (!RTL ? scrollbarWidth : 0) - 1;\n\n // reuse observer entry bounding box\n const observerEntry = self._observer.getEntry(element);\n const {\n width: elemWidth,\n height: elemHeight,\n left: elemRectLeft,\n right: elemRectRight,\n top: elemRectTop,\n } = observerEntry?.boundingClientRect ||\n getBoundingClientRect(element, true);\n\n const {\n x: elemOffsetLeft,\n y: elemOffsetTop,\n } = getRectRelativeToOffsetParent(\n element,\n offsetParent,\n { x: scrollLeft, y: scrollTop },\n );\n\n // reset arrow style\n setElementStyle(arrow as HTMLElement, {\n top: \"\",\n left: \"\",\n right: \"\",\n bottom: \"\",\n });\n let topPosition: number | string = 0;\n let bottomPosition: number | string = \"\";\n let leftPosition: number | string = 0;\n let rightPosition: number | string = \"\";\n let arrowTop: number | string = \"\";\n let arrowLeft: number | string = \"\";\n let arrowRight: number | string = \"\";\n\n const arrowWidth = arrow.offsetWidth || 0;\n const arrowHeight = arrow.offsetHeight || 0;\n const arrowAdjust = arrowWidth / 2;\n\n // check placement\n let topExceed = elemRectTop - tipHeight - arrowHeight < 0;\n let bottomExceed =\n elemRectTop + tipHeight + elemHeight + arrowHeight >= htmlch;\n let leftExceed = elemRectLeft - tipWidth - arrowWidth < leftBoundry;\n let rightExceed =\n elemRectLeft + tipWidth + elemWidth + arrowWidth >= rightBoundry;\n\n const horizontals = [\"left\", \"right\"];\n const verticals = [\"top\", \"bottom\"];\n\n topExceed = horizontals.includes(placement)\n ? elemRectTop + elemHeight / 2 - tipHeight / 2 - arrowHeight < 0\n : topExceed;\n bottomExceed = horizontals.includes(placement)\n ? elemRectTop + tipHeight / 2 + elemHeight / 2 + arrowHeight >= htmlch\n : bottomExceed;\n leftExceed = verticals.includes(placement)\n ? elemRectLeft + elemWidth / 2 - tipWidth / 2 < leftBoundry\n : leftExceed;\n rightExceed = verticals.includes(placement)\n ? elemRectLeft + tipWidth / 2 + elemWidth / 2 >= rightBoundry\n : rightExceed;\n\n // first remove side positions if both left and right limits are exceeded\n // we usually fall back to top|bottom\n placement = horizontals.includes(placement) && leftExceed && rightExceed\n ? \"top\"\n : placement;\n // recompute placement\n placement = placement === \"top\" && topExceed ? \"bottom\" : placement;\n placement = placement === \"bottom\" && bottomExceed ? \"top\" : placement;\n placement = placement === \"left\" && leftExceed ? \"right\" : placement;\n placement = placement === \"right\" && rightExceed\n ? \"left\"\n // istanbul ignore next @preserve\n : placement;\n\n // update tooltip/popover class\n // istanbul ignore else @preserve\n if (!tooltip.className.includes(placement)) {\n tooltip.className = tooltip.className.replace(\n tipClasses,\n tipClassPositions[placement],\n );\n }\n\n // compute tooltip / popover coordinates\n // istanbul ignore else @preserve\n if (horizontals.includes(placement)) {\n // secondary|side positions\n if (placement === \"left\") {\n // LEFT\n leftPosition = elemOffsetLeft - tipWidth - arrowWidth;\n } else {\n // RIGHT\n leftPosition = elemOffsetLeft + elemWidth + arrowWidth;\n }\n\n // adjust top and arrow\n if (topExceed && bottomExceed) {\n topPosition = 0;\n bottomPosition = 0;\n arrowTop = elemOffsetTop + elemHeight / 2 - arrowHeight / 2;\n } else if (topExceed) {\n topPosition = elemOffsetTop;\n bottomPosition = \"\";\n arrowTop = elemHeight / 2 - arrowWidth;\n } else if (bottomExceed) {\n topPosition = elemOffsetTop - tipHeight + elemHeight;\n bottomPosition = \"\";\n arrowTop = tipHeight - elemHeight / 2 - arrowWidth;\n } else {\n topPosition = elemOffsetTop - tipHeight / 2 + elemHeight / 2;\n arrowTop = tipHeight / 2 - arrowHeight / 2;\n }\n } else if (verticals.includes(placement)) {\n if (placement === \"top\") {\n topPosition = elemOffsetTop - tipHeight - arrowHeight;\n } else {\n // BOTTOM\n topPosition = elemOffsetTop + elemHeight + arrowHeight;\n }\n\n // adjust left | right and also the arrow\n if (leftExceed) {\n leftPosition = 0;\n arrowLeft = elemOffsetLeft + elemWidth / 2 - arrowAdjust;\n } else if (rightExceed) {\n leftPosition = \"auto\";\n rightPosition = 0;\n arrowRight = elemWidth / 2 + rightBoundry - elemRectRight - arrowAdjust;\n } else {\n leftPosition = elemOffsetLeft - tipWidth / 2 + elemWidth / 2;\n arrowLeft = tipWidth / 2 - arrowAdjust;\n }\n }\n\n // apply style to tooltip/popover\n setElementStyle(tooltip, {\n top: `${topPosition}px`,\n bottom: bottomPosition === \"\" ? \"\" : `${bottomPosition}px`,\n left: leftPosition === \"auto\" ? leftPosition : `${leftPosition}px`,\n right: rightPosition !== \"\" ? `${rightPosition}px` : \"\",\n });\n\n // update arrow placement\n // istanbul ignore else @preserve\n if (isHTMLElement(arrow)) {\n if (arrowTop !== \"\") {\n arrow.style.top = `${arrowTop}px`;\n }\n if (arrowLeft !== \"\") {\n arrow.style.left = `${arrowLeft}px`;\n } else if (arrowRight !== \"\") {\n arrow.style.right = `${arrowRight}px`;\n }\n }\n const updatedTooltipEvent = createCustomEvent<\n Record<string, unknown>,\n TooltipEvent | PopoverEvent\n >(\n `updated.bs.${toLowerCase(self.name)}`,\n );\n dispatchEvent(element, updatedTooltipEvent);\n });\n};\n\nexport default styleTip;\n","import getTipTemplate from \"./getTipTemplate\";\nimport tooltipString from \"../strings/tooltipString\";\nimport { TooltipOptions } from \"../interface/tooltip\";\n\nconst tooltipDefaults: TooltipOptions = {\n template: getTipTemplate(tooltipString),\n title: \"\",\n customClass: \"\",\n trigger: \"hover focus\",\n placement: \"top\",\n sanitizeFn: undefined,\n animation: true,\n delay: 200,\n container: document.body,\n content: \"\",\n dismissible: false,\n btnClose: \"\",\n};\nexport default tooltipDefaults;\n","/**\n * Global namespace for `data-bs-title` attribute.\n */\nconst dataOriginalTitle = \"data-original-title\";\nexport default dataOriginalTitle;\n","/**\n * Global namespace for most components `show` class.\n */\nconst showClass = \"show\";\nexport default showClass;\n","/** @type {string} */\nconst tooltipComponent = \"Tooltip\";\nexport default tooltipComponent;\n","/** @type {string} */\nconst modalString = \"modal\";\nexport default modalString;\n","/** @type {string} */\nconst offcanvasString = \"offcanvas\";\nexport default offcanvasString;\n","/**\n * Global namespace for most components `fade` class.\n */\nconst fadeClass = \"fade\";\nexport default fadeClass;\n","import {\n isArray,\n isFunction,\n isHTMLElement,\n isNode,\n isNodeList,\n isString,\n} from \"@thednp/shorty\";\n\n/**\n * Append an existing `Element` to Popover / Tooltip component or HTML\n * markup string to be parsed & sanitized to be used as popover / tooltip content.\n *\n * @param element target\n * @param content the `Element` to append / string\n * @param sanitizeFn a function to sanitize string content\n */\nconst setHtml = (\n element: HTMLElement,\n content: Node[] | Node | string,\n sanitizeFn?: (s: string) => string,\n) => {\n // istanbul ignore else @preserve\n if (isString(content) && content.length) {\n let dirty = content.trim(); // fixing #233\n if (isFunction(sanitizeFn)) dirty = sanitizeFn(dirty);\n\n const domParser = new DOMParser();\n const tempDocument = domParser.parseFromString(dirty, \"text/html\");\n element.append(...[...tempDocument.body.childNodes]);\n } else if (isHTMLElement(content)) {\n element.append(content);\n } else if (\n isNodeList(content) || (isArray(content) && content.every(isNode))\n ) {\n element.append(...[...content]);\n }\n};\nexport default setHtml;\n","import {\n addClass,\n createElement,\n hasClass,\n isHTMLElement,\n isRTL,\n querySelector,\n setAttribute,\n} from \"@thednp/shorty\";\n\nimport tooltipComponent from \"../strings/tooltipComponent\";\nimport tooltipString from \"../strings/tooltipString\";\nimport popoverString from \"../strings/popoverString\";\nimport fadeClass from \"../strings/fadeClass\";\nimport tipClassPositions from \"./tipClassPositions\";\nimport setHtml from \"./setHtml\";\nimport Tooltip from \"../components/tooltip\";\nimport Popover from \"../components/popover\";\n\n/**\n * Creates a new tooltip / popover.\n *\n * @param self the `Tooltip` / `Popover` instance\n */\nconst createTip = (self: Tooltip | Popover) => {\n const isTooltip = self.name === tooltipComponent;\n\n const { id, element, options } = self;\n const {\n title,\n placement,\n template,\n animation,\n customClass,\n sanitizeFn,\n dismissible,\n content,\n btnClose,\n } = options;\n const tipString = isTooltip ? tooltipString : popoverString;\n const tipPositions = { ...tipClassPositions };\n let titleParts: Node[] = [];\n let contentParts: Node[] = [];\n\n if (isRTL(element)) {\n tipPositions.left = \"end\";\n tipPositions.right = \"start\";\n }\n\n // set initial popover class\n const placementClass = `bs-${tipString}-${tipPositions[placement]}`;\n\n // load template\n let tooltipTemplate: Node | string;\n if (isHTMLElement(template)) {\n tooltipTemplate = template;\n } else {\n const htmlMarkup = createElement(\"div\") as HTMLElement;\n setHtml(htmlMarkup, template, sanitizeFn);\n tooltipTemplate = htmlMarkup.firstChild as HTMLElement;\n }\n\n /* istanbul ignore if @preserve */\n if (!isHTMLElement(tooltipTemplate)) return;\n\n // set popover markup\n self.tooltip = tooltipTemplate.cloneNode(true) as HTMLElement;\n const { tooltip } = self;\n\n // set id and role attributes\n setAttribute(tooltip, \"id\", id);\n setAttribute(tooltip, \"role\", tooltipString);\n\n const bodyClass = isTooltip\n ? `${tooltipString}-inner`\n : `${popoverString}-body`;\n const tooltipHeader = isTooltip\n ? null\n : querySelector<HTMLElement>(`.${popoverString}-header`, tooltip);\n const tooltipBody = querySelector<HTMLElement>(`.${bodyClass}`, tooltip);\n\n // set arrow and enable access for styleTip\n self.arrow = querySelector<HTMLElement>(\n `.${tipString}-arrow`,\n tooltip,\n ) as HTMLElement;\n const { arrow } = self;\n\n if (isHTMLElement(title)) titleParts = [title.cloneNode(true)];\n else {\n const tempTitle = createElement(\"div\") as HTMLElement;\n setHtml(tempTitle, title, sanitizeFn);\n titleParts = [...[...tempTitle.childNodes]];\n }\n\n if (isHTMLElement(content)) contentParts = [content.cloneNode(true)];\n else {\n const tempContent = createElement(\"div\") as HTMLElement;\n setHtml(tempContent, content, sanitizeFn);\n contentParts = [...[...tempContent.childNodes]];\n }\n\n // set dismissible button\n if (dismissible) {\n if (title) {\n if (isHTMLElement(btnClose)) {\n titleParts = [...titleParts, btnClose.cloneNode(true)];\n } else {\n const tempBtn = createElement(\"div\") as HTMLElement;\n setHtml(tempBtn, btnClose, sanitizeFn);\n titleParts = [...titleParts, tempBtn.firstChild as Node];\n }\n } else {\n // istanbul ignore else @preserve\n if (tooltipHeader) tooltipHeader.remove();\n if (isHTMLElement(btnClose)) {\n contentParts = [...contentParts, btnClose.cloneNode(true)];\n } else {\n const tempBtn = createElement(\"div\") as HTMLElement;\n setHtml(tempBtn, btnClose, sanitizeFn);\n contentParts = [...contentParts, tempBtn.firstChild as Node];\n }\n }\n }\n\n // fill the template with content from options / data attributes\n // also sanitize title && content\n // istanbul ignore else @preserve\n if (!isTooltip) {\n // istanbul ignore else @preserve\n if (title && tooltipHeader) {\n setHtml(tooltipHeader, titleParts, sanitizeFn);\n }\n // istanbul ignore else @preserve\n if (content && tooltipBody) {\n setHtml(tooltipBody, contentParts, sanitizeFn);\n }\n // set btn\n // istanbul ignore next @preserve\n self.btn = querySelector<HTMLButtonElement>(\".btn-close\", tooltip) ||\n undefined;\n } else if (title && tooltipBody) setHtml(tooltipBody, title, sanitizeFn);\n\n // Bootstrap 5.2.x\n addClass(tooltip, \"position-absolute\");\n addClass(arrow, \"position-absolute\");\n\n // set popover animation and placement\n // istanbul ignore else @preserve\n if (!hasClass(tooltip, tipString)) addClass(tooltip, tipString);\n // istanbul ignore else @preserve\n if (animation && !hasClass(tooltip, fadeClass)) {\n addClass(tooltip, fadeClass);\n }\n // istanbul ignore else @preserve\n if (customClass && !hasClass(tooltip, customClass)) {\n addClass(tooltip, customClass);\n }\n // istanbul ignore else @preserve\n if (!hasClass(tooltip, placementClass)) addClass(tooltip, placementClass);\n};\n\nexport default createTip;\n","import { createElement, getDocumentBody, isNode } from \"@thednp/shorty\";\n\n// the default container for Modal, Offcanvas, Popover and Tooltip\nconst popupContainer = createElement({\n tagName: \"div\",\n className: \"popup-container\",\n}) as HTMLElement;\n\nconst appendPopup = (target: Element, customContainer?: ParentNode) => {\n const containerIsBody = isNode(customContainer) &&\n customContainer.nodeName === \"BODY\";\n const lookup = isNode(customContainer) && !containerIsBody\n ? customContainer\n : popupContainer;\n const BODY = containerIsBody ? customContainer : getDocumentBody(target);\n\n // istanbul ignore else @preserve\n if (isNode(target)) {\n if (lookup === popupContainer) {\n BODY.append(popupContainer);\n }\n lookup.append(target);\n }\n};\n\nconst removePopup = (target: Element, customContainer?: ParentNode) => {\n const containerIsBody = isNode(customContainer) &&\n customContainer.nodeName === \"BODY\";\n const lookup = isNode(customContainer) && !containerIsBody\n ? customContainer\n : popupContainer;\n\n // istanbul ignore else @preserve\n if (isNode(target)) {\n target.remove();\n\n if (lookup === popupContainer && !popupContainer.children.length) {\n popupContainer.remove();\n }\n }\n};\n\nconst hasPopup = (target: Element, customContainer?: ParentNode) => {\n const lookup = isNode(customContainer) && customContainer.nodeName !== \"BODY\"\n ? customContainer\n : popupContainer;\n return isNode(target) && lookup.contains(target);\n};\n\nexport { appendPopup, hasPopup, popupContainer, removePopup };\n","import {\n getDocument,\n getElementStyle,\n getParentNode,\n isShadowRoot,\n isTableElement,\n} from \"@thednp/shorty\";\n\n/**\n * Returns an `HTMLElement` to be used as default value for *options.container*\n * for `Tooltip` / `Popover` components.\n *\n * @see https://github.com/floating-ui/floating-ui\n *\n * @param element the target\n * @returns the query result\n */\nconst getElementContainer = (element: Element) => {\n const majorBlockTags = [\"HTML\", \"BODY\"];\n const containers: HTMLElement[] = [];\n let { parentNode } = element;\n\n while (parentNode && !majorBlockTags.includes(parentNode.nodeName)) {\n parentNode = getParentNode(parentNode) as HTMLElement;\n // istanbul ignore else @preserve\n if (!(isShadowRoot(parentNode) || isTableElement(parentNode))) {\n containers.push(parentNode as HTMLElement);\n }\n }\n\n const knownContainer = containers.find((c, i) => {\n if (\n ((getElementStyle(c, \"position\") !== \"relative\" ||\n getElementStyle(c, \"position\") === \"relative\" &&\n c.offsetHeight !== c.scrollHeight) &&\n containers.slice(i + 1).every((r) =>\n getElementStyle(r, \"position\") === \"static\"\n ))\n ) {\n return c;\n }\n return null;\n });\n\n // istanbul ignore next @preserve\n return knownContainer || getDocument(element).body;\n};\n\nexport default getElementContainer;\n","","import pkg from \"../package.json\" with { type: \"json\" };\n\nconst Version = pkg.version;\n\nexport default Version;\n","/* Native JavaScript for Bootstrap 5 | Base Component\n----------------------------------------------------- */\nimport {\n Data,\n isElement,\n isString,\n normalizeOptions,\n ObjectKeys,\n querySelector,\n} from \"@thednp/shorty\";\n\nimport type { BaseOptions } from \"~/interface/baseComponent\";\nimport Version from \"~/version\";\n\n/** Returns a new `BaseComponent` instance. */\nexport default class BaseComponent {\n declare element: Element;\n declare options?: BaseOptions;\n\n /**\n * @param target `Element` or selector string\n * @param config component instance options\n */\n constructor(target: Element | string, config?: BaseOptions) {\n let element: Element | null;\n\n try {\n if (isElement(target)) {\n element = target as Element;\n } else if (isString(target)) {\n element = querySelector(target);\n // istanbul ignore else @preserve\n if (!element) throw Error(`\"${target}\" is not a valid selector.`);\n } else {\n throw Error(`your target is not an instance of HTMLElement.`);\n }\n } catch (e) {\n throw Error(`${this.name} Error: ${(e as Error).message}`);\n }\n\n const prevInstance = Data.get<typeof this>(element, this.name);\n /* istanbul ignore else @preserve */\n if (prevInstance) {\n // remove previously attached event listeners\n // to avoid memory leaks\n prevInstance._toggleEventListeners();\n }\n\n this.element = element;\n this.options = this.defaults && ObjectKeys(this.defaults).length\n ? normalizeOptions(element, this.defaults, config || {}, \"bs\")\n : /* istanbul ignore next @preserve */ {};\n\n Data.set(element, this.name, this);\n }\n\n // istanbul ignore next @preserve\n get version() {\n return Version;\n }\n\n // istanbul ignore next @preserve\n get name() {\n return \"BaseComponent\";\n }\n\n // istanbul ignore next @preserve\n get defaults() {\n return {};\n }\n\n /** just to have something to extend from */\n // istanbul ignore next @preserve coverage wise this isn't important\n _toggleEventListeners = () => {\n // do something to please linters\n };\n\n /** Removes component from target element. */\n dispose() {\n Data.remove<typeof this>(this.element, this.name);\n ObjectKeys(this).forEach((prop) => {\n delete this[prop];\n });\n }\n}\n","/* Native JavaScript for Bootstrap 5 | Tooltip\n---------------------------------------------- */\nimport {\n addClass,\n ariaDescribedBy,\n closest,\n createCustomEvent,\n dispatchEvent,\n emulateTransitionEnd,\n focus,\n focusEvent,\n focusinEvent,\n focusoutEvent,\n getAttribute,\n getDocument,\n getElementStyle,\n getInstance,\n getUID,\n getWindow,\n hasAttribute,\n hasClass,\n isApple,\n mouseclickEvent,\n mousedownEvent,\n mouseenterEvent,\n mousehoverEvent,\n mouseleaveEvent,\n ObjectAssign,\n passiveHandler,\n removeAttribute,\n removeClass,\n setAttribute,\n Timer,\n toLowerCase,\n TouchEvent,\n touchstartEvent,\n} from \"@thednp/shorty\";\n\nimport { addListener, removeListener } from \"@thednp/event-listener\";\nimport PositionObserver from \"@thednp/position-observer\";\n\nimport dataBsToggle from \"~/strings/dataBsToggle\";\nimport dataOriginalTitle from \"~/strings/dataOriginalTitle\";\nimport showClass from \"~/strings/showClass\";\nimport tooltipString from \"~/strings/tooltipString\";\nimport tooltipComponent from \"~/strings/tooltipComponent\";\nimport popoverString from \"~/strings/popoverString\";\nimport popoverComponent from \"~/strings/popoverComponent\";\nimport modalString from \"~/strings/modalString\";\nimport offcanvasString from \"~/strings/offcanvasString\";\n\nimport styleTip from \"~/util/styleTip\";\nimport createTip from \"~/util/createTip\";\nimport { appendPopup, hasPopup, removePopup } from \"~/util/popupContainer\";\nimport getElementContainer from \"~/util/getElementContainer\";\nimport tooltipDefaults from \"~/util/tooltipDefaults\";\nimport BaseComponent from \"./base-component\";\nimport type { TooltipEvent, TooltipOptions } from \"~/interface/tooltip\";\nimport type { PopoverEvent, PopoverOptions } from \"~/interface/popover\";\n\n// TOOLTIP PRIVATE GC\n// ==================\nconst tooltipSelector =\n `[${dataBsToggle}=\"${tooltipString}\"],[data-tip=\"${tooltipString}\"]`;\nconst titleAttr = \"title\";\n\n/**\n * Static method which returns an existing `Tooltip` instance associated\n * to a target `Element`.\n */\nlet getTooltipInstance = (element: Element) =>\n getInstance<Tooltip>(element, tooltipComponent);\n\n/**\n * A `Tooltip` initialization callback.\n */\nconst tooltipInitCallback = (element: Element) => new Tooltip(element);\n\n// TOOLTIP PRIVATE METHODS\n// =======================\n/**\n * Removes the tooltip from the DOM.\n *\n * @param self the `Tooltip` instance\n */\nconst removeTooltip = (self: Tooltip) => {\n const { element, tooltip, container } = self;\n removeAttribute(element, ariaDescribedBy);\n removePopup(\n tooltip,\n container,\n );\n};\n\n/**\n * Check if container contains the tooltip.\n *\n * @param self Tooltip\n */\nconst hasTip = (self: Tooltip): boolean | undefined => {\n const { tooltip, container } = self;\n\n return tooltip &&\n hasPopup(tooltip, container);\n};\n\n/**\n * Executes after the instance has been disposed.\n *\n * @param self the `Tooltip` instance\n * @param callback the parent dispose callback\n */\nconst disposeTooltipComplete = (self: Tooltip, callback?: () => void) => {\n const { element } = self;\n self._toggleEventListeners();\n\n // istanbul ignore else @preserve\n if (\n hasAttribute(element, dataOriginalTitle) && self.name === tooltipComponent\n ) {\n toggleTooltipTitle(self);\n }\n // istanbul ignore else @preserve\n if (callback) callback();\n};\n\n/**\n * Toggles on/off the special `Tooltip` event listeners.\n *\n * @param self the `Tooltip` instance\n * @param add when `true`, event listeners are added\n */\nconst toggleTooltipAction = (self: Tooltip, add?: boolean) => {\n const action = add ? addListener : removeListener;\n const { element } = self;\n\n action(\n getDocument(element),\n touchstartEvent,\n self.handleTouch,\n passiveHandler,\n );\n};\n\n/**\n * Executes after the tooltip was shown to the user.\n *\n * @param self the `Tooltip` instance\n */\nconst tooltipShownAction = (self: Tooltip) => {\n const { element } = self;\n const shownTooltipEvent = createCustomEvent<\n Record<string, never>,\n TooltipEvent | PopoverEvent\n >(\n `shown.bs.${toLowerCase(self.name)}`,\n );\n\n toggleTooltipAction(self, true);\n dispatchEvent(element, shownTooltipEvent);\n Timer.clear(element, \"in\");\n};\n\n/**\n * Executes after the tooltip was hidden to the user.\n *\n * @param self the `Tooltip` instance\n */\nconst tooltipHiddenAction = (self: Tooltip) => {\n const { element } = self;\n const hiddenTooltipEvent = createCustomEvent<\n Record<string, never>,\n TooltipEvent | PopoverEvent\n >(\n `hidden.bs.${toLowerCase(self.name)}`,\n );\n\n toggleTooltipAction(self);\n removeTooltip(self);\n dispatchEvent(element, hiddenTooltipEvent);\n\n Timer.clear(element, \"out\");\n};\n\n/**\n * Toggles on/off the `Tooltip` event listeners that hide/update the tooltip.\n *\n * @param self the `Tooltip` instance\n * @param add when `true`, event listeners are added\n */\nconst toggleTooltipOpenHandlers = (self: Tooltip, add?: boolean) => {\n const action = add ? addListener : removeListener;\n const { element, tooltip } = self;\n const parentModal = closest(element, `.${modalString}`);\n const parentOffcanvas = closest(element, `.${offcanvasString}`);\n\n if (add) {\n [element, tooltip]\n .forEach((target) => self._observer.observe(target));\n } else self._observer.disconnect();\n\n // dismiss tooltips inside modal / offcanvas\n if (parentModal) {\n action(parentModal, `hide.bs.${modalString}`, self.handleHide);\n }\n if (parentOffcanvas) {\n action(parentOffcanvas, `hide.bs.${offcanvasString}`, self.handleHide);\n }\n};\n\n/**\n * Toggles the `title` and `data-original-title` attributes.\n *\n * @param self the `Tooltip` instance\n * @param content when `true`, event listeners are added\n */\nconst toggleTooltipTitle = (self: Tooltip, content?: string) => {\n // [0 - add, 1 - remove] | [0 - remove, 1 - add]\n const titleAtt = [dataOriginalTitle, titleAttr];\n const { element } = self;\n\n setAttribute(\n element,\n titleAtt[content ? 0 : 1],\n // istanbul ignore next @preserve\n content ||\n getAttribute(element, titleAtt[0]) ||\n \"\",\n );\n removeAttribute(element, titleAtt[content ? 1 : 0]);\n};\n\n// TOOLTIP DEFINITION\n// ==================\n/** Creates a new `Tooltip` instance. */\nexport default class Tooltip extends BaseComponent {\n static selector = tooltipSelector;\n static init = tooltipInitCallback;\n static getInstance = getTooltipInstance;\n static styleTip = styleTip;\n declare element: Element & HTMLOrSVGElement;\n declare options: TooltipOptions;\n declare btn?: HTMLElement;\n declare tooltip: HTMLElement;\n declare container: HTMLElement;\n declare offsetParent: Element | Window;\n declare arrow: HTMLElement;\n declare enabled: boolean;\n declare id: string;\n declare _observer: PositionObserver;\n\n /**\n * @param target the target element\n * @param config the instance options\n */\n constructor(target: Element | string, config?: Partial<TooltipOptions>) {\n super(target, config);\n\n const { element } = this;\n const isTooltip = this.name === tooltipComponent;\n const tipString = isTooltip ? tooltipString : popoverString;\n const tipComponent = isTooltip ? tooltipComponent : popoverComponent;\n\n // istanbul ignore next @preserve: this is to set Popover too\n getTooltipInstance = <T extends Tooltip>(elem: Element) =>\n getInstance<T>(elem, tipComponent);\n\n // additional properties\n this.enabled = true;\n /** Set unique ID for `aria-describedby`. */\n this.id = `${tipString}-${getUID(element, tipString)}`;\n\n // instance options\n const { options } = this;\n\n // invalidate\n // istanbul ignore else @preserve\n if (((!options.title && isTooltip) || (!isTooltip && !options.content))) {\n return;\n }\n\n // reset default options\n ObjectAssign(tooltipDefaults, { titleAttr: \"\" });\n\n // set title attributes and add event listeners\n // istanbul ignore else @preserve\n if (\n hasAttribute(element, titleAttr) && isTooltip &&\n typeof options.title === \"string\"\n ) {\n toggleTooltipTitle(this, options.title);\n }\n\n // set containers\n const container = getElementContainer(element);\n const offsetParent = [\"sticky\", \"fixed\", \"relative\"].some(\n (position) =>\n getElementStyle(container, \"position\") ===\n position,\n )\n ? container\n : getWindow(element);\n\n this.container = container;\n this.offsetParent = offsetParent;\n\n // create tooltip here\n createTip(this);\n\n /* istanbul ignore if @preserve */\n if (!this.tooltip) return;\n\n // create observer\n this._observer = new PositionObserver(() => this.update());\n\n // attach events\n this._toggleEventListeners(true);\n }\n\n /**\n * Returns component name string.\n */\n get name() {\n return tooltipComponent;\n }\n /**\n * Returns component default options.\n */\n get defaults() {\n return tooltipDefaults;\n }\n\n // TOOLTIP PUBLIC METHODS\n // ======================\n /** Handles the focus event on iOS. */\n // istanbul ignore next @preserve - impossible to test without Apple device\n handleFocus = () => focus(this.element as HTMLElement);\n /** Shows the tooltip. */\n handleShow = () => this.show();\n show() {\n const { options, tooltip, element, container, id } = this;\n const { animation } = options;\n const outTimer = Timer.get(element, \"out\");\n\n Timer.clear(element, \"out\");\n\n if (tooltip && !outTimer && !hasTip(this)) {\n Timer.set(\n element,\n () => {\n const showTooltipEvent = createCustomEvent<\n Record<string, never>,\n TooltipEvent | PopoverEvent\n >(\n `show.bs.${toLowerCase(this.name)}`,\n );\n dispatchEvent(element, showTooltipEvent);\n\n // istanbul ignore else @preserve\n if (!showTooltipEvent.defaultPrevented) {\n // append to container\n appendPopup(tooltip, container);\n\n setAttribute(element, ariaDescribedBy, `#${id}`);\n\n this.update();\n toggleTooltipOpenHandlers(this, true);\n\n // istanbul ignore else @preserve\n if (!hasClass(tooltip, showClass)) addClass(tooltip, showClass);\n // istanbul ignore else @preserve\n if (animation) {\n emulateTransitionEnd(tooltip, () => tooltipShownAction(this));\n } else tooltipShownAction(this);\n }\n },\n 17,\n \"in\",\n );\n }\n }\n\n /** Hides the tooltip. */\n handleHide = () => this.hide();\n hide() {\n const { options, tooltip, element } = this;\n const { animation, delay } = options;\n\n Timer.clear(element, \"in\");\n\n // istanbul ignore else @preserve\n if (tooltip && hasTip(this)) {\n Timer.set(\n element,\n () => {\n const hideTooltipEvent = createCustomEvent<\n Record<string, never>,\n TooltipEvent | PopoverEvent\n >(\n `hide.bs.${toLowerCase(this.name)}`,\n );\n dispatchEvent(element, hideTooltipEvent);\n\n // istanbul ignore else @preserve\n if (!hideTooltipEvent.defaultPrevented) {\n this.update();\n removeClass(tooltip, showClass);\n toggleTooltipOpenHandlers(this);\n\n // istanbul ignore else @preserve\n if (animation) {\n emulateTransitionEnd(tooltip, () => tooltipHiddenAction(this));\n } else tooltipHiddenAction(this);\n }\n },\n delay + 17,\n \"out\",\n );\n }\n }\n\n /** Updates the tooltip position. */\n update = () => {\n styleTip(this);\n };\n\n /** Toggles the tooltip visibility. */\n toggle = () => {\n const { tooltip } = this;\n\n if (tooltip && !hasTip(this)) this.show();\n else this.hide();\n };\n\n /** Enables the tooltip. */\n enable() {\n const { enabled } = this;\n // istanbul ignore else @preserve\n if (!enabled) {\n this._toggleEventListeners(true);\n this.enabled = !enabled;\n }\n }\n\n /** Disables the tooltip. */\n disable() {\n const { tooltip, enabled } = this;\n // istanbul ignore else @preserve\n if (enabled) {\n if (tooltip && hasTip(this)) this.hide();\n this._toggleEventListeners();\n this.enabled = !enabled;\n }\n }\n\n /** Toggles the `disabled` property. */\n toggleEnabled() {\n if (!this.enabled) this.enable();\n else this.disable();\n }\n\n /**\n * Handles the `touchstart` event listener for `Tooltip`\n *\n * @this {Tooltip}\n * @param {TouchEvent} e the `Event` object\n */\n handleTouch = ({ target }: TouchEvent) => {\n const { tooltip, element } = this;\n\n // istanbul ignore if @preserve\n if (\n (tooltip && tooltip.contains(target)) ||\n target === element ||\n (target && element.contains(target))\n ) {\n // smile for ESLint\n } else {\n this.hide();\n }\n };\n\n /**\n * Toggles on/off the `Tooltip` event listeners.\n *\n * @param add when `true`, event listeners are added\n */\n _toggleEventListeners = (add?: boolean) => {\n const action = add ? addListener : removeListener;\n // btn is only for dismissible popover\n const { element, options, btn } = this;\n const { trigger } = options;\n const isPopover = this.name !== tooltipComponent;\n const dismissible = isPopover && (options as PopoverOptions).dismissible\n ? true\n : false;\n\n // istanbul ignore else @preserve\n if (!trigger.includes(\"manual\")) {\n this.enabled = !!add;\n\n const triggerOptions = trigger.split(\" \");\n\n triggerOptions.forEach((tr) => {\n // istanbul ignore else @preserve\n if (tr === mousehoverEvent) {\n action(element, mousedownEvent, this.handleShow);\n action(element, mouseenterEvent, this.handleShow);\n\n // istanbul ignore else @preserve\n if (!dismissible) {\n action(element, mouseleaveEvent, this.handleHide);\n action(\n getDocument(element),\n touchstartEvent,\n this.handleTouch,\n passiveHandler,\n );\n }\n } else if (tr === mouseclickEvent) {\n action(element, tr, !dismissible ? this.toggle : this.handleShow);\n } else if (tr === focusEvent) {\n action(element, focusinEvent, this.handleShow);\n // istanbul ignore else @preserve\n if (!dismissible) action(element, focusoutEvent, this.handleHide);\n // istanbul ignore else @preserve\n if (isApple()) {\n action(element, mouseclickEvent, this.handleFocus);\n }\n }\n // istanbul ignore else @preserve\n if (dismissible && btn) {\n action(btn, mouseclickEvent, this.handleHide);\n }\n });\n }\n };\n\n /** Removes the `Tooltip` from the target element. */\n dispose() {\n const { tooltip, options } = this;\n const clone = { ...this, name: this.name };\n const callback = () =>\n setTimeout(\n () => disposeTooltipComplete(clone, () => super.dispose()),\n 17,\n );\n\n if (options.animation && hasTip(clone)) {\n this.options.delay = 0; // reset delay\n this.hide();\n emulateTransitionEnd(tooltip, callback);\n } else {\n callback();\n }\n }\n}\n","/* Native JavaScript for Bootstrap 5 | Popover\n---------------------------------------------- */\nimport { focus, getInstance, ObjectAssign } from \"@thednp/shorty\";\n\nimport dataBsToggle from \"~/strings/dataBsToggle\";\nimport popoverString from \"~/strings/popoverString\";\nimport popoverComponent from \"~/strings/popoverComponent\";\n\nimport getTipTemplate from \"~/util/getTipTemplate\";\nimport styleTip from \"~/util/styleTip\";\nimport tooltipDefaults from \"~/util/tooltipDefaults\";\nimport Tooltip from \"./tooltip\";\n\nimport type { PopoverOptions /* , PopoverEvent */ } from \"~/interface/popover\";\n\n// POPOVER PRIVATE GC\n// ==================\nconst popoverSelector =\n `[${dataBsToggle}=\"${popoverString}\"],[data-tip=\"${popoverString}\"]`;\n\nconst popoverDefaults: PopoverOptions = ObjectAssign({}, tooltipDefaults, {\n template: getTipTemplate(popoverString),\n content: \"\",\n dismissible: false,\n btnClose:\n '<button class=\"btn-close position-absolute top-0 end-0 m-1\" aria-label=\"Close\"></button>',\n});\n\n/**\n * Static method which returns an existing `Popover` instance associated\n * to a target `Element`.\n */\nconst getPopoverInstance = (element: Element) =>\n getInstance<Popover>(element, popoverComponent);\n\n/**\n * A `Popover` initialization callback.\n */\nconst popoverInitCallback = (element: Element) => new Popover(element);\n\n// POPOVER DEFINITION\n// ==================\n/** Returns a new `Popover` instance. */\nexport default class Popover extends Tooltip {\n static selector = popoverSelector;\n static init = popoverInitCallback;\n static getInstance = getPopoverInstance;\n static styleTip = styleTip;\n declare options: PopoverOptions;\n\n /**\n * @param target the target element\n * @param config the instance options\n */\n constructor(target: Element | string, config?: Partial<PopoverOptions>) {\n super(target, config);\n }\n /**\n * Returns component name string.\n */\n get name() {\n return popoverComponent;\n }\n /**\n * Returns component default options.\n */\n get defaults() {\n return popoverDefaults;\n }\n\n /* extend original `show()` */\n show = () => {\n super.show();\n // btn only exists within dismissible popover\n const { options, btn } = this;\n // istanbul ignore else @preserve\n if (options.dismissible && btn) setTimeout(() => focus(btn), 17);\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAGA,MAAM,eAAe;;;;ACFrB,MAAM,gBAAgB;;;;ACAtB,MAAM,mBAAmB;;;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