@esri/solutions-components 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/deduct-calculator.cjs.entry.js +1 -1
- package/dist/cjs/pci-calculator.cjs.entry.js +1 -1
- package/dist/cjs/{pciUtils-6a806ba4.js → pciUtils-423cfc68.js} +25 -7
- package/dist/collection/demos/deduct-calculator.html +2 -5
- package/dist/collection/demos/new-public-notification.html +6 -4
- package/dist/collection/utils/pciUtils.js +25 -7
- package/dist/collection/utils/pciUtils.ts +30 -7
- package/dist/components/ExpandToggle.js +110 -0
- package/dist/components/Heading.js +22 -0
- package/dist/components/_commonjsHelpers.js +22 -0
- package/dist/components/action-bar.js +276 -0
- package/dist/components/action-group.js +149 -0
- package/dist/components/action-menu.js +356 -0
- package/dist/components/action.js +214 -0
- package/dist/components/add-record-modal.d.ts +11 -0
- package/dist/components/add-record-modal.js +171 -0
- package/dist/components/array.js +15 -0
- package/dist/components/block.js +272 -0
- package/dist/components/buffer-tools.d.ts +11 -0
- package/dist/components/buffer-tools.js +11 -0
- package/dist/components/buffer-tools2.js +262 -0
- package/dist/components/button.js +263 -0
- package/dist/components/calcite-accordion-item.js +244 -0
- package/dist/components/calcite-accordion.js +180 -0
- package/dist/components/calcite-action-bar.js +11 -0
- package/dist/components/calcite-action-group.js +11 -0
- package/dist/components/calcite-action-menu.js +11 -0
- package/dist/components/calcite-action-pad.js +197 -0
- package/dist/components/calcite-action.js +11 -0
- package/dist/components/calcite-alert.js +297 -0
- package/dist/components/calcite-avatar.js +182 -0
- package/dist/components/calcite-block-section.js +155 -0
- package/dist/components/calcite-block.js +11 -0
- package/dist/components/calcite-button.js +11 -0
- package/dist/components/calcite-card.js +187 -0
- package/dist/components/calcite-checkbox.js +11 -0
- package/dist/components/calcite-chip.js +11 -0
- package/dist/components/calcite-color-picker-hex-input.js +11 -0
- package/dist/components/calcite-color-picker-swatch.js +11 -0
- package/dist/components/calcite-color-picker.js +1036 -0
- package/dist/components/calcite-combobox-item-group.js +75 -0
- package/dist/components/calcite-combobox-item.js +11 -0
- package/dist/components/calcite-combobox.js +11 -0
- package/dist/components/calcite-date-picker-day.js +11 -0
- package/dist/components/calcite-date-picker-month-header.js +11 -0
- package/dist/components/calcite-date-picker-month.js +11 -0
- package/dist/components/calcite-date-picker.js +11 -0
- package/dist/components/calcite-dropdown-group.js +11 -0
- package/dist/components/calcite-dropdown-item.js +11 -0
- package/dist/components/calcite-dropdown.js +11 -0
- package/dist/components/calcite-fab.js +144 -0
- package/dist/components/calcite-filter.js +195 -0
- package/dist/components/calcite-flow-item.js +243 -0
- package/dist/components/calcite-flow.js +147 -0
- package/dist/components/calcite-graph.js +11 -0
- package/dist/components/calcite-handle.js +11 -0
- package/dist/components/calcite-icon.js +11 -0
- package/dist/components/calcite-inline-editable.js +294 -0
- package/dist/components/calcite-input-date-picker.js +713 -0
- package/dist/components/calcite-input-message.js +11 -0
- package/dist/components/calcite-input-number.js +637 -0
- package/dist/components/calcite-input-text.js +400 -0
- package/dist/components/calcite-input-time-picker.js +434 -0
- package/dist/components/calcite-input.js +11 -0
- package/dist/components/calcite-label.js +11 -0
- package/dist/components/calcite-link.js +11 -0
- package/dist/components/calcite-list-item-group.js +65 -0
- package/dist/components/calcite-list-item.js +11 -0
- package/dist/components/calcite-list.js +11 -0
- package/dist/components/calcite-loader.js +11 -0
- package/dist/components/calcite-modal.js +11 -0
- package/dist/components/calcite-notice.js +11 -0
- package/dist/components/calcite-option-group.js +64 -0
- package/dist/components/calcite-option.js +11 -0
- package/dist/components/calcite-pagination.js +258 -0
- package/dist/components/calcite-panel.js +11 -0
- package/dist/components/calcite-pick-list-group.js +74 -0
- package/dist/components/calcite-pick-list-item.js +11 -0
- package/dist/components/calcite-pick-list.js +11 -0
- package/dist/components/calcite-popover-manager.js +94 -0
- package/dist/components/calcite-popover.js +11 -0
- package/dist/components/calcite-progress.js +11 -0
- package/dist/components/calcite-radio-button-group.js +132 -0
- package/dist/components/calcite-radio-button.js +310 -0
- package/dist/components/calcite-radio-group-item.js +11 -0
- package/dist/components/calcite-radio-group.js +11 -0
- package/dist/components/calcite-rating.js +201 -0
- package/dist/components/calcite-scrim.js +11 -0
- package/dist/components/calcite-select.js +11 -0
- package/dist/components/calcite-shell-center-row.js +100 -0
- package/dist/components/calcite-shell-panel.js +11 -0
- package/dist/components/calcite-shell.js +11 -0
- package/dist/components/calcite-slider.js +11 -0
- package/dist/components/calcite-sortable-list.js +202 -0
- package/dist/components/calcite-split-button.js +11 -0
- package/dist/components/calcite-stepper-item.js +271 -0
- package/dist/components/calcite-stepper.js +256 -0
- package/dist/components/calcite-switch.js +11 -0
- package/dist/components/calcite-tab-nav.js +11 -0
- package/dist/components/calcite-tab-title.js +11 -0
- package/dist/components/calcite-tab.js +11 -0
- package/dist/components/calcite-tabs.js +11 -0
- package/dist/components/calcite-tile-select-group.js +65 -0
- package/dist/components/calcite-tile-select.js +266 -0
- package/dist/components/calcite-tile.js +11 -0
- package/dist/components/calcite-time-picker.js +11 -0
- package/dist/components/calcite-tip-group.js +41 -0
- package/dist/components/calcite-tip-manager.js +223 -0
- package/dist/components/calcite-tip.js +162 -0
- package/dist/components/calcite-tooltip-manager.js +57 -0
- package/dist/components/calcite-tooltip.js +11 -0
- package/dist/components/calcite-tree-item.js +11 -0
- package/dist/components/calcite-tree.js +11 -0
- package/dist/components/calcite-value-list-item.js +11 -0
- package/dist/components/calcite-value-list.js +11 -0
- package/dist/components/card-manager.d.ts +11 -0
- package/dist/components/card-manager.js +143 -0
- package/dist/components/check-list.d.ts +11 -0
- package/dist/components/check-list.js +11 -0
- package/dist/components/check-list2.js +131 -0
- package/dist/components/checkbox.js +165 -0
- package/dist/components/chip.js +170 -0
- package/dist/components/color-picker-hex-input.js +363 -0
- package/dist/components/color-picker-swatch.js +2034 -0
- package/dist/components/combobox-item.js +182 -0
- package/dist/components/combobox.js +912 -0
- package/dist/components/comment-card.d.ts +11 -0
- package/dist/components/comment-card.js +90 -0
- package/dist/components/conditionalSlot.js +50 -0
- package/dist/components/config-buffer-tools.d.ts +11 -0
- package/dist/components/config-buffer-tools.js +187 -0
- package/dist/components/config-draw-tools.d.ts +11 -0
- package/dist/components/config-draw-tools.js +121 -0
- package/dist/components/config-layer-picker.d.ts +11 -0
- package/dist/components/config-layer-picker.js +163 -0
- package/dist/components/config-pdf-download.d.ts +11 -0
- package/dist/components/config-pdf-download.js +154 -0
- package/dist/components/crowdsource-manager.d.ts +11 -0
- package/dist/components/crowdsource-manager.js +90 -0
- package/dist/components/crowdsource-reporter.d.ts +11 -0
- package/dist/components/crowdsource-reporter.js +90 -0
- package/dist/components/csvUtils.js +74 -0
- package/dist/components/date-picker-day.js +111 -0
- package/dist/components/date-picker-month-header.js +224 -0
- package/dist/components/date-picker-month.js +344 -0
- package/dist/components/date-picker.js +575 -0
- package/dist/components/date.js +180 -0
- package/dist/components/debounce.js +487 -0
- package/dist/components/deduct-calculator.d.ts +11 -0
- package/dist/components/deduct-calculator.js +11 -0
- package/dist/components/deduct-calculator2.js +1002 -0
- package/dist/components/dom.js +231 -0
- package/dist/components/dropdown-group.js +96 -0
- package/dist/components/dropdown-item.js +232 -0
- package/dist/components/dropdown.js +505 -0
- package/dist/components/edit-record-modal.d.ts +11 -0
- package/dist/components/edit-record-modal.js +11 -0
- package/dist/components/edit-record-modal2.js +161 -0
- package/dist/components/filter.js +763 -0
- package/dist/components/floating-ui.js +1768 -0
- package/dist/components/form.js +228 -0
- package/dist/components/graph.js +254 -0
- package/dist/components/guid.js +24 -0
- package/dist/components/handle.js +119 -0
- package/dist/components/icon.js +202 -0
- package/dist/components/index.d.ts +61 -0
- package/dist/components/index.js +196 -0
- package/dist/components/index2.js +199 -0
- package/dist/components/info-card.d.ts +11 -0
- package/dist/components/info-card.js +11 -0
- package/dist/components/info-card2.js +97 -0
- package/dist/components/input-message.js +101 -0
- package/dist/components/input.js +740 -0
- package/dist/components/interactive.js +51 -0
- package/dist/components/interfaces.js +19 -0
- package/dist/components/interfaces2.js +21 -0
- package/dist/components/interfaces3.js +80 -0
- package/dist/components/json-editor.d.ts +11 -0
- package/dist/components/json-editor.js +11 -0
- package/dist/components/json-editor2.js +441 -0
- package/dist/components/key.js +16 -0
- package/dist/components/label.js +106 -0
- package/dist/components/label2.js +131 -0
- package/dist/components/labelFormats.js +210 -0
- package/dist/components/layer-table.d.ts +11 -0
- package/dist/components/layer-table.js +453 -0
- package/dist/components/link.js +123 -0
- package/dist/components/list-item.d.ts +11 -0
- package/dist/components/list-item.js +90 -0
- package/dist/components/list-item2.js +149 -0
- package/dist/components/list.js +83 -0
- package/dist/components/loadModules.js +28 -0
- package/dist/components/loader.js +116 -0
- package/dist/components/locale.js +412 -0
- package/dist/components/locale2.js +413 -0
- package/dist/components/map-card.d.ts +11 -0
- package/dist/components/map-card.js +354 -0
- package/dist/components/map-draw-tools.d.ts +11 -0
- package/dist/components/map-draw-tools.js +11 -0
- package/dist/components/map-draw-tools2.js +228 -0
- package/dist/components/map-layer-picker.d.ts +11 -0
- package/dist/components/map-layer-picker.js +11 -0
- package/dist/components/map-layer-picker2.js +188 -0
- package/dist/components/map-search.d.ts +11 -0
- package/dist/components/map-search.js +155 -0
- package/dist/components/map-select-tools.d.ts +11 -0
- package/dist/components/map-select-tools.js +11 -0
- package/dist/components/map-select-tools2.js +588 -0
- package/dist/components/mapViewUtils.js +129 -0
- package/dist/components/math.js +24 -0
- package/dist/components/media-card.d.ts +11 -0
- package/dist/components/media-card.js +11 -0
- package/dist/components/media-card2.js +177 -0
- package/dist/components/modal.js +495 -0
- package/dist/components/nonChromiumPlatformUtils.js +503 -0
- package/dist/components/notice.js +192 -0
- package/dist/components/observers.js +56 -0
- package/dist/components/openCloseComponent.js +56 -0
- package/dist/components/option.js +109 -0
- package/dist/components/panel.js +459 -0
- package/dist/components/pci-calculator.d.ts +11 -0
- package/dist/components/pci-calculator.js +193 -0
- package/dist/components/pdf-download.d.ts +11 -0
- package/dist/components/pdf-download.js +11 -0
- package/dist/components/pdf-download2.js +189 -0
- package/dist/components/pick-list-item.js +255 -0
- package/dist/components/pick-list.js +170 -0
- package/dist/components/popover.js +500 -0
- package/dist/components/progress.js +60 -0
- package/dist/components/public-notification.d.ts +11 -0
- package/dist/components/public-notification.js +825 -0
- package/dist/components/publicNotificationStore.js +38 -0
- package/dist/components/queryUtils.js +187 -0
- package/dist/components/radio-group-item.js +101 -0
- package/dist/components/radio-group.js +235 -0
- package/dist/components/refine-selection-tools.d.ts +11 -0
- package/dist/components/refine-selection-tools.js +11 -0
- package/dist/components/refine-selection-tools2.js +492 -0
- package/dist/components/refine-selection.d.ts +11 -0
- package/dist/components/refine-selection.js +11 -0
- package/dist/components/refine-selection2.js +376 -0
- package/dist/components/resources.js +24 -0
- package/dist/components/resources2.js +21 -0
- package/dist/components/resources3.js +38 -0
- package/dist/components/scrim.js +83 -0
- package/dist/components/select.js +259 -0
- package/dist/components/shared-list-render.js +319 -0
- package/dist/components/shell-panel.js +281 -0
- package/dist/components/shell.js +121 -0
- package/dist/components/slider.js +896 -0
- package/dist/components/solution-configuration.d.ts +11 -0
- package/dist/components/solution-configuration.js +2233 -0
- package/dist/components/solution-contents.d.ts +11 -0
- package/dist/components/solution-contents.js +11 -0
- package/dist/components/solution-contents2.js +128 -0
- package/dist/components/solution-item-details.d.ts +11 -0
- package/dist/components/solution-item-details.js +11 -0
- package/dist/components/solution-item-details2.js +234 -0
- package/dist/components/solution-item-icon.d.ts +11 -0
- package/dist/components/solution-item-icon.js +11 -0
- package/dist/components/solution-item-icon2.js +342 -0
- package/dist/components/solution-item-sharing.d.ts +11 -0
- package/dist/components/solution-item-sharing.js +11 -0
- package/dist/components/solution-item-sharing2.js +167 -0
- package/dist/components/solution-item.d.ts +11 -0
- package/dist/components/solution-item.js +11 -0
- package/dist/components/solution-item2.js +315 -0
- package/dist/components/solution-organization-variables.d.ts +11 -0
- package/dist/components/solution-organization-variables.js +11 -0
- package/dist/components/solution-organization-variables2.js +132 -0
- package/dist/components/solution-resource-item.d.ts +11 -0
- package/dist/components/solution-resource-item.js +11 -0
- package/dist/components/solution-resource-item2.js +356 -0
- package/dist/components/solution-spatial-ref.d.ts +11 -0
- package/dist/components/solution-spatial-ref.js +11 -0
- package/dist/components/solution-spatial-ref2.js +21446 -0
- package/dist/components/solution-store.js +4092 -0
- package/dist/components/solution-template-data.d.ts +11 -0
- package/dist/components/solution-template-data.js +11 -0
- package/dist/components/solution-template-data2.js +233 -0
- package/dist/components/solution-variables.d.ts +11 -0
- package/dist/components/solution-variables.js +11 -0
- package/dist/components/solution-variables2.js +150 -0
- package/dist/components/sortable.esm.js +3026 -0
- package/dist/components/split-button.js +165 -0
- package/dist/components/store-manager.d.ts +11 -0
- package/dist/components/store-manager.js +83 -0
- package/dist/components/switch.js +139 -0
- package/dist/components/tab-nav.js +241 -0
- package/dist/components/tab-title.js +276 -0
- package/dist/components/tab.js +154 -0
- package/dist/components/tabs.js +188 -0
- package/dist/components/tile.js +129 -0
- package/dist/components/time-picker.js +943 -0
- package/dist/components/tooltip.js +399 -0
- package/dist/components/tree-item.js +294 -0
- package/dist/components/tree.js +327 -0
- package/dist/components/utils.js +119 -0
- package/dist/components/utils2.js +51 -0
- package/dist/components/value-list-item.js +204 -0
- package/dist/components/value-list.js +333 -0
- package/dist/esm/deduct-calculator.entry.js +1 -1
- package/dist/esm/pci-calculator.entry.js +1 -1
- package/dist/esm/{pciUtils-e3007a1c.js → pciUtils-ecda46e5.js} +25 -7
- package/dist/solutions-components/demos/deduct-calculator.html +2 -5
- package/dist/solutions-components/demos/new-public-notification.html +6 -4
- package/dist/solutions-components/{p-ff80ffbb.entry.js → p-0512635b.entry.js} +1 -1
- package/dist/solutions-components/{p-5ec407c2.entry.js → p-0c088725.entry.js} +1 -1
- package/dist/solutions-components/p-cc815aca.js +21 -0
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/pciUtils.ts +30 -7
- package/dist/types/utils/pciUtils.d.ts +2 -1
- package/package.json +4 -3
- package/dist/solutions-components/p-647bbd18.js +0 -21
@@ -0,0 +1,399 @@
|
|
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
|
+
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
7
|
+
import { g as guid } from './guid.js';
|
8
|
+
import { b as defaultOffsetDistance, c as connectFloatingUI, u as updateAfterClose, a as disconnectFloatingUI, r as reposition, F as FloatingCSS } from './floating-ui.js';
|
9
|
+
import { i as isPrimaryPointerButton, q as queryElementRoots, t as toAriaBoolean } from './dom.js';
|
10
|
+
|
11
|
+
/*!
|
12
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
13
|
+
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
14
|
+
* v1.0.0-beta.97
|
15
|
+
*/
|
16
|
+
const CSS = {
|
17
|
+
container: "container",
|
18
|
+
arrow: "arrow"
|
19
|
+
};
|
20
|
+
const TOOLTIP_DELAY_MS = 500;
|
21
|
+
const ARIA_DESCRIBED_BY = "aria-describedby";
|
22
|
+
|
23
|
+
/*!
|
24
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
25
|
+
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
26
|
+
* v1.0.0-beta.97
|
27
|
+
*/
|
28
|
+
class TooltipManager {
|
29
|
+
constructor() {
|
30
|
+
// --------------------------------------------------------------------------
|
31
|
+
//
|
32
|
+
// Private Properties
|
33
|
+
//
|
34
|
+
// --------------------------------------------------------------------------
|
35
|
+
this.registeredElements = new WeakMap();
|
36
|
+
this.hoverTimeouts = new WeakMap();
|
37
|
+
this.registeredElementCount = 0;
|
38
|
+
// --------------------------------------------------------------------------
|
39
|
+
//
|
40
|
+
// Private Methods
|
41
|
+
//
|
42
|
+
// --------------------------------------------------------------------------
|
43
|
+
this.queryTooltip = (composedPath) => {
|
44
|
+
const { registeredElements } = this;
|
45
|
+
const registeredElement = composedPath.find((pathEl) => registeredElements.has(pathEl));
|
46
|
+
return registeredElements.get(registeredElement);
|
47
|
+
};
|
48
|
+
this.keyDownHandler = (event) => {
|
49
|
+
if (event.key === "Escape") {
|
50
|
+
const { activeTooltipEl } = this;
|
51
|
+
if (activeTooltipEl) {
|
52
|
+
this.clearHoverTimeout(activeTooltipEl);
|
53
|
+
this.toggleTooltip(activeTooltipEl, false);
|
54
|
+
}
|
55
|
+
}
|
56
|
+
};
|
57
|
+
this.mouseEnterShow = (event) => {
|
58
|
+
this.hoverEvent(event, true);
|
59
|
+
};
|
60
|
+
this.mouseLeaveHide = (event) => {
|
61
|
+
this.hoverEvent(event, false);
|
62
|
+
};
|
63
|
+
this.clickHandler = (event) => {
|
64
|
+
if (!isPrimaryPointerButton(event)) {
|
65
|
+
return;
|
66
|
+
}
|
67
|
+
const clickedTooltip = this.queryTooltip(event.composedPath());
|
68
|
+
this.clickedTooltip = clickedTooltip;
|
69
|
+
if (clickedTooltip === null || clickedTooltip === void 0 ? void 0 : clickedTooltip.closeOnClick) {
|
70
|
+
this.toggleTooltip(clickedTooltip, false);
|
71
|
+
this.clearHoverTimeout(clickedTooltip);
|
72
|
+
}
|
73
|
+
};
|
74
|
+
this.focusShow = (event) => {
|
75
|
+
this.focusEvent(event, true);
|
76
|
+
};
|
77
|
+
this.blurHide = (event) => {
|
78
|
+
this.focusEvent(event, false);
|
79
|
+
};
|
80
|
+
this.hoverToggle = (tooltip, value) => {
|
81
|
+
const { hoverTimeouts } = this;
|
82
|
+
hoverTimeouts.delete(tooltip);
|
83
|
+
if (value) {
|
84
|
+
this.closeExistingTooltip();
|
85
|
+
}
|
86
|
+
this.toggleTooltip(tooltip, value);
|
87
|
+
};
|
88
|
+
}
|
89
|
+
// --------------------------------------------------------------------------
|
90
|
+
//
|
91
|
+
// Public Methods
|
92
|
+
//
|
93
|
+
// --------------------------------------------------------------------------
|
94
|
+
registerElement(referenceEl, tooltip) {
|
95
|
+
this.registeredElementCount++;
|
96
|
+
this.registeredElements.set(referenceEl, tooltip);
|
97
|
+
if (this.registeredElementCount === 1) {
|
98
|
+
this.addListeners();
|
99
|
+
}
|
100
|
+
}
|
101
|
+
unregisterElement(referenceEl) {
|
102
|
+
if (this.registeredElements.delete(referenceEl)) {
|
103
|
+
this.registeredElementCount--;
|
104
|
+
}
|
105
|
+
if (this.registeredElementCount === 0) {
|
106
|
+
this.removeListeners();
|
107
|
+
}
|
108
|
+
}
|
109
|
+
addListeners() {
|
110
|
+
document.addEventListener("keydown", this.keyDownHandler);
|
111
|
+
document.addEventListener("pointerover", this.mouseEnterShow, { capture: true });
|
112
|
+
document.addEventListener("pointerout", this.mouseLeaveHide, { capture: true });
|
113
|
+
document.addEventListener("pointerdown", this.clickHandler, { capture: true });
|
114
|
+
document.addEventListener("focusin", this.focusShow, { capture: true });
|
115
|
+
document.addEventListener("focusout", this.blurHide, { capture: true });
|
116
|
+
}
|
117
|
+
removeListeners() {
|
118
|
+
document.removeEventListener("keydown", this.keyDownHandler);
|
119
|
+
document.removeEventListener("pointerover", this.mouseEnterShow, { capture: true });
|
120
|
+
document.removeEventListener("pointerout", this.mouseLeaveHide, { capture: true });
|
121
|
+
document.removeEventListener("pointerdown", this.clickHandler, { capture: true });
|
122
|
+
document.removeEventListener("focusin", this.focusShow, { capture: true });
|
123
|
+
document.removeEventListener("focusout", this.blurHide, { capture: true });
|
124
|
+
}
|
125
|
+
clearHoverTimeout(tooltip) {
|
126
|
+
const { hoverTimeouts } = this;
|
127
|
+
if (hoverTimeouts.has(tooltip)) {
|
128
|
+
window.clearTimeout(hoverTimeouts.get(tooltip));
|
129
|
+
hoverTimeouts.delete(tooltip);
|
130
|
+
}
|
131
|
+
}
|
132
|
+
closeExistingTooltip() {
|
133
|
+
const { activeTooltipEl } = this;
|
134
|
+
if (activeTooltipEl) {
|
135
|
+
this.toggleTooltip(activeTooltipEl, false);
|
136
|
+
}
|
137
|
+
}
|
138
|
+
focusTooltip(tooltip, value) {
|
139
|
+
this.closeExistingTooltip();
|
140
|
+
if (value) {
|
141
|
+
this.clearHoverTimeout(tooltip);
|
142
|
+
}
|
143
|
+
this.toggleTooltip(tooltip, value);
|
144
|
+
}
|
145
|
+
toggleTooltip(tooltip, value) {
|
146
|
+
tooltip.open = value;
|
147
|
+
if (value) {
|
148
|
+
this.activeTooltipEl = tooltip;
|
149
|
+
}
|
150
|
+
}
|
151
|
+
hoverTooltip(tooltip, value) {
|
152
|
+
this.clearHoverTimeout(tooltip);
|
153
|
+
const { hoverTimeouts } = this;
|
154
|
+
const timeoutId = window.setTimeout(() => this.hoverToggle(tooltip, value), TOOLTIP_DELAY_MS );
|
155
|
+
hoverTimeouts.set(tooltip, timeoutId);
|
156
|
+
}
|
157
|
+
activeTooltipHover(event) {
|
158
|
+
const { activeTooltipEl, hoverTimeouts } = this;
|
159
|
+
const { type } = event;
|
160
|
+
if (!activeTooltipEl) {
|
161
|
+
return;
|
162
|
+
}
|
163
|
+
if (type === "pointerover" && event.composedPath().includes(activeTooltipEl)) {
|
164
|
+
this.clearHoverTimeout(activeTooltipEl);
|
165
|
+
}
|
166
|
+
else if (type === "pointerout" && !hoverTimeouts.has(activeTooltipEl)) {
|
167
|
+
this.hoverTooltip(activeTooltipEl, false);
|
168
|
+
}
|
169
|
+
}
|
170
|
+
hoverEvent(event, value) {
|
171
|
+
const tooltip = this.queryTooltip(event.composedPath());
|
172
|
+
this.activeTooltipHover(event);
|
173
|
+
if (!tooltip) {
|
174
|
+
return;
|
175
|
+
}
|
176
|
+
this.hoverTooltip(tooltip, value);
|
177
|
+
}
|
178
|
+
focusEvent(event, value) {
|
179
|
+
const tooltip = this.queryTooltip(event.composedPath());
|
180
|
+
if (!tooltip || tooltip === this.clickedTooltip) {
|
181
|
+
this.clickedTooltip = null;
|
182
|
+
return;
|
183
|
+
}
|
184
|
+
this.focusTooltip(tooltip, value);
|
185
|
+
}
|
186
|
+
}
|
187
|
+
|
188
|
+
const tooltipCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0.01}}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}:host([hidden]){display:none}:host{display:block;position:absolute;z-index:999}.calcite-floating-ui-anim{position:relative;transition:var(--calcite-floating-ui-transition);visibility:hidden;transition-property:transform, visibility, opacity;opacity:0;box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);z-index:1;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;visibility:visible;transform:translate(0)}:host([calcite-hydrated-hidden]){visibility:hidden !important;pointer-events:none}.arrow,.arrow::before{position:absolute;inline-size:8px;block-size:8px;z-index:-1}.arrow::before{content:\"\";--tw-shadow:0 4px 8px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);--tw-shadow-colored:0 4px 8px -1px var(--tw-shadow-color), 0 2px 4px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);transform:rotate(45deg);background:var(--calcite-ui-foreground-1)}:host([data-placement^=top]) .arrow{inset-block-end:-4px}:host([data-placement^=bottom]) .arrow{inset-block-start:-4px}:host([data-placement^=left]) .arrow{direction:ltr;inset-inline-end:-4px}:host([data-placement^=right]) .arrow{direction:ltr;inset-inline-start:-4px}.container{position:relative;overflow:hidden;border-radius:0.25rem;background-color:var(--calcite-ui-foreground-1);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)}";
|
189
|
+
|
190
|
+
const manager = new TooltipManager();
|
191
|
+
const Tooltip = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
192
|
+
constructor() {
|
193
|
+
super();
|
194
|
+
this.__registerHost();
|
195
|
+
this.__attachShadow();
|
196
|
+
// --------------------------------------------------------------------------
|
197
|
+
//
|
198
|
+
// Properties
|
199
|
+
//
|
200
|
+
// --------------------------------------------------------------------------
|
201
|
+
/** Closes the component when the `referenceElement` is clicked. */
|
202
|
+
this.closeOnClick = false;
|
203
|
+
/**
|
204
|
+
* Offset the position of the component away from the `referenceElement`.
|
205
|
+
*
|
206
|
+
* @default 6
|
207
|
+
*/
|
208
|
+
this.offsetDistance = defaultOffsetDistance;
|
209
|
+
/**
|
210
|
+
* Offset the position of the component along the `referenceElement`.
|
211
|
+
*/
|
212
|
+
this.offsetSkidding = 0;
|
213
|
+
/**
|
214
|
+
* When `true`, the component is open.
|
215
|
+
*/
|
216
|
+
this.open = false;
|
217
|
+
/**
|
218
|
+
* Determines the type of positioning to use for the overlaid content.
|
219
|
+
*
|
220
|
+
* Using `"absolute"` will work for most cases. The component will be positioned inside of overflowing parent containers and will affect the container's layout.
|
221
|
+
*
|
222
|
+
* The `"fixed"` value should be used to escape an overflowing parent container, or when the reference element's `position` CSS property is `"fixed"`.
|
223
|
+
*
|
224
|
+
*/
|
225
|
+
this.overlayPositioning = "absolute";
|
226
|
+
/**
|
227
|
+
* Determines where the component will be positioned relative to the `referenceElement`.
|
228
|
+
*
|
229
|
+
* @see [LogicalPlacement](https://github.com/Esri/calcite-components/blob/master/src/utils/floating-ui.ts#L25)
|
230
|
+
*/
|
231
|
+
this.placement = "auto";
|
232
|
+
this.guid = `calcite-tooltip-${guid()}`;
|
233
|
+
this.hasLoaded = false;
|
234
|
+
// --------------------------------------------------------------------------
|
235
|
+
//
|
236
|
+
// Private Methods
|
237
|
+
//
|
238
|
+
// --------------------------------------------------------------------------
|
239
|
+
this.setUpReferenceElement = (warn = true) => {
|
240
|
+
this.removeReferences();
|
241
|
+
this.effectiveReferenceElement = this.getReferenceElement();
|
242
|
+
connectFloatingUI(this, this.effectiveReferenceElement, this.el);
|
243
|
+
const { el, referenceElement, effectiveReferenceElement } = this;
|
244
|
+
if (warn && referenceElement && !effectiveReferenceElement) {
|
245
|
+
console.warn(`${el.tagName}: reference-element id "${referenceElement}" was not found.`, {
|
246
|
+
el
|
247
|
+
});
|
248
|
+
}
|
249
|
+
this.addReferences();
|
250
|
+
};
|
251
|
+
this.getId = () => {
|
252
|
+
return this.el.id || this.guid;
|
253
|
+
};
|
254
|
+
this.addReferences = () => {
|
255
|
+
const { effectiveReferenceElement } = this;
|
256
|
+
if (!effectiveReferenceElement) {
|
257
|
+
return;
|
258
|
+
}
|
259
|
+
const id = this.getId();
|
260
|
+
if ("setAttribute" in effectiveReferenceElement) {
|
261
|
+
effectiveReferenceElement.setAttribute(ARIA_DESCRIBED_BY, id);
|
262
|
+
}
|
263
|
+
manager.registerElement(effectiveReferenceElement, this.el);
|
264
|
+
};
|
265
|
+
this.removeReferences = () => {
|
266
|
+
const { effectiveReferenceElement } = this;
|
267
|
+
if (!effectiveReferenceElement) {
|
268
|
+
return;
|
269
|
+
}
|
270
|
+
if ("removeAttribute" in effectiveReferenceElement) {
|
271
|
+
effectiveReferenceElement.removeAttribute(ARIA_DESCRIBED_BY);
|
272
|
+
}
|
273
|
+
manager.unregisterElement(effectiveReferenceElement);
|
274
|
+
};
|
275
|
+
}
|
276
|
+
offsetDistanceOffsetHandler() {
|
277
|
+
this.reposition(true);
|
278
|
+
}
|
279
|
+
offsetSkiddingHandler() {
|
280
|
+
this.reposition(true);
|
281
|
+
}
|
282
|
+
openHandler(value) {
|
283
|
+
if (value) {
|
284
|
+
this.reposition(true);
|
285
|
+
}
|
286
|
+
else {
|
287
|
+
updateAfterClose(this.el);
|
288
|
+
}
|
289
|
+
}
|
290
|
+
overlayPositioningHandler() {
|
291
|
+
this.reposition(true);
|
292
|
+
}
|
293
|
+
placementHandler() {
|
294
|
+
this.reposition(true);
|
295
|
+
}
|
296
|
+
referenceElementHandler() {
|
297
|
+
this.setUpReferenceElement();
|
298
|
+
}
|
299
|
+
// --------------------------------------------------------------------------
|
300
|
+
//
|
301
|
+
// Lifecycle
|
302
|
+
//
|
303
|
+
// --------------------------------------------------------------------------
|
304
|
+
connectedCallback() {
|
305
|
+
this.setUpReferenceElement(this.hasLoaded);
|
306
|
+
}
|
307
|
+
componentDidLoad() {
|
308
|
+
if (this.referenceElement && !this.effectiveReferenceElement) {
|
309
|
+
this.setUpReferenceElement();
|
310
|
+
}
|
311
|
+
this.reposition(true);
|
312
|
+
this.hasLoaded = true;
|
313
|
+
}
|
314
|
+
disconnectedCallback() {
|
315
|
+
this.removeReferences();
|
316
|
+
disconnectFloatingUI(this, this.effectiveReferenceElement, this.el);
|
317
|
+
}
|
318
|
+
// --------------------------------------------------------------------------
|
319
|
+
//
|
320
|
+
// Public Methods
|
321
|
+
//
|
322
|
+
// --------------------------------------------------------------------------
|
323
|
+
/**
|
324
|
+
* Updates the position of the component.
|
325
|
+
*
|
326
|
+
* @param delayed
|
327
|
+
*/
|
328
|
+
async reposition(delayed = false) {
|
329
|
+
const { el, effectiveReferenceElement, placement, overlayPositioning, offsetDistance, offsetSkidding, arrowEl } = this;
|
330
|
+
return reposition(this, {
|
331
|
+
floatingEl: el,
|
332
|
+
referenceEl: effectiveReferenceElement,
|
333
|
+
overlayPositioning,
|
334
|
+
placement,
|
335
|
+
offsetDistance,
|
336
|
+
offsetSkidding,
|
337
|
+
includeArrow: true,
|
338
|
+
arrowEl,
|
339
|
+
type: "tooltip"
|
340
|
+
}, delayed);
|
341
|
+
}
|
342
|
+
getReferenceElement() {
|
343
|
+
const { referenceElement, el } = this;
|
344
|
+
return ((typeof referenceElement === "string"
|
345
|
+
? queryElementRoots(el, { id: referenceElement })
|
346
|
+
: referenceElement) || null);
|
347
|
+
}
|
348
|
+
// --------------------------------------------------------------------------
|
349
|
+
//
|
350
|
+
// Render Methods
|
351
|
+
//
|
352
|
+
// --------------------------------------------------------------------------
|
353
|
+
render() {
|
354
|
+
const { effectiveReferenceElement, label, open } = this;
|
355
|
+
const displayed = effectiveReferenceElement && open;
|
356
|
+
const hidden = !displayed;
|
357
|
+
return (h(Host, { "aria-hidden": toAriaBoolean(hidden), "aria-label": label, "aria-live": "polite", "calcite-hydrated-hidden": hidden, id: this.getId(), role: "tooltip" }, h("div", { class: {
|
358
|
+
[FloatingCSS.animation]: true,
|
359
|
+
[FloatingCSS.animationActive]: displayed
|
360
|
+
} }, h("div", { class: CSS.arrow, ref: (arrowEl) => (this.arrowEl = arrowEl) }), h("div", { class: CSS.container }, h("slot", null)))));
|
361
|
+
}
|
362
|
+
get el() { return this; }
|
363
|
+
static get watchers() { return {
|
364
|
+
"offsetDistance": ["offsetDistanceOffsetHandler"],
|
365
|
+
"offsetSkidding": ["offsetSkiddingHandler"],
|
366
|
+
"open": ["openHandler"],
|
367
|
+
"overlayPositioning": ["overlayPositioningHandler"],
|
368
|
+
"placement": ["placementHandler"],
|
369
|
+
"referenceElement": ["referenceElementHandler"]
|
370
|
+
}; }
|
371
|
+
static get style() { return tooltipCss; }
|
372
|
+
}, [1, "calcite-tooltip", {
|
373
|
+
"closeOnClick": [516, "close-on-click"],
|
374
|
+
"label": [1],
|
375
|
+
"offsetDistance": [514, "offset-distance"],
|
376
|
+
"offsetSkidding": [514, "offset-skidding"],
|
377
|
+
"open": [516],
|
378
|
+
"overlayPositioning": [513, "overlay-positioning"],
|
379
|
+
"placement": [513],
|
380
|
+
"referenceElement": [1, "reference-element"],
|
381
|
+
"effectiveReferenceElement": [32],
|
382
|
+
"reposition": [64]
|
383
|
+
}]);
|
384
|
+
function defineCustomElement() {
|
385
|
+
if (typeof customElements === "undefined") {
|
386
|
+
return;
|
387
|
+
}
|
388
|
+
const components = ["calcite-tooltip"];
|
389
|
+
components.forEach(tagName => { switch (tagName) {
|
390
|
+
case "calcite-tooltip":
|
391
|
+
if (!customElements.get(tagName)) {
|
392
|
+
customElements.define(tagName, Tooltip);
|
393
|
+
}
|
394
|
+
break;
|
395
|
+
} });
|
396
|
+
}
|
397
|
+
defineCustomElement();
|
398
|
+
|
399
|
+
export { Tooltip as T, defineCustomElement as d };
|