@zanichelli/albe-web-components 15.0.2 → 15.0.3

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.
Files changed (34) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/dist/cjs/z-popover.cjs.entry.js +4 -4
  3. package/dist/cjs/z-popover.cjs.entry.js.map +1 -1
  4. package/dist/collection/components/z-popover/index.js +4 -4
  5. package/dist/collection/components/z-popover/index.js.map +1 -1
  6. package/dist/components/index25.js +4 -4
  7. package/dist/components/index25.js.map +1 -1
  8. package/dist/esm/z-popover.entry.js +4 -4
  9. package/dist/esm/z-popover.entry.js.map +1 -1
  10. package/dist/esm-es5/z-popover.entry.js +1 -1
  11. package/dist/esm-es5/z-popover.entry.js.map +1 -1
  12. package/dist/web-components-library/p-1efff671.system.entry.js +2 -0
  13. package/dist/web-components-library/p-1efff671.system.entry.js.map +1 -0
  14. package/dist/web-components-library/p-746903c3.entry.js +2 -0
  15. package/dist/web-components-library/p-746903c3.entry.js.map +1 -0
  16. package/dist/web-components-library/p-f530271b.system.js +1 -1
  17. package/dist/web-components-library/web-components-library.esm.js +1 -1
  18. package/package.json +1 -1
  19. package/www/build/p-1efff671.system.entry.js +2 -0
  20. package/www/build/p-1efff671.system.entry.js.map +1 -0
  21. package/www/build/{p-e65aa787.js → p-21d22d93.js} +1 -1
  22. package/www/build/p-746903c3.entry.js +2 -0
  23. package/www/build/p-746903c3.entry.js.map +1 -0
  24. package/www/build/p-f530271b.system.js +1 -1
  25. package/www/build/web-components-library.esm.js +1 -1
  26. package/www/index.html +1 -1
  27. package/dist/web-components-library/p-1090b1fd.entry.js +0 -2
  28. package/dist/web-components-library/p-1090b1fd.entry.js.map +0 -1
  29. package/dist/web-components-library/p-ca0f30e5.system.entry.js +0 -2
  30. package/dist/web-components-library/p-ca0f30e5.system.entry.js.map +0 -1
  31. package/www/build/p-1090b1fd.entry.js +0 -2
  32. package/www/build/p-1090b1fd.entry.js.map +0 -1
  33. package/www/build/p-ca0f30e5.system.entry.js +0 -2
  34. package/www/build/p-ca0f30e5.system.entry.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
4
4
 
5
+ ## 15.0.3 (2024-07-25)
6
+
5
7
  ## 15.0.2 (2024-07-24)
6
8
 
7
9
  ## 15.0.1 (2024-07-22)
@@ -10,10 +10,10 @@ const ZPopoverStyle0 = stylesCss;
10
10
 
11
11
  const DOCUMENT_ELEMENT = document.documentElement;
