@esri/calcite-components 5.1.0-next.8 → 5.1.0-next.9

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 (161) hide show
  1. package/dist/cdn/{YCTMZBN3.js → 24BVOJIY.js} +1 -1
  2. package/dist/cdn/{AQRFO7EB.js → 34EJXQYF.js} +1 -1
  3. package/dist/cdn/{LS6DCTIG.js → 3GXLGKZV.js} +1 -1
  4. package/dist/cdn/{OHI6NELF.js → 3IHT5FIP.js} +1 -1
  5. package/dist/cdn/{IMFR5NEO.js → 3O7NXGXJ.js} +1 -1
  6. package/dist/cdn/{TRQXVBXU.js → 43FMFYKZ.js} +1 -1
  7. package/dist/cdn/{H764MK3H.js → 43SP7K3P.js} +1 -1
  8. package/dist/cdn/{GOV5YXBE.js → 45Z5R6GR.js} +1 -1
  9. package/dist/cdn/{G3LIWIPW.js → 47RTCYTX.js} +1 -1
  10. package/dist/cdn/{L36EVTCL.js → 4AQ3DQDN.js} +1 -1
  11. package/dist/cdn/{OGR5ARIW.js → 4DJKUEBQ.js} +1 -1
  12. package/dist/cdn/4IBKGKIH.js +2 -0
  13. package/dist/cdn/{G5PEBD22.js → 4JVVYRDW.js} +1 -1
  14. package/dist/cdn/{ISXEEXKP.js → 4U633XVG.js} +1 -1
  15. package/dist/cdn/{OXIEI7FU.js → 55GOZN42.js} +1 -1
  16. package/dist/cdn/{AKHHJLNI.js → 575ZYV35.js} +1 -1
  17. package/dist/cdn/{VZBGQAPM.js → 5LUEFKD3.js} +1 -1
  18. package/dist/cdn/{24AJZ7NF.js → 5RDU2ZNH.js} +1 -1
  19. package/dist/cdn/{Z5H3SBF4.js → 5TJGOI64.js} +1 -1
  20. package/dist/cdn/{CZLSVHDA.js → 67QHQNZF.js} +1 -1
  21. package/dist/cdn/{O64Y2APR.js → 6C76CPWO.js} +1 -1
  22. package/dist/cdn/{222PZZVE.js → 6LA4PLL2.js} +1 -1
  23. package/dist/cdn/{NKB7CA3Y.js → 6OKASMD7.js} +1 -1
  24. package/dist/cdn/{OI35UHBC.js → 7ECYZZBW.js} +1 -1
  25. package/dist/cdn/{SJMZTW3M.js → 7JGWCRII.js} +1 -1
  26. package/dist/cdn/{XWSZOGW5.js → 7XBTO6NQ.js} +1 -1
  27. package/dist/cdn/{EXQURJYX.js → A6XPQQWN.js} +1 -1
  28. package/dist/cdn/{PXNLTA7Q.js → ANQRSTGE.js} +1 -1
  29. package/dist/cdn/{7PY56QMA.js → AS2M2ZWD.js} +1 -1
  30. package/dist/cdn/{6LSU4JVT.js → BAMCFG7H.js} +1 -1
  31. package/dist/cdn/{YCAYW3ES.js → BDQCESE7.js} +1 -1
  32. package/dist/cdn/{47YWJRMK.js → BG7CCT2Q.js} +1 -1
  33. package/dist/cdn/{WGLBPXGA.js → BMRN6G4T.js} +1 -1
  34. package/dist/cdn/{OI5C3DZQ.js → BPIG37CO.js} +1 -1
  35. package/dist/cdn/{2MVB66KM.js → BZGE52YU.js} +1 -1
  36. package/dist/cdn/{EBTV6BQC.js → C25ETLQX.js} +1 -1
  37. package/dist/cdn/{FA4JJMDD.js → CKMZY3H7.js} +1 -1
  38. package/dist/cdn/{T2ZN7HPU.js → CMVTCAFL.js} +1 -1
  39. package/dist/cdn/{FHTREWRA.js → CNR7IJIS.js} +1 -1
  40. package/dist/cdn/{6UI3PKF5.js → CSOE3CJR.js} +1 -1
  41. package/dist/cdn/{I7TFCBQO.js → DRQCOAQ4.js} +1 -1
  42. package/dist/cdn/{BLZ5Z3L3.js → DTUD5FAT.js} +1 -1
  43. package/dist/cdn/{7J54SLPG.js → DYBHFMG7.js} +1 -1
  44. package/dist/cdn/{N4R7WBTP.js → E6EGKXUX.js} +1 -1
  45. package/dist/cdn/{M7DW3FTJ.js → EB4M47KA.js} +1 -1
  46. package/dist/cdn/{DOWM2T5Z.js → EIXE62NK.js} +1 -1
  47. package/dist/cdn/{HFAM5MEC.js → EQZPTVS3.js} +1 -1
  48. package/dist/cdn/{ZQO6FYUW.js → ESATITDD.js} +1 -1
  49. package/dist/cdn/{OZVZ5LCR.js → ETIO6SPJ.js} +1 -1
  50. package/dist/cdn/EY7FPNVS.js +2 -0
  51. package/dist/cdn/{XHL646A2.js → FIEDEHAP.js} +1 -1
  52. package/dist/cdn/{P76VFMZV.js → FZ6ZUHKQ.js} +1 -1
  53. package/dist/cdn/{LESJQSHY.js → GGGN54CY.js} +1 -1
  54. package/dist/cdn/{DML4UYSR.js → GH34TDLL.js} +1 -1
  55. package/dist/cdn/{2KWDJDMW.js → HG2EYXWI.js} +1 -1
  56. package/dist/cdn/{7SJGHMRM.js → HQDFIE2B.js} +1 -1
  57. package/dist/cdn/{R7ZYHFUG.js → HZGU4N3I.js} +1 -1
  58. package/dist/cdn/{4KMSHV4T.js → I5G3H4D4.js} +1 -1
  59. package/dist/cdn/{C6PZ6UXS.js → I7BWPAOF.js} +1 -1
  60. package/dist/cdn/{XMUU3UTU.js → IBQYZCFQ.js} +1 -1
  61. package/dist/cdn/{FP7RUVVK.js → IJ7V345Q.js} +1 -1
  62. package/dist/cdn/{FE36XWQT.js → IQ4VNR4Q.js} +1 -1
  63. package/dist/cdn/{LWQNBQLX.js → IWG7JAQJ.js} +1 -1
  64. package/dist/cdn/{MMKBWG37.js → IZLDBAPA.js} +1 -1
  65. package/dist/cdn/{T72X6C55.js → J2OGE3DI.js} +1 -1
  66. package/dist/cdn/{V6KMTSY3.js → JPWQ44GC.js} +1 -1
  67. package/dist/cdn/{I3AH3MF6.js → JRF656V5.js} +1 -1
  68. package/dist/cdn/{VSGEBKJL.js → JRWW665Q.js} +1 -1
  69. package/dist/cdn/{WVFJMOTI.js → JVAE3MLA.js} +1 -1
  70. package/dist/cdn/{CFOEAERZ.js → K2H2TINH.js} +1 -1
  71. package/dist/cdn/{BH25NEU3.js → KDZRPYFR.js} +1 -1
  72. package/dist/cdn/{YWGODKAA.js → KHIMNKVO.js} +1 -1
  73. package/dist/cdn/{7Q6OKLFD.js → KMOFSKZF.js} +1 -1
  74. package/dist/cdn/{YJRANKFJ.js → KQNOWW4C.js} +1 -1
  75. package/dist/cdn/{KB33IA7A.js → KYKC2CK2.js} +1 -1
  76. package/dist/cdn/{H6GZBNAP.js → L24DVRWE.js} +1 -1
  77. package/dist/cdn/{6LVCAJSU.js → L5LBH4FP.js} +1 -1
  78. package/dist/cdn/{KONOZFYK.js → LKRLVAVK.js} +1 -1
  79. package/dist/cdn/{SZBL6UYR.js → LQD663MA.js} +1 -1
  80. package/dist/cdn/{BYFOQ5L7.js → M6MHKAA5.js} +1 -1
  81. package/dist/cdn/MMEADS6E.js +2 -0
  82. package/dist/cdn/{ZNRHT3KC.js → MVA4NE6I.js} +1 -1
  83. package/dist/cdn/{2G4JQYU3.js → NGXAYCAR.js} +1 -1
  84. package/dist/cdn/{7BCKEAN4.js → NJRKH5Q7.js} +1 -1
  85. package/dist/cdn/{4OYHP3ZM.js → NVHH3XZJ.js} +1 -1
  86. package/dist/cdn/{RLE4LAGP.js → NVSO6GLT.js} +1 -1
  87. package/dist/cdn/{FEK3PIOE.js → NY7A5LKZ.js} +1 -1
  88. package/dist/cdn/{H5CLLKA7.js → O7BFREIB.js} +1 -1
  89. package/dist/cdn/{MIZ37SIW.js → OLYLT2L5.js} +1 -1
  90. package/dist/cdn/{NRP3ANIH.js → OPHJLVOH.js} +1 -1
  91. package/dist/cdn/{ZTRVZ3XB.js → OQ2UCUQP.js} +1 -1
  92. package/dist/cdn/{2MN63CPE.js → OXCJDMGQ.js} +1 -1
  93. package/dist/cdn/{QKC2XFP5.js → P4JFMLKY.js} +1 -1
  94. package/dist/cdn/{W26FRFX7.js → PCTQTX5N.js} +1 -1
  95. package/dist/cdn/{CW3BSFXN.js → PFKFYB45.js} +1 -1
  96. package/dist/cdn/{3KDUSL55.js → PHGT3YNE.js} +1 -1
  97. package/dist/cdn/{BWVI7Y36.js → PIU3YYLU.js} +1 -1
  98. package/dist/cdn/{YOWRCPCO.js → QCDS2TXE.js} +1 -1
  99. package/dist/cdn/{YCIXRDI4.js → QR4JRFEP.js} +1 -1
  100. package/dist/cdn/{YRXMN6UU.js → QULVDSNJ.js} +1 -1
  101. package/dist/cdn/{V6PUXCHJ.js → QWALXRY6.js} +1 -1
  102. package/dist/cdn/{YDUAJXOW.js → RCUNETDY.js} +1 -1
  103. package/dist/cdn/{B6PZTEUN.js → RPT5BJMD.js} +1 -1
  104. package/dist/cdn/{4C3MDIBF.js → S7XHDLIF.js} +1 -1
  105. package/dist/cdn/{7MOAOZLZ.js → SAQAAU52.js} +1 -1
  106. package/dist/cdn/{2IVE7ZEH.js → SG24GAXY.js} +1 -1
  107. package/dist/cdn/{UW5IDOUT.js → SHD6TE4R.js} +1 -1
  108. package/dist/cdn/{6WOFQ5YL.js → SIMNCT4V.js} +1 -1
  109. package/dist/cdn/{OOITRFLJ.js → SJSCENKK.js} +1 -1
  110. package/dist/cdn/{UWFSTP6H.js → SLVFP6JA.js} +1 -1
  111. package/dist/cdn/{A5U47A46.js → TKH5LW5O.js} +1 -1
  112. package/dist/cdn/{2HAZSBOB.js → TMOOTRK4.js} +1 -1
  113. package/dist/cdn/{ZWUAND2V.js → TTFCVVON.js} +1 -1
  114. package/dist/cdn/{VAIV6TN5.js → TXRFE5GH.js} +1 -1
  115. package/dist/cdn/{6UFBJC4N.js → TXYWJHYI.js} +1 -1
  116. package/dist/cdn/{DY2ED436.js → U4MTAQRM.js} +1 -1
  117. package/dist/cdn/UHQ454NG.js +2 -0
  118. package/dist/cdn/{QLMMEMXZ.js → UKC7JB7P.js} +1 -1
  119. package/dist/cdn/{UW2OIFN6.js → UTQKB5CS.js} +1 -1
  120. package/dist/cdn/{SDD3P4XX.js → V2EVNXUV.js} +1 -1
  121. package/dist/cdn/{EDTUYGTH.js → VOTW2RMD.js} +1 -1
  122. package/dist/cdn/{X7WG3NQR.js → VQHTMUYJ.js} +1 -1
  123. package/dist/cdn/{VS2M3PA6.js → WBJUAZ65.js} +1 -1
  124. package/dist/cdn/{N6UQ2IN3.js → WEAILY72.js} +1 -1
  125. package/dist/cdn/{M5HMGRI3.js → WITGQRKF.js} +1 -1
  126. package/dist/cdn/{GBD3L2UH.js → WM4NZNNA.js} +1 -1
  127. package/dist/cdn/{QZKM3D6F.js → XJZLGVT6.js} +1 -1
  128. package/dist/cdn/{PWPVALIF.js → XUSE3II4.js} +1 -1
  129. package/dist/cdn/{FZIKVG4Q.js → XW3UC4FN.js} +1 -1
  130. package/dist/cdn/{WDKSZZPO.js → YANXY6FO.js} +1 -1
  131. package/dist/cdn/{PUV74SQM.js → YJHXVSEP.js} +1 -1
  132. package/dist/cdn/{ITDGV5OO.js → YM6QAFEQ.js} +1 -1
  133. package/dist/cdn/{QO4WS7CE.js → YMHR4PKM.js} +1 -1
  134. package/dist/cdn/{3KC2E42Z.js → YMSZKTCN.js} +1 -1
  135. package/dist/cdn/{QHJ5GHM6.js → YYDYHAP7.js} +1 -1
  136. package/dist/cdn/{UPCUFECO.js → ZEASFJJQ.js} +1 -1
  137. package/dist/cdn/{OLJ3NCJ2.js → ZGCRVGEK.js} +1 -1
  138. package/dist/cdn/{ITZTBZ6D.js → ZGJRTQBX.js} +1 -1
  139. package/dist/cdn/{23OTAQAT.js → ZPZI63EH.js} +1 -1
  140. package/dist/cdn/{TWMPNHXY.js → ZTV4V5SF.js} +1 -1
  141. package/dist/cdn/index.js +1 -1
  142. package/dist/chunks/dom.js +5 -5
  143. package/dist/chunks/floating-ui.js +1 -4
  144. package/dist/chunks/runtime.js +4 -4
  145. package/dist/chunks/useReferenceElement.js +505 -0
  146. package/dist/components/calcite-block/customElement.js +1 -1
  147. package/dist/components/calcite-popover/customElement.js +11 -176
  148. package/dist/components/calcite-sheet/customElement.js +1 -1
  149. package/dist/components/calcite-tab-nav/customElement.js +1 -1
  150. package/dist/components/calcite-tabs/customElement.js +1 -1
  151. package/dist/components/calcite-tooltip/customElement.js +11 -310
  152. package/dist/components/calcite-tree-item/customElement.js +1 -1
  153. package/dist/docs/api.json +1 -1
  154. package/dist/docs/docs.json +1 -1
  155. package/dist/docs/web-types.json +1 -1
  156. package/package.json +2 -2
  157. package/dist/cdn/5XX7HCEA.js +0 -2
  158. package/dist/cdn/7JKP2OCF.js +0 -2
  159. package/dist/cdn/CMJEMF3I.js +0 -2
  160. package/dist/cdn/XIHNK7BL.js +0 -2
  161. package/dist/chunks/FloatingArrow.js +0 -24
