@esri/calcite-components 1.0.0-next.373 → 1.0.0-next.374

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 (118) hide show
  1. package/dist/calcite/calcite.esm.js +1 -1
  2. package/dist/calcite/p-05ad8606.system.entry.js +5 -0
  3. package/dist/calcite/{p-32d61433.system.entry.js → p-2f0d280a.system.entry.js} +1 -1
  4. package/dist/calcite/{p-617c3f30.system.entry.js → p-3dd50bac.system.entry.js} +1 -1
  5. package/dist/calcite/p-4e258f5c.entry.js +5 -0
  6. package/dist/calcite/{p-82491929.entry.js → p-6e37af80.entry.js} +1 -1
  7. package/dist/calcite/p-7409e609.system.js +5 -0
  8. package/dist/calcite/p-76c53ab5.entry.js +5 -0
  9. package/dist/calcite/{p-f24ddc56.system.entry.js → p-80eb08b3.system.entry.js} +1 -1
  10. package/dist/calcite/p-8a413063.js +5 -0
  11. package/dist/calcite/{p-ee14736a.entry.js → p-8c126095.entry.js} +1 -1
  12. package/dist/calcite/{p-2e324a56.system.entry.js → p-92711575.system.entry.js} +2 -2
  13. package/dist/calcite/p-99b729f6.entry.js +5 -0
  14. package/dist/calcite/p-99d32fc3.system.js +1 -1
  15. package/dist/calcite/p-a49d1a11.system.entry.js +5 -0
  16. package/dist/calcite/p-a5660ba5.entry.js +5 -0
  17. package/dist/calcite/p-aceeb62f.entry.js +5 -0
  18. package/dist/calcite/p-b78f6de5.system.entry.js +5 -0
  19. package/dist/calcite/p-bab0c984.entry.js +5 -0
  20. package/dist/calcite/{p-39d4d1b1.system.entry.js → p-bd6cbbbd.system.entry.js} +1 -1
  21. package/dist/calcite/{p-8709d314.system.entry.js → p-c93dbb93.system.entry.js} +1 -1
  22. package/dist/calcite/p-d2bcb3ae.entry.js +5 -0
  23. package/dist/calcite/p-dd8b6d4f.system.entry.js +5 -0
  24. package/dist/calcite/p-e05aa070.entry.js +5 -0
  25. package/dist/calcite/p-e66c335c.entry.js +5 -0
  26. package/dist/calcite/p-f3102bbb.system.entry.js +5 -0
  27. package/dist/calcite/{p-3cdf0ad5.system.entry.js → p-fd3c4738.system.entry.js} +1 -1
  28. package/dist/calcite/p-fe6e3ff9.entry.js +5 -0
  29. package/dist/cjs/calcite-action-menu.cjs.entry.js +1 -4
  30. package/dist/cjs/calcite-alert.cjs.entry.js +4 -6
  31. package/dist/cjs/calcite-date-picker_4.cjs.entry.js +1 -1
  32. package/dist/cjs/calcite-dropdown_3.cjs.entry.js +1 -1
  33. package/dist/cjs/calcite-graph_2.cjs.entry.js +7 -3
  34. package/dist/cjs/calcite-inline-editable.cjs.entry.js +38 -13
  35. package/dist/cjs/calcite-input-date-picker.cjs.entry.js +1 -1
  36. package/dist/cjs/calcite-input.cjs.entry.js +11 -7
  37. package/dist/cjs/calcite-modal.cjs.entry.js +1 -1
  38. package/dist/cjs/calcite-notice.cjs.entry.js +4 -6
  39. package/dist/cjs/calcite-radio-button-group.cjs.entry.js +13 -0
  40. package/dist/cjs/calcite-radio-button.cjs.entry.js +0 -4
  41. package/dist/cjs/{resources-11763017.js → resources-f70fb01b.js} +3 -0
  42. package/dist/collection/components/calcite-action-menu/calcite-action-menu.js +1 -4
  43. package/dist/collection/components/calcite-alert/calcite-alert.js +8 -7
  44. package/dist/collection/components/calcite-date-picker/utils.js +3 -0
  45. package/dist/collection/components/calcite-dropdown/calcite-dropdown.js +2 -2
  46. package/dist/collection/components/calcite-inline-editable/calcite-inline-editable.js +39 -14
  47. package/dist/collection/components/calcite-input/calcite-input.js +12 -8
  48. package/dist/collection/components/calcite-modal/calcite-modal.js +1 -1
  49. package/dist/collection/components/calcite-notice/calcite-notice.js +4 -6
  50. package/dist/collection/components/calcite-radio-button/calcite-radio-button.js +0 -4
  51. package/dist/collection/components/calcite-radio-button-group/calcite-radio-button-group.js +13 -0
  52. package/dist/collection/components/calcite-slider/calcite-slider.js +7 -3
  53. package/dist/components/calcite-action-menu2.js +1 -4
  54. package/dist/components/calcite-alert.js +5 -7
  55. package/dist/components/calcite-date-picker2.js +3 -0
  56. package/dist/components/calcite-dropdown2.js +2 -2
  57. package/dist/components/calcite-inline-editable.js +39 -14
  58. package/dist/components/calcite-input2.js +12 -8
  59. package/dist/components/calcite-modal.js +1 -1
  60. package/dist/components/calcite-notice.js +4 -6
  61. package/dist/components/calcite-radio-button-group.js +13 -0
  62. package/dist/components/calcite-radio-button.js +0 -4
  63. package/dist/components/calcite-slider.js +7 -3
  64. package/dist/custom-elements/index.js +80 -45
  65. package/dist/esm/calcite-action-menu.entry.js +1 -4
  66. package/dist/esm/calcite-alert.entry.js +5 -7
  67. package/dist/esm/calcite-date-picker_4.entry.js +1 -1
  68. package/dist/esm/calcite-dropdown_3.entry.js +2 -2
  69. package/dist/esm/calcite-graph_2.entry.js +7 -3
  70. package/dist/esm/calcite-inline-editable.entry.js +39 -14
  71. package/dist/esm/calcite-input-date-picker.entry.js +1 -1
  72. package/dist/esm/calcite-input.entry.js +12 -8
  73. package/dist/esm/calcite-modal.entry.js +1 -1
  74. package/dist/esm/calcite-notice.entry.js +4 -6
  75. package/dist/esm/calcite-radio-button-group.entry.js +13 -0
  76. package/dist/esm/calcite-radio-button.entry.js +0 -4
  77. package/dist/esm/{resources-c768953c.js → resources-f02a1ab5.js} +3 -0
  78. package/dist/esm-es5/calcite-action-menu.entry.js +2 -2
  79. package/dist/esm-es5/calcite-alert.entry.js +1 -1
  80. package/dist/esm-es5/calcite-date-picker_4.entry.js +1 -1
  81. package/dist/esm-es5/calcite-dropdown_3.entry.js +1 -1
  82. package/dist/esm-es5/calcite-graph_2.entry.js +1 -1
  83. package/dist/esm-es5/calcite-inline-editable.entry.js +1 -1
  84. package/dist/esm-es5/calcite-input-date-picker.entry.js +1 -1
  85. package/dist/esm-es5/calcite-input.entry.js +1 -1
  86. package/dist/esm-es5/calcite-modal.entry.js +1 -1
  87. package/dist/esm-es5/calcite-notice.entry.js +1 -1
  88. package/dist/esm-es5/calcite-radio-button-group.entry.js +1 -1
  89. package/dist/esm-es5/calcite-radio-button.entry.js +1 -1
  90. package/dist/esm-es5/resources-f02a1ab5.js +5 -0
  91. package/dist/extras/docs-json.json +1 -1
  92. package/dist/types/components/calcite-alert/calcite-alert.d.ts +0 -3
  93. package/dist/types/components/calcite-inline-editable/calcite-inline-editable.d.ts +3 -1
  94. package/dist/types/components/calcite-input/calcite-input.d.ts +2 -4
  95. package/dist/types/components/calcite-notice/calcite-notice.d.ts +0 -3
  96. package/dist/types/components/calcite-radio-button-group/calcite-radio-button-group.d.ts +2 -0
  97. package/dist/types/components/calcite-slider/calcite-slider.d.ts +1 -0
  98. package/hydrate/index.js +77 -45
  99. package/package.json +6 -2
  100. package/readme.md +0 -4
  101. package/dist/calcite/p-06fbc0f2.system.entry.js +0 -5
  102. package/dist/calcite/p-08be120f.entry.js +0 -5
  103. package/dist/calcite/p-0b552c00.system.entry.js +0 -5
  104. package/dist/calcite/p-500300b5.entry.js +0 -5
  105. package/dist/calcite/p-647d22ef.js +0 -5
  106. package/dist/calcite/p-64a5e88c.entry.js +0 -5
  107. package/dist/calcite/p-6969dabb.entry.js +0 -5
  108. package/dist/calcite/p-8ba8a357.system.js +0 -5
  109. package/dist/calcite/p-97375cc0.entry.js +0 -5
  110. package/dist/calcite/p-99422223.system.entry.js +0 -5
  111. package/dist/calcite/p-a50e52f1.entry.js +0 -5
  112. package/dist/calcite/p-abe7730b.entry.js +0 -5
  113. package/dist/calcite/p-c5b3d90c.entry.js +0 -5
  114. package/dist/calcite/p-cd9d106b.system.entry.js +0 -5
  115. package/dist/calcite/p-dba7c714.system.entry.js +0 -5
  116. package/dist/calcite/p-e5c2a6eb.entry.js +0 -5
  117. package/dist/calcite/p-e63f0806.entry.js +0 -5
  118. package/dist/esm-es5/resources-c768953c.js +0 -5