12
12
  function getParentElement(element) {
13
- if (element.parentNode.host) {
14
- return element.parentNode.host;
13
+ if (element.parentNode === element.shadowRoot) {
14
+ return element.shadowRoot.host;
15
15
  }
16
- return element.parentNode;
16
+ return element.parentElement;
17
17
  }
18
18
  /**
19
19
  * Find the closest scrollable parent of a node.
@@ -304,7 +304,7 @@ const ZPopover = class {
304
304
  this.onOpen();
305
305
  }
306
306
  render() {
307
- return index.h("slot", { key: 'a7a3830d93abc15bc7138815f9820bc8cda7ab35' });
307
+ return index.h("slot", { key: '06ccad911be5d149ace59bb4cd239648a9eeb5da' });
308
308
  }
309
309
  get host() { return index.getElement(this); }
310
310
  static get watchers() { return {
@@ -1 +1 @@
1
- {"file":"z-popover.entry.cjs.js","mappings":";;;;;;;AAAA,MAAM,SAAS,GAAG,+/GAA+/G,CAAC;AAClhH,uBAAe,SAAS;;ACExB,MAAM,gBAAgB,GAAG,QAAQ,CAAC,eAAe,CAAC;AAElD,SAAS,gBAAgB,CAAC,OAAgB;IACxC,IAAK,OAAO,CAAC,UAAyB,CAAC,IAAI,EAAE;QAC3C,OAAQ,OAAO,CAAC,UAAyB,CAAC,IAAI,CAAC;KAChD;IAED,OAAO,OAAO,CAAC,UAAqB,CAAC;AACvC,CAAC;AAED;;;;;AAKA,SAAS,oBAAoB,CAAC,OAAgB;IAC5C,IAAI,MAAM,GAAG,gBAA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AAC;YACtC,KAAK,CAAC,SAAS,GAAG,GAAG,eAAe,GAAG,YAAY,CAAC,MAAM,GAAG,YAAY,IAAI,CAAC;SAC/E;aAAM,IAAI,QAAQ,KAAKA,uBAAe,CAAC,QAAQ,EAAE;YAChD,KAAK,CAAC,GAAG,GAAG,MAAM,CAAC;YACnB,KAAK,CAAC,KAAK,GAAG,GAAG,WAAW,GAAG,YAAY,CAAC,KAAK,IAAI,CAAC;YACtD,KAAK,CAAC,MAAM,GAAG,GAAG,YAAY,GAAG,YAAY,CAAC,MAAM,GAAG,cAAc,IAAI,CAAC;YAC1E,KAAK,CAAC,IAAI,GAAG,MAAM,CAAC;YACpB,KAAK,CAAC,QAAQ,GAAG,GAAG,aAAa,IAAI,CAAC;YACtC,KAAK,CAAC,SAAS,GAAG,GAAG,YAAY,GAAG,YAAY,CAAC,MAAM,GAAG,YAAY,IAAI,CAAC;SAC5E;QAED,IAAI,CAAC,eAAe,GAAG,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC;QACjD,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;KAClE;IAED,iBAAiB;QACf,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACrC,IAAI,CAAC,MAAM,EAAE,CAAC;KACf;IAED,MAAM;QACJ,OAAOE,oEAAa,CAAC;KACtB;;;;;;;;;;;","names":["PopoverPosition","KeyboardCode","h"],"sources":["src/components/z-popover/styles.css?tag=z-popover&encapsulation=shadow","src/components/z-popover/index.tsx"],"sourcesContent":[":host {\n --z-popover-theme--surface: var(--color-surface01);\n --z-popover-theme--text: var(--color-default-text);\n --z-popover-padding: 0;\n --z-popover-shadow-filter: drop-shadow(0 1px 2px var(--shadow-color-base));\n\n position: relative;\n display: none;\n min-width: calc(var(--space-unit) * 8);\n min-height: calc(var(--space-unit) * 4);\n align-items: center;\n justify-content: center;\n padding: var(--z-popover-padding);\n background: var(--z-popover-theme--surface);\n border-radius: var(--border-radius-small);\n color: var(--z-popover-theme--text);\n fill: currentcolor;\n filter: var(--z-popover-shadow-filter);\n font-family: var(--font-family-sans);\n text-align: center;\n}\n\n:host([open][current-position]),\n:host([open=\"true\"][current-position]) {\n display: flex;\n}\n\n:host([center][current-position=\"top\"]),\n:host([center][current-position=\"bottom\"]) {\n transform: translateX(-50%);\n}\n\n:host([center][current-position=\"right\"]),\n:host([center][current-position=\"left\"]) {\n transform: translateY(-50%);\n}\n\n:host([current-position^=\"top\"]) {\n margin: 0 0 var(--space-unit);\n}\n\n:host([current-position^=\"bottom\"]) {\n margin: var(--space-unit) 0 0;\n}\n\n:host([current-position^=\"left\"]) {\n margin: 0 var(--space-unit) 0 0;\n}\n\n:host([current-position^=\"right\"]) {\n margin: 0 0 0 var(--space-unit);\n}\n\n/* Arrow style */\n\n:host([current-position])::before {\n --arrow-size: 6px;\n --arrow-edge-offset: calc(100% - var(--space-unit) - (var(--arrow-size) / 2));\n --arrow-center-x-offset: calc(50% - (var(--arrow-size) / 2));\n --arrow-center-y-offset: calc(100% - (var(--arrow-size) / 2));\n\n position: absolute;\n display: block;\n width: var(--arrow-size);\n height: var(--arrow-size);\n background: var(--z-popover-theme--surface);\n content: \"\";\n transform: rotate(45deg);\n}\n\n:host([show-arrow=\"false\"])::before,\n:host(:not([show-arrow]))::before {\n display: none;\n}\n\n:host([current-position^=\"top\"])::before {\n top: var(--arrow-center-y-offset);\n}\n\n:host([current-position^=\"bottom\"])::before {\n bottom: var(--arrow-center-y-offset);\n}\n\n:host([current-position=\"top\"])::before,\n:host([current-position=\"bottom\"])::before {\n right: var(--arrow-edge-offset);\n}\n\n:host([current-position=\"right\"])::before,\n:host([current-position=\"left\"])::before {\n bottom: var(--arrow-edge-offset);\n}\n\n:host([current-position=\"right\"])::before {\n right: var(--arrow-center-y-offset);\n}\n\n:host([current-position=\"left\"])::before {\n left: var(--arrow-center-y-offset);\n}\n\n:host([current-position=\"top_right\"])::before,\n:host([current-position=\"bottom_right\"])::before {\n right: var(--arrow-edge-offset);\n}\n\n:host([current-position=\"top_left\"])::before,\n:host([current-position=\"bottom_left\"])::before {\n left: var(--arrow-edge-offset);\n}\n\n:host([current-position=\"right_top\"])::before,\n:host([current-position=\"left_top\"])::before {\n top: var(--arrow-edge-offset);\n}\n\n:host([current-position=\"right_top\"])::before,\n:host([current-position=\"right_bottom\"])::before {\n right: var(--arrow-center-y-offset);\n}\n\n:host([current-position=\"left_top\"])::before,\n:host([current-position=\"left_bottom\"])::before {\n left: var(--arrow-center-y-offset);\n}\n\n:host([current-position=\"right_bottom\"])::before,\n:host([current-position=\"left_bottom\"])::before {\n bottom: var(--arrow-edge-offset);\n}\n\n:host([center][current-position=\"top\"])::before,\n:host([center][current-position=\"bottom\"])::before {\n right: auto;\n left: var(--arrow-center-x-offset);\n}\n\n:host([center][current-position=\"right\"])::before,\n:host([center][current-position=\"left\"])::before {\n top: var(--arrow-center-x-offset);\n bottom: auto;\n}\n\n::slotted(*) {\n overflow: auto;\n flex: 1 auto;\n}\n","import {Component, Element, Event, EventEmitter, Listen, Prop, State, Watch, h} from \"@stencil/core\";\nimport {KeyboardCode, PopoverPosition} from \"../../beans\";\n\nconst DOCUMENT_ELEMENT = document.documentElement;\n\nfunction getParentElement(element: Element): ShadowRoot[\"host\"] {\n if ((element.parentNode as ShadowRoot).host) {\n return (element.parentNode as ShadowRoot).host;\n }\n\n return element.parentNode as Element;\n}\n\n/**\n * Find the closest scrollable parent of a node.\n *\n * @param {Element} element The node\n */\nfunction findScrollableParent(element: Element): Element {\n let parent = getParentElement(element);\n\n while (parent && parent !== DOCUMENT_ELEMENT) {\n const {overflow, overflowX, overflowY} = window.getComputedStyle(parent);\n if (overflow === \"hidden\" || overflowY === \"hidden\" || overflowX === \"hidden\") {\n return parent;\n }\n\n if (\n (parent.scrollHeight > parent.clientHeight && overflow !== \"visible\" && overflowY !== \"visible\") ||\n (parent.scrollWidth > parent.clientWidth && overflow !== \"visible\" && overflowX !== \"visible\")\n ) {\n return parent;\n }\n\n parent = getParentElement(parent);\n }\n\n return DOCUMENT_ELEMENT;\n}\n\n/**\n * Calculate computed offset.\n * It includes matrix transformations.\n * @param element The target element.\n * @param targetParentOffset The relative offset parent.\n * @return A client rect object.\n */\nfunction computeOffset(element: HTMLElement, targetParentOffset?: HTMLElement): Record<string, number> {\n const rect = element.getBoundingClientRect();\n const width = rect.width;\n const height = rect.height;\n\n let top = 0;\n let left = 0;\n let offsetParent = element;\n while (offsetParent && offsetParent != targetParentOffset) {\n left += offsetParent.offsetLeft;\n\n // document.body sometimes has offsetTop == 0 but still has an\n // offset because of children margins!\n if (offsetParent === document.body) {\n top += offsetParent.getBoundingClientRect().top + window.scrollY;\n } else {\n top += offsetParent.offsetTop;\n }\n\n if (window.DOMMatrix) {\n const style = window.getComputedStyle(offsetParent);\n const transform = style.transform || style.webkitTransform;\n const domMatrix = new DOMMatrix(transform);\n if (domMatrix) {\n left += domMatrix.m41;\n if (offsetParent !== document.body) {\n top += domMatrix.m42;\n }\n }\n }\n\n if (!offsetParent.offsetParent) {\n break;\n }\n\n offsetParent = offsetParent.offsetParent as HTMLElement;\n }\n\n let parentWidth: number;\n let parentHeight: number;\n if (offsetParent === document.body) {\n parentWidth = window.innerWidth;\n parentHeight = window.innerHeight;\n } else {\n parentWidth = offsetParent.offsetWidth;\n parentHeight = offsetParent.offsetHeight;\n }\n\n const right = parentWidth - left - rect.width;\n const bottom = parentHeight - top - rect.height;\n\n return {top, right, bottom, left, width, height};\n}\n\n/**\n * Popover component.\n *\n * @cssprop --z-popover-theme--surface - background color of the popover.\n * @cssprop --z-popover-theme--text - foreground color of the popover.\n * @cssprop --z-popover-padding - padding of the popover.\n * @cssprop --z-popover-shadow-filter - drop-shadow filter of the popover. Defaults to `drop-shadow(0 1px 2px var(--shadow-color-base))`.\n */\n@Component({\n tag: \"z-popover\",\n styleUrl: \"styles.css\",\n shadow: true,\n})\nexport class ZPopover {\n /** Popover position. */\n @Prop({reflect: true})\n position: PopoverPosition = PopoverPosition.AUTO;\n\n /**\n * The open state of the popover.\n */\n @Prop({reflect: true, mutable: true})\n open = false;\n\n /**\n * The selector or the element bound with the popover.\n * If string css selector is provided make sure to use a valid selector.\n */\n @Prop()\n bindTo?: string | HTMLElement;\n\n /**\n * Whether to show popover's arrow.\n */\n @Prop({reflect: true})\n showArrow = false;\n\n /**\n * Whether to center the popup on the main side (according to \"position\").\n */\n @Prop({reflect: true})\n center = false;\n\n /**\n * If true, the popover can be closed by clicking outside of it or pressing the escape key.\n * Otherwise, it will be closed only programmatically (by setting `open` to `false`).\n */\n @Prop()\n closable = true;\n\n /**\n * The current position of the popover.\n */\n @State()\n currentPosition?: PopoverPosition;\n\n /**\n * Position change event.\n */\n @Event()\n positionChange: EventEmitter;\n\n /**\n * Open change event.\n */\n @Event()\n openChange: EventEmitter;\n\n @Element() host: HTMLZPopoverElement;\n\n private animationFrameRequestId?: number;\n\n @Listen(\"keyup\", {target: \"window\"})\n closePopoverWithKeyboard(e: KeyboardEvent): void {\n if (this.closable && e.key === KeyboardCode.ESC) {\n this.open = false;\n }\n }\n\n /**\n * Close the popover when clicking outside of its content.\n * Stop event propagation if the click was fired by popover's trigger element,\n * to prevent close and reopen glitches.\n * @param {MouseEvent} e\n */\n @Listen(\"click\", {target: \"body\", capture: true})\n handleOutsideClick(e: MouseEvent): void {\n if (!this.closable || !this.open) {\n return;\n }\n\n if (!e.composedPath().includes(this.host)) {\n const target = e.target as HTMLElement;\n const triggerElemClicked =\n this.bindTo instanceof HTMLElement ? this.bindTo.contains(target) : target.closest(this.bindTo);\n if (triggerElemClicked) {\n e.stopPropagation();\n }\n\n this.open = false;\n this.positionChange.emit({position: this.currentPosition});\n }\n }\n\n @Watch(\"position\")\n validatePosition(newValue: PopoverPosition): void {\n if (newValue && !Object.values(PopoverPosition).includes(newValue as PopoverPosition)) {\n this.position = PopoverPosition.AUTO;\n }\n\n this.currentPosition = this.position;\n this.positionChange.emit({position: this.currentPosition});\n }\n\n /**\n * Setup popover behaviors on opening.\n */\n @Watch(\"open\")\n onOpen(): void {\n cancelAnimationFrame(this.animationFrameRequestId);\n if (this.open) {\n const setPosition = (): void => {\n if (this.open) {\n this.setPosition();\n this.animationFrameRequestId = requestAnimationFrame(setPosition);\n }\n };\n\n setPosition();\n } else if (this.host.hasAttribute(\"current-position\")) {\n this.host.removeAttribute(\"current-position\");\n this.currentPosition = undefined;\n }\n\n this.openChange.emit({open: this.open});\n }\n\n disconnectedCallback(): void {\n cancelAnimationFrame(this.animationFrameRequestId);\n }\n\n /**\n * Set the position of the popover.\n */\n private setPosition(): void {\n let element: HTMLElement;\n if (typeof this.bindTo === \"string\") {\n element = this.host.ownerDocument.querySelector(this.bindTo) as HTMLElement;\n } else if (this.bindTo) {\n element = this.bindTo;\n } else {\n element = this.host.parentElement as HTMLElement;\n }\n\n if (!element) {\n return;\n }\n\n const scrollContainer = findScrollableParent(element) as HTMLElement;\n const scrollingBoundingRect = scrollContainer.getBoundingClientRect();\n const offsetContainer = this.host.offsetParent as HTMLElement;\n\n const relativeBoundingRect = offsetContainer\n ? computeOffset(offsetContainer, scrollContainer)\n : {top: 0, right: 0, bottom: 0, left: 0};\n const boundingRect = computeOffset(element, scrollContainer);\n\n const top = boundingRect.top - scrollContainer.scrollTop;\n const bottom = scrollingBoundingRect.height - (boundingRect.top + boundingRect.height) + scrollContainer.scrollTop;\n const left = boundingRect.left - scrollContainer.scrollLeft;\n const right = scrollingBoundingRect.width - (boundingRect.left + boundingRect.width) + scrollContainer.scrollLeft;\n\n const overflowBottom = Math.max(0, scrollingBoundingRect.top + scrollingBoundingRect.height - window.innerHeight);\n const overflowRight = Math.max(0, scrollingBoundingRect.left + scrollingBoundingRect.width - window.innerWidth);\n\n const availableTop = Math.min(top, top + scrollingBoundingRect.top);\n const availableBottom = Math.min(bottom, bottom - overflowBottom);\n const availableLeft = Math.min(left, left + scrollingBoundingRect.left);\n const availableRight = Math.min(right, right - overflowRight);\n\n const availableHeight = availableTop + availableBottom + boundingRect.height;\n const availableWidth = availableLeft + availableRight + boundingRect.width;\n\n let position = this.currentPosition;\n const positions: PopoverPosition[] = [];\n if (this.position === PopoverPosition.AUTO) {\n /**\n * The `AUTO` position tries to place the popover in the 'safest' area,\n * where there's more space available.\n */\n if (availableLeft / availableWidth > 0.6) {\n positions.push(PopoverPosition.LEFT);\n } else if (availableLeft / availableWidth < 0.4) {\n positions.push(PopoverPosition.RIGHT);\n }\n\n if (availableTop / availableHeight > 0.9) {\n positions.unshift(PopoverPosition.TOP);\n } else if (availableTop / availableHeight > 0.6) {\n positions.push(PopoverPosition.TOP);\n } else if (availableTop / availableHeight < 0.1) {\n positions.unshift(PopoverPosition.BOTTOM);\n } else {\n positions.push(PopoverPosition.BOTTOM);\n }\n\n position = positions.join(\"_\") as PopoverPosition;\n }\n\n const style = this.host.style;\n style.position = \"absolute\";\n\n const offsetTop = boundingRect.top - relativeBoundingRect.top;\n const offsetRight = boundingRect.right - relativeBoundingRect.right;\n const offsetBottom = boundingRect.bottom - relativeBoundingRect.bottom;\n const offsetLeft = boundingRect.left - relativeBoundingRect.left;\n const offsetModifier = this.center ? 0.5 : 0;\n const sizeModifier = this.center ? 0.5 : 0;\n\n if (position === PopoverPosition.TOP || position === PopoverPosition.TOP_RIGHT) {\n style.top = \"auto\";\n style.right = \"auto\";\n style.bottom = `${offsetBottom + boundingRect.height}px`;\n\n style.left = `${offsetLeft + boundingRect.width * offsetModifier}px`;\n style.maxHeight = `${availableTop}px`;\n if (position === PopoverPosition.TOP_RIGHT) {\n style.maxWidth = `${availableRight + boundingRect.width * sizeModifier}px`;\n }\n } else if (position === PopoverPosition.TOP_LEFT) {\n style.top = \"auto\";\n style.right = `${offsetRight + boundingRect.width * offsetModifier}px`;\n style.bottom = `${offsetBottom + boundingRect.height}px`;\n style.left = \"auto\";\n style.maxWidth = `${availableLeft}px`;\n style.maxHeight = `${availableTop}px`;\n } else if (position === PopoverPosition.BOTTOM || position === PopoverPosition.BOTTOM_RIGHT) {\n style.top = `${offsetTop + boundingRect.height}px`;\n style.right = \"auto\";\n style.bottom = \"auto\";\n style.left = `${offsetLeft + boundingRect.width * offsetModifier}px`;\n style.maxHeight = `${availableBottom}px`;\n if (position === PopoverPosition.BOTTOM_RIGHT) {\n style.maxWidth = `${availableRight + boundingRect.width * sizeModifier}px`;\n }\n } else if (position === PopoverPosition.BOTTOM_LEFT) {\n style.top = `${offsetTop + boundingRect.height}px`;\n style.right = `${offsetRight + boundingRect.width * offsetModifier}px`;\n style.bottom = \"auto\";\n style.left = \"auto\";\n style.maxWidth = `${availableLeft}px`;\n style.maxHeight = `${availableBottom}px`;\n } else if (position === PopoverPosition.RIGHT || position === PopoverPosition.RIGHT_BOTTOM) {\n style.top = `${offsetTop + boundingRect.height * offsetModifier}px`;\n style.right = \"auto\";\n style.bottom = \"auto\";\n style.left = `${offsetLeft + boundingRect.width}px`;\n style.maxWidth = `${availableRight}px`;\n style.maxHeight = `${availableBottom + boundingRect.height * sizeModifier}px`;\n } else if (position === PopoverPosition.RIGHT_TOP) {\n style.top = \"auto\";\n style.right = \"auto\";\n style.bottom = `${offsetBottom + boundingRect.height * offsetModifier}px`;\n style.left = `${offsetLeft + boundingRect.width}px`;\n style.maxWidth = `${availableRight}px`;\n style.maxHeight = `${availableTop + boundingRect.height * sizeModifier}px`;\n } else if (position === PopoverPosition.LEFT || position === PopoverPosition.LEFT_BOTTOM) {\n style.top = `${offsetTop + boundingRect.height * offsetModifier}px`;\n style.right = `${offsetRight + boundingRect.width}px`;\n style.bottom = \"auto\";\n style.left = \"auto\";\n style.maxWidth = `${availableLeft}px`;\n style.maxHeight = `${availableBottom + boundingRect.height * sizeModifier}px`;\n } else if (position === PopoverPosition.LEFT_TOP) {\n style.top = \"auto\";\n style.right = `${offsetRight + boundingRect.width}px`;\n style.bottom = `${offsetBottom + boundingRect.height * offsetModifier}px`;\n style.left = \"auto\";\n style.maxWidth = `${availableLeft}px`;\n style.maxHeight = `${availableTop + boundingRect.height * sizeModifier}px`;\n }\n\n this.currentPosition = position || this.position;\n this.host.setAttribute(\"current-position\", this.currentPosition);\n }\n\n componentWillLoad(): void {\n this.validatePosition(this.position);\n this.onOpen();\n }\n\n render(): HTMLSlotElement {\n return <slot></slot>;\n }\n}\n"],"version":3}
1
+ {"file":"z-popover.entry.cjs.js","mappings":";;;;;;;AAAA,MAAM,SAAS,GAAG,+/GAA+/G,CAAC;AAClhH,uBAAe,SAAS;;ACExB,MAAM,gBAAgB,GAAG,QAAQ,CAAC,eAAe,CAAC;AAElD,SAAS,gBAAgB,CAAC,OAAgB;IACxC,IAAI,OAAO,CAAC,UAAU,KAAK,OAAO,CAAC,UAAU,EAAE;QAC7C,OAAO,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC;KAChC;IAED,OAAO,OAAO,CAAC,aAAa,CAAC;AAC/B,CAAC;AAED;;;;;AAKA,SAAS,oBAAoB,CAAC,OAAgB;IAC5C,IAAI,MAAM,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAEvC,OAAO,MAAM,IAAI,MAAM,KAAK,gBAAgB,EAAE;QAC5C,MAAM,EAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAC,GAAG,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;QACzE,IAAI,QAAQ,KAAK,QAAQ,IAAI,SAAS,KAAK,QAAQ,IAAI,SAAS,KAAK,QAAQ,EAAE;YAC7E,OAAO,MAAM,CAAC;SACf;QAED,IACE,CAAC,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,IAAI,QAAQ,KAAK,SAAS,IAAI,SAAS,KAAK,SAAS;aAC9F,MAAM,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,QAAQ,KAAK,SAAS,IAAI,SAAS,KAAK,SAAS,CAAC,EAC9F;YACA,OAAO,MAAM,CAAC;SACf;QAED,MAAM,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;KACnC;IAED,OAAO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AAQ,CAAC;QACjD,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;KAClE;IAED,iBAAiB;QACf,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACrC,IAAI,CAAC,MAAM,EAAE,CAAC;KACf;IAED,MAAM;QACJ,OAAOE,oEAAa,CAAC;KACtB;;;;;;;;;;;","names":["PopoverPosition","KeyboardCode","h"],"sources":["src/components/z-popover/styles.css?tag=z-popover&encapsulation=shadow","src/components/z-popover/index.tsx"],"sourcesContent":[":host {\n --z-popover-theme--surface: var(--color-surface01);\n --z-popover-theme--text: var(--color-default-text);\n --z-popover-padding: 0;\n --z-popover-shadow-filter: drop-shadow(0 1px 2px var(--shadow-color-base));\n\n position: relative;\n display: none;\n min-width: calc(var(--space-unit) * 8);\n min-height: calc(var(--space-unit) * 4);\n align-items: center;\n justify-content: center;\n padding: var(--z-popover-padding);\n background: var(--z-popover-theme--surface);\n border-radius: var(--border-radius-small);\n color: var(--z-popover-theme--text);\n fill: currentcolor;\n filter: var(--z-popover-shadow-filter);\n font-family: var(--font-family-sans);\n text-align: center;\n}\n\n:host([open][current-position]),\n:host([open=\"true\"][current-position]) {\n display: flex;\n}\n\n:host([center][current-position=\"top\"]),\n:host([center][current-position=\"bottom\"]) {\n transform: translateX(-50%);\n}\n\n:host([center][current-position=\"right\"]),\n:host([center][current-position=\"left\"]) {\n transform: translateY(-50%);\n}\n\n:host([current-position^=\"top\"]) {\n margin: 0 0 var(--space-unit);\n}\n\n:host([current-position^=\"bottom\"]) {\n margin: var(--space-unit) 0 0;\n}\n\n:host([current-position^=\"left\"]) {\n margin: 0 var(--space-unit) 0 0;\n}\n\n:host([current-position^=\"right\"]) {\n margin: 0 0 0 var(--space-unit);\n}\n\n/* Arrow style */\n\n:host([current-position])::before {\n --arrow-size: 6px;\n --arrow-edge-offset: calc(100% - var(--space-unit) - (var(--arrow-size) / 2));\n --arrow-center-x-offset: calc(50% - (var(--arrow-size) / 2));\n --arrow-center-y-offset: calc(100% - (var(--arrow-size) / 2));\n\n position: absolute;\n display: block;\n width: var(--arrow-size);\n height: var(--arrow-size);\n background: var(--z-popover-theme--surface);\n content: \"\";\n transform: rotate(45deg);\n}\n\n:host([show-arrow=\"false\"])::before,\n:host(:not([show-arrow]))::before {\n display: none;\n}\n\n:host([current-position^=\"top\"])::before {\n top: var(--arrow-center-y-offset);\n}\n\n:host([current-position^=\"bottom\"])::before {\n bottom: var(--arrow-center-y-offset);\n}\n\n:host([current-position=\"top\"])::before,\n:host([current-position=\"bottom\"])::before {\n right: var(--arrow-edge-offset);\n}\n\n:host([current-position=\"right\"])::before,\n:host([current-position=\"left\"])::before {\n bottom: var(--arrow-edge-offset);\n}\n\n:host([current-position=\"right\"])::before {\n right: var(--arrow-center-y-offset);\n}\n\n:host([current-position=\"left\"])::before {\n left: var(--arrow-center-y-offset);\n}\n\n:host([current-position=\"top_right\"])::before,\n:host([current-position=\"bottom_right\"])::before {\n right: var(--arrow-edge-offset);\n}\n\n:host([current-position=\"top_left\"])::before,\n:host([current-position=\"bottom_left\"])::before {\n left: var(--arrow-edge-offset);\n}\n\n:host([current-position=\"right_top\"])::before,\n:host([current-position=\"left_top\"])::before {\n top: var(--arrow-edge-offset);\n}\n\n:host([current-position=\"right_top\"])::before,\n:host([current-position=\"right_bottom\"])::before {\n right: var(--arrow-center-y-offset);\n}\n\n:host([current-position=\"left_top\"])::before,\n:host([current-position=\"left_bottom\"])::before {\n left: var(--arrow-center-y-offset);\n}\n\n:host([current-position=\"right_bottom\"])::before,\n:host([current-position=\"left_bottom\"])::before {\n bottom: var(--arrow-edge-offset);\n}\n\n:host([center][current-position=\"top\"])::before,\n:host([center][current-position=\"bottom\"])::before {\n right: auto;\n left: var(--arrow-center-x-offset);\n}\n\n:host([center][current-position=\"right\"])::before,\n:host([center][current-position=\"left\"])::before {\n top: var(--arrow-center-x-offset);\n bottom: auto;\n}\n\n::slotted(*) {\n overflow: auto;\n flex: 1 auto;\n}\n","import {Component, Element, Event, EventEmitter, Listen, Prop, State, Watch, h} from \"@stencil/core\";\nimport {KeyboardCode, PopoverPosition} from \"../../beans\";\n\nconst DOCUMENT_ELEMENT = document.documentElement;\n\nfunction getParentElement(element: Element): Element {\n if (element.parentNode === element.shadowRoot) {\n return element.shadowRoot.host;\n }\n\n return element.parentElement;\n}\n\n/**\n * Find the closest scrollable parent of a node.\n *\n * @param {Element} element The node\n */\nfunction findScrollableParent(element: Element): Element {\n let parent = getParentElement(element);\n\n while (parent && parent !== DOCUMENT_ELEMENT) {\n const {overflow, overflowX, overflowY} = window.getComputedStyle(parent);\n if (overflow === \"hidden\" || overflowY === \"hidden\" || overflowX === \"hidden\") {\n return parent;\n }\n\n if (\n (parent.scrollHeight > parent.clientHeight && overflow !== \"visible\" && overflowY !== \"visible\") ||\n (parent.scrollWidth > parent.clientWidth && overflow !== \"visible\" && overflowX !== \"visible\")\n ) {\n return parent;\n }\n\n parent = getParentElement(parent);\n }\n\n return DOCUMENT_ELEMENT;\n}\n\n/**\n * Calculate computed offset.\n * It includes matrix transformations.\n * @param element The target element.\n * @param targetParentOffset The relative offset parent.\n * @return A client rect object.\n */\nfunction computeOffset(element: HTMLElement, targetParentOffset?: HTMLElement): Record<string, number> {\n const rect = element.getBoundingClientRect();\n const width = rect.width;\n const height = rect.height;\n\n let top = 0;\n let left = 0;\n let offsetParent = element;\n while (offsetParent && offsetParent != targetParentOffset) {\n left += offsetParent.offsetLeft;\n\n // document.body sometimes has offsetTop == 0 but still has an\n // offset because of children margins!\n if (offsetParent === document.body) {\n top += offsetParent.getBoundingClientRect().top + window.scrollY;\n } else {\n top += offsetParent.offsetTop;\n }\n\n if (window.DOMMatrix) {\n const style = window.getComputedStyle(offsetParent);\n const transform = style.transform || style.webkitTransform;\n const domMatrix = new DOMMatrix(transform);\n if (domMatrix) {\n left += domMatrix.m41;\n if (offsetParent !== document.body) {\n top += domMatrix.m42;\n }\n }\n }\n\n if (!offsetParent.offsetParent) {\n break;\n }\n\n offsetParent = offsetParent.offsetParent as HTMLElement;\n }\n\n let parentWidth: number;\n let parentHeight: number;\n if (offsetParent === document.body) {\n parentWidth = window.innerWidth;\n parentHeight = window.innerHeight;\n } else {\n parentWidth = offsetParent.offsetWidth;\n parentHeight = offsetParent.offsetHeight;\n }\n\n const right = parentWidth - left - rect.width;\n const bottom = parentHeight - top - rect.height;\n\n return {top, right, bottom, left, width, height};\n}\n\n/**\n * Popover component.\n *\n * @cssprop --z-popover-theme--surface - background color of the popover.\n * @cssprop --z-popover-theme--text - foreground color of the popover.\n * @cssprop --z-popover-padding - padding of the popover.\n * @cssprop --z-popover-shadow-filter - drop-shadow filter of the popover. Defaults to `drop-shadow(0 1px 2px var(--shadow-color-base))`.\n */\n@Component({\n tag: \"z-popover\",\n styleUrl: \"styles.css\",\n shadow: true,\n})\nexport class ZPopover {\n /** Popover position. */\n @Prop({reflect: true})\n position: PopoverPosition = PopoverPosition.AUTO;\n\n /**\n * The open state of the popover.\n */\n @Prop({reflect: true, mutable: true})\n open = false;\n\n /**\n * The selector or the element bound with the popover.\n * If string css selector is provided make sure to use a valid selector.\n */\n @Prop()\n bindTo?: string | HTMLElement;\n\n /**\n * Whether to show popover's arrow.\n */\n @Prop({reflect: true})\n showArrow = false;\n\n /**\n * Whether to center the popup on the main side (according to \"position\").\n */\n @Prop({reflect: true})\n center = false;\n\n /**\n * If true, the popover can be closed by clicking outside of it or pressing the escape key.\n * Otherwise, it will be closed only programmatically (by setting `open` to `false`).\n */\n @Prop()\n closable = true;\n\n /**\n * The current position of the popover.\n */\n @State()\n currentPosition?: PopoverPosition;\n\n /**\n * Position change event.\n */\n @Event()\n positionChange: EventEmitter;\n\n /**\n * Open change event.\n */\n @Event()\n openChange: EventEmitter;\n\n @Element() host: HTMLZPopoverElement;\n\n private animationFrameRequestId?: number;\n\n @Listen(\"keyup\", {target: \"window\"})\n closePopoverWithKeyboard(e: KeyboardEvent): void {\n if (this.closable && e.key === KeyboardCode.ESC) {\n this.open = false;\n }\n }\n\n /**\n * Close the popover when clicking outside of its content.\n * Stop event propagation if the click was fired by popover's trigger element,\n * to prevent close and reopen glitches.\n * @param {MouseEvent} e\n */\n @Listen(\"click\", {target: \"body\", capture: true})\n handleOutsideClick(e: MouseEvent): void {\n if (!this.closable || !this.open) {\n return;\n }\n\n if (!e.composedPath().includes(this.host)) {\n const target = e.target as HTMLElement;\n const triggerElemClicked =\n this.bindTo instanceof HTMLElement ? this.bindTo.contains(target) : target.closest(this.bindTo);\n if (triggerElemClicked) {\n e.stopPropagation();\n }\n\n this.open = false;\n this.positionChange.emit({position: this.currentPosition});\n }\n }\n\n @Watch(\"position\")\n validatePosition(newValue: PopoverPosition): void {\n if (newValue && !Object.values(PopoverPosition).includes(newValue as PopoverPosition)) {\n this.position = PopoverPosition.AUTO;\n }\n\n this.currentPosition = this.position;\n this.positionChange.emit({position: this.currentPosition});\n }\n\n /**\n * Setup popover behaviors on opening.\n */\n @Watch(\"open\")\n onOpen(): void {\n cancelAnimationFrame(this.animationFrameRequestId);\n if (this.open) {\n const setPosition = (): void => {\n if (this.open) {\n this.setPosition();\n this.animationFrameRequestId = requestAnimationFrame(setPosition);\n }\n };\n\n setPosition();\n } else if (this.host.hasAttribute(\"current-position\")) {\n this.host.removeAttribute(\"current-position\");\n this.currentPosition = undefined;\n }\n\n this.openChange.emit({open: this.open});\n }\n\n disconnectedCallback(): void {\n cancelAnimationFrame(this.animationFrameRequestId);\n }\n\n /**\n * Set the position of the popover.\n */\n private setPosition(): void {\n let element: HTMLElement;\n if (typeof this.bindTo === \"string\") {\n element = this.host.ownerDocument.querySelector(this.bindTo) as HTMLElement;\n } else if (this.bindTo) {\n element = this.bindTo;\n } else {\n element = this.host.parentElement as HTMLElement;\n }\n\n if (!element) {\n return;\n }\n\n const scrollContainer = findScrollableParent(element) as HTMLElement;\n const scrollingBoundingRect = scrollContainer.getBoundingClientRect();\n const offsetContainer = this.host.offsetParent as HTMLElement;\n\n const relativeBoundingRect = offsetContainer\n ? computeOffset(offsetContainer, scrollContainer)\n : {top: 0, right: 0, bottom: 0, left: 0};\n const boundingRect = computeOffset(element, scrollContainer);\n\n const top = boundingRect.top - scrollContainer.scrollTop;\n const bottom = scrollingBoundingRect.height - (boundingRect.top + boundingRect.height) + scrollContainer.scrollTop;\n const left = boundingRect.left - scrollContainer.scrollLeft;\n const right = scrollingBoundingRect.width - (boundingRect.left + boundingRect.width) + scrollContainer.scrollLeft;\n\n const overflowBottom = Math.max(0, scrollingBoundingRect.top + scrollingBoundingRect.height - window.innerHeight);\n const overflowRight = Math.max(0, scrollingBoundingRect.left + scrollingBoundingRect.width - window.innerWidth);\n\n const availableTop = Math.min(top, top + scrollingBoundingRect.top);\n const availableBottom = Math.min(bottom, bottom - overflowBottom);\n const availableLeft = Math.min(left, left + scrollingBoundingRect.left);\n const availableRight = Math.min(right, right - overflowRight);\n\n const availableHeight = availableTop + availableBottom + boundingRect.height;\n const availableWidth = availableLeft + availableRight + boundingRect.width;\n\n let position = this.currentPosition;\n const positions: PopoverPosition[] = [];\n if (this.position === PopoverPosition.AUTO) {\n /**\n * The `AUTO` position tries to place the popover in the 'safest' area,\n * where there's more space available.\n */\n if (availableLeft / availableWidth > 0.6) {\n positions.push(PopoverPosition.LEFT);\n } else if (availableLeft / availableWidth < 0.4) {\n positions.push(PopoverPosition.RIGHT);\n }\n\n if (availableTop / availableHeight > 0.9) {\n positions.unshift(PopoverPosition.TOP);\n } else if (availableTop / availableHeight > 0.6) {\n positions.push(PopoverPosition.TOP);\n } else if (availableTop / availableHeight < 0.1) {\n positions.unshift(PopoverPosition.BOTTOM);\n } else {\n positions.push(PopoverPosition.BOTTOM);\n }\n\n position = positions.join(\"_\") as PopoverPosition;\n }\n\n const style = this.host.style;\n style.position = \"absolute\";\n\n const offsetTop = boundingRect.top - relativeBoundingRect.top;\n const offsetRight = boundingRect.right - relativeBoundingRect.right;\n const offsetBottom = boundingRect.bottom - relativeBoundingRect.bottom;\n const offsetLeft = boundingRect.left - relativeBoundingRect.left;\n const offsetModifier = this.center ? 0.5 : 0;\n const sizeModifier = this.center ? 0.5 : 0;\n\n if (position === PopoverPosition.TOP || position === PopoverPosition.TOP_RIGHT) {\n style.top = \"auto\";\n style.right = \"auto\";\n style.bottom = `${offsetBottom + boundingRect.height}px`;\n\n style.left = `${offsetLeft + boundingRect.width * offsetModifier}px`;\n style.maxHeight = `${availableTop}px`;\n if (position === PopoverPosition.TOP_RIGHT) {\n style.maxWidth = `${availableRight + boundingRect.width * sizeModifier}px`;\n }\n } else if (position === PopoverPosition.TOP_LEFT) {\n style.top = \"auto\";\n style.right = `${offsetRight + boundingRect.width * offsetModifier}px`;\n style.bottom = `${offsetBottom + boundingRect.height}px`;\n style.left = \"auto\";\n style.maxWidth = `${availableLeft}px`;\n style.maxHeight = `${availableTop}px`;\n } else if (position === PopoverPosition.BOTTOM || position === PopoverPosition.BOTTOM_RIGHT) {\n style.top = `${offsetTop + boundingRect.height}px`;\n style.right = \"auto\";\n style.bottom = \"auto\";\n style.left = `${offsetLeft + boundingRect.width * offsetModifier}px`;\n style.maxHeight = `${availableBottom}px`;\n if (position === PopoverPosition.BOTTOM_RIGHT) {\n style.maxWidth = `${availableRight + boundingRect.width * sizeModifier}px`;\n }\n } else if (position === PopoverPosition.BOTTOM_LEFT) {\n style.top = `${offsetTop + boundingRect.height}px`;\n style.right = `${offsetRight + boundingRect.width * offsetModifier}px`;\n style.bottom = \"auto\";\n style.left = \"auto\";\n style.maxWidth = `${availableLeft}px`;\n style.maxHeight = `${availableBottom}px`;\n } else if (position === PopoverPosition.RIGHT || position === PopoverPosition.RIGHT_BOTTOM) {\n style.top = `${offsetTop + boundingRect.height * offsetModifier}px`;\n style.right = \"auto\";\n style.bottom = \"auto\";\n style.left = `${offsetLeft + boundingRect.width}px`;\n style.maxWidth = `${availableRight}px`;\n style.maxHeight = `${availableBottom + boundingRect.height * sizeModifier}px`;\n } else if (position === PopoverPosition.RIGHT_TOP) {\n style.top = \"auto\";\n style.right = \"auto\";\n style.bottom = `${offsetBottom + boundingRect.height * offsetModifier}px`;\n style.left = `${offsetLeft + boundingRect.width}px`;\n style.maxWidth = `${availableRight}px`;\n style.maxHeight = `${availableTop + boundingRect.height * sizeModifier}px`;\n } else if (position === PopoverPosition.LEFT || position === PopoverPosition.LEFT_BOTTOM) {\n style.top = `${offsetTop + boundingRect.height * offsetModifier}px`;\n style.right = `${offsetRight + boundingRect.width}px`;\n style.bottom = \"auto\";\n style.left = \"auto\";\n style.maxWidth = `${availableLeft}px`;\n style.maxHeight = `${availableBottom + boundingRect.height * sizeModifier}px`;\n } else if (position === PopoverPosition.LEFT_TOP) {\n style.top = \"auto\";\n style.right = `${offsetRight + boundingRect.width}px`;\n style.bottom = `${offsetBottom + boundingRect.height * offsetModifier}px`;\n style.left = \"auto\";\n style.maxWidth = `${availableLeft}px`;\n style.maxHeight = `${availableTop + boundingRect.height * sizeModifier}px`;\n }\n\n this.currentPosition = position || this.position;\n this.host.setAttribute(\"current-position\", this.currentPosition);\n }\n\n componentWillLoad(): void {\n this.validatePosition(this.position);\n this.onOpen();\n }\n\n render(): HTMLSlotElement {\n return <slot></slot>;\n }\n}\n"],"version":3}
@@ -2,10 +2,10 @@ import { h } from "@stencil/core";
2
2
  import { KeyboardCode, PopoverPosition } from "../../beans";
