@esri/solutions-components 0.6.13 → 0.6.15
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/assets/t9n/layer-table/resources.json +1 -1
- package/dist/assets/t9n/layer-table/resources_en.json +1 -1
- package/dist/assets/t9n/map-layer-picker/resources.json +4 -0
- package/dist/assets/t9n/map-layer-picker/resources_en.json +4 -0
- package/dist/cjs/basemap-gallery_6.cjs.entry.js +20 -5
- package/dist/cjs/buffer-tools_4.cjs.entry.js +1 -1
- package/dist/cjs/calcite-chip_3.cjs.entry.js +803 -0
- package/dist/cjs/calcite-combobox_6.cjs.entry.js +76 -28
- package/dist/cjs/card-manager_3.cjs.entry.js +112 -54
- package/dist/cjs/crowdsource-manager.cjs.entry.js +18 -5
- package/dist/cjs/{downloadUtils-fb4744e0.js → downloadUtils-34a515ad.js} +2 -2
- package/dist/cjs/edit-card_2.cjs.entry.js +29 -18
- package/dist/cjs/{index.es-372e33de.js → index.es-0ba11065.js} +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/map-select-tools_3.cjs.entry.js +3 -3
- package/dist/cjs/{mapViewUtils-a4dd36ec.js → mapViewUtils-a2884698.js} +39 -55
- package/dist/cjs/public-notification.cjs.entry.js +3 -3
- package/dist/cjs/{publicNotificationStore-b69862af.js → publicNotificationStore-610bd880.js} +0 -4
- package/dist/cjs/solutions-components.cjs.js +1 -1
- package/dist/collection/components/basemap-gallery/basemap-gallery.js +23 -1
- package/dist/collection/components/card-manager/card-manager.js +2 -2
- package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +171 -5
- package/dist/collection/components/edit-card/edit-card.js +44 -21
- package/dist/collection/components/layer-table/layer-table.js +127 -47
- package/dist/collection/components/map-card/map-card.js +115 -5
- package/dist/collection/components/map-layer-picker/map-layer-picker.css +6 -0
- package/dist/collection/components/map-layer-picker/map-layer-picker.js +107 -27
- package/dist/collection/components/map-picker/map-picker.css +5 -1
- package/dist/collection/components/map-picker/map-picker.js +3 -3
- package/dist/collection/components/map-tools/map-tools.js +104 -1
- package/dist/collection/demos/crowdsource-manager.html +2 -2
- package/dist/collection/demos/new-public-notification.html +3 -3
- package/dist/collection/utils/interfaces.ts +12 -1
- package/dist/collection/utils/mapViewUtils.js +38 -52
- package/dist/collection/utils/mapViewUtils.ts +41 -57
- package/dist/collection/utils/publicNotificationStore.js +0 -4
- package/dist/collection/utils/publicNotificationStore.ts +0 -4
- package/dist/components/basemap-gallery2.js +2 -0
- package/dist/components/card-manager2.js +2 -2
- package/dist/components/crowdsource-manager.js +27 -6
- package/dist/components/edit-card2.js +29 -18
- package/dist/components/layer-table2.js +136 -78
- package/dist/components/map-card2.js +17 -5
- package/dist/components/map-layer-picker2.js +114 -52
- package/dist/components/map-picker2.js +4 -4
- package/dist/components/map-select-tools2.js +55 -43
- package/dist/components/map-tools2.js +20 -1
- package/dist/components/mapViewUtils.js +39 -53
- package/dist/components/public-notification.js +1 -1
- package/dist/components/publicNotificationStore.js +0 -4
- package/dist/components/refine-selection2.js +61 -49
- package/dist/esm/basemap-gallery_6.entry.js +20 -5
- package/dist/esm/buffer-tools_4.entry.js +1 -1
- package/dist/esm/calcite-chip_3.entry.js +797 -0
- package/dist/esm/calcite-combobox_6.entry.js +76 -28
- package/dist/esm/card-manager_3.entry.js +112 -54
- package/dist/esm/crowdsource-manager.entry.js +18 -5
- package/dist/esm/{downloadUtils-67c7a6c8.js → downloadUtils-ac67a786.js} +2 -2
- package/dist/esm/edit-card_2.entry.js +29 -18
- package/dist/esm/{index.es-59a67d3d.js → index.es-f553598f.js} +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/map-select-tools_3.entry.js +3 -3
- package/dist/esm/{mapViewUtils-00a04d52.js → mapViewUtils-8141d8c1.js} +39 -53
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm/public-notification.entry.js +3 -3
- package/dist/esm/{publicNotificationStore-90a6a274.js → publicNotificationStore-dcf39a55.js} +0 -4
- package/dist/esm/solutions-components.js +1 -1
- package/dist/solutions-components/demos/crowdsource-manager.html +2 -2
- package/dist/solutions-components/demos/new-public-notification.html +3 -3
- package/dist/solutions-components/p-08b52ed8.entry.js +6 -0
- package/dist/solutions-components/p-16362eb4.js +36 -0
- package/dist/solutions-components/{p-3691a072.js → p-1ab414e0.js} +2 -2
- package/dist/solutions-components/{p-73ab9d9a.entry.js → p-3d7aa1b2.entry.js} +1 -1
- package/dist/solutions-components/{p-9a8c51bf.entry.js → p-57cf6784.entry.js} +1 -1
- package/dist/solutions-components/p-64b22d57.entry.js +6 -0
- package/dist/solutions-components/p-654dd5df.entry.js +6 -0
- package/dist/solutions-components/{p-0219a1a9.entry.js → p-83a52f9e.entry.js} +6 -6
- package/dist/solutions-components/{p-f9166fcb.js → p-a26711e8.js} +1 -1
- package/dist/solutions-components/{p-b892e595.entry.js → p-b9d29f30.entry.js} +1 -1
- package/dist/solutions-components/{p-1b41181b.js → p-c8d0ce92.js} +2 -2
- package/dist/solutions-components/p-ee7e2f00.entry.js +34 -0
- package/dist/solutions-components/p-ef6ec812.entry.js +6 -0
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/interfaces.ts +12 -1
- package/dist/solutions-components/utils/mapViewUtils.ts +41 -57
- package/dist/solutions-components/utils/publicNotificationStore.ts +0 -4
- package/dist/types/components/basemap-gallery/basemap-gallery.d.ts +5 -0
- package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +37 -1
- package/dist/types/components/edit-card/edit-card.d.ts +10 -9
- package/dist/types/components/layer-table/layer-table.d.ts +40 -0
- package/dist/types/components/map-card/map-card.d.ts +25 -1
- package/dist/types/components/map-layer-picker/map-layer-picker.d.ts +50 -3
- package/dist/types/components/map-picker/map-picker.d.ts +2 -2
- package/dist/types/components/map-tools/map-tools.d.ts +21 -1
- package/dist/types/components.d.ts +182 -2
- package/dist/types/preact.d.ts +6 -3
- package/dist/types/utils/interfaces.d.ts +10 -1
- package/dist/types/utils/mapViewUtils.d.ts +8 -24
- package/dist/types/utils/publicNotificationStore.d.ts +0 -2
- package/package.json +1 -1
- package/dist/cjs/calcite-chip.cjs.entry.js +0 -259
- package/dist/cjs/calcite-notice.cjs.entry.js +0 -139
- package/dist/cjs/calcite-tooltip.cjs.entry.js +0 -439
- package/dist/esm/calcite-chip.entry.js +0 -255
- package/dist/esm/calcite-notice.entry.js +0 -135
- package/dist/esm/calcite-tooltip.entry.js +0 -435
- package/dist/solutions-components/p-2cff8331.entry.js +0 -6
- package/dist/solutions-components/p-3a6c8fc3.entry.js +0 -6
- package/dist/solutions-components/p-3b1fc7a2.entry.js +0 -6
- package/dist/solutions-components/p-767002cd.js +0 -36
- package/dist/solutions-components/p-a776b7e6.entry.js +0 -6
- package/dist/solutions-components/p-be36d5ed.entry.js +0 -22
- package/dist/solutions-components/p-c644edf5.entry.js +0 -11
- package/dist/solutions-components/p-cfd88a2f.entry.js +0 -11
@@ -0,0 +1,797 @@
|
|
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 { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-c7de2486.js';
|
7
|
+
import { r as slotChangeHasAssignedElement, t as toAriaBoolean, v as setRequestedIcon, g as getSlotted, q as queryElementRoots, i as isPrimaryPointerButton, A as getShadowRootNode } from './dom-2b326ec3.js';
|
8
|
+
import { c as connectConditionalSlotComponent, d as disconnectConditionalSlotComponent } from './conditionalSlot-dff8f839.js';
|
9
|
+
import { a as setComponentLoaded, s as setUpLoadableComponent, c as componentFocusable } from './loadable-f848be11.js';
|
10
|
+
import { u as updateMessages, c as connectMessages, d as disconnectMessages, s as setUpMessages } from './t9n-9791aa0c.js';
|
11
|
+
import { c as connectInteractive, u as updateHostInteraction, d as disconnectInteractive } from './interactive-bd6837bc.js';
|
12
|
+
import { c as connectLocalized, d as disconnectLocalized } from './locale-00000ab4.js';
|
13
|
+
import { c as createObserver } from './observers-95c50046.js';
|
14
|
+
import { i as isActivationKey } from './key-02fa06ae.js';
|
15
|
+
import { K as KindIcons } from './resources-efae7280.js';
|
16
|
+
import { c as connectFloatingUI, b as defaultOffsetDistance, a as disconnectFloatingUI, r as reposition, F as FloatingCSS } from './floating-ui-9f8e4ed4.js';
|
17
|
+
import { g as guid } from './guid-70cda807.js';
|
18
|
+
import { o as onToggleOpenCloseComponent } from './openCloseComponent-9fce341c.js';
|
19
|
+
import { F as FloatingArrow } from './FloatingArrow-4a1b35d6.js';
|
20
|
+
import './resources-1e6d76df.js';
|
21
|
+
import './debounce-229b1a22.js';
|
22
|
+
|
23
|
+
/*!
|
24
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
25
|
+
* See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
|
26
|
+
* v1.6.1
|
27
|
+
*/
|
28
|
+
const CSS$2 = {
|
29
|
+
title: "title",
|
30
|
+
close: "close",
|
31
|
+
imageContainer: "image-container",
|
32
|
+
chipIcon: "chip-icon",
|
33
|
+
textSlotted: "text--slotted",
|
34
|
+
container: "container",
|
35
|
+
imageSlotted: "image--slotted",
|
36
|
+
closable: "closable",
|
37
|
+
multiple: "multiple",
|
38
|
+
selectable: "selectable",
|
39
|
+
selectIcon: "select-icon",
|
40
|
+
selectIconActive: "select-icon--active",
|
41
|
+
nonInteractive: "non-interactive",
|
42
|
+
isCircle: "is-circle",
|
43
|
+
};
|
44
|
+
const SLOTS$1 = {
|
45
|
+
image: "image",
|
46
|
+
};
|
47
|
+
const ICONS = {
|
48
|
+
close: "x",
|
49
|
+
unchecked: "circle",
|
50
|
+
checkedSingle: "circle-f",
|
51
|
+
checked: "check-circle-f",
|
52
|
+
};
|
53
|
+
|
54
|
+
const chipCss = ":host([disabled]){cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host([scale=s]){block-size:1.5rem;font-size:var(--calcite-font-size--2);--calcite-chip-spacing-s-internal:0.25rem;--calcite-chip-spacing-l-internal:0.5rem}:host([scale=s]) .close,:host([scale=s]) .select-icon--active{block-size:1rem;inline-size:1rem}:host([scale=s]) .image-container{block-size:1.25rem;inline-size:1.25rem}:host([scale=s]) .container.is-circle{block-size:1.5rem;inline-size:1.5rem}:host([scale=m]){block-size:2rem;font-size:var(--calcite-font-size--1);--calcite-chip-spacing-s-internal:0.375rem;--calcite-chip-spacing-l-internal:0.5rem}:host([scale=m]) .close,:host([scale=m]) .image-container,:host([scale=m]) .select-icon--active{block-size:1.5rem;inline-size:1.5rem}:host([scale=m]) .container.is-circle{block-size:2rem;inline-size:2rem}:host([scale=l]){block-size:2.75rem;font-size:var(--calcite-font-size-0);--calcite-chip-spacing-s-internal:0.5rem;--calcite-chip-spacing-l-internal:0.75rem}:host([scale=l]) .image-container,:host([scale=l]) .close,:host([scale=l]) .select-icon--active{block-size:2rem;inline-size:2rem}:host([scale=l]) .container.is-circle{block-size:2.75rem;inline-size:2.75rem}:host{display:inline-flex;cursor:default;border-radius:9999px}.container{box-sizing:border-box;display:inline-flex;block-size:100%;max-inline-size:100%;align-items:center;justify-content:center;border-radius:9999px;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-1);font-weight:var(--calcite-font-weight-medium);outline-color:transparent}.container:not(.is-circle){padding-inline:var(--calcite-chip-spacing-s-internal)}.container.selectable{cursor:pointer}.container:not(.non-interactive):focus{outline:2px solid var(--calcite-ui-focus-color, var(--calcite-ui-brand));outline-offset:calc(\n 2px *\n calc(\n 1 -\n 2 * clamp(\n 0,\n var(--calcite-ui-focus-offset-invert),\n 1\n )\n )\n )}:host([scale=s]) .container.image--slotted{padding-inline-start:calc(0.125rem / 2)}:host([scale=s]) .container.is-circle{padding-inline:0}.container.text--slotted .title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-inline:var(--calcite-chip-spacing-s-internal)}.container:not(.text--slotted) .title{display:none}.container:not(.image--slotted) .image-container{display:none}.container.closable{padding-inline-end:calc(var(--calcite-chip-spacing-l-internal) / 2)}.container:not(.is-circle).image--slotted{padding-inline-start:calc(var(--calcite-chip-spacing-l-internal) / 2)}.container:not(.is-circle).image--slotted .image-container{margin-inline-end:var(--calcite-chip-spacing-s-internal)}.container:not(.is-circle).image--slotted .image-container~.chip-icon{margin-inline-start:var(--calcite-chip-spacing-s-internal)}.container:not(.is-circle).selectable:not(.text--slotted) .chip-icon{margin-inline-end:var(--calcite-chip-spacing-s-internal)}.container:not(.is-circle):not(.selectable):not(.text--slotted) .chip-icon{margin-inline-start:var(--calcite-chip-spacing-s-internal)}.container:not(.is-circle):not(.text--slotted) .chip-icon{margin-inline-end:var(--calcite-chip-spacing-s-internal)}.container:not(.is-circle):not(.text-slotted).image--slotted .image-container{margin-inline-end:var(--calcite-chip-spacing-s-internal)}.container:not(.is-circle):not(.closable):not(.text--slotted).image--slotted.selectable .image-container{margin-inline-end:0}.container:not(.is-circle):not(.closable):not(.text--slotted).image--slotted.selectable .image-container~.chip-icon{margin-inline-start:calc(var(--calcite-chip-spacing-s-internal) * 2)}.chip-icon{position:relative;margin-block:0px;display:inline-flex;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);margin-inline:var(--calcite-chip-spacing-s-internal)}.image-container{display:inline-flex;overflow:hidden;align-items:center;justify-content:center;pointer-events:none}.close{margin:0px;cursor:pointer;align-items:center;border-style:none;background-color:transparent;color:var(--calcite-ui-text-1);outline-color:transparent;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;-webkit-appearance:none;display:flex;border-radius:50%;align-content:center;justify-content:center;--calcite-chip-transparent-hover:var(--calcite-button-transparent-hover);--calcite-chip-transparent-press:var(--calcite-button-transparent-press)}.close:hover{background-color:var(--calcite-chip-transparent-hover)}.close:focus{background-color:var(--calcite-chip-transparent-hover);outline:2px solid var(--calcite-ui-focus-color, var(--calcite-ui-brand));outline-offset:calc(\n -2px *\n calc(\n 1 -\n 2 * clamp(\n 0,\n var(--calcite-ui-focus-offset-invert),\n 1\n )\n )\n )}.close:active{background-color:var(--calcite-chip-transparent-press)}.close calcite-icon{color:inherit}.select-icon{align-self:center;justify-content:center;align-items:center;display:flex;inset-block-start:-1px;position:relative;visibility:hidden;inline-size:0;opacity:0;transition:opacity 0.15s ease-in-out, inline-size 0.15s ease-in-out}.select-icon.select-icon--active{visibility:visible;opacity:0.5}.container:not(.is-circle).image--slotted .select-icon.select-icon--active{margin-inline-end:var(--calcite-chip-spacing-s-internal)}:host([selected]) .select-icon{opacity:1}.container:hover .select-icon--active{opacity:1}slot[name=image]::slotted(*){display:flex;block-size:100%;inline-size:100%;overflow:hidden;border-radius:50%}:host([kind=neutral]){background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1)}:host([kind=neutral]) .container{border-color:transparent}:host([kind=neutral]) .close{color:var(--calcite-ui-text-3)}:host([kind=neutral]) .chip-icon{color:var(--calcite-ui-icon-color, var(--calcite-ui-text-3))}:host([kind=inverse]){background-color:var(--calcite-ui-inverse);color:var(--calcite-ui-text-inverse)}:host([kind=inverse]) .container{border-color:transparent}:host([kind=inverse]) .close{color:var(--calcite-ui-text-inverse)}:host([kind=inverse]) .chip-icon{color:var(--calcite-ui-icon-color, var(--calcite-ui-text-inverse))}:host([kind=brand]){background-color:var(--calcite-ui-brand);color:var(--calcite-ui-text-inverse)}:host([kind=brand]) .container{border-color:transparent}:host([kind=brand]) .close{color:var(--calcite-ui-text-inverse)}:host([kind=brand]) .chip-icon{color:var(--calcite-ui-icon-color, var(--calcite-ui-text-inverse))}:host([appearance=outline-fill]),:host([appearance=outline]){background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-1)}:host([appearance=outline-fill]) .close,:host([appearance=outline]) .close{color:var(--calcite-ui-text-3)}:host([appearance=outline-fill]) .chip-icon,:host([appearance=outline]) .chip-icon{color:var(--calcite-ui-icon-color, var(--calcite-ui-text-3))}:host([appearance=outline-fill]){background-color:var(--calcite-ui-foreground-1)}:host([appearance=outline]){background-color:transparent}:host([kind=neutral][appearance=outline-fill]) .container,:host([kind=neutral][appearance=outline]) .container{border-color:var(--calcite-ui-border-1)}:host([kind=inverse][appearance=outline-fill]) .container,:host([kind=inverse][appearance=outline]) .container{border-color:var(--calcite-ui-border-inverse)}:host([kind=brand][appearance=outline-fill]) .container,:host([kind=brand][appearance=outline]) .container{border-color:var(--calcite-ui-brand)}:host([kind=brand][appearance=solid]) button,:host([kind=inverse][appearance=solid]) button{outline-color:var(--calcite-ui-text-inverse)}:host([closed]){display:none}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}:host([hidden]){display:none}[hidden]{display:none}";
|
55
|
+
|
56
|
+
const Chip = class {
|
57
|
+
constructor(hostRef) {
|
58
|
+
registerInstance(this, hostRef);
|
59
|
+
this.calciteChipClose = createEvent(this, "calciteChipClose", 6);
|
60
|
+
this.calciteChipSelect = createEvent(this, "calciteChipSelect", 6);
|
61
|
+
this.calciteInternalChipKeyEvent = createEvent(this, "calciteInternalChipKeyEvent", 6);
|
62
|
+
this.mutationObserver = createObserver("mutation", () => this.updateHasText());
|
63
|
+
// --------------------------------------------------------------------------
|
64
|
+
//
|
65
|
+
// Private Methods
|
66
|
+
//
|
67
|
+
// --------------------------------------------------------------------------
|
68
|
+
this.close = () => {
|
69
|
+
this.calciteChipClose.emit();
|
70
|
+
this.selected = false;
|
71
|
+
this.closed = true;
|
72
|
+
};
|
73
|
+
this.closeButtonKeyDownHandler = (event) => {
|
74
|
+
if (isActivationKey(event.key)) {
|
75
|
+
event.preventDefault();
|
76
|
+
this.close();
|
77
|
+
}
|
78
|
+
};
|
79
|
+
this.handleSlotImageChange = (event) => {
|
80
|
+
this.hasImage = slotChangeHasAssignedElement(event);
|
81
|
+
};
|
82
|
+
this.handleEmittingEvent = () => {
|
83
|
+
if (this.interactive) {
|
84
|
+
this.calciteChipSelect.emit();
|
85
|
+
}
|
86
|
+
};
|
87
|
+
this.disabled = false;
|
88
|
+
this.appearance = "solid";
|
89
|
+
this.kind = "neutral";
|
90
|
+
this.closable = false;
|
91
|
+
this.icon = undefined;
|
92
|
+
this.iconFlipRtl = false;
|
93
|
+
this.scale = "m";
|
94
|
+
this.label = undefined;
|
95
|
+
this.value = undefined;
|
96
|
+
this.closed = false;
|
97
|
+
this.selectionMode = "none";
|
98
|
+
this.selected = false;
|
99
|
+
this.messageOverrides = undefined;
|
100
|
+
this.messages = undefined;
|
101
|
+
this.interactive = false;
|
102
|
+
this.defaultMessages = undefined;
|
103
|
+
this.effectiveLocale = undefined;
|
104
|
+
this.hasText = false;
|
105
|
+
this.hasImage = false;
|
106
|
+
}
|
107
|
+
onMessagesChange() {
|
108
|
+
/* wired up by t9n util */
|
109
|
+
}
|
110
|
+
effectiveLocaleChange() {
|
111
|
+
updateMessages(this, this.effectiveLocale);
|
112
|
+
}
|
113
|
+
// --------------------------------------------------------------------------
|
114
|
+
//
|
115
|
+
// Lifecycle
|
116
|
+
//
|
117
|
+
// --------------------------------------------------------------------------
|
118
|
+
connectedCallback() {
|
119
|
+
var _a;
|
120
|
+
connectConditionalSlotComponent(this);
|
121
|
+
connectInteractive(this);
|
122
|
+
connectLocalized(this);
|
123
|
+
connectMessages(this);
|
124
|
+
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
|
125
|
+
}
|
126
|
+
componentDidLoad() {
|
127
|
+
setComponentLoaded(this);
|
128
|
+
}
|
129
|
+
componentDidRender() {
|
130
|
+
updateHostInteraction(this);
|
131
|
+
}
|
132
|
+
disconnectedCallback() {
|
133
|
+
var _a;
|
134
|
+
disconnectConditionalSlotComponent(this);
|
135
|
+
disconnectInteractive(this);
|
136
|
+
disconnectLocalized(this);
|
137
|
+
disconnectMessages(this);
|
138
|
+
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
139
|
+
}
|
140
|
+
async componentWillLoad() {
|
141
|
+
setUpLoadableComponent(this);
|
142
|
+
{
|
143
|
+
await setUpMessages(this);
|
144
|
+
this.updateHasText();
|
145
|
+
}
|
146
|
+
}
|
147
|
+
//--------------------------------------------------------------------------
|
148
|
+
//
|
149
|
+
// Event Listeners
|
150
|
+
//
|
151
|
+
//--------------------------------------------------------------------------
|
152
|
+
keyDownHandler(event) {
|
153
|
+
if (event.target === this.el) {
|
154
|
+
switch (event.key) {
|
155
|
+
case " ":
|
156
|
+
case "Enter":
|
157
|
+
this.handleEmittingEvent();
|
158
|
+
event.preventDefault();
|
159
|
+
break;
|
160
|
+
case "ArrowRight":
|
161
|
+
case "ArrowLeft":
|
162
|
+
case "Home":
|
163
|
+
case "End":
|
164
|
+
this.calciteInternalChipKeyEvent.emit(event);
|
165
|
+
event.preventDefault();
|
166
|
+
break;
|
167
|
+
}
|
168
|
+
}
|
169
|
+
}
|
170
|
+
clickHandler() {
|
171
|
+
if (!this.interactive && this.closable) {
|
172
|
+
this.closeButtonEl.focus();
|
173
|
+
}
|
174
|
+
}
|
175
|
+
//--------------------------------------------------------------------------
|
176
|
+
//
|
177
|
+
// Public Methods
|
178
|
+
//
|
179
|
+
//--------------------------------------------------------------------------
|
180
|
+
/** Sets focus on the component. */
|
181
|
+
async setFocus() {
|
182
|
+
var _a, _b;
|
183
|
+
await componentFocusable(this);
|
184
|
+
if (!this.disabled && this.interactive) {
|
185
|
+
(_a = this.containerEl) === null || _a === void 0 ? void 0 : _a.focus();
|
186
|
+
}
|
187
|
+
else if (!this.disabled && this.closable) {
|
188
|
+
(_b = this.closeButtonEl) === null || _b === void 0 ? void 0 : _b.focus();
|
189
|
+
}
|
190
|
+
}
|
191
|
+
updateHasText() {
|
192
|
+
this.hasText = this.el.textContent.trim().length > 0;
|
193
|
+
}
|
194
|
+
//--------------------------------------------------------------------------
|
195
|
+
//
|
196
|
+
// Render Methods
|
197
|
+
//
|
198
|
+
//--------------------------------------------------------------------------
|
199
|
+
renderChipImage() {
|
200
|
+
return (h("div", { class: CSS$2.imageContainer }, h("slot", { name: SLOTS$1.image, onSlotchange: this.handleSlotImageChange })));
|
201
|
+
}
|
202
|
+
renderSelectionIcon() {
|
203
|
+
const icon = this.selectionMode === "multiple" && this.selected
|
204
|
+
? ICONS.checked
|
205
|
+
: this.selectionMode === "multiple"
|
206
|
+
? ICONS.unchecked
|
207
|
+
: this.selected
|
208
|
+
? ICONS.checkedSingle
|
209
|
+
: undefined;
|
210
|
+
return (h("div", { class: {
|
211
|
+
[CSS$2.selectIcon]: true,
|
212
|
+
[CSS$2.selectIconActive]: this.selectionMode === "multiple" || this.selected,
|
213
|
+
} }, h("calcite-icon", { icon: icon, scale: this.scale === "l" ? "m" : "s" })));
|
214
|
+
}
|
215
|
+
renderCloseButton() {
|
216
|
+
return (h("button", { "aria-label": this.messages.dismissLabel, class: CSS$2.close, onClick: this.close, onKeyDown: this.closeButtonKeyDownHandler, tabIndex: this.disabled ? -1 : 0,
|
217
|
+
// eslint-disable-next-line react/jsx-sort-props
|
218
|
+
ref: (el) => (this.closeButtonEl = el) }, h("calcite-icon", { icon: ICONS.close, scale: this.scale === "l" ? "m" : "s" })));
|
219
|
+
}
|
220
|
+
renderIcon() {
|
221
|
+
return (h("calcite-icon", { class: CSS$2.chipIcon, flipRtl: this.iconFlipRtl, icon: this.icon, scale: this.scale === "l" ? "m" : "s" }));
|
222
|
+
}
|
223
|
+
render() {
|
224
|
+
const disableInteraction = this.disabled || (!this.disabled && !this.interactive);
|
225
|
+
const role = this.selectionMode === "multiple" && this.interactive
|
226
|
+
? "checkbox"
|
227
|
+
: this.selectionMode !== "none" && this.interactive
|
228
|
+
? "radio"
|
229
|
+
: this.interactive
|
230
|
+
? "button"
|
231
|
+
: undefined;
|
232
|
+
return (h(Host, null, h("div", { "aria-checked": this.selectionMode !== "none" && this.interactive
|
233
|
+
? toAriaBoolean(this.selected)
|
234
|
+
: undefined, "aria-disabled": disableInteraction ? toAriaBoolean(this.disabled) : undefined, "aria-label": this.label, class: {
|
235
|
+
[CSS$2.container]: true,
|
236
|
+
[CSS$2.textSlotted]: this.hasText,
|
237
|
+
[CSS$2.imageSlotted]: this.hasImage,
|
238
|
+
[CSS$2.selectable]: this.selectionMode !== "none",
|
239
|
+
[CSS$2.multiple]: this.selectionMode === "multiple",
|
240
|
+
[CSS$2.closable]: this.closable,
|
241
|
+
[CSS$2.nonInteractive]: !this.interactive,
|
242
|
+
[CSS$2.isCircle]: !this.closable &&
|
243
|
+
!this.hasText &&
|
244
|
+
(!this.icon || !this.hasImage) &&
|
245
|
+
(this.selectionMode === "none" ||
|
246
|
+
(!!this.selectionMode && this.selectionMode !== "multiple" && !this.selected)),
|
247
|
+
}, onClick: this.handleEmittingEvent, role: role, tabIndex: disableInteraction ? -1 : 0,
|
248
|
+
// eslint-disable-next-line react/jsx-sort-props
|
249
|
+
ref: (el) => (this.containerEl = el) }, this.selectionMode !== "none" && this.renderSelectionIcon(), this.renderChipImage(), this.icon && this.renderIcon(), h("span", { class: CSS$2.title }, h("slot", null)), this.closable && this.renderCloseButton())));
|
250
|
+
}
|
251
|
+
static get assetsDirs() { return ["assets"]; }
|
252
|
+
get el() { return getElement(this); }
|
253
|
+
static get watchers() { return {
|
254
|
+
"messageOverrides": ["onMessagesChange"],
|
255
|
+
"effectiveLocale": ["effectiveLocaleChange"]
|
256
|
+
}; }
|
257
|
+
};
|
258
|
+
Chip.style = chipCss;
|
259
|
+
|
260
|
+
/*!
|
261
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
262
|
+
* See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
|
263
|
+
* v1.6.1
|
264
|
+
*/
|
265
|
+
const SLOTS = {
|
266
|
+
title: "title",
|
267
|
+
message: "message",
|
268
|
+
link: "link",
|
269
|
+
actionsEnd: "actions-end",
|
270
|
+
};
|
271
|
+
const CSS$1 = {
|
272
|
+
actionsEnd: "actions-end",
|
273
|
+
close: "notice-close",
|
274
|
+
container: "container",
|
275
|
+
content: "notice-content",
|
276
|
+
icon: "notice-icon",
|
277
|
+
};
|
278
|
+
|
279
|
+
const noticeCss = ":host([scale=s]){--calcite-notice-spacing-token-small:0.5rem;--calcite-notice-spacing-token-large:0.75rem}:host([scale=s]) .container slot[name=title]::slotted(*),:host([scale=s]) .container *::slotted([slot=title]){margin-block:0.125rem;font-size:var(--calcite-font-size--1);line-height:1.375}:host([scale=s]) .container slot[name=message]::slotted(*),:host([scale=s]) .container *::slotted([slot=message]){margin-block:0.125rem;font-size:var(--calcite-font-size--2);line-height:1.375}:host([scale=s]) ::slotted(calcite-link){margin-block:0.125rem;font-size:var(--calcite-font-size--2);line-height:1.375}:host([scale=s]) .notice-close{padding:0.5rem}:host([scale=m]){--calcite-notice-spacing-token-small:0.75rem;--calcite-notice-spacing-token-large:1rem}:host([scale=m]) .container slot[name=title]::slotted(*),:host([scale=m]) .container *::slotted([slot=title]){margin-block:0.125rem;font-size:var(--calcite-font-size-0);line-height:1.375}:host([scale=m]) .container slot[name=message]::slotted(*),:host([scale=m]) .container *::slotted([slot=message]){margin-block:0.125rem;font-size:var(--calcite-font-size--1);line-height:1.375}:host([scale=m]) ::slotted(calcite-link){margin-block:0.125rem;font-size:var(--calcite-font-size--1);line-height:1.375}:host([scale=l]){--calcite-notice-spacing-token-small:1rem;--calcite-notice-spacing-token-large:1.25rem}:host([scale=l]) .container slot[name=title]::slotted(*),:host([scale=l]) .container *::slotted([slot=title]){margin-block:0.125rem;font-size:var(--calcite-font-size-1);line-height:1.375}:host([scale=l]) .container slot[name=message]::slotted(*),:host([scale=l]) .container *::slotted([slot=message]){margin-block:0.125rem;font-size:var(--calcite-font-size-0);line-height:1.375}:host([scale=l]) ::slotted(calcite-link){margin-block:0.125rem;font-size:var(--calcite-font-size-0);line-height:1.375}:host([width=auto]){--calcite-notice-width:auto}:host([width=half]){--calcite-notice-width:50%}:host([width=full]){--calcite-notice-width:100%}:host{margin-inline:auto;display:none;max-inline-size:100%;align-items:center;inline-size:var(--calcite-notice-width)}.container{pointer-events:none;margin-block:0px;box-sizing:border-box;display:none;inline-size:100%;background-color:var(--calcite-ui-foreground-1);opacity:0;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;max-block-size:0;text-align:start;border-inline-start:0px solid;box-shadow:0 0 0 0 transparent}.notice-close{outline-color:transparent}.notice-close:focus{outline:2px solid var(--calcite-ui-focus-color, var(--calcite-ui-brand));outline-offset:calc(\n -2px *\n calc(\n 1 -\n 2 * clamp(\n 0,\n var(--calcite-ui-focus-offset-invert),\n 1\n )\n )\n )}:host{display:flex}:host([open]) .container{pointer-events:auto;display:flex;max-block-size:100%;align-items:center;border-width:2px;opacity:1;--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)}.container slot[name=title]::slotted(*),.container *::slotted([slot=title]){margin:0px;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1)}.container slot[name=message]::slotted(*),.container *::slotted([slot=message]){margin:0px;display:inline;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-2);margin-inline-end:var(--calcite-notice-spacing-token-small)}.notice-content{box-sizing:border-box;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;padding-inline:var(--calcite-notice-spacing-token-large);flex:0 0 auto;display:flex;min-inline-size:0px;flex-direction:column;overflow-wrap:break-word;flex:1 1 0;padding-block:var(--calcite-notice-spacing-token-small);padding-inline:0 var(--calcite-notice-spacing-token-small)}.notice-content:first-of-type:not(:only-child){padding-inline-start:var(--calcite-notice-spacing-token-large)}.notice-content:only-of-type{padding-block:var(--calcite-notice-spacing-token-small);padding-inline:var(--calcite-notice-spacing-token-large)}.notice-icon{display:flex;align-items:center;box-sizing:border-box;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;padding-block:var(--calcite-notice-spacing-token-small);padding-inline:var(--calcite-notice-spacing-token-large);flex:0 0 auto}.notice-close{display:flex;cursor:pointer;align-items:center;align-self:stretch;border-style:none;background-color:transparent;color:var(--calcite-ui-text-3);outline:2px solid transparent;outline-offset:2px;box-sizing:border-box;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;padding-block:var(--calcite-notice-spacing-token-small);padding-inline:var(--calcite-notice-spacing-token-large);flex:0 0 auto;-webkit-appearance:none}.notice-close:hover,.notice-close:focus{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1)}.notice-close:active{background-color:var(--calcite-ui-foreground-3)}.actions-end{display:flex;align-self:stretch}:host([kind=brand]) .container{border-color:var(--calcite-ui-brand)}:host([kind=brand]) .container .notice-icon{color:var(--calcite-ui-brand)}:host([kind=info]) .container{border-color:var(--calcite-ui-info)}:host([kind=info]) .container .notice-icon{color:var(--calcite-ui-info)}:host([kind=danger]) .container{border-color:var(--calcite-ui-danger)}:host([kind=danger]) .container .notice-icon{color:var(--calcite-ui-danger)}:host([kind=success]) .container{border-color:var(--calcite-ui-success)}:host([kind=success]) .container .notice-icon{color:var(--calcite-ui-success)}:host([kind=warning]) .container{border-color:var(--calcite-ui-warning)}:host([kind=warning]) .container .notice-icon{color:var(--calcite-ui-warning)}:host([hidden]){display:none}[hidden]{display:none}";
|
280
|
+
|
281
|
+
const Notice = class {
|
282
|
+
constructor(hostRef) {
|
283
|
+
registerInstance(this, hostRef);
|
284
|
+
this.calciteNoticeClose = createEvent(this, "calciteNoticeClose", 6);
|
285
|
+
this.calciteNoticeOpen = createEvent(this, "calciteNoticeOpen", 6);
|
286
|
+
//--------------------------------------------------------------------------
|
287
|
+
//
|
288
|
+
// Private Methods
|
289
|
+
//
|
290
|
+
//--------------------------------------------------------------------------
|
291
|
+
this.close = () => {
|
292
|
+
this.open = false;
|
293
|
+
this.calciteNoticeClose.emit();
|
294
|
+
};
|
295
|
+
this.open = false;
|
296
|
+
this.kind = "brand";
|
297
|
+
this.closable = false;
|
298
|
+
this.icon = undefined;
|
299
|
+
this.iconFlipRtl = false;
|
300
|
+
this.scale = "m";
|
301
|
+
this.width = "auto";
|
302
|
+
this.messages = undefined;
|
303
|
+
this.messageOverrides = undefined;
|
304
|
+
this.effectiveLocale = undefined;
|
305
|
+
this.defaultMessages = undefined;
|
306
|
+
}
|
307
|
+
onMessagesChange() {
|
308
|
+
/* wired up by t9n util */
|
309
|
+
}
|
310
|
+
updateRequestedIcon() {
|
311
|
+
this.requestedIcon = setRequestedIcon(KindIcons, this.icon, this.kind);
|
312
|
+
}
|
313
|
+
//--------------------------------------------------------------------------
|
314
|
+
//
|
315
|
+
// Lifecycle
|
316
|
+
//
|
317
|
+
//--------------------------------------------------------------------------
|
318
|
+
connectedCallback() {
|
319
|
+
connectConditionalSlotComponent(this);
|
320
|
+
connectLocalized(this);
|
321
|
+
connectMessages(this);
|
322
|
+
}
|
323
|
+
disconnectedCallback() {
|
324
|
+
disconnectConditionalSlotComponent(this);
|
325
|
+
disconnectLocalized(this);
|
326
|
+
disconnectMessages(this);
|
327
|
+
}
|
328
|
+
async componentWillLoad() {
|
329
|
+
setUpLoadableComponent(this);
|
330
|
+
this.requestedIcon = setRequestedIcon(KindIcons, this.icon, this.kind);
|
331
|
+
await setUpMessages(this);
|
332
|
+
}
|
333
|
+
componentDidLoad() {
|
334
|
+
setComponentLoaded(this);
|
335
|
+
}
|
336
|
+
render() {
|
337
|
+
const { el } = this;
|
338
|
+
const closeButton = (h("button", { "aria-label": this.messages.close, class: CSS$1.close, onClick: this.close,
|
339
|
+
// eslint-disable-next-line react/jsx-sort-props
|
340
|
+
ref: (el) => (this.closeButton = el) }, h("calcite-icon", { icon: "x", scale: this.scale === "l" ? "m" : "s" })));
|
341
|
+
const hasActionEnd = getSlotted(el, SLOTS.actionsEnd);
|
342
|
+
return (h("div", { class: CSS$1.container }, this.requestedIcon ? (h("div", { class: CSS$1.icon }, h("calcite-icon", { flipRtl: this.iconFlipRtl, icon: this.requestedIcon, scale: this.scale === "l" ? "m" : "s" }))) : null, h("div", { class: CSS$1.content }, h("slot", { name: SLOTS.title }), h("slot", { name: SLOTS.message }), h("slot", { name: SLOTS.link })), hasActionEnd ? (h("div", { class: CSS$1.actionsEnd }, h("slot", { name: SLOTS.actionsEnd }))) : null, this.closable ? closeButton : null));
|
343
|
+
}
|
344
|
+
//--------------------------------------------------------------------------
|
345
|
+
//
|
346
|
+
// Public Methods
|
347
|
+
//
|
348
|
+
//--------------------------------------------------------------------------
|
349
|
+
/** Sets focus on the component's first focusable element. */
|
350
|
+
async setFocus() {
|
351
|
+
await componentFocusable(this);
|
352
|
+
const noticeLinkEl = this.el.querySelector("calcite-link");
|
353
|
+
if (!this.closeButton && !noticeLinkEl) {
|
354
|
+
return;
|
355
|
+
}
|
356
|
+
if (noticeLinkEl) {
|
357
|
+
return noticeLinkEl.setFocus();
|
358
|
+
}
|
359
|
+
else if (this.closeButton) {
|
360
|
+
this.closeButton.focus();
|
361
|
+
}
|
362
|
+
}
|
363
|
+
effectiveLocaleChange() {
|
364
|
+
updateMessages(this, this.effectiveLocale);
|
365
|
+
}
|
366
|
+
static get assetsDirs() { return ["assets"]; }
|
367
|
+
get el() { return getElement(this); }
|
368
|
+
static get watchers() { return {
|
369
|
+
"messageOverrides": ["onMessagesChange"],
|
370
|
+
"icon": ["updateRequestedIcon"],
|
371
|
+
"kind": ["updateRequestedIcon"],
|
372
|
+
"effectiveLocale": ["effectiveLocaleChange"]
|
373
|
+
}; }
|
374
|
+
};
|
375
|
+
Notice.style = noticeCss;
|
376
|
+
|
377
|
+
/*!
|
378
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
379
|
+
* See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
|
380
|
+
* v1.6.1
|
381
|
+
*/
|
382
|
+
const CSS = {
|
383
|
+
container: "container",
|
384
|
+
};
|
385
|
+
const TOOLTIP_OPEN_DELAY_MS = 300;
|
386
|
+
const TOOLTIP_CLOSE_DELAY_MS = 500;
|
387
|
+
const ARIA_DESCRIBED_BY = "aria-describedby";
|
388
|
+
|
389
|
+
/*!
|
390
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
391
|
+
* See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
|
392
|
+
* v1.6.1
|
393
|
+
*/
|
394
|
+
function getEffectiveReferenceElement(tooltip) {
|
395
|
+
const { referenceElement } = tooltip;
|
396
|
+
return ((typeof referenceElement === "string" ? queryElementRoots(tooltip, { id: referenceElement }) : referenceElement) ||
|
397
|
+
null);
|
398
|
+
}
|
399
|
+
|
400
|
+
/*!
|
401
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
402
|
+
* See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
|
403
|
+
* v1.6.1
|
404
|
+
*/
|
405
|
+
class TooltipManager {
|
406
|
+
constructor() {
|
407
|
+
// --------------------------------------------------------------------------
|
408
|
+
//
|
409
|
+
// Private Properties
|
410
|
+
//
|
411
|
+
// --------------------------------------------------------------------------
|
412
|
+
this.registeredElements = new WeakMap();
|
413
|
+
this.registeredShadowRootCounts = new WeakMap();
|
414
|
+
this.hoverOpenTimeout = null;
|
415
|
+
this.hoverCloseTimeout = null;
|
416
|
+
this.hoveredTooltip = null;
|
417
|
+
this.clickedTooltip = null;
|
418
|
+
this.activeTooltip = null;
|
419
|
+
this.registeredElementCount = 0;
|
420
|
+
// --------------------------------------------------------------------------
|
421
|
+
//
|
422
|
+
// Private Methods
|
423
|
+
//
|
424
|
+
// --------------------------------------------------------------------------
|
425
|
+
this.queryTooltip = (composedPath) => {
|
426
|
+
const { registeredElements } = this;
|
427
|
+
const registeredElement = composedPath.find((pathEl) => registeredElements.has(pathEl));
|
428
|
+
return registeredElements.get(registeredElement);
|
429
|
+
};
|
430
|
+
this.keyDownHandler = (event) => {
|
431
|
+
if (event.key === "Escape" && !event.defaultPrevented) {
|
432
|
+
const { activeTooltip } = this;
|
433
|
+
if (activeTooltip?.open) {
|
434
|
+
this.clearHoverTimeout();
|
435
|
+
this.closeActiveTooltip();
|
436
|
+
const referenceElement = getEffectiveReferenceElement(activeTooltip);
|
437
|
+
if (referenceElement instanceof Element && referenceElement.contains(event.target)) {
|
438
|
+
event.preventDefault();
|
439
|
+
}
|
440
|
+
}
|
441
|
+
}
|
442
|
+
};
|
443
|
+
this.pointerMoveHandler = (event) => {
|
444
|
+
const composedPath = event.composedPath();
|
445
|
+
const { activeTooltip } = this;
|
446
|
+
const hoveringActiveTooltip = activeTooltip?.open && composedPath.includes(activeTooltip);
|
447
|
+
if (hoveringActiveTooltip) {
|
448
|
+
this.clearHoverTimeout();
|
449
|
+
return;
|
450
|
+
}
|
451
|
+
const tooltip = this.queryTooltip(composedPath);
|
452
|
+
this.hoveredTooltip = tooltip;
|
453
|
+
if (this.isClosableClickedTooltip(tooltip)) {
|
454
|
+
return;
|
455
|
+
}
|
456
|
+
this.clickedTooltip = null;
|
457
|
+
if (tooltip) {
|
458
|
+
this.openHoveredTooltip(tooltip);
|
459
|
+
}
|
460
|
+
else if (activeTooltip) {
|
461
|
+
this.closeHoveredTooltip();
|
462
|
+
}
|
463
|
+
};
|
464
|
+
this.pointerDownHandler = (event) => {
|
465
|
+
if (!isPrimaryPointerButton(event)) {
|
466
|
+
return;
|
467
|
+
}
|
468
|
+
const clickedTooltip = this.queryTooltip(event.composedPath());
|
469
|
+
this.clickedTooltip = clickedTooltip;
|
470
|
+
if (clickedTooltip?.closeOnClick) {
|
471
|
+
this.toggleTooltip(clickedTooltip, false);
|
472
|
+
this.clearHoverTimeout();
|
473
|
+
}
|
474
|
+
};
|
475
|
+
this.focusInHandler = (event) => {
|
476
|
+
this.queryFocusedTooltip(event, true);
|
477
|
+
};
|
478
|
+
this.focusOutHandler = (event) => {
|
479
|
+
this.queryFocusedTooltip(event, false);
|
480
|
+
};
|
481
|
+
this.openHoveredTooltip = (tooltip) => {
|
482
|
+
this.hoverOpenTimeout = window.setTimeout(() => {
|
483
|
+
if (this.hoverOpenTimeout === null) {
|
484
|
+
return;
|
485
|
+
}
|
486
|
+
this.clearHoverCloseTimeout();
|
487
|
+
if (this.activeTooltip === this.hoveredTooltip) {
|
488
|
+
return;
|
489
|
+
}
|
490
|
+
this.closeActiveTooltip();
|
491
|
+
if (tooltip !== this.hoveredTooltip) {
|
492
|
+
return;
|
493
|
+
}
|
494
|
+
this.toggleTooltip(tooltip, true);
|
495
|
+
}, this.activeTooltip ? 0 : TOOLTIP_OPEN_DELAY_MS);
|
496
|
+
};
|
497
|
+
this.closeHoveredTooltip = () => {
|
498
|
+
this.hoverCloseTimeout = window.setTimeout(() => {
|
499
|
+
if (this.hoverCloseTimeout === null) {
|
500
|
+
return;
|
501
|
+
}
|
502
|
+
this.closeActiveTooltip();
|
503
|
+
}, TOOLTIP_CLOSE_DELAY_MS);
|
504
|
+
};
|
505
|
+
}
|
506
|
+
// --------------------------------------------------------------------------
|
507
|
+
//
|
508
|
+
// Public Methods
|
509
|
+
//
|
510
|
+
// --------------------------------------------------------------------------
|
511
|
+
registerElement(referenceEl, tooltip) {
|
512
|
+
this.registeredElementCount++;
|
513
|
+
this.registeredElements.set(referenceEl, tooltip);
|
514
|
+
const shadowRoot = this.getReferenceElShadowRootNode(referenceEl);
|
515
|
+
if (shadowRoot) {
|
516
|
+
this.registerShadowRoot(shadowRoot);
|
517
|
+
}
|
518
|
+
if (this.registeredElementCount === 1) {
|
519
|
+
this.addListeners();
|
520
|
+
}
|
521
|
+
}
|
522
|
+
unregisterElement(referenceEl) {
|
523
|
+
const shadowRoot = this.getReferenceElShadowRootNode(referenceEl);
|
524
|
+
if (shadowRoot) {
|
525
|
+
this.unregisterShadowRoot(shadowRoot);
|
526
|
+
}
|
527
|
+
if (this.registeredElements.delete(referenceEl)) {
|
528
|
+
this.registeredElementCount--;
|
529
|
+
}
|
530
|
+
if (this.registeredElementCount === 0) {
|
531
|
+
this.removeListeners();
|
532
|
+
}
|
533
|
+
}
|
534
|
+
addShadowListeners(shadowRoot) {
|
535
|
+
shadowRoot.addEventListener("focusin", this.focusInHandler, { capture: true });
|
536
|
+
shadowRoot.addEventListener("focusout", this.focusOutHandler, { capture: true });
|
537
|
+
}
|
538
|
+
removeShadowListeners(shadowRoot) {
|
539
|
+
shadowRoot.removeEventListener("focusin", this.focusInHandler, { capture: true });
|
540
|
+
shadowRoot.removeEventListener("focusout", this.focusOutHandler, { capture: true });
|
541
|
+
}
|
542
|
+
addListeners() {
|
543
|
+
document.addEventListener("keydown", this.keyDownHandler, { capture: true });
|
544
|
+
document.addEventListener("pointermove", this.pointerMoveHandler, { capture: true });
|
545
|
+
document.addEventListener("pointerdown", this.pointerDownHandler, { capture: true });
|
546
|
+
document.addEventListener("focusin", this.focusInHandler, { capture: true });
|
547
|
+
document.addEventListener("focusout", this.focusOutHandler, { capture: true });
|
548
|
+
}
|
549
|
+
removeListeners() {
|
550
|
+
document.removeEventListener("keydown", this.keyDownHandler, { capture: true });
|
551
|
+
document.removeEventListener("pointermove", this.pointerMoveHandler, { capture: true });
|
552
|
+
document.removeEventListener("pointerdown", this.pointerDownHandler, { capture: true });
|
553
|
+
document.removeEventListener("focusin", this.focusInHandler, { capture: true });
|
554
|
+
document.removeEventListener("focusout", this.focusOutHandler, { capture: true });
|
555
|
+
}
|
556
|
+
clearHoverOpenTimeout() {
|
557
|
+
window.clearTimeout(this.hoverOpenTimeout);
|
558
|
+
this.hoverOpenTimeout = null;
|
559
|
+
}
|
560
|
+
clearHoverCloseTimeout() {
|
561
|
+
window.clearTimeout(this.hoverCloseTimeout);
|
562
|
+
this.hoverCloseTimeout = null;
|
563
|
+
}
|
564
|
+
clearHoverTimeout() {
|
565
|
+
this.clearHoverOpenTimeout();
|
566
|
+
this.clearHoverCloseTimeout();
|
567
|
+
}
|
568
|
+
closeActiveTooltip() {
|
569
|
+
const { activeTooltip } = this;
|
570
|
+
if (activeTooltip?.open) {
|
571
|
+
this.toggleTooltip(activeTooltip, false);
|
572
|
+
}
|
573
|
+
}
|
574
|
+
toggleFocusedTooltip(tooltip, open) {
|
575
|
+
this.closeActiveTooltip();
|
576
|
+
if (open) {
|
577
|
+
this.clearHoverTimeout();
|
578
|
+
}
|
579
|
+
this.toggleTooltip(tooltip, open);
|
580
|
+
}
|
581
|
+
toggleTooltip(tooltip, open) {
|
582
|
+
tooltip.open = open;
|
583
|
+
this.activeTooltip = open ? tooltip : null;
|
584
|
+
}
|
585
|
+
queryFocusedTooltip(event, open) {
|
586
|
+
const tooltip = this.queryTooltip(event.composedPath());
|
587
|
+
if (!tooltip || this.isClosableClickedTooltip(tooltip)) {
|
588
|
+
return;
|
589
|
+
}
|
590
|
+
this.toggleFocusedTooltip(tooltip, open);
|
591
|
+
}
|
592
|
+
isClosableClickedTooltip(tooltip) {
|
593
|
+
return tooltip?.closeOnClick && tooltip === this.clickedTooltip;
|
594
|
+
}
|
595
|
+
registerShadowRoot(shadowRoot) {
|
596
|
+
const { registeredShadowRootCounts } = this;
|
597
|
+
const newCount = (registeredShadowRootCounts.get(shadowRoot) ?? 0) + 1;
|
598
|
+
if (newCount === 1) {
|
599
|
+
this.addShadowListeners(shadowRoot);
|
600
|
+
}
|
601
|
+
registeredShadowRootCounts.set(shadowRoot, newCount);
|
602
|
+
}
|
603
|
+
unregisterShadowRoot(shadowRoot) {
|
604
|
+
const { registeredShadowRootCounts } = this;
|
605
|
+
const newCount = registeredShadowRootCounts.get(shadowRoot) - 1;
|
606
|
+
if (newCount === 0) {
|
607
|
+
this.removeShadowListeners(shadowRoot);
|
608
|
+
}
|
609
|
+
registeredShadowRootCounts.set(shadowRoot, newCount);
|
610
|
+
}
|
611
|
+
getReferenceElShadowRootNode(referenceEl) {
|
612
|
+
return referenceEl instanceof Element ? getShadowRootNode(referenceEl) : null;
|
613
|
+
}
|
614
|
+
}
|
615
|
+
|
616
|
+
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}";
|
617
|
+
|
618
|
+
const manager = new TooltipManager();
|
619
|
+
const Tooltip = class {
|
620
|
+
constructor(hostRef) {
|
621
|
+
registerInstance(this, hostRef);
|
622
|
+
this.calciteTooltipBeforeClose = createEvent(this, "calciteTooltipBeforeClose", 6);
|
623
|
+
this.calciteTooltipClose = createEvent(this, "calciteTooltipClose", 6);
|
624
|
+
this.calciteTooltipBeforeOpen = createEvent(this, "calciteTooltipBeforeOpen", 6);
|
625
|
+
this.calciteTooltipOpen = createEvent(this, "calciteTooltipOpen", 6);
|
626
|
+
this.guid = `calcite-tooltip-${guid()}`;
|
627
|
+
this.hasLoaded = false;
|
628
|
+
this.openTransitionProp = "opacity";
|
629
|
+
this.setTransitionEl = (el) => {
|
630
|
+
this.transitionEl = el;
|
631
|
+
};
|
632
|
+
this.setUpReferenceElement = (warn = true) => {
|
633
|
+
this.removeReferences();
|
634
|
+
this.effectiveReferenceElement = getEffectiveReferenceElement(this.el);
|
635
|
+
connectFloatingUI(this, this.effectiveReferenceElement, this.el);
|
636
|
+
const { el, referenceElement, effectiveReferenceElement } = this;
|
637
|
+
if (warn && referenceElement && !effectiveReferenceElement) {
|
638
|
+
console.warn(`${el.tagName}: reference-element id "${referenceElement}" was not found.`, {
|
639
|
+
el,
|
640
|
+
});
|
641
|
+
}
|
642
|
+
this.addReferences();
|
643
|
+
};
|
644
|
+
this.getId = () => {
|
645
|
+
return this.el.id || this.guid;
|
646
|
+
};
|
647
|
+
this.addReferences = () => {
|
648
|
+
const { effectiveReferenceElement } = this;
|
649
|
+
if (!effectiveReferenceElement) {
|
650
|
+
return;
|
651
|
+
}
|
652
|
+
const id = this.getId();
|
653
|
+
if ("setAttribute" in effectiveReferenceElement) {
|
654
|
+
effectiveReferenceElement.setAttribute(ARIA_DESCRIBED_BY, id);
|
655
|
+
}
|
656
|
+
manager.registerElement(effectiveReferenceElement, this.el);
|
657
|
+
};
|
658
|
+
this.removeReferences = () => {
|
659
|
+
const { effectiveReferenceElement } = this;
|
660
|
+
if (!effectiveReferenceElement) {
|
661
|
+
return;
|
662
|
+
}
|
663
|
+
if ("removeAttribute" in effectiveReferenceElement) {
|
664
|
+
effectiveReferenceElement.removeAttribute(ARIA_DESCRIBED_BY);
|
665
|
+
}
|
666
|
+
manager.unregisterElement(effectiveReferenceElement);
|
667
|
+
};
|
668
|
+
this.closeOnClick = false;
|
669
|
+
this.label = undefined;
|
670
|
+
this.offsetDistance = defaultOffsetDistance;
|
671
|
+
this.offsetSkidding = 0;
|
672
|
+
this.open = false;
|
673
|
+
this.overlayPositioning = "absolute";
|
674
|
+
this.placement = "auto";
|
675
|
+
this.referenceElement = undefined;
|
676
|
+
this.effectiveReferenceElement = undefined;
|
677
|
+
this.floatingLayout = "vertical";
|
678
|
+
}
|
679
|
+
offsetDistanceOffsetHandler() {
|
680
|
+
this.reposition(true);
|
681
|
+
}
|
682
|
+
offsetSkiddingHandler() {
|
683
|
+
this.reposition(true);
|
684
|
+
}
|
685
|
+
openHandler(value) {
|
686
|
+
onToggleOpenCloseComponent(this);
|
687
|
+
if (value) {
|
688
|
+
this.reposition(true);
|
689
|
+
}
|
690
|
+
}
|
691
|
+
overlayPositioningHandler() {
|
692
|
+
this.reposition(true);
|
693
|
+
}
|
694
|
+
placementHandler() {
|
695
|
+
this.reposition(true);
|
696
|
+
}
|
697
|
+
referenceElementHandler() {
|
698
|
+
this.setUpReferenceElement();
|
699
|
+
}
|
700
|
+
// --------------------------------------------------------------------------
|
701
|
+
//
|
702
|
+
// Lifecycle
|
703
|
+
//
|
704
|
+
// --------------------------------------------------------------------------
|
705
|
+
connectedCallback() {
|
706
|
+
this.setUpReferenceElement(this.hasLoaded);
|
707
|
+
if (this.open) {
|
708
|
+
onToggleOpenCloseComponent(this);
|
709
|
+
}
|
710
|
+
}
|
711
|
+
async componentWillLoad() {
|
712
|
+
if (this.open) {
|
713
|
+
onToggleOpenCloseComponent(this);
|
714
|
+
}
|
715
|
+
}
|
716
|
+
componentDidLoad() {
|
717
|
+
if (this.referenceElement && !this.effectiveReferenceElement) {
|
718
|
+
this.setUpReferenceElement();
|
719
|
+
}
|
720
|
+
this.reposition(true);
|
721
|
+
this.hasLoaded = true;
|
722
|
+
}
|
723
|
+
disconnectedCallback() {
|
724
|
+
this.removeReferences();
|
725
|
+
disconnectFloatingUI(this, this.effectiveReferenceElement, this.el);
|
726
|
+
}
|
727
|
+
// --------------------------------------------------------------------------
|
728
|
+
//
|
729
|
+
// Public Methods
|
730
|
+
//
|
731
|
+
// --------------------------------------------------------------------------
|
732
|
+
/**
|
733
|
+
* Updates the position of the component.
|
734
|
+
*
|
735
|
+
* @param delayed
|
736
|
+
*/
|
737
|
+
async reposition(delayed = false) {
|
738
|
+
const { el, effectiveReferenceElement, placement, overlayPositioning, offsetDistance, offsetSkidding, arrowEl, } = this;
|
739
|
+
return reposition(this, {
|
740
|
+
floatingEl: el,
|
741
|
+
referenceEl: effectiveReferenceElement,
|
742
|
+
overlayPositioning,
|
743
|
+
placement,
|
744
|
+
offsetDistance,
|
745
|
+
offsetSkidding,
|
746
|
+
arrowEl,
|
747
|
+
type: "tooltip",
|
748
|
+
}, delayed);
|
749
|
+
}
|
750
|
+
// --------------------------------------------------------------------------
|
751
|
+
//
|
752
|
+
// Private Methods
|
753
|
+
//
|
754
|
+
// --------------------------------------------------------------------------
|
755
|
+
onBeforeOpen() {
|
756
|
+
this.calciteTooltipBeforeOpen.emit();
|
757
|
+
}
|
758
|
+
onOpen() {
|
759
|
+
this.calciteTooltipOpen.emit();
|
760
|
+
}
|
761
|
+
onBeforeClose() {
|
762
|
+
this.calciteTooltipBeforeClose.emit();
|
763
|
+
}
|
764
|
+
onClose() {
|
765
|
+
this.calciteTooltipClose.emit();
|
766
|
+
}
|
767
|
+
// --------------------------------------------------------------------------
|
768
|
+
//
|
769
|
+
// Render Methods
|
770
|
+
//
|
771
|
+
// --------------------------------------------------------------------------
|
772
|
+
render() {
|
773
|
+
const { effectiveReferenceElement, label, open, floatingLayout } = this;
|
774
|
+
const displayed = effectiveReferenceElement && open;
|
775
|
+
const hidden = !displayed;
|
776
|
+
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: {
|
777
|
+
[FloatingCSS.animation]: true,
|
778
|
+
[FloatingCSS.animationActive]: displayed,
|
779
|
+
},
|
780
|
+
// eslint-disable-next-line react/jsx-sort-props
|
781
|
+
ref: this.setTransitionEl }, h(FloatingArrow, { floatingLayout: floatingLayout,
|
782
|
+
// eslint-disable-next-line react/jsx-sort-props
|
783
|
+
ref: (arrowEl) => (this.arrowEl = arrowEl) }), h("div", { class: CSS.container }, h("slot", null)))));
|
784
|
+
}
|
785
|
+
get el() { return getElement(this); }
|
786
|
+
static get watchers() { return {
|
787
|
+
"offsetDistance": ["offsetDistanceOffsetHandler"],
|
788
|
+
"offsetSkidding": ["offsetSkiddingHandler"],
|
789
|
+
"open": ["openHandler"],
|
790
|
+
"overlayPositioning": ["overlayPositioningHandler"],
|
791
|
+
"placement": ["placementHandler"],
|
792
|
+
"referenceElement": ["referenceElementHandler"]
|
793
|
+
}; }
|
794
|
+
};
|
795
|
+
Tooltip.style = tooltipCss;
|
796
|
+
|
797
|
+
export { Chip as calcite_chip, Notice as calcite_notice, Tooltip as calcite_tooltip };
|