@esri/calcite-components 1.0.0-next.305 → 1.0.0-next.309

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 (161) hide show
  1. package/dist/calcite/calcite.esm.js +1 -1
  2. package/dist/calcite/calcite.js +1 -1
  3. package/dist/calcite/p-2a714a22.entry.js +5 -0
  4. package/dist/calcite/p-362cb320.entry.js +5 -0
  5. package/dist/calcite/{p-e62a9b1d.system.entry.js → p-4778c5cf.system.entry.js} +1 -1
  6. package/dist/calcite/{p-9f240615.system.entry.js → p-59a285d8.system.entry.js} +1 -1
  7. package/dist/calcite/p-688f06b9.entry.js +5 -0
  8. package/dist/calcite/p-8c02f97a.entry.js +5 -0
  9. package/dist/calcite/p-8e252799.system.js +5 -0
  10. package/dist/calcite/{p-243d95ab.system.entry.js → p-a5e8f022.system.entry.js} +2 -2
  11. package/dist/calcite/{p-88b875d3.system.entry.js → p-b0e21c19.system.entry.js} +1 -1
  12. package/dist/calcite/p-c61ebee9.entry.js +5 -0
  13. package/dist/calcite/p-ca6025ab.system.entry.js +5 -0
  14. package/dist/calcite/p-dbe899c6.system.entry.js +5 -0
  15. package/dist/calcite/p-e616f9b5.entry.js +5 -0
  16. package/dist/cjs/calcite-alert.cjs.entry.js +22 -5
  17. package/dist/cjs/calcite-graph_2.cjs.entry.js +18 -10
  18. package/dist/cjs/calcite-input.cjs.entry.js +16 -14
  19. package/dist/cjs/calcite-radio_2.cjs.entry.js +3 -7
  20. package/dist/cjs/calcite-shell_3.cjs.entry.js +156 -5
  21. package/dist/cjs/calcite-tile-select_2.cjs.entry.js +2 -2
  22. package/dist/cjs/calcite.cjs.js +2 -2
  23. package/dist/cjs/loader.cjs.js +2 -2
  24. package/dist/collection/collection-manifest.json +1 -1
  25. package/dist/collection/components/calcite-alert/calcite-alert.js +23 -4
  26. package/dist/collection/components/calcite-input/calcite-input.js +16 -14
  27. package/dist/collection/components/calcite-radio-button/calcite-radio-button.js +3 -7
  28. package/dist/collection/components/calcite-shell-panel/calcite-shell-panel.css +43 -0
  29. package/dist/collection/components/calcite-shell-panel/calcite-shell-panel.js +194 -5
  30. package/dist/collection/components/calcite-shell-panel/resources.js +5 -1
  31. package/dist/collection/components/calcite-slider/calcite-slider.css +1 -0
  32. package/dist/collection/components/calcite-slider/calcite-slider.js +19 -9
  33. package/dist/collection/components/calcite-tile-select/calcite-tile-select.js +16 -4
  34. package/dist/components/calcite-accordion-item.js +4 -1
  35. package/dist/components/calcite-accordion.js +4 -1
  36. package/dist/components/calcite-action-bar.js +4 -1
  37. package/dist/components/calcite-action-group2.js +4 -1
  38. package/dist/components/calcite-action-menu2.js +4 -1
  39. package/dist/components/calcite-action-pad.js +4 -1
  40. package/dist/components/calcite-action2.js +4 -1
  41. package/dist/components/calcite-alert.js +26 -6
  42. package/dist/components/calcite-avatar.js +4 -1
  43. package/dist/components/calcite-block-section.js +4 -1
  44. package/dist/components/calcite-block.js +4 -1
  45. package/dist/components/calcite-button2.js +5 -2
  46. package/dist/components/calcite-card.js +4 -1
  47. package/dist/components/calcite-checkbox2.js +4 -1
  48. package/dist/components/calcite-chip2.js +4 -1
  49. package/dist/components/calcite-color-picker-hex-input2.js +4 -1
  50. package/dist/components/calcite-color-picker-swatch2.js +4 -1
  51. package/dist/components/calcite-color-picker.js +4 -1
  52. package/dist/components/calcite-combobox-item-group.js +4 -1
  53. package/dist/components/calcite-combobox-item.js +4 -1
  54. package/dist/components/calcite-combobox.js +4 -1
  55. package/dist/components/calcite-date-picker-day2.js +4 -1
  56. package/dist/components/calcite-date-picker-month-header2.js +4 -1
  57. package/dist/components/calcite-date-picker-month2.js +4 -1
  58. package/dist/components/calcite-date-picker2.js +4 -1
  59. package/dist/components/calcite-dropdown-group.js +4 -1
  60. package/dist/components/calcite-dropdown-item.js +4 -1
  61. package/dist/components/calcite-dropdown2.js +4 -1
  62. package/dist/components/calcite-fab.js +4 -1
  63. package/dist/components/calcite-filter2.js +4 -1
  64. package/dist/components/calcite-flow.js +4 -1
  65. package/dist/components/calcite-graph2.js +4 -1
  66. package/dist/components/calcite-handle2.js +4 -1
  67. package/dist/components/calcite-icon2.js +4 -1
  68. package/dist/components/calcite-inline-editable.js +4 -1
  69. package/dist/components/calcite-input-date-picker.js +4 -1
  70. package/dist/components/calcite-input-message.js +4 -1
  71. package/dist/components/calcite-input-time-picker.js +4 -1
  72. package/dist/components/calcite-input2.js +20 -15
  73. package/dist/components/calcite-label2.js +4 -1
  74. package/dist/components/calcite-link2.js +4 -1
  75. package/dist/components/calcite-list-item-group.js +4 -1
  76. package/dist/components/calcite-list-item.js +4 -1
  77. package/dist/components/calcite-list.js +4 -1
  78. package/dist/components/calcite-loader2.js +4 -1
  79. package/dist/components/calcite-modal.js +4 -1
  80. package/dist/components/calcite-notice.js +4 -1
  81. package/dist/components/calcite-option-group.js +4 -1
  82. package/dist/components/calcite-option.js +4 -1
  83. package/dist/components/calcite-pagination.js +4 -1
  84. package/dist/components/calcite-panel.js +4 -1
  85. package/dist/components/calcite-pick-list-group.js +4 -1
  86. package/dist/components/calcite-pick-list-item2.js +4 -1
  87. package/dist/components/calcite-pick-list.js +4 -1
  88. package/dist/components/calcite-popover-manager.js +4 -1
  89. package/dist/components/calcite-popover2.js +4 -1
  90. package/dist/components/calcite-progress2.js +4 -1
  91. package/dist/components/calcite-radio-button-group.js +4 -1
  92. package/dist/components/calcite-radio-button.js +7 -8
  93. package/dist/components/calcite-radio-group-item.js +4 -1
  94. package/dist/components/calcite-radio-group.js +4 -1
  95. package/dist/components/calcite-radio2.js +4 -1
  96. package/dist/components/calcite-rating.js +4 -1
  97. package/dist/components/calcite-scrim2.js +4 -1
  98. package/dist/components/calcite-select.js +4 -1
  99. package/dist/components/calcite-shell-center-row.js +4 -1
  100. package/dist/components/calcite-shell-panel.js +164 -7
  101. package/dist/components/calcite-shell.js +4 -1
  102. package/dist/components/calcite-slider.js +22 -11
  103. package/dist/components/calcite-sortable-list.js +4 -1
  104. package/dist/components/calcite-split-button.js +4 -1
  105. package/dist/components/calcite-stepper-item.js +4 -1
  106. package/dist/components/calcite-stepper.js +4 -1
  107. package/dist/components/calcite-switch2.js +4 -1
  108. package/dist/components/calcite-tab-nav2.js +4 -1
  109. package/dist/components/calcite-tab-title2.js +4 -1
  110. package/dist/components/calcite-tab2.js +4 -1
  111. package/dist/components/calcite-tabs2.js +4 -1
  112. package/dist/components/calcite-tile-select-group.js +4 -1
  113. package/dist/components/calcite-tile-select.js +7 -4
  114. package/dist/components/calcite-tile2.js +4 -1
  115. package/dist/components/calcite-time-picker2.js +4 -1
  116. package/dist/components/calcite-tip-group.js +4 -1
  117. package/dist/components/calcite-tip-manager.js +4 -1
  118. package/dist/components/calcite-tip.js +4 -1
  119. package/dist/components/calcite-tooltip-manager2.js +4 -1
  120. package/dist/components/calcite-tooltip.js +4 -1
  121. package/dist/components/calcite-tree-item.js +4 -1
  122. package/dist/components/calcite-tree.js +4 -1
  123. package/dist/components/calcite-value-list-item.js +4 -1
  124. package/dist/components/calcite-value-list.js +4 -1
  125. package/dist/custom-elements/index.js +403 -230
  126. package/dist/esm/calcite-alert.entry.js +22 -5
  127. package/dist/esm/calcite-graph_2.entry.js +18 -10
  128. package/dist/esm/calcite-input.entry.js +16 -14
  129. package/dist/esm/calcite-radio_2.entry.js +3 -7
  130. package/dist/esm/calcite-shell_3.entry.js +157 -6
  131. package/dist/esm/calcite-tile-select_2.entry.js +2 -2
  132. package/dist/esm/calcite.js +2 -2
  133. package/dist/esm/loader.js +2 -2
  134. package/dist/esm-es5/calcite-alert.entry.js +2 -2
  135. package/dist/esm-es5/calcite-graph_2.entry.js +1 -1
  136. package/dist/esm-es5/calcite-input.entry.js +1 -1
  137. package/dist/esm-es5/calcite-radio_2.entry.js +1 -1
  138. package/dist/esm-es5/calcite-shell_3.entry.js +1 -1
  139. package/dist/esm-es5/calcite-tile-select_2.entry.js +1 -1
  140. package/dist/esm-es5/calcite.js +1 -1
  141. package/dist/esm-es5/loader.js +1 -1
  142. package/dist/extras/docs-json.json +51 -2
  143. package/dist/types/components/calcite-alert/calcite-alert.d.ts +3 -0
  144. package/dist/types/components/calcite-input/calcite-input.d.ts +1 -1
  145. package/dist/types/components/calcite-shell-panel/calcite-shell-panel.d.ts +31 -0
  146. package/dist/types/components/calcite-shell-panel/resources.d.ts +4 -0
  147. package/dist/types/components/calcite-slider/calcite-slider.d.ts +3 -1
  148. package/dist/types/components/calcite-tile-select/calcite-tile-select.d.ts +2 -2
  149. package/dist/types/components.d.ts +18 -0
  150. package/hydrate/index.js +316 -140
  151. package/package.json +10 -10
  152. package/readme.md +2 -2
  153. package/dist/calcite/p-3eb1dc0f.entry.js +0 -5
  154. package/dist/calcite/p-42696c81.system.entry.js +0 -5
  155. package/dist/calcite/p-56e28cef.entry.js +0 -5
  156. package/dist/calcite/p-5c0c29bc.entry.js +0 -5
  157. package/dist/calcite/p-5f817b79.entry.js +0 -5
  158. package/dist/calcite/p-6f1cca21.system.js +0 -5
  159. package/dist/calcite/p-737fb960.entry.js +0 -5
  160. package/dist/calcite/p-82139130.entry.js +0 -5
  161. package/dist/calcite/p-b1a96c72.system.entry.js +0 -5
