@esri/calcite-components 1.0.0-next.422 → 1.0.0-next.425

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 (44) hide show
  1. package/dist/calcite/calcite.esm.js +1 -1
  2. package/dist/calcite/{p-afe59546.entry.js → p-2139226c.entry.js} +1 -1
  3. package/dist/calcite/p-2692ac43.entry.js +5 -0
  4. package/dist/calcite/p-58392046.system.entry.js +5 -0
  5. package/dist/calcite/p-62afcb36.system.js +1 -1
  6. package/dist/calcite/p-7b238036.entry.js +5 -0
  7. package/dist/calcite/p-cedd48fe.system.entry.js +5 -0
  8. package/dist/calcite/{p-9ad8c7c5.system.entry.js → p-fe3f4e0e.system.entry.js} +1 -1
  9. package/dist/cjs/calcite-date-picker_4.cjs.entry.js +27 -19
  10. package/dist/cjs/calcite-graph_2.cjs.entry.js +67 -38
  11. package/dist/cjs/calcite-tab_4.cjs.entry.js +31 -32
  12. package/dist/collection/components/date-picker-month-header/date-picker-month-header.js +27 -19
  13. package/dist/collection/components/slider/slider.js +76 -41
  14. package/dist/collection/components/tab/tab.js +10 -12
  15. package/dist/collection/components/tab-nav/tab-nav.js +8 -5
  16. package/dist/collection/components/tab-title/tab-title.js +13 -12
  17. package/dist/collection/components/tabs/tabs.js +0 -3
  18. package/dist/components/calcite-slider.js +67 -38
  19. package/dist/components/date-picker-month-header.js +27 -19
  20. package/dist/components/tab-nav.js +8 -5
  21. package/dist/components/tab-title.js +13 -12
  22. package/dist/components/tab.js +10 -12
  23. package/dist/components/tabs.js +0 -3
  24. package/dist/custom-elements/index.js +125 -89
  25. package/dist/esm/calcite-date-picker_4.entry.js +27 -19
  26. package/dist/esm/calcite-graph_2.entry.js +67 -38
  27. package/dist/esm/calcite-tab_4.entry.js +31 -32
  28. package/dist/esm-es5/calcite-date-picker_4.entry.js +1 -1
  29. package/dist/esm-es5/calcite-graph_2.entry.js +1 -1
  30. package/dist/esm-es5/calcite-tab_4.entry.js +1 -1
  31. package/dist/extras/docs-json.json +6 -3
  32. package/dist/types/components/date-picker-month-header/date-picker-month-header.d.ts +3 -1
  33. package/dist/types/components/slider/slider.d.ts +5 -2
  34. package/dist/types/components/tab/tab.d.ts +4 -5
  35. package/dist/types/components/tab-nav/tab-nav.d.ts +15 -19
  36. package/dist/types/components/tab-title/tab-title.d.ts +9 -18
  37. package/dist/types/components/tabs/tabs.d.ts +1 -4
  38. package/dist/types/components.d.ts +2 -2
  39. package/hydrate/index.js +125 -89
  40. package/package.json +2 -2
  41. package/dist/calcite/p-1aeca42a.system.entry.js +0 -5
  42. package/dist/calcite/p-3915705c.entry.js +0 -5
  43. package/dist/calcite/p-872e82a6.system.entry.js +0 -5
  44. package/dist/calcite/p-e22ab8fa.entry.js +0 -5
@@ -9,6 +9,9 @@ import { clamp, decimalPlaces } from "../../utils/math";
9
9
  import { connectLabel, disconnectLabel } from "../../utils/label";
10
10
  import { afterConnectDefaultValueSet, connectForm, disconnectForm, HiddenFormInputSlot } from "../../utils/form";
11
11
  import { updateHostInteraction } from "../../utils/interactive";