@@ -2,115 +2,18 @@
2
2
  import { c as customElement } from "../../chunks/runtime.js";
3
3
  import { keyed } from "lit/directives/keyed.js";
4
4
  import { css, html } from "lit";
5
- import { LitElement, createEvent, safeClassMap, setAttribute } from "@arcgis/lumina";
5
+ import { LitElement, createEvent, safeClassMap } from "@arcgis/lumina";
6
6
  import { createRef, ref } from "lit/directives/ref.js";
7
7
  import { useDirection } from "@arcgis/lumina/controllers";
8
- import { e as defaultOffsetDistance, r as reposition, a as disconnectFloatingUI, f as filterValidFlipPlacements, c as connectFloatingUI, h as hideFloatingUI, F as FloatingCSS } from "../../chunks/floating-ui.js";
9
- import { j as isPrimaryPointerButton, x as isKeyboardTriggeredClick, q as queryElementRoots } from "../../chunks/dom.js";
10
- import { t as toAriaBoolean } from "../../chunks/aria.js";
11
- import { g as guid } from "../../chunks/guid.js";
8
+ import { e as defaultOffsetDistance, r as reposition, c as connectFloatingUI, a as disconnectFloatingUI, f as filterValidFlipPlacements, h as hideFloatingUI, F as FloatingCSS } from "../../chunks/floating-ui.js";
12
9
  import { t as toggleOpenClose } from "../../chunks/openCloseComponent.js";
