@esri/calcite-components 1.0.0-next.365 → 1.0.0-next.366

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. package/dist/calcite/calcite.esm.js +1 -1
  2. package/dist/calcite/p-0282fd8b.system.entry.js +5 -0
  3. package/dist/calcite/p-050ff462.entry.js +5 -0
  4. package/dist/calcite/p-05b03971.system.entry.js +5 -0
  5. package/dist/calcite/p-08847812.entry.js +5 -0
  6. package/dist/calcite/p-1bcce6c9.entry.js +5 -0
  7. package/dist/calcite/p-1ef9235e.system.entry.js +5 -0
  8. package/dist/calcite/p-25ed6059.entry.js +5 -0
  9. package/dist/calcite/p-40cbbd20.entry.js +5 -0
  10. package/dist/calcite/p-4347fde9.system.entry.js +5 -0
  11. package/dist/calcite/p-43cd4b9b.entry.js +5 -0
  12. package/dist/calcite/p-55e2658e.entry.js +5 -0
  13. package/dist/calcite/p-5682a918.entry.js +5 -0
  14. package/dist/calcite/p-597b782e.system.entry.js +5 -0
  15. package/dist/calcite/p-60e4f404.entry.js +5 -0
  16. package/dist/calcite/p-660c8077.js +5 -0
  17. package/dist/calcite/p-7279ccf9.entry.js +5 -0
  18. package/dist/calcite/p-832d7f68.system.entry.js +5 -0
  19. package/dist/calcite/p-888a152c.system.entry.js +5 -0
  20. package/dist/calcite/p-946c3bed.system.entry.js +5 -0
  21. package/dist/calcite/p-94717214.entry.js +5 -0
  22. package/dist/calcite/p-953259af.entry.js +5 -0
  23. package/dist/calcite/p-99d32fc3.system.js +1 -1
  24. package/dist/calcite/p-9b723fdd.system.entry.js +5 -0
  25. package/dist/calcite/p-9fe77a88.system.entry.js +5 -0
  26. package/dist/calcite/p-a52288cd.system.entry.js +5 -0
  27. package/dist/calcite/p-a71d17b4.entry.js +5 -0
  28. package/dist/calcite/p-aea7c650.system.entry.js +5 -0
  29. package/dist/calcite/p-af7ed41f.system.entry.js +5 -0
  30. package/dist/calcite/p-b14e0be5.system.entry.js +5 -0
  31. package/dist/calcite/p-b53b28e3.system.js +5 -0
  32. package/dist/calcite/p-b88d7391.entry.js +5 -0
  33. package/dist/calcite/p-ba915998.entry.js +5 -0
  34. package/dist/calcite/p-dd4457cd.entry.js +5 -0
  35. package/dist/calcite/p-eff2fb8c.system.entry.js +5 -0
  36. package/dist/calcite/p-fd57beb5.system.entry.js +5 -0
  37. package/dist/cjs/calcite-action-bar.cjs.entry.js +3 -24
  38. package/dist/cjs/calcite-action-group.cjs.entry.js +13 -0
  39. package/dist/cjs/calcite-action-menu.cjs.entry.js +3 -0
  40. package/dist/cjs/calcite-action-pad.cjs.entry.js +8 -0
  41. package/dist/cjs/calcite-block_2.cjs.entry.js +14 -1
  42. package/dist/cjs/calcite-chip.cjs.entry.js +14 -1
  43. package/dist/cjs/calcite-list_3.cjs.entry.js +13 -0
  44. package/dist/cjs/calcite-modal.cjs.entry.js +5 -2
  45. package/dist/cjs/calcite-notice.cjs.entry.js +8 -0
  46. package/dist/cjs/calcite-panel.cjs.entry.js +18 -12
  47. package/dist/cjs/calcite-pick-list_3.cjs.entry.js +23 -0
  48. package/dist/cjs/calcite-shell_3.cjs.entry.js +35 -7
  49. package/dist/cjs/calcite-tile.cjs.entry.js +13 -0
  50. package/dist/cjs/calcite-tip_3.cjs.entry.js +13 -1
  51. package/dist/cjs/calcite-tree_2.cjs.entry.js +6 -0
  52. package/dist/cjs/calcite-value-list_2.cjs.entry.js +12 -0
  53. package/dist/cjs/conditionalSlot-e874fbb0.js +43 -0
  54. package/dist/collection/components/calcite-action-group/calcite-action-group.js +12 -0
  55. package/dist/collection/components/calcite-action-menu/calcite-action-menu.js +3 -0
  56. package/dist/collection/components/calcite-action-pad/calcite-action-pad.js +7 -0
  57. package/dist/collection/components/calcite-block/calcite-block.js +13 -1
  58. package/dist/collection/components/calcite-chip/calcite-chip.js +13 -1
  59. package/dist/collection/components/calcite-list-item/calcite-list-item.js +12 -0
  60. package/dist/collection/components/calcite-modal/calcite-modal.js +5 -2
  61. package/dist/collection/components/calcite-notice/calcite-notice.js +7 -0
  62. package/dist/collection/components/calcite-panel/calcite-panel.js +19 -14
  63. package/dist/collection/components/calcite-pick-list-group/calcite-pick-list-group.js +12 -0
  64. package/dist/collection/components/calcite-pick-list-item/calcite-pick-list-item.js +12 -0
  65. package/dist/collection/components/calcite-shell/calcite-shell.js +14 -2
  66. package/dist/collection/components/calcite-shell-center-row/calcite-shell-center-row.js +13 -1
  67. package/dist/collection/components/calcite-shell-panel/calcite-shell-panel.js +9 -4
  68. package/dist/collection/components/calcite-tile/calcite-tile.js +12 -0
  69. package/dist/collection/components/calcite-tip/calcite-tip.js +13 -1
  70. package/dist/collection/components/calcite-tree-item/calcite-tree-item.js +5 -0
  71. package/dist/collection/components/calcite-value-list-item/calcite-value-list-item.js +12 -0
  72. package/dist/collection/utils/conditionalSlot.js +22 -11
  73. package/dist/components/calcite-action-bar.js +2 -23
  74. package/dist/components/calcite-action-group2.js +12 -0
  75. package/dist/components/calcite-action-menu2.js +3 -0
  76. package/dist/components/calcite-action-pad.js +7 -0
  77. package/dist/components/calcite-block.js +13 -1
  78. package/dist/components/calcite-chip2.js +13 -1
  79. package/dist/components/calcite-list-item.js +12 -0
  80. package/dist/components/calcite-modal.js +5 -2
  81. package/dist/components/calcite-notice.js +7 -0
  82. package/dist/components/calcite-panel.js +17 -12
  83. package/dist/components/calcite-pick-list-group.js +12 -0
  84. package/dist/components/calcite-pick-list-item2.js +12 -0
  85. package/dist/components/calcite-shell-center-row.js +13 -1
  86. package/dist/components/calcite-shell-panel.js +9 -4
  87. package/dist/components/calcite-shell.js +14 -2
  88. package/dist/components/calcite-tile2.js +12 -0
  89. package/dist/components/calcite-tip.js +13 -1
  90. package/dist/components/calcite-tree-item.js +5 -0
  91. package/dist/components/calcite-value-list-item.js +12 -0
  92. package/dist/components/conditionalSlot.js +40 -0
  93. package/dist/custom-elements/index.js +194 -35
  94. package/dist/esm/calcite-action-bar.entry.js +2 -23
  95. package/dist/esm/calcite-action-group.entry.js +13 -0
  96. package/dist/esm/calcite-action-menu.entry.js +3 -0
  97. package/dist/esm/calcite-action-pad.entry.js +8 -0
  98. package/dist/esm/calcite-block_2.entry.js +14 -1
  99. package/dist/esm/calcite-chip.entry.js +14 -1
  100. package/dist/esm/calcite-list_3.entry.js +13 -0
  101. package/dist/esm/calcite-modal.entry.js +5 -2
  102. package/dist/esm/calcite-notice.entry.js +8 -0
  103. package/dist/esm/calcite-panel.entry.js +18 -12
  104. package/dist/esm/calcite-pick-list_3.entry.js +23 -0
  105. package/dist/esm/calcite-shell_3.entry.js +35 -7
  106. package/dist/esm/calcite-tile.entry.js +13 -0
  107. package/dist/esm/calcite-tip_3.entry.js +13 -1
  108. package/dist/esm/calcite-tree_2.entry.js +6 -0
  109. package/dist/esm/calcite-value-list_2.entry.js +12 -0
  110. package/dist/esm/conditionalSlot-0c4ea23a.js +40 -0
  111. package/dist/esm-es5/calcite-action-bar.entry.js +2 -2
  112. package/dist/esm-es5/calcite-action-group.entry.js +1 -1
  113. package/dist/esm-es5/calcite-action-menu.entry.js +2 -2
  114. package/dist/esm-es5/calcite-action-pad.entry.js +2 -2
  115. package/dist/esm-es5/calcite-block_2.entry.js +1 -1
  116. package/dist/esm-es5/calcite-chip.entry.js +2 -2
  117. package/dist/esm-es5/calcite-list_3.entry.js +1 -1
  118. package/dist/esm-es5/calcite-modal.entry.js +1 -1
  119. package/dist/esm-es5/calcite-notice.entry.js +2 -2
  120. package/dist/esm-es5/calcite-panel.entry.js +2 -2
  121. package/dist/esm-es5/calcite-pick-list_3.entry.js +1 -1
  122. package/dist/esm-es5/calcite-shell_3.entry.js +1 -1
  123. package/dist/esm-es5/calcite-tile.entry.js +1 -1
  124. package/dist/esm-es5/calcite-tip_3.entry.js +1 -1
  125. package/dist/esm-es5/calcite-tree_2.entry.js +1 -1
  126. package/dist/esm-es5/calcite-value-list_2.entry.js +1 -1
  127. package/dist/esm-es5/conditionalSlot-0c4ea23a.js +5 -0
  128. package/dist/extras/docs-json.json +1 -1
  129. package/dist/types/components/calcite-action-group/calcite-action-group.d.ts +4 -1
  130. package/dist/types/components/calcite-action-menu/calcite-action-menu.d.ts +2 -1
  131. package/dist/types/components/calcite-action-pad/calcite-action-pad.d.ts +4 -1
  132. package/dist/types/components/calcite-block/calcite-block.d.ts +4 -1
  133. package/dist/types/components/calcite-chip/calcite-chip.d.ts +4 -1
  134. package/dist/types/components/calcite-list-item/calcite-list-item.d.ts +4 -1
  135. package/dist/types/components/calcite-modal/calcite-modal.d.ts +2 -1
  136. package/dist/types/components/calcite-notice/calcite-notice.d.ts +4 -1
  137. package/dist/types/components/calcite-panel/calcite-panel.d.ts +5 -6
  138. package/dist/types/components/calcite-pick-list-group/calcite-pick-list-group.d.ts +4 -1
  139. package/dist/types/components/calcite-pick-list-item/calcite-pick-list-item.d.ts +4 -1
  140. package/dist/types/components/calcite-shell/calcite-shell.d.ts +4 -1
  141. package/dist/types/components/calcite-shell-center-row/calcite-shell-center-row.d.ts +4 -1
  142. package/dist/types/components/calcite-shell-panel/calcite-shell-panel.d.ts +3 -1
  143. package/dist/types/components/calcite-tile/calcite-tile.d.ts +4 -1
  144. package/dist/types/components/calcite-tip/calcite-tip.d.ts +4 -1
  145. package/dist/types/components/calcite-tree-item/calcite-tree-item.d.ts +3 -1
  146. package/dist/types/components/calcite-value-list-item/calcite-value-list-item.d.ts +4 -1
  147. package/hydrate/index.js +194 -35
  148. package/package.json +1 -1
  149. package/dist/calcite/p-0af820bf.entry.js +0 -5
  150. package/dist/calcite/p-0cf878ed.system.entry.js +0 -5
  151. package/dist/calcite/p-1d7a9909.system.entry.js +0 -5
  152. package/dist/calcite/p-253efee4.entry.js +0 -5
  153. package/dist/calcite/p-2618de8a.entry.js +0 -5
  154. package/dist/calcite/p-273cd5ab.entry.js +0 -5
  155. package/dist/calcite/p-2a8938c7.system.entry.js +0 -5
  156. package/dist/calcite/p-2c954eaa.system.entry.js +0 -5
  157. package/dist/calcite/p-37bddb73.system.entry.js +0 -5
  158. package/dist/calcite/p-3ab992ff.system.entry.js +0 -5
  159. package/dist/calcite/p-3b73b785.system.entry.js +0 -5
  160. package/dist/calcite/p-4659df78.entry.js +0 -5
  161. package/dist/calcite/p-54e271c9.system.entry.js +0 -5
  162. package/dist/calcite/p-5df1936f.entry.js +0 -5
  163. package/dist/calcite/p-698167ac.entry.js +0 -5
  164. package/dist/calcite/p-7d355abe.system.entry.js +0 -5
  165. package/dist/calcite/p-8d36bc7c.entry.js +0 -5
  166. package/dist/calcite/p-9d81d229.entry.js +0 -5
  167. package/dist/calcite/p-a0043c61.entry.js +0 -5
  168. package/dist/calcite/p-a1f65f6e.entry.js +0 -5
  169. package/dist/calcite/p-a4dec1f6.system.entry.js +0 -5
  170. package/dist/calcite/p-a9c50960.system.entry.js +0 -5
  171. package/dist/calcite/p-aaed1677.entry.js +0 -5
  172. package/dist/calcite/p-ac778725.system.entry.js +0 -5
  173. package/dist/calcite/p-ac8cf248.entry.js +0 -5
  174. package/dist/calcite/p-b4d3f1c1.entry.js +0 -5
  175. package/dist/calcite/p-c0ed9eff.entry.js +0 -5
  176. package/dist/calcite/p-cb9cd28c.system.entry.js +0 -5
  177. package/dist/calcite/p-d578e568.system.entry.js +0 -5
  178. package/dist/calcite/p-e564004a.system.entry.js +0 -5
  179. package/dist/calcite/p-f6fc151d.system.entry.js +0 -5
  180. package/dist/calcite/p-f73124d0.entry.js +0 -5
