@esri/solutions-components 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (196) hide show
  1. package/dist/assets/t9n/feature-comments/resources.json +3 -0
  2. package/dist/assets/t9n/feature-comments/resources_en.json +3 -0
  3. package/dist/assets/t9n/feature-form-flow-item/resources.json +3 -0
  4. package/dist/assets/t9n/feature-form-flow-item/resources_en.json +3 -0
  5. package/dist/assets/t9n/layer-table/resources.json +2 -1
  6. package/dist/assets/t9n/layer-table/resources_en.json +2 -1
  7. package/dist/assets/t9n/list-flow-item/resources.json +3 -0
  8. package/dist/assets/t9n/list-flow-item/resources_en.json +3 -0
  9. package/dist/assets/t9n/location-flow-item/resources.json +3 -0
  10. package/dist/assets/t9n/location-flow-item/resources_en.json +3 -0
  11. package/dist/assets/t9n/share-item/resources.json +3 -0
  12. package/dist/assets/t9n/share-item/resources_en.json +3 -0
  13. package/dist/cjs/{list-item.cjs.entry.js → arcgis-login.cjs.entry.js} +4 -19
  14. package/dist/cjs/basemap-gallery_7.cjs.entry.js +13 -9
  15. package/dist/cjs/calcite-action_2.cjs.entry.js +61 -392
  16. package/dist/cjs/calcite-alert_3.cjs.entry.js +21 -3
  17. package/dist/cjs/calcite-combobox_6.cjs.entry.js +32 -8
  18. package/dist/cjs/calcite-popover.cjs.entry.js +418 -0
  19. package/dist/cjs/card-manager_3.cjs.entry.js +154 -18
  20. package/dist/cjs/crowdsource-manager.cjs.entry.js +24 -2
  21. package/dist/cjs/crowdsource-reporter.cjs.entry.js +45 -6
  22. package/dist/cjs/{downloadUtils-e3e595e9.js → downloadUtils-9c4fde54.js} +2 -2
  23. package/dist/cjs/feature-comments.cjs.entry.js +60 -0
  24. package/dist/cjs/feature-form-flow-item.cjs.entry.js +60 -0
  25. package/dist/cjs/features-flow-item.cjs.entry.js +60 -0
  26. package/dist/cjs/{index.es-047537b5.js → index.es-d208a6d6.js} +2 -2
  27. package/dist/cjs/list-flow-item.cjs.entry.js +60 -0
  28. package/dist/cjs/loader.cjs.js +1 -1
  29. package/dist/cjs/location-flow-item.cjs.entry.js +60 -0
  30. package/dist/cjs/map-select-tools_3.cjs.entry.js +2 -2
  31. package/dist/cjs/{mapViewUtils-f7bbc35b.js → mapViewUtils-bab83c90.js} +21 -0
  32. package/dist/cjs/public-notification.cjs.entry.js +2 -2
  33. package/dist/cjs/refine-results-flow-item.cjs.entry.js +60 -0
  34. package/dist/cjs/share-item.cjs.entry.js +60 -0
  35. package/dist/cjs/solutions-components.cjs.js +1 -1
  36. package/dist/collection/collection-manifest.json +8 -1
  37. package/dist/collection/components/{list-item/list-item.js → arcgis-login/arcgis-login.js} +4 -19
  38. package/dist/collection/components/arcgis-login/test/arcgis-login.e2e.js +29 -0
  39. package/dist/collection/components/arcgis-login/test/arcgis-login.spec.js +37 -0
  40. package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +118 -2
  41. package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.js +294 -6
  42. package/dist/collection/components/feature-comments/feature-comments.css +19 -0
  43. package/dist/collection/components/feature-comments/feature-comments.js +74 -0
  44. package/dist/collection/components/feature-comments/test/feature-comments.e2e.js +29 -0
  45. package/dist/collection/components/feature-comments/test/feature-comments.spec.js +37 -0
  46. package/dist/collection/components/feature-form-flow-item/feature-form-flow-item.css +19 -0
  47. package/dist/collection/components/feature-form-flow-item/feature-form-flow-item.js +74 -0
  48. package/dist/collection/components/feature-form-flow-item/test/feature-form-flow-item.e2e.js +29 -0
  49. package/dist/collection/components/feature-form-flow-item/test/feature-form-flow-item.spec.js +37 -0
  50. package/dist/collection/components/features-flow-item/features-flow-item.css +19 -0
  51. package/dist/collection/components/features-flow-item/features-flow-item.js +74 -0
  52. package/dist/collection/components/features-flow-item/test/features-flow-item.e2e.js +29 -0
  53. package/dist/collection/components/features-flow-item/test/features-flow-item.spec.js +37 -0
  54. package/dist/collection/components/info-card/info-card.js +21 -2
  55. package/dist/collection/components/layer-table/layer-table.js +199 -10
  56. package/dist/collection/components/list-flow-item/list-flow-item.css +19 -0
  57. package/dist/collection/components/list-flow-item/list-flow-item.js +74 -0
  58. package/dist/collection/components/list-flow-item/test/list-flow-item.e2e.js +29 -0
  59. package/dist/collection/components/list-flow-item/test/list-flow-item.spec.js +37 -0
  60. package/dist/collection/components/location-flow-item/location-flow-item.css +19 -0
  61. package/dist/collection/components/location-flow-item/location-flow-item.js +74 -0
  62. package/dist/collection/components/location-flow-item/test/location-flow-item.e2e.js +29 -0
  63. package/dist/collection/components/location-flow-item/test/location-flow-item.spec.js +37 -0
  64. package/dist/collection/components/map-card/map-card.js +38 -7
  65. package/dist/collection/components/map-layer-picker/map-layer-picker.js +49 -7
  66. package/dist/collection/components/map-picker/map-picker.js +37 -9
  67. package/dist/collection/components/refine-results-flow-item/refine-results-flow-item.css +19 -0
  68. package/dist/collection/components/refine-results-flow-item/refine-results-flow-item.js +74 -0
  69. package/dist/collection/components/refine-results-flow-item/test/refine-results-flow-item.e2e.js +29 -0
  70. package/dist/collection/components/refine-results-flow-item/test/refine-results-flow-item.spec.js +37 -0
  71. package/dist/collection/components/share-item/share-item.css +19 -0
  72. package/dist/collection/components/share-item/share-item.js +74 -0
  73. package/dist/collection/components/share-item/test/share-item.e2e.js +29 -0
  74. package/dist/collection/components/share-item/test/share-item.spec.js +37 -0
  75. package/dist/collection/demos/crowdsource-reporter.html +56 -15
  76. package/dist/collection/utils/interfaces.ts +5 -0
  77. package/dist/collection/utils/queryUtils.js +20 -0
  78. package/dist/collection/utils/queryUtils.ts +26 -0
  79. package/dist/components/arcgis-login.d.ts +11 -0
  80. package/dist/components/arcgis-login.js +75 -0
  81. package/dist/components/calcite-list-item.js +1 -1
  82. package/dist/components/card-manager2.js +7 -1
  83. package/dist/components/crowdsource-manager.js +32 -3
  84. package/dist/components/crowdsource-reporter.js +61 -7
  85. package/dist/components/feature-comments.d.ts +11 -0
  86. package/dist/components/feature-comments.js +75 -0
  87. package/dist/components/feature-form-flow-item.d.ts +11 -0
  88. package/dist/components/feature-form-flow-item.js +75 -0
  89. package/dist/components/features-flow-item.d.ts +11 -0
  90. package/dist/components/features-flow-item.js +75 -0
  91. package/dist/components/info-card2.js +28 -3
  92. package/dist/components/layer-table2.js +138 -10
  93. package/dist/components/list-flow-item.d.ts +11 -0
  94. package/dist/components/list-flow-item.js +75 -0
  95. package/dist/components/list-item.js +425 -55
  96. package/dist/components/location-flow-item.d.ts +11 -0
  97. package/dist/components/location-flow-item.js +75 -0
  98. package/dist/components/map-card2.js +22 -8
  99. package/dist/components/map-layer-picker2.js +32 -7
  100. package/dist/components/map-picker2.js +16 -11
  101. package/dist/components/map-select-tools2.js +1 -1
  102. package/dist/components/public-notification.js +1 -1
  103. package/dist/components/queryUtils.js +21 -1
  104. package/dist/components/refine-results-flow-item.d.ts +11 -0
  105. package/dist/components/refine-results-flow-item.js +75 -0
  106. package/dist/components/refine-selection2.js +2 -2
  107. package/dist/components/{list-item.d.ts → share-item.d.ts} +4 -4
  108. package/dist/components/share-item.js +75 -0
  109. package/dist/esm/{list-item.entry.js → arcgis-login.entry.js} +4 -19
  110. package/dist/esm/basemap-gallery_7.entry.js +13 -9
  111. package/dist/esm/calcite-action_2.entry.js +63 -394
  112. package/dist/esm/calcite-alert_3.entry.js +21 -3
  113. package/dist/esm/calcite-combobox_6.entry.js +32 -8
  114. package/dist/esm/calcite-popover.entry.js +414 -0
  115. package/dist/esm/card-manager_3.entry.js +154 -18
  116. package/dist/esm/crowdsource-manager.entry.js +24 -2
  117. package/dist/esm/crowdsource-reporter.entry.js +45 -6
  118. package/dist/esm/{downloadUtils-8fbd1347.js → downloadUtils-b84a6f55.js} +2 -2
  119. package/dist/esm/feature-comments.entry.js +56 -0
  120. package/dist/esm/feature-form-flow-item.entry.js +56 -0
  121. package/dist/esm/features-flow-item.entry.js +56 -0
  122. package/dist/esm/{index.es-b6705ce7.js → index.es-0d4698c7.js} +2 -2
  123. package/dist/esm/list-flow-item.entry.js +56 -0
  124. package/dist/esm/loader.js +1 -1
  125. package/dist/esm/location-flow-item.entry.js +56 -0
  126. package/dist/esm/map-select-tools_3.entry.js +2 -2
  127. package/dist/esm/{mapViewUtils-1e2befd7.js → mapViewUtils-88f363b6.js} +21 -1
  128. package/dist/esm/public-notification.entry.js +2 -2
  129. package/dist/esm/refine-results-flow-item.entry.js +56 -0
  130. package/dist/esm/share-item.entry.js +56 -0
  131. package/dist/esm/solutions-components.js +1 -1
  132. package/dist/solutions-components/demos/crowdsource-reporter.html +56 -15
  133. package/dist/solutions-components/{p-072680a5.js → p-214d41c3.js} +2 -2
  134. package/dist/solutions-components/p-28657abb.entry.js +11 -0
  135. package/dist/solutions-components/p-31b66bc3.entry.js +6 -0
  136. package/dist/solutions-components/{p-0123207d.entry.js → p-34737944.entry.js} +1 -1
  137. package/dist/solutions-components/{p-13d0424a.entry.js → p-3ced939f.entry.js} +1 -1
  138. package/dist/solutions-components/p-3dfbf45e.entry.js +6 -0
  139. package/dist/solutions-components/{p-092fd5d9.js → p-3ee78186.js} +1 -1
  140. package/dist/solutions-components/{p-7f793144.entry.js → p-4327c361.entry.js} +1 -1
  141. package/dist/solutions-components/p-455f4ed8.entry.js +17 -0
  142. package/dist/solutions-components/p-478fc7cb.entry.js +6 -0
  143. package/dist/solutions-components/p-4aafb627.js +36 -0
  144. package/dist/solutions-components/p-58562dda.entry.js +6 -0
  145. package/dist/solutions-components/{p-f367db61.entry.js → p-81503752.entry.js} +1 -1
  146. package/dist/solutions-components/{p-c90671e1.entry.js → p-9d54d7a0.entry.js} +4 -4
  147. package/dist/solutions-components/p-a5d70d3a.entry.js +6 -0
  148. package/dist/solutions-components/p-bd62df52.entry.js +6 -0
  149. package/dist/solutions-components/{p-ca780ab8.entry.js → p-d6f51bea.entry.js} +2 -2
  150. package/dist/solutions-components/p-e6371690.entry.js +6 -0
  151. package/dist/solutions-components/p-e7aad23d.entry.js +6 -0
  152. package/dist/solutions-components/p-ed95f634.entry.js +6 -0
  153. package/dist/solutions-components/p-fd08afb5.entry.js +6 -0
  154. package/dist/solutions-components/solutions-components.esm.js +1 -1
  155. package/dist/solutions-components/utils/interfaces.ts +5 -0
  156. package/dist/solutions-components/utils/queryUtils.ts +26 -0
  157. package/dist/types/components/{list-item/list-item.d.ts → arcgis-login/arcgis-login.d.ts} +2 -9
  158. package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +36 -0
  159. package/dist/types/components/crowdsource-reporter/crowdsource-reporter.d.ts +73 -0
  160. package/dist/types/components/feature-comments/feature-comments.d.ts +19 -0
  161. package/dist/types/components/feature-form-flow-item/feature-form-flow-item.d.ts +19 -0
  162. package/dist/types/components/features-flow-item/features-flow-item.d.ts +19 -0
  163. package/dist/types/components/info-card/info-card.d.ts +8 -0
  164. package/dist/types/components/layer-table/layer-table.d.ts +77 -2
  165. package/dist/types/components/list-flow-item/list-flow-item.d.ts +19 -0
  166. package/dist/types/components/location-flow-item/location-flow-item.d.ts +19 -0
  167. package/dist/types/components/map-card/map-card.d.ts +12 -0
  168. package/dist/types/components/map-layer-picker/map-layer-picker.d.ts +15 -2
  169. package/dist/types/components/map-picker/map-picker.d.ts +1 -4
  170. package/dist/types/components/refine-results-flow-item/refine-results-flow-item.d.ts +19 -0
  171. package/dist/types/components/share-item/share-item.d.ts +19 -0
  172. package/dist/types/components.d.ts +301 -9
  173. package/dist/types/preact.d.ts +15 -1
  174. package/dist/types/utils/interfaces.d.ts +4 -0
  175. package/dist/types/utils/queryUtils.d.ts +9 -0
  176. package/package.json +1 -1
  177. package/dist/assets/t9n/config-buffer-tools/resources.json +0 -12
  178. package/dist/assets/t9n/config-buffer-tools/resources_en.json +0 -12
  179. package/dist/assets/t9n/config-draw-tools/resources.json +0 -10
  180. package/dist/assets/t9n/config-draw-tools/resources_en.json +0 -10
  181. package/dist/assets/t9n/config-layer-picker/resources.json +0 -3
  182. package/dist/assets/t9n/config-layer-picker/resources_en.json +0 -3
  183. package/dist/assets/t9n/config-pdf-download/resources.json +0 -6
  184. package/dist/assets/t9n/config-pdf-download/resources_en.json +0 -6
  185. package/dist/cjs/calcite-loader.cjs.entry.js +0 -80
  186. package/dist/components/list-item2.js +0 -460
  187. package/dist/esm/calcite-loader.entry.js +0 -76
  188. package/dist/solutions-components/p-11cb7b04.entry.js +0 -6
  189. package/dist/solutions-components/p-45cf4f67.entry.js +0 -6
  190. package/dist/solutions-components/p-4807b2a1.js +0 -36
  191. package/dist/solutions-components/p-557a1912.entry.js +0 -6
  192. package/dist/solutions-components/p-68735975.entry.js +0 -6
  193. package/dist/solutions-components/p-ec830ecb.entry.js +0 -23
  194. /package/dist/assets/t9n/{list-item → arcgis-login}/resources.json +0 -0
  195. /package/dist/assets/t9n/{list-item → arcgis-login}/resources_en.json +0 -0
  196. /package/dist/collection/components/{list-item/list-item.css → arcgis-login/arcgis-login.css} +0 -0
