@esri/solutions-components 0.6.13 → 0.6.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. package/dist/assets/t9n/layer-table/resources.json +1 -1
  2. package/dist/assets/t9n/layer-table/resources_en.json +1 -1
  3. package/dist/assets/t9n/map-layer-picker/resources.json +4 -0
  4. package/dist/assets/t9n/map-layer-picker/resources_en.json +4 -0
  5. package/dist/cjs/basemap-gallery_6.cjs.entry.js +20 -5
  6. package/dist/cjs/buffer-tools_4.cjs.entry.js +1 -1
  7. package/dist/cjs/calcite-chip_3.cjs.entry.js +803 -0
  8. package/dist/cjs/calcite-combobox_6.cjs.entry.js +76 -28
  9. package/dist/cjs/card-manager_3.cjs.entry.js +112 -54
  10. package/dist/cjs/crowdsource-manager.cjs.entry.js +18 -5
  11. package/dist/cjs/{downloadUtils-fb4744e0.js → downloadUtils-34a515ad.js} +2 -2
  12. package/dist/cjs/edit-card_2.cjs.entry.js +5 -0
  13. package/dist/cjs/{index.es-372e33de.js → index.es-0ba11065.js} +2 -2
  14. package/dist/cjs/loader.cjs.js +1 -1
  15. package/dist/cjs/map-select-tools_3.cjs.entry.js +3 -3
  16. package/dist/cjs/{mapViewUtils-a4dd36ec.js → mapViewUtils-a2884698.js} +39 -55
  17. package/dist/cjs/public-notification.cjs.entry.js +3 -3
  18. package/dist/cjs/{publicNotificationStore-b69862af.js → publicNotificationStore-610bd880.js} +0 -4
  19. package/dist/cjs/solutions-components.cjs.js +1 -1
  20. package/dist/collection/components/basemap-gallery/basemap-gallery.js +23 -1
  21. package/dist/collection/components/card-manager/card-manager.js +2 -2
  22. package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +171 -5
  23. package/dist/collection/components/edit-card/edit-card.js +19 -0
  24. package/dist/collection/components/layer-table/layer-table.js +127 -47
  25. package/dist/collection/components/map-card/map-card.js +115 -5
  26. package/dist/collection/components/map-layer-picker/map-layer-picker.css +4 -0
  27. package/dist/collection/components/map-layer-picker/map-layer-picker.js +107 -27
  28. package/dist/collection/components/map-picker/map-picker.css +5 -1
  29. package/dist/collection/components/map-picker/map-picker.js +3 -3
  30. package/dist/collection/components/map-tools/map-tools.js +104 -1
  31. package/dist/collection/utils/interfaces.ts +12 -1
  32. package/dist/collection/utils/mapViewUtils.js +38 -52
  33. package/dist/collection/utils/mapViewUtils.ts +41 -57
  34. package/dist/collection/utils/publicNotificationStore.js +0 -4
  35. package/dist/collection/utils/publicNotificationStore.ts +0 -4
  36. package/dist/components/basemap-gallery2.js +2 -0
  37. package/dist/components/card-manager2.js +2 -2
  38. package/dist/components/crowdsource-manager.js +27 -6
  39. package/dist/components/edit-card2.js +5 -0
  40. package/dist/components/layer-table2.js +136 -78
  41. package/dist/components/map-card2.js +17 -5
  42. package/dist/components/map-layer-picker2.js +114 -52
  43. package/dist/components/map-picker2.js +4 -4
  44. package/dist/components/map-select-tools2.js +55 -43
  45. package/dist/components/map-tools2.js +20 -1
  46. package/dist/components/mapViewUtils.js +39 -53
  47. package/dist/components/public-notification.js +1 -1
  48. package/dist/components/publicNotificationStore.js +0 -4
  49. package/dist/components/refine-selection2.js +61 -49
  50. package/dist/esm/basemap-gallery_6.entry.js +20 -5
  51. package/dist/esm/buffer-tools_4.entry.js +1 -1
  52. package/dist/esm/calcite-chip_3.entry.js +797 -0
  53. package/dist/esm/calcite-combobox_6.entry.js +76 -28
  54. package/dist/esm/card-manager_3.entry.js +112 -54
  55. package/dist/esm/crowdsource-manager.entry.js +18 -5
  56. package/dist/esm/{downloadUtils-67c7a6c8.js → downloadUtils-ac67a786.js} +2 -2
  57. package/dist/esm/edit-card_2.entry.js +5 -0
  58. package/dist/esm/{index.es-59a67d3d.js → index.es-f553598f.js} +2 -2
  59. package/dist/esm/loader.js +1 -1
  60. package/dist/esm/map-select-tools_3.entry.js +3 -3
  61. package/dist/esm/{mapViewUtils-00a04d52.js → mapViewUtils-8141d8c1.js} +39 -53
  62. package/dist/esm/public-notification.entry.js +3 -3
  63. package/dist/esm/{publicNotificationStore-90a6a274.js → publicNotificationStore-dcf39a55.js} +0 -4
  64. package/dist/esm/solutions-components.js +1 -1
  65. package/dist/solutions-components/p-08b52ed8.entry.js +6 -0
  66. package/dist/solutions-components/p-16362eb4.js +36 -0
  67. package/dist/solutions-components/{p-3691a072.js → p-1ab414e0.js} +2 -2
  68. package/dist/solutions-components/{p-73ab9d9a.entry.js → p-3d7aa1b2.entry.js} +1 -1
  69. package/dist/solutions-components/{p-9a8c51bf.entry.js → p-57cf6784.entry.js} +1 -1
  70. package/dist/solutions-components/p-64b22d57.entry.js +6 -0
  71. package/dist/solutions-components/p-654dd5df.entry.js +6 -0
  72. package/dist/solutions-components/{p-f9166fcb.js → p-a26711e8.js} +1 -1
  73. package/dist/solutions-components/p-b1c8c6d7.entry.js +6 -0
  74. package/dist/solutions-components/{p-b892e595.entry.js → p-b9d29f30.entry.js} +1 -1
  75. package/dist/solutions-components/{p-1b41181b.js → p-c8d0ce92.js} +2 -2
  76. package/dist/solutions-components/{p-0219a1a9.entry.js → p-e76949eb.entry.js} +6 -6
  77. package/dist/solutions-components/p-ee7e2f00.entry.js +34 -0
  78. package/dist/solutions-components/solutions-components.esm.js +1 -1
  79. package/dist/solutions-components/utils/interfaces.ts +12 -1
  80. package/dist/solutions-components/utils/mapViewUtils.ts +41 -57
  81. package/dist/solutions-components/utils/publicNotificationStore.ts +0 -4
  82. package/dist/types/components/basemap-gallery/basemap-gallery.d.ts +5 -0
  83. package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +37 -1
  84. package/dist/types/components/edit-card/edit-card.d.ts +8 -0
  85. package/dist/types/components/layer-table/layer-table.d.ts +40 -0
  86. package/dist/types/components/map-card/map-card.d.ts +25 -1
  87. package/dist/types/components/map-layer-picker/map-layer-picker.d.ts +50 -3
  88. package/dist/types/components/map-picker/map-picker.d.ts +2 -2
  89. package/dist/types/components/map-tools/map-tools.d.ts +21 -1
  90. package/dist/types/components.d.ts +182 -2
  91. package/dist/types/preact.d.ts +6 -3
  92. package/dist/types/utils/interfaces.d.ts +10 -1
  93. package/dist/types/utils/mapViewUtils.d.ts +8 -24
  94. package/dist/types/utils/publicNotificationStore.d.ts +0 -2
  95. package/package.json +1 -1
  96. package/dist/cjs/calcite-chip.cjs.entry.js +0 -259
  97. package/dist/cjs/calcite-notice.cjs.entry.js +0 -139
  98. package/dist/cjs/calcite-tooltip.cjs.entry.js +0 -439
  99. package/dist/esm/calcite-chip.entry.js +0 -255
  100. package/dist/esm/calcite-notice.entry.js +0 -135
  101. package/dist/esm/calcite-tooltip.entry.js +0 -435
  102. package/dist/solutions-components/p-2cff8331.entry.js +0 -6
  103. package/dist/solutions-components/p-3a6c8fc3.entry.js +0 -6
  104. package/dist/solutions-components/p-3b1fc7a2.entry.js +0 -6
  105. package/dist/solutions-components/p-767002cd.js +0 -36
  106. package/dist/solutions-components/p-a776b7e6.entry.js +0 -6
  107. package/dist/solutions-components/p-be36d5ed.entry.js +0 -22
  108. package/dist/solutions-components/p-c644edf5.entry.js +0 -11
  109. package/dist/solutions-components/p-cfd88a2f.entry.js +0 -11