@@ -127,10 +127,7 @@ export class CalciteActionMenu {
127
127
  };
128
128
  this.getActions = () => {
129
129
  const { el } = this;
130
- const assignedActions = this.getAssignedElements().filter((element) => element.tagName === "CALCITE-ACTION" && element.slot !== "trigger");
131
- const actionElements = assignedActions.length
132
- ? assignedActions
133
- : Array.from(el.querySelectorAll("calcite-action:not([slot=trigger])"));
130
+ const actionElements = getSlotted(el, { all: true, matches: "calcite-action" });
134
131
  this.updateActions(actionElements);
135
132
  this.actionElements = actionElements;
136
133
  this.connectMenuButtonEl();
@@ -3,7 +3,7 @@
3
3
  * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
4
4
  */
5
5
  import { Component, Element, Event, h, Host, Listen, Method, Prop, State, Watch } from "@stencil/core";
6
- import { setRequestedIcon } from "../../utils/dom";
6
+ import { getSlotted, setRequestedIcon } from "../../utils/dom";
7
7
  import { DURATIONS, SLOTS, TEXT } from "./resources";
8
8
  import { StatusIcons } from "./interfaces";
9
9
  /** Alerts are meant to provide a way to communicate urgent or important information to users, frequently as a result of an action they took in your app. Alerts are positioned
@@ -105,9 +105,6 @@ export class CalciteAlert {
105
105
  componentWillLoad() {
106
106
  this.requestedIcon = setRequestedIcon(StatusIcons, this.icon, this.color);
107
107
  }
108
- componentDidLoad() {
109
- this.alertLinkEl = this.el.querySelectorAll("calcite-link")[0];
110
- }
111
108
  disconnectedCallback() {
112
109
  window.clearTimeout(this.autoDismissTimeoutId);
113
110
  }
@@ -160,11 +157,12 @@ export class CalciteAlert {
160
157
  //--------------------------------------------------------------------------
161
158
  /** Sets focus on the component. */
162
159
  async setFocus() {
163
- if (!this.closeButton && !this.alertLinkEl) {
160
+ const alertLinkEl = getSlotted(this.el, { selector: "calcite-link" });
161
+ if (!this.closeButton && !alertLinkEl) {
164
162
  return;
165
163
  }
166
- else if (this.alertLinkEl) {
167
- this.alertLinkEl.setFocus();
164
+ else if (alertLinkEl) {
165
+ alertLinkEl.setFocus();
168
166
  }
169
167
  else if (this.closeButton) {
170
168
  this.closeButton.focus();
@@ -468,6 +466,9 @@ export class CalciteAlert {
468
466
  "references": {
469
467
  "Promise": {
470
468
  "location": "global"
469
+ },
470
+ "HTMLCalciteLinkElement": {
471
+ "location": "global"
471
472
  }
472
473
  },
473
474
  "return": "Promise<void>"
@@ -16,6 +16,9 @@ function getSupportedLocale(lang = "") {
16
16
  lang = lang.toLowerCase();
17
17
  if (lang.includes("-")) {
18
18
  lang = lang.replace(/(\w+)-(\w+)/, (_match, language, region) => `${language}-${region.toUpperCase()}`);
19
+ if (!locales.includes(lang)) {
20
+ lang = lang.split("-")[0];
21
+ }
19
22
  }
20
23
  return locales.includes(lang) ? lang : "en";
21
24
  }
@@ -3,7 +3,7 @@
3
3
  * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
4
4
  */
5
5
  import { Component, Element, Event, h, Host, Listen, Method, Prop, Watch } from "@stencil/core";
6
- import { focusElement } from "../../utils/dom";
6
+ import { focusElement, getSlotted } from "../../utils/dom";
7
7
  import { createPopper, CSS as PopperCSS, updatePopper } from "../../utils/popper";
8
8
  import { DefaultDropdownPlacement, SLOTS } from "./resources";
9
9
  import { createObserver } from "../../utils/observers";
@@ -67,7 +67,7 @@ export class CalciteDropdown {
67
67
  //--------------------------------------------------------------------------
68
68
  this.updateItems = () => {
69
69
  this.updateSelectedItems();
70
- this.triggers = Array.from(this.el.querySelectorAll("[slot=dropdown-trigger]"));
70
+ this.triggers = getSlotted(this.el, "dropdown-trigger", { all: true });
71
71
  this.items = Array.from(this.el.querySelectorAll("calcite-dropdown-item"));
72
72
  this.reposition();
73
73
  };
@@ -3,9 +3,10 @@
3
3
  * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
4
4
  */
5
5
  import { Component, Element, Event, h, Listen, Method, Prop, Watch } from "@stencil/core";
6
- import { getElementProp } from "../../utils/dom";
6
+ import { getElementProp, getSlotted } from "../../utils/dom";
7
7
  import { TEXT, CSS } from "./resources";
8
8
  import { connectLabel, disconnectLabel, getLabelText } from "../../utils/label";
9
+ import { createObserver } from "../../utils/observers";
9
10
  /**
10
11
  * @slot - A slot for adding a `calcite-input`.
11
12
  */
@@ -36,26 +37,31 @@ export class CalciteInlineEditable {
36
37
  * @default "Save"
37
38
  */
38
39
  this.intlConfirmChanges = TEXT.intlConfirmChanges;
40
+ this.mutationObserver = createObserver("mutation", () => this.mutationObserverCallback());
39
41
  this.transitionEnd = () => {
40
42
  if (!this.editingEnabled && !!this.shouldEmitCancel) {
41
43
  this.calciteInlineEditableEditCancel.emit();
42
44
  }
43
45
  };
44
46
  this.enableEditing = () => {
45
- this.valuePriorToEditing = this.inputElement.value;
47
+ var _a, _b;
48
+ this.valuePriorToEditing = (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.value;
46
49
  this.editingEnabled = true;
47
- this.inputElement.setFocus();
50
+ (_b = this.inputElement) === null || _b === void 0 ? void 0 : _b.setFocus();
48
51
  this.calciteInlineEditableEnableEditingChange.emit();
49
52
  };
50
53
  this.disableEditing = () => {
51
54
  this.editingEnabled = false;
52
55
  };
53
56
  this.cancelEditing = () => {
54
- this.inputElement.value = this.valuePriorToEditing;
57
+ if (this.inputElement) {
58
+ this.inputElement.value = this.valuePriorToEditing;
59
+ }
55
60
  this.disableEditing();
56
61
  this.enableEditingButton.setFocus();
57
62
  };
58
63
  this.escapeKeyHandler = async (e) => {
64
+ var _a;
59
65
  if (e.key !== "Escape") {
60
66
  if (e.key === "Tab" && this.shouldShowControls) {
61
67
  if (!e.shiftKey && e.target === this.inputElement) {
@@ -65,7 +71,7 @@ export class CalciteInlineEditable {
65
71
  if (!!e.shiftKey && e.target === this.cancelEditingButton) {
66
72
  e.preventDefault();
67
73
  e.stopPropagation();
68
- this.inputElement.setFocus();
74
+ (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.setFocus();
69
75
  }
70
76
  }
71
77
  return;
@@ -107,10 +113,14 @@ export class CalciteInlineEditable {
107
113
  };
108
114
  }
109
115
  disabledWatcher(disabled) {
110
- this.inputElement.disabled = disabled;
116
+ if (this.inputElement) {
117
+ this.inputElement.disabled = disabled;
118
+ }
111
119
  }
112
120
  editingEnabledWatcher(newValue, oldValue) {
113
- this.inputElement.editingEnabled = newValue;
121
+ if (this.inputElement) {
122
+ this.inputElement.editingEnabled = newValue;
123
+ }
114
124
  if (!newValue && !!oldValue) {
115
125
  this.shouldEmitCancel = true;
116
126
  }
@@ -121,17 +131,15 @@ export class CalciteInlineEditable {
121
131
  //
122
132
  //--------------------------------------------------------------------------
123
133
  connectedCallback() {
134
+ var _a;
124
135
  connectLabel(this);
136
+ (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true });
137
+ this.mutationObserverCallback();
125
138
  }
126
139
  disconnectedCallback() {
140
+ var _a;
127
141
  disconnectLabel(this);
128
- }
129
- componentWillLoad() {
130
- this.inputElement = this.el.querySelector("calcite-input");
131
- this.inputElement.disabled = this.disabled;
132
- this.inputElement.label = this.inputElement.label || getLabelText(this);
133
- this.scale =
134
- this.scale || this.inputElement.scale || getElementProp(this.el, "scale", undefined);
142
+ (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
135
143
  }
136
144
  render() {
137
145
  return (h("div", { class: CSS.wrapper, onClick: this.enableEditingHandler, onKeyDown: this.escapeKeyHandler, onTransitionEnd: this.transitionEnd },
@@ -177,9 +185,26 @@ export class CalciteInlineEditable {
177
185
  // Private Methods
178
186
  //
179
187
  //--------------------------------------------------------------------------
188
+ mutationObserverCallback() {
189
+ var _a;
190
+ this.updateSlottedInput();
191
+ this.scale =
192
+ this.scale || ((_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.scale) || getElementProp(this.el, "scale", undefined);
193
+ }
180
194
  onLabelClick() {
181
195
  this.setFocus();
182
196
  }
197
+ updateSlottedInput() {
198
+ const inputElement = getSlotted(this.el, {
199
+ matches: "calcite-input"
200
+ });
201
+ this.inputElement = inputElement;
202
+ if (!inputElement) {
203
+ return;
204
+ }
205
+ this.inputElement.disabled = this.disabled;
206
+ this.inputElement.label = this.inputElement.label || getLabelText(this);
207
+ }
183
208
  get shouldShowControls() {
184
209
  return this.editingEnabled && this.controls;
185
210
  }
@@ -3,7 +3,7 @@
3
3
  * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
4
4
  */
5
5
  import { Component, Element, Event, h, Host, Method, Prop, State, Watch } from "@stencil/core";
6
- import { getElementDir, getElementProp, setRequestedIcon } from "../../utils/dom";
6
+ import { getElementDir, getElementProp, getSlotted, setRequestedIcon } from "../../utils/dom";
7
7
  import { CSS, INPUT_TYPE_ICONS, SLOTS } from "./resources";
8
8
  import { connectLabel, disconnectLabel, getLabelText } from "../../utils/label";
9
9
  import { connectForm, disconnectForm, HiddenFormInputSlot } from "../../utils/form";
@@ -12,6 +12,7 @@ import { numberKeys } from "../../utils/key";
12
12
  import { isValidNumber, parseNumberString, sanitizeNumberString } from "../../utils/number";
13
13
  import { CSS_UTILITY, TEXT } from "../../utils/resources";
14
14
  import { decimalPlaces } from "../../utils/math";
15
+ import { createObserver } from "../../utils/observers";
15
16
  /**
16
17
  * @slot action - A slot for positioning a button next to an input
17
18
  */
@@ -76,6 +77,7 @@ export class CalciteInput {
76
77
  this.childElType = "input";
77
78
  /** whether the value of the input was changed as a result of user typing or not */
78
79
  this.internalValueChange = false;
80
+ this.mutationObserver = createObserver("mutation", () => this.setDisabledAction());
79
81
  //--------------------------------------------------------------------------
80
82
  //
81
83
  // Private Methods
@@ -114,7 +116,8 @@ export class CalciteInput {
114
116
  }
115
117
  };
116
118
  this.inputFocusHandler = (event) => {
117
- if (event.target !== this.slottedActionEl) {
119
+ const slottedActionEl = getSlotted(this.el, "action");
120
+ if (event.target !== slottedActionEl) {
118
121
  this.setFocus();
119
122
  }
120
123
  this.calciteInputFocus.emit({
@@ -358,6 +361,7 @@ export class CalciteInput {
358
361
  //
359
362
  //--------------------------------------------------------------------------
360
363
  connectedCallback() {
364
+ var _a;
361
365
  this.scale = getElementProp(this.el, "scale", this.scale);
362
366
  this.status = getElementProp(this.el, "status", this.status);
363
367
  this.inlineEditableEl = this.el.closest("calcite-inline-editable");
@@ -374,10 +378,14 @@ export class CalciteInput {
374
378
  }
375
379
  connectLabel(this);
376
380
  connectForm(this);
381
+ (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true });
382
+ this.setDisabledAction();
377
383
  }
378
384
  disconnectedCallback() {
385
+ var _a;
379
386
  disconnectLabel(this);
380
387
  disconnectForm(this);
388
+ (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
381
389
  }
382
390
  componentWillLoad() {
383
391
  var _a, _b;
@@ -386,10 +394,6 @@ export class CalciteInput {
386
394
  this.minString = (_b = this.min) === null || _b === void 0 ? void 0 : _b.toString();
387
395
  this.requestedIcon = setRequestedIcon(INPUT_TYPE_ICONS, this.icon, this.type);
388
396
  }
389
- componentDidLoad() {
390
- this.slottedActionEl = this.el.querySelector("[slot=action]");
391
- this.setDisabledAction();
392
- }
393
397
  componentShouldUpdate(newValue, oldValue, property) {
394
398
  if (this.type === "number" && property === "value" && newValue && !isValidNumber(newValue)) {
395
399
  this.setValue({
@@ -461,10 +465,10 @@ export class CalciteInput {
461
465
  }
462
466
  }
463
467
  setDisabledAction() {
464
- if (!this.slottedActionEl) {
468
+ const slottedActionEl = getSlotted(this.el, "action");
469
+ if (!slottedActionEl) {
465
470
  return;
466
471
  }
467
- const slottedActionEl = this.slottedActionEl;
468
472
  this.disabled
469
473
  ? slottedActionEl.setAttribute("disabled", "")
470
474
  : slottedActionEl.removeAttribute("disabled");
@@ -98,7 +98,7 @@ export class CalciteModal {
98
98
  }
99
99
  };
100
100
  this.updateFooterVisibility = () => {
101
- this.hasFooter = !!this.el.querySelector(`[slot=${SLOTS.back}], [slot=${SLOTS.secondary}], [slot=${SLOTS.primary}]`);
101
+ this.hasFooter = !!getSlotted(this.el, [SLOTS.back, SLOTS.primary, SLOTS.secondary]);
102
102
  };
103
103
  }
104
104
  //--------------------------------------------------------------------------
@@ -66,9 +66,6 @@ export class CalciteNotice {
66
66
  componentWillLoad() {
67
67
  this.requestedIcon = setRequestedIcon(StatusIcons, this.icon, this.color);
68
68
  }
69
- componentDidLoad() {
70
- this.noticeLinkEl = this.el.querySelector("calcite-link");
71
- }
72
69
  render() {
73
70
  const { el } = this;
74
71
  const closeButton = (h("button", { "aria-label": this.intlClose, class: CSS.close, onClick: this.close, ref: (el) => (this.closeButton = el) },
@@ -92,11 +89,12 @@ export class CalciteNotice {
92
89
  //--------------------------------------------------------------------------
93
90
  /** Sets focus on the component. */
94
91
  async setFocus() {
95
- if (!this.closeButton && !this.noticeLinkEl) {
92
+ const noticeLinkEl = this.el.querySelector("calcite-link");
93
+ if (!this.closeButton && !noticeLinkEl) {
96
94
  return;
97
95
  }
98
- if (this.noticeLinkEl) {
99
- this.noticeLinkEl.setFocus();
96
+ if (noticeLinkEl) {
97
+ noticeLinkEl.setFocus();
100
98
  }
101
99
  else if (this.closeButton) {
102
100
  this.closeButton.focus();
@@ -129,10 +129,6 @@ export class CalciteRadioButton {
129
129
  }
130
130
  nameChanged() {
131
131
  this.checkLastRadioButton();
132
- const currentValue = this.rootNode.querySelector(`input[name="${this.name}"]:checked`);
133
- if (!(currentValue === null || currentValue === void 0 ? void 0 : currentValue.value)) {
134
- this.uncheckAllRadioButtonsInGroup();
135
- }
136
132
  }
137
133
  //--------------------------------------------------------------------------
138
134
  //
@@ -3,6 +3,7 @@
3
3
  * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
4
4
  */
5
5
  import { Component, Host, h, Element, Prop, Watch, Event, Listen } from "@stencil/core";
6
+ import { createObserver } from "../../utils/observers";
6
7
  /**
7
8
  * @slot - A slot for adding `calcite-radio-button`s.
8
9
  */
@@ -23,6 +24,12 @@ export class CalciteRadioButtonGroup {
23
24
  this.required = false;
24
25
  /** The scale (size) of the radio button group. */
25
26
  this.scale = "m";
27
+ // --------------------------------------------------------------------------
28
+ //
29
+ // Private Properties
30
+ //
31
+ // --------------------------------------------------------------------------
32
+ this.mutationObserver = createObserver("mutation", () => this.passPropsToRadioButtons());
26
33
  //--------------------------------------------------------------------------
27
34
  //
28
35
  // Private Methods
@@ -59,7 +66,13 @@ export class CalciteRadioButtonGroup {
59
66
  //
60
67
  //--------------------------------------------------------------------------
61
68
  connectedCallback() {
69
+ var _a;
62
70
  this.passPropsToRadioButtons();
71
+ (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
72
+ }
73
+ disconnectedCallback() {
74
+ var _a;
75
+ (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
63
76
  }
64
77
  //--------------------------------------------------------------------------
65
78
  //
@@ -83,9 +83,7 @@ export class CalciteSlider {
83
83
  }
84
84
  };
85
85
  this.dragEnd = (event) => {
86
- document.removeEventListener("pointermove", this.dragUpdate);
87
- document.removeEventListener("pointerup", this.dragEnd);
88
- document.removeEventListener("pointercancel", this.dragEnd);
86
+ this.removeDragListeners();
89
87
  this.focusActiveHandle(event.clientX);
90
88
  if (this.lastDragPropValue != this[this.dragProp]) {
91
89
  this.emitChange();
@@ -120,6 +118,7 @@ export class CalciteSlider {
120
118
  disconnectedCallback() {
121
119
  disconnectLabel(this);
122
120
  disconnectForm(this);
121
+ this.removeDragListeners();
123
122
  }
124
123
  componentWillLoad() {
125
124
  this.isRange = !!(this.maxValue || this.maxValue === 0);
@@ -515,6 +514,11 @@ export class CalciteSlider {
515
514
  emitChange() {
516
515
  this.calciteSliderChange.emit();
517
516
  }
517
+ removeDragListeners() {
518
+ document.removeEventListener("pointermove", this.dragUpdate);
519
+ document.removeEventListener("pointerup", this.dragEnd);
520
+ document.removeEventListener("pointercancel", this.dragEnd);
521
+ }
518
522
  /**
519
523
  * Set the prop value if changed at the component level
520
524
  * @param valueProp
@@ -144,10 +144,7 @@ let CalciteActionMenu = class extends HTMLElement {
144
144
  };
145
145
  this.getActions = () => {
146
146
  const { el } = this;
147
- const assignedActions = this.getAssignedElements().filter((element) => element.tagName === "CALCITE-ACTION" && element.slot !== "trigger");
148
- const actionElements = assignedActions.length
149
- ? assignedActions
150
- : Array.from(el.querySelectorAll("calcite-action:not([slot=trigger])"));
147
+ const actionElements = getSlotted(el, { all: true, matches: "calcite-action" });
151
148
  this.updateActions(actionElements);
152
149
  this.actionElements = actionElements;
153
150
  this.connectMenuButtonEl();
@@ -3,7 +3,7 @@
3
3
  * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
4
4
  */
5
5
  import { HTMLElement, createEvent, h, Host, proxyCustomElement } from '@stencil/core/internal/client';
6
- import { s as setRequestedIcon } from './dom.js';
6
+ import { s as setRequestedIcon, b as getSlotted } from './dom.js';
7
7
  import { S as StatusIcons } from './interfaces.js';
8
8
  import { d as defineCustomElement$3 } from './calcite-chip2.js';
9
9
  import { d as defineCustomElement$2 } from './calcite-icon2.js';
@@ -122,9 +122,6 @@ let CalciteAlert$1 = class extends HTMLElement {
122
122
  componentWillLoad() {
123
123
  this.requestedIcon = setRequestedIcon(StatusIcons, this.icon, this.color);
124
124
  }
125
- componentDidLoad() {
126
- this.alertLinkEl = this.el.querySelectorAll("calcite-link")[0];
127
- }
128
125
  disconnectedCallback() {
129
126
  window.clearTimeout(this.autoDismissTimeoutId);
130
127
  }
@@ -165,11 +162,12 @@ let CalciteAlert$1 = class extends HTMLElement {
165
162
  //--------------------------------------------------------------------------
166
163
  /** Sets focus on the component. */
167
164
  async setFocus() {
168
- if (!this.closeButton && !this.alertLinkEl) {
165
+ const alertLinkEl = getSlotted(this.el, { selector: "calcite-link" });
166
+ if (!this.closeButton && !alertLinkEl) {
169
167
  return;
170
168
  }
171
- else if (this.alertLinkEl) {
172
- this.alertLinkEl.setFocus();
169
+ else if (alertLinkEl) {
170
+ alertLinkEl.setFocus();
173
171
  }
174
172
  else if (this.closeButton) {
175
173
  this.closeButton.focus();
@@ -22,6 +22,9 @@ function getSupportedLocale(lang = "") {
22
22
  lang = lang.toLowerCase();
23
23
  if (lang.includes("-")) {
24
24
  lang = lang.replace(/(\w+)-(\w+)/, (_match, language, region) => `${language}-${region.toUpperCase()}`);
25
+ if (!locales.includes(lang)) {
26
+ lang = lang.split("-")[0];
27
+ }
25
28
  }
26
29
  return locales.includes(lang) ? lang : "en";
27
30
  }
@@ -3,7 +3,7 @@
3
3
  * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
4
4
  */
5
5
  import { HTMLElement, createEvent, h, Host, proxyCustomElement } from '@stencil/core/internal/client';
6
- import { f as focusElement } from './dom.js';
6
+ import { b as getSlotted, f as focusElement } from './dom.js';
7
7
  import { C as CSS, u as updatePopper, c as createPopper } from './popper.js';
8
8
  import { c as createObserver } from './observers.js';
9
9
 
@@ -76,7 +76,7 @@ let CalciteDropdown = class extends HTMLElement {
76
76
  //--------------------------------------------------------------------------
77
77
  this.updateItems = () => {
78
78
  this.updateSelectedItems();
79
- this.triggers = Array.from(this.el.querySelectorAll("[slot=dropdown-trigger]"));
79
+ this.triggers = getSlotted(this.el, "dropdown-trigger", { all: true });
80
80
  this.items = Array.from(this.el.querySelectorAll("calcite-dropdown-item"));
81
81
  this.reposition();
82
82
  };
@@ -3,8 +3,9 @@
3
3
  * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
4
4
  */
5
5
  import { HTMLElement, createEvent, h, proxyCustomElement } from '@stencil/core/internal/client';
6
- import { g as getElementProp } from './dom.js';
6
+ import { g as getElementProp, b as getSlotted } from './dom.js';
7
7
  import { c as connectLabel, d as disconnectLabel, g as getLabelText } from './label.js';
8
+ import { c as createObserver } from './observers.js';
8
9
  import { d as defineCustomElement$4 } from './calcite-button2.js';
9
10
  import { d as defineCustomElement$3 } from './calcite-icon2.js';
10
11
  import { d as defineCustomElement$2 } from './calcite-loader2.js';
@@ -59,26 +60,31 @@ let CalciteInlineEditable$1 = class extends HTMLElement {
59
60
  * @default "Save"
60
61
  */
61
62
  this.intlConfirmChanges = TEXT.intlConfirmChanges;
63
+ this.mutationObserver = createObserver("mutation", () => this.mutationObserverCallback());
62
64
  this.transitionEnd = () => {
63
65
  if (!this.editingEnabled && !!this.shouldEmitCancel) {
64
66
  this.calciteInlineEditableEditCancel.emit();
65
67
  }
66
68
  };
67
69
  this.enableEditing = () => {
68
- this.valuePriorToEditing = this.inputElement.value;
70
+ var _a, _b;
71
+ this.valuePriorToEditing = (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.value;
69
72
  this.editingEnabled = true;
70
- this.inputElement.setFocus();
73
+ (_b = this.inputElement) === null || _b === void 0 ? void 0 : _b.setFocus();
71
74
  this.calciteInlineEditableEnableEditingChange.emit();
72
75
  };
73
76
  this.disableEditing = () => {
74
77
  this.editingEnabled = false;
75
78
  };
76
79
  this.cancelEditing = () => {
77
- this.inputElement.value = this.valuePriorToEditing;
80
+ if (this.inputElement) {
81
+ this.inputElement.value = this.valuePriorToEditing;
82
+ }
78
83
  this.disableEditing();
79
84
  this.enableEditingButton.setFocus();
80
85
  };
81
86
  this.escapeKeyHandler = async (e) => {
87
+ var _a;
82
88
  if (e.key !== "Escape") {
83
89
  if (e.key === "Tab" && this.shouldShowControls) {
84
90
  if (!e.shiftKey && e.target === this.inputElement) {
@@ -88,7 +94,7 @@ let CalciteInlineEditable$1 = class extends HTMLElement {
88
94
  if (!!e.shiftKey && e.target === this.cancelEditingButton) {
89
95
  e.preventDefault();
90
96
  e.stopPropagation();
91
- this.inputElement.setFocus();
97
+ (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.setFocus();
92
98
  }
93
99
  }
94
100
  return;
@@ -130,10 +136,14 @@ let CalciteInlineEditable$1 = class extends HTMLElement {
130
136
  };
131
137
  }
132
138
  disabledWatcher(disabled) {
133
- this.inputElement.disabled = disabled;
139
+ if (this.inputElement) {
140
+ this.inputElement.disabled = disabled;
141
+ }
134
142
  }
135
143
  editingEnabledWatcher(newValue, oldValue) {
136
- this.inputElement.editingEnabled = newValue;
144
+ if (this.inputElement) {
145
+ this.inputElement.editingEnabled = newValue;
146
+ }
137
147
  if (!newValue && !!oldValue) {
138
148
  this.shouldEmitCancel = true;
139
149
  }
@@ -144,17 +154,15 @@ let CalciteInlineEditable$1 = class extends HTMLElement {
144
154
  //
145
155
  //--------------------------------------------------------------------------
146
156
  connectedCallback() {
157
+ var _a;
147
158
  connectLabel(this);
159
+ (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true });
160
+ this.mutationObserverCallback();
148
161
  }
149
162
  disconnectedCallback() {
163
+ var _a;
150
164
  disconnectLabel(this);
151
- }
152
- componentWillLoad() {
153
- this.inputElement = this.el.querySelector("calcite-input");
154
- this.inputElement.disabled = this.disabled;
155
- this.inputElement.label = this.inputElement.label || getLabelText(this);
156
- this.scale =
157
- this.scale || this.inputElement.scale || getElementProp(this.el, "scale", undefined);
165
+ (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
158
166
  }
159
167
  render() {
160
168
  return (h("div", { class: CSS.wrapper, onClick: this.enableEditingHandler, onKeyDown: this.escapeKeyHandler, onTransitionEnd: this.transitionEnd }, h("div", { class: CSS.inputWrapper }, h("slot", null)), h("div", { class: CSS.controlsWrapper }, h("calcite-button", { appearance: "transparent", class: CSS.enableEditingButton, color: "neutral", disabled: this.disabled, iconStart: "pencil", label: this.intlEnableEditing, onClick: this.enableEditingHandler, ref: (el) => (this.enableEditingButton = el), scale: this.scale, style: {
@@ -194,9 +202,26 @@ let CalciteInlineEditable$1 = class extends HTMLElement {
194
202
  // Private Methods
195
203
  //
196
204
  //--------------------------------------------------------------------------
205
+ mutationObserverCallback() {
206
+ var _a;
207
+ this.updateSlottedInput();
208
+ this.scale =
209
+ this.scale || ((_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.scale) || getElementProp(this.el, "scale", undefined);
210
+ }
197
211
  onLabelClick() {
198
212
  this.setFocus();
199
213
  }
214
+ updateSlottedInput() {
215
+ const inputElement = getSlotted(this.el, {
216
+ matches: "calcite-input"
217
+ });
218
+ this.inputElement = inputElement;
219
+ if (!inputElement) {
220
+ return;
221
+ }
222
+ this.inputElement.disabled = this.disabled;
223
+ this.inputElement.label = this.inputElement.label || getLabelText(this);
224
+ }
200
225
  get shouldShowControls() {
201
226
  return this.editingEnabled && this.controls;
202
227
  }