12
+ function isRange(value) {
13
+ return Array.isArray(value);
14
+ }
12
15
  export class Slider {
13
16
  constructor() {
14
17
  //--------------------------------------------------------------------------
@@ -45,13 +48,12 @@ export class Slider {
45
48
  /** Interval to move on up/down keys */
46
49
  this.step = 1;
47
50
  /** Currently selected number (if single select) */
48
- this.value = null;
51
+ this.value = 0;
49
52
  /**
50
53
  * Specify the scale of the slider, defaults to m
51
54
  */
52
55
  this.scale = "m";
53
56
  this.guid = `calcite-slider-${guid()}`;
54
- this.isRange = false;
55
57
  this.activeProp = "value";
56
58
  this.minMaxValueRange = null;
57
59
  this.minValueDragRange = null;
@@ -61,7 +63,7 @@ export class Slider {
61
63
  event.preventDefault();
62
64
  if (this.dragProp) {
63
65
  const value = this.translate(event.clientX || event.pageX);
64
- if (this.isRange && this.dragProp === "minMaxValue") {
66
+ if (isRange(this.value) && this.dragProp === "minMaxValue") {
65
67
  if (this.minValueDragRange && this.maxValueDragRange && this.minMaxValueRange) {
66
68
  const newMinValue = value - this.minValueDragRange;
67
69
  const newMaxValue = value + this.maxValueDragRange;
@@ -107,12 +109,20 @@ export class Slider {
107
109
  histogramWatcher(newHistogram) {
108
110
  this.hasHistogram = !!newHistogram;
109
111
  }
112
+ valueHandler() {
113
+ this.setMinMaxFromValue();
114
+ }
115
+ minMaxValueHandler() {
116
+ this.setValueFromMinMax();
117
+ }
110
118
  //--------------------------------------------------------------------------
111
119
  //
112
120
  // Lifecycle
113
121
  //
114
122
  //--------------------------------------------------------------------------
115
123
  connectedCallback() {
124
+ this.setMinMaxFromValue();
125
+ this.setValueFromMinMax();
116
126
  connectLabel(this);
117
127
  connectForm(this);
118
128
  }
@@ -122,11 +132,12 @@ export class Slider {
122
132
  this.removeDragListeners();
123
133
  }
124
134
  componentWillLoad() {
125
- this.isRange = !!(this.maxValue || this.maxValue === 0);
126
135
  this.tickValues = this.generateTickValues();
127
- this.value = this.clamp(this.value);
136
+ if (!isRange(this.value)) {
137
+ this.value = this.clamp(this.value);
138
+ }
128
139
  afterConnectDefaultValueSet(this, this.value);
129
- if (this.snap) {
140
+ if (this.snap && !isRange(this.value)) {
130
141
  this.value = this.getClosestStep(this.value);
131
142
  }
132
143
  if (this.histogram) {
@@ -136,9 +147,9 @@ export class Slider {
136
147
  componentDidRender() {
137
148
  if (this.labelHandles) {
138
149
  this.adjustHostObscuredHandleLabel("value");
139
- if (this.isRange) {
150
+ if (isRange(this.value)) {
140
151
  this.adjustHostObscuredHandleLabel("minValue");
141
- if (!(this.precise && this.isRange && !this.hasHistogram)) {
152
+ if (!(this.precise && !this.hasHistogram)) {
142
153
  this.hyphenateCollidingRangeHandleLabels();
143
154
  }
144
155
  }
@@ -148,23 +159,23 @@ export class Slider {
148
159
  }
149
160
  render() {
150
161
  const id = this.el.id || this.guid;
162
+ const maxProp = isRange(this.value) ? "maxValue" : "value";
163
+ const value = isRange(this.value) ? this.maxValue : this.value;
151
164
  const min = this.minValue || this.min;
152
- const max = this.maxValue || this.value;
153
- const maxProp = this.isRange ? "maxValue" : "value";
154
- const value = this[maxProp];
155
165
  const useMinValue = this.shouldUseMinValue();
156
166
  const minInterval = this.getUnitInterval(useMinValue ? this.minValue : min) * 100;
157
- const maxInterval = this.getUnitInterval(max) * 100;
167
+ const maxInterval = this.getUnitInterval(value) * 100;
158
168
  const mirror = this.shouldMirror();
159
169
  const leftThumbOffset = `${mirror ? 100 - minInterval : minInterval}%`;
160
170
  const rightThumbOffset = `${mirror ? maxInterval : 100 - maxInterval}%`;
161
- const handle = (h("div", { "aria-disabled": this.disabled, "aria-label": this.isRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
171
+ const valueIsRange = isRange(this.value);
172
+ const handle = (h("div", { "aria-disabled": this.disabled, "aria-label": valueIsRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
162
173
  thumb: true,
163
174
  "thumb--value": true,
164
175
  "thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp
165
176
  }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: () => this.dragStart(maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 },
166
177
  h("div", { class: "handle" })));
167
- const labeledHandle = (h("div", { "aria-disabled": this.disabled, "aria-label": this.isRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
178
+ const labeledHandle = (h("div", { "aria-disabled": this.disabled, "aria-label": valueIsRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
168
179
  thumb: true,
169
180
  "thumb--value": true,
170
181
  "thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp
@@ -173,7 +184,7 @@ export class Slider {
173
184
  h("span", { "aria-hidden": "true", class: "handle__label handle__label--value static" }, value ? value.toLocaleString() : value),
174
185
  h("span", { "aria-hidden": "true", class: "handle__label handle__label--value transformed" }, value ? value.toLocaleString() : value),
175
186
  h("div", { class: "handle" })));
176
- const histogramLabeledHandle = (h("div", { "aria-disabled": this.disabled, "aria-label": this.isRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
187
+ const histogramLabeledHandle = (h("div", { "aria-disabled": this.disabled, "aria-label": valueIsRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
177
188
  thumb: true,
178
189
  "thumb--value": true,
179
190
  "thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp
@@ -182,7 +193,7 @@ export class Slider {
182
193
  h("span", { "aria-hidden": "true", class: "handle__label handle__label--value" }, value ? value.toLocaleString() : value),
183
194
  h("span", { "aria-hidden": "true", class: "handle__label handle__label--value static" }, value ? value.toLocaleString() : value),
184
195
  h("span", { "aria-hidden": "true", class: "handle__label handle__label--value transformed" }, value ? value.toLocaleString() : value)));
185
- const preciseHandle = (h("div", { "aria-disabled": this.disabled, "aria-label": this.isRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
196
+ const preciseHandle = (h("div", { "aria-disabled": this.disabled, "aria-label": valueIsRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
186
197
  thumb: true,
187
198
  "thumb--value": true,
188
199
  "thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp,
@@ -190,7 +201,7 @@ export class Slider {
190
201
  }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: () => this.dragStart(maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 },
191
202
  h("div", { class: "handle" }),
192
203
  h("div", { class: "handle-extension" })));
193
- const histogramPreciseHandle = (h("div", { "aria-disabled": this.disabled, "aria-label": this.isRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
204
+ const histogramPreciseHandle = (h("div", { "aria-disabled": this.disabled, "aria-label": valueIsRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
194
205
  thumb: true,
195
206
  "thumb--value": true,
196
207
  "thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp,
@@ -198,7 +209,7 @@ export class Slider {
198
209
  }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: () => this.dragStart(maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 },
199
210
  h("div", { class: "handle-extension" }),
200
211
  h("div", { class: "handle" })));
201
- const labeledPreciseHandle = (h("div", { "aria-disabled": this.disabled, "aria-label": this.isRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
212
+ const labeledPreciseHandle = (h("div", { "aria-disabled": this.disabled, "aria-label": valueIsRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
202
213
  thumb: true,
203
214
  "thumb--value": true,
204
215
  "thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp,
@@ -209,7 +220,7 @@ export class Slider {
209
220
  h("span", { "aria-hidden": "true", class: "handle__label handle__label--value transformed" }, value ? value.toLocaleString() : value),
210
221
  h("div", { class: "handle" }),
211
222
  h("div", { class: "handle-extension" })));
212
- const histogramLabeledPreciseHandle = (h("div", { "aria-disabled": this.disabled, "aria-label": this.isRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
223
+ const histogramLabeledPreciseHandle = (h("div", { "aria-disabled": this.disabled, "aria-label": valueIsRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
213
224
  thumb: true,
214
225
  "thumb--value": true,
215
226
  "thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp,
@@ -266,7 +277,7 @@ export class Slider {
266
277
  return (h(Host, { id: id, onTouchStart: this.handleTouchStart },
267
278
  h("div", { class: {
268
279
  ["container"]: true,
269
- ["container--range"]: this.isRange,
280
+ ["container--range"]: valueIsRange,
270
281
  [`scale--${this.scale}`]: true
271
282
  } },
272
283
  this.renderGraph(),
@@ -277,7 +288,7 @@ export class Slider {
277
288
  } }),
278
289
  h("div", { class: "ticks" }, this.tickValues.map((tick) => {
279
290
  const tickOffset = `${this.getUnitInterval(tick) * 100}%`;
280
- let activeTicks = tick >= min && tick <= max;
291
+ let activeTicks = tick >= min && tick <= value;
281
292
  if (useMinValue) {
282
293
  activeTicks = tick >= this.minValue && tick <= this.maxValue;
283
294
  }
@@ -290,18 +301,18 @@ export class Slider {
290
301
  } }, this.renderTickLabel(tick)));
291
302
  }))),
292
303
  h("div", { class: "thumb-container" },
293
- !this.precise && !this.labelHandles && this.isRange && minHandle,
304
+ !this.precise && !this.labelHandles && valueIsRange && minHandle,
294
305
  !this.hasHistogram &&
295
306
  !this.precise &&
296
307
  this.labelHandles &&
297
- this.isRange &&
308
+ valueIsRange &&
298
309
  minLabeledHandle,
299
- this.precise && !this.labelHandles && this.isRange && minPreciseHandle,
300
- this.precise && this.labelHandles && this.isRange && minLabeledPreciseHandle,
310
+ this.precise && !this.labelHandles && valueIsRange && minPreciseHandle,
311
+ this.precise && this.labelHandles && valueIsRange && minLabeledPreciseHandle,
301
312
  this.hasHistogram &&
302
313
  !this.precise &&
303
314
  this.labelHandles &&
304
- this.isRange &&
315
+ valueIsRange &&
305
316
  minHistogramLabeledHandle,
306
317
  !this.precise && !this.labelHandles && handle,
307
318
  !this.hasHistogram && !this.precise && this.labelHandles && labeledHandle,
@@ -316,9 +327,10 @@ export class Slider {
316
327
  h(HiddenFormInputSlot, { component: this })))));
317
328
  }
318
329
  renderGraph() {
319
- return this.histogram ? (h("calcite-graph", { class: "graph", colorStops: this.histogramStops, data: this.histogram, highlightMax: this.isRange ? this.maxValue : this.value, highlightMin: this.isRange ? this.minValue : this.min, max: this.max, min: this.min })) : null;
330
+ return this.histogram ? (h("calcite-graph", { class: "graph", colorStops: this.histogramStops, data: this.histogram, highlightMax: isRange(this.value) ? this.maxValue : this.value, highlightMin: isRange(this.value) ? this.minValue : this.min, max: this.max, min: this.min })) : null;
320
331
  }
321
332
  renderTickLabel(tick) {
333
+ const valueIsRange = isRange(this.value);
322
334
  const isMinTickLabel = tick === this.min;
323
335
  const isMaxTickLabel = tick === this.max;
324
336
  const tickLabel = (h("span", { class: {
@@ -326,26 +338,26 @@ export class Slider {
326
338
  "tick__label--min": isMinTickLabel,
327
339
  "tick__label--max": isMaxTickLabel
328
340
  } }, tick.toLocaleString()));
329
- if (this.labelTicks && !this.hasHistogram && !this.isRange) {
341
+ if (this.labelTicks && !this.hasHistogram && !valueIsRange) {
330
342
  return tickLabel;
331
343
  }
332
344
  if (this.labelTicks &&
333
345
  !this.hasHistogram &&
334
- this.isRange &&
346
+ valueIsRange &&
335
347
  !this.precise &&
336
348
  !this.labelHandles) {
337
349
  return tickLabel;
338
350
  }
339
351
  if (this.labelTicks &&
340
352
  !this.hasHistogram &&
341
- this.isRange &&
353
+ valueIsRange &&
342
354
  !this.precise &&
343
355
  this.labelHandles) {
344
356
  return tickLabel;
345
357
  }
346
358
  if (this.labelTicks &&
347
359
  !this.hasHistogram &&
348
- this.isRange &&
360
+ valueIsRange &&
349
361
  this.precise &&
350
362
  (isMinTickLabel || isMaxTickLabel)) {
351
363
  return tickLabel;
@@ -429,7 +441,7 @@ export class Slider {
429
441
  const x = event.clientX || event.pageX;
430
442
  const position = this.translate(x);
431
443
  let prop = "value";
432
- if (this.isRange) {
444
+ if (isRange(this.value)) {
433
445
  const inRange = position >= this.minValue && position <= this.maxValue;
434
446
  if (inRange && this.lastDragProp === "minMaxValue") {
435
447
  prop = "minMaxValue";
@@ -465,6 +477,19 @@ export class Slider {
465
477
  // Private Methods
466
478
  //
467
479
  //--------------------------------------------------------------------------
480
+ setValueFromMinMax() {
481
+ const { minValue, maxValue } = this;
482
+ if (typeof minValue === "number" && typeof maxValue === "number") {
483
+ this.value = [minValue, maxValue];
484
+ }
485
+ }
486
+ setMinMaxFromValue() {
487
+ const { value } = this;
488
+ if (isRange(value)) {
489
+ this.minValue = value[0];
490
+ this.maxValue = value[1];
491
+ }
492
+ }
468
493
  onLabelClick() {
469
494
  this.setFocus();
470
495
  }
@@ -472,7 +497,7 @@ export class Slider {
472
497
  return this.mirrored && !this.hasHistogram;
473
498
  }
474
499
  shouldUseMinValue() {
475
- if (!this.isRange) {
500
+ if (!isRange(this.value)) {
476
501
  return false;
477
502
  }
478
503
  return ((this.hasHistogram && this.maxValue === 0) || (!this.hasHistogram && this.minValue === 0));
@@ -687,19 +712,20 @@ export class Slider {
687
712
  * Hides bounding tick labels that are obscured by either handle.
688
713
  */
689
714
  hideObscuredBoundingTickLabels() {
690
- if (!this.hasHistogram && !this.isRange && !this.labelHandles && !this.precise) {
715
+ const valueIsRange = isRange(this.value);
716
+ if (!this.hasHistogram && !valueIsRange && !this.labelHandles && !this.precise) {
691
717
  return;
692
718
  }
693
- if (!this.hasHistogram && !this.isRange && this.labelHandles && !this.precise) {
719
+ if (!this.hasHistogram && !valueIsRange && this.labelHandles && !this.precise) {
694
720
  return;
695
721
  }
696
- if (!this.hasHistogram && !this.isRange && !this.labelHandles && this.precise) {
722
+ if (!this.hasHistogram && !valueIsRange && !this.labelHandles && this.precise) {
697
723
  return;
698
724
  }
699
- if (!this.hasHistogram && !this.isRange && this.labelHandles && this.precise) {
725
+ if (!this.hasHistogram && !valueIsRange && this.labelHandles && this.precise) {
700
726
  return;
701
727
  }
702
- if (!this.hasHistogram && this.isRange && !this.precise) {
728
+ if (!this.hasHistogram && valueIsRange && !this.precise) {
703
729
  return;
704
730
  }
705
731
  if (this.hasHistogram && !this.precise && !this.labelHandles) {
@@ -1147,8 +1173,8 @@ export class Slider {
1147
1173
  "type": "number",
1148
1174
  "mutable": true,
1149
1175
  "complexType": {
1150
- "original": "null | number",
1151
- "resolved": "number",
1176
+ "original": "null | number | number[]",
1177
+ "resolved": "number | number[]",
1152
1178
  "references": {}
1153
1179
  },
1154
1180
  "required": false,
@@ -1159,7 +1185,7 @@ export class Slider {
1159
1185
  },
1160
1186
  "attribute": "value",
1161
1187
  "reflect": true,
1162
- "defaultValue": "null"
1188
+ "defaultValue": "0"
1163
1189
  },
1164
1190
  "scale": {
1165
1191
  "type": "string",
@@ -1263,6 +1289,15 @@ export class Slider {
1263
1289
  static get watchers() { return [{
1264
1290
  "propName": "histogram",
1265
1291
  "methodName": "histogramWatcher"
1292
+ }, {
1293
+ "propName": "value",
1294
+ "methodName": "valueHandler"
1295
+ }, {
1296
+ "propName": "minValue",
1297
+ "methodName": "minMaxValueHandler"
1298
+ }, {
1299
+ "propName": "maxValue",
1300
+ "methodName": "minMaxValueHandler"
1266
1301
  }]; }
1267
1302
  static get listeners() { return [{
1268
1303
  "name": "keydown",
@@ -16,14 +16,6 @@ export class Tab {
16
16
  this.active = false;
17
17
  /** @internal Parent tabs component scale value */
18
18
  this.scale = "m";
19
- //--------------------------------------------------------------------------
20
- //
21
- // Private State/Props
22
- //
23
- //--------------------------------------------------------------------------
24
- /**
25
- * @internal
26
- */
27
19
  this.guid = `calcite-tab-title-${guid()}`;
28
20
  }
29
21
  //--------------------------------------------------------------------------
@@ -37,12 +29,15 @@ export class Tab {
37
29
  h("section", null,
38
30
  h("slot", null))));
39
31
  }
32
+ connectedCallback() {
33
+ this.parentTabsEl = this.el.closest("calcite-tabs");
34
+ }
40
35
  componentDidLoad() {
41
36
  this.calciteTabRegister.emit();
42
37
  }
43
38
  componentWillRender() {
44
39
  var _a;
45
- this.scale = (_a = this.el.closest("calcite-tabs")) === null || _a === void 0 ? void 0 : _a.scale;
40
+ this.scale = (_a = this.parentTabsEl) === null || _a === void 0 ? void 0 : _a.scale;
46
41
  }
47
42
  disconnectedCallback() {
48
43
  var _a;
@@ -57,10 +52,13 @@ export class Tab {
57
52
  //
58
53
  //--------------------------------------------------------------------------
59
54
  tabChangeHandler(event) {
55
+ const targetTabsEl = event
56
+ .composedPath()
57
+ .find((el) => el.tagName === "CALCITE-TABS");
60
58
  // to allow `<calcite-tabs>` to be nested we need to make sure this
61
- // `calciteTabChange` event was actually fired from a title that is a
62
- // child of the `<calcite-tabs>` that is the a parent of this tab.
63
- if (!event.composedPath().includes(this.el.closest("calcite-tabs"))) {
59
+ // `calciteTabChange` event was actually fired from a within the same
60
+ // `<calcite-tabs>` that is the a parent of this tab.
61
+ if (targetTabsEl !== this.parentTabsEl) {
64
62
  return;
65
63
  }
66
64
  if (this.tab) {
@@ -52,6 +52,9 @@ export class TabNav {
52
52
  // Lifecycle
53
53
  //
54
54
  //--------------------------------------------------------------------------
55
+ connectedCallback() {
56
+ this.parentTabsEl = this.el.closest("calcite-tabs");
57
+ }
55
58
  componentWillLoad() {
56
59
  const storageKey = `calcite-tab-nav-${this.storageId}`;
57
60
  if (localStorage && this.storageId && localStorage.getItem(storageKey)) {
@@ -63,11 +66,11 @@ export class TabNav {
63
66
  }
64
67
  }
65
68
  componentWillRender() {
66
- var _a, _b, _c, _d;
67
- this.layout = (_a = this.el.closest("calcite-tabs")) === null || _a === void 0 ? void 0 : _a.layout;
68
- this.position = (_b = this.el.closest("calcite-tabs")) === null || _b === void 0 ? void 0 : _b.position;
69
- this.scale = (_c = this.el.closest("calcite-tabs")) === null || _c === void 0 ? void 0 : _c.scale;
70
- this.bordered = (_d = this.el.closest("calcite-tabs")) === null || _d === void 0 ? void 0 : _d.bordered;
69
+ const { parentTabsEl } = this;
70
+ this.layout = parentTabsEl === null || parentTabsEl === void 0 ? void 0 : parentTabsEl.layout;
71
+ this.position = parentTabsEl === null || parentTabsEl === void 0 ? void 0 : parentTabsEl.position;
72
+ this.scale = parentTabsEl === null || parentTabsEl === void 0 ? void 0 : parentTabsEl.scale;
73
+ this.bordered = parentTabsEl === null || parentTabsEl === void 0 ? void 0 : parentTabsEl.bordered;
71
74
  // fix issue with active tab-title not lining up with blue indicator
72
75
  if (this.selectedTabEl) {
73
76
  this.updateOffsetPosition();
@@ -32,9 +32,6 @@ export class TabTitle {
32
32
  this.mutationObserver = createObserver("mutation", () => this.updateHasText());
33
33
  /** determine if there is slotted text for styling purposes */
34
34
  this.hasText = false;
35
- /**
36
- * @internal
37
- */
38
35
  this.guid = `calcite-tab-title-${guid()}`;
39
36
  }
40
37
  activeTabChanged() {
@@ -107,15 +104,19 @@ export class TabTitle {
107
104
  //
108
105
  //--------------------------------------------------------------------------
109
106
  tabChangeHandler(event) {
110
- if (event.composedPath().includes(this.parentTabNavEl)) {
111
- if (this.tab) {
112
- this.active = this.tab === event.detail.tab;
113
- }
114
- else {
115
- this.getTabIndex().then((index) => {
116
- this.active = index === event.detail.tab;
117
- });
118
- }
107
+ const targetTabsEl = event
108
+ .composedPath()
109
+ .find((el) => el.tagName === "CALCITE-TABS");
110
+ if (targetTabsEl !== this.parentTabsEl) {
111
+ return;
112
+ }
113
+ if (this.tab) {
114
+ this.active = this.tab === event.detail.tab;
115
+ }
116
+ else {
117
+ this.getTabIndex().then((index) => {
118
+ this.active = index === event.detail.tab;
119
+ });
119
120
  }
120
121
  }
121
122
  onClick() {
@@ -42,14 +42,12 @@ export class Tabs {
42
42
  //
43
43
  //--------------------------------------------------------------------------
44
44
  /**
45
- * @internal
46
45
  *
47
46
  * Stores an array of ids of `<calcite-tab-titles>`s to match up ARIA
48
47
  * attributes.
49
48
  */
50
49
  this.titles = [];
51
50
  /**
52
- * @internal
53
51
  *
54
52
  * Stores an array of ids of `<calcite-tab>`s to match up ARIA attributes.
55
53
  */
@@ -114,7 +112,6 @@ export class Tabs {
114
112
  //
115
113
  //--------------------------------------------------------------------------
116
114
  /**
117
- * @internal
118
115
  *
119
116
  * Matches up elements from the internal `tabs` and `titles` to automatically
120
117
  * update the ARIA attributes and link `<calcite-tab>` and