3
3
  const DOCUMENT_ELEMENT = document.documentElement;
4
4
  function getParentElement(element) {
5
- if (element.parentNode.host) {
6
- return element.parentNode.host;
5
+ if (element.parentNode === element.shadowRoot) {
6
+ return element.shadowRoot.host;
7
7
  }
8
- return element.parentNode;
8
+ return element.parentElement;
9
9
  }
10
10
  /**
11
11
  * Find the closest scrollable parent of a node.
@@ -301,7 +301,7 @@ export class ZPopover {
301
301
  this.onOpen();
302
302
  }
303
303
  render() {
304
- return h("slot", { key: 'a7a3830d93abc15bc7138815f9820bc8cda7ab35' });
304
+ return h("slot", { key: '06ccad911be5d149ace59bb4cd239648a9eeb5da' });
305
305
  }
306
306
  static get is() { return "z-popover"; }
307
307
  static get encapsulation() { return "shadow"; }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/z-popover/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAC,MAAM,eAAe,CAAC;AACrG,OAAO,EAAC,YAAY,EAAE,eAAe,EAAC,MAAM,aAAa,CAAC;AAE1D,MAAM,gBAAgB,GAAG,QAAQ,CAAC,eAAe,CAAC;AAElD,SAAS,gBAAgB,CAAC,OAAgB;IACxC,IAAK,OAAO,CAAC,UAAyB,CAAC,IAAI,EAAE,CAAC;QAC5C,OAAQ,OAAO,CAAC,UAAyB,CAAC,IAAI,CAAC;IACjD,CAAC;IAED,OAAO,OAAO,CAAC,UAAqB,CAAC;AACvC,CAAC;AAED;;;;GAIG;AACH,SAAS,oBAAoB,CAAC,OAAgB;IAC5C,IAAI,MAAM,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAEvC,OAAO,MAAM,IAAI,MAAM,KAAK,gBAAgB,EAAE,CAAC;QAC7C,MAAM,EAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAC,GAAG,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;QACzE,IAAI,QAAQ,KAAK,QAAQ,IAAI,SAAS,KAAK,QAAQ,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;YAC9E,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,IACE,CAAC,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,IAAI,QAAQ,KAAK,SAAS,IAAI,SAAS,KAAK,SAAS,CAAC;YAChG,CAAC,MAAM,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,QAAQ,KAAK,SAAS,IAAI,SAAS,KAAK,SAAS,CAAC,EAC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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {Component, Element, Event, EventEmitter, Listen, Prop, State, Watch, h} from \"@stencil/core\";\nimport {KeyboardCode, PopoverPosition} from \"../../beans\";\n\nconst DOCUMENT_ELEMENT = document.documentElement;\n\nfunction getParentElement(element: Element): ShadowRoot[\"host\"] {\n if ((element.parentNode as ShadowRoot).host) {\n return (element.parentNode as ShadowRoot).host;\n }\n\n return element.parentNode as Element;\n}\n\n/**\n * Find the closest scrollable parent of a node.\n *\n * @param {Element} element The node\n */\nfunction findScrollableParent(element: Element): Element {\n let parent = getParentElement(element);\n\n while (parent && parent !== DOCUMENT_ELEMENT) {\n const {overflow, overflowX, overflowY} = window.getComputedStyle(parent);\n if (overflow === \"hidden\" || overflowY === \"hidden\" || overflowX === \"hidden\") {\n return parent;\n }\n\n if (\n (parent.scrollHeight > parent.clientHeight && overflow !== \"visible\" && overflowY !== \"visible\") ||\n (parent.scrollWidth > parent.clientWidth && overflow !== \"visible\" && overflowX !== \"visible\")\n ) {\n return parent;\n }\n\n parent = getParentElement(parent);\n }\n\n return DOCUMENT_ELEMENT;\n}\n\n/**\n * Calculate computed offset.\n * It includes matrix transformations.\n * @param element The target element.\n * @param targetParentOffset The relative offset parent.\n * @return A client rect object.\n */\nfunction computeOffset(element: HTMLElement, targetParentOffset?: HTMLElement): Record<string, number> {\n const rect = element.getBoundingClientRect();\n const width = rect.width;\n const height = rect.height;\n\n let top = 0;\n let left = 0;\n let offsetParent = element;\n while (offsetParent && offsetParent != targetParentOffset) {\n left += offsetParent.offsetLeft;\n\n // document.body sometimes has offsetTop == 0 but still has an\n // offset because of children margins!\n if (offsetParent === document.body) {\n top += offsetParent.getBoundingClientRect().top + window.scrollY;\n } else {\n top += offsetParent.offsetTop;\n }\n\n if (window.DOMMatrix) {\n const style = window.getComputedStyle(offsetParent);\n const transform = style.transform || style.webkitTransform;\n const domMatrix = new DOMMatrix(transform);\n if (domMatrix) {\n left += domMatrix.m41;\n if (offsetParent !== document.body) {\n top += domMatrix.m42;\n }\n }\n }\n\n if (!offsetParent.offsetParent) {\n break;\n }\n\n offsetParent = offsetParent.offsetParent as HTMLElement;\n }\n\n let parentWidth: number;\n let parentHeight: number;\n if (offsetParent === document.body) {\n parentWidth = window.innerWidth;\n parentHeight = window.innerHeight;\n } else {\n parentWidth = offsetParent.offsetWidth;\n parentHeight = offsetParent.offsetHeight;\n }\n\n const right = parentWidth - left - rect.width;\n const bottom = parentHeight - top - rect.height;\n\n return {top, right, bottom, left, width, height};\n}\n\n/**\n * Popover component.\n *\n * @cssprop --z-popover-theme--surface - background color of the popover.\n * @cssprop --z-popover-theme--text - foreground color of the popover.\n * @cssprop --z-popover-padding - padding of the popover.\n * @cssprop --z-popover-shadow-filter - drop-shadow filter of the popover. Defaults to `drop-shadow(0 1px 2px var(--shadow-color-base))`.\n */\n@Component({\n tag: \"z-popover\",\n styleUrl: \"styles.css\",\n shadow: true,\n})\nexport class ZPopover {\n /** Popover position. */\n @Prop({reflect: true})\n position: PopoverPosition = PopoverPosition.AUTO;\n\n /**\n * The open state of the popover.\n */\n @Prop({reflect: true, mutable: true})\n open = false;\n\n /**\n * The selector or the element bound with the popover.\n * If string css selector is provided make sure to use a valid selector.\n */\n @Prop()\n bindTo?: string | HTMLElement;\n\n /**\n * Whether to show popover's arrow.\n */\n @Prop({reflect: true})\n showArrow = false;\n\n /**\n * Whether to center the popup on the main side (according to \"position\").\n */\n @Prop({reflect: true})\n center = false;\n\n /**\n * If true, the popover can be closed by clicking outside of it or pressing the escape key.\n * Otherwise, it will be closed only programmatically (by setting `open` to `false`).\n */\n @Prop()\n closable = true;\n\n /**\n * The current position of the popover.\n */\n @State()\n currentPosition?: PopoverPosition;\n\n /**\n * Position change event.\n */\n @Event()\n positionChange: EventEmitter;\n\n /**\n * Open change event.\n */\n @Event()\n openChange: EventEmitter;\n\n @Element() host: HTMLZPopoverElement;\n\n private animationFrameRequestId?: number;\n\n @Listen(\"keyup\", {target: \"window\"})\n closePopoverWithKeyboard(e: KeyboardEvent): void {\n if (this.closable && e.key === KeyboardCode.ESC) {\n this.open = false;\n }\n }\n\n /**\n * Close the popover when clicking outside of its content.\n * Stop event propagation if the click was fired by popover's trigger element,\n * to prevent close and reopen glitches.\n * @param {MouseEvent} e\n */\n @Listen(\"click\", {target: \"body\", capture: true})\n handleOutsideClick(e: MouseEvent): void {\n if (!this.closable || !this.open) {\n return;\n }\n\n if (!e.composedPath().includes(this.host)) {\n const target = e.target as HTMLElement;\n const triggerElemClicked =\n this.bindTo instanceof HTMLElement ? this.bindTo.contains(target) : target.closest(this.bindTo);\n if (triggerElemClicked) {\n e.stopPropagation();\n }\n\n this.open = false;\n this.positionChange.emit({position: this.currentPosition});\n }\n }\n\n @Watch(\"position\")\n validatePosition(newValue: PopoverPosition): void {\n if (newValue && !Object.values(PopoverPosition).includes(newValue as PopoverPosition)) {\n this.position = PopoverPosition.AUTO;\n }\n\n this.currentPosition = this.position;\n this.positionChange.emit({position: this.currentPosition});\n }\n\n /**\n * Setup popover behaviors on opening.\n */\n @Watch(\"open\")\n onOpen(): void {\n cancelAnimationFrame(this.animationFrameRequestId);\n if (this.open) {\n const setPosition = (): void => {\n if (this.open) {\n this.setPosition();\n this.animationFrameRequestId = requestAnimationFrame(setPosition);\n }\n };\n\n setPosition();\n } else if (this.host.hasAttribute(\"current-position\")) {\n this.host.removeAttribute(\"current-position\");\n this.currentPosition = undefined;\n }\n\n this.openChange.emit({open: this.open});\n }\n\n disconnectedCallback(): void {\n cancelAnimationFrame(this.animationFrameRequestId);\n }\n\n /**\n * Set the position of the popover.\n */\n private setPosition(): void {\n let element: HTMLElement;\n if (typeof this.bindTo === \"string\") {\n element = this.host.ownerDocument.querySelector(this.bindTo) as HTMLElement;\n } else if (this.bindTo) {\n element = this.bindTo;\n } else {\n element = this.host.parentElement as HTMLElement;\n }\n\n if (!element) {\n return;\n }\n\n const scrollContainer = findScrollableParent(element) as HTMLElement;\n const scrollingBoundingRect = scrollContainer.getBoundingClientRect();\n const offsetContainer = this.host.offsetParent as HTMLElement;\n\n const relativeBoundingRect = offsetContainer\n ? computeOffset(offsetContainer, scrollContainer)\n : {top: 0, right: 0, bottom: 0, left: 0};\n const boundingRect = computeOffset(element, scrollContainer);\n\n const top = boundingRect.top - scrollContainer.scrollTop;\n const bottom = scrollingBoundingRect.height - (boundingRect.top + boundingRect.height) + scrollContainer.scrollTop;\n const left = boundingRect.left - scrollContainer.scrollLeft;\n const right = scrollingBoundingRect.width - (boundingRect.left + boundingRect.width) + scrollContainer.scrollLeft;\n\n const overflowBottom = Math.max(0, scrollingBoundingRect.top + scrollingBoundingRect.height - window.innerHeight);\n const overflowRight = Math.max(0, scrollingBoundingRect.left + scrollingBoundingRect.width - window.innerWidth);\n\n const availableTop = Math.min(top, top + scrollingBoundingRect.top);\n const availableBottom = Math.min(bottom, bottom - overflowBottom);\n const availableLeft = Math.min(left, left + scrollingBoundingRect.left);\n const availableRight = Math.min(right, right - overflowRight);\n\n const availableHeight = availableTop + availableBottom + boundingRect.height;\n const availableWidth = availableLeft + availableRight + boundingRect.width;\n\n let position = this.currentPosition;\n const positions: PopoverPosition[] = [];\n if (this.position === PopoverPosition.AUTO) {\n /**\n * The `AUTO` position tries to place the popover in the 'safest' area,\n * where there's more space available.\n */\n if (availableLeft / availableWidth > 0.6) {\n positions.push(PopoverPosition.LEFT);\n } else if (availableLeft / availableWidth < 0.4) {\n positions.push(PopoverPosition.RIGHT);\n }\n\n if (availableTop / availableHeight > 0.9) {\n positions.unshift(PopoverPosition.TOP);\n } else if (availableTop / availableHeight > 0.6) {\n positions.push(PopoverPosition.TOP);\n } else if (availableTop / availableHeight < 0.1) {\n positions.unshift(PopoverPosition.BOTTOM);\n } else {\n positions.push(PopoverPosition.BOTTOM);\n }\n\n position = positions.join(\"_\") as PopoverPosition;\n }\n\n const style = this.host.style;\n style.position = \"absolute\";\n\n const offsetTop = boundingRect.top - relativeBoundingRect.top;\n const offsetRight = boundingRect.right - relativeBoundingRect.right;\n const offsetBottom = boundingRect.bottom - relativeBoundingRect.bottom;\n const offsetLeft = boundingRect.left - relativeBoundingRect.left;\n const offsetModifier = this.center ? 0.5 : 0;\n const sizeModifier = this.center ? 0.5 : 0;\n\n if (position === PopoverPosition.TOP || position === PopoverPosition.TOP_RIGHT) {\n style.top = \"auto\";\n style.right = \"auto\";\n style.bottom = `${offsetBottom + boundingRect.height}px`;\n\n style.left = `${offsetLeft + boundingRect.width * offsetModifier}px`;\n style.maxHeight = `${availableTop}px`;\n if (position === PopoverPosition.TOP_RIGHT) {\n style.maxWidth = `${availableRight + boundingRect.width * sizeModifier}px`;\n }\n } else if (position === PopoverPosition.TOP_LEFT) {\n style.top = \"auto\";\n style.right = `${offsetRight + boundingRect.width * offsetModifier}px`;\n style.bottom = `${offsetBottom + boundingRect.height}px`;\n style.left = \"auto\";\n style.maxWidth = `${availableLeft}px`;\n style.maxHeight = `${availableTop}px`;\n } else if (position === PopoverPosition.BOTTOM || position === PopoverPosition.BOTTOM_RIGHT) {\n style.top = `${offsetTop + boundingRect.height}px`;\n style.right = \"auto\";\n style.bottom = \"auto\";\n style.left = `${offsetLeft + boundingRect.width * offsetModifier}px`;\n style.maxHeight = `${availableBottom}px`;\n if (position === PopoverPosition.BOTTOM_RIGHT) {\n style.maxWidth = `${availableRight + boundingRect.width * sizeModifier}px`;\n }\n } else if (position === PopoverPosition.BOTTOM_LEFT) {\n style.top = `${offsetTop + boundingRect.height}px`;\n style.right = `${offsetRight + boundingRect.width * offsetModifier}px`;\n style.bottom = \"auto\";\n style.left = \"auto\";\n style.maxWidth = `${availableLeft}px`;\n style.maxHeight = `${availableBottom}px`;\n } else if (position === PopoverPosition.RIGHT || position === PopoverPosition.RIGHT_BOTTOM) {\n style.top = `${offsetTop + boundingRect.height * offsetModifier}px`;\n style.right = \"auto\";\n style.bottom = \"auto\";\n style.left = `${offsetLeft + boundingRect.width}px`;\n style.maxWidth = `${availableRight}px`;\n style.maxHeight = `${availableBottom + boundingRect.height * sizeModifier}px`;\n } else if (position === PopoverPosition.RIGHT_TOP) {\n style.top = \"auto\";\n style.right = \"auto\";\n style.bottom = `${offsetBottom + boundingRect.height * offsetModifier}px`;\n style.left = `${offsetLeft + boundingRect.width}px`;\n style.maxWidth = `${availableRight}px`;\n style.maxHeight = `${availableTop + boundingRect.height * sizeModifier}px`;\n } else if (position === PopoverPosition.LEFT || position === PopoverPosition.LEFT_BOTTOM) {\n style.top = `${offsetTop + boundingRect.height * offsetModifier}px`;\n style.right = `${offsetRight + boundingRect.width}px`;\n style.bottom = \"auto\";\n style.left = \"auto\";\n style.maxWidth = `${availableLeft}px`;\n style.maxHeight = `${availableBottom + boundingRect.height * sizeModifier}px`;\n } else if (position === PopoverPosition.LEFT_TOP) {\n style.top = \"auto\";\n style.right = `${offsetRight + boundingRect.width}px`;\n style.bottom = `${offsetBottom + boundingRect.height * offsetModifier}px`;\n style.left = \"auto\";\n style.maxWidth = `${availableLeft}px`;\n style.maxHeight = `${availableTop + boundingRect.height * sizeModifier}px`;\n }\n\n this.currentPosition = position || this.position;\n this.host.setAttribute(\"current-position\", this.currentPosition);\n }\n\n componentWillLoad(): void {\n this.validatePosition(this.position);\n this.onOpen();\n }\n\n render(): HTMLSlotElement {\n return <slot></slot>;\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/z-popover/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAC,MAAM,eAAe,CAAC;AACrG,OAAO,EAAC,YAAY,EAAE,eAAe,EAAC,MAAM,aAAa,CAAC;AAE1D,MAAM,gBAAgB,GAAG,QAAQ,CAAC,eAAe,CAAC;AAElD,SAAS,gBAAgB,CAAC,OAAgB;IACxC,IAAI,OAAO,CAAC,UAAU,KAAK,OAAO,CAAC,UAAU,EAAE,CAAC;QAC9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AI,CAAC;YAC1E,KAAK,CAAC,IAAI,GAAG,MAAM,CAAC;YACpB,KAAK,CAAC,QAAQ,GAAG,GAAG,aAAa,IAAI,CAAC;YACtC,KAAK,CAAC,SAAS,GAAG,GAAG,YAAY,GAAG,YAAY,CAAC,MAAM,GAAG,YAAY,IAAI,CAAC;QAC7E,CAAC;QAED,IAAI,CAAC,eAAe,GAAG,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC;QACjD,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;IACnE,CAAC;IAED,iBAAiB;QACf,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACrC,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAED,MAAM;QACJ,OAAO,8DAAa,CAAC;IACvB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {Component, Element, Event, EventEmitter, Listen, Prop, State, Watch, h} from \"@stencil/core\";\nimport {KeyboardCode, PopoverPosition} from \"../../beans\";\n\nconst DOCUMENT_ELEMENT = document.documentElement;\n\nfunction getParentElement(element: Element): Element {\n if (element.parentNode === element.shadowRoot) {\n return element.shadowRoot.host;\n }\n\n return element.parentElement;\n}\n\n/**\n * Find the closest scrollable parent of a node.\n *\n * @param {Element} element The node\n */\nfunction findScrollableParent(element: Element): Element {\n let parent = getParentElement(element);\n\n while (parent && parent !== DOCUMENT_ELEMENT) {\n const {overflow, overflowX, overflowY} = window.getComputedStyle(parent);\n if (overflow === \"hidden\" || overflowY === \"hidden\" || overflowX === \"hidden\") {\n return parent;\n }\n\n if (\n (parent.scrollHeight > parent.clientHeight && overflow !== \"visible\" && overflowY !== \"visible\") ||\n (parent.scrollWidth > parent.clientWidth && overflow !== \"visible\" && overflowX !== \"visible\")\n ) {\n return parent;\n }\n\n parent = getParentElement(parent);\n }\n\n return DOCUMENT_ELEMENT;\n}\n\n/**\n * Calculate computed offset.\n * It includes matrix transformations.\n * @param element The target element.\n * @param targetParentOffset The relative offset parent.\n * @return A client rect object.\n */\nfunction computeOffset(element: HTMLElement, targetParentOffset?: HTMLElement): Record<string, number> {\n const rect = element.getBoundingClientRect();\n const width = rect.width;\n const height = rect.height;\n\n let top = 0;\n let left = 0;\n let offsetParent = element;\n while (offsetParent && offsetParent != targetParentOffset) {\n left += offsetParent.offsetLeft;\n\n // document.body sometimes has offsetTop == 0 but still has an\n // offset because of children margins!\n if (offsetParent === document.body) {\n top += offsetParent.getBoundingClientRect().top + window.scrollY;\n } else {\n top += offsetParent.offsetTop;\n }\n\n if (window.DOMMatrix) {\n const style = window.getComputedStyle(offsetParent);\n const transform = style.transform || style.webkitTransform;\n const domMatrix = new DOMMatrix(transform);\n if (domMatrix) {\n left += domMatrix.m41;\n if (offsetParent !== document.body) {\n top += domMatrix.m42;\n }\n }\n }\n\n if (!offsetParent.offsetParent) {\n break;\n }\n\n offsetParent = offsetParent.offsetParent as HTMLElement;\n }\n\n let parentWidth: number;\n let parentHeight: number;\n if (offsetParent === document.body) {\n parentWidth = window.innerWidth;\n parentHeight = window.innerHeight;\n } else {\n parentWidth = offsetParent.offsetWidth;\n parentHeight = offsetParent.offsetHeight;\n }\n\n const right = parentWidth - left - rect.width;\n const bottom = parentHeight - top - rect.height;\n\n return {top, right, bottom, left, width, height};\n}\n\n/**\n * Popover component.\n *\n * @cssprop --z-popover-theme--surface - background color of the popover.\n * @cssprop --z-popover-theme--text - foreground color of the popover.\n * @cssprop --z-popover-padding - padding of the popover.\n * @cssprop --z-popover-shadow-filter - drop-shadow filter of the popover. Defaults to `drop-shadow(0 1px 2px var(--shadow-color-base))`.\n */\n@Component({\n tag: \"z-popover\",\n styleUrl: \"styles.css\",\n shadow: true,\n})\nexport class ZPopover {\n /** Popover position. */\n @Prop({reflect: true})\n position: PopoverPosition = PopoverPosition.AUTO;\n\n /**\n * The open state of the popover.\n */\n @Prop({reflect: true, mutable: true})\n open = false;\n\n /**\n * The selector or the element bound with the popover.\n * If string css selector is provided make sure to use a valid selector.\n */\n @Prop()\n bindTo?: string | HTMLElement;\n\n /**\n * Whether to show popover's arrow.\n */\n @Prop({reflect: true})\n showArrow = false;\n\n /**\n * Whether to center the popup on the main side (according to \"position\").\n */\n @Prop({reflect: true})\n center = false;\n\n /**\n * If true, the popover can be closed by clicking outside of it or pressing the escape key.\n * Otherwise, it will be closed only programmatically (by setting `open` to `false`).\n */\n @Prop()\n closable = true;\n\n /**\n * The current position of the popover.\n */\n @State()\n currentPosition?: PopoverPosition;\n\n /**\n * Position change event.\n */\n @Event()\n positionChange: EventEmitter;\n\n /**\n * Open change event.\n */\n @Event()\n openChange: EventEmitter;\n\n @Element() host: HTMLZPopoverElement;\n\n private animationFrameRequestId?: number;\n\n @Listen(\"keyup\", {target: \"window\"})\n closePopoverWithKeyboard(e: KeyboardEvent): void {\n if (this.closable && e.key === KeyboardCode.ESC) {\n this.open = false;\n }\n }\n\n /**\n * Close the popover when clicking outside of its content.\n * Stop event propagation if the click was fired by popover's trigger element,\n * to prevent close and reopen glitches.\n * @param {MouseEvent} e\n */\n @Listen(\"click\", {target: \"body\", capture: true})\n handleOutsideClick(e: MouseEvent): void {\n if (!this.closable || !this.open) {\n return;\n }\n\n if (!e.composedPath().includes(this.host)) {\n const target = e.target as HTMLElement;\n const triggerElemClicked =\n this.bindTo instanceof HTMLElement ? this.bindTo.contains(target) : target.closest(this.bindTo);\n if (triggerElemClicked) {\n e.stopPropagation();\n }\n\n this.open = false;\n this.positionChange.emit({position: this.currentPosition});\n }\n }\n\n @Watch(\"position\")\n validatePosition(newValue: PopoverPosition): void {\n if (newValue && !Object.values(PopoverPosition).includes(newValue as PopoverPosition)) {\n this.position = PopoverPosition.AUTO;\n }\n\n this.currentPosition = this.position;\n this.positionChange.emit({position: this.currentPosition});\n }\n\n /**\n * Setup popover behaviors on opening.\n */\n @Watch(\"open\")\n onOpen(): void {\n cancelAnimationFrame(this.animationFrameRequestId);\n if (this.open) {\n const setPosition = (): void => {\n if (this.open) {\n this.setPosition();\n this.animationFrameRequestId = requestAnimationFrame(setPosition);\n }\n };\n\n setPosition();\n } else if (this.host.hasAttribute(\"current-position\")) {\n this.host.removeAttribute(\"current-position\");\n this.currentPosition = undefined;\n }\n\n this.openChange.emit({open: this.open});\n }\n\n disconnectedCallback(): void {\n cancelAnimationFrame(this.animationFrameRequestId);\n }\n\n /**\n * Set the position of the popover.\n */\n private setPosition(): void {\n let element: HTMLElement;\n if (typeof this.bindTo === \"string\") {\n element = this.host.ownerDocument.querySelector(this.bindTo) as HTMLElement;\n } else if (this.bindTo) {\n element = this.bindTo;\n } else {\n element = this.host.parentElement as HTMLElement;\n }\n\n if (!element) {\n return;\n }\n\n const scrollContainer = findScrollableParent(element) as HTMLElement;\n const scrollingBoundingRect = scrollContainer.getBoundingClientRect();\n const offsetContainer = this.host.offsetParent as HTMLElement;\n\n const relativeBoundingRect = offsetContainer\n ? computeOffset(offsetContainer, scrollContainer)\n : {top: 0, right: 0, bottom: 0, left: 0};\n const boundingRect = computeOffset(element, scrollContainer);\n\n const top = boundingRect.top - scrollContainer.scrollTop;\n const bottom = scrollingBoundingRect.height - (boundingRect.top + boundingRect.height) + scrollContainer.scrollTop;\n const left = boundingRect.left - scrollContainer.scrollLeft;\n const right = scrollingBoundingRect.width - (boundingRect.left + boundingRect.width) + scrollContainer.scrollLeft;\n\n const overflowBottom = Math.max(0, scrollingBoundingRect.top + scrollingBoundingRect.height - window.innerHeight);\n const overflowRight = Math.max(0, scrollingBoundingRect.left + scrollingBoundingRect.width - window.innerWidth);\n\n const availableTop = Math.min(top, top + scrollingBoundingRect.top);\n const availableBottom = Math.min(bottom, bottom - overflowBottom);\n const availableLeft = Math.min(left, left + scrollingBoundingRect.left);\n const availableRight = Math.min(right, right - overflowRight);\n\n const availableHeight = availableTop + availableBottom + boundingRect.height;\n const availableWidth = availableLeft + availableRight + boundingRect.width;\n\n let position = this.currentPosition;\n const positions: PopoverPosition[] = [];\n if (this.position === PopoverPosition.AUTO) {\n /**\n * The `AUTO` position tries to place the popover in the 'safest' area,\n * where there's more space available.\n */\n if (availableLeft / availableWidth > 0.6) {\n positions.push(PopoverPosition.LEFT);\n } else if (availableLeft / availableWidth < 0.4) {\n positions.push(PopoverPosition.RIGHT);\n }\n\n if (availableTop / availableHeight > 0.9) {\n positions.unshift(PopoverPosition.TOP);\n } else if (availableTop / availableHeight > 0.6) {\n positions.push(PopoverPosition.TOP);\n } else if (availableTop / availableHeight < 0.1) {\n positions.unshift(PopoverPosition.BOTTOM);\n } else {\n positions.push(PopoverPosition.BOTTOM);\n }\n\n position = positions.join(\"_\") as PopoverPosition;\n }\n\n const style = this.host.style;\n style.position = \"absolute\";\n\n const offsetTop = boundingRect.top - relativeBoundingRect.top;\n const offsetRight = boundingRect.right - relativeBoundingRect.right;\n const offsetBottom = boundingRect.bottom - relativeBoundingRect.bottom;\n const offsetLeft = boundingRect.left - relativeBoundingRect.left;\n const offsetModifier = this.center ? 0.5 : 0;\n const sizeModifier = this.center ? 0.5 : 0;\n\n if (position === PopoverPosition.TOP || position === PopoverPosition.TOP_RIGHT) {\n style.top = \"auto\";\n style.right = \"auto\";\n style.bottom = `${offsetBottom + boundingRect.height}px`;\n\n style.left = `${offsetLeft + boundingRect.width * offsetModifier}px`;\n style.maxHeight = `${availableTop}px`;\n if (position === PopoverPosition.TOP_RIGHT) {\n style.maxWidth = `${availableRight + boundingRect.width * sizeModifier}px`;\n }\n } else if (position === PopoverPosition.TOP_LEFT) {\n style.top = \"auto\";\n style.right = `${offsetRight + boundingRect.width * offsetModifier}px`;\n style.bottom = `${offsetBottom + boundingRect.height}px`;\n style.left = \"auto\";\n style.maxWidth = `${availableLeft}px`;\n style.maxHeight = `${availableTop}px`;\n } else if (position === PopoverPosition.BOTTOM || position === PopoverPosition.BOTTOM_RIGHT) {\n style.top = `${offsetTop + boundingRect.height}px`;\n style.right = \"auto\";\n style.bottom = \"auto\";\n style.left = `${offsetLeft + boundingRect.width * offsetModifier}px`;\n style.maxHeight = `${availableBottom}px`;\n if (position === PopoverPosition.BOTTOM_RIGHT) {\n style.maxWidth = `${availableRight + boundingRect.width * sizeModifier}px`;\n }\n } else if (position === PopoverPosition.BOTTOM_LEFT) {\n style.top = `${offsetTop + boundingRect.height}px`;\n style.right = `${offsetRight + boundingRect.width * offsetModifier}px`;\n style.bottom = \"auto\";\n style.left = \"auto\";\n style.maxWidth = `${availableLeft}px`;\n style.maxHeight = `${availableBottom}px`;\n } else if (position === PopoverPosition.RIGHT || position === PopoverPosition.RIGHT_BOTTOM) {\n style.top = `${offsetTop + boundingRect.height * offsetModifier}px`;\n style.right = \"auto\";\n style.bottom = \"auto\";\n style.left = `${offsetLeft + boundingRect.width}px`;\n style.maxWidth = `${availableRight}px`;\n style.maxHeight = `${availableBottom + boundingRect.height * sizeModifier}px`;\n } else if (position === PopoverPosition.RIGHT_TOP) {\n style.top = \"auto\";\n style.right = \"auto\";\n style.bottom = `${offsetBottom + boundingRect.height * offsetModifier}px`;\n style.left = `${offsetLeft + boundingRect.width}px`;\n style.maxWidth = `${availableRight}px`;\n style.maxHeight = `${availableTop + boundingRect.height * sizeModifier}px`;\n } else if (position === PopoverPosition.LEFT || position === PopoverPosition.LEFT_BOTTOM) {\n style.top = `${offsetTop + boundingRect.height * offsetModifier}px`;\n style.right = `${offsetRight + boundingRect.width}px`;\n style.bottom = \"auto\";\n style.left = \"auto\";\n style.maxWidth = `${availableLeft}px`;\n style.maxHeight = `${availableBottom + boundingRect.height * sizeModifier}px`;\n } else if (position === PopoverPosition.LEFT_TOP) {\n style.top = \"auto\";\n style.right = `${offsetRight + boundingRect.width}px`;\n style.bottom = `${offsetBottom + boundingRect.height * offsetModifier}px`;\n style.left = \"auto\";\n style.maxWidth = `${availableLeft}px`;\n style.maxHeight = `${availableTop + boundingRect.height * sizeModifier}px`;\n }\n\n this.currentPosition = position || this.position;\n this.host.setAttribute(\"current-position\", this.currentPosition);\n }\n\n componentWillLoad(): void {\n this.validatePosition(this.position);\n this.onOpen();\n }\n\n render(): HTMLSlotElement {\n return <slot></slot>;\n }\n}\n"]}
@@ -6,10 +6,10 @@ const ZPopoverStyle0 = stylesCss;
6
6
 
7
7
  const DOCUMENT_ELEMENT = document.documentElement;
8
8
  function getParentElement(element) {
9
- if (element.parentNode.host) {
10
- return element.parentNode.host;
9
+ if (element.parentNode === element.shadowRoot) {
10
+ return element.shadowRoot.host;
11
11
  }
12
- return element.parentNode;
12
+ return element.parentElement;
13
13
  }
14
14
  /**
15
15
  * Find the closest scrollable parent of a node.
@@ -302,7 +302,7 @@ const ZPopover = /*@__PURE__*/ proxyCustomElement(class ZPopover extends HTMLEle
302
302
  this.onOpen();
303
303
  }
304
304
  render() {
305
- return h("slot", { key: 'a7a3830d93abc15bc7138815f9820bc8cda7ab35' });
305
+ return h("slot", { key: '06ccad911be5d149ace59bb4cd239648a9eeb5da' });
306
306
  }
307
307
  get host() { return this; }
308
308
  static get watchers() { return {
@@ -1 +1 @@
1
- {"file":"index25.js","mappings":";;;AAAA,MAAM,SAAS,GAAG,+/GAA+/G,CAAC;AAClhH,uBAAe,SAAS;;ACExB,MAAM,gBAAgB,GAAG,QAAQ,CAAC,eAAe,CAAC;AAElD,SAAS,gBAAgB,CAAC,OAAgB;IACxC,IAAK,OAAO,CAAC,UAAyB,CAAC,IAAI,EAAE;QAC3C,OAAQ,OAAO,CAAC,UAAyB,CAAC,IAAI,CAAC;KAChD;IAED,OAAO,OAAO,CAAC,UAAqB,CAAC;AACvC,CAAC;AAED;;;;;AAKA,SAAS,oBAAoB,CAAC,OAAgB;IAC5C,IAAI,MAAM,GAAG,gBAAgB,CAAC,OAA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AAC,MAAM,GAAG,YAAY,IAAI,CAAC;SAC/E;aAAM,IAAI,QAAQ,KAAK,eAAe,CAAC,QAAQ,EAAE;YAChD,KAAK,CAAC,GAAG,GAAG,MAAM,CAAC;YACnB,KAAK,CAAC,KAAK,GAAG,GAAG,WAAW,GAAG,YAAY,CAAC,KAAK,IAAI,CAAC;YACtD,KAAK,CAAC,MAAM,GAAG,GAAG,YAAY,GAAG,YAAY,CAAC,MAAM,GAAG,cAAc,IAAI,CAAC;YAC1E,KAAK,CAAC,IAAI,GAAG,MAAM,CAAC;YACpB,KAAK,CAAC,QAAQ,GAAG,GAAG,aAAa,IAAI,CAAC;YACtC,KAAK,CAAC,SAAS,GAAG,GAAG,YAAY,GAAG,YAAY,CAAC,MAAM,GAAG,YAAY,IAAI,CAAC;SAC5E;QAED,IAAI,CAAC,eAAe,GAAG,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC;QACjD,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;KAClE;IAED,iBAAiB;QACf,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACrC,IAAI,CAAC,MAAM,EAAE,CAAC;KACf;IAED,MAAM;QACJ,OAAO,8DAAa,CAAC;KACtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/z-popover/styles.css?tag=z-popover&encapsulation=shadow","src/components/z-popover/index.tsx"],"sourcesContent":[":host {\n --z-popover-theme--surface: var(--color-surface01);\n --z-popover-theme--text: var(--color-default-text);\n --z-popover-padding: 0;\n --z-popover-shadow-filter: drop-shadow(0 1px 2px var(--shadow-color-base));\n\n position: relative;\n display: none;\n min-width: calc(var(--space-unit) * 8);\n min-height: calc(var(--space-unit) * 4);\n align-items: center;\n justify-content: center;\n padding: var(--z-popover-padding);\n background: var(--z-popover-theme--surface);\n border-radius: var(--border-radius-small);\n color: var(--z-popover-theme--text);\n fill: currentcolor;\n filter: var(--z-popover-shadow-filter);\n font-family: var(--font-family-sans);\n text-align: center;\n}\n\n:host([open][current-position]),\n:host([open=\"true\"][current-position]) {\n display: flex;\n}\n\n:host([center][current-position=\"top\"]),\n:host([center][current-position=\"bottom\"]) {\n transform: translateX(-50%);\n}\n\n:host([center][current-position=\"right\"]),\n:host([center][current-position=\"left\"]) {\n transform: translateY(-50%);\n}\n\n:host([current-position^=\"top\"]) {\n margin: 0 0 var(--space-unit);\n}\n\n:host([current-position^=\"bottom\"]) {\n margin: var(--space-unit) 0 0;\n}\n\n:host([current-position^=\"left\"]) {\n margin: 0 var(--space-unit) 0 0;\n}\n\n:host([current-position^=\"right\"]) {\n margin: 0 0 0 var(--space-unit);\n}\n\n/* Arrow style */\n\n:host([current-position])::before {\n --arrow-size: 6px;\n --arrow-edge-offset: calc(100% - var(--space-unit) - (var(--arrow-size) / 2));\n --arrow-center-x-offset: calc(50% - (var(--arrow-size) / 2));\n --arrow-center-y-offset: calc(100% - (var(--arrow-size) / 2));\n\n position: absolute;\n display: block;\n width: var(--arrow-size);\n height: var(--arrow-size);\n background: var(--z-popover-theme--surface);\n content: \"\";\n transform: rotate(45deg);\n}\n\n:host([show-arrow=\"false\"])::before,\n:host(:not([show-arrow]))::before {\n display: none;\n}\n\n:host([current-position^=\"top\"])::before {\n top: var(--arrow-center-y-offset);\n}\n\n:host([current-position^=\"bottom\"])::before {\n bottom: var(--arrow-center-y-offset);\n}\n\n:host([current-position=\"top\"])::before,\n:host([current-position=\"bottom\"])::before {\n right: var(--arrow-edge-offset);\n}\n\n:host([current-position=\"right\"])::before,\n:host([current-position=\"left\"])::before {\n bottom: var(--arrow-edge-offset);\n}\n\n:host([current-position=\"right\"])::before {\n right: var(--arrow-center-y-offset);\n}\n\n:host([current-position=\"left\"])::before {\n left: var(--arrow-center-y-offset);\n}\n\n:host([current-position=\"top_right\"])::before,\n:host([current-position=\"bottom_right\"])::before {\n right: var(--arrow-edge-offset);\n}\n\n:host([current-position=\"top_left\"])::before,\n:host([current-position=\"bottom_left\"])::before {\n left: var(--arrow-edge-offset);\n}\n\n:host([current-position=\"right_top\"])::before,\n:host([current-position=\"left_top\"])::before {\n top: var(--arrow-edge-offset);\n}\n\n:host([current-position=\"right_top\"])::before,\n:host([current-position=\"right_bottom\"])::before {\n right: var(--arrow-center-y-offset);\n}\n\n:host([current-position=\"left_top\"])::before,\n:host([current-position=\"left_bottom\"])::before {\n left: var(--arrow-center-y-offset);\n}\n\n:host([current-position=\"right_bottom\"])::before,\n:host([current-position=\"left_bottom\"])::before {\n bottom: var(--arrow-edge-offset);\n}\n\n:host([center][current-position=\"top\"])::before,\n:host([center][current-position=\"bottom\"])::before {\n right: auto;\n left: var(--arrow-center-x-offset);\n}\n\n:host([center][current-position=\"right\"])::before,\n:host([center][current-position=\"left\"])::before {\n top: var(--arrow-center-x-offset);\n bottom: auto;\n}\n\n::slotted(*) {\n overflow: auto;\n flex: 1 auto;\n}\n","import {Component, Element, Event, EventEmitter, Listen, Prop, State, Watch, h} from \"@stencil/core\";\nimport {KeyboardCode, PopoverPosition} from \"../../beans\";\n\nconst DOCUMENT_ELEMENT = document.documentElement;\n\nfunction getParentElement(element: Element): ShadowRoot[\"host\"] {\n if ((element.parentNode as ShadowRoot).host) {\n return (element.parentNode as ShadowRoot).host;\n }\n\n return element.parentNode as Element;\n}\n\n/**\n * Find the closest scrollable parent of a node.\n *\n * @param {Element} element The node\n */\nfunction findScrollableParent(element: Element): Element {\n let parent = getParentElement(element);\n\n while (parent && parent !== DOCUMENT_ELEMENT) {\n const {overflow, overflowX, overflowY} = window.getComputedStyle(parent);\n if (overflow === \"hidden\" || overflowY === \"hidden\" || overflowX === \"hidden\") {\n return parent;\n }\n\n if (\n (parent.scrollHeight > parent.clientHeight && overflow !== \"visible\" && overflowY !== \"visible\") ||\n (parent.scrollWidth > parent.clientWidth && overflow !== \"visible\" && overflowX !== \"visible\")\n ) {\n return parent;\n }\n\n parent = getParentElement(parent);\n }\n\n return DOCUMENT_ELEMENT;\n}\n\n/**\n * Calculate computed offset.\n * It includes matrix transformations.\n * @param element The target element.\n * @param targetParentOffset The relative offset parent.\n * @return A client rect object.\n */\nfunction computeOffset(element: HTMLElement, targetParentOffset?: HTMLElement): Record<string, number> {\n const rect = element.getBoundingClientRect();\n const width = rect.width;\n const height = rect.height;\n\n let top = 0;\n let left = 0;\n let offsetParent = element;\n while (offsetParent && offsetParent != targetParentOffset) {\n left += offsetParent.offsetLeft;\n\n // document.body sometimes has offsetTop == 0 but still has an\n // offset because of children margins!\n if (offsetParent === document.body) {\n top += offsetParent.getBoundingClientRect().top + window.scrollY;\n } else {\n top += offsetParent.offsetTop;\n }\n\n if (window.DOMMatrix) {\n const style = window.getComputedStyle(offsetParent);\n const transform = style.transform || style.webkitTransform;\n const domMatrix = new DOMMatrix(transform);\n if (domMatrix) {\n left += domMatrix.m41;\n if (offsetParent !== document.body) {\n top += domMatrix.m42;\n }\n }\n }\n\n if (!offsetParent.offsetParent) {\n break;\n }\n\n offsetParent = offsetParent.offsetParent as HTMLElement;\n }\n\n let parentWidth: number;\n let parentHeight: number;\n if (offsetParent === document.body) {\n parentWidth = window.innerWidth;\n parentHeight = window.innerHeight;\n } else {\n parentWidth = offsetParent.offsetWidth;\n parentHeight = offsetParent.offsetHeight;\n }\n\n const right = parentWidth - left - rect.width;\n const bottom = parentHeight - top - rect.height;\n\n return {top, right, bottom, left, width, height};\n}\n\n/**\n * Popover component.\n *\n * @cssprop --z-popover-theme--surface - background color of the popover.\n * @cssprop --z-popover-theme--text - foreground color of the popover.\n * @cssprop --z-popover-padding - padding of the popover.\n * @cssprop --z-popover-shadow-filter - drop-shadow filter of the popover. Defaults to `drop-shadow(0 1px 2px var(--shadow-color-base))`.\n */\n@Component({\n tag: \"z-popover\",\n styleUrl: \"styles.css\",\n shadow: true,\n})\nexport class ZPopover {\n /** Popover position. */\n @Prop({reflect: true})\n position: PopoverPosition = PopoverPosition.AUTO;\n\n /**\n * The open state of the popover.\n */\n @Prop({reflect: true, mutable: true})\n open = false;\n\n /**\n * The selector or the element bound with the popover.\n * If string css selector is provided make sure to use a valid selector.\n */\n @Prop()\n bindTo?: string | HTMLElement;\n\n /**\n * Whether to show popover's arrow.\n */\n @Prop({reflect: true})\n showArrow = false;\n\n /**\n * Whether to center the popup on the main side (according to \"position\").\n */\n @Prop({reflect: true})\n center = false;\n\n /**\n * If true, the popover can be closed by clicking outside of it or pressing the escape key.\n * Otherwise, it will be closed only programmatically (by setting `open` to `false`).\n */\n @Prop()\n closable = true;\n\n /**\n * The current position of the popover.\n */\n @State()\n currentPosition?: PopoverPosition;\n\n /**\n * Position change event.\n */\n @Event()\n positionChange: EventEmitter;\n\n /**\n * Open change event.\n */\n @Event()\n openChange: EventEmitter;\n\n @Element() host: HTMLZPopoverElement;\n\n private animationFrameRequestId?: number;\n\n @Listen(\"keyup\", {target: \"window\"})\n closePopoverWithKeyboard(e: KeyboardEvent): void {\n if (this.closable && e.key === KeyboardCode.ESC) {\n this.open = false;\n }\n }\n\n /**\n * Close the popover when clicking outside of its content.\n * Stop event propagation if the click was fired by popover's trigger element,\n * to prevent close and reopen glitches.\n * @param {MouseEvent} e\n */\n @Listen(\"click\", {target: \"body\", capture: true})\n handleOutsideClick(e: MouseEvent): void {\n if (!this.closable || !this.open) {\n return;\n }\n\n if (!e.composedPath().includes(this.host)) {\n const target = e.target as HTMLElement;\n const triggerElemClicked =\n this.bindTo instanceof HTMLElement ? this.bindTo.contains(target) : target.closest(this.bindTo);\n if (triggerElemClicked) {\n e.stopPropagation();\n }\n\n this.open = false;\n this.positionChange.emit({position: this.currentPosition});\n }\n }\n\n @Watch(\"position\")\n validatePosition(newValue: PopoverPosition): void {\n if (newValue && !Object.values(PopoverPosition).includes(newValue as PopoverPosition)) {\n this.position = PopoverPosition.AUTO;\n }\n\n this.currentPosition = this.position;\n this.positionChange.emit({position: this.currentPosition});\n }\n\n /**\n * Setup popover behaviors on opening.\n */\n @Watch(\"open\")\n onOpen(): void {\n cancelAnimationFrame(this.animationFrameRequestId);\n if (this.open) {\n const setPosition = (): void => {\n if (this.open) {\n this.setPosition();\n this.animationFrameRequestId = requestAnimationFrame(setPosition);\n }\n };\n\n setPosition();\n } else if (this.host.hasAttribute(\"current-position\")) {\n this.host.removeAttribute(\"current-position\");\n this.currentPosition = undefined;\n }\n\n this.openChange.emit({open: this.open});\n }\n\n disconnectedCallback(): void {\n cancelAnimationFrame(this.animationFrameRequestId);\n }\n\n /**\n * Set the position of the popover.\n */\n private setPosition(): void {\n let element: HTMLElement;\n if (typeof this.bindTo === \"string\") {\n element = this.host.ownerDocument.querySelector(this.bindTo) as HTMLElement;\n } else if (this.bindTo) {\n element = this.bindTo;\n } else {\n element = this.host.parentElement as HTMLElement;\n }\n\n if (!element) {\n return;\n }\n\n const scrollContainer = findScrollableParent(element) as HTMLElement;\n const scrollingBoundingRect = scrollContainer.getBoundingClientRect();\n const offsetContainer = this.host.offsetParent as HTMLElement;\n\n const relativeBoundingRect = offsetContainer\n ? computeOffset(offsetContainer, scrollContainer)\n : {top: 0, right: 0, bottom: 0, left: 0};\n const boundingRect = computeOffset(element, scrollContainer);\n\n const top = boundingRect.top - scrollContainer.scrollTop;\n const bottom = scrollingBoundingRect.height - (boundingRect.top + boundingRect.height) + scrollContainer.scrollTop;\n const left = boundingRect.left - scrollContainer.scrollLeft;\n const right = scrollingBoundingRect.width - (boundingRect.left + boundingRect.width) + scrollContainer.scrollLeft;\n\n const overflowBottom = Math.max(0, scrollingBoundingRect.top + scrollingBoundingRect.height - window.innerHeight);\n const overflowRight = Math.max(0, scrollingBoundingRect.left + scrollingBoundingRect.width - window.innerWidth);\n\n const availableTop = Math.min(top, top + scrollingBoundingRect.top);\n const availableBottom = Math.min(bottom, bottom - overflowBottom);\n const availableLeft = Math.min(left, left + scrollingBoundingRect.left);\n const availableRight = Math.min(right, right - overflowRight);\n\n const availableHeight = availableTop + availableBottom + boundingRect.height;\n const availableWidth = availableLeft + availableRight + boundingRect.width;\n\n let position = this.currentPosition;\n const positions: PopoverPosition[] = [];\n if (this.position === PopoverPosition.AUTO) {\n /**\n * The `AUTO` position tries to place the popover in the 'safest' area,\n * where there's more space available.\n */\n if (availableLeft / availableWidth > 0.6) {\n positions.push(PopoverPosition.LEFT);\n } else if (availableLeft / availableWidth < 0.4) {\n positions.push(PopoverPosition.RIGHT);\n }\n\n if (availableTop / availableHeight > 0.9) {\n positions.unshift(PopoverPosition.TOP);\n } else if (availableTop / availableHeight > 0.6) {\n positions.push(PopoverPosition.TOP);\n } else if (availableTop / availableHeight < 0.1) {\n positions.unshift(PopoverPosition.BOTTOM);\n } else {\n positions.push(PopoverPosition.BOTTOM);\n }\n\n position = positions.join(\"_\") as PopoverPosition;\n }\n\n const style = this.host.style;\n style.position = \"absolute\";\n\n const offsetTop = boundingRect.top - relativeBoundingRect.top;\n const offsetRight = boundingRect.right - relativeBoundingRect.right;\n const offsetBottom = boundingRect.bottom - relativeBoundingRect.bottom;\n const offsetLeft = boundingRect.left - relativeBoundingRect.left;\n const offsetModifier = this.center ? 0.5 : 0;\n const sizeModifier = this.center ? 0.5 : 0;\n\n if (position === PopoverPosition.TOP || position === PopoverPosition.TOP_RIGHT) {\n style.top = \"auto\";\n style.right = \"auto\";\n style.bottom = `${offsetBottom + boundingRect.height}px`;\n\n style.left = `${offsetLeft + boundingRect.width * offsetModifier}px`;\n style.maxHeight = `${availableTop}px`;\n if (position === PopoverPosition.TOP_RIGHT) {\n style.maxWidth = `${availableRight + boundingRect.width * sizeModifier}px`;\n }\n } else if (position === PopoverPosition.TOP_LEFT) {\n style.top = \"auto\";\n style.right = `${offsetRight + boundingRect.width * offsetModifier}px`;\n style.bottom = `${offsetBottom + boundingRect.height}px`;\n style.left = \"auto\";\n style.maxWidth = `${availableLeft}px`;\n style.maxHeight = `${availableTop}px`;\n } else if (position === PopoverPosition.BOTTOM || position === PopoverPosition.BOTTOM_RIGHT) {\n style.top = `${offsetTop + boundingRect.height}px`;\n style.right = \"auto\";\n style.bottom = \"auto\";\n style.left = `${offsetLeft + boundingRect.width * offsetModifier}px`;\n style.maxHeight = `${availableBottom}px`;\n if (position === PopoverPosition.BOTTOM_RIGHT) {\n style.maxWidth = `${availableRight + boundingRect.width * sizeModifier}px`;\n }\n } else if (position === PopoverPosition.BOTTOM_LEFT) {\n style.top = `${offsetTop + boundingRect.height}px`;\n style.right = `${offsetRight + boundingRect.width * offsetModifier}px`;\n style.bottom = \"auto\";\n style.left = \"auto\";\n style.maxWidth = `${availableLeft}px`;\n style.maxHeight = `${availableBottom}px`;\n } else if (position === PopoverPosition.RIGHT || position === PopoverPosition.RIGHT_BOTTOM) {\n style.top = `${offsetTop + boundingRect.height * offsetModifier}px`;\n style.right = \"auto\";\n style.bottom = \"auto\";\n style.left = `${offsetLeft + boundingRect.width}px`;\n style.maxWidth = `${availableRight}px`;\n style.maxHeight = `${availableBottom + boundingRect.height * sizeModifier}px`;\n } else if (position === PopoverPosition.RIGHT_TOP) {\n style.top = \"auto\";\n style.right = \"auto\";\n style.bottom = `${offsetBottom + boundingRect.height * offsetModifier}px`;\n style.left = `${offsetLeft + boundingRect.width}px`;\n style.maxWidth = `${availableRight}px`;\n style.maxHeight = `${availableTop + boundingRect.height * sizeModifier}px`;\n } else if (position === PopoverPosition.LEFT || position === PopoverPosition.LEFT_BOTTOM) {\n style.top = `${offsetTop + boundingRect.height * offsetModifier}px`;\n style.right = `${offsetRight + boundingRect.width}px`;\n style.bottom = \"auto\";\n style.left = \"auto\";\n style.maxWidth = `${availableLeft}px`;\n style.maxHeight = `${availableBottom + boundingRect.height * sizeModifier}px`;\n } else if (position === PopoverPosition.LEFT_TOP) {\n style.top = \"auto\";\n style.right = `${offsetRight + boundingRect.width}px`;\n style.bottom = `${offsetBottom + boundingRect.height * offsetModifier}px`;\n style.left = \"auto\";\n style.maxWidth = `${availableLeft}px`;\n style.maxHeight = `${availableTop + boundingRect.height * sizeModifier}px`;\n }\n\n this.currentPosition = position || this.position;\n this.host.setAttribute(\"current-position\", this.currentPosition);\n }\n\n componentWillLoad(): void {\n this.validatePosition(this.position);\n this.onOpen();\n }\n\n render(): HTMLSlotElement {\n return <slot></slot>;\n }\n}\n"],"version":3}
1
+ {"file":"index25.js","mappings":";;;AAAA,MAAM,SAAS,GAAG,+/GAA+/G,CAAC;AAClhH,uBAAe,SAAS;;ACExB,MAAM,gBAAgB,GAAG,QAAQ,CAAC,eAAe,CAAC;AAElD,SAAS,gBAAgB,CAAC,OAAgB;IACxC,IAAI,OAAO,CAAC,UAAU,KAAK,OAAO,CAAC,UAAU,EAAE;QAC7C,OAAO,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC;KAChC;IAED,OAAO,OAAO,CAAC,aAAa,CAAC;AAC/B,CAAC;AAED;;;;;AAKA,SAAS,oBAAoB,CAAC,OAAgB;IAC5C,IAAI,MAAM,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAEvC,OAAO,MAAM,IAAI,MAAM,KAAK,gBAAgB,EAAE;QAC5C,MAAM,EAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAC,GAAG,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;QACzE,IAAI,QAAQ,KAAK,QAAQ,IAAI,SAAS,KAAK,QAAQ,IAAI,SAAS,KAAK,QAAQ,EAAE;YAC7E,OAAO,MAAM,CAAC;SACf;QAED,IACE,CAAC,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,IAAI,QAAQ,KAAK,SAAS,IAAI,SAAS,KAAK,SAAS;aAC9F,MAAM,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,QAAQ,KAAK,SAAS,IAAI,SAAS,KAAK,SAAS,CAAC,EAC9F;YACA,OAAO,MAAM,CAAC;SACf;QAED,MAAM,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;KACnC;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED;;;;;;;AAOA,SAAS,aAAa,CAAC,OAAoB,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,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACrC,IAAI,CAAC,MAAM,EAAE,CAAC;KACf;IAED,MAAM;QACJ,OAAO,8DAAa,CAAC;KACtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/z-popover/styles.css?tag=z-popover&encapsulation=shadow","src/components/z-popover/index.tsx"],"sourcesContent":[":host {\n --z-popover-theme--surface: var(--color-surface01);\n --z-popover-theme--text: var(--color-default-text);\n --z-popover-padding: 0;\n --z-popover-shadow-filter: drop-shadow(0 1px 2px var(--shadow-color-base));\n\n position: relative;\n display: none;\n min-width: calc(var(--space-unit) * 8);\n min-height: calc(var(--space-unit) * 4);\n align-items: center;\n justify-content: center;\n padding: var(--z-popover-padding);\n background: var(--z-popover-theme--surface);\n border-radius: var(--border-radius-small);\n color: var(--z-popover-theme--text);\n fill: currentcolor;\n filter: var(--z-popover-shadow-filter);\n font-family: var(--font-family-sans);\n text-align: center;\n}\n\n:host([open][current-position]),\n:host([open=\"true\"][current-position]) {\n display: flex;\n}\n\n:host([center][current-position=\"top\"]),\n:host([center][current-position=\"bottom\"]) {\n transform: translateX(-50%);\n}\n\n:host([center][current-position=\"right\"]),\n:host([center][current-position=\"left\"]) {\n transform: translateY(-50%);\n}\n\n:host([current-position^=\"top\"]) {\n margin: 0 0 var(--space-unit);\n}\n\n:host([current-position^=\"bottom\"]) {\n margin: var(--space-unit) 0 0;\n}\n\n:host([current-position^=\"left\"]) {\n margin: 0 var(--space-unit) 0 0;\n}\n\n:host([current-position^=\"right\"]) {\n margin: 0 0 0 var(--space-unit);\n}\n\n/* Arrow style */\n\n:host([current-position])::before {\n --arrow-size: 6px;\n --arrow-edge-offset: calc(100% - var(--space-unit) - (var(--arrow-size) / 2));\n --arrow-center-x-offset: calc(50% - (var(--arrow-size) / 2));\n --arrow-center-y-offset: calc(100% - (var(--arrow-size) / 2));\n\n position: absolute;\n display: block;\n width: var(--arrow-size);\n height: var(--arrow-size);\n background: var(--z-popover-theme--surface);\n content: \"\";\n transform: rotate(45deg);\n}\n\n:host([show-arrow=\"false\"])::before,\n:host(:not([show-arrow]))::before {\n display: none;\n}\n\n:host([current-position^=\"top\"])::before {\n top: var(--arrow-center-y-offset);\n}\n\n:host([current-position^=\"bottom\"])::before {\n bottom: var(--arrow-center-y-offset);\n}\n\n:host([current-position=\"top\"])::before,\n:host([current-position=\"bottom\"])::before {\n right: var(--arrow-edge-offset);\n}\n\n:host([current-position=\"right\"])::before,\n:host([current-position=\"left\"])::before {\n bottom: var(--arrow-edge-offset);\n}\n\n:host([current-position=\"right\"])::before {\n right: var(--arrow-center-y-offset);\n}\n\n:host([current-position=\"left\"])::before {\n left: var(--arrow-center-y-offset);\n}\n\n:host([current-position=\"top_right\"])::before,\n:host([current-position=\"bottom_right\"])::before {\n right: var(--arrow-edge-offset);\n}\n\n:host([current-position=\"top_left\"])::before,\n:host([current-position=\"bottom_left\"])::before {\n left: var(--arrow-edge-offset);\n}\n\n:host([current-position=\"right_top\"])::before,\n:host([current-position=\"left_top\"])::before {\n top: var(--arrow-edge-offset);\n}\n\n:host([current-position=\"right_top\"])::before,\n:host([current-position=\"right_bottom\"])::before {\n right: var(--arrow-center-y-offset);\n}\n\n:host([current-position=\"left_top\"])::before,\n:host([current-position=\"left_bottom\"])::before {\n left: var(--arrow-center-y-offset);\n}\n\n:host([current-position=\"right_bottom\"])::before,\n:host([current-position=\"left_bottom\"])::before {\n bottom: var(--arrow-edge-offset);\n}\n\n:host([center][current-position=\"top\"])::before,\n:host([center][current-position=\"bottom\"])::before {\n right: auto;\n left: var(--arrow-center-x-offset);\n}\n\n:host([center][current-position=\"right\"])::before,\n:host([center][current-position=\"left\"])::before {\n top: var(--arrow-center-x-offset);\n bottom: auto;\n}\n\n::slotted(*) {\n overflow: auto;\n flex: 1 auto;\n}\n","import {Component, Element, Event, EventEmitter, Listen, Prop, State, Watch, h} from \"@stencil/core\";\nimport {KeyboardCode, PopoverPosition} from \"../../beans\";\n\nconst DOCUMENT_ELEMENT = document.documentElement;\n\nfunction getParentElement(element: Element): Element {\n if (element.parentNode === element.shadowRoot) {\n return element.shadowRoot.host;\n }\n\n return element.parentElement;\n}\n\n/**\n * Find the closest scrollable parent of a node.\n *\n * @param {Element} element The node\n */\nfunction findScrollableParent(element: Element): Element {\n let parent = getParentElement(element);\n\n while (parent && parent !== DOCUMENT_ELEMENT) {\n const {overflow, overflowX, overflowY} = window.getComputedStyle(parent);\n if (overflow === \"hidden\" || overflowY === \"hidden\" || overflowX === \"hidden\") {\n return parent;\n }\n\n if (\n (parent.scrollHeight > parent.clientHeight && overflow !== \"visible\" && overflowY !== \"visible\") ||\n (parent.scrollWidth > parent.clientWidth && overflow !== \"visible\" && overflowX !== \"visible\")\n ) {\n return parent;\n }\n\n parent = getParentElement(parent);\n }\n\n return DOCUMENT_ELEMENT;\n}\n\n/**\n * Calculate computed offset.\n * It includes matrix transformations.\n * @param element The target element.\n * @param targetParentOffset The relative offset parent.\n * @return A client rect object.\n */\nfunction computeOffset(element: HTMLElement, targetParentOffset?: HTMLElement): Record<string, number> {\n const rect = element.getBoundingClientRect();\n const width = rect.width;\n const height = rect.height;\n\n let top = 0;\n let left = 0;\n let offsetParent = element;\n while (offsetParent && offsetParent != targetParentOffset) {\n left += offsetParent.offsetLeft;\n\n // document.body sometimes has offsetTop == 0 but still has an\n // offset because of children margins!\n if (offsetParent === document.body) {\n top += offsetParent.getBoundingClientRect().top + window.scrollY;\n } else {\n top += offsetParent.offsetTop;\n }\n\n if (window.DOMMatrix) {\n const style = window.getComputedStyle(offsetParent);\n const transform = style.transform || style.webkitTransform;\n const domMatrix = new DOMMatrix(transform);\n if (domMatrix) {\n left += domMatrix.m41;\n if (offsetParent !== document.body) {\n top += domMatrix.m42;\n }\n }\n }\n\n if (!offsetParent.offsetParent) {\n break;\n }\n\n offsetParent = offsetParent.offsetParent as HTMLElement;\n }\n\n let parentWidth: number;\n let parentHeight: number;\n if (offsetParent === document.body) {\n parentWidth = window.innerWidth;\n parentHeight = window.innerHeight;\n } else {\n parentWidth = offsetParent.offsetWidth;\n parentHeight = offsetParent.offsetHeight;\n }\n\n const right = parentWidth - left - rect.width;\n const bottom = parentHeight - top - rect.height;\n\n return {top, right, bottom, left, width, height};\n}\n\n/**\n * Popover component.\n *\n * @cssprop --z-popover-theme--surface - background color of the popover.\n * @cssprop --z-popover-theme--text - foreground color of the popover.\n * @cssprop --z-popover-padding - padding of the popover.\n * @cssprop --z-popover-shadow-filter - drop-shadow filter of the popover. Defaults to `drop-shadow(0 1px 2px var(--shadow-color-base))`.\n */\n@Component({\n tag: \"z-popover\",\n styleUrl: \"styles.css\",\n shadow: true,\n})\nexport class ZPopover {\n /** Popover position. */\n @Prop({reflect: true})\n position: PopoverPosition = PopoverPosition.AUTO;\n\n /**\n * The open state of the popover.\n */\n @Prop({reflect: true, mutable: true})\n open = false;\n\n /**\n * The selector or the element bound with the popover.\n * If string css selector is provided make sure to use a valid selector.\n */\n @Prop()\n bindTo?: string | HTMLElement;\n\n /**\n * Whether to show popover's arrow.\n */\n @Prop({reflect: true})\n showArrow = false;\n\n /**\n * Whether to center the popup on the main side (according to \"position\").\n */\n @Prop({reflect: true})\n center = false;\n\n /**\n * If true, the popover can be closed by clicking outside of it or pressing the escape key.\n * Otherwise, it will be closed only programmatically (by setting `open` to `false`).\n */\n @Prop()\n closable = true;\n\n /**\n * The current position of the popover.\n */\n @State()\n currentPosition?: PopoverPosition;\n\n /**\n * Position change event.\n */\n @Event()\n positionChange: EventEmitter;\n\n /**\n * Open change event.\n */\n @Event()\n openChange: EventEmitter;\n\n @Element() host: HTMLZPopoverElement;\n\n private animationFrameRequestId?: number;\n\n @Listen(\"keyup\", {target: \"window\"})\n closePopoverWithKeyboard(e: KeyboardEvent): void {\n if (this.closable && e.key === KeyboardCode.ESC) {\n this.open = false;\n }\n }\n\n /**\n * Close the popover when clicking outside of its content.\n * Stop event propagation if the click was fired by popover's trigger element,\n * to prevent close and reopen glitches.\n * @param {MouseEvent} e\n */\n @Listen(\"click\", {target: \"body\", capture: true})\n handleOutsideClick(e: MouseEvent): void {\n if (!this.closable || !this.open) {\n return;\n }\n\n if (!e.composedPath().includes(this.host)) {\n const target = e.target as HTMLElement;\n const triggerElemClicked =\n this.bindTo instanceof HTMLElement ? this.bindTo.contains(target) : target.closest(this.bindTo);\n if (triggerElemClicked) {\n e.stopPropagation();\n }\n\n this.open = false;\n this.positionChange.emit({position: this.currentPosition});\n }\n }\n\n @Watch(\"position\")\n validatePosition(newValue: PopoverPosition): void {\n if (newValue && !Object.values(PopoverPosition).includes(newValue as PopoverPosition)) {\n this.position = PopoverPosition.AUTO;\n }\n\n this.currentPosition = this.position;\n this.positionChange.emit({position: this.currentPosition});\n }\n\n /**\n * Setup popover behaviors on opening.\n */\n @Watch(\"open\")\n onOpen(): void {\n cancelAnimationFrame(this.animationFrameRequestId);\n if (this.open) {\n const setPosition = (): void => {\n if (this.open) {\n this.setPosition();\n this.animationFrameRequestId = requestAnimationFrame(setPosition);\n }\n };\n\n setPosition();\n } else if (this.host.hasAttribute(\"current-position\")) {\n this.host.removeAttribute(\"current-position\");\n this.currentPosition = undefined;\n }\n\n this.openChange.emit({open: this.open});\n }\n\n disconnectedCallback(): void {\n cancelAnimationFrame(this.animationFrameRequestId);\n }\n\n /**\n * Set the position of the popover.\n */\n private setPosition(): void {\n let element: HTMLElement;\n if (typeof this.bindTo === \"string\") {\n element = this.host.ownerDocument.querySelector(this.bindTo) as HTMLElement;\n } else if (this.bindTo) {\n element = this.bindTo;\n } else {\n element = this.host.parentElement as HTMLElement;\n }\n\n if (!element) {\n return;\n }\n\n const scrollContainer = findScrollableParent(element) as HTMLElement;\n const scrollingBoundingRect = scrollContainer.getBoundingClientRect();\n const offsetContainer = this.host.offsetParent as HTMLElement;\n\n const relativeBoundingRect = offsetContainer\n ? computeOffset(offsetContainer, scrollContainer)\n : {top: 0, right: 0, bottom: 0, left: 0};\n const boundingRect = computeOffset(element, scrollContainer);\n\n const top = boundingRect.top - scrollContainer.scrollTop;\n const bottom = scrollingBoundingRect.height - (boundingRect.top + boundingRect.height) + scrollContainer.scrollTop;\n const left = boundingRect.left - scrollContainer.scrollLeft;\n const right = scrollingBoundingRect.width - (boundingRect.left + boundingRect.width) + scrollContainer.scrollLeft;\n\n const overflowBottom = Math.max(0, scrollingBoundingRect.top + scrollingBoundingRect.height - window.innerHeight);\n const overflowRight = Math.max(0, scrollingBoundingRect.left + scrollingBoundingRect.width - window.innerWidth);\n\n const availableTop = Math.min(top, top + scrollingBoundingRect.top);\n const availableBottom = Math.min(bottom, bottom - overflowBottom);\n const availableLeft = Math.min(left, left + scrollingBoundingRect.left);\n const availableRight = Math.min(right, right - overflowRight);\n\n const availableHeight = availableTop + availableBottom + boundingRect.height;\n const availableWidth = availableLeft + availableRight + boundingRect.width;\n\n let position = this.currentPosition;\n const positions: PopoverPosition[] = [];\n if (this.position === PopoverPosition.AUTO) {\n /**\n * The `AUTO` position tries to place the popover in the 'safest' area,\n * where there's more space available.\n */\n if (availableLeft / availableWidth > 0.6) {\n positions.push(PopoverPosition.LEFT);\n } else if (availableLeft / availableWidth < 0.4) {\n positions.push(PopoverPosition.RIGHT);\n }\n\n if (availableTop / availableHeight > 0.9) {\n positions.unshift(PopoverPosition.TOP);\n } else if (availableTop / availableHeight > 0.6) {\n positions.push(PopoverPosition.TOP);\n } else if (availableTop / availableHeight < 0.1) {\n positions.unshift(PopoverPosition.BOTTOM);\n } else {\n positions.push(PopoverPosition.BOTTOM);\n }\n\n position = positions.join(\"_\") as PopoverPosition;\n }\n\n const style = this.host.style;\n style.position = \"absolute\";\n\n const offsetTop = boundingRect.top - relativeBoundingRect.top;\n const offsetRight = boundingRect.right - relativeBoundingRect.right;\n const offsetBottom = boundingRect.bottom - relativeBoundingRect.bottom;\n const offsetLeft = boundingRect.left - relativeBoundingRect.left;\n const offsetModifier = this.center ? 0.5 : 0;\n const sizeModifier = this.center ? 0.5 : 0;\n\n if (position === PopoverPosition.TOP || position === PopoverPosition.TOP_RIGHT) {\n style.top = \"auto\";\n style.right = \"auto\";\n style.bottom = `${offsetBottom + boundingRect.height}px`;\n\n style.left = `${offsetLeft + boundingRect.width * offsetModifier}px`;\n style.maxHeight = `${availableTop}px`;\n if (position === PopoverPosition.TOP_RIGHT) {\n style.maxWidth = `${availableRight + boundingRect.width * sizeModifier}px`;\n }\n } else if (position === PopoverPosition.TOP_LEFT) {\n style.top = \"auto\";\n style.right = `${offsetRight + boundingRect.width * offsetModifier}px`;\n style.bottom = `${offsetBottom + boundingRect.height}px`;\n style.left = \"auto\";\n style.maxWidth = `${availableLeft}px`;\n style.maxHeight = `${availableTop}px`;\n } else if (position === PopoverPosition.BOTTOM || position === PopoverPosition.BOTTOM_RIGHT) {\n style.top = `${offsetTop + boundingRect.height}px`;\n style.right = \"auto\";\n style.bottom = \"auto\";\n style.left = `${offsetLeft + boundingRect.width * offsetModifier}px`;\n style.maxHeight = `${availableBottom}px`;\n if (position === PopoverPosition.BOTTOM_RIGHT) {\n style.maxWidth = `${availableRight + boundingRect.width * sizeModifier}px`;\n }\n } else if (position === PopoverPosition.BOTTOM_LEFT) {\n style.top = `${offsetTop + boundingRect.height}px`;\n style.right = `${offsetRight + boundingRect.width * offsetModifier}px`;\n style.bottom = \"auto\";\n style.left = \"auto\";\n style.maxWidth = `${availableLeft}px`;\n style.maxHeight = `${availableBottom}px`;\n } else if (position === PopoverPosition.RIGHT || position === PopoverPosition.RIGHT_BOTTOM) {\n style.top = `${offsetTop + boundingRect.height * offsetModifier}px`;\n style.right = \"auto\";\n style.bottom = \"auto\";\n style.left = `${offsetLeft + boundingRect.width}px`;\n style.maxWidth = `${availableRight}px`;\n style.maxHeight = `${availableBottom + boundingRect.height * sizeModifier}px`;\n } else if (position === PopoverPosition.RIGHT_TOP) {\n style.top = \"auto\";\n style.right = \"auto\";\n style.bottom = `${offsetBottom + boundingRect.height * offsetModifier}px`;\n style.left = `${offsetLeft + boundingRect.width}px`;\n style.maxWidth = `${availableRight}px`;\n style.maxHeight = `${availableTop + boundingRect.height * sizeModifier}px`;\n } else if (position === PopoverPosition.LEFT || position === PopoverPosition.LEFT_BOTTOM) {\n style.top = `${offsetTop + boundingRect.height * offsetModifier}px`;\n style.right = `${offsetRight + boundingRect.width}px`;\n style.bottom = \"auto\";\n style.left = \"auto\";\n style.maxWidth = `${availableLeft}px`;\n style.maxHeight = `${availableBottom + boundingRect.height * sizeModifier}px`;\n } else if (position === PopoverPosition.LEFT_TOP) {\n style.top = \"auto\";\n style.right = `${offsetRight + boundingRect.width}px`;\n style.bottom = `${offsetBottom + boundingRect.height * offsetModifier}px`;\n style.left = \"auto\";\n style.maxWidth = `${availableLeft}px`;\n style.maxHeight = `${availableTop + boundingRect.height * sizeModifier}px`;\n }\n\n this.currentPosition = position || this.position;\n this.host.setAttribute(\"current-position\", this.currentPosition);\n }\n\n componentWillLoad(): void {\n this.validatePosition(this.position);\n this.onOpen();\n }\n\n render(): HTMLSlotElement {\n return <slot></slot>;\n }\n}\n"],"version":3}
@@ -6,10 +6,10 @@ const ZPopoverStyle0 = stylesCss;
6
6
 
7
7
  const DOCUMENT_ELEMENT = document.documentElement;
8
8
  function getParentElement(element) {
9
- if (element.parentNode.host) {
10
- return element.parentNode.host;
9
+ if (element.parentNode === element.shadowRoot) {
10
+ return element.shadowRoot.host;
11
11
  }
12
- return element.parentNode;
12
+ return element.parentElement;
13
13
  }
14
14
  /**
15
15
  * Find the closest scrollable parent of a node.
@@ -300,7 +300,7 @@ const ZPopover = class {
300
300
  this.onOpen();
301
301
  }
302
302
  render() {
303
- return h("slot", { key: 'a7a3830d93abc15bc7138815f9820bc8cda7ab35' });
303
+ return h("slot", { key: '06ccad911be5d149ace59bb4cd239648a9eeb5da' });
304
304
  }
305
305
  get host() { return getElement(this); }
306
306
  static get watchers() { return {