@@ -2,9 +2,10 @@
2
2
  * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
4
4
  */
5
- import { Component, Element, Event, Prop, Watch, h } from "@stencil/core";
6
- import { CSS, SLOTS } from "./resources";
5
+ import { Component, Element, Event, Prop, Watch, h, State, forceUpdate } from "@stencil/core";
6
+ import { CSS, SLOTS, TEXT } from "./resources";
7
7
  import { getSlotted } from "../../utils/dom";
8
+ import { clamp } from "../../utils/math";
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.
@@ -32,10 +33,121 @@ export class CalciteShellPanel {
32
33
  * This sets width of the content area.
33
34
  */
34
35
  this.widthScale = "m";
36
+ /**
37
+ * Accessible label for resize separator.
38
+ * @default "Resize"
39
+ */
40
+ this.intlResize = TEXT.resize;
41
+ /**
42
+ * This property makes the content area resizable if the calcite-shell-panel is not 'detached'.
43
+ */
44
+ this.resizable = false;
45
+ this.contentWidth = null;
46
+ this.initialContentWidth = null;
47
+ this.initialClientX = null;
48
+ this.contentWidthMax = null;
49
+ this.contentWidthMin = null;
50
+ this.step = 1;
51
+ this.stepMultiplier = 10;
52
+ this.storeContentEl = (contentEl) => {
53
+ this.contentEl = contentEl;
54
+ };
55
+ this.getKeyAdjustedWidth = (event) => {
56
+ const { key } = event;
57
+ const { step, stepMultiplier, contentWidthMin, contentWidthMax, initialContentWidth, position } = this;
58
+ const multipliedStep = step * stepMultiplier;
59
+ const MOVEMENT_KEYS = [
60
+ "ArrowUp",
61
+ "ArrowDown",
62
+ "ArrowLeft",
63
+ "ArrowRight",
64
+ "Home",
65
+ "End",
66
+ "PageUp",
67
+ "PageDown"
68
+ ];
69
+ if (MOVEMENT_KEYS.indexOf(key) > -1) {
70
+ event.preventDefault();
71
+ }
72
+ const increaseKeys = key === "ArrowUp" || (position === "end" ? key === "ArrowLeft" : key === "ArrowRight");
73
+ if (increaseKeys) {
74
+ const stepValue = event.shiftKey ? multipliedStep : step;
75
+ return initialContentWidth + stepValue;
76
+ }
77
+ const decreaseKeys = key === "ArrowDown" || (position === "end" ? key === "ArrowRight" : key === "ArrowLeft");
78
+ if (decreaseKeys) {
79
+ const stepValue = event.shiftKey ? multipliedStep : step;
80
+ return initialContentWidth - stepValue;
81
+ }
82
+ if (typeof contentWidthMin === "number" && key === "Home") {
83
+ return contentWidthMin;
84
+ }
85
+ if (typeof contentWidthMax === "number" && key === "End") {
86
+ return contentWidthMax;
87
+ }
88
+ if (key === "PageDown") {
89
+ return initialContentWidth - multipliedStep;
90
+ }
91
+ if (key === "PageUp") {
92
+ return initialContentWidth + multipliedStep;
93
+ }
94
+ return null;
95
+ };
96
+ this.separatorKeyDown = (event) => {
97
+ this.setInitialContentWidth();
98
+ const width = this.getKeyAdjustedWidth(event);
99
+ if (typeof width === "number") {
100
+ this.setContentWidth(width);
101
+ }
102
+ };
103
+ this.separatorPointerMove = (event) => {
104
+ event.preventDefault();
105
+ const { initialContentWidth, position, initialClientX } = this;
106
+ const offset = event.clientX - initialClientX;
107
+ this.setContentWidth(position === "end" ? initialContentWidth - offset : initialContentWidth + offset);
108
+ };
109
+ this.separatorPointerUp = (event) => {
110
+ event.preventDefault();
111
+ document.removeEventListener("pointerup", this.separatorPointerUp);
112
+ document.removeEventListener("pointermove", this.separatorPointerMove);
113
+ };
114
+ this.setInitialContentWidth = () => {
115
+ var _a;
116
+ this.initialContentWidth = (_a = this.contentEl) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().width;
117
+ };
118
+ this.separatorPointerDown = (event) => {
119
+ event.preventDefault();
120
+ const { separatorEl } = this;
121
+ separatorEl && document.activeElement !== separatorEl && separatorEl.focus();
122
+ this.setInitialContentWidth();
123
+ this.initialClientX = event.clientX;
124
+ document.addEventListener("pointerup", this.separatorPointerUp);
125
+ document.addEventListener("pointermove", this.separatorPointerMove);
126
+ };
127
+ this.connectSeparator = (separatorEl) => {
128
+ this.disconnectSeparator();
129
+ this.separatorEl = separatorEl;
130
+ separatorEl.addEventListener("pointerdown", this.separatorPointerDown);
131
+ };
132
+ this.disconnectSeparator = () => {
133
+ var _a;
134
+ (_a = this.separatorEl) === null || _a === void 0 ? void 0 : _a.removeEventListener("pointerdown", this.separatorPointerDown);
135
+ };
35
136
  }
