@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,723 @@
|
|
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, F as Fragment, g as getElement, f as forceUpdate, H as Host } from './p-c023e6a1.js';
|
7
|
+
import { C as CSS$1, I as ICONS, S as SLOTS } from './p-6e0da576.js';
|
8
|
+
import { t as toAriaBoolean, i as isPrimaryPointerButton, f as focusElement, q as queryElementRoots } from './p-83166522.js';
|
9
|
+
import { g as getRoundRobinIndex } from './p-e947d3b0.js';
|
10
|
+
import { g as guid } from './p-a80b3880.js';
|
11
|
+
import { i as isActivationKey } from './p-73e23995.js';
|
12
|
+
import { b as defaultOffsetDistance, f as filterComputedPlacements, c as connectFloatingUI, u as updateAfterClose, a as disconnectFloatingUI, r as reposition, F as FloatingCSS } from './p-cdc46c0c.js';
|
13
|
+
import { c as connectOpenCloseComponent, d as disconnectOpenCloseComponent } from './p-2e9ed892.js';
|
14
|
+
import { H as Heading } from './p-508317b3.js';
|
15
|
+
import './p-729708a3.js';
|
16
|
+
import './p-4e32bf8c.js';
|
17
|
+
|
18
|
+
const actionMenuCss = "@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{box-sizing:border-box;display:flex;flex-direction:column;background-color:var(--calcite-ui-foreground-1);font-size:var(--calcite-font-size-1);color:var(--calcite-ui-text-2)}.menu ::slotted(calcite-action){margin:0.125rem;display:flex;outline-color:transparent}.menu ::slotted(calcite-action[active]){outline:2px solid var(--calcite-ui-brand);outline-offset:0px}.default-trigger{position:relative;block-size:100%;flex:0 1 auto;align-self:stretch}slot[name=trigger]::slotted(calcite-action),calcite-action::slotted([slot=trigger]){position:relative;block-size:100%;flex:0 1 auto;align-self:stretch}.menu{flex-direction:column;flex-wrap:nowrap;outline:2px solid transparent;outline-offset:2px}";
|
19
|
+
|
20
|
+
const SUPPORTED_MENU_NAV_KEYS = ["ArrowUp", "ArrowDown", "End", "Home"];
|
21
|
+
const ActionMenu = class {
|
22
|
+
constructor(hostRef) {
|
23
|
+
registerInstance(this, hostRef);
|
24
|
+
this.calciteActionMenuOpenChange = createEvent(this, "calciteActionMenuOpenChange", 6);
|
25
|
+
// --------------------------------------------------------------------------
|
26
|
+
//
|
27
|
+
// Properties
|
28
|
+
//
|
29
|
+
// --------------------------------------------------------------------------
|
30
|
+
/**
|
31
|
+
* When `true`, the component is expanded.
|
32
|
+
*/
|
33
|
+
this.expanded = false;
|
34
|
+
/**
|
35
|
+
* When `true`, the component is open.
|
36
|
+
*/
|
37
|
+
this.open = false;
|
38
|
+
/**
|
39
|
+
* Determines the type of positioning to use for the overlaid content.
|
40
|
+
*
|
41
|
+
* Using `"absolute"` will work for most cases. The component will be positioned inside of overflowing parent containers and will affect the container's layout.
|
42
|
+
* `"fixed"` should be used to escape an overflowing parent container, or when the reference element's `position` CSS property is `"fixed"`.
|
43
|
+
*
|
44
|
+
*/
|
45
|
+
this.overlayPositioning = "absolute";
|
46
|
+
/**
|
47
|
+
* Determines where the component will be positioned relative to the `referenceElement`.
|
48
|
+
*
|
49
|
+
* @see [LogicalPlacement](https://github.com/Esri/calcite-components/blob/master/src/utils/floating-ui.ts#L25)
|
50
|
+
*/
|
51
|
+
this.placement = "auto";
|
52
|
+
this.actionElements = [];
|
53
|
+
this.guid = `calcite-action-menu-${guid()}`;
|
54
|
+
this.menuId = `${this.guid}-menu`;
|
55
|
+
this.menuButtonId = `${this.guid}-menu-button`;
|
56
|
+
this.activeMenuItemIndex = -1;
|
57
|
+
// --------------------------------------------------------------------------
|
58
|
+
//
|
59
|
+
// Component Methods
|
60
|
+
//
|
61
|
+
// --------------------------------------------------------------------------
|
62
|
+
this.connectMenuButtonEl = () => {
|
63
|
+
const { menuButtonId, menuId, open, label } = this;
|
64
|
+
const menuButtonEl = this.slottedMenuButtonEl || this.defaultMenuButtonEl;
|
65
|
+
if (this.menuButtonEl === menuButtonEl) {
|
66
|
+
return;
|
67
|
+
}
|
68
|
+
this.disconnectMenuButtonEl();
|
69
|
+
this.menuButtonEl = menuButtonEl;
|
70
|
+
this.setTooltipReferenceElement();
|
71
|
+
if (!menuButtonEl) {
|
72
|
+
return;
|
73
|
+
}
|
74
|
+
menuButtonEl.active = open;
|
75
|
+
menuButtonEl.setAttribute("aria-controls", menuId);
|
76
|
+
menuButtonEl.setAttribute("aria-expanded", toAriaBoolean(open));
|
77
|
+
menuButtonEl.setAttribute("aria-haspopup", "true");
|
78
|
+
if (!menuButtonEl.id) {
|
79
|
+
menuButtonEl.id = menuButtonId;
|
80
|
+
}
|
81
|
+
if (!menuButtonEl.label) {
|
82
|
+
menuButtonEl.label = label;
|
83
|
+
}
|
84
|
+
if (!menuButtonEl.text) {
|
85
|
+
menuButtonEl.text = label;
|
86
|
+
}
|
87
|
+
menuButtonEl.addEventListener("pointerdown", this.menuButtonClick);
|
88
|
+
menuButtonEl.addEventListener("keydown", this.menuButtonKeyDown);
|
89
|
+
};
|
90
|
+
this.disconnectMenuButtonEl = () => {
|
91
|
+
const { menuButtonEl } = this;
|
92
|
+
if (!menuButtonEl) {
|
93
|
+
return;
|
94
|
+
}
|
95
|
+
menuButtonEl.removeEventListener("pointerdown", this.menuButtonClick);
|
96
|
+
menuButtonEl.removeEventListener("keydown", this.menuButtonKeyDown);
|
97
|
+
};
|
98
|
+
this.setMenuButtonEl = (event) => {
|
99
|
+
const actions = event.target
|
100
|
+
.assignedElements({
|
101
|
+
flatten: true
|
102
|
+
})
|
103
|
+
.filter((el) => el === null || el === void 0 ? void 0 : el.matches("calcite-action"));
|
104
|
+
this.slottedMenuButtonEl = actions[0];
|
105
|
+
this.connectMenuButtonEl();
|
106
|
+
};
|
107
|
+
this.setDefaultMenuButtonEl = (el) => {
|
108
|
+
this.defaultMenuButtonEl = el;
|
109
|
+
this.connectMenuButtonEl();
|
110
|
+
};
|
111
|
+
// --------------------------------------------------------------------------
|
112
|
+
//
|
113
|
+
// Private Methods
|
114
|
+
//
|
115
|
+
// --------------------------------------------------------------------------
|
116
|
+
this.handleCalciteActionClick = () => {
|
117
|
+
this.open = false;
|
118
|
+
this.setFocus();
|
119
|
+
};
|
120
|
+
this.menuButtonClick = (event) => {
|
121
|
+
if (!isPrimaryPointerButton(event)) {
|
122
|
+
return;
|
123
|
+
}
|
124
|
+
this.toggleOpen();
|
125
|
+
};
|
126
|
+
this.updateTooltip = (event) => {
|
127
|
+
const tooltips = event.target
|
128
|
+
.assignedElements({
|
129
|
+
flatten: true
|
130
|
+
})
|
131
|
+
.filter((el) => el === null || el === void 0 ? void 0 : el.matches("calcite-tooltip"));
|
132
|
+
this.tooltipEl = tooltips[0];
|
133
|
+
this.setTooltipReferenceElement();
|
134
|
+
};
|
135
|
+
this.setTooltipReferenceElement = () => {
|
136
|
+
const { tooltipEl, expanded, menuButtonEl, open } = this;
|
137
|
+
if (tooltipEl) {
|
138
|
+
tooltipEl.referenceElement = !expanded && !open ? menuButtonEl : null;
|
139
|
+
}
|
140
|
+
};
|
141
|
+
this.updateAction = (action, index) => {
|
142
|
+
const { guid, activeMenuItemIndex } = this;
|
143
|
+
const id = `${guid}-action-${index}`;
|
144
|
+
action.tabIndex = -1;
|
145
|
+
action.setAttribute("role", "menuitem");
|
146
|
+
if (!action.id) {
|
147
|
+
action.id = id;
|
148
|
+
}
|
149
|
+
action.active = index === activeMenuItemIndex;
|
150
|
+
};
|
151
|
+
this.updateActions = (actions) => {
|
152
|
+
actions === null || actions === void 0 ? void 0 : actions.forEach(this.updateAction);
|
153
|
+
};
|
154
|
+
this.handleDefaultSlotChange = (event) => {
|
155
|
+
const actions = event.target
|
156
|
+
.assignedElements({
|
157
|
+
flatten: true
|
158
|
+
})
|
159
|
+
.filter((el) => el === null || el === void 0 ? void 0 : el.matches("calcite-action"));
|
160
|
+
this.actionElements = actions;
|
161
|
+
};
|
162
|
+
this.menuButtonKeyDown = (event) => {
|
163
|
+
const { key } = event;
|
164
|
+
const { actionElements, activeMenuItemIndex, open } = this;
|
165
|
+
if (!actionElements.length) {
|
166
|
+
return;
|
167
|
+
}
|
168
|
+
if (isActivationKey(key)) {
|
169
|
+
event.preventDefault();
|
170
|
+
if (!open) {
|
171
|
+
this.toggleOpen();
|
172
|
+
return;
|
173
|
+
}
|
174
|
+
const action = actionElements[activeMenuItemIndex];
|
175
|
+
action ? action.click() : this.toggleOpen(false);
|
176
|
+
}
|
177
|
+
if (key === "Tab") {
|
178
|
+
this.open = false;
|
179
|
+
return;
|
180
|
+
}
|
181
|
+
if (key === "Escape") {
|
182
|
+
this.toggleOpen(false);
|
183
|
+
event.preventDefault();
|
184
|
+
return;
|
185
|
+
}
|
186
|
+
this.handleActionNavigation(event, key, actionElements);
|
187
|
+
};
|
188
|
+
this.handleActionNavigation = (event, key, actions) => {
|
189
|
+
if (!this.isValidKey(key, SUPPORTED_MENU_NAV_KEYS)) {
|
190
|
+
return;
|
191
|
+
}
|
192
|
+
event.preventDefault();
|
193
|
+
if (!this.open) {
|
194
|
+
this.toggleOpen();
|
195
|
+
if (key === "Home" || key === "ArrowDown") {
|
196
|
+
this.activeMenuItemIndex = 0;
|
197
|
+
}
|
198
|
+
if (key === "End" || key === "ArrowUp") {
|
199
|
+
this.activeMenuItemIndex = actions.length - 1;
|
200
|
+
}
|
201
|
+
return;
|
202
|
+
}
|
203
|
+
if (key === "Home") {
|
204
|
+
this.activeMenuItemIndex = 0;
|
205
|
+
}
|
206
|
+
if (key === "End") {
|
207
|
+
this.activeMenuItemIndex = actions.length - 1;
|
208
|
+
}
|
209
|
+
const currentIndex = this.activeMenuItemIndex;
|
210
|
+
if (key === "ArrowUp") {
|
211
|
+
this.activeMenuItemIndex = getRoundRobinIndex(Math.max(currentIndex - 1, -1), actions.length);
|
212
|
+
}
|
213
|
+
if (key === "ArrowDown") {
|
214
|
+
this.activeMenuItemIndex = getRoundRobinIndex(currentIndex + 1, actions.length);
|
215
|
+
}
|
216
|
+
};
|
217
|
+
this.toggleOpenEnd = () => {
|
218
|
+
this.setFocus();
|
219
|
+
this.el.removeEventListener("calcitePopoverOpen", this.toggleOpenEnd);
|
220
|
+
};
|
221
|
+
this.toggleOpen = (value = !this.open) => {
|
222
|
+
this.el.addEventListener("calcitePopoverOpen", this.toggleOpenEnd);
|
223
|
+
this.open = value;
|
224
|
+
};
|
225
|
+
}
|
226
|
+
// --------------------------------------------------------------------------
|
227
|
+
//
|
228
|
+
// Lifecycle
|
229
|
+
//
|
230
|
+
// --------------------------------------------------------------------------
|
231
|
+
disconnectedCallback() {
|
232
|
+
this.disconnectMenuButtonEl();
|
233
|
+
}
|
234
|
+
expandedHandler() {
|
235
|
+
this.open = false;
|
236
|
+
this.setTooltipReferenceElement();
|
237
|
+
}
|
238
|
+
openHandler(open) {
|
239
|
+
this.activeMenuItemIndex = this.open ? 0 : -1;
|
240
|
+
if (this.menuButtonEl) {
|
241
|
+
this.menuButtonEl.active = open;
|
242
|
+
}
|
243
|
+
this.calciteActionMenuOpenChange.emit(open);
|
244
|
+
this.setTooltipReferenceElement();
|
245
|
+
}
|
246
|
+
closeCalciteActionMenuOnClick(event) {
|
247
|
+
if (!isPrimaryPointerButton(event)) {
|
248
|
+
return;
|
249
|
+
}
|
250
|
+
const composedPath = event.composedPath();
|
251
|
+
if (composedPath.includes(this.el)) {
|
252
|
+
return;
|
253
|
+
}
|
254
|
+
this.open = false;
|
255
|
+
}
|
256
|
+
activeMenuItemIndexHandler() {
|
257
|
+
this.updateActions(this.actionElements);
|
258
|
+
}
|
259
|
+
// --------------------------------------------------------------------------
|
260
|
+
//
|
261
|
+
// Methods
|
262
|
+
//
|
263
|
+
// --------------------------------------------------------------------------
|
264
|
+
/** Sets focus on the component. */
|
265
|
+
async setFocus() {
|
266
|
+
focusElement(this.menuButtonEl);
|
267
|
+
}
|
268
|
+
renderMenuButton() {
|
269
|
+
const { label, scale, expanded } = this;
|
270
|
+
const menuButtonSlot = (h("slot", { name: SLOTS.trigger, onSlotchange: this.setMenuButtonEl }, h("calcite-action", { class: CSS$1.defaultTrigger, icon: ICONS.menu, ref: this.setDefaultMenuButtonEl, scale: scale, text: label, textEnabled: expanded })));
|
271
|
+
return menuButtonSlot;
|
272
|
+
}
|
273
|
+
renderMenuItems() {
|
274
|
+
const { actionElements, activeMenuItemIndex, open, menuId, menuButtonEl, label, placement, overlayPositioning, flipPlacements } = this;
|
275
|
+
const activeAction = actionElements[activeMenuItemIndex];
|
276
|
+
const activeDescendantId = (activeAction === null || activeAction === void 0 ? void 0 : activeAction.id) || null;
|
277
|
+
return (h("calcite-popover", { disablePointer: true, flipPlacements: flipPlacements, label: label, offsetDistance: 0, open: open, overlayPositioning: overlayPositioning, placement: placement, referenceElement: menuButtonEl }, h("div", { "aria-activedescendant": activeDescendantId, "aria-labelledby": menuButtonEl === null || menuButtonEl === void 0 ? void 0 : menuButtonEl.id, class: CSS$1.menu, id: menuId, onClick: this.handleCalciteActionClick, role: "menu", tabIndex: -1 }, h("slot", { onSlotchange: this.handleDefaultSlotChange }))));
|
278
|
+
}
|
279
|
+
render() {
|
280
|
+
return (h(Fragment, null, this.renderMenuButton(), this.renderMenuItems(), h("slot", { name: SLOTS.tooltip, onSlotchange: this.updateTooltip })));
|
281
|
+
}
|
282
|
+
isValidKey(key, supportedKeys) {
|
283
|
+
return !!supportedKeys.find((k) => k === key);
|
284
|
+
}
|
285
|
+
get el() { return getElement(this); }
|
286
|
+
static get watchers() { return {
|
287
|
+
"expanded": ["expandedHandler"],
|
288
|
+
"open": ["openHandler"],
|
289
|
+
"activeMenuItemIndex": ["activeMenuItemIndexHandler"]
|
290
|
+
}; }
|
291
|
+
};
|
292
|
+
ActionMenu.style = actionMenuCss;
|
293
|
+
|
294
|
+
/*!
|
295
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
296
|
+
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
297
|
+
* v1.0.0-beta.97
|
298
|
+
*/
|
299
|
+
const CSS = {
|
300
|
+
container: "container",
|
301
|
+
arrow: "arrow",
|
302
|
+
imageContainer: "image-container",
|
303
|
+
closeButtonContainer: "close-button-container",
|
304
|
+
closeButton: "close-button",
|
305
|
+
content: "content",
|
306
|
+
hasHeader: "has-header",
|
307
|
+
header: "header",
|
308
|
+
headerContent: "header-content",
|
309
|
+
heading: "heading"
|
310
|
+
};
|
311
|
+
const TEXT = {
|
312
|
+
close: "Close"
|
313
|
+
};
|
314
|
+
const defaultPopoverPlacement = "auto";
|
315
|
+
const ARIA_CONTROLS = "aria-controls";
|
316
|
+
const ARIA_EXPANDED = "aria-expanded";
|
317
|
+
const HEADING_LEVEL = 2;
|
318
|
+
|
319
|
+
/*!
|
320
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
321
|
+
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
322
|
+
* v1.0.0-beta.97
|
323
|
+
*/
|
324
|
+
class PopoverManager {
|
325
|
+
constructor() {
|
326
|
+
// --------------------------------------------------------------------------
|
327
|
+
//
|
328
|
+
// Private Properties
|
329
|
+
//
|
330
|
+
// --------------------------------------------------------------------------
|
331
|
+
this.registeredElements = new Map();
|
332
|
+
this.registeredElementCount = 0;
|
333
|
+
// --------------------------------------------------------------------------
|
334
|
+
//
|
335
|
+
// Private Methods
|
336
|
+
//
|
337
|
+
// --------------------------------------------------------------------------
|
338
|
+
this.queryPopover = (composedPath) => {
|
339
|
+
const { registeredElements } = this;
|
340
|
+
const registeredElement = composedPath.find((pathEl) => registeredElements.has(pathEl));
|
341
|
+
return registeredElements.get(registeredElement);
|
342
|
+
};
|
343
|
+
this.togglePopovers = (event) => {
|
344
|
+
const composedPath = event.composedPath();
|
345
|
+
const togglePopover = this.queryPopover(composedPath);
|
346
|
+
if (togglePopover && !togglePopover.triggerDisabled) {
|
347
|
+
togglePopover.toggle();
|
348
|
+
}
|
349
|
+
Array.from(this.registeredElements.values())
|
350
|
+
.filter((popover) => popover !== togglePopover && popover.autoClose && popover.open && !composedPath.includes(popover))
|
351
|
+
.forEach((popover) => popover.toggle(false));
|
352
|
+
};
|
353
|
+
this.keyHandler = (event) => {
|
354
|
+
if (event.defaultPrevented || !isActivationKey(event.key)) {
|
355
|
+
return;
|
356
|
+
}
|
357
|
+
this.togglePopovers(event);
|
358
|
+
};
|
359
|
+
this.clickHandler = (event) => {
|
360
|
+
if (isPrimaryPointerButton(event)) {
|
361
|
+
this.togglePopovers(event);
|
362
|
+
}
|
363
|
+
};
|
364
|
+
}
|
365
|
+
// --------------------------------------------------------------------------
|
366
|
+
//
|
367
|
+
// Public Methods
|
368
|
+
//
|
369
|
+
// --------------------------------------------------------------------------
|
370
|
+
registerElement(referenceEl, popover) {
|
371
|
+
this.registeredElementCount++;
|
372
|
+
this.registeredElements.set(referenceEl, popover);
|
373
|
+
if (this.registeredElementCount === 1) {
|
374
|
+
this.addListeners();
|
375
|
+
}
|
376
|
+
}
|
377
|
+
unregisterElement(referenceEl) {
|
378
|
+
if (this.registeredElements.delete(referenceEl)) {
|
379
|
+
this.registeredElementCount--;
|
380
|
+
}
|
381
|
+
if (this.registeredElementCount === 0) {
|
382
|
+
this.removeListeners();
|
383
|
+
}
|
384
|
+
}
|
385
|
+
addListeners() {
|
386
|
+
document.addEventListener("pointerdown", this.clickHandler, { capture: true });
|
387
|
+
document.addEventListener("keydown", this.keyHandler, { capture: true });
|
388
|
+
}
|
389
|
+
removeListeners() {
|
390
|
+
document.removeEventListener("pointerdown", this.clickHandler, { capture: true });
|
391
|
+
document.removeEventListener("keydown", this.keyHandler, { capture: true });
|
392
|
+
}
|
393
|
+
}
|
394
|
+
|
395
|
+
const popoverCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0.01}}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}:host([hidden]){display:none}:host{display:block;position:absolute;z-index:900}.calcite-floating-ui-anim{position:relative;transition:var(--calcite-floating-ui-transition);visibility:hidden;transition-property:transform, visibility, opacity;opacity:0;box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);z-index:1;border-radius:0.25rem}:host([data-placement^=bottom]) .calcite-floating-ui-anim{transform:translateY(-5px)}:host([data-placement^=top]) .calcite-floating-ui-anim{transform:translateY(5px)}:host([data-placement^=left]) .calcite-floating-ui-anim{transform:translateX(5px)}:host([data-placement^=right]) .calcite-floating-ui-anim{transform:translateX(-5px)}:host([data-placement]) .calcite-floating-ui-anim--active{opacity:1;visibility:visible;transform:translate(0)}:host([calcite-hydrated-hidden]){visibility:hidden !important;pointer-events:none}.arrow,.arrow::before{position:absolute;inline-size:8px;block-size:8px;z-index:-1}.arrow::before{content:\"\";--tw-shadow:0 4px 8px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);--tw-shadow-colored:0 4px 8px -1px var(--tw-shadow-color), 0 2px 4px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);transform:rotate(45deg);background:var(--calcite-ui-foreground-1)}:host([data-placement^=top]) .arrow{inset-block-end:-4px}:host([data-placement^=bottom]) .arrow{inset-block-start:-4px}:host([data-placement^=left]) .arrow{direction:ltr;inset-inline-end:-4px}:host([data-placement^=right]) .arrow{direction:ltr;inset-inline-start:-4px}:host{pointer-events:none}:host([open]){pointer-events:initial}.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)}.header{display:flex;flex:1 1 auto;align-items:stretch;justify-content:flex-start;border-width:0px;border-block-end-width:1px;border-style:solid;background-color:var(--calcite-ui-foreground-1);border-block-end-color:var(--calcite-ui-border-3)}.heading{margin:0px;display:block;flex:1 1 auto;align-self:center;white-space:normal;padding-inline:1rem;padding-block:0.75rem;font-size:var(--calcite-font-size-0);line-height:1.375;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1);word-wrap:break-word;word-break:break-word}.container{position:relative;display:flex;block-size:100%;flex-direction:row;flex-wrap:nowrap;border-radius:0.25rem;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-1)}.container.has-header{flex-direction:column}.content{display:flex;block-size:100%;inline-size:100%;flex-direction:column;flex-wrap:nowrap;align-self:center;word-wrap:break-word;word-break:break-word}.close-button-container{display:flex;overflow:hidden;flex:0 0 auto;border-start-end-radius:0.25rem;border-end-end-radius:0.25rem}::slotted(calcite-panel),::slotted(calcite-flow){block-size:100%}";
|
396
|
+
|
397
|
+
const manager = new PopoverManager();
|
398
|
+
const Popover = class {
|
399
|
+
constructor(hostRef) {
|
400
|
+
registerInstance(this, hostRef);
|
401
|
+
this.calcitePopoverBeforeClose = createEvent(this, "calcitePopoverBeforeClose", 6);
|
402
|
+
this.calcitePopoverClose = createEvent(this, "calcitePopoverClose", 6);
|
403
|
+
this.calcitePopoverBeforeOpen = createEvent(this, "calcitePopoverBeforeOpen", 6);
|
404
|
+
this.calcitePopoverOpen = createEvent(this, "calcitePopoverOpen", 6);
|
405
|
+
// --------------------------------------------------------------------------
|
406
|
+
//
|
407
|
+
// Properties
|
408
|
+
//
|
409
|
+
// --------------------------------------------------------------------------
|
410
|
+
/**
|
411
|
+
* When `true`, clicking outside of the component automatically closes open `calcite-popover`s.
|
412
|
+
*/
|
413
|
+
this.autoClose = false;
|
414
|
+
/**
|
415
|
+
* When `true`, a close button is added to the component.
|
416
|
+
*
|
417
|
+
* @deprecated use dismissible instead.
|
418
|
+
*/
|
419
|
+
this.closeButton = false;
|
420
|
+
/**
|
421
|
+
* When `true`, a close button is added to the component.
|
422
|
+
*
|
423
|
+
* @deprecated use `closable` instead.
|
424
|
+
*/
|
425
|
+
this.dismissible = false;
|
426
|
+
/** When `true`, display a close button within the component. */
|
427
|
+
this.closable = false;
|
428
|
+
/**
|
429
|
+
* When `true`, prevents flipping the component's placement when overlapping its `referenceElement`.
|
430
|
+
*/
|
431
|
+
this.disableFlip = false;
|
432
|
+
/**
|
433
|
+
* When `true`, removes the caret pointer.
|
434
|
+
*/
|
435
|
+
this.disablePointer = false;
|
436
|
+
/**
|
437
|
+
* Offsets the position of the component away from the `referenceElement`.
|
438
|
+
*
|
439
|
+
* @default 6
|
440
|
+
*/
|
441
|
+
this.offsetDistance = defaultOffsetDistance;
|
442
|
+
/**
|
443
|
+
* Offsets the position of the component along the `referenceElement`.
|
444
|
+
*/
|
445
|
+
this.offsetSkidding = 0;
|
446
|
+
/**
|
447
|
+
* When `true`, displays and positions the component.
|
448
|
+
*/
|
449
|
+
this.open = false;
|
450
|
+
/**
|
451
|
+
* Determines the type of positioning to use for the overlaid content.
|
452
|
+
*
|
453
|
+
* Using `"absolute"` will work for most cases. The component will be positioned inside of overflowing parent containers and will affect the container's layout.
|
454
|
+
*
|
455
|
+
* `"fixed"` value should be used to escape an overflowing parent container, or when the reference element's `position` CSS property is `"fixed"`.
|
456
|
+
*
|
457
|
+
*/
|
458
|
+
this.overlayPositioning = "absolute";
|
459
|
+
/**
|
460
|
+
* Determines where the component will be positioned relative to the `referenceElement`.
|
461
|
+
*
|
462
|
+
* @see [LogicalPlacement](https://github.com/Esri/calcite-components/blob/master/src/utils/floating-ui.ts#L25)
|
463
|
+
*/
|
464
|
+
this.placement = defaultPopoverPlacement;
|
465
|
+
/**
|
466
|
+
* When `true`, disables automatically toggling the component when its `referenceElement` has been triggered.
|
467
|
+
*
|
468
|
+
* This property can be set to `true` to manage when the component is open.
|
469
|
+
*/
|
470
|
+
this.triggerDisabled = false;
|
471
|
+
/**
|
472
|
+
* Accessible name for the component's close button.
|
473
|
+
*
|
474
|
+
* @default "Close"
|
475
|
+
*/
|
476
|
+
this.intlClose = TEXT.close;
|
477
|
+
this.guid = `calcite-popover-${guid()}`;
|
478
|
+
this.openTransitionProp = "opacity";
|
479
|
+
this.hasLoaded = false;
|
480
|
+
// --------------------------------------------------------------------------
|
481
|
+
//
|
482
|
+
// Private Methods
|
483
|
+
//
|
484
|
+
// --------------------------------------------------------------------------
|
485
|
+
this.setTransitionEl = (el) => {
|
486
|
+
this.transitionEl = el;
|
487
|
+
connectOpenCloseComponent(this);
|
488
|
+
};
|
489
|
+
this.setFilteredPlacements = () => {
|
490
|
+
const { el, flipPlacements } = this;
|
491
|
+
this.filteredFlipPlacements = flipPlacements
|
492
|
+
? filterComputedPlacements(flipPlacements, el)
|
493
|
+
: null;
|
494
|
+
};
|
495
|
+
this.setUpReferenceElement = (warn = true) => {
|
496
|
+
this.removeReferences();
|
497
|
+
this.effectiveReferenceElement = this.getReferenceElement();
|
498
|
+
connectFloatingUI(this, this.effectiveReferenceElement, this.el);
|
499
|
+
const { el, referenceElement, effectiveReferenceElement } = this;
|
500
|
+
if (warn && referenceElement && !effectiveReferenceElement) {
|
501
|
+
console.warn(`${el.tagName}: reference-element id "${referenceElement}" was not found.`, {
|
502
|
+
el
|
503
|
+
});
|
504
|
+
}
|
505
|
+
this.addReferences();
|
506
|
+
};
|
507
|
+
this.getId = () => {
|
508
|
+
return this.el.id || this.guid;
|
509
|
+
};
|
510
|
+
this.setExpandedAttr = () => {
|
511
|
+
const { effectiveReferenceElement, open } = this;
|
512
|
+
if (!effectiveReferenceElement) {
|
513
|
+
return;
|
514
|
+
}
|
515
|
+
if ("setAttribute" in effectiveReferenceElement) {
|
516
|
+
effectiveReferenceElement.setAttribute(ARIA_EXPANDED, toAriaBoolean(open));
|
517
|
+
}
|
518
|
+
};
|
519
|
+
this.addReferences = () => {
|
520
|
+
const { effectiveReferenceElement } = this;
|
521
|
+
if (!effectiveReferenceElement) {
|
522
|
+
return;
|
523
|
+
}
|
524
|
+
const id = this.getId();
|
525
|
+
if ("setAttribute" in effectiveReferenceElement) {
|
526
|
+
effectiveReferenceElement.setAttribute(ARIA_CONTROLS, id);
|
527
|
+
}
|
528
|
+
manager.registerElement(effectiveReferenceElement, this.el);
|
529
|
+
this.setExpandedAttr();
|
530
|
+
};
|
531
|
+
this.removeReferences = () => {
|
532
|
+
const { effectiveReferenceElement } = this;
|
533
|
+
if (!effectiveReferenceElement) {
|
534
|
+
return;
|
535
|
+
}
|
536
|
+
if ("removeAttribute" in effectiveReferenceElement) {
|
537
|
+
effectiveReferenceElement.removeAttribute(ARIA_CONTROLS);
|
538
|
+
effectiveReferenceElement.removeAttribute(ARIA_EXPANDED);
|
539
|
+
}
|
540
|
+
manager.unregisterElement(effectiveReferenceElement);
|
541
|
+
};
|
542
|
+
this.hide = () => {
|
543
|
+
this.open = false;
|
544
|
+
};
|
545
|
+
this.storeArrowEl = (el) => {
|
546
|
+
this.arrowEl = el;
|
547
|
+
this.reposition(true);
|
548
|
+
};
|
549
|
+
}
|
550
|
+
handleDismissible(value) {
|
551
|
+
this.closable = value;
|
552
|
+
}
|
553
|
+
handleClosable(value) {
|
554
|
+
this.dismissible = value;
|
555
|
+
}
|
556
|
+
flipPlacementsHandler() {
|
557
|
+
this.setFilteredPlacements();
|
558
|
+
this.reposition(true);
|
559
|
+
}
|
560
|
+
offsetDistanceOffsetHandler() {
|
561
|
+
this.reposition(true);
|
562
|
+
}
|
563
|
+
offsetSkiddingHandler() {
|
564
|
+
this.reposition(true);
|
565
|
+
}
|
566
|
+
openHandler(value) {
|
567
|
+
if (value) {
|
568
|
+
this.reposition(true);
|
569
|
+
}
|
570
|
+
else {
|
571
|
+
updateAfterClose(this.el);
|
572
|
+
}
|
573
|
+
this.setExpandedAttr();
|
574
|
+
}
|
575
|
+
overlayPositioningHandler() {
|
576
|
+
this.reposition(true);
|
577
|
+
}
|
578
|
+
placementHandler() {
|
579
|
+
this.reposition(true);
|
580
|
+
}
|
581
|
+
referenceElementHandler() {
|
582
|
+
this.setUpReferenceElement();
|
583
|
+
this.reposition(true);
|
584
|
+
}
|
585
|
+
// --------------------------------------------------------------------------
|
586
|
+
//
|
587
|
+
// Lifecycle
|
588
|
+
//
|
589
|
+
// --------------------------------------------------------------------------
|
590
|
+
connectedCallback() {
|
591
|
+
this.setFilteredPlacements();
|
592
|
+
connectOpenCloseComponent(this);
|
593
|
+
const closable = this.closable || this.dismissible;
|
594
|
+
if (closable) {
|
595
|
+
this.handleDismissible(closable);
|
596
|
+
}
|
597
|
+
if (closable) {
|
598
|
+
this.handleClosable(closable);
|
599
|
+
}
|
600
|
+
this.setUpReferenceElement(this.hasLoaded);
|
601
|
+
}
|
602
|
+
componentDidLoad() {
|
603
|
+
if (this.referenceElement && !this.effectiveReferenceElement) {
|
604
|
+
this.setUpReferenceElement();
|
605
|
+
}
|
606
|
+
this.reposition();
|
607
|
+
this.hasLoaded = true;
|
608
|
+
}
|
609
|
+
disconnectedCallback() {
|
610
|
+
this.removeReferences();
|
611
|
+
disconnectFloatingUI(this, this.effectiveReferenceElement, this.el);
|
612
|
+
disconnectOpenCloseComponent(this);
|
613
|
+
}
|
614
|
+
// --------------------------------------------------------------------------
|
615
|
+
//
|
616
|
+
// Public Methods
|
617
|
+
//
|
618
|
+
// --------------------------------------------------------------------------
|
619
|
+
/**
|
620
|
+
* Updates the position of the component.
|
621
|
+
*
|
622
|
+
* @param delayed
|
623
|
+
*/
|
624
|
+
async reposition(delayed = false) {
|
625
|
+
const { el, effectiveReferenceElement, placement, overlayPositioning, disableFlip, filteredFlipPlacements, offsetDistance, offsetSkidding, arrowEl } = this;
|
626
|
+
return reposition(this, {
|
627
|
+
floatingEl: el,
|
628
|
+
referenceEl: effectiveReferenceElement,
|
629
|
+
overlayPositioning,
|
630
|
+
placement,
|
631
|
+
disableFlip,
|
632
|
+
flipPlacements: filteredFlipPlacements,
|
633
|
+
offsetDistance,
|
634
|
+
offsetSkidding,
|
635
|
+
includeArrow: !this.disablePointer,
|
636
|
+
arrowEl,
|
637
|
+
type: "popover"
|
638
|
+
}, delayed);
|
639
|
+
}
|
640
|
+
/**
|
641
|
+
* Sets focus on the component.
|
642
|
+
*
|
643
|
+
* @param focusId
|
644
|
+
*/
|
645
|
+
async setFocus(focusId) {
|
646
|
+
var _a;
|
647
|
+
const { closeButtonEl } = this;
|
648
|
+
if (focusId === "close-button" && closeButtonEl) {
|
649
|
+
forceUpdate(closeButtonEl);
|
650
|
+
closeButtonEl.setFocus();
|
651
|
+
return;
|
652
|
+
}
|
653
|
+
(_a = this.el) === null || _a === void 0 ? void 0 : _a.focus();
|
654
|
+
}
|
655
|
+
/**
|
656
|
+
* Toggles the component's open property.
|
657
|
+
*
|
658
|
+
* @param value
|
659
|
+
*/
|
660
|
+
async toggle(value = !this.open) {
|
661
|
+
this.open = value;
|
662
|
+
}
|
663
|
+
getReferenceElement() {
|
664
|
+
const { referenceElement, el } = this;
|
665
|
+
return ((typeof referenceElement === "string"
|
666
|
+
? queryElementRoots(el, { id: referenceElement })
|
667
|
+
: referenceElement) || null);
|
668
|
+
}
|
669
|
+
onBeforeOpen() {
|
670
|
+
this.calcitePopoverBeforeOpen.emit();
|
671
|
+
}
|
672
|
+
onOpen() {
|
673
|
+
this.calcitePopoverOpen.emit();
|
674
|
+
}
|
675
|
+
onBeforeClose() {
|
676
|
+
this.calcitePopoverBeforeClose.emit();
|
677
|
+
}
|
678
|
+
onClose() {
|
679
|
+
this.calcitePopoverClose.emit();
|
680
|
+
}
|
681
|
+
// --------------------------------------------------------------------------
|
682
|
+
//
|
683
|
+
// Render Methods
|
684
|
+
//
|
685
|
+
// --------------------------------------------------------------------------
|
686
|
+
renderCloseButton() {
|
687
|
+
const { closeButton, intlClose, heading, closable } = this;
|
688
|
+
return closable || closeButton ? (h("div", { class: CSS.closeButtonContainer }, h("calcite-action", { class: CSS.closeButton, onClick: this.hide, ref: (closeButtonEl) => (this.closeButtonEl = closeButtonEl), scale: heading ? "s" : "m", text: intlClose }, h("calcite-icon", { icon: "x", scale: heading ? "s" : "m" })))) : null;
|
689
|
+
}
|
690
|
+
renderHeader() {
|
691
|
+
const { heading, headingLevel } = this;
|
692
|
+
const headingNode = heading ? (h(Heading, { class: CSS.heading, level: headingLevel || HEADING_LEVEL }, heading)) : null;
|
693
|
+
return headingNode ? (h("div", { class: CSS.header }, headingNode, this.renderCloseButton())) : null;
|
694
|
+
}
|
695
|
+
render() {
|
696
|
+
const { effectiveReferenceElement, heading, label, open, disablePointer } = this;
|
697
|
+
const displayed = effectiveReferenceElement && open;
|
698
|
+
const hidden = !displayed;
|
699
|
+
const arrowNode = !disablePointer ? h("div", { class: CSS.arrow, ref: this.storeArrowEl }) : null;
|
700
|
+
return (h(Host, { "aria-hidden": toAriaBoolean(hidden), "aria-label": label, "aria-live": "polite", "calcite-hydrated-hidden": hidden, id: this.getId(), role: "dialog" }, h("div", { class: {
|
701
|
+
[FloatingCSS.animation]: true,
|
702
|
+
[FloatingCSS.animationActive]: displayed
|
703
|
+
}, ref: this.setTransitionEl }, arrowNode, h("div", { class: {
|
704
|
+
[CSS.hasHeader]: !!heading,
|
705
|
+
[CSS.container]: true
|
706
|
+
} }, this.renderHeader(), h("div", { class: CSS.content }, h("slot", null)), !heading ? this.renderCloseButton() : null))));
|
707
|
+
}
|
708
|
+
get el() { return getElement(this); }
|
709
|
+
static get watchers() { return {
|
710
|
+
"dismissible": ["handleDismissible"],
|
711
|
+
"closable": ["handleClosable"],
|
712
|
+
"flipPlacements": ["flipPlacementsHandler"],
|
713
|
+
"offsetDistance": ["offsetDistanceOffsetHandler"],
|
714
|
+
"offsetSkidding": ["offsetSkiddingHandler"],
|
715
|
+
"open": ["openHandler"],
|
716
|
+
"overlayPositioning": ["overlayPositioningHandler"],
|
717
|
+
"placement": ["placementHandler"],
|
718
|
+
"referenceElement": ["referenceElementHandler"]
|
719
|
+
}; }
|
720
|
+
};
|
721
|
+
Popover.style = popoverCss;
|
722
|
+
|
723
|
+
export { ActionMenu as calcite_action_menu, Popover as calcite_popover };
|