@@ -1,439 +0,0 @@
1
- /*!
2
- * Copyright 2022 Esri
3
- * Licensed under the Apache License, Version 2.0
4
- * http://www.apache.org/licenses/LICENSE-2.0
5
- */
6
- 'use strict';
7
-
8
- Object.defineProperty(exports, '__esModule', { value: true });
9
-
10
- const index = require('./index-ee37804b.js');
11
- const dom = require('./dom-456f9f13.js');
12
- const floatingUi = require('./floating-ui-2b0fbba0.js');
13
- const guid = require('./guid-d1123d5e.js');
14
- const openCloseComponent = require('./openCloseComponent-359d855c.js');
15
- const FloatingArrow = require('./FloatingArrow-88e3f797.js');
16
- require('./resources-993f6faf.js');
17
- require('./debounce-30afab47.js');
18
-
19
- /*!
20
- * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
21
- * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
22
- * v1.6.1
23
- */
24
- const CSS = {
25
- container: "container",
26
- };
27
- const TOOLTIP_OPEN_DELAY_MS = 300;
28
- const TOOLTIP_CLOSE_DELAY_MS = 500;
29
- const ARIA_DESCRIBED_BY = "aria-describedby";
30
-
31
- /*!
32
- * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
33
- * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
34
- * v1.6.1
35
- */
36
- function getEffectiveReferenceElement(tooltip) {
37
- const { referenceElement } = tooltip;
38
- return ((typeof referenceElement === "string" ? dom.queryElementRoots(tooltip, { id: referenceElement }) : referenceElement) ||
39
- null);
40
- }
41
-
42
- /*!
43
- * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
44
- * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
45
- * v1.6.1
46
- */
47
- class TooltipManager {
48
- constructor() {
49
- // --------------------------------------------------------------------------
50
- //
51
- // Private Properties
52
- //
53
- // --------------------------------------------------------------------------
54
- this.registeredElements = new WeakMap();
55
- this.registeredShadowRootCounts = new WeakMap();
56
- this.hoverOpenTimeout = null;
57
- this.hoverCloseTimeout = null;
58
- this.hoveredTooltip = null;
59
- this.clickedTooltip = null;
60
- this.activeTooltip = null;
61
- this.registeredElementCount = 0;
62
- // --------------------------------------------------------------------------
63
- //
64
- // Private Methods
65
- //
66
- // --------------------------------------------------------------------------
67
- this.queryTooltip = (composedPath) => {
68
- const { registeredElements } = this;
69
- const registeredElement = composedPath.find((pathEl) => registeredElements.has(pathEl));
70
- return registeredElements.get(registeredElement);
71
- };
72
- this.keyDownHandler = (event) => {
73
- if (event.key === "Escape" && !event.defaultPrevented) {
74
- const { activeTooltip } = this;
75
- if (activeTooltip?.open) {
76
- this.clearHoverTimeout();
77
- this.closeActiveTooltip();
78
- const referenceElement = getEffectiveReferenceElement(activeTooltip);
79
- if (referenceElement instanceof Element && referenceElement.contains(event.target)) {
80
- event.preventDefault();
81
- }
82
- }
83
- }
84
- };
85
- this.pointerMoveHandler = (event) => {
86
- const composedPath = event.composedPath();
87
- const { activeTooltip } = this;
88
- const hoveringActiveTooltip = activeTooltip?.open && composedPath.includes(activeTooltip);
89
- if (hoveringActiveTooltip) {
90
- this.clearHoverTimeout();
91
- return;
92
- }
93
- const tooltip = this.queryTooltip(composedPath);
94
- this.hoveredTooltip = tooltip;
95
- if (this.isClosableClickedTooltip(tooltip)) {
96
- return;
97
- }
98
- this.clickedTooltip = null;
99
- if (tooltip) {
100
- this.openHoveredTooltip(tooltip);
101
- }
102
- else if (activeTooltip) {
103
- this.closeHoveredTooltip();
104
- }
105
- };
106
- this.pointerDownHandler = (event) => {
107
- if (!dom.isPrimaryPointerButton(event)) {
108
- return;
109
- }
110
- const clickedTooltip = this.queryTooltip(event.composedPath());
111
- this.clickedTooltip = clickedTooltip;
112
- if (clickedTooltip?.closeOnClick) {
113
- this.toggleTooltip(clickedTooltip, false);
114
- this.clearHoverTimeout();
115
- }
116
- };
117
- this.focusInHandler = (event) => {
118
- this.queryFocusedTooltip(event, true);
119
- };
120
- this.focusOutHandler = (event) => {
121
- this.queryFocusedTooltip(event, false);
122
- };
123
- this.openHoveredTooltip = (tooltip) => {
124
- this.hoverOpenTimeout = window.setTimeout(() => {
125
- if (this.hoverOpenTimeout === null) {
126
- return;
127
- }
128
- this.clearHoverCloseTimeout();
129
- if (this.activeTooltip === this.hoveredTooltip) {
130
- return;
131
- }
132
- this.closeActiveTooltip();
133
- if (tooltip !== this.hoveredTooltip) {
134
- return;
135
- }
136
- this.toggleTooltip(tooltip, true);
137
- }, this.activeTooltip ? 0 : TOOLTIP_OPEN_DELAY_MS);
138
- };
139
- this.closeHoveredTooltip = () => {
140
- this.hoverCloseTimeout = window.setTimeout(() => {
141
- if (this.hoverCloseTimeout === null) {
142
- return;
143
- }
144
- this.closeActiveTooltip();
145
- }, TOOLTIP_CLOSE_DELAY_MS);
146
- };
147
- }
148
- // --------------------------------------------------------------------------
149
- //
150
- // Public Methods
151
- //
152
- // --------------------------------------------------------------------------
153
- registerElement(referenceEl, tooltip) {
154
- this.registeredElementCount++;
155
- this.registeredElements.set(referenceEl, tooltip);
156
- const shadowRoot = this.getReferenceElShadowRootNode(referenceEl);
157
- if (shadowRoot) {
158
- this.registerShadowRoot(shadowRoot);
159
- }
160
- if (this.registeredElementCount === 1) {
161
- this.addListeners();
162
- }
163
- }
164
- unregisterElement(referenceEl) {
165
- const shadowRoot = this.getReferenceElShadowRootNode(referenceEl);
166
- if (shadowRoot) {
167
- this.unregisterShadowRoot(shadowRoot);
168
- }
169
- if (this.registeredElements.delete(referenceEl)) {
170
- this.registeredElementCount--;
171
- }
172
- if (this.registeredElementCount === 0) {
173
- this.removeListeners();
174
- }
175
- }
176
- addShadowListeners(shadowRoot) {
177
- shadowRoot.addEventListener("focusin", this.focusInHandler, { capture: true });
178
- shadowRoot.addEventListener("focusout", this.focusOutHandler, { capture: true });
179
- }
180
- removeShadowListeners(shadowRoot) {
181
- shadowRoot.removeEventListener("focusin", this.focusInHandler, { capture: true });
182
- shadowRoot.removeEventListener("focusout", this.focusOutHandler, { capture: true });
183
- }
184
- addListeners() {
185
- document.addEventListener("keydown", this.keyDownHandler, { capture: true });
186
- document.addEventListener("pointermove", this.pointerMoveHandler, { capture: true });
187
- document.addEventListener("pointerdown", this.pointerDownHandler, { capture: true });
188
- document.addEventListener("focusin", this.focusInHandler, { capture: true });
189
- document.addEventListener("focusout", this.focusOutHandler, { capture: true });
190
- }
191
- removeListeners() {
192
- document.removeEventListener("keydown", this.keyDownHandler, { capture: true });
193
- document.removeEventListener("pointermove", this.pointerMoveHandler, { capture: true });
194
- document.removeEventListener("pointerdown", this.pointerDownHandler, { capture: true });
195
- document.removeEventListener("focusin", this.focusInHandler, { capture: true });
196
- document.removeEventListener("focusout", this.focusOutHandler, { capture: true });
197
- }
198
- clearHoverOpenTimeout() {
199
- window.clearTimeout(this.hoverOpenTimeout);
200
- this.hoverOpenTimeout = null;
201
- }
202
- clearHoverCloseTimeout() {
203
- window.clearTimeout(this.hoverCloseTimeout);
204
- this.hoverCloseTimeout = null;
205
- }
206
- clearHoverTimeout() {
207
- this.clearHoverOpenTimeout();
208
- this.clearHoverCloseTimeout();
209
- }
210
- closeActiveTooltip() {
211
- const { activeTooltip } = this;
212
- if (activeTooltip?.open) {
213
- this.toggleTooltip(activeTooltip, false);
214
- }
215
- }
216
- toggleFocusedTooltip(tooltip, open) {
217
- this.closeActiveTooltip();
218
- if (open) {
219
- this.clearHoverTimeout();
220
- }
221
- this.toggleTooltip(tooltip, open);
222
- }
223
- toggleTooltip(tooltip, open) {
224
- tooltip.open = open;
225
- this.activeTooltip = open ? tooltip : null;
226
- }
227
- queryFocusedTooltip(event, open) {
228
- const tooltip = this.queryTooltip(event.composedPath());
229
- if (!tooltip || this.isClosableClickedTooltip(tooltip)) {
230
- return;
231
- }
232
- this.toggleFocusedTooltip(tooltip, open);
233
- }
234
- isClosableClickedTooltip(tooltip) {
235
- return tooltip?.closeOnClick && tooltip === this.clickedTooltip;
236
- }
237
- registerShadowRoot(shadowRoot) {
238
- const { registeredShadowRootCounts } = this;
239
- const newCount = (registeredShadowRootCounts.get(shadowRoot) ?? 0) + 1;
240
- if (newCount === 1) {
241
- this.addShadowListeners(shadowRoot);
242
- }
243
- registeredShadowRootCounts.set(shadowRoot, newCount);
244
- }
245
- unregisterShadowRoot(shadowRoot) {
246
- const { registeredShadowRootCounts } = this;
247
- const newCount = registeredShadowRootCounts.get(shadowRoot) - 1;
248
- if (newCount === 0) {
249
- this.removeShadowListeners(shadowRoot);
250
- }
251
- registeredShadowRootCounts.set(shadowRoot, newCount);
252
- }
253
- getReferenceElShadowRootNode(referenceEl) {
254
- return referenceEl instanceof Element ? dom.getShadowRootNode(referenceEl) : null;
255
- }
256
- }
257
-
258
- const tooltipCss = ":host{--calcite-floating-ui-z-index:var(--calcite-tooltip-z-index, var(--calcite-app-z-index-tooltip));display:block;position:absolute;z-index:var(--calcite-floating-ui-z-index)}.calcite-floating-ui-anim{position:relative;transition:var(--calcite-floating-ui-transition);transition-property:transform, visibility, opacity;opacity:0;box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);z-index:var(--calcite-app-z-index);border-radius:0.25rem}:host([data-placement^=bottom]) .calcite-floating-ui-anim{transform:translateY(-5px)}:host([data-placement^=top]) .calcite-floating-ui-anim{transform:translateY(5px)}:host([data-placement^=left]) .calcite-floating-ui-anim{transform:translateX(5px)}:host([data-placement^=right]) .calcite-floating-ui-anim{transform:translateX(-5px)}:host([data-placement]) .calcite-floating-ui-anim--active{opacity:1;transform:translate(0)}:host([calcite-hydrated-hidden]){visibility:hidden !important;pointer-events:none}.calcite-floating-ui-arrow{pointer-events:none;position:absolute;z-index:calc(var(--calcite-app-z-index) * -1);fill:var(--calcite-ui-foreground-1)}.calcite-floating-ui-arrow__stroke{stroke:var(--calcite-ui-border-3)}.container{position:relative;overflow:hidden;border-radius:0.25rem;padding-block:0.75rem;padding-inline:1rem;font-size:var(--calcite-font-size--2);line-height:1.375;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1);max-inline-size:20rem;max-block-size:20rem;text-align:start}.calcite-floating-ui-anim{border-radius:0.25rem;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);background-color:var(--calcite-ui-foreground-1)}.arrow::before{outline:1px solid var(--calcite-ui-border-3)}:host([hidden]){display:none}[hidden]{display:none}";
259
-
260
- const manager = new TooltipManager();
261
- const Tooltip = class {
262
- constructor(hostRef) {
263
- index.registerInstance(this, hostRef);
264
- this.calciteTooltipBeforeClose = index.createEvent(this, "calciteTooltipBeforeClose", 6);
265
- this.calciteTooltipClose = index.createEvent(this, "calciteTooltipClose", 6);
266
- this.calciteTooltipBeforeOpen = index.createEvent(this, "calciteTooltipBeforeOpen", 6);
267
- this.calciteTooltipOpen = index.createEvent(this, "calciteTooltipOpen", 6);
268
- this.guid = `calcite-tooltip-${guid.guid()}`;
269
- this.hasLoaded = false;
270
- this.openTransitionProp = "opacity";
271
- this.setTransitionEl = (el) => {
272
- this.transitionEl = el;
273
- };
274
- this.setUpReferenceElement = (warn = true) => {
275
- this.removeReferences();
276
- this.effectiveReferenceElement = getEffectiveReferenceElement(this.el);
277
- floatingUi.connectFloatingUI(this, this.effectiveReferenceElement, this.el);
278
- const { el, referenceElement, effectiveReferenceElement } = this;
279
- if (warn && referenceElement && !effectiveReferenceElement) {
280
- console.warn(`${el.tagName}: reference-element id "${referenceElement}" was not found.`, {
281
- el,
282
- });
283
- }
284
- this.addReferences();
285
- };
286
- this.getId = () => {
287
- return this.el.id || this.guid;
288
- };
289
- this.addReferences = () => {
290
- const { effectiveReferenceElement } = this;
291
- if (!effectiveReferenceElement) {
292
- return;
293
- }
294
- const id = this.getId();
295
- if ("setAttribute" in effectiveReferenceElement) {
296
- effectiveReferenceElement.setAttribute(ARIA_DESCRIBED_BY, id);
297
- }
298
- manager.registerElement(effectiveReferenceElement, this.el);
299
- };
300
- this.removeReferences = () => {
301
- const { effectiveReferenceElement } = this;
302
- if (!effectiveReferenceElement) {
303
- return;
304
- }
305
- if ("removeAttribute" in effectiveReferenceElement) {
306
- effectiveReferenceElement.removeAttribute(ARIA_DESCRIBED_BY);
307
- }
308
- manager.unregisterElement(effectiveReferenceElement);
309
- };
310
- this.closeOnClick = false;
311
- this.label = undefined;
312
- this.offsetDistance = floatingUi.defaultOffsetDistance;
313
- this.offsetSkidding = 0;
314
- this.open = false;
315
- this.overlayPositioning = "absolute";
316
- this.placement = "auto";
317
- this.referenceElement = undefined;
318
- this.effectiveReferenceElement = undefined;
319
- this.floatingLayout = "vertical";
320
- }
321
- offsetDistanceOffsetHandler() {
322
- this.reposition(true);
323
- }
324
- offsetSkiddingHandler() {
325
- this.reposition(true);
326
- }
327
- openHandler(value) {
328
- openCloseComponent.onToggleOpenCloseComponent(this);
329
- if (value) {
330
- this.reposition(true);
331
- }
332
- }
333
- overlayPositioningHandler() {
334
- this.reposition(true);
335
- }
336
- placementHandler() {
337
- this.reposition(true);
338
- }
339
- referenceElementHandler() {
340
- this.setUpReferenceElement();
341
- }
342
- // --------------------------------------------------------------------------
343
- //
344
- // Lifecycle
345
- //
346
- // --------------------------------------------------------------------------
347
- connectedCallback() {
348
- this.setUpReferenceElement(this.hasLoaded);
349
- if (this.open) {
350
- openCloseComponent.onToggleOpenCloseComponent(this);
351
- }
352
- }
353
- async componentWillLoad() {
354
- if (this.open) {
355
- openCloseComponent.onToggleOpenCloseComponent(this);
356
- }
357
- }
358
- componentDidLoad() {
359
- if (this.referenceElement && !this.effectiveReferenceElement) {
360
- this.setUpReferenceElement();
361
- }
362
- this.reposition(true);
363
- this.hasLoaded = true;
364
- }
365
- disconnectedCallback() {
366
- this.removeReferences();
367
- floatingUi.disconnectFloatingUI(this, this.effectiveReferenceElement, this.el);
368
- }
369
- // --------------------------------------------------------------------------
370
- //
371
- // Public Methods
372
- //
373
- // --------------------------------------------------------------------------
374
- /**
375
- * Updates the position of the component.
376
- *
377
- * @param delayed
378
- */
379
- async reposition(delayed = false) {
380
- const { el, effectiveReferenceElement, placement, overlayPositioning, offsetDistance, offsetSkidding, arrowEl, } = this;
381
- return floatingUi.reposition(this, {
382
- floatingEl: el,
383
- referenceEl: effectiveReferenceElement,
384
- overlayPositioning,
385
- placement,
386
- offsetDistance,
387
- offsetSkidding,
388
- arrowEl,
389
- type: "tooltip",
390
- }, delayed);
391
- }
392
- // --------------------------------------------------------------------------
393
- //
394
- // Private Methods
395
- //
396
- // --------------------------------------------------------------------------
397
- onBeforeOpen() {
398
- this.calciteTooltipBeforeOpen.emit();
399
- }
400
- onOpen() {
401
- this.calciteTooltipOpen.emit();
402
- }
403
- onBeforeClose() {
404
- this.calciteTooltipBeforeClose.emit();
405
- }
406
- onClose() {
407
- this.calciteTooltipClose.emit();
408
- }
409
- // --------------------------------------------------------------------------
410
- //
411
- // Render Methods
412
- //
413
- // --------------------------------------------------------------------------
414
- render() {
415
- const { effectiveReferenceElement, label, open, floatingLayout } = this;
416
- const displayed = effectiveReferenceElement && open;
417
- const hidden = !displayed;
418
- return (index.h(index.Host, { "aria-hidden": dom.toAriaBoolean(hidden), "aria-label": label, "aria-live": "polite", "calcite-hydrated-hidden": hidden, id: this.getId(), role: "tooltip" }, index.h("div", { class: {
419
- [floatingUi.FloatingCSS.animation]: true,
420
- [floatingUi.FloatingCSS.animationActive]: displayed,
421
- },
422
- // eslint-disable-next-line react/jsx-sort-props
423
- ref: this.setTransitionEl }, index.h(FloatingArrow.FloatingArrow, { floatingLayout: floatingLayout,
424
- // eslint-disable-next-line react/jsx-sort-props
425
- ref: (arrowEl) => (this.arrowEl = arrowEl) }), index.h("div", { class: CSS.container }, index.h("slot", null)))));
426
- }
427
- get el() { return index.getElement(this); }
428
- static get watchers() { return {
429
- "offsetDistance": ["offsetDistanceOffsetHandler"],
430
- "offsetSkidding": ["offsetSkiddingHandler"],
431
- "open": ["openHandler"],
432
- "overlayPositioning": ["overlayPositioningHandler"],
433
- "placement": ["placementHandler"],
434
- "referenceElement": ["referenceElementHandler"]
435
- }; }
436
- };
437
- Tooltip.style = tooltipCss;
438
-
439
- exports.calcite_tooltip = Tooltip;