@esri/solutions-components 0.3.6 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/buffer-tools_6.cjs.entry.js +8 -5
- package/dist/cjs/calcite-combobox_3.cjs.entry.js +2 -2
- package/dist/cjs/calcite-input-message_5.cjs.entry.js +6 -4
- package/dist/cjs/calcite-shell-panel_14.cjs.entry.js +2 -2
- package/dist/cjs/{csvUtils-83af7ae1.js → csvUtils-34666909.js} +1 -1
- package/dist/cjs/{interfaces-772edf61.js → interfaces-17c631bf.js} +1 -1
- package/dist/cjs/layer-table.cjs.entry.js +3 -3
- package/dist/cjs/map-card.cjs.entry.js +1 -1
- package/dist/cjs/{mapViewUtils-55ac76cb.js → mapViewUtils-24d1d859.js} +1 -1
- package/dist/cjs/public-notification.cjs.entry.js +16 -10
- package/dist/cjs/solution-configuration.cjs.entry.js +2 -2
- package/dist/cjs/solution-contents_3.cjs.entry.js +2 -2
- package/dist/cjs/{solution-store-39726b81.js → solution-store-2dbab624.js} +1 -1
- package/dist/collection/components/buffer-tools/buffer-tools.js +2 -2
- package/dist/collection/components/map-draw-tools/map-draw-tools.js +2 -1
- package/dist/collection/components/public-notification/public-notification.js +14 -8
- package/dist/collection/components/refine-selection/refine-selection.js +4 -2
- package/dist/collection/components/refine-selection-tools/refine-selection-tools.css +1 -0
- package/dist/collection/components/refine-selection-tools/refine-selection-tools.js +3 -1
- package/dist/collection/demos/new-public-notification.html +2 -1
- package/dist/collection/utils/interfaces.js +1 -1
- package/dist/collection/utils/interfaces.ts +2 -2
- package/dist/components/interfaces3.js +1 -1
- package/dist/components/map-draw-tools2.js +2 -1
- package/dist/components/public-notification.js +14 -8
- package/dist/components/refine-selection-tools2.js +4 -2
- package/dist/components/refine-selection2.js +4 -2
- package/dist/esm/buffer-tools_6.entry.js +8 -5
- package/dist/esm/calcite-combobox_3.entry.js +2 -2
- package/dist/esm/calcite-input-message_5.entry.js +6 -4
- package/dist/esm/calcite-shell-panel_14.entry.js +2 -2
- package/dist/esm/{csvUtils-eb231cfb.js → csvUtils-ae3004b9.js} +1 -1
- package/dist/esm/{interfaces-3b23a5f9.js → interfaces-d0d83efa.js} +1 -1
- package/dist/esm/layer-table.entry.js +3 -3
- package/dist/esm/map-card.entry.js +1 -1
- package/dist/esm/{mapViewUtils-e5d8a1e1.js → mapViewUtils-541e7a3c.js} +1 -1
- package/dist/esm/public-notification.entry.js +16 -10
- package/dist/esm/solution-configuration.entry.js +2 -2
- package/dist/esm/solution-contents_3.entry.js +2 -2
- package/dist/esm/{solution-store-c0bf9200.js → solution-store-41e15f1c.js} +1 -1
- package/dist/solutions-components/demos/new-public-notification.html +2 -1
- package/dist/solutions-components/p-05e64bd1.js +498 -2
- package/dist/solutions-components/p-08a95b33.entry.js +138 -0
- package/dist/solutions-components/p-0da5bbdf.entry.js +91 -0
- package/dist/solutions-components/p-0ef91144.entry.js +913 -0
- package/dist/solutions-components/p-0f523243.entry.js +1916 -0
- package/dist/solutions-components/p-11b9510e.entry.js +173 -0
- package/dist/solutions-components/p-1b875d94.entry.js +58 -0
- package/dist/solutions-components/p-1c567f3a.js +23 -16
- package/dist/solutions-components/p-1c883db9.entry.js +43 -0
- package/dist/solutions-components/p-1f225056.js +322 -0
- package/dist/solutions-components/p-1f499e67.entry.js +72 -0
- package/dist/solutions-components/p-20d3d758.entry.js +881 -0
- package/dist/solutions-components/p-2274ac9e.entry.js +160 -0
- package/dist/solutions-components/p-23ec5ac5.entry.js +93 -0
- package/dist/solutions-components/p-2447798c.entry.js +155 -0
- package/dist/solutions-components/p-2525e691.entry.js +432 -0
- package/dist/solutions-components/p-2561f5b5.js +4092 -0
- package/dist/solutions-components/p-29f887c0.entry.js +234 -0
- package/dist/solutions-components/p-2a0d8047.entry.js +345 -0
- package/dist/solutions-components/p-2c177e6a.entry.js +101 -0
- package/dist/solutions-components/p-2e9ed892.js +46 -1
- package/dist/solutions-components/p-316f56db.js +219 -2
- package/dist/solutions-components/p-327f3ebf.entry.js +98 -0
- package/dist/solutions-components/p-356f8b54.entry.js +138 -0
- package/dist/solutions-components/p-359c58de.entry.js +172 -0
- package/dist/solutions-components/p-37336c0d.entry.js +116 -0
- package/dist/solutions-components/p-374a5031.js +105 -2
- package/dist/solutions-components/p-39ea6ef4.entry.js +71 -0
- package/dist/solutions-components/p-3b010ce1.js +17 -1
- package/dist/solutions-components/p-4307dacd.js +194 -1
- package/dist/solutions-components/p-44da2507.js +405 -14
- package/dist/solutions-components/p-46bdffe8.entry.js +54 -0
- package/dist/solutions-components/p-4894bbeb.js +53 -2
- package/dist/solutions-components/p-4cd569f1.entry.js +1298 -0
- package/dist/solutions-components/p-4d4160f9.entry.js +121 -0
- package/dist/solutions-components/p-4e32bf8c.js +482 -1
- package/dist/solutions-components/p-4e9cbd32.entry.js +184 -0
- package/dist/solutions-components/p-508317b3.js +13 -2
- package/dist/solutions-components/p-54697d58.entry.js +198 -0
- package/dist/solutions-components/p-55c79103.entry.js +311 -0
- package/dist/solutions-components/p-57fd19c0.entry.js +706 -0
- package/dist/solutions-components/p-59b48fde.entry.js +443 -0
- package/dist/solutions-components/p-60e0e6a0.entry.js +214 -0
- package/dist/solutions-components/p-621d0534.entry.js +123 -0
- package/dist/solutions-components/p-63f6e8f1.js +14 -1
- package/dist/solutions-components/p-66aeec57.entry.js +61 -0
- package/dist/solutions-components/p-69834f46.entry.js +618 -0
- package/dist/solutions-components/p-6d9da8e5.entry.js +21530 -0
- package/dist/solutions-components/p-6e0da576.js +13 -1
- package/dist/solutions-components/p-6ec3f294.entry.js +106 -0
- package/dist/solutions-components/p-6fe17794.js +9 -1
- package/dist/solutions-components/p-7024cb16.entry.js +72 -0
- package/dist/solutions-components/p-70535506.entry.js +226 -0
- package/dist/solutions-components/p-708a63a8.js +12 -1
- package/dist/solutions-components/p-729708a3.js +14 -1
- package/dist/solutions-components/p-73e23995.js +6 -1
- package/dist/solutions-components/p-74b29d75.entry.js +231 -0
- package/dist/solutions-components/p-74b7ee25.entry.js +711 -0
- package/dist/solutions-components/p-77182c3a.js +3015 -1
- package/dist/solutions-components/p-78b3ef80.entry.js +456 -0
- package/dist/solutions-components/p-79709c19.js +60 -3
- package/dist/solutions-components/p-7a46ef97.js +181 -2
- package/dist/solutions-components/p-7be159e6.entry.js +175 -0
- package/dist/solutions-components/p-7d4451c2.entry.js +71 -0
- package/dist/solutions-components/p-7daea1df.js +41 -1
- package/dist/solutions-components/p-7e39e5ad.entry.js +102 -0
- package/dist/solutions-components/p-7fb45059.entry.js +43 -0
- package/dist/solutions-components/p-815533de.js +306 -3
- package/dist/solutions-components/p-816622ca.entry.js +248 -0
- package/dist/solutions-components/p-83166522.js +205 -2
- package/dist/solutions-components/p-83bd1991.entry.js +36 -0
- package/dist/solutions-components/p-856464d7.entry.js +572 -0
- package/dist/solutions-components/p-8c349bad.entry.js +347 -0
- package/dist/solutions-components/p-8dccb390.entry.js +1986 -0
- package/dist/solutions-components/p-904c185a.entry.js +228 -0
- package/dist/solutions-components/p-9092f8b3.entry.js +156 -0
- package/dist/solutions-components/p-9371145a.entry.js +477 -0
- package/dist/solutions-components/p-93d3119d.js +1948 -1
- package/dist/solutions-components/p-95ec8062.entry.js +173 -0
- package/dist/solutions-components/p-991ee695.js +109 -1
- package/dist/solutions-components/p-9a57dab7.entry.js +213 -0
- package/dist/solutions-components/p-9a9955db.js +41 -1
- package/dist/solutions-components/p-9c1ebc90.js +35 -16
- package/dist/solutions-components/p-9eba5c66.js +399 -3
- package/dist/solutions-components/p-a033a507.entry.js +252 -0
- package/dist/solutions-components/p-a3773415.entry.js +1132 -0
- package/dist/solutions-components/p-a44fe40f.entry.js +94 -0
- package/dist/solutions-components/p-a5b1ab03.js +33 -3
- package/dist/solutions-components/p-a5b2c13d.entry.js +723 -0
- package/dist/solutions-components/p-a6d729b7.entry.js +85 -0
- package/dist/solutions-components/p-a8005026.entry.js +565 -0
- package/dist/solutions-components/p-a80b3880.js +14 -1
- package/dist/solutions-components/p-a89198a3.entry.js +2620 -0
- package/dist/solutions-components/p-aa04bd1f.entry.js +95 -0
- package/dist/solutions-components/p-aa0a0922.entry.js +80 -0
- package/dist/solutions-components/p-ae1fd76b.js +11 -1
- package/dist/solutions-components/p-b2cf435e.entry.js +87 -0
- package/dist/solutions-components/p-b359dc78.js +41 -1
- package/dist/solutions-components/p-b57bc4eb.entry.js +71 -0
- package/dist/solutions-components/p-b75cc407.entry.js +145 -0
- package/dist/solutions-components/p-b911cb75.entry.js +71 -0
- package/dist/solutions-components/p-b965e177.entry.js +335 -0
- package/dist/solutions-components/p-b978636e.js +14 -1
- package/dist/solutions-components/p-ba10a5c8.entry.js +42 -0
- package/dist/solutions-components/p-bd67334c.js +122 -2
- package/dist/solutions-components/p-bde20dba.entry.js +212 -0
- package/dist/solutions-components/p-be0b5a94.entry.js +248 -0
- package/dist/solutions-components/p-c023e6a1.js +2028 -2
- package/dist/solutions-components/p-c27b0c2d.entry.js +150 -0
- package/dist/solutions-components/p-c579ed60.entry.js +447 -0
- package/dist/solutions-components/p-c92bc231.js +101 -2
- package/dist/solutions-components/p-cc815aca.js +839 -16
- package/dist/solutions-components/p-cc8beabb.entry.js +695 -0
- package/dist/solutions-components/p-cdc46c0c.js +1751 -2
- package/dist/solutions-components/p-d12e6992.entry.js +118 -0
- package/dist/solutions-components/p-d1dfed6b.entry.js +179 -0
- package/dist/solutions-components/p-d48a24e6.js +754 -2
- package/dist/solutions-components/p-d96ee3ef.entry.js +579 -0
- package/dist/solutions-components/p-dbc9a5a8.js +80 -0
- package/dist/solutions-components/p-dcdbe712.entry.js +278 -0
- package/dist/solutions-components/p-de39206f.entry.js +113 -0
- package/dist/solutions-components/p-de5416e8.js +28 -1
- package/dist/solutions-components/p-df420d54.entry.js +213 -0
- package/dist/solutions-components/p-e3138cf0.entry.js +20 -0
- package/dist/solutions-components/p-e4845fec.entry.js +152 -0
- package/dist/solutions-components/p-e611d8c8.js +28 -1
- package/dist/solutions-components/p-e947d3b0.js +5 -1
- package/dist/solutions-components/p-ea534300.js +41 -2
- package/dist/solutions-components/p-ec84ee85.entry.js +55 -0
- package/dist/solutions-components/p-ed36c637.entry.js +85 -0
- package/dist/solutions-components/p-f0add71c.js +74 -0
- package/dist/solutions-components/p-f42e014b.js +171 -2
- package/dist/solutions-components/p-fc02e7de.entry.js +308 -0
- package/dist/solutions-components/p-fc884dd6.js +28 -16
- package/dist/solutions-components/p-fcbfa59c.entry.js +181 -0
- package/dist/solutions-components/p-fdc5cf5f.entry.js +138 -0
- package/dist/solutions-components/solutions-components.esm.js +20 -1
- package/dist/solutions-components/utils/interfaces.ts +2 -2
- package/dist/types/components/buffer-tools/buffer-tools.d.ts +2 -2
- package/dist/types/components/public-notification/public-notification.d.ts +9 -1
- package/dist/types/components.d.ts +2 -2
- package/package.json +1 -1
- package/dist/solutions-components/p-021432b8.entry.js +0 -12
- package/dist/solutions-components/p-03440b1e.entry.js +0 -11
- package/dist/solutions-components/p-0512635b.entry.js +0 -6
- package/dist/solutions-components/p-086ef115.entry.js +0 -29
- package/dist/solutions-components/p-0b4bf57f.entry.js +0 -6
- package/dist/solutions-components/p-0c088725.entry.js +0 -6
- package/dist/solutions-components/p-0f820c08.entry.js +0 -6
- package/dist/solutions-components/p-164780a0.entry.js +0 -6
- package/dist/solutions-components/p-179a68a0.entry.js +0 -6
- package/dist/solutions-components/p-184b5005.entry.js +0 -11
- package/dist/solutions-components/p-1d082fee.entry.js +0 -11
- package/dist/solutions-components/p-1e6c02a2.entry.js +0 -11
- package/dist/solutions-components/p-20a58e62.entry.js +0 -17
- package/dist/solutions-components/p-20b2458c.entry.js +0 -11
- package/dist/solutions-components/p-245d47c1.entry.js +0 -6
- package/dist/solutions-components/p-2cb057a9.entry.js +0 -11
- package/dist/solutions-components/p-2cc72806.entry.js +0 -23
- package/dist/solutions-components/p-2de1db9c.entry.js +0 -11
- package/dist/solutions-components/p-2e9c7055.entry.js +0 -11
- package/dist/solutions-components/p-2ed5e6c8.entry.js +0 -11
- package/dist/solutions-components/p-3109d940.entry.js +0 -6
- package/dist/solutions-components/p-31a8bcfa.entry.js +0 -6
- package/dist/solutions-components/p-3649acb3.entry.js +0 -18
- package/dist/solutions-components/p-3f88ba73.entry.js +0 -6
- package/dist/solutions-components/p-3fa9b3c8.js +0 -36
- package/dist/solutions-components/p-40c41709.entry.js +0 -6
- package/dist/solutions-components/p-40e963c7.entry.js +0 -11
- package/dist/solutions-components/p-40f480da.entry.js +0 -11
- package/dist/solutions-components/p-49d5d2d3.entry.js +0 -11
- package/dist/solutions-components/p-4f7049a4.entry.js +0 -11
- package/dist/solutions-components/p-506e4d78.entry.js +0 -6
- package/dist/solutions-components/p-576fdcab.entry.js +0 -6
- package/dist/solutions-components/p-5bd0cf34.entry.js +0 -23
- package/dist/solutions-components/p-65e177f1.entry.js +0 -6
- package/dist/solutions-components/p-67d710c2.entry.js +0 -6
- package/dist/solutions-components/p-7268b445.entry.js +0 -11
- package/dist/solutions-components/p-75ea4667.entry.js +0 -6
- package/dist/solutions-components/p-778c0a36.entry.js +0 -17
- package/dist/solutions-components/p-7a22509b.entry.js +0 -12
- package/dist/solutions-components/p-7bff51db.entry.js +0 -6
- package/dist/solutions-components/p-7d2d0d5d.entry.js +0 -6
- package/dist/solutions-components/p-7f0036f1.entry.js +0 -11
- package/dist/solutions-components/p-8060fb94.entry.js +0 -6
- package/dist/solutions-components/p-80a1b305.entry.js +0 -6
- package/dist/solutions-components/p-81eae877.entry.js +0 -12
- package/dist/solutions-components/p-84e86b8b.entry.js +0 -6
- package/dist/solutions-components/p-851e04ae.entry.js +0 -6
- package/dist/solutions-components/p-9106950a.entry.js +0 -11
- package/dist/solutions-components/p-979804a4.entry.js +0 -11
- package/dist/solutions-components/p-9862baa8.entry.js +0 -11
- package/dist/solutions-components/p-9b5a9117.entry.js +0 -12
- package/dist/solutions-components/p-9deff0c2.entry.js +0 -6
- package/dist/solutions-components/p-9f400eeb.entry.js +0 -6
- package/dist/solutions-components/p-a0639ad1.entry.js +0 -11
- package/dist/solutions-components/p-a33c044e.entry.js +0 -6
- package/dist/solutions-components/p-a516c658.entry.js +0 -6
- package/dist/solutions-components/p-aa0ef36d.entry.js +0 -11
- package/dist/solutions-components/p-aaccbdf3.entry.js +0 -18
- package/dist/solutions-components/p-ab03a5c9.entry.js +0 -11
- package/dist/solutions-components/p-ad469b92.entry.js +0 -11
- package/dist/solutions-components/p-adc86ac3.entry.js +0 -6
- package/dist/solutions-components/p-addc1156.entry.js +0 -11
- package/dist/solutions-components/p-ae846934.entry.js +0 -11
- package/dist/solutions-components/p-b0572fc4.entry.js +0 -37
- package/dist/solutions-components/p-b4e476b7.js +0 -257
- package/dist/solutions-components/p-b668daf8.js +0 -21
- package/dist/solutions-components/p-b6e6eae1.entry.js +0 -6
- package/dist/solutions-components/p-bc317a7f.entry.js +0 -6
- package/dist/solutions-components/p-be41429f.js +0 -21
- package/dist/solutions-components/p-bf6b6353.entry.js +0 -11
- package/dist/solutions-components/p-c2e3dfbb.entry.js +0 -11
- package/dist/solutions-components/p-c4afae53.entry.js +0 -12
- package/dist/solutions-components/p-c9da1c26.entry.js +0 -6
- package/dist/solutions-components/p-cbf8cd49.entry.js +0 -6
- package/dist/solutions-components/p-cc1a064a.entry.js +0 -11
- package/dist/solutions-components/p-d09a168c.entry.js +0 -6
- package/dist/solutions-components/p-d377f913.entry.js +0 -11
- package/dist/solutions-components/p-d4cefead.entry.js +0 -37
- package/dist/solutions-components/p-d7bc0baf.entry.js +0 -16
- package/dist/solutions-components/p-d8968487.entry.js +0 -11
- package/dist/solutions-components/p-e00a0b86.entry.js +0 -11
- package/dist/solutions-components/p-e9a7ed49.entry.js +0 -11
- package/dist/solutions-components/p-ec27e493.entry.js +0 -11
- package/dist/solutions-components/p-ed6404eb.entry.js +0 -6
- package/dist/solutions-components/p-ef21e195.entry.js +0 -23
- package/dist/solutions-components/p-f6068a2d.entry.js +0 -11
- package/dist/solutions-components/p-f6c4cff3.entry.js +0 -11
- package/dist/solutions-components/p-f847291f.entry.js +0 -6
- package/dist/solutions-components/p-f90fd262.entry.js +0 -11
- package/dist/solutions-components/p-fc973005.entry.js +0 -6
- package/dist/solutions-components/p-ff9fb6bc.entry.js +0 -11
@@ -0,0 +1,443 @@
|
|
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 './p-c023e6a1.js';
|
7
|
+
import { f as focusElement, a as getSlotted, k as ensureId, l as isCalciteFocusable } from './p-83166522.js';
|
8
|
+
import { c as createObserver } from './p-9a9955db.js';
|
9
|
+
import { c as connectConditionalSlotComponent, d as disconnectConditionalSlotComponent } from './p-ea534300.js';
|
10
|
+
import { c as connectOpenCloseComponent, d as disconnectOpenCloseComponent } from './p-2e9ed892.js';
|
11
|
+
import './p-729708a3.js';
|
12
|
+
import './p-a80b3880.js';
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Traverses the slots of the open shadowroots and returns all children matching the query.
|
16
|
+
* @param {ShadowRoot | HTMLElement} root
|
17
|
+
* @param skipNode
|
18
|
+
* @param isMatch
|
19
|
+
* @param {number} maxDepth
|
20
|
+
* @param {number} depth
|
21
|
+
* @returns {HTMLElement[]}
|
22
|
+
*/
|
23
|
+
function queryShadowRoot(root, skipNode, isMatch, maxDepth = 20, depth = 0) {
|
24
|
+
let matches = [];
|
25
|
+
// If the depth is above the max depth, abort the searching here.
|
26
|
+
if (depth >= maxDepth) {
|
27
|
+
return matches;
|
28
|
+
}
|
29
|
+
// Traverses a slot element
|
30
|
+
const traverseSlot = ($slot) => {
|
31
|
+
// Only check nodes that are of the type Node.ELEMENT_NODE
|
32
|
+
// Read more here https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
|
33
|
+
const assignedNodes = $slot.assignedNodes().filter(node => node.nodeType === 1);
|
34
|
+
if (assignedNodes.length > 0) {
|
35
|
+
return queryShadowRoot(assignedNodes[0].parentElement, skipNode, isMatch, maxDepth, depth + 1);
|
36
|
+
}
|
37
|
+
return [];
|
38
|
+
};
|
39
|
+
// Go through each child and continue the traversing if necessary
|
40
|
+
// Even though the typing says that children can't be undefined, Edge 15 sometimes gives an undefined value.
|
41
|
+
// Therefore we fallback to an empty array if it is undefined.
|
42
|
+
const children = Array.from(root.children || []);
|
43
|
+
for (const $child of children) {
|
44
|
+
// Check if the node and its descendants should be skipped
|
45
|
+
if (skipNode($child)) {
|
46
|
+
continue;
|
47
|
+
}
|
48
|
+
// If the child matches we always add it
|
49
|
+
if (isMatch($child)) {
|
50
|
+
matches.push($child);
|
51
|
+
}
|
52
|
+
if ($child.shadowRoot != null) {
|
53
|
+
matches.push(...queryShadowRoot($child.shadowRoot, skipNode, isMatch, maxDepth, depth + 1));
|
54
|
+
}
|
55
|
+
else if ($child.tagName === "SLOT") {
|
56
|
+
matches.push(...traverseSlot($child));
|
57
|
+
}
|
58
|
+
else {
|
59
|
+
matches.push(...queryShadowRoot($child, skipNode, isMatch, maxDepth, depth + 1));
|
60
|
+
}
|
61
|
+
}
|
62
|
+
return matches;
|
63
|
+
}
|
64
|
+
|
65
|
+
/**
|
66
|
+
* Returns whether the element is hidden.
|
67
|
+
* @param $elem
|
68
|
+
*/
|
69
|
+
function isHidden($elem) {
|
70
|
+
return $elem.hasAttribute("hidden")
|
71
|
+
|| ($elem.hasAttribute("aria-hidden") && $elem.getAttribute("aria-hidden") !== "false")
|
72
|
+
// A quick and dirty way to check whether the element is hidden.
|
73
|
+
// For a more fine-grained check we could use "window.getComputedStyle" but we don't because of bad performance.
|
74
|
+
// If the element has visibility set to "hidden" or "collapse", display set to "none" or opacity set to "0" through CSS
|
75
|
+
// we won't be able to catch it here. We accept it due to the huge performance benefits.
|
76
|
+
|| $elem.style.display === `none`
|
77
|
+
|| $elem.style.opacity === `0`
|
78
|
+
|| $elem.style.visibility === `hidden`
|
79
|
+
|| $elem.style.visibility === `collapse`;
|
80
|
+
// If offsetParent is null we can assume that the element is hidden
|
81
|
+
// https://stackoverflow.com/questions/306305/what-would-make-offsetparent-null
|
82
|
+
//|| $elem.offsetParent == null;
|
83
|
+
}
|
84
|
+
/**
|
85
|
+
* Returns whether the element is disabled.
|
86
|
+
* @param $elem
|
87
|
+
*/
|
88
|
+
function isDisabled($elem) {
|
89
|
+
return $elem.hasAttribute("disabled")
|
90
|
+
|| ($elem.hasAttribute("aria-disabled") && $elem.getAttribute("aria-disabled") !== "false");
|
91
|
+
}
|
92
|
+
/**
|
93
|
+
* Determines whether an element is focusable.
|
94
|
+
* Read more here: https://stackoverflow.com/questions/1599660/which-html-elements-can-receive-focus/1600194#1600194
|
95
|
+
* Or here: https://stackoverflow.com/questions/18261595/how-to-check-if-a-dom-element-is-focusable
|
96
|
+
* @param $elem
|
97
|
+
*/
|
98
|
+
function isFocusable($elem) {
|
99
|
+
// Discard elements that are removed from the tab order.
|
100
|
+
if ($elem.getAttribute("tabindex") === "-1" || isHidden($elem) || isDisabled($elem)) {
|
101
|
+
return false;
|
102
|
+
}
|
103
|
+
return (
|
104
|
+
// At this point we know that the element can have focus (eg. won't be -1) if the tabindex attribute exists
|
105
|
+
$elem.hasAttribute("tabindex")
|
106
|
+
// Anchor tags or area tags with a href set
|
107
|
+
|| ($elem instanceof HTMLAnchorElement || $elem instanceof HTMLAreaElement) && $elem.hasAttribute("href")
|
108
|
+
// Form elements which are not disabled
|
109
|
+
|| ($elem instanceof HTMLButtonElement
|
110
|
+
|| $elem instanceof HTMLInputElement
|
111
|
+
|| $elem instanceof HTMLTextAreaElement
|
112
|
+
|| $elem instanceof HTMLSelectElement)
|
113
|
+
// IFrames
|
114
|
+
|| $elem instanceof HTMLIFrameElement);
|
115
|
+
}
|
116
|
+
|
117
|
+
/*!
|
118
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
119
|
+
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
120
|
+
* v1.0.0-beta.97
|
121
|
+
*/
|
122
|
+
const CSS = {
|
123
|
+
modal: "modal",
|
124
|
+
modalOpen: "modal--open",
|
125
|
+
title: "title",
|
126
|
+
header: "header",
|
127
|
+
footer: "footer",
|
128
|
+
scrim: "scrim",
|
129
|
+
back: "back",
|
130
|
+
close: "close",
|
131
|
+
secondary: "secondary",
|
132
|
+
primary: "primary",
|
133
|
+
overflowHidden: "overflow-hidden",
|
134
|
+
// these classes help apply the animation in phases to only set transform on open/close
|
135
|
+
// this helps avoid a positioning issue for any floating-ui-owning children
|
136
|
+
openingIdle: "modal--opening-idle",
|
137
|
+
openingActive: "modal--opening-active",
|
138
|
+
closingIdle: "modal--closing-idle",
|
139
|
+
closingActive: "modal--closing-active"
|
140
|
+
};
|
141
|
+
const ICONS = {
|
142
|
+
close: "x"
|
143
|
+
};
|
144
|
+
const SLOTS = {
|
145
|
+
content: "content",
|
146
|
+
header: "header",
|
147
|
+
back: "back",
|
148
|
+
secondary: "secondary",
|
149
|
+
primary: "primary"
|
150
|
+
};
|
151
|
+
const TEXT = {
|
152
|
+
close: "Close"
|
153
|
+
};
|
154
|
+
|
155
|
+
const modalCss = "@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{position:fixed;inset:0px;z-index:700;display:flex;align-items:center;justify-content:center;overflow-y:hidden;color:var(--calcite-ui-text-2);opacity:0;visibility:hidden !important;transition:visibility 0ms linear var(--calcite-internal-animation-timing-slow), opacity var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88)}:host([scale=s]){--calcite-modal-padding:0.75rem;--calcite-modal-padding-large:1rem;--calcite-modal-title-text:var(--calcite-font-size-1);--calcite-modal-content-text:var(--calcite-font-size--1);--calcite-modal-padding-internal:0.75rem;--calcite-modal-padding-large-internal:1rem;--calcite-modal-title-text-internal:var(--calcite-font-size-1);--calcite-modal-content-text-internal:var(--calcite-font-size--1)}:host([scale=m]){--calcite-modal-padding:1rem;--calcite-modal-padding-large:1.25rem;--calcite-modal-title-text:var(--calcite-font-size-2);--calcite-modal-content-text:var(--calcite-font-size-0);--calcite-modal-padding-internal:1rem;--calcite-modal-padding-large-internal:1.25rem;--calcite-modal-title-text-internal:var(--calcite-font-size-2);--calcite-modal-content-text-internal:var(--calcite-font-size-0)}:host([scale=l]){--calcite-modal-padding:1.25rem;--calcite-modal-padding-large:1.5rem;--calcite-modal-title-text:var(--calcite-font-size-3);--calcite-modal-content-text:var(--calcite-font-size-1);--calcite-modal-padding-internal:1.25rem;--calcite-modal-padding-large-internal:1.5rem;--calcite-modal-title-text-internal:var(--calcite-font-size-3);--calcite-modal-content-text-internal:var(--calcite-font-size-1)}.scrim{--calcite-scrim-background:rgba(0, 0, 0, 0.75);position:fixed;inset:0px;display:flex;overflow-y:hidden}.modal{pointer-events:none;z-index:800;float:none;margin:1.5rem;box-sizing:border-box;display:flex;inline-size:100%;flex-direction:column;overflow:hidden;border-radius:0.25rem;background-color:var(--calcite-ui-foreground-1);opacity:0;--tw-shadow:0 2px 12px -4px rgba(0, 0, 0, 0.2), 0 2px 4px -2px rgba(0, 0, 0, 0.16);--tw-shadow-colored:0 2px 12px -4px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);-webkit-overflow-scrolling:touch;visibility:hidden;transition:transform var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), visibility 0ms linear var(--calcite-internal-animation-timing-slow), opacity var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88);--calcite-modal-hidden-position:translate3d(0, 20px, 0);--calcite-modal-shown-position:translate3d(0, 0, 0)}.modal--opening-idle{transform:var(--calcite-modal-hidden-position)}.modal--opening-active{transform:var(--calcite-modal-shown-position)}.modal--closing-idle{transform:var(--calcite-modal-shown-position)}.modal--closing-active{transform:var(--calcite-modal-hidden-position)}:host([open]){opacity:1;visibility:visible !important;transition-delay:0ms}:host([open]) .modal--open{pointer-events:auto;visibility:visible;opacity:1;transition:transform var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), visibility 0ms linear, opacity var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), max-inline-size var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), max-block-size var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88);transition-delay:0ms}.header{z-index:400;display:flex;min-inline-size:0px;max-inline-size:100%;border-start-start-radius:0.25rem;border-start-end-radius:0.25rem;border-width:0px;border-block-end-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);background-color:var(--calcite-ui-foreground-1);flex:0 0 auto}.close{order:2;margin:0px;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;border-style:none;background-color:transparent;color:var(--calcite-ui-text-3);outline-color:transparent;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;border-start-end-radius:0.25rem;padding-block:var(--calcite-modal-padding, var(--calcite-modal-padding-internal));padding-inline:var(--calcite-modal-padding, var(--calcite-modal-padding-internal));flex:0 0 auto}.close calcite-icon{pointer-events:none;vertical-align:-2px}.close:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}.close:hover,.close:focus,.close:active{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1)}.title{order:1;display:flex;min-inline-size:0px;align-items:center;flex:1 1 auto;padding-block:var(--calcite-modal-padding, var(--calcite-model-padding-internal));padding-inline:var(--calcite-modal-padding-large, var(--calcite-modal-padding-large-internal))}slot[name=header]::slotted(*),*::slotted([slot=header]){margin:0px;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-1);font-size:var(--calcite-modal-title-text, var(--calcite-modal-title-text-internal))}.content{position:relative;box-sizing:border-box;display:block;block-size:100%;overflow:auto;background-color:var(--calcite-ui-foreground-1);padding:0px;max-block-size:calc(100vh - 12rem)}.content--spaced{padding:var(--calcite-modal-padding)}.content--no-footer{border-end-end-radius:0.25rem;border-end-start-radius:0.25rem}slot[name=content]::slotted(*),*::slotted([slot=content]){font-size:var(--calcite-modal-content-text, var(--calcite-modal-context-text-internal))}:host([background-color=grey]) .content{background-color:var(--calcite-ui-background)}.footer{z-index:400;-webkit-margin-before:auto;margin-block-start:auto;box-sizing:border-box;display:flex;inline-size:100%;justify-content:space-between;border-end-end-radius:0.25rem;border-end-start-radius:0.25rem;border-width:0px;border-block-start-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);background-color:var(--calcite-ui-foreground-1);flex:0 0 auto;padding-block:var(--calcite-modal-padding, var(--calcite-modal-padding-internal));padding-inline:var(--calcite-modal-padding-large, var(--calcite-modal-padding-large-internal))}.footer--hide-back .back,.footer--hide-secondary .secondary{display:none}.back{display:block;-webkit-margin-end:auto;margin-inline-end:auto}.secondary{margin-inline:0.25rem;display:block}slot[name=primary]{display:block}:host([width=small]) .modal{inline-size:auto}:host([width=s]) .modal{max-inline-size:32rem}@media screen and (max-width: 35rem){:host([width=s]) .modal{margin:0px;block-size:100%;max-block-size:100%;inline-size:100%;max-inline-size:100%;border-radius:0px}:host([width=s]) .content{flex:1 1 auto;max-block-size:unset}:host([width=s][docked]){align-items:flex-end}}:host([width=m]) .modal{max-inline-size:48rem}@media screen and (max-width: 51rem){:host([width=m]) .modal{margin:0px;block-size:100%;max-block-size:100%;inline-size:100%;max-inline-size:100%;border-radius:0px}:host([width=m]) .content{flex:1 1 auto;max-block-size:unset}:host([width=m][docked]){align-items:flex-end}}:host([width=l]) .modal{max-inline-size:94rem}@media screen and (max-width: 97rem){:host([width=l]) .modal{margin:0px;block-size:100%;max-block-size:100%;inline-size:100%;max-inline-size:100%;border-radius:0px}:host([width=l]) .content{flex:1 1 auto;max-block-size:unset}:host([width=l][docked]){align-items:flex-end}}:host([fullscreen]){background-color:transparent}:host([fullscreen]) .modal{margin:0px;block-size:100%;max-block-size:100%;inline-size:100%;max-inline-size:100%;--calcite-modal-hidden-position:translate3D(0, 20px, 0) scale(0.95);--calcite-modal-shown-position:translate3D(0, 0, 0) scale(1)}:host([fullscreen]) .content{max-block-size:100%;flex:1 1 auto}:host([open][fullscreen]) .header{border-radius:0}:host([open][fullscreen]) .footer{border-radius:0}:host([docked]) .modal{block-size:auto}:host([docked]) .content{block-size:auto;flex:1 1 auto}@media screen and (max-width: 860px){:host([docked]) .modal{border-radius:var(--calcite-border-radius) var(--calcite-border-radius) 0 0}:host([docked]) .close{border-start-end-radius:var(--calcite-border-radius)}}:host([color=red]) .modal{border-color:var(--calcite-ui-danger)}:host([color=blue]) .modal{border-color:var(--calcite-ui-info)}:host([color=red]) .modal,:host([color=blue]) .modal{border-width:0px;border-block-start-width:4px;border-style:solid}:host([color=red]) .header,:host([color=blue]) .header{border-radius:0.25rem;border-end-end-radius:0px;border-end-start-radius:0px}@media screen and (max-width: 860px){slot[name=header]::slotted(*),*::slotted([slot=header]){font-size:var(--calcite-font-size-1)}.footer{position:sticky;inset-block-end:0px}}@media screen and (max-width: 480px){.footer{flex-direction:column}.back,.secondary{margin:0px;-webkit-margin-after:0.25rem;margin-block-end:0.25rem}}";
|
156
|
+
|
157
|
+
const isFocusableExtended = (el) => {
|
158
|
+
return isCalciteFocusable(el) || isFocusable(el);
|
159
|
+
};
|
160
|
+
const getFocusableElements = (el) => {
|
161
|
+
return queryShadowRoot(el, isHidden, isFocusableExtended);
|
162
|
+
};
|
163
|
+
const Modal = class {
|
164
|
+
constructor(hostRef) {
|
165
|
+
registerInstance(this, hostRef);
|
166
|
+
this.calciteModalBeforeClose = createEvent(this, "calciteModalBeforeClose", 6);
|
167
|
+
this.calciteModalClose = createEvent(this, "calciteModalClose", 6);
|
168
|
+
this.calciteModalBeforeOpen = createEvent(this, "calciteModalBeforeOpen", 6);
|
169
|
+
this.calciteModalOpen = createEvent(this, "calciteModalOpen", 6);
|
170
|
+
//--------------------------------------------------------------------------
|
171
|
+
//
|
172
|
+
// Properties
|
173
|
+
//
|
174
|
+
//--------------------------------------------------------------------------
|
175
|
+
/**
|
176
|
+
* When `true`, the component is active.
|
177
|
+
*
|
178
|
+
* @deprecated use `open` instead.
|
179
|
+
*/
|
180
|
+
this.active = false;
|
181
|
+
/** When `true`, displays and positions the component. */
|
182
|
+
this.open = false;
|
183
|
+
/** Passes a function to run before the component closes. */
|
184
|
+
this.beforeClose = () => Promise.resolve();
|
185
|
+
/** When `true`, disables the component's close button. */
|
186
|
+
this.disableCloseButton = false;
|
187
|
+
/** When `true`, disables the closing of the component when clicked outside. */
|
188
|
+
this.disableOutsideClose = false;
|
189
|
+
/** Accessible name for the component's close button. */
|
190
|
+
this.intlClose = TEXT.close;
|
191
|
+
/** When `true`, disables the default close on escape behavior. */
|
192
|
+
this.disableEscape = false;
|
193
|
+
/** Specifies the size of the component. */
|
194
|
+
this.scale = "m";
|
195
|
+
/** Specifies the width of the component. Can use scale sizes or pass a number (displays in pixels). */
|
196
|
+
this.width = "m";
|
197
|
+
/** Sets the background color of the component's content. */
|
198
|
+
this.backgroundColor = "white";
|
199
|
+
/**
|
200
|
+
* When `true`, disables spacing to the content area slot.
|
201
|
+
*
|
202
|
+
* @deprecated Use `--calcite-modal-padding` CSS variable instead.
|
203
|
+
*/
|
204
|
+
this.noPadding = false;
|
205
|
+
//--------------------------------------------------------------------------
|
206
|
+
//
|
207
|
+
// Variables
|
208
|
+
//
|
209
|
+
//--------------------------------------------------------------------------
|
210
|
+
this.hasFooter = true;
|
211
|
+
/**
|
212
|
+
* We use internal variable to make sure initially open modal can transition from closed state when rendered
|
213
|
+
*
|
214
|
+
* @private
|
215
|
+
*/
|
216
|
+
this.isOpen = false;
|
217
|
+
this.mutationObserver = createObserver("mutation", () => this.updateFooterVisibility());
|
218
|
+
this.openTransitionProp = "opacity";
|
219
|
+
//--------------------------------------------------------------------------
|
220
|
+
//
|
221
|
+
// Private Methods
|
222
|
+
//
|
223
|
+
//--------------------------------------------------------------------------
|
224
|
+
this.setTransitionEl = (el) => {
|
225
|
+
this.transitionEl = el;
|
226
|
+
connectOpenCloseComponent(this);
|
227
|
+
};
|
228
|
+
this.openEnd = () => {
|
229
|
+
this.setFocus();
|
230
|
+
this.el.removeEventListener("calciteModalOpen", this.openEnd);
|
231
|
+
};
|
232
|
+
this.handleOutsideClose = () => {
|
233
|
+
if (this.disableOutsideClose) {
|
234
|
+
return;
|
235
|
+
}
|
236
|
+
this.close();
|
237
|
+
};
|
238
|
+
/** Close the modal, first running the `beforeClose` method */
|
239
|
+
this.close = () => {
|
240
|
+
return this.beforeClose(this.el).then(() => {
|
241
|
+
this.open = false;
|
242
|
+
this.isOpen = false;
|
243
|
+
focusElement(this.previousActiveElement);
|
244
|
+
this.removeOverflowHiddenClass();
|
245
|
+
});
|
246
|
+
};
|
247
|
+
this.focusFirstElement = () => {
|
248
|
+
focusElement(this.disableCloseButton ? getFocusableElements(this.el)[0] : this.closeButtonEl);
|
249
|
+
};
|
250
|
+
this.focusLastElement = () => {
|
251
|
+
const focusableElements = getFocusableElements(this.el).filter((el) => !el.getAttribute("data-focus-fence"));
|
252
|
+
if (focusableElements.length > 0) {
|
253
|
+
focusElement(focusableElements[focusableElements.length - 1]);
|
254
|
+
}
|
255
|
+
else {
|
256
|
+
focusElement(this.closeButtonEl);
|
257
|
+
}
|
258
|
+
};
|
259
|
+
this.updateFooterVisibility = () => {
|
260
|
+
this.hasFooter = !!getSlotted(this.el, [SLOTS.back, SLOTS.primary, SLOTS.secondary]);
|
261
|
+
};
|
262
|
+
}
|
263
|
+
//--------------------------------------------------------------------------
|
264
|
+
//
|
265
|
+
// Lifecycle
|
266
|
+
//
|
267
|
+
//--------------------------------------------------------------------------
|
268
|
+
componentWillLoad() {
|
269
|
+
// when modal initially renders, if active was set we need to open as watcher doesn't fire
|
270
|
+
if (this.open) {
|
271
|
+
requestAnimationFrame(() => this.openModal());
|
272
|
+
}
|
273
|
+
}
|
274
|
+
connectedCallback() {
|
275
|
+
var _a;
|
276
|
+
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
|
277
|
+
this.updateFooterVisibility();
|
278
|
+
connectConditionalSlotComponent(this);
|
279
|
+
connectOpenCloseComponent(this);
|
280
|
+
if (this.open) {
|
281
|
+
this.active = this.open;
|
282
|
+
}
|
283
|
+
if (this.active) {
|
284
|
+
this.activeHandler(this.active);
|
285
|
+
}
|
286
|
+
}
|
287
|
+
disconnectedCallback() {
|
288
|
+
var _a;
|
289
|
+
this.removeOverflowHiddenClass();
|
290
|
+
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
291
|
+
disconnectConditionalSlotComponent(this);
|
292
|
+
disconnectOpenCloseComponent(this);
|
293
|
+
}
|
294
|
+
render() {
|
295
|
+
return (h(Host, { "aria-describedby": this.contentId, "aria-labelledby": this.titleId, "aria-modal": "true", role: "dialog" }, h("calcite-scrim", { class: CSS.scrim, onClick: this.handleOutsideClose }), this.renderStyle(), h("div", { class: {
|
296
|
+
[CSS.modal]: true,
|
297
|
+
[CSS.modalOpen]: this.isOpen
|
298
|
+
}, ref: this.setTransitionEl }, h("div", { "data-focus-fence": true, onFocus: this.focusLastElement, tabindex: "0" }), h("div", { class: CSS.header }, this.renderCloseButton(), h("header", { class: CSS.title }, h("slot", { name: CSS.header }))), h("div", { class: {
|
299
|
+
content: true,
|
300
|
+
"content--spaced": !this.noPadding,
|
301
|
+
"content--no-footer": !this.hasFooter
|
302
|
+
}, ref: (el) => (this.modalContent = el) }, h("slot", { name: SLOTS.content })), this.renderFooter(), h("div", { "data-focus-fence": true, onFocus: this.focusFirstElement, tabindex: "0" }))));
|
303
|
+
}
|
304
|
+
renderFooter() {
|
305
|
+
return this.hasFooter ? (h("div", { class: CSS.footer, key: "footer" }, h("span", { class: CSS.back }, h("slot", { name: SLOTS.back })), h("span", { class: CSS.secondary }, h("slot", { name: SLOTS.secondary })), h("span", { class: CSS.primary }, h("slot", { name: SLOTS.primary })))) : null;
|
306
|
+
}
|
307
|
+
renderCloseButton() {
|
308
|
+
return !this.disableCloseButton ? (h("button", { "aria-label": this.intlClose, class: CSS.close, key: "button", onClick: this.close, ref: (el) => (this.closeButtonEl = el), title: this.intlClose }, h("calcite-icon", { icon: ICONS.close, scale: this.scale === "s" ? "s" : this.scale === "m" ? "m" : this.scale === "l" ? "l" : null }))) : null;
|
309
|
+
}
|
310
|
+
renderStyle() {
|
311
|
+
const hasCustomWidth = !isNaN(parseInt(`${this.width}`));
|
312
|
+
return hasCustomWidth ? (h("style", null, `
|
313
|
+
.${CSS.modal} {
|
314
|
+
max-width: ${this.width}px !important;
|
315
|
+
}
|
316
|
+
@media screen and (max-width: ${this.width}px) {
|
317
|
+
.${CSS.modal} {
|
318
|
+
height: 100% !important;
|
319
|
+
max-height: 100% !important;
|
320
|
+
width: 100% !important;
|
321
|
+
max-width: 100% !important;
|
322
|
+
margin: 0 !important;
|
323
|
+
border-radius: 0 !important;
|
324
|
+
}
|
325
|
+
.content {
|
326
|
+
flex: 1 1 auto !important;
|
327
|
+
max-height: unset !important;
|
328
|
+
}
|
329
|
+
}
|
330
|
+
`)) : null;
|
331
|
+
}
|
332
|
+
//--------------------------------------------------------------------------
|
333
|
+
//
|
334
|
+
// Event Listeners
|
335
|
+
//
|
336
|
+
//--------------------------------------------------------------------------
|
337
|
+
handleEscape(event) {
|
338
|
+
if (this.open && !this.disableEscape && event.key === "Escape" && !event.defaultPrevented) {
|
339
|
+
this.close();
|
340
|
+
event.preventDefault();
|
341
|
+
}
|
342
|
+
}
|
343
|
+
//--------------------------------------------------------------------------
|
344
|
+
//
|
345
|
+
// Public Methods
|
346
|
+
//
|
347
|
+
//--------------------------------------------------------------------------
|
348
|
+
/**
|
349
|
+
* Focus the first interactive element.
|
350
|
+
*
|
351
|
+
* @param el
|
352
|
+
* @deprecated use `setFocus` instead.
|
353
|
+
*/
|
354
|
+
async focusElement(el) {
|
355
|
+
if (el) {
|
356
|
+
el.focus();
|
357
|
+
}
|
358
|
+
return this.setFocus();
|
359
|
+
}
|
360
|
+
/**
|
361
|
+
* Sets focus on the component.
|
362
|
+
*
|
363
|
+
* By default, tries to focus on focusable content. If there is none, it will focus on the close button.
|
364
|
+
* To focus on the close button, use the `close-button` focus ID.
|
365
|
+
*
|
366
|
+
* @param focusId
|
367
|
+
*/
|
368
|
+
async setFocus(focusId) {
|
369
|
+
const closeButton = this.closeButtonEl;
|
370
|
+
return focusElement(focusId === "close-button" ? closeButton : getFocusableElements(this.el)[0] || closeButton);
|
371
|
+
}
|
372
|
+
/**
|
373
|
+
* Sets the scroll top of the component's content.
|
374
|
+
*
|
375
|
+
* @param top
|
376
|
+
* @param left
|
377
|
+
*/
|
378
|
+
async scrollContent(top = 0, left = 0) {
|
379
|
+
if (this.modalContent) {
|
380
|
+
if (this.modalContent.scrollTo) {
|
381
|
+
this.modalContent.scrollTo({ top, left, behavior: "smooth" });
|
382
|
+
}
|
383
|
+
else {
|
384
|
+
this.modalContent.scrollTop = top;
|
385
|
+
this.modalContent.scrollLeft = left;
|
386
|
+
}
|
387
|
+
}
|
388
|
+
}
|
389
|
+
onBeforeOpen() {
|
390
|
+
this.transitionEl.classList.add(CSS.openingActive);
|
391
|
+
this.calciteModalBeforeOpen.emit();
|
392
|
+
}
|
393
|
+
onOpen() {
|
394
|
+
this.transitionEl.classList.remove(CSS.openingIdle, CSS.openingActive);
|
395
|
+
this.calciteModalOpen.emit();
|
396
|
+
}
|
397
|
+
onBeforeClose() {
|
398
|
+
this.transitionEl.classList.add(CSS.closingActive);
|
399
|
+
this.calciteModalBeforeClose.emit();
|
400
|
+
}
|
401
|
+
onClose() {
|
402
|
+
this.transitionEl.classList.remove(CSS.closingIdle, CSS.closingActive);
|
403
|
+
this.calciteModalClose.emit();
|
404
|
+
}
|
405
|
+
activeHandler(value) {
|
406
|
+
this.open = value;
|
407
|
+
}
|
408
|
+
async toggleModal(value) {
|
409
|
+
var _a, _b;
|
410
|
+
this.active = value;
|
411
|
+
if (value) {
|
412
|
+
(_a = this.transitionEl) === null || _a === void 0 ? void 0 : _a.classList.add(CSS.openingIdle);
|
413
|
+
this.openModal();
|
414
|
+
}
|
415
|
+
else {
|
416
|
+
(_b = this.transitionEl) === null || _b === void 0 ? void 0 : _b.classList.add(CSS.closingIdle);
|
417
|
+
this.close();
|
418
|
+
}
|
419
|
+
}
|
420
|
+
/** Open the modal */
|
421
|
+
openModal() {
|
422
|
+
this.previousActiveElement = document.activeElement;
|
423
|
+
this.el.addEventListener("calciteModalOpen", this.openEnd);
|
424
|
+
this.open = true;
|
425
|
+
this.isOpen = true;
|
426
|
+
const titleEl = getSlotted(this.el, SLOTS.header);
|
427
|
+
const contentEl = getSlotted(this.el, SLOTS.content);
|
428
|
+
this.titleId = ensureId(titleEl);
|
429
|
+
this.contentId = ensureId(contentEl);
|
430
|
+
document.documentElement.classList.add(CSS.overflowHidden);
|
431
|
+
}
|
432
|
+
removeOverflowHiddenClass() {
|
433
|
+
document.documentElement.classList.remove(CSS.overflowHidden);
|
434
|
+
}
|
435
|
+
get el() { return getElement(this); }
|
436
|
+
static get watchers() { return {
|
437
|
+
"active": ["activeHandler"],
|
438
|
+
"open": ["toggleModal"]
|
439
|
+
}; }
|
440
|
+
};
|
441
|
+
Modal.style = modalCss;
|
442
|
+
|
443
|
+
export { Modal as calcite_modal };
|
@@ -0,0 +1,214 @@
|
|
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, g as getElement } from './p-c023e6a1.js';
|
7
|
+
import { g as guid } from './p-a80b3880.js';
|
8
|
+
import { u as updateHostInteraction } from './p-7daea1df.js';
|
9
|
+
|
10
|
+
/*!
|
11
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
12
|
+
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
13
|
+
* v1.0.0-beta.97
|
14
|
+
*/
|
15
|
+
const CSS = {
|
16
|
+
checked: "checked",
|
17
|
+
description: "description",
|
18
|
+
descriptionOnly: "description-only",
|
19
|
+
disabled: "disabled",
|
20
|
+
heading: "heading",
|
21
|
+
headingOnly: "heading-only",
|
22
|
+
icon: "icon",
|
23
|
+
iconOnly: "icon-only",
|
24
|
+
inputAlignmentEnd: "input-alignment-end",
|
25
|
+
inputAlignmentStart: "input-alignment-start",
|
26
|
+
inputEnabled: "input-enabled",
|
27
|
+
largeVisual: "large-visual",
|
28
|
+
widthAuto: "width-auto",
|
29
|
+
widthFull: "width-full"
|
30
|
+
};
|
31
|
+
|
32
|
+
const tileSelectCss = "@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([disabled]){pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host{display:block}:host .container{background-color:var(--calcite-ui-foreground-1);box-shadow:0 0 0 1px var(--calcite-ui-border-2);box-sizing:border-box;cursor:pointer;display:inline-block;block-size:100%;max-inline-size:300px;padding:0.75rem;position:relative;vertical-align:top;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}:host .container.checked{z-index:1;box-shadow:0 0 0 1px var(--calcite-ui-brand)}:host .container.heading-only{align-items:center}:host .container:not(.input-enabled) ::slotted(calcite-checkbox),:host .container:not(.input-enabled) ::slotted(calcite-radio-button){position:absolute;inline-size:1px;block-size:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}:host .container.focused{outline-color:transparent}:host .container.focused:not(.disabled):not(.input-enabled){outline:2px solid var(--calcite-ui-brand);outline-offset:-4px;box-shadow:0 0 0 1px var(--calcite-ui-brand), inset 0 0 0 2px var(--calcite-ui-foreground-1)}:host .container.input-enabled.input-alignment-start.width-auto.heading-only,:host .container.input-enabled.input-alignment-start.width-auto.icon-only,:host .container.input-enabled.input-alignment-start.width-auto.description-only,:host .container.input-enabled.input-alignment-start.width-auto.heading.description,:host .container.input-enabled.input-alignment-start.width-auto.icon.description,:host .container.input-enabled.input-alignment-start.width-auto.heading.icon.description{display:inline-grid;grid-template-columns:max-content 1fr}:host .container.input-enabled.input-alignment-start.heading-only,:host .container.input-enabled.input-alignment-start.icon-only,:host .container.input-enabled.input-alignment-start.description-only,:host .container.input-enabled.input-alignment-start.heading.description,:host .container.input-enabled.input-alignment-start.icon.description,:host .container.input-enabled.input-alignment-start.heading.icon.description{gap:0.75rem}:host .container.input-enabled.input-alignment-start calcite-tile{order:1}:host .container.input-enabled.input-alignment-start.large-visual ::slotted(calcite-checkbox),:host .container.input-enabled.input-alignment-start.large-visual ::slotted(calcite-radio-button){position:absolute;inset-block-start:0.75rem;inset-inline-start:0.75rem}:host .container.input-enabled.input-alignment-end.width-auto.heading-only,:host .container.input-enabled.input-alignment-end.width-auto.icon-only{display:inline-grid;grid-gap:0.75rem;grid-template-columns:max-content 1fr}:host .container.input-enabled.input-alignment-end.heading-only,:host .container.input-enabled.input-alignment-end.icon-only{gap:0.75rem}:host .container.input-enabled.input-alignment-end.description-only ::slotted(calcite-checkbox),:host .container.input-enabled.input-alignment-end.description-only ::slotted(calcite-radio-button),:host .container.input-enabled.input-alignment-end.heading.description ::slotted(calcite-checkbox),:host .container.input-enabled.input-alignment-end.heading.description ::slotted(calcite-radio-button),:host .container.input-enabled.input-alignment-end.icon.description ::slotted(calcite-checkbox),:host .container.input-enabled.input-alignment-end.icon.description ::slotted(calcite-radio-button),:host .container.input-enabled.input-alignment-end.heading.icon.description ::slotted(calcite-checkbox),:host .container.input-enabled.input-alignment-end.heading.icon.description ::slotted(calcite-radio-button){position:absolute;inset-block-start:0.75rem;inset-inline-end:0.75rem}:host .container.input-enabled.input-alignment-end.large-visual ::slotted(calcite-checkbox),:host .container.input-enabled.input-alignment-end.large-visual ::slotted(calcite-radio-button){position:absolute;inset-block-start:0.75rem;inset-inline-end:0.75rem}:host .container.width-full{display:flex;max-inline-size:none}:host .container.width-full calcite-tile{flex:1 1 auto}:host(:hover) .container:not(.input-enabled){box-shadow:0 0 0 1px var(--calcite-ui-brand)}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}";
|
33
|
+
|
34
|
+
const TileSelect = class {
|
35
|
+
constructor(hostRef) {
|
36
|
+
registerInstance(this, hostRef);
|
37
|
+
this.calciteTileSelectChange = createEvent(this, "calciteTileSelectChange", 6);
|
38
|
+
//--------------------------------------------------------------------------
|
39
|
+
//
|
40
|
+
// Properties
|
41
|
+
//
|
42
|
+
//--------------------------------------------------------------------------
|
43
|
+
/** When `true`, the component is checked. */
|
44
|
+
this.checked = false;
|
45
|
+
/** When `true`, interaction is prevented and the component is displayed with lower opacity. */
|
46
|
+
this.disabled = false;
|
47
|
+
/** When `true`, the component is not displayed and is not focusable or checkable. */
|
48
|
+
this.hidden = false;
|
49
|
+
/** When `true`, displays an interactive input based on the `type` property. */
|
50
|
+
this.inputEnabled = false;
|
51
|
+
/** When `inputEnabled` is `true`, specifies the placement of the interactive input on the component. */
|
52
|
+
this.inputAlignment = "start";
|
53
|
+
/**
|
54
|
+
* The selection mode of the component.
|
55
|
+
*
|
56
|
+
* Use radio for single selection, and checkbox for multiple selections.
|
57
|
+
*/
|
58
|
+
this.type = "radio";
|
59
|
+
/** Specifies the width of the component. */
|
60
|
+
this.width = "auto";
|
61
|
+
this.guid = `calcite-tile-select-${guid()}`;
|
62
|
+
//--------------------------------------------------------------------------
|
63
|
+
//
|
64
|
+
// State
|
65
|
+
//
|
66
|
+
//--------------------------------------------------------------------------
|
67
|
+
/** The focused state of the tile-select. */
|
68
|
+
this.focused = false;
|
69
|
+
}
|
70
|
+
checkedChanged(newChecked) {
|
71
|
+
this.input.checked = newChecked;
|
72
|
+
}
|
73
|
+
nameChanged(newName) {
|
74
|
+
this.input.name = newName;
|
75
|
+
}
|
76
|
+
//--------------------------------------------------------------------------
|
77
|
+
//
|
78
|
+
// Public Methods
|
79
|
+
//
|
80
|
+
//--------------------------------------------------------------------------
|
81
|
+
/** Sets focus on the component. */
|
82
|
+
async setFocus() {
|
83
|
+
var _a;
|
84
|
+
(_a = this.input) === null || _a === void 0 ? void 0 : _a.setFocus();
|
85
|
+
}
|
86
|
+
//--------------------------------------------------------------------------
|
87
|
+
//
|
88
|
+
// Event Listeners
|
89
|
+
//
|
90
|
+
//--------------------------------------------------------------------------
|
91
|
+
checkboxChangeHandler(event) {
|
92
|
+
const checkbox = event.target;
|
93
|
+
if (checkbox === this.input) {
|
94
|
+
this.checked = checkbox.checked;
|
95
|
+
}
|
96
|
+
event.stopPropagation();
|
97
|
+
this.calciteTileSelectChange.emit();
|
98
|
+
}
|
99
|
+
checkboxFocusBlurHandler(event) {
|
100
|
+
const checkbox = event.target;
|
101
|
+
if (checkbox === this.input) {
|
102
|
+
this.focused = event.detail;
|
103
|
+
}
|
104
|
+
event.stopPropagation();
|
105
|
+
}
|
106
|
+
radioButtonChangeHandler(event) {
|
107
|
+
const radioButton = event.target;
|
108
|
+
if (radioButton === this.input) {
|
109
|
+
this.checked = radioButton.checked;
|
110
|
+
}
|
111
|
+
event.stopPropagation();
|
112
|
+
this.calciteTileSelectChange.emit();
|
113
|
+
}
|
114
|
+
radioButtonCheckedChangeHandler(event) {
|
115
|
+
const radioButton = event.target;
|
116
|
+
if (radioButton === this.input) {
|
117
|
+
this.checked = radioButton.checked;
|
118
|
+
}
|
119
|
+
event.stopPropagation();
|
120
|
+
}
|
121
|
+
radioButtonFocusBlurHandler(event) {
|
122
|
+
const radioButton = event.target;
|
123
|
+
if (radioButton === this.input) {
|
124
|
+
this.focused = radioButton.focused;
|
125
|
+
}
|
126
|
+
event.stopPropagation();
|
127
|
+
}
|
128
|
+
click(event) {
|
129
|
+
const target = event.target;
|
130
|
+
const targets = ["calcite-tile", "calcite-tile-select"];
|
131
|
+
if (targets.includes(target.localName)) {
|
132
|
+
this.input.click();
|
133
|
+
}
|
134
|
+
}
|
135
|
+
mouseenter() {
|
136
|
+
if (this.input.localName === "calcite-radio-button") {
|
137
|
+
this.input.hovered = true;
|
138
|
+
}
|
139
|
+
if (this.input.localName === "calcite-checkbox") {
|
140
|
+
this.input.hovered = true;
|
141
|
+
}
|
142
|
+
}
|
143
|
+
mouseleave() {
|
144
|
+
if (this.input.localName === "calcite-radio-button") {
|
145
|
+
this.input.hovered = false;
|
146
|
+
}
|
147
|
+
if (this.input.localName === "calcite-checkbox") {
|
148
|
+
this.input.hovered = false;
|
149
|
+
}
|
150
|
+
}
|
151
|
+
//--------------------------------------------------------------------------
|
152
|
+
//
|
153
|
+
// Lifecycle
|
154
|
+
//
|
155
|
+
//--------------------------------------------------------------------------
|
156
|
+
connectedCallback() {
|
157
|
+
this.renderInput();
|
158
|
+
}
|
159
|
+
disconnectedCallback() {
|
160
|
+
this.input.parentNode.removeChild(this.input);
|
161
|
+
}
|
162
|
+
componentDidRender() {
|
163
|
+
updateHostInteraction(this);
|
164
|
+
}
|
165
|
+
// --------------------------------------------------------------------------
|
166
|
+
//
|
167
|
+
// Render Methods
|
168
|
+
//
|
169
|
+
// --------------------------------------------------------------------------
|
170
|
+
renderInput() {
|
171
|
+
this.input = document.createElement(this.type === "radio" ? "calcite-radio-button" : "calcite-checkbox");
|
172
|
+
this.input.checked = this.checked;
|
173
|
+
this.input.disabled = this.disabled;
|
174
|
+
this.input.hidden = this.hidden;
|
175
|
+
this.input.id = this.guid;
|
176
|
+
this.input.label = this.heading || this.name || "";
|
177
|
+
if (this.name) {
|
178
|
+
this.input.name = this.name;
|
179
|
+
}
|
180
|
+
if (this.value) {
|
181
|
+
this.input.value = this.value != null ? this.value.toString() : "";
|
182
|
+
}
|
183
|
+
this.el.insertAdjacentElement("beforeend", this.input);
|
184
|
+
}
|
185
|
+
render() {
|
186
|
+
const { checked, description, disabled, focused, heading, icon, inputAlignment, inputEnabled, width } = this;
|
187
|
+
return (h("div", { class: {
|
188
|
+
checked,
|
189
|
+
container: true,
|
190
|
+
[CSS.description]: Boolean(description),
|
191
|
+
[CSS.descriptionOnly]: Boolean(!heading && !icon && description),
|
192
|
+
disabled,
|
193
|
+
focused,
|
194
|
+
[CSS.heading]: Boolean(heading),
|
195
|
+
[CSS.headingOnly]: heading && !icon && !description,
|
196
|
+
[CSS.icon]: Boolean(icon),
|
197
|
+
[CSS.iconOnly]: !heading && icon && !description,
|
198
|
+
[CSS.inputAlignmentEnd]: inputAlignment === "end",
|
199
|
+
[CSS.inputAlignmentStart]: inputAlignment === "start",
|
200
|
+
[CSS.inputEnabled]: inputEnabled,
|
201
|
+
[CSS.largeVisual]: heading && icon && !description,
|
202
|
+
[CSS.widthAuto]: width === "auto",
|
203
|
+
[CSS.widthFull]: width === "full"
|
204
|
+
} }, h("calcite-tile", { active: checked, description: description, embed: true, heading: heading, icon: icon }), h("slot", null)));
|
205
|
+
}
|
206
|
+
get el() { return getElement(this); }
|
207
|
+
static get watchers() { return {
|
208
|
+
"checked": ["checkedChanged"],
|
209
|
+
"name": ["nameChanged"]
|
210
|
+
}; }
|
211
|
+
};
|
212
|
+
TileSelect.style = tileSelectCss;
|
213
|
+
|
214
|
+
export { TileSelect as calcite_tile_select };
|