@@ -8,7 +8,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
8
8
 
9
9
  const index = require('./index-6b5d2de5.js');
10
10
  const dom = require('./dom-0de9fb18.js');
11
+ const conditionalSlot = require('./conditionalSlot-e874fbb0.js');
11
12
  require('./guid-b270f0db.js');
13
+ require('./observers-41837607.js');
12
14
 
13
15
  const SLOTS = {
14
16
  contentStart: "content-start",
@@ -43,6 +45,17 @@ let CalciteTile = class {
43
45
  }
44
46
  // --------------------------------------------------------------------------
45
47
  //
48
+ // Lifecycle
49
+ //
50
+ // --------------------------------------------------------------------------
51
+ connectedCallback() {
52
+ conditionalSlot.connectConditionalSlotComponent(this);
53
+ }
54
+ disconnectedCallback() {
55
+ conditionalSlot.disconnectConditionalSlotComponent(this);
56
+ }
57
+ // --------------------------------------------------------------------------
58
+ //
46
59
  // Render Methods
47
60
  //
48
61
  // --------------------------------------------------------------------------
@@ -9,6 +9,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
9
9
  const index = require('./index-6b5d2de5.js');
10
10
  const dom = require('./dom-0de9fb18.js');
11
11
  const CalciteHeading = require('./CalciteHeading-112c19f9.js');
12
+ const conditionalSlot = require('./conditionalSlot-e874fbb0.js');
12
13
  const observers = require('./observers-41837607.js');
13
14
  require('./guid-b270f0db.js');
14
15
 
@@ -94,6 +95,17 @@ let CalciteTip = class {
94
95
  }
95
96
  // --------------------------------------------------------------------------
96
97
  //
98
+ // Lifecycle
99
+ //
100
+ // --------------------------------------------------------------------------
101
+ connectedCallback() {
102
+ conditionalSlot.connectConditionalSlotComponent(this);
103
+ }
104
+ disconnectedCallback() {
105
+ conditionalSlot.disconnectConditionalSlotComponent(this);
106
+ }
107
+ // --------------------------------------------------------------------------
108
+ //
97
109
  // Render Methods
98
110
  //
99
111
  // --------------------------------------------------------------------------
@@ -112,7 +124,7 @@ let CalciteTip = class {
112
124
  }
113
125
  renderImageFrame() {
114
126
  const { el } = this;
115
- return dom.getSlotted(el, SLOTS.thumbnail) ? (index.h("div", { class: CSS.imageFrame }, index.h("slot", { name: SLOTS.thumbnail }))) : null;
127
+ return dom.getSlotted(el, SLOTS.thumbnail) ? (index.h("div", { class: CSS.imageFrame, key: "thumbnail" }, index.h("slot", { name: SLOTS.thumbnail }))) : null;
116
128
  }
117
129
  renderInfoNode() {
118
130
  return (index.h("div", { class: CSS.info }, index.h("slot", null)));
@@ -8,7 +8,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
8
8
 
9
9
  const index = require('./index-6b5d2de5.js');
10
10
  const dom = require('./dom-0de9fb18.js');
11
+ const conditionalSlot = require('./conditionalSlot-e874fbb0.js');
11
12
  require('./guid-b270f0db.js');
13
+ require('./observers-41837607.js');
12
14
 
13
15
  var TreeSelectionMode;
14
16
  (function (TreeSelectionMode) {
@@ -292,6 +294,10 @@ let CalciteTreeItem = class {
292
294
  const { expanded } = this.parentTreeItem;
293
295
  this.updateParentIsExpanded(this.parentTreeItem, expanded);
294
296
  }
297
+ conditionalSlot.connectConditionalSlotComponent(this);
298
+ }
299
+ disconnectedCallback() {
300
+ conditionalSlot.disconnectConditionalSlotComponent(this);
295
301
  }
296
302
  componentWillRender() {
297
303
  this.hasChildren = !!this.el.querySelector("calcite-tree");
@@ -13,6 +13,7 @@ const array = require('./array-a5dedf5a.js');
13
13
  const observers = require('./observers-41837607.js');
14
14
  const guid = require('./guid-b270f0db.js');
15
15
  const dom = require('./dom-0de9fb18.js');
16
+ const conditionalSlot = require('./conditionalSlot-e874fbb0.js');
16
17
  require('./debounce-95979061.js');
17
18
 
18
19
  const CSS = {
@@ -281,6 +282,17 @@ let CalciteValueListItem = class {
281
282
  }
282
283
  // --------------------------------------------------------------------------
283
284
  //
285
+ // Lifecycle
286
+ //
287
+ // --------------------------------------------------------------------------
288
+ connectedCallback() {
289
+ conditionalSlot.connectConditionalSlotComponent(this);
290
+ }
291
+ disconnectedCallback() {
292
+ conditionalSlot.disconnectConditionalSlotComponent(this);
293
+ }
294
+ // --------------------------------------------------------------------------
295
+ //
284
296
  // Public Methods
285
297
  //
286
298
  // --------------------------------------------------------------------------
@@ -0,0 +1,43 @@
1
+ /*!
2
+ * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
4
+ */
5
+ 'use strict';
6
+
7
+ const index = require('./index-6b5d2de5.js');
8
+ const observers = require('./observers-41837607.js');
9
+
10
+ const observed = new Set();
11
+ let mutationObserver;
12
+ const observerOptions = { childList: true };
13
+ /**
14
+ * Helper to set up a conditional slot component on connectedCallback.
15
+ */
16
+ function connectConditionalSlotComponent(component) {
17
+ if (!mutationObserver) {
18
+ mutationObserver = observers.createObserver("mutation", processMutations);
19
+ }
20
+ mutationObserver.observe(component.el, observerOptions);
21
+ }
22
+ /**
23
+ * Helper to tear down a conditional slot component on disconnectedCallback.
24
+ */
25
+ function disconnectConditionalSlotComponent(component) {
26
+ observed.delete(component.el);
27
+ // we explicitly process queued mutations and disconnect and reconnect
28
+ // the observer until MutationObserver gets an `unobserve` method
29
+ // see https://github.com/whatwg/dom/issues/126
30
+ processMutations(mutationObserver.takeRecords());
31
+ mutationObserver.disconnect();
32
+ for (const [element] of observed.entries()) {
33
+ mutationObserver.observe(element, observerOptions);
34
+ }
35
+ }
36
+ function processMutations(mutations) {
37
+ mutations.forEach(({ target }) => {
38
+ index.forceUpdate(target);
39
+ });
40
+ }
41
+
42
+ exports.connectConditionalSlotComponent = connectConditionalSlotComponent;
43
+ exports.disconnectConditionalSlotComponent = disconnectConditionalSlotComponent;
@@ -7,6 +7,7 @@ import { SLOTS, TEXT, ICONS } from "./resources";
7
7
  import { Fragment } from "@stencil/core/internal";
8
8
  import { getSlotted } from "../../utils/dom";
9
9
  import { SLOTS as ACTION_MENU_SLOTS } from "../calcite-action-menu/resources";
10
+ import { connectConditionalSlotComponent, disconnectConditionalSlotComponent } from "../../utils/conditionalSlot";
10
11
  /**
11
12
  * @slot - A slot for adding a group of `calcite-action`s.
12
13
  * @slot menu-actions - a slot for adding an overflow menu with actions inside a dropdown.
@@ -45,6 +46,17 @@ export class CalciteActionGroup {
45
46
  }
46
47
  // --------------------------------------------------------------------------
47
48
  //
49
+ // Lifecycle
50
+ //
51
+ // --------------------------------------------------------------------------
52
+ connectedCallback() {
53
+ connectConditionalSlotComponent(this);
54
+ }
55
+ disconnectedCallback() {
56
+ disconnectConditionalSlotComponent(this);
57
+ }
58
+ // --------------------------------------------------------------------------
59
+ //
48
60
  // Component Methods
49
61
  //
50
62
  // --------------------------------------------------------------------------
@@ -9,6 +9,7 @@ import { Fragment } from "@stencil/core/internal";
9
9
  import { getRoundRobinIndex } from "../../utils/array";
10
10
  import { guid } from "../../utils/guid";
11
11
  import { createObserver } from "../../utils/observers";
12
+ import { connectConditionalSlotComponent, disconnectConditionalSlotComponent } from "../../utils/conditionalSlot";
12
13
  const SUPPORTED_BUTTON_NAV_KEYS = ["ArrowUp", "ArrowDown"];
13
14
  const SUPPORTED_MENU_NAV_KEYS = ["ArrowUp", "ArrowDown", "End", "Home"];
14
15
  /**
@@ -220,11 +221,13 @@ export class CalciteActionMenu {
220
221
  var _a;
221
222
  (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
222
223
  this.getActions();
224
+ connectConditionalSlotComponent(this);
223
225
  }
224
226
  disconnectedCallback() {
225
227
  var _a;
226
228
  (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
227
229
  this.disconnectMenuButtonEl();
230
+ disconnectConditionalSlotComponent(this);
228
231
  }
229
232
  expandedHandler() {
230
233
  this.open = false;
@@ -6,6 +6,7 @@ import { Component, Element, Event, Host, Prop, Watch, h, Method } from "@stenci
6
6
  import { CalciteExpandToggle, toggleChildActionText } from "../functional/CalciteExpandToggle";
7
7
  import { focusElement, getSlotted } from "../../utils/dom";
8
8
  import { CSS, TEXT, SLOTS } from "./resources";
9
+ import { connectConditionalSlotComponent, disconnectConditionalSlotComponent } from "../../utils/conditionalSlot";
9
10
  /**
10
11
  * @slot - A slot for adding `calcite-action`s to the action pad.
11
12
  * @slot expand-tooltip - Used to set the tooltip for the expand toggle.
@@ -67,6 +68,12 @@ export class CalciteActionPad {
67
68
  // Lifecycle
68
69
  //
69
70
  // --------------------------------------------------------------------------
71
+ connectedCallback() {
72
+ connectConditionalSlotComponent(this);
73
+ }
74
+ disconnectedCallback() {
75
+ disconnectConditionalSlotComponent(this);
76
+ }
70
77
  componentWillLoad() {
71
78
  const { el, expandDisabled, expanded } = this;
72
79
  if (!expandDisabled) {
@@ -6,6 +6,7 @@ import { Component, Element, Event, h, Host, Prop } from "@stencil/core";
6
6
  import { CSS, HEADING_LEVEL, ICONS, SLOTS, TEXT } from "./resources";
7
7
  import { getSlotted } from "../../utils/dom";
8
8
  import { CalciteHeading } from "../functional/CalciteHeading";
9
+ import { connectConditionalSlotComponent, disconnectConditionalSlotComponent } from "../../utils/conditionalSlot";
9
10
  /**
10
11
  * @slot - A slot for adding content to the block.
11
12
  * @slot icon - A slot for adding a leading header icon.
@@ -59,6 +60,17 @@ export class CalciteBlock {
59
60
  }
60
61
  // --------------------------------------------------------------------------
61
62
  //
63
+ // Lifecycle
64
+ //
65
+ // --------------------------------------------------------------------------
66
+ connectedCallback() {
67
+ connectConditionalSlotComponent(this);
68
+ }
69
+ disconnectedCallback() {
70
+ disconnectConditionalSlotComponent(this);
71
+ }
72
+ // --------------------------------------------------------------------------
73
+ //
62
74
  // Render Methods
63
75
  //
64
76
  // --------------------------------------------------------------------------
@@ -72,7 +84,7 @@ export class CalciteBlock {
72
84
  const showingLoadingStatus = this.loading && !this.open;
73
85
  const statusIcon = showingLoadingStatus ? ICONS.refresh : ICONS[status];
74
86
  const hasIcon = getSlotted(el, SLOTS.icon) || statusIcon;
75
- const iconEl = !statusIcon ? (h("slot", { name: SLOTS.icon })) : (h("calcite-icon", { class: {
87
+ const iconEl = !statusIcon ? (h("slot", { key: "icon-slot", name: SLOTS.icon })) : (h("calcite-icon", { class: {
76
88
  [CSS.statusIcon]: true,
77
89
  [CSS.valid]: status == "valid",
78
90
  [CSS.invalid]: status == "invalid",
@@ -6,6 +6,7 @@ import { Component, h, Prop, Event, Element, Method } from "@stencil/core";
6
6
  import { getSlotted } from "../../utils/dom";
7
7
  import { guid } from "../../utils/guid";
8
8
  import { CSS, TEXT, SLOTS, ICONS } from "./resources";
9
+ import { connectConditionalSlotComponent, disconnectConditionalSlotComponent } from "../../utils/conditionalSlot";
9
10
  /**
10
11
  * @slot - A slot for adding text.
11
12
  * @slot image - A slot for adding an image.
@@ -42,6 +43,17 @@ export class CalciteChip {
42
43
  };
43
44
  this.guid = guid();
44
45
  }
46
+ // --------------------------------------------------------------------------
47
+ //
48
+ // Lifecycle
49
+ //
50
+ // --------------------------------------------------------------------------
51
+ connectedCallback() {
52
+ connectConditionalSlotComponent(this);
53
+ }
54
+ disconnectedCallback() {
55
+ disconnectConditionalSlotComponent(this);
56
+ }
45
57
  //--------------------------------------------------------------------------
46
58
  //
47
59
  // Public Methods
@@ -60,7 +72,7 @@ export class CalciteChip {
60
72
  renderChipImage() {
61
73
  const { el } = this;
62
74
  const hasChipImage = getSlotted(el, SLOTS.image);
63
- return hasChipImage ? (h("div", { class: CSS.chipImageContainer },
75
+ return hasChipImage ? (h("div", { class: CSS.chipImageContainer, key: "image" },
64
76
  h("slot", { name: SLOTS.image }))) : null;
65
77
  }
66
78
  render() {
@@ -5,6 +5,7 @@
5
5
  import { Component, Element, Prop, h, Host, Method } from "@stencil/core";
6
6
  import { SLOTS, CSS } from "./resources";
7
7
  import { getSlotted } from "../../utils/dom";
8
+ import { connectConditionalSlotComponent, disconnectConditionalSlotComponent } from "../../utils/conditionalSlot";
8
9
  /**
9
10
  * @slot - A slot for adding `calcite-list-item` and `calcite-list-item-group` elements.
10
11
  * @slot actions-start - A slot for adding actionable `calcite-action` elements before the content of the list item.
@@ -30,6 +31,17 @@ export class CalciteListItem {
30
31
  }
31
32
  // --------------------------------------------------------------------------
32
33
  //
34
+ // Lifecycle
35
+ //
36
+ // --------------------------------------------------------------------------
37
+ connectedCallback() {
38
+ connectConditionalSlotComponent(this);
39
+ }
40
+ disconnectedCallback() {
41
+ disconnectConditionalSlotComponent(this);
42
+ }
43
+ // --------------------------------------------------------------------------
44
+ //
33
45
  // Public Methods
34
46
  //
35
47
  // --------------------------------------------------------------------------
@@ -8,6 +8,7 @@ import { queryShadowRoot } from "@a11y/focus-trap/shadow";
8
8
  import { isFocusable, isHidden } from "@a11y/focus-trap/focusable";
9
9
  import { TEXT, SLOTS, CSS, ICONS } from "./resources";
10
10
  import { createObserver } from "../../utils/observers";
11
+ import { connectConditionalSlotComponent, disconnectConditionalSlotComponent } from "../../utils/conditionalSlot";
11
12
  const isFocusableExtended = (el) => {
12
13
  return isCalciteFocusable(el) || isFocusable(el);
13
14
  };
@@ -115,11 +116,13 @@ export class CalciteModal {
115
116
  var _a;
116
117
  (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
117
118
  this.updateFooterVisibility();
119
+ connectConditionalSlotComponent(this);
118
120
  }
119
121
  disconnectedCallback() {
120
122
  var _a;
121
123
  this.removeOverflowHiddenClass();
122
124
  (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
125
+ disconnectConditionalSlotComponent(this);
123
126
  }
124
127
  render() {
125
128
  return (h(Host, { "aria-describedby": this.contentId, "aria-labelledby": this.titleId, "aria-modal": "true", role: "dialog" },
@@ -141,7 +144,7 @@ export class CalciteModal {
141
144
  h("div", { "data-focus-fence": true, onFocus: this.focusFirstElement, tabindex: "0" }))));
142
145
  }
143
146
  renderFooter() {
144
- return this.hasFooter ? (h("div", { class: CSS.footer },
147
+ return this.hasFooter ? (h("div", { class: CSS.footer, key: "footer" },
145
148
  h("span", { class: CSS.back },
146
149
  h("slot", { name: SLOTS.back })),
147
150
  h("span", { class: CSS.secondary },
@@ -150,7 +153,7 @@ export class CalciteModal {
150
153
  h("slot", { name: SLOTS.primary })))) : null;
151
154
  }
152
155
  renderCloseButton() {
153
- return !this.disableCloseButton ? (h("button", { "aria-label": this.intlClose, class: CSS.close, onClick: this.close, ref: (el) => (this.closeButtonEl = el), title: this.intlClose },
156
+ 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 },
154
157
  h("calcite-icon", { icon: ICONS.close, scale: this.scale === "s" ? "s" : this.scale === "m" ? "m" : this.scale === "l" ? "l" : null }))) : null;
155
158
  }
156
159
  renderStyle() {
@@ -6,6 +6,7 @@ import { Component, Element, Event, h, Method, Prop, Watch } from "@stencil/core
6
6
  import { CSS, SLOTS, TEXT } from "./resources";
7
7
  import { StatusIcons } from "../calcite-alert/interfaces";
8
8
  import { getSlotted, setRequestedIcon } from "../../utils/dom";
9
+ import { connectConditionalSlotComponent, disconnectConditionalSlotComponent } from "../../utils/conditionalSlot";
9
10
  /** Notices are intended to be used to present users with important-but-not-crucial contextual tips or copy. Because
10
11
  * notices are displayed inline, a common use case is displaying them on page-load to present users with short hints or contextual copy.
11
12
  * They are optionally dismissible - useful for keeping track of whether or not a user has dismissed the notice. You can also choose not
@@ -56,6 +57,12 @@ export class CalciteNotice {
56
57
  // Lifecycle
57
58
  //
58
59
  //--------------------------------------------------------------------------
60
+ connectedCallback() {
61
+ connectConditionalSlotComponent(this);
62
+ }
63
+ disconnectedCallback() {
64
+ disconnectConditionalSlotComponent(this);
65
+ }
59
66
  componentWillLoad() {
60
67
  this.requestedIcon = setRequestedIcon(StatusIcons, this.icon, this.color);
61
68
  }
@@ -7,6 +7,7 @@ import { CSS, HEADING_LEVEL, ICONS, SLOTS, TEXT } from "./resources";
7
7
  import { getElementDir, getSlotted } from "../../utils/dom";
8
8
  import { CalciteHeading } from "../functional/CalciteHeading";
9
9
  import { SLOTS as ACTION_MENU_SLOTS } from "../calcite-action-menu/resources";
10
+ import { connectConditionalSlotComponent, disconnectConditionalSlotComponent } from "../../utils/conditionalSlot";
10
11
  /**
11
12
  * @slot - A slot for adding custom content.
12
13
  * @slot header-actions-start - A slot for adding actions or content to the start side of the panel header.
@@ -82,6 +83,17 @@ export class CalcitePanel {
82
83
  }
83
84
  // --------------------------------------------------------------------------
84
85
  //
86
+ // Lifecycle
87
+ //
88
+ // --------------------------------------------------------------------------
89
+ connectedCallback() {
90
+ connectConditionalSlotComponent(this);
91
+ }
92
+ disconnectedCallback() {
93
+ disconnectConditionalSlotComponent(this);
94
+ }
95
+ // --------------------------------------------------------------------------
96
+ //
85
97
  // Methods
86
98
  //
87
99
  // --------------------------------------------------------------------------
@@ -123,7 +135,7 @@ export class CalcitePanel {
123
135
  * Allows user to override the entire header-content node.
124
136
  */
125
137
  renderHeaderSlottedContent() {
126
- return (h("div", { class: CSS.headerContent, key: "header-content" },
138
+ return (h("div", { class: CSS.headerContent, key: "slotted-header-content" },
127
139
  h("slot", { name: SLOTS.headerContent })));
128
140
  }
129
141
  renderHeaderStartActions() {
@@ -145,7 +157,7 @@ export class CalcitePanel {
145
157
  renderMenu() {
146
158
  const { el, intlOptions, menuOpen } = this;
147
159
  const hasMenuItems = getSlotted(el, SLOTS.headerMenuActions);
148
- return hasMenuItems ? (h("calcite-action-menu", { flipPlacements: ["top", "bottom"], label: intlOptions || TEXT.options, open: menuOpen, placement: "bottom-end" },
160
+ return hasMenuItems ? (h("calcite-action-menu", { flipPlacements: ["top", "bottom"], key: "menu", label: intlOptions || TEXT.options, open: menuOpen, placement: "bottom-end" },
149
161
  h("calcite-action", { icon: ICONS.menu, slot: ACTION_MENU_SLOTS.trigger, text: intlOptions || TEXT.options }),
150
162
  h("slot", { name: SLOTS.headerMenuActions }))) : null;
151
163
  }
@@ -170,20 +182,13 @@ export class CalcitePanel {
170
182
  actionsNodeEnd,
171
183
  headerMenuNode)) : null;
172
184
  }
173
- /**
174
- * Allows user to override the entire footer node.
175
- */
176
- renderFooterSlottedContent() {
185
+ renderFooterNode() {
177
186
  const { el } = this;
178
187
  const hasFooterSlottedContent = getSlotted(el, SLOTS.footer);
179
- return hasFooterSlottedContent ? (h("footer", { class: CSS.footer },
180
- h("slot", { name: SLOTS.footer }))) : null;
181
- }
182
- renderFooterActions() {
183
- const { el } = this;
184
188
  const hasFooterActions = getSlotted(el, SLOTS.footerActions);
185
- return hasFooterActions ? (h("footer", { class: CSS.footer },
186
- h("slot", { name: SLOTS.footerActions }))) : null;
189
+ return hasFooterSlottedContent || hasFooterActions ? (h("footer", { class: CSS.footer, key: "footer" },
190
+ hasFooterSlottedContent ? h("slot", { key: "footer-slot", name: SLOTS.footer }) : null,
191
+ hasFooterActions ? h("slot", { key: "footer-actions-slot", name: SLOTS.footerActions }) : null)) : null;
187
192
  }
188
193
  renderContent() {
189
194
  const { el } = this;
@@ -203,7 +208,7 @@ export class CalcitePanel {
203
208
  const panelNode = (h("article", { "aria-busy": loading.toString(), class: CSS.container, hidden: dismissible && dismissed, onKeyDown: panelKeyDownHandler, ref: this.setContainerRef, tabIndex: dismissible ? 0 : -1 },
204
209
  this.renderHeaderNode(),
205
210
  this.renderContent(),
206
- this.renderFooterSlottedContent() || this.renderFooterActions()));
211
+ this.renderFooterNode()));
207
212
  return (h(Fragment, null,
208
213
  loading || disabled ? h("calcite-scrim", { loading: loading }) : null,
209
214
  panelNode));
@@ -7,10 +7,22 @@ import { CSS, SLOTS } from "./resources";
7
7
  import { HEADING_LEVEL } from "./resources";
8
8
  import { getSlotted } from "../../utils/dom";
9
9
  import { CalciteHeading, constrainHeadingLevel } from "../functional/CalciteHeading";
10
+ import { connectConditionalSlotComponent, disconnectConditionalSlotComponent } from "../../utils/conditionalSlot";
10
11
  /**
11
12
  * @slot - A slot for adding `calcite-pick-list-item` elements.
12
13
  */
13
14
  export class CalcitePickListGroup {
15
+ // --------------------------------------------------------------------------
16
+ //
17
+ // Lifecycle
18
+ //
19
+ // --------------------------------------------------------------------------
20
+ connectedCallback() {
21
+ connectConditionalSlotComponent(this);
22
+ }
23
+ disconnectedCallback() {
24
+ disconnectConditionalSlotComponent(this);
25
+ }
14
26
  // --------------------------------------------------------------------------
15
27
  //
16
28
  // Render Methods
@@ -6,6 +6,7 @@ import { Component, Element, Event, Fragment, h, Method, Prop, Watch } from "@st
6
6
  import { CSS, ICONS, SLOTS, TEXT } from "./resources";
7
7
  import { ICON_TYPES } from "../calcite-pick-list/resources";
8
8
  import { getSlotted } from "../../utils/dom";
9
+ import { connectConditionalSlotComponent, disconnectConditionalSlotComponent } from "../../utils/conditionalSlot";
9
10
  /**
10
11
  * @slot actions-end - a slot for adding actions or content to the end side of the item.
11
12
  * @slot actions-start - a slot for adding actions or content to the start side of the item.
@@ -90,6 +91,17 @@ export class CalcitePickListItem {
90
91
  }
91
92
  // --------------------------------------------------------------------------
92
93
  //
94
+ // Lifecycle
95
+ //
96
+ // --------------------------------------------------------------------------
97
+ connectedCallback() {
98
+ connectConditionalSlotComponent(this);
99
+ }
100
+ disconnectedCallback() {
101
+ disconnectConditionalSlotComponent(this);
102
+ }
103
+ // --------------------------------------------------------------------------
104
+ //
93
105
  // Public Methods
94
106
  //
95
107
  // --------------------------------------------------------------------------
@@ -5,6 +5,7 @@
5
5
  import { Component, Element, Prop, h, Fragment } from "@stencil/core";
6
6
  import { CSS, SLOTS } from "./resources";
7
7
  import { getSlotted } from "../../utils/dom";
8
+ import { connectConditionalSlotComponent, disconnectConditionalSlotComponent } from "../../utils/conditionalSlot";
8
9
  /**
9
10
  * @slot - A slot for adding content to the shell. This content will appear between any leading and trailing panels added to the shell. (eg. a map)
10
11
  * @slot header - A slot for adding header content. This content will be positioned at the top of the shell.
@@ -27,12 +28,23 @@ export class CalciteShell {
27
28
  }
28
29
  // --------------------------------------------------------------------------
29
30
  //
31
+ // Lifecycle
32
+ //
33
+ // --------------------------------------------------------------------------
34
+ connectedCallback() {
35
+ connectConditionalSlotComponent(this);
36
+ }
37
+ disconnectedCallback() {
38
+ disconnectConditionalSlotComponent(this);
39
+ }
40
+ // --------------------------------------------------------------------------
41
+ //
30
42
  // Render Methods
31
43
  //
32
44
  // --------------------------------------------------------------------------
33
45
  renderHeader() {
34
46
  const hasHeader = !!getSlotted(this.el, SLOTS.header);
35
- return hasHeader ? h("slot", { name: SLOTS.header }) : null;
47
+ return hasHeader ? h("slot", { key: "header", name: SLOTS.header }) : null;
36
48
  }
37
49
  renderContent() {
38
50
  const content = !!this.contentBehind
@@ -53,7 +65,7 @@ export class CalciteShell {
53
65
  }
54
66
  renderFooter() {
55
67
  const hasFooter = !!getSlotted(this.el, SLOTS.footer);
56
- return hasFooter ? (h("div", { class: CSS.footer },
68
+ return hasFooter ? (h("div", { class: CSS.footer, key: "footer" },
57
69
  h("slot", { name: SLOTS.footer }))) : null;
58
70
  }
59
71
  renderMain() {
@@ -5,6 +5,7 @@
5
5
  import { Component, Element, Prop, h, Fragment } from "@stencil/core";
6
6
  import { CSS, SLOTS } from "./resources";
7
7
  import { getSlotted } from "../../utils/dom";
8
+ import { connectConditionalSlotComponent, disconnectConditionalSlotComponent } from "../../utils/conditionalSlot";
8
9
  /**
9
10
  * @slot - A slot for adding content to the shell panel.
10
11
  * @slot action-bar - A slot for adding a `calcite-action-bar` to the panel.
@@ -31,6 +32,17 @@ export class CalciteShellCenterRow {
31
32
  }
32
33
  // --------------------------------------------------------------------------
33
34
  //
35
+ // Lifecycle
36
+ //
37
+ // --------------------------------------------------------------------------
38
+ connectedCallback() {
39
+ connectConditionalSlotComponent(this);
40
+ }
41
+ disconnectedCallback() {
42
+ disconnectConditionalSlotComponent(this);
43
+ }
44
+ // --------------------------------------------------------------------------
45
+ //
34
46
  // Render Methods
35
47
  //
36
48
  // --------------------------------------------------------------------------
@@ -39,7 +51,7 @@ export class CalciteShellCenterRow {
39
51
  const contentNode = (h("div", { class: CSS.content },
40
52
  h("slot", null)));
41
53
  const actionBar = getSlotted(el, SLOTS.actionBar);
42
- const actionBarNode = actionBar ? (h("div", { class: CSS.actionBarContainer },
54
+ const actionBarNode = actionBar ? (h("div", { class: CSS.actionBarContainer, key: "action-bar" },
43
55
  h("slot", { name: SLOTS.actionBar }))) : null;
44
56
  const children = [actionBarNode, contentNode];
45
57
  if ((actionBar === null || actionBar === void 0 ? void 0 : actionBar.position) === "end") {
@@ -6,6 +6,7 @@ import { Component, Element, Event, Prop, Watch, h, State, forceUpdate } from "@
6
6
  import { CSS, SLOTS, TEXT } from "./resources";
7
7
  import { getSlotted, getElementDir } from "../../utils/dom";
8
8
  import { clamp } from "../../utils/math";
9
+ import { connectConditionalSlotComponent, disconnectConditionalSlotComponent } from "../../utils/conditionalSlot";
9
10
  /**
10
11
  * @slot - A slot for adding content to the shell panel.
11
12
  * @slot action-bar - A slot for adding a `calcite-action-bar` to the panel.
@@ -151,7 +152,11 @@ export class CalciteShellPanel {
151
152
  // Lifecycle
152
153
  //
153
154
  //--------------------------------------------------------------------------
155
+ connectedCallback() {
156
+ connectConditionalSlotComponent(this);
157
+ }
154
158
  disconnectedCallback() {
159
+ disconnectConditionalSlotComponent(this);
155
160
  this.disconnectSeparator();
156
161
  }
157
162
  componentDidLoad() {
@@ -165,18 +170,18 @@ export class CalciteShellPanel {
165
170
  renderHeader() {
166
171
  const { el } = this;
167
172
  const hasHeader = getSlotted(el, SLOTS.header);
168
- return hasHeader ? (h("div", { class: CSS.contentHeader },
173
+ return hasHeader ? (h("div", { class: CSS.contentHeader, key: "header" },
169
174
  h("slot", { name: SLOTS.header }))) : null;
170
175
  }
171
176
  render() {
172
177
  const { collapsed, detached, position, initialContentWidth, contentWidth, contentWidthMax, contentWidthMin, intlResize, resizable } = this;
173
178
  const allowResizing = !detached && resizable;
174
- const contentNode = (h("div", { class: { [CSS.content]: true, [CSS.contentDetached]: detached }, hidden: collapsed, ref: this.storeContentEl, style: allowResizing && contentWidth ? { width: `${contentWidth}px` } : null },
179
+ const contentNode = (h("div", { class: { [CSS.content]: true, [CSS.contentDetached]: detached }, hidden: collapsed, key: "content", ref: this.storeContentEl, style: allowResizing && contentWidth ? { width: `${contentWidth}px` } : null },
175
180
  this.renderHeader(),
176
181
  h("div", { class: CSS.contentBody },
177
182
  h("slot", null))));
178
- const separatorNode = allowResizing ? (h("div", { "aria-label": intlResize, "aria-orientation": "horizontal", "aria-valuemax": contentWidthMax, "aria-valuemin": contentWidthMin, "aria-valuenow": contentWidth !== null && contentWidth !== void 0 ? contentWidth : initialContentWidth, class: CSS.separator, onKeyDown: this.separatorKeyDown, ref: this.connectSeparator, role: "separator", tabIndex: 0, "touch-action": "none" })) : null;
179
- const actionBarNode = h("slot", { name: SLOTS.actionBar });
183
+ const separatorNode = allowResizing ? (h("div", { "aria-label": intlResize, "aria-orientation": "horizontal", "aria-valuemax": contentWidthMax, "aria-valuemin": contentWidthMin, "aria-valuenow": contentWidth !== null && contentWidth !== void 0 ? contentWidth : initialContentWidth, class: CSS.separator, key: "separator", onKeyDown: this.separatorKeyDown, ref: this.connectSeparator, role: "separator", tabIndex: 0, "touch-action": "none" })) : null;
184
+ const actionBarNode = h("slot", { key: "action-bar", name: SLOTS.actionBar });
180
185
  const mainNodes = [actionBarNode, contentNode, separatorNode];
181
186
  if (position === "end") {
182
187
  mainNodes.reverse();