13
10
  import { H as Heading } from "../../chunks/Heading.js";
14
11
  import { c as createObserver } from "../../chunks/observers.js";
15
- import { F as FloatingArrow } from "../../chunks/FloatingArrow.js";
12
+ import { u as useReferenceElement, F as FloatingArrow, r as referenceElementManager } from "../../chunks/useReferenceElement.js";
16
13
  import { u as useT9n } from "../../chunks/useT9n.js";
17
14
  import { u as useFocusTrap } from "../../chunks/useFocusTrap.js";
18
15
  import { u as useSetFocus } from "../../chunks/useSetFocus.js";
19
16
  import { u as useTopLayer } from "../../chunks/useTopLayer.js";
20
- import { i as isActivationKey } from "../../chunks/key.js";
21
- const clickTolerance = 5;
22
- function isDrag({
23
- startX,
24
- startY,
25
- endX,
26
- endY
27
- }) {
28
- const distance = Math.hypot(endX - startX, endY - startY);
29
- return distance > clickTolerance;
30
- }
31
- class PopoverManager {
32
- constructor() {
33
- this.registeredElements = /* @__PURE__ */ new Map();
34
- this.registeredElementCount = 0;
35
- this.queryPopover = (composedPath) => {
36
- const { registeredElements } = this;
37
- const registeredElement = composedPath.find((pathEl) => registeredElements.has(pathEl));
38
- return registeredElements.get(registeredElement);
39
- };
40
- this.togglePopovers = (event) => {
41
- const composedPath = event.composedPath();
42
- const togglePopover = this.queryPopover(composedPath);
43
- if (togglePopover && !togglePopover.triggerDisabled) {
44
- togglePopover.open = !togglePopover.open;
45
- }
46
- Array.from(this.registeredElements.values()).filter(
47
- (popover) => popover !== togglePopover && popover.autoClose && popover.open && !composedPath.includes(popover)
48
- ).forEach((popover) => popover.open = false);
49
- };
50
- this.keyDownHandler = (event) => {
51
- if (event.defaultPrevented) {
52
- return;
53
- }
54
- if (event.key === "Escape") {
55
- this.closeAllPopovers();
56
- } else if (isActivationKey(event.key)) {
57
- this.togglePopovers(event);
58
- }
59
- };
60
- this.pointerDownHandler = (event) => {
61
- if (event.defaultPrevented || !isPrimaryPointerButton(event)) {
62
- return;
63
- }
64
- const { clientX, clientY } = event;
65
- this.pointerDownPosition = { x: clientX, y: clientY };
66
- };
67
- this.clickHandler = (event) => {
68
- if (isKeyboardTriggeredClick(event) || event.defaultPrevented || this.pointerDownPosition && isDrag({
69
- endY: event.clientY,
70
- endX: event.clientX,
71
- startY: this.pointerDownPosition.y,
72
- startX: this.pointerDownPosition.x
73
- })) {
74
- return;
75
- }
76
- this.pointerDownPosition = void 0;
77
- this.togglePopovers(event);
78
- };
79
- }
80
- // --------------------------------------------------------------------------
81
- //
82
- // Public Methods
83
- //
84
- // --------------------------------------------------------------------------
85
- registerElement(referenceEl, popover) {
86
- this.registeredElementCount++;
87
- this.registeredElements.set(referenceEl, popover);
88
- if (this.registeredElementCount === 1) {
89
- this.addListeners();
90
- }
91
- }
92
- unregisterElement(referenceEl) {
93
- if (this.registeredElements.delete(referenceEl)) {
94
- this.registeredElementCount--;
95
- }
96
- if (this.registeredElementCount === 0) {
97
- this.removeListeners();
98
- }
99
- }
100
- closeAllPopovers() {
101
- Array.from(this.registeredElements.values()).forEach((popover) => popover.open = false);
102
- }
103
- addListeners() {
104
- window.addEventListener("pointerdown", this.pointerDownHandler);
105
- window.addEventListener("click", this.clickHandler);
106
- window.addEventListener("keydown", this.keyDownHandler);
107
- }
108
- removeListeners() {
109
- window.removeEventListener("pointerdown", this.pointerDownHandler);
110
- window.removeEventListener("click", this.clickHandler);
111
- window.removeEventListener("keydown", this.keyDownHandler);
112
- }
113
- }
114
17
  const CSS = {
115
18
  positionContainer: "position-container",
116
19
  container: "container",
@@ -123,13 +26,13 @@ const CSS = {
123
26
  heading: "heading"
124
27
  };
125
28
  const defaultPopoverPlacement = "auto";
126
- const ARIA_CONTROLS = "aria-controls";
127
- const ARIA_EXPANDED = "aria-expanded";
128
29
  const styles = css`:host{display:contents}:host([top-layer-disabled]){--calcite-floating-ui-z-index: var(--calcite-z-index-popup)}.position-container{inline-size:max-content;display:none;max-inline-size:100vw;max-block-size:100vh;inset-block-start:0;left:0;z-index:var(--calcite-floating-ui-z-index)}@starting-style{.position-container{opacity:0;inset-block-start:0;left:0}}.position-container{max-inline-size:var(--calcite-popover-max-size-x, 100vw)}.position-container[popover]{padding:0;margin:0;border:none;background-color:transparent;overflow:visible;display:none}.position-container:popover-open{display:block}.position-container .calcite-floating-ui-anim{position:relative;transition-duration:var(--calcite-floating-ui-transition);transition-property:inset-block-start,left,opacity,display;transition-behavior:allow-discrete;opacity:0;box-shadow:0 0 16px #00000029;z-index:var(--calcite-z-index);border-radius:.25rem}.position-container[data-placement^=bottom] .calcite-floating-ui-anim{inset-block-start:-5px}.position-container[data-placement^=top] .calcite-floating-ui-anim{inset-block-start:5px}.position-container[data-placement^=left] .calcite-floating-ui-anim{left:5px}.position-container[data-placement^=right] .calcite-floating-ui-anim{left:-5px}.position-container[data-placement] .calcite-floating-ui-anim--active{opacity:1;inset-block-start:0;left:0}@starting-style{.position-container[data-placement] .calcite-floating-ui-anim--active{opacity:0}}.calcite-floating-ui-arrow{pointer-events:none;position:absolute;z-index:calc(var(--calcite-z-index) * -1);fill:var(--calcite-color-foreground-1)}.calcite-floating-ui-arrow__stroke{stroke:var(--calcite-color-border-3)}:host([scale=s]) .heading{padding:.5rem .75rem;font-size:var(--calcite-font-size-relative-base);line-height:var(--calcite-font-line-height-relative-snug)}:host(:is([scale=s],[scale=m])){--calcite-internal-popover-close-spacing: var(--calcite-spacing-xs)}:host([scale=m]) .heading{padding:.75rem 1rem;font-size:var(--calcite-font-size-relative-md);line-height:var(--calcite-font-line-height-relative-snug)}:host([scale=l]){--calcite-internal-popover-close-spacing: var(--calcite-spacing-sm)}:host([scale=l]) .heading{padding:1rem 1.25rem;font-size:var(--calcite-font-size-relative-lg);line-height:var(--calcite-font-line-height-relative-snug)}.position-container .calcite-floating-ui-anim{border-width:1px;border-style:solid;background-color:var(--calcite-popover-background-color, var(--calcite-color-foreground-1));border-color:var(--calcite-popover-border-color, var(--calcite-color-border-3));border-radius:var(--calcite-popover-corner-radius, var(--calcite-corner-radius-round))}.calcite-floating-ui-arrow{fill:var(--calcite-popover-background-color, var(--calcite-color-foreground-1))}.calcite-floating-ui-arrow__stroke{stroke:var(--calcite-popover-border-color, var(--calcite-color-border-3))}.header{display:flex;flex:1 1 auto;align-items:stretch;justify-content:flex-start;border-width:0px;border-bottom-width:1px;border-style:solid;border-block-end-color:var(--calcite-popover-border-color, var(--calcite-color-border-3))}.heading{margin:0;display:block;flex:1 1 auto;align-self:center;white-space:normal;font-weight:var(--calcite-font-weight-medium);word-wrap:break-word;word-break:break-word;color:var(--calcite-popover-text-color, var(--calcite-color-text-1))}.header-container{position:relative;display:flex;height:100%;flex-direction:row;flex-wrap:nowrap;border-radius:.25rem;color:var(--calcite-popover-text-color, var(--calcite-color-text-1))}.header-container.has-header{flex-direction:column}.content{display:flex;height:100%;width:100%;flex-direction:column;flex-wrap:nowrap;align-self:center;word-wrap:break-word;word-break:break-word}.close-button{margin:auto;margin-inline-end:var(--calcite-internal-popover-close-spacing)}.close-button-container{display:flex;flex:0 0 auto}::slotted(calcite-panel),::slotted(calcite-flow){height:100%}:host([hidden]){display:none}[hidden]{display:none}`;
129
- const manager = new PopoverManager();
30
+ const manager = referenceElementManager({ click: true });
130
31
  class Popover extends LitElement {
131
32
  constructor() {
132
33
  super(...arguments);
34
+ this.referenceElementType = "click";
35
+ this.referenceElementController = useReferenceElement({ manager })(this);
133
36
  this.direction = useDirection();
134
37
  this.focusTrap = useFocusTrap({
135
38
  triggerProp: "open",
@@ -144,8 +47,6 @@ class Popover extends LitElement {
144
47
  }
145
48
  }
146
49
  })(this);
147
- this.guid = `calcite-popover-${guid()}`;
148
- this.hasLoaded = false;
149
50
  this.mutationObserver = createObserver("mutation", () => this.focusTrap.updateContainerElements());
150
51
  this.transitionProp = "opacity";
151
52
  this.transitionRef = createRef();
@@ -207,7 +108,6 @@ class Popover extends LitElement {
207
108
  super.connectedCallback();
208
109
  this.mutationObserver?.observe(this.el, { childList: true, subtree: true });
209
110
  this.setFilteredPlacements();
210
- requestAnimationFrame(() => this.setUpReferenceElement(this.hasLoaded));
211
111
  }
212
112
  willUpdate(changes) {
213
113
  if (changes.has("flipPlacements")) {
@@ -219,23 +119,18 @@ class Popover extends LitElement {
219
119
  if (changes.has("offsetDistance") && (this.hasUpdated || this.offsetDistance !== defaultOffsetDistance) || changes.has("offsetSkidding") && (this.hasUpdated || this.offsetSkidding !== 0) || changes.has("overlayPositioning") && (this.hasUpdated || this.overlayPositioning !== "absolute") || changes.has("placement") && (this.hasUpdated || this.placement !== defaultPopoverPlacement)) {
220
120
  this.reposition(true);
221
121
  }
222
- if (changes.has("referenceElement")) {
223
- this.referenceElementHandler();
224
- if (!this.referenceElement && this.open) {
225
- this.topLayer.hide();
226
- }
122
+ if (changes.has("referenceElement") && !this.referenceElement && this.open) {
123
+ this.topLayer.hide();
227
124
  }
228
125
  }
229
- loaded() {
230
- if (this.referenceElement && !this.referenceEl) {
231
- this.setUpReferenceElement();
126
+ updated(changes) {
127
+ if (changes.has("referenceEl")) {
128
+ connectFloatingUI(this);
232
129
  }
233
- this.hasLoaded = true;
234
130
  }
235
131
  disconnectedCallback() {
236
132
  super.disconnectedCallback();
237
133
  this.mutationObserver?.disconnect();
238
- this.removeReferences();
239
134
  disconnectFloatingUI(this);
240
135
  }
241
136
  flipPlacementsHandler() {
@@ -245,73 +140,14 @@ class Popover extends LitElement {
245
140
  openHandler() {
246
141
  toggleOpenClose(this);
247
142
  this.reposition(true);
248
- this.setExpandedAttr();
249
- }
250
- referenceElementHandler() {
251
- this.setUpReferenceElement();
252
- this.reposition(true);
253
143
  }
254
144
  setFloatingEl(el) {
255
145
  this.floatingEl = el;
256
- if (el) {
257
- requestAnimationFrame(() => this.setUpReferenceElement());
258
- }
259
146
  }
260
147
  setFilteredPlacements() {
261
148
  const { el, flipPlacements } = this;
262
149
  this.filteredFlipPlacements = flipPlacements ? filterValidFlipPlacements(flipPlacements, el) : null;
263
150
  }
264
- setUpReferenceElement(warn = true) {
265
- this.removeReferences();
266
- this.referenceEl = this.getReferenceElement();
267
- connectFloatingUI(this);
268
- const { el, referenceElement, referenceEl } = this;
269
- if (warn && referenceElement && !referenceEl) {
270
- console.warn(`${el.tagName}: reference-element id "${referenceElement}" was not found.`, {
271
- el
272
- });
273
- }
274
- this.addReferences();
275
- }
276
- getId() {
277
- return this.el.id || this.guid;
278
- }
279
- setExpandedAttr() {
280
- const { referenceEl, open } = this;
281
- if (!referenceEl) {
282
- return;
283
- }
284
- if ("setAttribute" in referenceEl) {
285
- referenceEl.setAttribute(ARIA_EXPANDED, toAriaBoolean(open));
286
- }
287
- }
288
- addReferences() {
289
- const { referenceEl } = this;
290
- if (!referenceEl) {
291
- return;
292
- }
293
- const id = this.getId();
294
- if ("setAttribute" in referenceEl) {
295
- referenceEl.setAttribute(ARIA_CONTROLS, id);
296
- }
297
- manager.registerElement(referenceEl, this.el);
298
- this.setExpandedAttr();
299
- }
300
- removeReferences() {
301
- const { referenceEl } = this;
302
- if (!referenceEl) {
303
- return;
304
- }
305
- if ("removeAttribute" in referenceEl) {
306
- referenceEl.removeAttribute(ARIA_CONTROLS);
307
- referenceEl.removeAttribute(ARIA_EXPANDED);
308
- }
309
- manager.unregisterElement(referenceEl);
310
- }
311
- getReferenceElement() {
312
- const { referenceElement, el } = this;
313
- return (typeof referenceElement === "string" ? queryElementRoots(el, { id: referenceElement }) : referenceElement) || null;
314
- }
315
151
  hide() {
316
152
  this.open = false;
317
153
  }
@@ -353,7 +189,6 @@ class Popover extends LitElement {
353
189
  this.el.inert = hidden;
354
190
  this.el.ariaLabel = label;
355
191
  this.el.ariaLive = "polite";
356
- setAttribute(this.el, "id", this.getId());
357
192
  this.el.role = "dialog";
358
193
  return html`<div class=${safeClassMap(CSS.positionContainer)} popover=manual ${ref(this.setFloatingEl)}><div class=${safeClassMap({
359
194
  [CSS.container]: true,
@@ -6,7 +6,7 @@ import { css, html } from "lit";
6
6
  import { LitElement, createEvent, setAttribute, safeClassMap } from "@arcgis/lumina";
7
7
  import { createRef, ref } from "lit/directives/ref.js";
8
8
  import { useDirection } from "@arcgis/lumina/controllers";
9
- import { y as ensureId, g as getStylePixelValue } from "../../chunks/dom.js";
9
+ import { z as ensureId, g as getStylePixelValue } from "../../chunks/dom.js";
10
10
  import { c as createObserver } from "../../chunks/observers.js";
11
11
  import { t as toggleOpenClose } from "../../chunks/openCloseComponent.js";
12
12
  import { g as getDimensionClass } from "../../chunks/dynamicClasses.js";
@@ -6,7 +6,7 @@ import { a as calciteSize24, b as calciteSize32, d as calciteSize44 } from "../.
6
6
  import { css, html } from "lit";
7
7
  import { LitElement, createEvent, safeClassMap } from "@arcgis/lumina";
8
8
  import { useDirection } from "@arcgis/lumina/controllers";
9
- import { z as filterDirectChildren, f as focusElementInGroup, i as focusElement } from "../../chunks/dom.js";
9
+ import { A as filterDirectChildren, f as focusElementInGroup, i as focusElement } from "../../chunks/dom.js";
10
10
  import { c as createObserver } from "../../chunks/observers.js";
11
11
  import { u as useT9n } from "../../chunks/useT9n.js";
12
12
  const ICON = {
@@ -3,7 +3,7 @@ import { c as customElement } from "../../chunks/runtime.js";
3
3
  import { css, html } from "lit";
4
4
  import { LitElement, safeClassMap } from "@arcgis/lumina";
5
5
  import { createRef, ref } from "lit/directives/ref.js";
6
- import { a as slotChangeGetAssignedElements, A as getSlotAssignedElements } from "../../chunks/dom.js";
6
+ import { a as slotChangeGetAssignedElements, B as getSlotAssignedElements } from "../../chunks/dom.js";
7
7
  const CSS = {
8
8
  section: "section"
9
9
  };
@@ -1,277 +1,26 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
2
  import { c as customElement } from "../../chunks/runtime.js";
3
3
  import { css, html } from "lit";
4
- import { LitElement, createEvent, setAttribute, safeClassMap } from "@arcgis/lumina";
4
+ import { LitElement, createEvent, safeClassMap } from "@arcgis/lumina";
5
5
  import { createRef, ref } from "lit/directives/ref.js";
6
6
  import { useDirection } from "@arcgis/lumina/controllers";
7
- import { e as defaultOffsetDistance, r as reposition, a as disconnectFloatingUI, h as hideFloatingUI, c as connectFloatingUI, F as FloatingCSS } from "../../chunks/floating-ui.js";
8
- import { g as guid } from "../../chunks/guid.js";
7
+ import { e as defaultOffsetDistance, r as reposition, c as connectFloatingUI, a as disconnectFloatingUI, h as hideFloatingUI, F as FloatingCSS } from "../../chunks/floating-ui.js";
9
8
  import { t as toggleOpenClose } from "../../chunks/openCloseComponent.js";
10
- import { F as FloatingArrow } from "../../chunks/FloatingArrow.js";
9
+ import { u as useReferenceElement, F as FloatingArrow, r as referenceElementManager } from "../../chunks/useReferenceElement.js";
11
10
  import { u as useTopLayer } from "../../chunks/useTopLayer.js";
12
- import { q as queryElementRoots, B as getShadowRootNode } from "../../chunks/dom.js";
13
11
  const CSS = {
14
12
  positionContainer: "position-container",
15
13
  container: "container"
16
14
  };
17
- const idPrefix = "calcite-tooltip";
18
- const IDS = {
19
- host: (id) => `${idPrefix}-${id}`
20
- };
21
- const TOOLTIP_OPEN_DELAY_MS = 300;
22
- const TOOLTIP_QUICK_OPEN_DELAY_MS = TOOLTIP_OPEN_DELAY_MS / 3;
23
- const TOOLTIP_CLOSE_DELAY_MS = TOOLTIP_OPEN_DELAY_MS * 1.5;
24
- const ARIA_DESCRIBED_BY = "aria-describedby";
25
- function getEffectiveReferenceElement(tooltip) {
26
- const { referenceElement } = tooltip;
27
- return (typeof referenceElement === "string" ? queryElementRoots(tooltip, { id: referenceElement }) : referenceElement) || null;
28
- }
29
- class TooltipManager {
30
- constructor() {
31
- this.registeredElements = /* @__PURE__ */ new WeakMap();
32
- this.registeredShadowRootCounts = /* @__PURE__ */ new WeakMap();
33
- this.hoverOpenTimeout = null;
34
- this.hoverCloseTimeout = null;
35
- this.activeTooltip = null;
36
- this.registeredElementCount = 0;
37
- this.clickedTooltip = null;
38
- this.hoveredTooltip = null;
39
- this.queryTooltip = (composedPath) => {
40
- const { registeredElements } = this;
41
- const registeredElement = composedPath.find((pathEl) => registeredElements.has(pathEl));
42
- return registeredElements.get(registeredElement);
43
- };
44
- this.keyDownHandler = (event) => {
45
- if (event.key === "Escape" && !event.defaultPrevented) {
46
- const { activeTooltip } = this;
47
- if (activeTooltip?.open) {
48
- this.clearHoverTimeout();
49
- this.closeActiveTooltip();
50
- const referenceElement = getEffectiveReferenceElement(activeTooltip);
51
- const composedPath = event.composedPath();
52
- if (referenceElement instanceof Element && composedPath.includes(referenceElement) || composedPath.includes(activeTooltip)) {
53
- event.preventDefault();
54
- }
55
- }
56
- }
57
- };
58
- this.pointerLeaveHandler = (event) => {
59
- if (event.defaultPrevented) {
60
- return;
61
- }
62
- this.clearHoverTimeout();
63
- this.closeHoveredTooltip();
64
- };
65
- this.pointerMoveHandler = (event) => {
66
- if (event.defaultPrevented) {
67
- this.closeHoveredTooltip();
68
- return;
69
- }
70
- const composedPath = event.composedPath();
71
- const tooltip = this.queryTooltip(composedPath);
72
- if (this.pathHasOpenTooltip(tooltip, composedPath)) {
73
- this.clearHoverTimeout();
74
- return;
75
- }
76
- if (tooltip === this.clickedTooltip) {
77
- return;
78
- }
79
- if (tooltip !== this.hoveredTooltip) {
80
- this.clearHoverOpenTimeout();
81
- }
82
- this.hoveredTooltip = tooltip;
83
- if (tooltip) {
84
- this.openHoveredTooltip(tooltip);
85
- } else if (this.activeTooltip?.open) {
86
- this.closeHoveredTooltip();
87
- }
88
- this.clickedTooltip = null;
89
- };
90
- this.clickHandler = (event) => {
91
- if (event.defaultPrevented) {
92
- return;
93
- }
94
- this.clickedTooltip = null;
95
- const composedPath = event.composedPath();
96
- const tooltip = this.queryTooltip(composedPath);
97
- if (this.pathHasOpenTooltip(tooltip, composedPath)) {
98
- this.clearHoverTimeout();
99
- return;
100
- }
101
- this.closeActiveTooltip();
102
- if (!tooltip) {
103
- return;
104
- }
105
- this.clearHoverTimeout();
106
- if (tooltip.closeOnClick) {
107
- this.clickedTooltip = tooltip;
108
- this.toggleTooltip(tooltip, false);
109
- return;
110
- }
111
- this.toggleTooltip(tooltip, true);
112
- };
113
- this.blurHandler = () => {
114
- this.closeActiveTooltip();
115
- };
116
- this.focusInHandler = (event) => {
117
- if (event.defaultPrevented) {
118
- return;
119
- }
120
- const composedPath = event.composedPath();
121
- const tooltip = this.queryTooltip(composedPath);
122
- if (this.pathHasOpenTooltip(tooltip, composedPath)) {
123
- this.clearHoverTimeout();
124
- return;
125
- }
126
- if (tooltip === this.clickedTooltip) {
127
- return;
128
- }
129
- this.clickedTooltip = null;
130
- this.closeTooltipIfNotActive(tooltip);
131
- if (!tooltip) {
132
- return;
133
- }
134
- this.toggleFocusedTooltip(tooltip, true);
135
- };
136
- this.openHoveredTooltip = (tooltip) => {
137
- this.hoverOpenTimeout = window.setTimeout(
138
- () => {
139
- if (this.hoverOpenTimeout === null || tooltip !== this.hoveredTooltip) {
140
- return;
141
- }
142
- this.clearHoverCloseTimeout();
143
- this.closeTooltipIfNotActive(tooltip);
144
- this.toggleTooltip(tooltip, true);
145
- },
146
- this.activeTooltip?.open ? TOOLTIP_QUICK_OPEN_DELAY_MS : TOOLTIP_OPEN_DELAY_MS
147
- );
148
- };
149
- this.closeHoveredTooltip = () => {
150
- this.hoverCloseTimeout = window.setTimeout(() => {
151
- if (this.hoverCloseTimeout === null) {
152
- return;
153
- }
154
- this.closeActiveTooltip();
155
- }, TOOLTIP_CLOSE_DELAY_MS);
156
- };
157
- }
158
- // --------------------------------------------------------------------------
159
- //
160
- // Public Methods
161
- //
162
- // --------------------------------------------------------------------------
163
- registerElement(referenceEl, tooltip) {
164
- this.registeredElementCount++;
165
- this.registeredElements.set(referenceEl, tooltip);
166
- const shadowRoot = this.getReferenceElShadowRootNode(referenceEl);
167
- if (shadowRoot) {
168
- this.registerShadowRoot(shadowRoot);
169
- }
170
- if (this.registeredElementCount === 1) {
171
- this.addListeners();
172
- }
173
- }
174
- unregisterElement(referenceEl) {
175
- const shadowRoot = this.getReferenceElShadowRootNode(referenceEl);
176
- if (shadowRoot) {
177
- this.unregisterShadowRoot(shadowRoot);
178
- }
179
- if (this.registeredElements.delete(referenceEl)) {
180
- this.registeredElementCount--;
181
- }
182
- if (this.registeredElementCount === 0) {
183
- this.removeListeners();
184
- }
185
- }
186
- pathHasOpenTooltip(tooltip, composedPath) {
187
- const { activeTooltip } = this;
188
- return activeTooltip?.open && composedPath.includes(activeTooltip) || tooltip?.open && composedPath.includes(tooltip);
189
- }
190
- addShadowListeners(shadowRoot) {
191
- shadowRoot.addEventListener("focusin", this.focusInHandler);
192
- }
193
- removeShadowListeners(shadowRoot) {
194
- shadowRoot.removeEventListener("focusin", this.focusInHandler);
195
- }
196
- addListeners() {
197
- window.addEventListener("keydown", this.keyDownHandler);
198
- window.addEventListener("pointermove", this.pointerMoveHandler);
199
- window.addEventListener("click", this.clickHandler);
200
- window.addEventListener("focusin", this.focusInHandler);
201
- window.addEventListener("blur", this.blurHandler);
202
- document.addEventListener("pointerleave", this.pointerLeaveHandler);
203
- }
204
- removeListeners() {
205
- window.removeEventListener("keydown", this.keyDownHandler);
206
- window.removeEventListener("pointermove", this.pointerMoveHandler);
207
- window.removeEventListener("click", this.clickHandler);
208
- window.removeEventListener("focusin", this.focusInHandler);
209
- window.removeEventListener("blur", this.blurHandler);
210
- document.removeEventListener("pointerleave", this.pointerLeaveHandler);
211
- }
212
- clearHoverOpenTimeout() {
213
- window.clearTimeout(this.hoverOpenTimeout);
214
- this.hoverOpenTimeout = null;
215
- }
216
- clearHoverCloseTimeout() {
217
- window.clearTimeout(this.hoverCloseTimeout);
218
- this.hoverCloseTimeout = null;
219
- }
220
- clearHoverTimeout() {
221
- this.clearHoverOpenTimeout();
222
- this.clearHoverCloseTimeout();
223
- }
224
- closeTooltipIfNotActive(tooltip) {
225
- if (this.activeTooltip !== tooltip) {
226
- this.closeActiveTooltip();
227
- }
228
- }
229
- closeActiveTooltip() {
230
- const { activeTooltip } = this;
231
- if (activeTooltip?.open) {
232
- this.toggleTooltip(activeTooltip, false);
233
- }
234
- }
235
- toggleFocusedTooltip(tooltip, open) {
236
- if (open) {
237
- this.clearHoverTimeout();
238
- }
239
- this.toggleTooltip(tooltip, open);
240
- }
241
- toggleTooltip(tooltip, open) {
242
- tooltip.open = open;
243
- this.activeTooltip = open ? tooltip : null;
244
- }
245
- registerShadowRoot(shadowRoot) {
246
- const { registeredShadowRootCounts } = this;
247
- const count = registeredShadowRootCounts.get(shadowRoot);
248
- const newCount = Math.min((typeof count === "number" ? count : 0) + 1, 1);
249
- if (newCount === 1) {
250
- this.addShadowListeners(shadowRoot);
251
- }
252
- registeredShadowRootCounts.set(shadowRoot, newCount);
253
- }
254
- unregisterShadowRoot(shadowRoot) {
255
- const { registeredShadowRootCounts } = this;
256
- const count = registeredShadowRootCounts.get(shadowRoot);
257
- const newCount = Math.max((typeof count === "number" ? count : 1) - 1, 0);
258
- if (newCount === 0) {
259
- this.removeShadowListeners(shadowRoot);
260
- }
261
- registeredShadowRootCounts.set(shadowRoot, newCount);
262
- }
263
- getReferenceElShadowRootNode(referenceEl) {
264
- return referenceEl instanceof Element ? getShadowRootNode(referenceEl) : null;
265
- }
266
- }
267
15
  const styles = css`:host{display:contents}:host([top-layer-disabled]){--calcite-floating-ui-z-index: var(--calcite-z-index-tooltip)}.position-container{inline-size:max-content;display:none;max-inline-size:100vw;max-block-size:100vh;inset-block-start:0;left:0;z-index:var(--calcite-floating-ui-z-index)}@starting-style{.position-container{opacity:0;inset-block-start:0;left:0}}.position-container{max-inline-size:var(--calcite-tooltip-max-size-x, 20rem);max-block-size:20rem}.position-container[popover]{padding:0;margin:0;border:none;background-color:transparent;overflow:visible;display:none}.position-container:popover-open{display:block}.position-container .calcite-floating-ui-anim{position:relative;transition-duration:var(--calcite-floating-ui-transition);transition-property:inset-block-start,left,opacity,display;transition-behavior:allow-discrete;opacity:0;box-shadow:0 0 16px #00000029;z-index:var(--calcite-z-index);border-radius:.25rem}.position-container[data-placement^=bottom] .calcite-floating-ui-anim{inset-block-start:-5px}.position-container[data-placement^=top] .calcite-floating-ui-anim{inset-block-start:5px}.position-container[data-placement^=left] .calcite-floating-ui-anim{left:5px}.position-container[data-placement^=right] .calcite-floating-ui-anim{left:-5px}.position-container[data-placement] .calcite-floating-ui-anim--active{opacity:1;inset-block-start:0;left:0}@starting-style{.position-container[data-placement] .calcite-floating-ui-anim--active{opacity:0}}.calcite-floating-ui-arrow{pointer-events:none;position:absolute;z-index:calc(var(--calcite-z-index) * -1);fill:var(--calcite-color-foreground-1)}.calcite-floating-ui-arrow__stroke{stroke:var(--calcite-color-border-3)}.container{position:relative;overflow:hidden;padding:.75rem 1rem;font-size:var(--calcite-font-size-relative-sm);line-height:var(--calcite-font-line-height-relative-snug);font-weight:var(--calcite-font-weight-medium);word-wrap:break-word;word-break:break-word;border-radius:var(--calcite-tooltip-corner-radius, var(--calcite-corner-radius-round));color:var(--calcite-tooltip-text-color, var(--calcite-color-text-1));text-align:start}.position-container .calcite-floating-ui-anim{border-width:1px;border-style:solid;background-color:var(--calcite-tooltip-background-color, var(--calcite-color-foreground-1));border-color:var(--calcite-tooltip-border-color, var(--calcite-color-border-3));border-radius:var(--calcite-tooltip-corner-radius, var(--calcite-corner-radius-round))}.calcite-floating-ui-arrow{fill:var(--calcite-tooltip-background-color, var(--calcite-color-foreground-1))}.calcite-floating-ui-arrow__stroke{stroke:var(--calcite-tooltip-border-color, var(--calcite-color-border-3))}:host([hidden]){display:none}[hidden]{display:none}`;
268
- const manager = new TooltipManager();
16
+ const manager = referenceElementManager({ hover: true });
269
17
  class Tooltip extends LitElement {
270
18
  constructor() {
271
19
  super(...arguments);
272
20
  this.arrowRef = createRef();
273
21
  this.direction = useDirection();
274
- this.guid = IDS.host(guid());
22
+ this.referenceElementType = "hover";
23
+ this.referenceElementController = useReferenceElement({ manager })(this);
275
24
  this.transitionProp = "opacity";
276
25
  this.transitionRef = createRef();
277
26
  this.topLayer = useTopLayer({
@@ -311,10 +60,6 @@ class Tooltip extends LitElement {
311
60
  type: "tooltip"
312
61
  }, delayed);
313
62
  }
314
- connectedCallback() {
315
- super.connectedCallback();
316
- this.setUpReferenceElement(true);
317
- }
318
63
  willUpdate(changes) {
319
64
  if (changes.has("offsetDistance") && (this.hasUpdated || this.offsetDistance !== defaultOffsetDistance) || changes.has("offsetSkidding") && (this.hasUpdated || this.offsetSkidding !== 0) || changes.has("overlayPositioning") && (this.hasUpdated || this.overlayPositioning !== "absolute") || changes.has("placement") && (this.hasUpdated || this.placement !== "auto")) {
320
65
  this.reposition(true);
@@ -322,21 +67,17 @@ class Tooltip extends LitElement {
322
67
  if (changes.has("open") && (this.hasUpdated || this.open !== false)) {
323
68
  this.openHandler();
324
69
  }
325
- if (changes.has("referenceElement")) {
326
- this.setUpReferenceElement();
327
- if (!this.referenceElement && this.open) {
328
- this.topLayer.hide();
329
- }
70
+ if (changes.has("referenceElement") && !this.referenceElement && this.open) {
71
+ this.topLayer.hide();
330
72
  }
331
73
  }
332
- loaded() {
333
- if (this.referenceElement && !this.referenceEl) {
334
- this.setUpReferenceElement();
74
+ updated(changes) {
75
+ if (changes.has("referenceEl")) {
76
+ connectFloatingUI(this);
335
77
  }
336
78
  }
337
79
  disconnectedCallback() {
338
80
  super.disconnectedCallback();
339
- this.removeReferences();
340
81
  disconnectFloatingUI(this);
341
82
  }
342
83
  openHandler() {
@@ -360,45 +101,6 @@ class Tooltip extends LitElement {
360
101
  }
361
102
  setFloatingEl(el) {
362
103
  this.floatingEl = el;
363
- if (el) {
364
- requestAnimationFrame(() => this.setUpReferenceElement());
365
- }
366
- }
367
- setUpReferenceElement(warn = true) {
368
- this.removeReferences();
369
- this.referenceEl = getEffectiveReferenceElement(this.el);
370
- connectFloatingUI(this);
371
- const { el, referenceElement, referenceEl } = this;
372
- if (warn && referenceElement && !referenceEl) {
373
- console.warn(`${el.tagName}: reference-element id "${referenceElement}" was not found.`, {
374
- el
375
- });
376
- }
377
- this.addReferences();
378
- }
379
- getId() {
380
- return this.el.id || this.guid;
381
- }
382
- addReferences() {
383
- const { referenceEl } = this;
384
- if (!referenceEl) {
385
- return;
386
- }
387
- const id = this.getId();
388
- if ("setAttribute" in referenceEl) {
389
- referenceEl.setAttribute(ARIA_DESCRIBED_BY, id);
390
- }
391
- manager.registerElement(referenceEl, this.el);
392
- }
393
- removeReferences() {
394
- const { referenceEl } = this;
395
- if (!referenceEl) {
396
- return;
397
- }
398
- if ("removeAttribute" in referenceEl) {
399
- referenceEl.removeAttribute(ARIA_DESCRIBED_BY);
400
- }
401
- manager.unregisterElement(referenceEl);
402
104
  }
403
105
  render() {
404
106
  const { referenceEl, label, open, floatingLayout } = this;
@@ -407,7 +109,6 @@ class Tooltip extends LitElement {
407
109
  this.el.inert = hidden;
408
110
  this.el.ariaLabel = label;
409
111
  this.el.ariaLive = "polite";
410
- setAttribute(this.el, "id", this.getId());
411
112
  this.el.role = "tooltip";
412
113
  return html`<div class=${safeClassMap(CSS.positionContainer)} popover=manual ${ref(this.setFloatingEl)}><div class=${safeClassMap({
413
114
  [FloatingCSS.animation]: true,