36
137
  watchHandler() {
37
138
  this.calciteShellPanelToggle.emit();
38
139
  }
140
+ //--------------------------------------------------------------------------
141
+ //
142
+ // Lifecycle
143
+ //
144
+ //--------------------------------------------------------------------------
145
+ disconnectedCallback() {
146
+ this.disconnectSeparator();
147
+ }
148
+ componentDidLoad() {
149
+ this.updateAriaValues();
150
+ }
39
151
  // --------------------------------------------------------------------------
40
152
  //
41
153
  // Render Methods
@@ -48,18 +160,53 @@ export class CalciteShellPanel {
48
160
  h("slot", { name: SLOTS.header }))) : null;
49
161
  }
50
162
  render() {
51
- const { collapsed, detached, position } = this;
52
- const contentNode = (h("div", { class: { [CSS.content]: true, [CSS.contentDetached]: detached }, hidden: collapsed },
163
+ const { collapsed, detached, position, initialContentWidth, contentWidth, contentWidthMax, contentWidthMin, intlResize, resizable } = this;
164
+ const allowResizing = !detached && resizable;
165
+ const contentNode = (h("div", { class: { [CSS.content]: true, [CSS.contentDetached]: detached }, hidden: collapsed, ref: this.storeContentEl, style: allowResizing && contentWidth ? { width: `${contentWidth}px` } : null },
53
166
  this.renderHeader(),
54
167
  h("div", { class: CSS.contentBody },
55
168
  h("slot", null))));
169
+ 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;
56
170
  const actionBarNode = h("slot", { name: SLOTS.actionBar });
57
- const mainNodes = [actionBarNode, contentNode];
171
+ const mainNodes = [actionBarNode, contentNode, separatorNode];
58
172
  if (position === "end") {
59
173
  mainNodes.reverse();
60
174
  }
61
175
  return h("div", { class: { [CSS.container]: true } }, mainNodes);
62
176
  }
177
+ // --------------------------------------------------------------------------
178
+ //
179
+ // private Methods
180
+ //
181
+ // --------------------------------------------------------------------------
182
+ setContentWidth(width) {
183
+ const { contentWidthMax, contentWidthMin } = this;
184
+ const roundedWidth = Math.round(width);
185
+ this.contentWidth =
186
+ typeof contentWidthMax === "number" && typeof contentWidthMin === "number"
187
+ ? clamp(roundedWidth, contentWidthMin, contentWidthMax)
188
+ : roundedWidth;
189
+ }
190
+ updateAriaValues() {
191
+ const { contentEl } = this;
192
+ const computedStyle = contentEl && getComputedStyle(contentEl);
193
+ if (!computedStyle) {
194
+ return;
195
+ }
196
+ const max = parseInt(computedStyle.getPropertyValue("max-width"), 10);
197
+ const min = parseInt(computedStyle.getPropertyValue("min-width"), 10);
198
+ const valueNow = parseInt(computedStyle.getPropertyValue("width"), 10);
199
+ if (typeof valueNow === "number" && !isNaN(valueNow)) {
200
+ this.initialContentWidth = valueNow;
201
+ }
202
+ if (typeof max === "number" && !isNaN(max)) {
203
+ this.contentWidthMax = max;
204
+ }
205
+ if (typeof min === "number" && !isNaN(min)) {
206
+ this.contentWidthMin = min;
207
+ }
208
+ forceUpdate(this);
209
+ }
63
210
  static get is() { return "calcite-shell-panel"; }
64
211
  static get encapsulation() { return "shadow"; }
65
212
  static get originalStyleUrls() { return {
@@ -172,8 +319,50 @@ export class CalciteShellPanel {
172
319
  },
173
320
  "attribute": "position",
174
321
  "reflect": true
322
+ },
323
+ "intlResize": {
324
+ "type": "string",
325
+ "mutable": false,
326
+ "complexType": {
327
+ "original": "string",
328
+ "resolved": "string",
329
+ "references": {}
330
+ },
331
+ "required": false,
332
+ "optional": false,
333
+ "docs": {
334
+ "tags": [{
335
+ "name": "default",
336
+ "text": "\"Resize\""
337
+ }],
338
+ "text": "Accessible label for resize separator."
339
+ },
340
+ "attribute": "intl-resize",
341
+ "reflect": false,
342
+ "defaultValue": "TEXT.resize"
343
+ },
344
+ "resizable": {
345
+ "type": "boolean",
346
+ "mutable": false,
347
+ "complexType": {
348
+ "original": "boolean",
349
+ "resolved": "boolean",
350
+ "references": {}
351
+ },
352
+ "required": false,
353
+ "optional": false,
354
+ "docs": {
355
+ "tags": [],
356
+ "text": "This property makes the content area resizable if the calcite-shell-panel is not 'detached'."
357
+ },
358
+ "attribute": "resizable",
359
+ "reflect": true,
360
+ "defaultValue": "false"
175
361
  }
176
362
  }; }
363
+ static get states() { return {
364
+ "contentWidth": {}
365
+ }; }
177
366
  static get events() { return [{
178
367
  "method": "calciteShellPanelToggle",
179
368
  "name": "calciteShellPanelToggle",
@@ -7,9 +7,13 @@ export const CSS = {
7
7
  content: "content",
8
8
  contentHeader: "content__header",
9
9
  contentBody: "content__body",
10
- contentDetached: "content--detached"
10
+ contentDetached: "content--detached",
11
+ separator: "separator"
11
12
  };
12
13
  export const SLOTS = {
13
14
  actionBar: "action-bar",
14
15
  header: "header"
15
16
  };
17
+ export const TEXT = {
18
+ resize: "Resize"
19
+ };
@@ -359,6 +359,7 @@
359
359
  margin-left: -2px;
360
360
  border: 1px solid var(--calcite-ui-foreground-1);
361
361
  background-color: var(--calcite-ui-border-1);
362
+ pointer-events: none;
362
363
  }
363
364
 
364
365
  .tick--active {
@@ -79,11 +79,11 @@ export class CalciteSlider {
79
79
  }
80
80
  }
81
81
  };
82
- this.dragEnd = () => {
82
+ this.dragEnd = (event) => {
83
83
  document.removeEventListener("pointermove", this.dragUpdate);
84
84
  document.removeEventListener("pointerup", this.dragEnd);
85
85
  document.removeEventListener("pointercancel", this.dragEnd);
86
- this.focusActiveHandle();
86
+ this.focusActiveHandle(event.clientX);
87
87
  if (this.lastDragPropValue != this[this.dragProp]) {
88
88
  this.emitChange();
89
89
  }
@@ -410,8 +410,8 @@ export class CalciteSlider {
410
410
  event.preventDefault();
411
411
  this.setValue(activeProp, this.clamp(adjustment, activeProp));
412
412
  }
413
- clickHandler() {
414
- this.focusActiveHandle();
413
+ clickHandler(event) {
414
+ this.focusActiveHandle(event.clientX);
415
415
  }
416
416
  pointerDownHandler(event) {
417
417
  const x = event.clientX || event.pageX;
@@ -482,16 +482,18 @@ export class CalciteSlider {
482
482
  document.addEventListener("pointerup", this.dragEnd);
483
483
  document.addEventListener("pointercancel", this.dragEnd);
484
484
  }
485
- focusActiveHandle() {
485
+ focusActiveHandle(valueX) {
486
486
  switch (this.dragProp) {
487
- default:
488
- case "maxValue":
489
- this.maxHandle.focus();
490
- break;
491
487
  case "minValue":
492
488
  this.minHandle.focus();
493
489
  break;
490
+ case "maxValue":
491
+ this.maxHandle.focus();
492
+ break;
494
493
  case "minMaxValue":
494
+ this.getClosestHandle(valueX).focus();
495
+ break;
496
+ default:
495
497
  break;
496
498
  }
497
499
  }
@@ -562,6 +564,14 @@ export class CalciteSlider {
562
564
  }
563
565
  return num;
564
566
  }
567
+ getClosestHandle(valueX) {
568
+ return this.getDistanceX(this.maxHandle, valueX) > this.getDistanceX(this.minHandle, valueX)
569
+ ? this.minHandle
570
+ : this.maxHandle;
571
+ }
572
+ getDistanceX(el, valueX) {
573
+ return Math.abs(el.getBoundingClientRect().left - valueX);
574
+ }
565
575
  getFontSizeForElement(element) {
566
576
  return Number(window.getComputedStyle(element).getPropertyValue("font-size").match(/\d+/)[0]);
567
577
  }
@@ -67,7 +67,7 @@ export class CalciteTileSelect {
67
67
  event.stopPropagation();
68
68
  this.calciteTileSelectChange.emit();
69
69
  }
70
- checkboxFocusHandler(event) {
70
+ checkboxFocusBlurHandler(event) {
71
71
  const checkbox = event.target;
72
72
  if (checkbox === this.input) {
73
73
  this.focused = event.detail;
@@ -89,7 +89,7 @@ export class CalciteTileSelect {
89
89
  }
90
90
  event.stopPropagation();
91
91
  }
92
- radioButtonFocusHandler(event) {
92
+ radioButtonFocusBlurHandler(event) {
93
93
  const radioButton = event.target;
94
94
  if (radioButton === this.input) {
95
95
  this.focused = radioButton.focused;
@@ -451,7 +451,13 @@ export class CalciteTileSelect {
451
451
  "passive": false
452
452
  }, {
453
453
  "name": "calciteInternalCheckboxFocus",
454
- "method": "checkboxFocusHandler",
454
+ "method": "checkboxFocusBlurHandler",
455
+ "target": undefined,
456
+ "capture": false,
457
+ "passive": false
458
+ }, {
459
+ "name": "calciteInternalCheckboxBlur",
460
+ "method": "checkboxFocusBlurHandler",
455
461
  "target": undefined,
456
462
  "capture": false,
457
463
  "passive": false
@@ -469,7 +475,13 @@ export class CalciteTileSelect {
469
475
  "passive": false
470
476
  }, {
471
477
  "name": "calciteInternalRadioButtonFocus",
472
- "method": "radioButtonFocusHandler",
478
+ "method": "radioButtonFocusBlurHandler",
479
+ "target": undefined,
480
+ "capture": false,
481
+ "passive": false
482
+ }, {
483
+ "name": "calciteInternalRadioButtonBlur",
484
+ "method": "radioButtonFocusBlurHandler",
473
485
  "target": undefined,
474
486
  "capture": false,
475
487
  "passive": false
@@ -2,7 +2,7 @@
2
2
  * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
4
4
  */
5
- import { createEvent, h, Host, proxyCustomElement } from '@stencil/core/internal/client';
5
+ import { HTMLElement, createEvent, h, Host, proxyCustomElement } from '@stencil/core/internal/client';
6
6
  import { g as getElementProp, a as getElementDir, C as CSS_UTILITY } from './dom.js';
7
7
  import { g as getKey } from './key.js';
8
8
  import { d as defineCustomElement$2 } from './calcite-icon2.js';
@@ -134,6 +134,9 @@ CalciteAccordionItem$1 = /*@__PURE__*/ proxyCustomElement(CalciteAccordionItem$1
134
134
  "icon": [513]
135
135
  }, [[0, "keydown", "keyDownHandler"], [16, "calciteAccordionChange", "updateActiveItemOnChange"]]]);
136
136
  function defineCustomElement$1() {
137
+ if (typeof customElements === "undefined") {
138
+ return;
139
+ }
137
140
  const components = ["calcite-accordion-item", "calcite-icon"];
138
141
  components.forEach(tagName => { switch (tagName) {
139
142
  case "calcite-accordion-item":
@@ -2,7 +2,7 @@
2
2
  * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
4
4
  */
5
- import { createEvent, h, proxyCustomElement } from '@stencil/core/internal/client';
5
+ import { HTMLElement, createEvent, h, proxyCustomElement } from '@stencil/core/internal/client';
6
6
  import { g as getKey } from './key.js';
7
7
 
8
8
  const calciteAccordionCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:300ms}.calcite-animate{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{-webkit-animation-name:in;animation-name:in}.calcite-animate__in-down{-webkit-animation-name:in-down;animation-name:in-down}.calcite-animate__in-up{-webkit-animation-name:in-up;animation-name:in-up}.calcite-animate__in-scale{-webkit-animation-name:in-scale;animation-name:in-scale}:root{--calcite-popper-transition:150ms ease-in-out}:host([hidden]){display:none}:host([scale=s]){--calcite-accordion-item-spacing-unit:0.25rem;--calcite-accordion-icon-margin:0.5rem;--calcite-accordion-item-padding:var(--calcite-accordion-item-spacing-unit) 0.5rem;font-size:var(--calcite-font-size--2);line-height:1rem}:host([scale=m]){--calcite-accordion-item-spacing-unit:0.5rem;--calcite-accordion-icon-margin:0.75rem;--calcite-accordion-item-padding:var(--calcite-accordion-item-spacing-unit) 0.75rem;font-size:var(--calcite-font-size--1);line-height:1rem}:host([scale=l]){--calcite-accordion-item-spacing-unit:0.75rem;--calcite-accordion-icon-margin:1rem;--calcite-accordion-item-padding:var(--calcite-accordion-item-spacing-unit) 1rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}:host{display:block;position:relative;max-width:100%;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-2);border-bottom-width:0;line-height:1.5rem;--calcite-accordion-item-border:var(--calcite-ui-border-2);--calcite-accordion-item-background:var(--calcite-ui-foreground-1)}:host([appearance=minimal]){--calcite-accordion-item-padding:var(--calcite-accordion-item-spacing-unit) 0;border-color:transparent}:host([appearance=transparent]){border-color:transparent;--calcite-accordion-item-border:transparent;--calcite-accordion-item-background:transparent}";
@@ -150,6 +150,9 @@ CalciteAccordion$1 = /*@__PURE__*/ proxyCustomElement(CalciteAccordion$1, [1, "c
150
150
  "selectionMode": [513, "selection-mode"]
151
151
  }, [[0, "calciteAccordionItemKeyEvent", "calciteAccordionItemKeyEvent"], [0, "calciteAccordionItemRegister", "registerCalciteAccordionItem"], [0, "calciteAccordionItemSelect", "updateActiveItemOnChange"]]]);
152
152
  function defineCustomElement$1() {
153
+ if (typeof customElements === "undefined") {
154
+ return;
155
+ }
153
156
  const components = ["calcite-accordion"];
154
157
  components.forEach(tagName => { switch (tagName) {
155
158
  case "calcite-accordion":
@@ -2,7 +2,7 @@
2
2
  * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
4
4
  */
5
- import { createEvent, h, Host, proxyCustomElement } from '@stencil/core/internal/client';
5
+ import { HTMLElement, createEvent, h, Host, proxyCustomElement } from '@stencil/core/internal/client';
6
6
  import { t as toggleChildActionText, C as CalciteExpandToggle, o as overflowActionsDebounceInMs, q as queryActions, a as overflowActions, g as getOverflowCount } from './CalciteExpandToggle.js';
7
7
  import { f as focusElement, b as getSlotted } from './dom.js';
8
8
  import { c as createObserver } from './observers.js';
@@ -214,6 +214,9 @@ CalciteActionBar$1 = /*@__PURE__*/ proxyCustomElement(CalciteActionBar$1, [1, "c
214
214
  "setFocus": [64]
215
215
  }]);
216
216
  function defineCustomElement$1() {
217
+ if (typeof customElements === "undefined") {
218
+ return;
219
+ }
217
220
  const components = ["calcite-action-bar", "calcite-action", "calcite-action-group", "calcite-action-menu", "calcite-icon", "calcite-loader", "calcite-popover", "calcite-tooltip-manager"];
218
221
  components.forEach(tagName => { switch (tagName) {
219
222
  case "calcite-action-bar":
@@ -2,7 +2,7 @@
2
2
  * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
4
4
  */
5
- import { h, Fragment, proxyCustomElement } from '@stencil/core/internal/client';
5
+ import { HTMLElement, h, Fragment, proxyCustomElement } from '@stencil/core/internal/client';
6
6
  import { b as getSlotted } from './dom.js';
7
7
  import { S as SLOTS$1, d as defineCustomElement$5 } from './calcite-action-menu2.js';
8
8
  import { d as defineCustomElement$6 } from './calcite-action2.js';
@@ -91,6 +91,9 @@ CalciteActionGroup = /*@__PURE__*/ proxyCustomElement(CalciteActionGroup, [1, "c
91
91
  "scale": [513]
92
92
  }]);
93
93
  function defineCustomElement() {
94
+ if (typeof customElements === "undefined") {
95
+ return;
96
+ }
94
97
  const components = ["calcite-action-group", "calcite-action", "calcite-action-menu", "calcite-icon", "calcite-loader", "calcite-popover", "calcite-tooltip-manager"];
95
98
  components.forEach(tagName => { switch (tagName) {
96
99
  case "calcite-action-group":
@@ -2,7 +2,7 @@
2
2
  * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
4
4
  */
5
- import { createEvent, h, Fragment, proxyCustomElement } from '@stencil/core/internal/client';
5
+ import { HTMLElement, createEvent, h, Fragment, proxyCustomElement } from '@stencil/core/internal/client';
6
6
  import { b as getSlotted, f as focusElement } from './dom.js';
7
7
  import { g as getRoundRobinIndex } from './array.js';
8
8
  import { g as guid } from './guid.js';
@@ -315,6 +315,9 @@ CalciteActionMenu = /*@__PURE__*/ proxyCustomElement(CalciteActionMenu, [1, "cal
315
315
  "setFocus": [64]
316
316
  }, [[8, "click", "closeCalciteActionMenuOnClick"]]]);
317
317
  function defineCustomElement() {
318
+ if (typeof customElements === "undefined") {
319
+ return;
320
+ }
318
321
  const components = ["calcite-action-menu", "calcite-action", "calcite-icon", "calcite-loader", "calcite-popover", "calcite-tooltip-manager"];
319
322
  components.forEach(tagName => { switch (tagName) {
320
323
  case "calcite-action-menu":
@@ -2,7 +2,7 @@
2
2
  * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
4
4
  */
5
- import { createEvent, h, Host, proxyCustomElement } from '@stencil/core/internal/client';
5
+ import { HTMLElement, createEvent, h, Host, proxyCustomElement } from '@stencil/core/internal/client';
6
6
  import { t as toggleChildActionText, C as CalciteExpandToggle } from './CalciteExpandToggle.js';
7
7
  import { f as focusElement, b as getSlotted, a as getElementDir, C as CSS_UTILITY } from './dom.js';
8
8
  import { d as defineCustomElement$8 } from './calcite-action2.js';
@@ -146,6 +146,9 @@ CalciteActionPad$1 = /*@__PURE__*/ proxyCustomElement(CalciteActionPad$1, [1, "c
146
146
  "setFocus": [64]
147
147
  }]);
148
148
  function defineCustomElement$1() {
149
+ if (typeof customElements === "undefined") {
150
+ return;
151
+ }
149
152
  const components = ["calcite-action-pad", "calcite-action", "calcite-action-group", "calcite-action-menu", "calcite-icon", "calcite-loader", "calcite-popover", "calcite-tooltip-manager"];
150
153
  components.forEach(tagName => { switch (tagName) {
151
154
  case "calcite-action-pad":
@@ -2,7 +2,7 @@
2
2
  * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
4
4
  */
5
- import { createEvent, forceUpdate, h, Host, proxyCustomElement } from '@stencil/core/internal/client';
5
+ import { HTMLElement, createEvent, forceUpdate, h, Host, proxyCustomElement } from '@stencil/core/internal/client';
6
6
  import { c as createObserver } from './observers.js';
7
7
  import { d as defineCustomElement$2 } from './calcite-icon2.js';
8
8
  import { d as defineCustomElement$1 } from './calcite-loader2.js';
@@ -159,6 +159,9 @@ CalciteAction = /*@__PURE__*/ proxyCustomElement(CalciteAction, [1, "calcite-act
159
159
  "setFocus": [64]
160
160
  }]);
161
161
  function defineCustomElement() {
162
+ if (typeof customElements === "undefined") {
163
+ return;
164
+ }
162
165
  const components = ["calcite-action", "calcite-icon", "calcite-loader"];
163
166
  components.forEach(tagName => { switch (tagName) {
164
167
  case "calcite-action":
@@ -2,7 +2,7 @@
2
2
  * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
4
4
  */
5
- import { createEvent, h, Host, proxyCustomElement } from '@stencil/core/internal/client';
5
+ import { HTMLElement, createEvent, h, Host, proxyCustomElement } from '@stencil/core/internal/client';
6
6
  import { s as setRequestedIcon, a as getElementDir, C as CSS_UTILITY } from './dom.js';
7
7
  import { S as StatusIcons } from './interfaces.js';
8
8
  import { d as defineCustomElement$3 } from './calcite-chip2.js';
@@ -63,8 +63,13 @@ let CalciteAlert$1 = class extends HTMLElement {
63
63
  this.queueLength = 0;
64
64
  /** is the alert queued */
65
65
  this.queued = false;
66
+ this.autoDismissTimeout = null;
67
+ this.trackTimer = new Date();
66
68
  /** close and emit the closed alert and the queue */
67
69
  this.closeAlert = () => {
70
+ if (this.autoDismissTimeout) {
71
+ this.autoDismissTimeout = null;
72
+ }
68
73
  this.queued = false;
69
74
  this.active = false;
70
75
  this.queue = this.queue.filter((e) => e !== this.el);
@@ -88,6 +93,12 @@ let CalciteAlert$1 = class extends HTMLElement {
88
93
  updateRequestedIcon() {
89
94
  this.requestedIcon = setRequestedIcon(StatusIcons, this.icon, this.color);
90
95
  }
96
+ updateDuration(newDuration, prevDuration) {
97
+ if (this.autoDismiss && prevDuration !== newDuration && this.autoDismissTimeout) {
98
+ window.clearTimeout(this.autoDismissTimeout);
99
+ this.autoDismissTimeout = window.setTimeout(() => this.closeAlert(), DURATIONS[this.autoDismissDuration] - (new Date().valueOf() - this.trackTimer.valueOf()));
100
+ }
101
+ }
91
102
  //--------------------------------------------------------------------------
92
103
  //
93
104
  // Lifecycle
@@ -104,20 +115,25 @@ let CalciteAlert$1 = class extends HTMLElement {
104
115
  componentDidLoad() {
105
116
  this.alertLinkEl = this.el.querySelectorAll("calcite-link")[0];
106
117
  }
118
+ disconnectedCallback() {
119
+ if (this.autoDismissTimeout) {
120
+ window.clearTimeout(this.autoDismissTimeout);
121
+ }
122
+ }
107
123
  render() {
108
124
  const dir = getElementDir(this.el);
109
125
  const closeButton = (h("button", { "aria-label": this.intlClose, class: "alert-close", onClick: this.closeAlert, ref: (el) => (this.closeButton = el), type: "button" }, h("calcite-icon", { icon: "x", scale: this.scale === "l" ? "m" : "s" })));
110
126
  const queueText = `+${this.queueLength > 2 ? this.queueLength - 1 : 1}`;
111
127
  const queueCount = (h("div", { class: `${this.queueLength > 1 ? "active " : ""}alert-queue-count` }, h("calcite-chip", { scale: this.scale, value: queueText }, queueText)));
112
128
  const { active, autoDismiss, label, queued, requestedIcon } = this;
113
- const progress = h("div", { class: "alert-dismiss-progress" });
129
+ const progressBar = h("div", { class: "alert-dismiss-progress" });
114
130
  const role = autoDismiss ? "alert" : "alertdialog";
115
131
  const hidden = !active;
116
132
  return (h(Host, { "aria-hidden": hidden.toString(), "aria-label": label, "calcite-hydrated-hidden": hidden, role: role }, h("div", { class: {
117
133
  container: true,
118
134
  queued,
119
135
  [CSS_UTILITY.rtl]: dir === "rtl"
120
- } }, requestedIcon ? (h("div", { class: "alert-icon" }, h("calcite-icon", { icon: requestedIcon, scale: this.scale === "l" ? "m" : "s" }))) : null, h("div", { class: "alert-content" }, h("slot", { name: SLOTS.title }), h("slot", { name: SLOTS.message }), h("slot", { name: SLOTS.link })), queueCount, !autoDismiss ? closeButton : null, active && !queued && autoDismiss ? progress : null)));
136
+ } }, requestedIcon ? (h("div", { class: "alert-icon" }, h("calcite-icon", { icon: requestedIcon, scale: this.scale === "l" ? "m" : "s" }))) : null, h("div", { class: "alert-content" }, h("slot", { name: SLOTS.title }), h("slot", { name: SLOTS.message }), h("slot", { name: SLOTS.link })), queueCount, !autoDismiss ? closeButton : null, active && !queued && autoDismiss ? progressBar : null)));
121
137
  }
122
138
  // when an alert is opened or closed, update queue and determine active alert
123
139
  alertSync(event) {
@@ -163,8 +179,8 @@ let CalciteAlert$1 = class extends HTMLElement {
163
179
  var _a;
164
180
  if (((_a = this.queue) === null || _a === void 0 ? void 0 : _a[0]) === this.el) {
165
181
  this.openAlert();
166
- clearTimeout(this.autoDismissTimeout);
167
- if (this.autoDismiss) {
182
+ if (this.autoDismiss && !this.autoDismissTimeout) {
183
+ this.trackTimer = new Date();
168
184
  this.autoDismissTimeout = window.setTimeout(() => this.closeAlert(), DURATIONS[this.autoDismissDuration]);
169
185
  }
170
186
  }
@@ -185,7 +201,8 @@ let CalciteAlert$1 = class extends HTMLElement {
185
201
  static get watchers() { return {
186
202
  "active": ["watchActive"],
187
203
  "icon": ["updateRequestedIcon"],
188
- "color": ["updateRequestedIcon"]
204
+ "color": ["updateRequestedIcon"],
205
+ "autoDismissDuration": ["updateDuration"]
189
206
  }; }
190
207
  static get style() { return calciteAlertCss; }
191
208
  };
@@ -205,6 +222,9 @@ CalciteAlert$1 = /*@__PURE__*/ proxyCustomElement(CalciteAlert$1, [1, "calcite-a
205
222
  "setFocus": [64]
206
223
  }, [[8, "calciteAlertSync", "alertSync"], [8, "calciteAlertRegister", "alertRegister"]]]);
207
224
  function defineCustomElement$1() {
225
+ if (typeof customElements === "undefined") {
226
+ return;
227
+ }
208
228
  const components = ["calcite-alert", "calcite-chip", "calcite-icon"];
209
229
  components.forEach(tagName => { switch (tagName) {
210
230
  case "calcite-alert":
@@ -2,7 +2,7 @@
2
2
  * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
4
4
  */
5
- import { h, proxyCustomElement } from '@stencil/core/internal/client';
5
+ import { HTMLElement, h, proxyCustomElement } from '@stencil/core/internal/client';
6
6
  import { a as getElementDir, c as getThemeName } from './dom.js';
7
7
  import { h as hexToRGB, i as isValidHex } from './utils.js';
8
8
  import { d as defineCustomElement$2 } from './calcite-icon2.js';
@@ -149,6 +149,9 @@ CalciteAvatar$1 = /*@__PURE__*/ proxyCustomElement(CalciteAvatar$1, [1, "calcite
149
149
  "error": [32]
150
150
  }]);
151
151
  function defineCustomElement$1() {
152
+ if (typeof customElements === "undefined") {
153
+ return;
154
+ }
152
155
  const components = ["calcite-avatar", "calcite-icon"];
153
156
  components.forEach(tagName => { switch (tagName) {
154
157
  case "calcite-avatar":
@@ -2,7 +2,7 @@
2
2
  * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
4
4
  */
5
- import { createEvent, h, proxyCustomElement } from '@stencil/core/internal/client';
5
+ import { HTMLElement, createEvent, h, proxyCustomElement } from '@stencil/core/internal/client';
6
6
  import { a as getElementDir, C as CSS_UTILITY } from './dom.js';
7
7
  import { d as defineCustomElement$3 } from './calcite-icon2.js';
8
8
  import { d as defineCustomElement$2 } from './calcite-switch2.js';
@@ -112,6 +112,9 @@ CalciteBlockSection$1 = /*@__PURE__*/ proxyCustomElement(CalciteBlockSection$1,
112
112
  "toggleDisplay": [513, "toggle-display"]
113
113
  }]);
114
114
  function defineCustomElement$1() {
115
+ if (typeof customElements === "undefined") {
116
+ return;
117
+ }
115
118
  const components = ["calcite-block-section", "calcite-icon", "calcite-switch"];
116
119
  components.forEach(tagName => { switch (tagName) {
117
120
  case "calcite-block-section":