@@ -21,7 +21,7 @@ import { d as debounce } from './debounce-229b1a22.js';
21
21
  import { c as connectConditionalSlotComponent, d as disconnectConditionalSlotComponent } from './conditionalSlot-2966afcc.js';
22
22
  import { i as isActivationKey } from './key-5ab69c42.js';
23
23
  import { g as getLocaleComponentStrings } from './locale-5bdc0197.js';
24
- import { l as getMapLayerHash, m as getMapTableHash } from './mapViewUtils-1e2befd7.js';
24
+ import { m as getMapLayerHash, n as getMapTableHash } from './mapViewUtils-88f363b6.js';
25
25
  import { s as state } from './publicNotificationStore-05b455ff.js';
26
26
  import './resources-bb8600a6.js';
27
27
  import './browser-b8a2c2d7.js';
@@ -1694,7 +1694,17 @@ const MapLayerPicker = class {
1694
1694
  registerInstance(this, hostRef);
1695
1695
  this.noLayersFound = createEvent(this, "noLayersFound", 7);
1696
1696
  this.layerSelectionChange = createEvent(this, "layerSelectionChange", 7);
1697
+ //--------------------------------------------------------------------------
1698
+ //
1699
+ // Properties (protected)
1700
+ //
1701
+ //--------------------------------------------------------------------------
1702
+ /**
1703
+ * boolean: When true the default layer has been loaded once and should no longer be used
1704
+ */
1705
+ this.defaultLayerHonored = false;
1697
1706
  this.appearance = "transparent";
1707
+ this.defaultLayerId = "";
1698
1708
  this.enabledLayerIds = [];
1699
1709
  this.enabledTableIds = [];
1700
1710
  this.mapView = undefined;
@@ -1716,7 +1726,6 @@ const MapLayerPicker = class {
1716
1726
  //--------------------------------------------------------------------------
1717
1727
  /**
1718
1728
  * Called each time the mapView prop is changed.
1719
- *
1720
1729
  */
1721
1730
  async mapViewWatchHandler() {
1722
1731
  await this._setLayers();
@@ -1838,21 +1847,36 @@ const MapLayerPicker = class {
1838
1847
  const item = itemType === "layer" ? this._layerNameHash[id] : this._tableNameHash[id];
1839
1848
  const disabled = this.onlyShowUpdatableLayers ? !item.supportsUpdate : false;
1840
1849
  const name = item.name;
1841
- return this.type === "combobox" ? (h("calcite-combobox-item", { disabled: disabled, textLabel: name, value: id })) :
1842
- this.type === "select" ? (h("calcite-option", { disabled: disabled, label: name, value: id })) :
1843
- (h("calcite-dropdown-item", { disabled: disabled, onClick: disabled ? undefined : () => void this._setSelectedLayer(id) }, name));
1850
+ const selected = this.selectedIds.indexOf(id) > -1;
1851
+ return this.type === "combobox" ? (h("calcite-combobox-item", { disabled: disabled, selected: selected, textLabel: name, value: id })) :
1852
+ this.type === "select" ? (h("calcite-option", { disabled: disabled, label: name, selected: selected, value: id })) : (h("calcite-dropdown-item", { disabled: disabled, onClick: disabled ? undefined : () => void this._setSelectedLayer(id), selected: selected }, name));
1844
1853
  }
1845
1854
  /**
1846
1855
  * Store the layer name based on the user selection
1847
1856
  */
1848
1857
  _setSelectedLayer(id) {
1849
- const item = Object.keys(this._layerNameHash).indexOf(id) > -1 ?
1850
- this._layerNameHash[id] : Object.keys(this._tableNameHash).indexOf(id) > -1 ?
1851
- this._tableNameHash[id] : undefined;
1858
+ let item;
1859
+ const hasDefaultLayer = this.defaultLayerId && !this.defaultLayerHonored;
1860
+ if (hasDefaultLayer) {
1861
+ item = this._getLayerFromHash(this.defaultLayerId);
1862
+ this.defaultLayerHonored = item !== undefined;
1863
+ id = this.defaultLayerHonored ? this.defaultLayerId : id;
1864
+ }
1865
+ item = item ? item : this._getLayerFromHash(id);
1852
1866
  this.selectedName = item === null || item === void 0 ? void 0 : item.name;
1853
1867
  this.selectedIds = [id];
1854
1868
  this.layerSelectionChange.emit(this.selectedIds);
1855
1869
  }
1870
+ /**
1871
+ * Fetch layer hash info for the given id
1872
+ *
1873
+ * @returns ILayerHashInfo for the id
1874
+ */
1875
+ _getLayerFromHash(id) {
1876
+ return Object.keys(this._layerNameHash).indexOf(id) > -1 ?
1877
+ this._layerNameHash[id] : Object.keys(this._tableNameHash).indexOf(id) > -1 ?
1878
+ this._tableNameHash[id] : undefined;
1879
+ }
1856
1880
  /**
1857
1881
  * Fetch the ids of the layers from the map
1858
1882
  *
@@ -0,0 +1,414 @@
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, f as forceUpdate, h, H as Host, g as getElement } from './index-b05b3079.js';
7
+ import { f as filterComputedPlacements, c as connectFloatingUI, b as defaultOffsetDistance, a as disconnectFloatingUI, r as reposition, F as FloatingCSS } from './floating-ui-9c3f29d1.js';
8
+ import { d as deactivateFocusTrap, a as activateFocusTrap, c as connectFocusTrap, u as updateFocusTrapElements } from './focusTrapComponent-d703f459.js';
9
+ import { i as isPrimaryPointerButton, t as toAriaBoolean, f as focusFirstTabbable, q as queryElementRoots } from './dom-923ca11d.js';
10
+ import { g as guid } from './guid-99d025c6.js';
11
+ import { o as onToggleOpenCloseComponent } from './openCloseComponent-ecc80ec6.js';
12
+ import { H as Heading } from './Heading-d54e4e64.js';
13
+ import { c as connectLocalized, d as disconnectLocalized } from './locale-76c0c1d9.js';
14
+ import { u as updateMessages, c as connectMessages, s as setUpMessages, d as disconnectMessages } from './t9n-709a2605.js';
15
+ import { i as isActivationKey } from './key-5ab69c42.js';
16
+ import { s as setUpLoadableComponent, a as setComponentLoaded, c as componentFocusable } from './loadable-9617e31c.js';
17
+ import { c as createObserver } from './observers-115d1b4b.js';
18
+ import { F as FloatingArrow } from './FloatingArrow-3bcbf69c.js';
19
+ import './debounce-229b1a22.js';
20
+ import './resources-bb8600a6.js';
21
+
22
+ /*!
23
+ * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
24
+ * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
25
+ * v1.9.0
26
+ */
27
+ const CSS = {
28
+ container: "container",
29
+ imageContainer: "image-container",
30
+ closeButtonContainer: "close-button-container",
31
+ closeButton: "close-button",
32
+ content: "content",
33
+ hasHeader: "has-header",
34
+ header: "header",
35
+ headerContent: "header-content",
36
+ heading: "heading",
37
+ };
38
+ const defaultPopoverPlacement = "auto";
39
+ const ARIA_CONTROLS = "aria-controls";
40
+ const ARIA_EXPANDED = "aria-expanded";
41
+
42
+ /*!
43
+ * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
44
+ * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
45
+ * v1.9.0
46
+ */
47
+ class PopoverManager {
48
+ constructor() {
49
+ // --------------------------------------------------------------------------
50
+ //
51
+ // Private Properties
52
+ //
53
+ // --------------------------------------------------------------------------
54
+ this.registeredElements = new Map();
55
+ this.registeredElementCount = 0;
56
+ // --------------------------------------------------------------------------
57
+ //
58
+ // Private Methods
59
+ //
60
+ // --------------------------------------------------------------------------
61
+ this.queryPopover = (composedPath) => {
62
+ const { registeredElements } = this;
63
+ const registeredElement = composedPath.find((pathEl) => registeredElements.has(pathEl));
64
+ return registeredElements.get(registeredElement);
65
+ };
66
+ this.togglePopovers = (event) => {
67
+ const composedPath = event.composedPath();
68
+ const togglePopover = this.queryPopover(composedPath);
69
+ if (togglePopover && !togglePopover.triggerDisabled) {
70
+ togglePopover.open = !togglePopover.open;
71
+ }
72
+ Array.from(this.registeredElements.values())
73
+ .filter((popover) => popover !== togglePopover && popover.autoClose && popover.open && !composedPath.includes(popover))
74
+ .forEach((popover) => (popover.open = false));
75
+ };
76
+ this.keyHandler = (event) => {
77
+ if (event.defaultPrevented) {
78
+ return;
79
+ }
80
+ if (event.key === "Escape") {
81
+ this.closeAllPopovers();
82
+ }
83
+ else if (isActivationKey(event.key)) {
84
+ this.togglePopovers(event);
85
+ }
86
+ };
87
+ this.clickHandler = (event) => {
88
+ if (isPrimaryPointerButton(event)) {
89
+ this.togglePopovers(event);
90
+ }
91
+ };
92
+ }
93
+ // --------------------------------------------------------------------------
94
+ //
95
+ // Public Methods
96
+ //
97
+ // --------------------------------------------------------------------------
98
+ registerElement(referenceEl, popover) {
99
+ this.registeredElementCount++;
100
+ this.registeredElements.set(referenceEl, popover);
101
+ if (this.registeredElementCount === 1) {
102
+ this.addListeners();
103
+ }
104
+ }
105
+ unregisterElement(referenceEl) {
106
+ if (this.registeredElements.delete(referenceEl)) {
107
+ this.registeredElementCount--;
108
+ }
109
+ if (this.registeredElementCount === 0) {
110
+ this.removeListeners();
111
+ }
112
+ }
113
+ closeAllPopovers() {
114
+ Array.from(this.registeredElements.values()).forEach((popover) => (popover.open = false));
115
+ }
116
+ addListeners() {
117
+ document.addEventListener("pointerdown", this.clickHandler, { capture: true });
118
+ document.addEventListener("keydown", this.keyHandler, { capture: true });
119
+ }
120
+ removeListeners() {
121
+ document.removeEventListener("pointerdown", this.clickHandler, { capture: true });
122
+ document.removeEventListener("keydown", this.keyHandler, { capture: true });
123
+ }
124
+ }
125
+
126
+ const popoverCss = ":host{--calcite-floating-ui-z-index:var(--calcite-popover-z-index, var(--calcite-app-z-index-popup));display:block;position:absolute;z-index:var(--calcite-floating-ui-z-index)}.calcite-floating-ui-anim{position:relative;transition:var(--calcite-floating-ui-transition);transition-property:transform, visibility, opacity;opacity:0;box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);z-index:var(--calcite-app-z-index);border-radius:0.25rem}:host([data-placement^=bottom]) .calcite-floating-ui-anim{transform:translateY(-5px)}:host([data-placement^=top]) .calcite-floating-ui-anim{transform:translateY(5px)}:host([data-placement^=left]) .calcite-floating-ui-anim{transform:translateX(5px)}:host([data-placement^=right]) .calcite-floating-ui-anim{transform:translateX(-5px)}:host([data-placement]) .calcite-floating-ui-anim--active{opacity:1;transform:translate(0)}:host([calcite-hydrated-hidden]){visibility:hidden !important;pointer-events:none}.calcite-floating-ui-arrow{pointer-events:none;position:absolute;z-index:calc(var(--calcite-app-z-index) * -1);fill:var(--calcite-ui-foreground-1)}.calcite-floating-ui-arrow__stroke{stroke:var(--calcite-ui-border-3)}:host([scale=s]) .heading{padding-inline:0.75rem;padding-block:0.5rem;font-size:var(--calcite-font-size--1);line-height:1.375}:host([scale=m]) .heading{padding-inline:1rem;padding-block:0.75rem;font-size:var(--calcite-font-size-0);line-height:1.375}:host([scale=l]) .heading{padding-inline:1.25rem;padding-block:1rem;font-size:var(--calcite-font-size-1);line-height:1.375}: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;border-block-end-color:var(--calcite-ui-border-3)}.heading{margin:0px;display:block;flex:1 1 auto;align-self:center;white-space:normal;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;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%}:host([hidden]){display:none}[hidden]{display:none}";
127
+
128
+ const manager = new PopoverManager();
129
+ const Popover = class {
130
+ constructor(hostRef) {
131
+ registerInstance(this, hostRef);
132
+ this.calcitePopoverBeforeClose = createEvent(this, "calcitePopoverBeforeClose", 6);
133
+ this.calcitePopoverClose = createEvent(this, "calcitePopoverClose", 6);
134
+ this.calcitePopoverBeforeOpen = createEvent(this, "calcitePopoverBeforeOpen", 6);
135
+ this.calcitePopoverOpen = createEvent(this, "calcitePopoverOpen", 6);
136
+ this.mutationObserver = createObserver("mutation", () => this.updateFocusTrapElements());
137
+ this.guid = `calcite-popover-${guid()}`;
138
+ this.openTransitionProp = "opacity";
139
+ this.hasLoaded = false;
140
+ // --------------------------------------------------------------------------
141
+ //
142
+ // Private Methods
143
+ //
144
+ // --------------------------------------------------------------------------
145
+ this.setTransitionEl = (el) => {
146
+ this.transitionEl = el;
147
+ };
148
+ this.setFilteredPlacements = () => {
149
+ const { el, flipPlacements } = this;
150
+ this.filteredFlipPlacements = flipPlacements
151
+ ? filterComputedPlacements(flipPlacements, el)
152
+ : null;
153
+ };
154
+ this.setUpReferenceElement = (warn = true) => {
155
+ this.removeReferences();
156
+ this.effectiveReferenceElement = this.getReferenceElement();
157
+ connectFloatingUI(this, this.effectiveReferenceElement, this.el);
158
+ const { el, referenceElement, effectiveReferenceElement } = this;
159
+ if (warn && referenceElement && !effectiveReferenceElement) {
160
+ console.warn(`${el.tagName}: reference-element id "${referenceElement}" was not found.`, {
161
+ el,
162
+ });
163
+ }
164
+ this.addReferences();
165
+ };
166
+ this.getId = () => {
167
+ return this.el.id || this.guid;
168
+ };
169
+ this.setExpandedAttr = () => {
170
+ const { effectiveReferenceElement, open } = this;
171
+ if (!effectiveReferenceElement) {
172
+ return;
173
+ }
174
+ if ("setAttribute" in effectiveReferenceElement) {
175
+ effectiveReferenceElement.setAttribute(ARIA_EXPANDED, toAriaBoolean(open));
176
+ }
177
+ };
178
+ this.addReferences = () => {
179
+ const { effectiveReferenceElement } = this;
180
+ if (!effectiveReferenceElement) {
181
+ return;
182
+ }
183
+ const id = this.getId();
184
+ if ("setAttribute" in effectiveReferenceElement) {
185
+ effectiveReferenceElement.setAttribute(ARIA_CONTROLS, id);
186
+ }
187
+ manager.registerElement(effectiveReferenceElement, this.el);
188
+ this.setExpandedAttr();
189
+ };
190
+ this.removeReferences = () => {
191
+ const { effectiveReferenceElement } = this;
192
+ if (!effectiveReferenceElement) {
193
+ return;
194
+ }
195
+ if ("removeAttribute" in effectiveReferenceElement) {
196
+ effectiveReferenceElement.removeAttribute(ARIA_CONTROLS);
197
+ effectiveReferenceElement.removeAttribute(ARIA_EXPANDED);
198
+ }
199
+ manager.unregisterElement(effectiveReferenceElement);
200
+ };
201
+ this.hide = () => {
202
+ this.open = false;
203
+ };
204
+ this.storeArrowEl = (el) => {
205
+ this.arrowEl = el;
206
+ this.reposition(true);
207
+ };
208
+ this.autoClose = false;
209
+ this.closable = false;
210
+ this.flipDisabled = false;
211
+ this.focusTrapDisabled = false;
212
+ this.pointerDisabled = false;
213
+ this.flipPlacements = undefined;
214
+ this.heading = undefined;
215
+ this.headingLevel = undefined;
216
+ this.label = undefined;
217
+ this.messageOverrides = undefined;
218
+ this.messages = undefined;
219
+ this.offsetDistance = defaultOffsetDistance;
220
+ this.offsetSkidding = 0;
221
+ this.open = false;
222
+ this.overlayPositioning = "absolute";
223
+ this.placement = defaultPopoverPlacement;
224
+ this.referenceElement = undefined;
225
+ this.scale = "m";
226
+ this.triggerDisabled = false;
227
+ this.effectiveLocale = "";
228
+ this.floatingLayout = "vertical";
229
+ this.effectiveReferenceElement = undefined;
230
+ this.defaultMessages = undefined;
231
+ }
232
+ handleFocusTrapDisabled(focusTrapDisabled) {
233
+ if (!this.open) {
234
+ return;
235
+ }
236
+ focusTrapDisabled ? deactivateFocusTrap(this) : activateFocusTrap(this);
237
+ }
238
+ flipPlacementsHandler() {
239
+ this.setFilteredPlacements();
240
+ this.reposition(true);
241
+ }
242
+ onMessagesChange() {
243
+ /* wired up by t9n util */
244
+ }
245
+ offsetDistanceOffsetHandler() {
246
+ this.reposition(true);
247
+ }
248
+ offsetSkiddingHandler() {
249
+ this.reposition(true);
250
+ }
251
+ openHandler(value) {
252
+ onToggleOpenCloseComponent(this);
253
+ if (value) {
254
+ this.reposition(true);
255
+ }
256
+ this.setExpandedAttr();
257
+ }
258
+ overlayPositioningHandler() {
259
+ this.reposition(true);
260
+ }
261
+ placementHandler() {
262
+ this.reposition(true);
263
+ }
264
+ referenceElementHandler() {
265
+ this.setUpReferenceElement();
266
+ this.reposition(true);
267
+ }
268
+ effectiveLocaleChange() {
269
+ updateMessages(this, this.effectiveLocale);
270
+ }
271
+ // --------------------------------------------------------------------------
272
+ //
273
+ // Lifecycle
274
+ //
275
+ // --------------------------------------------------------------------------
276
+ connectedCallback() {
277
+ this.setFilteredPlacements();
278
+ connectLocalized(this);
279
+ connectMessages(this);
280
+ this.setUpReferenceElement(this.hasLoaded);
281
+ connectFocusTrap(this);
282
+ if (this.open) {
283
+ onToggleOpenCloseComponent(this);
284
+ }
285
+ }
286
+ async componentWillLoad() {
287
+ await setUpMessages(this);
288
+ setUpLoadableComponent(this);
289
+ }
290
+ componentDidLoad() {
291
+ setComponentLoaded(this);
292
+ if (this.referenceElement && !this.effectiveReferenceElement) {
293
+ this.setUpReferenceElement();
294
+ }
295
+ this.reposition();
296
+ this.hasLoaded = true;
297
+ }
298
+ disconnectedCallback() {
299
+ this.removeReferences();
300
+ disconnectLocalized(this);
301
+ disconnectMessages(this);
302
+ disconnectFloatingUI(this, this.effectiveReferenceElement, this.el);
303
+ deactivateFocusTrap(this);
304
+ }
305
+ // --------------------------------------------------------------------------
306
+ //
307
+ // Public Methods
308
+ //
309
+ // --------------------------------------------------------------------------
310
+ /**
311
+ * Updates the position of the component.
312
+ *
313
+ * @param delayed
314
+ */
315
+ async reposition(delayed = false) {
316
+ const { el, effectiveReferenceElement, placement, overlayPositioning, flipDisabled, filteredFlipPlacements, offsetDistance, offsetSkidding, arrowEl, } = this;
317
+ return reposition(this, {
318
+ floatingEl: el,
319
+ referenceEl: effectiveReferenceElement,
320
+ overlayPositioning,
321
+ placement,
322
+ flipDisabled,
323
+ flipPlacements: filteredFlipPlacements,
324
+ offsetDistance,
325
+ offsetSkidding,
326
+ arrowEl,
327
+ type: "popover",
328
+ }, delayed);
329
+ }
330
+ /**
331
+ * Sets focus on the component's first focusable element.
332
+ */
333
+ async setFocus() {
334
+ await componentFocusable(this);
335
+ forceUpdate(this.el);
336
+ focusFirstTabbable(this.el);
337
+ }
338
+ /**
339
+ * Updates the element(s) that are used within the focus-trap of the component.
340
+ */
341
+ async updateFocusTrapElements() {
342
+ updateFocusTrapElements(this);
343
+ }
344
+ getReferenceElement() {
345
+ const { referenceElement, el } = this;
346
+ return ((typeof referenceElement === "string"
347
+ ? queryElementRoots(el, { id: referenceElement })
348
+ : referenceElement) || null);
349
+ }
350
+ onBeforeOpen() {
351
+ this.calcitePopoverBeforeOpen.emit();
352
+ }
353
+ onOpen() {
354
+ this.calcitePopoverOpen.emit();
355
+ activateFocusTrap(this);
356
+ }
357
+ onBeforeClose() {
358
+ this.calcitePopoverBeforeClose.emit();
359
+ }
360
+ onClose() {
361
+ this.calcitePopoverClose.emit();
362
+ deactivateFocusTrap(this);
363
+ }
364
+ // --------------------------------------------------------------------------
365
+ //
366
+ // Render Methods
367
+ //
368
+ // --------------------------------------------------------------------------
369
+ renderCloseButton() {
370
+ const { messages, closable } = this;
371
+ return closable ? (h("div", { class: CSS.closeButtonContainer, key: CSS.closeButtonContainer }, h("calcite-action", { appearance: "transparent", class: CSS.closeButton, onClick: this.hide, scale: this.scale, text: messages.close,
372
+ // eslint-disable-next-line react/jsx-sort-props -- ref should be last so node attrs/props are in sync (see https://github.com/Esri/calcite-design-system/pull/6530)
373
+ ref: (closeButtonEl) => (this.closeButtonEl = closeButtonEl) }, h("calcite-icon", { icon: "x", scale: this.scale === "l" ? "m" : this.scale })))) : null;
374
+ }
375
+ renderHeader() {
376
+ const { heading, headingLevel } = this;
377
+ const headingNode = heading ? (h(Heading, { class: CSS.heading, level: headingLevel }, heading)) : null;
378
+ return headingNode ? (h("div", { class: CSS.header, key: CSS.header }, headingNode, this.renderCloseButton())) : null;
379
+ }
380
+ render() {
381
+ const { effectiveReferenceElement, heading, label, open, pointerDisabled, floatingLayout } = this;
382
+ const displayed = effectiveReferenceElement && open;
383
+ const hidden = !displayed;
384
+ const arrowNode = !pointerDisabled ? (h(FloatingArrow, { floatingLayout: floatingLayout, key: "floating-arrow",
385
+ // eslint-disable-next-line react/jsx-sort-props -- ref should be last so node attrs/props are in sync (see https://github.com/Esri/calcite-design-system/pull/6530)
386
+ ref: this.storeArrowEl })) : null;
387
+ 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: {
388
+ [FloatingCSS.animation]: true,
389
+ [FloatingCSS.animationActive]: displayed,
390
+ },
391
+ // eslint-disable-next-line react/jsx-sort-props -- ref should be last so node attrs/props are in sync (see https://github.com/Esri/calcite-design-system/pull/6530)
392
+ ref: this.setTransitionEl }, arrowNode, h("div", { class: {
393
+ [CSS.hasHeader]: !!heading,
394
+ [CSS.container]: true,
395
+ } }, this.renderHeader(), h("div", { class: CSS.content }, h("slot", null)), !heading ? this.renderCloseButton() : null))));
396
+ }
397
+ static get assetsDirs() { return ["assets"]; }
398
+ get el() { return getElement(this); }
399
+ static get watchers() { return {
400
+ "focusTrapDisabled": ["handleFocusTrapDisabled"],
401
+ "flipPlacements": ["flipPlacementsHandler"],
402
+ "messageOverrides": ["onMessagesChange"],
403
+ "offsetDistance": ["offsetDistanceOffsetHandler"],
404
+ "offsetSkidding": ["offsetSkiddingHandler"],
405
+ "open": ["openHandler"],
406
+ "overlayPositioning": ["overlayPositioningHandler"],
407
+ "placement": ["placementHandler"],
408
+ "referenceElement": ["referenceElementHandler"],
409
+ "effectiveLocale": ["effectiveLocaleChange"]
410
+ }; }
411
+ };
412
+ Popover.style = popoverCss;
413
+
414
+ export { Popover as calcite_popover };