@esri/calcite-components 5.1.0-next.7 → 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 (185) hide show
  1. package/dist/cdn/{3L54WMSL.js → 24BVOJIY.js} +1 -1
  2. package/dist/cdn/{VLKT7UVD.js → 34EJXQYF.js} +1 -1
  3. package/dist/cdn/{BCLXCJEM.js → 3GXLGKZV.js} +1 -1
  4. package/dist/cdn/{BYWKKEUK.js → 3IHT5FIP.js} +1 -1
  5. package/dist/cdn/{GS2OPY5B.js → 3O7NXGXJ.js} +1 -1
  6. package/dist/cdn/{S6HRAHQS.js → 43FMFYKZ.js} +1 -1
  7. package/dist/cdn/{3YNOEWLR.js → 43SP7K3P.js} +1 -1
  8. package/dist/cdn/{UFKZPJGX.js → 45Z5R6GR.js} +1 -1
  9. package/dist/cdn/{2YZJ5SK5.js → 47RTCYTX.js} +1 -1
  10. package/dist/cdn/{7MBOUDMI.js → 4AQ3DQDN.js} +1 -1
  11. package/dist/cdn/{J7B4VKUB.js → 4DJKUEBQ.js} +1 -1
  12. package/dist/cdn/4IBKGKIH.js +2 -0
  13. package/dist/cdn/{I6I5D5MI.js → 4JVVYRDW.js} +1 -1
  14. package/dist/cdn/{7BJTVAGJ.js → 4U633XVG.js} +1 -1
  15. package/dist/cdn/55GOZN42.js +2 -0
  16. package/dist/cdn/{IX7RXOMC.js → 575ZYV35.js} +1 -1
  17. package/dist/cdn/{LTPGJM6S.js → 5LUEFKD3.js} +1 -1
  18. package/dist/cdn/{RPXB3OIR.js → 5RDU2ZNH.js} +1 -1
  19. package/dist/cdn/{NRBJ3VOF.js → 5TJGOI64.js} +1 -1
  20. package/dist/cdn/{GC4LUWE2.js → 67QHQNZF.js} +1 -1
  21. package/dist/cdn/{SYSRTPLT.js → 6C76CPWO.js} +1 -1
  22. package/dist/cdn/{R72JHGCT.js → 6LA4PLL2.js} +1 -1
  23. package/dist/cdn/{AOSKB4O3.js → 6OKASMD7.js} +1 -1
  24. package/dist/cdn/{Q6OXR72I.js → 7ECYZZBW.js} +1 -1
  25. package/dist/cdn/{YVLGTYKI.js → 7JGWCRII.js} +1 -1
  26. package/dist/cdn/{3WREYYM5.js → 7XBTO6NQ.js} +1 -1
  27. package/dist/cdn/A6XPQQWN.js +2 -0
  28. package/dist/cdn/{K3YSAFRD.js → ANQRSTGE.js} +1 -1
  29. package/dist/cdn/{GFUL7D7M.js → AS2M2ZWD.js} +1 -1
  30. package/dist/cdn/{PFVIFFID.js → BAMCFG7H.js} +1 -1
  31. package/dist/cdn/{ZPR4DBFS.js → BDQCESE7.js} +1 -1
  32. package/dist/cdn/{5BL7R465.js → BG7CCT2Q.js} +1 -1
  33. package/dist/cdn/{3ARW44US.js → BMRN6G4T.js} +1 -1
  34. package/dist/cdn/{B6LFHYRQ.js → BPIG37CO.js} +1 -1
  35. package/dist/cdn/{RL55PUKO.js → BZGE52YU.js} +1 -1
  36. package/dist/cdn/{A5BBQLSY.js → C25ETLQX.js} +1 -1
  37. package/dist/cdn/{PZMLAOBO.js → CKMZY3H7.js} +1 -1
  38. package/dist/cdn/{WOUDT7QM.js → CMVTCAFL.js} +1 -1
  39. package/dist/cdn/{ETLJSBPM.js → CNR7IJIS.js} +1 -1
  40. package/dist/cdn/{PYIFXBJK.js → CSOE3CJR.js} +1 -1
  41. package/dist/cdn/{QKCQY33W.js → DRQCOAQ4.js} +1 -1
  42. package/dist/cdn/{GHLGH22R.js → DTUD5FAT.js} +1 -1
  43. package/dist/cdn/{BFOWFEX3.js → DYBHFMG7.js} +1 -1
  44. package/dist/cdn/{W7C3ZKLA.js → E6EGKXUX.js} +1 -1
  45. package/dist/cdn/{M2EEQG72.js → EB4M47KA.js} +1 -1
  46. package/dist/cdn/{Z5RVFQRM.js → EIXE62NK.js} +1 -1
  47. package/dist/cdn/{CFN4BIZL.js → EQZPTVS3.js} +1 -1
  48. package/dist/cdn/{HIOWL6WU.js → ESATITDD.js} +1 -1
  49. package/dist/cdn/ETIO6SPJ.js +2 -0
  50. package/dist/cdn/EY7FPNVS.js +2 -0
  51. package/dist/cdn/{TCCEQ7MN.js → FIEDEHAP.js} +1 -1
  52. package/dist/cdn/{J435BGYU.js → FZ6ZUHKQ.js} +1 -1
  53. package/dist/cdn/{77ZP6SXN.js → GGGN54CY.js} +1 -1
  54. package/dist/cdn/{WGALRMGQ.js → GH34TDLL.js} +1 -1
  55. package/dist/cdn/{7GGO2CZM.js → HG2EYXWI.js} +1 -1
  56. package/dist/cdn/{DRDD2NOI.js → HQDFIE2B.js} +1 -1
  57. package/dist/cdn/{6HLSG3XA.js → HZGU4N3I.js} +1 -1
  58. package/dist/cdn/{XU6Y5UJM.js → I5G3H4D4.js} +1 -1
  59. package/dist/cdn/{3OKBFBPD.js → I7BWPAOF.js} +1 -1
  60. package/dist/cdn/{PP3ZYBZZ.js → IBQYZCFQ.js} +1 -1
  61. package/dist/cdn/{GNJJTXA5.js → IJ7V345Q.js} +1 -1
  62. package/dist/cdn/{MCTFB7GO.js → IQ4VNR4Q.js} +1 -1
  63. package/dist/cdn/{MOO6RSVL.js → IWG7JAQJ.js} +1 -1
  64. package/dist/cdn/{CWAS32KR.js → IZLDBAPA.js} +1 -1
  65. package/dist/cdn/{ODAPCLKU.js → J2OGE3DI.js} +1 -1
  66. package/dist/cdn/{RGTWEZAQ.js → JPWQ44GC.js} +1 -1
  67. package/dist/cdn/{EZCA7WQG.js → JRF656V5.js} +1 -1
  68. package/dist/cdn/{RPTMX4W3.js → JRWW665Q.js} +1 -1
  69. package/dist/cdn/{4FGXGSCS.js → JVAE3MLA.js} +1 -1
  70. package/dist/cdn/{6PUUPFDX.js → K2H2TINH.js} +1 -1
  71. package/dist/cdn/{4YVKX7KL.js → KDZRPYFR.js} +1 -1
  72. package/dist/cdn/{2QXTLDZ6.js → KHIMNKVO.js} +1 -1
  73. package/dist/cdn/{B74N65HB.js → KMOFSKZF.js} +1 -1
  74. package/dist/cdn/{LWILKWNQ.js → KQNOWW4C.js} +1 -1
  75. package/dist/cdn/{KME7ZZCF.js → KYKC2CK2.js} +1 -1
  76. package/dist/cdn/{UHGCQVOL.js → L24DVRWE.js} +1 -1
  77. package/dist/cdn/{JSRHPQ52.js → L5LBH4FP.js} +1 -1
  78. package/dist/cdn/LKRLVAVK.js +2 -0
  79. package/dist/cdn/{7FWJSF56.js → LQD663MA.js} +1 -1
  80. package/dist/cdn/{PBYPABMK.js → M6MHKAA5.js} +1 -1
  81. package/dist/cdn/MMEADS6E.js +2 -0
  82. package/dist/cdn/{OOTSFWEM.js → MVA4NE6I.js} +1 -1
  83. package/dist/cdn/{3JNFU6KC.js → NGXAYCAR.js} +1 -1
  84. package/dist/cdn/{LD7LTIBH.js → NJRKH5Q7.js} +1 -1
  85. package/dist/cdn/{YELDC3QJ.js → NVHH3XZJ.js} +1 -1
  86. package/dist/cdn/{FS6JTDJK.js → NVSO6GLT.js} +1 -1
  87. package/dist/cdn/{IIZ3STBY.js → NY7A5LKZ.js} +1 -1
  88. package/dist/cdn/{MIHUMK4H.js → O7BFREIB.js} +1 -1
  89. package/dist/cdn/{B6HWVI4Y.js → OLYLT2L5.js} +1 -1
  90. package/dist/cdn/{BF5X3NKJ.js → OPHJLVOH.js} +1 -1
  91. package/dist/cdn/{YHMDHOC5.js → OQ2UCUQP.js} +1 -1
  92. package/dist/cdn/{HMXVJFQG.js → OXCJDMGQ.js} +1 -1
  93. package/dist/cdn/{PPZ47NEL.js → P4JFMLKY.js} +1 -1
  94. package/dist/cdn/{IJLVEBB7.js → PCTQTX5N.js} +1 -1
  95. package/dist/cdn/{55SG4TFB.js → PFKFYB45.js} +1 -1
  96. package/dist/cdn/{FZX5RPOG.js → PHGT3YNE.js} +1 -1
  97. package/dist/cdn/{TG2Q5JYE.js → PIU3YYLU.js} +1 -1
  98. package/dist/cdn/{JJVYITPX.js → QCDS2TXE.js} +1 -1
  99. package/dist/cdn/{QDHV7HSF.js → QR4JRFEP.js} +1 -1
  100. package/dist/cdn/QULVDSNJ.js +2 -0
  101. package/dist/cdn/{II65AX2Y.js → QWALXRY6.js} +1 -1
  102. package/dist/cdn/{T7KRQA2S.js → RCUNETDY.js} +1 -1
  103. package/dist/cdn/{PUI672KC.js → RPT5BJMD.js} +1 -1
  104. package/dist/cdn/{72UQHKZB.js → S7XHDLIF.js} +1 -1
  105. package/dist/cdn/{VLRV4R6U.js → SAQAAU52.js} +1 -1
  106. package/dist/cdn/{NEP2GKTJ.js → SG24GAXY.js} +1 -1
  107. package/dist/cdn/{5Q5XOD7Y.js → SHD6TE4R.js} +1 -1
  108. package/dist/cdn/{6EIEBFGZ.js → SIMNCT4V.js} +1 -1
  109. package/dist/cdn/{XGQPFD4F.js → SJSCENKK.js} +1 -1
  110. package/dist/cdn/{YCCYLLDK.js → SLVFP6JA.js} +1 -1
  111. package/dist/cdn/{WPVR4P6L.js → TKH5LW5O.js} +1 -1
  112. package/dist/cdn/{EUTZTNZS.js → TMOOTRK4.js} +1 -1
  113. package/dist/cdn/{4RM7IDEC.js → TTFCVVON.js} +1 -1
  114. package/dist/cdn/{CEKWE7MI.js → TXRFE5GH.js} +1 -1
  115. package/dist/cdn/{6PPA5ENT.js → TXYWJHYI.js} +1 -1
  116. package/dist/cdn/{JSPE4OG7.js → U4MTAQRM.js} +1 -1
  117. package/dist/cdn/UHQ454NG.js +2 -0
  118. package/dist/cdn/{NIOMLRZP.js → UKC7JB7P.js} +1 -1
  119. package/dist/cdn/{CJGFEG4P.js → UTQKB5CS.js} +1 -1
  120. package/dist/cdn/{MXIVUGX2.js → V2EVNXUV.js} +1 -1
  121. package/dist/cdn/{FZUCWEY4.js → VOTW2RMD.js} +1 -1
  122. package/dist/cdn/{KF4IOR4S.js → VQHTMUYJ.js} +1 -1
  123. package/dist/cdn/{LZ5FKMVP.js → WBJUAZ65.js} +1 -1
  124. package/dist/cdn/{QTH6ZO2M.js → WEAILY72.js} +1 -1
  125. package/dist/cdn/WITGQRKF.js +2 -0
  126. package/dist/cdn/WM4NZNNA.js +2 -0
  127. package/dist/cdn/{RABVM5D7.js → XJZLGVT6.js} +1 -1
  128. package/dist/cdn/{N3AYJLQ3.js → XUSE3II4.js} +1 -1
  129. package/dist/cdn/{PIAOVZIP.js → XW3UC4FN.js} +1 -1
  130. package/dist/cdn/{K3MWE3BD.js → YANXY6FO.js} +1 -1
  131. package/dist/cdn/{6ASYMYYE.js → YJHXVSEP.js} +1 -1
  132. package/dist/cdn/{S6Q2RWZQ.js → YM6QAFEQ.js} +1 -1
  133. package/dist/cdn/{BDV62ZVL.js → YMHR4PKM.js} +1 -1
  134. package/dist/cdn/{CWCZZTTC.js → YMSZKTCN.js} +1 -1
  135. package/dist/cdn/{MRGLBHY6.js → YYDYHAP7.js} +1 -1
  136. package/dist/cdn/{O6DG6EWV.js → ZEASFJJQ.js} +1 -1
  137. package/dist/cdn/{IOTVOWSQ.js → ZGCRVGEK.js} +1 -1
  138. package/dist/cdn/{V7UCCXSG.js → ZGJRTQBX.js} +1 -1
  139. package/dist/cdn/{V3YAFJPI.js → ZPZI63EH.js} +1 -1
  140. package/dist/cdn/{7JU6PR2F.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/input.js +2 -2
  145. package/dist/chunks/runtime.js +4 -4
  146. package/dist/chunks/useForm.js +165 -0
  147. package/dist/chunks/useReferenceElement.js +505 -0
  148. package/dist/components/calcite-block/customElement.js +1 -1
  149. package/dist/components/calcite-checkbox/customElement.d.ts +1 -1
  150. package/dist/components/calcite-checkbox/customElement.js +6 -7
  151. package/dist/components/calcite-combobox/customElement.d.ts +1 -1
  152. package/dist/components/calcite-combobox/customElement.js +11 -12
  153. package/dist/components/calcite-input/customElement.js +1 -1
  154. package/dist/components/calcite-input-date-picker/customElement.js +1 -1
  155. package/dist/components/calcite-input-number/customElement.js +1 -1
  156. package/dist/components/calcite-input-text/customElement.js +2 -161
  157. package/dist/components/calcite-input-time-picker/customElement.js +1 -1
  158. package/dist/components/calcite-list/customElement.js +25 -3
  159. package/dist/components/calcite-list-item-group/customElement.js +1 -1
  160. package/dist/components/calcite-meter/customElement.d.ts +7 -1
  161. package/dist/components/calcite-meter/customElement.js +0 -4
  162. package/dist/components/calcite-popover/customElement.js +11 -176
  163. package/dist/components/calcite-sheet/customElement.js +1 -1
  164. package/dist/components/calcite-tab-nav/customElement.js +1 -1
  165. package/dist/components/calcite-tabs/customElement.js +1 -1
  166. package/dist/components/calcite-text-area/customElement.js +1 -1
  167. package/dist/components/calcite-tooltip/customElement.js +11 -310
  168. package/dist/components/calcite-tree-item/customElement.js +1 -1
  169. package/dist/docs/api.json +1 -1
  170. package/dist/docs/docs.json +1 -1
  171. package/dist/docs/vscode.html-custom-data.json +1 -1
  172. package/dist/docs/web-types.json +1 -1
  173. package/dist/loader.js +2 -2
  174. package/package.json +2 -2
  175. package/dist/cdn/6AYITVWB.js +0 -2
  176. package/dist/cdn/CFGMG4DH.js +0 -2
  177. package/dist/cdn/DAUSY6FZ.js +0 -2
  178. package/dist/cdn/ECD3C5ZE.js +0 -2
  179. package/dist/cdn/GRA7E3RF.js +0 -2
  180. package/dist/cdn/K6ZO6PJL.js +0 -2
  181. package/dist/cdn/SHGMG2W2.js +0 -2
  182. package/dist/cdn/V5MTQXYJ.js +0 -2
  183. package/dist/cdn/WKUBLKRJ.js +0 -2
  184. package/dist/cdn/ZGL65NS5.js +0 -2
  185. package/dist/chunks/FloatingArrow.js +0 -24
@@ -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,
@@ -5,7 +5,7 @@ import { css, html, nothing } from "lit";
5
5
  import { createRef, ref } from "lit/directives/ref.js";
6
6
  import { LitElement, createEvent, safeClassMap, setAttribute } from "@arcgis/lumina";
7
7
  import { useDirection } from "@arcgis/lumina/controllers";
8
- import { z as filterDirectChildren, a as slotChangeGetAssignedElements, s as slotChangeHasAssignedElement } from "../../chunks/dom.js";
8
+ import { A as filterDirectChildren, a as slotChangeGetAssignedElements, s as slotChangeHasAssignedElement } from "../../chunks/dom.js";
9
9
  import { t as toAriaBoolean } from "../../chunks/aria.js";
10
10
  import { g as getIconScale } from "../../chunks/component.js";
11
11
  import { u as useInteractive } from "../../chunks/useInteractive.js";