igniteui-webcomponents 6.1.2 → 6.2.0

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 (225) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/LICENSE +1 -1
  3. package/README.md +13 -1
  4. package/components/card/themes/content.js +7 -0
  5. package/components/card/themes/content.js.map +1 -1
  6. package/components/card/themes/shared/content/card.content.indigo.css.d.ts +1 -0
  7. package/components/card/themes/shared/content/card.content.indigo.css.js +3 -0
  8. package/components/card/themes/shared/content/card.content.indigo.css.js.map +1 -0
  9. package/components/carousel/carousel-indicator.d.ts +1 -1
  10. package/components/carousel/carousel-indicator.js.map +1 -1
  11. package/components/carousel/carousel-slide.d.ts +3 -3
  12. package/components/carousel/carousel-slide.js +7 -13
  13. package/components/carousel/carousel-slide.js.map +1 -1
  14. package/components/carousel/carousel.d.ts +39 -38
  15. package/components/carousel/carousel.js +160 -153
  16. package/components/carousel/carousel.js.map +1 -1
  17. package/components/checkbox/checkbox-base.d.ts +3 -5
  18. package/components/checkbox/checkbox-base.js +15 -21
  19. package/components/checkbox/checkbox-base.js.map +1 -1
  20. package/components/checkbox/checkbox.d.ts +3 -4
  21. package/components/checkbox/checkbox.js +18 -17
  22. package/components/checkbox/checkbox.js.map +1 -1
  23. package/components/checkbox/switch.d.ts +0 -1
  24. package/components/checkbox/switch.js +7 -10
  25. package/components/checkbox/switch.js.map +1 -1
  26. package/components/checkbox/themes/dark/checkbox/checkbox.bootstrap.css.js +1 -1
  27. package/components/checkbox/themes/dark/checkbox/checkbox.bootstrap.css.js.map +1 -1
  28. package/components/checkbox/themes/dark/checkbox/checkbox.fluent.css.js +1 -1
  29. package/components/checkbox/themes/dark/checkbox/checkbox.fluent.css.js.map +1 -1
  30. package/components/checkbox/themes/shared/checkbox/checkbox.bootstrap.css.js +1 -1
  31. package/components/checkbox/themes/shared/checkbox/checkbox.bootstrap.css.js.map +1 -1
  32. package/components/checkbox/themes/shared/checkbox/checkbox.common.css.js +1 -1
  33. package/components/checkbox/themes/shared/checkbox/checkbox.common.css.js.map +1 -1
  34. package/components/checkbox/themes/shared/checkbox/checkbox.fluent.css.js +1 -1
  35. package/components/checkbox/themes/shared/checkbox/checkbox.fluent.css.js.map +1 -1
  36. package/components/checkbox/themes/shared/checkbox/checkbox.indigo.css.js +1 -1
  37. package/components/checkbox/themes/shared/checkbox/checkbox.indigo.css.js.map +1 -1
  38. package/components/checkbox/themes/shared/checkbox/checkbox.material.css.js +1 -1
  39. package/components/checkbox/themes/shared/checkbox/checkbox.material.css.js.map +1 -1
  40. package/components/chip/chip.d.ts +11 -11
  41. package/components/chip/chip.js +61 -65
  42. package/components/chip/chip.js.map +1 -1
  43. package/components/combo/combo.d.ts +3 -3
  44. package/components/combo/combo.js +12 -6
  45. package/components/combo/combo.js.map +1 -1
  46. package/components/combo/themes/shared/combo.common.css.js +1 -1
  47. package/components/combo/themes/shared/combo.common.css.js.map +1 -1
  48. package/components/combo/themes/shared/combo.indigo.css.js +1 -1
  49. package/components/combo/themes/shared/combo.indigo.css.js.map +1 -1
  50. package/components/combo/themes/shared/combo.material.css.js +1 -1
  51. package/components/combo/themes/shared/combo.material.css.js.map +1 -1
  52. package/components/common/controllers/internals.d.ts +66 -2
  53. package/components/common/controllers/internals.js +21 -0
  54. package/components/common/controllers/internals.js.map +1 -1
  55. package/components/common/controllers/slot.d.ts +87 -0
  56. package/components/common/controllers/slot.js +75 -0
  57. package/components/common/controllers/slot.js.map +1 -0
  58. package/components/common/mixins/forms/associated.d.ts +1 -1
  59. package/components/common/mixins/forms/associated.js +91 -36
  60. package/components/common/mixins/forms/associated.js.map +1 -1
  61. package/components/common/mixins/forms/form-transformers.d.ts +21 -0
  62. package/components/common/mixins/forms/form-transformers.js +64 -0
  63. package/components/common/mixins/forms/form-transformers.js.map +1 -0
  64. package/components/common/mixins/forms/form-value.d.ts +7 -36
  65. package/components/common/mixins/forms/form-value.js +2 -64
  66. package/components/common/mixins/forms/form-value.js.map +1 -1
  67. package/components/common/mixins/forms/types.d.ts +19 -10
  68. package/components/common/mixins/forms/types.js +2 -1
  69. package/components/common/mixins/forms/types.js.map +1 -1
  70. package/components/common/util.d.ts +1 -0
  71. package/components/common/util.js +3 -0
  72. package/components/common/util.js.map +1 -1
  73. package/components/date-picker/date-picker.d.ts +1 -3
  74. package/components/date-picker/date-picker.js +11 -13
  75. package/components/date-picker/date-picker.js.map +1 -1
  76. package/components/date-picker/themes/dark/date-picker.indigo.css.js +1 -1
  77. package/components/date-picker/themes/dark/date-picker.indigo.css.js.map +1 -1
  78. package/components/date-picker/themes/shared/date-picker.bootstrap.css.js +1 -1
  79. package/components/date-picker/themes/shared/date-picker.bootstrap.css.js.map +1 -1
  80. package/components/date-picker/themes/shared/date-picker.common.css.js +1 -1
  81. package/components/date-picker/themes/shared/date-picker.common.css.js.map +1 -1
  82. package/components/date-picker/themes/shared/date-picker.fluent.css.js +1 -1
  83. package/components/date-picker/themes/shared/date-picker.fluent.css.js.map +1 -1
  84. package/components/date-picker/themes/shared/date-picker.indigo.css.js +1 -1
  85. package/components/date-picker/themes/shared/date-picker.indigo.css.js.map +1 -1
  86. package/components/date-picker/themes/shared/date-picker.material.css.js +1 -1
  87. package/components/date-picker/themes/shared/date-picker.material.css.js.map +1 -1
  88. package/components/date-range-picker/date-range-picker.d.ts +1 -3
  89. package/components/date-range-picker/date-range-picker.js +19 -26
  90. package/components/date-range-picker/date-range-picker.js.map +1 -1
  91. package/components/date-range-picker/themes/dark/date-range-picker.indigo.css.js +1 -1
  92. package/components/date-range-picker/themes/dark/date-range-picker.indigo.css.js.map +1 -1
  93. package/components/date-range-picker/themes/shared/date-range-picker.bootstrap.css.js +1 -1
  94. package/components/date-range-picker/themes/shared/date-range-picker.bootstrap.css.js.map +1 -1
  95. package/components/date-range-picker/themes/shared/date-range-picker.common.css.js +1 -1
  96. package/components/date-range-picker/themes/shared/date-range-picker.common.css.js.map +1 -1
  97. package/components/date-range-picker/themes/shared/date-range-picker.fluent.css.js +1 -1
  98. package/components/date-range-picker/themes/shared/date-range-picker.fluent.css.js.map +1 -1
  99. package/components/date-range-picker/themes/shared/date-range-picker.indigo.css.js +1 -1
  100. package/components/date-range-picker/themes/shared/date-range-picker.indigo.css.js.map +1 -1
  101. package/components/date-range-picker/themes/shared/date-range-picker.material.css.js +1 -1
  102. package/components/date-range-picker/themes/shared/date-range-picker.material.css.js.map +1 -1
  103. package/components/date-time-input/date-time-input.d.ts +1 -2
  104. package/components/date-time-input/date-time-input.js +7 -7
  105. package/components/date-time-input/date-time-input.js.map +1 -1
  106. package/components/dialog/dialog.d.ts +23 -25
  107. package/components/dialog/dialog.js +108 -115
  108. package/components/dialog/dialog.js.map +1 -1
  109. package/components/dialog/themes/dark/dialog.bootstrap.css.js +1 -1
  110. package/components/dialog/themes/dark/dialog.bootstrap.css.js.map +1 -1
  111. package/components/expansion-panel/expansion-panel.d.ts +12 -14
  112. package/components/expansion-panel/expansion-panel.js +43 -56
  113. package/components/expansion-panel/expansion-panel.js.map +1 -1
  114. package/components/file-input/file-input.d.ts +1 -3
  115. package/components/file-input/file-input.js +6 -11
  116. package/components/file-input/file-input.js.map +1 -1
  117. package/components/file-input/themes/shared/file-input.bootstrap.css.js +1 -1
  118. package/components/file-input/themes/shared/file-input.bootstrap.css.js.map +1 -1
  119. package/components/file-input/themes/shared/file-input.material.css.js +1 -1
  120. package/components/file-input/themes/shared/file-input.material.css.js.map +1 -1
  121. package/components/input/input.d.ts +1 -4
  122. package/components/input/input.js +7 -12
  123. package/components/input/input.js.map +1 -1
  124. package/components/input/themes/shared/input.bootstrap.css.js +1 -1
  125. package/components/input/themes/shared/input.bootstrap.css.js.map +1 -1
  126. package/components/input/themes/shared/input.common.css.js +1 -1
  127. package/components/input/themes/shared/input.common.css.js.map +1 -1
  128. package/components/input/themes/shared/input.fluent.css.js +1 -1
  129. package/components/input/themes/shared/input.fluent.css.js.map +1 -1
  130. package/components/input/themes/shared/input.indigo.css.js +1 -1
  131. package/components/input/themes/shared/input.indigo.css.js.map +1 -1
  132. package/components/input/themes/shared/input.material.css.js +1 -1
  133. package/components/input/themes/shared/input.material.css.js.map +1 -1
  134. package/components/mask-input/mask-input-base.js +1 -0
  135. package/components/mask-input/mask-input-base.js.map +1 -1
  136. package/components/mask-input/mask-input.d.ts +2 -3
  137. package/components/mask-input/mask-input.js +5 -8
  138. package/components/mask-input/mask-input.js.map +1 -1
  139. package/components/nav-drawer/nav-drawer-item.d.ts +3 -4
  140. package/components/nav-drawer/nav-drawer-item.js +15 -18
  141. package/components/nav-drawer/nav-drawer-item.js.map +1 -1
  142. package/components/nav-drawer/nav-drawer.d.ts +1 -2
  143. package/components/nav-drawer/nav-drawer.js +9 -11
  144. package/components/nav-drawer/nav-drawer.js.map +1 -1
  145. package/components/nav-drawer/themes/container.base.css.js +1 -1
  146. package/components/nav-drawer/themes/container.base.css.js.map +1 -1
  147. package/components/nav-drawer/themes/shared/container/nav-drawer.common.css.js +1 -1
  148. package/components/nav-drawer/themes/shared/container/nav-drawer.common.css.js.map +1 -1
  149. package/components/popover/popover.d.ts +17 -16
  150. package/components/popover/popover.js +81 -91
  151. package/components/popover/popover.js.map +1 -1
  152. package/components/progress/base.d.ts +8 -8
  153. package/components/progress/base.js +19 -23
  154. package/components/progress/base.js.map +1 -1
  155. package/components/progress/circular-gradient.js.map +1 -1
  156. package/components/progress/circular-progress.d.ts +3 -4
  157. package/components/progress/circular-progress.js +15 -18
  158. package/components/progress/circular-progress.js.map +1 -1
  159. package/components/progress/linear-progress.d.ts +1 -0
  160. package/components/progress/linear-progress.js +5 -1
  161. package/components/progress/linear-progress.js.map +1 -1
  162. package/components/radio/radio.d.ts +3 -5
  163. package/components/radio/radio.js +33 -31
  164. package/components/radio/radio.js.map +1 -1
  165. package/components/radio/themes/dark/radio.fluent.css.js +1 -1
  166. package/components/radio/themes/dark/radio.fluent.css.js.map +1 -1
  167. package/components/radio/themes/shared/radio.bootstrap.css.js +1 -1
  168. package/components/radio/themes/shared/radio.bootstrap.css.js.map +1 -1
  169. package/components/radio/themes/shared/radio.common.css.js +1 -1
  170. package/components/radio/themes/shared/radio.common.css.js.map +1 -1
  171. package/components/radio/themes/shared/radio.fluent.css.js +1 -1
  172. package/components/radio/themes/shared/radio.fluent.css.js.map +1 -1
  173. package/components/radio/themes/shared/radio.indigo.css.js +1 -1
  174. package/components/radio/themes/shared/radio.indigo.css.js.map +1 -1
  175. package/components/radio/themes/shared/radio.material.css.js +1 -1
  176. package/components/radio/themes/shared/radio.material.css.js.map +1 -1
  177. package/components/radio-group/radio-group.d.ts +4 -4
  178. package/components/radio-group/radio-group.js +24 -21
  179. package/components/radio-group/radio-group.js.map +1 -1
  180. package/components/rating/rating.d.ts +1 -2
  181. package/components/rating/rating.js +4 -3
  182. package/components/rating/rating.js.map +1 -1
  183. package/components/select/select.d.ts +35 -38
  184. package/components/select/select.js +138 -146
  185. package/components/select/select.js.map +1 -1
  186. package/components/select/themes/shared/select.bootstrap.css.js +1 -1
  187. package/components/select/themes/shared/select.bootstrap.css.js.map +1 -1
  188. package/components/select/themes/shared/select.common.css.js +1 -1
  189. package/components/select/themes/shared/select.common.css.js.map +1 -1
  190. package/components/select/themes/shared/select.fluent.css.js +1 -1
  191. package/components/select/themes/shared/select.fluent.css.js.map +1 -1
  192. package/components/select/themes/shared/select.indigo.css.js +1 -1
  193. package/components/select/themes/shared/select.indigo.css.js.map +1 -1
  194. package/components/select/themes/shared/select.material.css.js +1 -1
  195. package/components/select/themes/shared/select.material.css.js.map +1 -1
  196. package/components/slider/slider-label.js.map +1 -1
  197. package/components/slider/slider.d.ts +1 -2
  198. package/components/slider/slider.js +5 -2
  199. package/components/slider/slider.js.map +1 -1
  200. package/components/textarea/textarea.d.ts +13 -20
  201. package/components/textarea/textarea.js +66 -90
  202. package/components/textarea/textarea.js.map +1 -1
  203. package/components/textarea/themes/shared/textarea.bootstrap.css.js +1 -1
  204. package/components/textarea/themes/shared/textarea.bootstrap.css.js.map +1 -1
  205. package/components/textarea/themes/shared/textarea.common.css.js +1 -1
  206. package/components/textarea/themes/shared/textarea.common.css.js.map +1 -1
  207. package/components/textarea/themes/shared/textarea.fluent.css.js +1 -1
  208. package/components/textarea/themes/shared/textarea.fluent.css.js.map +1 -1
  209. package/components/textarea/themes/shared/textarea.indigo.css.js +1 -1
  210. package/components/textarea/themes/shared/textarea.indigo.css.js.map +1 -1
  211. package/components/textarea/themes/shared/textarea.material.css.js +1 -1
  212. package/components/textarea/themes/shared/textarea.material.css.js.map +1 -1
  213. package/components/tile-manager/position.js +2 -1
  214. package/components/tile-manager/position.js.map +1 -1
  215. package/components/tile-manager/tile.d.ts +8 -12
  216. package/components/tile-manager/tile.js +16 -37
  217. package/components/tile-manager/tile.js.map +1 -1
  218. package/components/validation-container/validation-container.d.ts +2 -1
  219. package/components/validation-container/validation-container.js +19 -14
  220. package/components/validation-container/validation-container.js.map +1 -1
  221. package/custom-elements.json +9346 -6470
  222. package/igniteui-webcomponents.css-data.json +1 -1
  223. package/igniteui-webcomponents.html-data.json +1 -1
  224. package/package.json +1 -1
  225. package/web-types.json +2 -2
@@ -6,7 +6,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  import { ContextProvider } from '@lit/context';
8
8
  import { html, LitElement, nothing } from 'lit';
9
- import { property, queryAll, queryAssignedElements, state, } from 'lit/decorators.js';
9
+ import { property, queryAll, state } from 'lit/decorators.js';
10
+ import { cache } from 'lit/directives/cache.js';
10
11
  import { createRef, ref } from 'lit/directives/ref.js';
11
12
  import { styleMap } from 'lit/directives/style-map.js';
12
13
  import { addThemingController } from '../../theming/theming-controller.js';
@@ -16,11 +17,12 @@ import { addGesturesController, } from '../common/controllers/gestures.js';
16
17
  import { addInternalsController } from '../common/controllers/internals.js';
17
18
  import { addKeybindings, arrowLeft, arrowRight, endKey, homeKey, } from '../common/controllers/key-bindings.js';
18
19
  import { createMutationController, } from '../common/controllers/mutation-observer.js';
20
+ import { addSlotController, setSlots, } from '../common/controllers/slot.js';
19
21
  import { watch } from '../common/decorators/watch.js';
20
22
  import { registerComponent } from '../common/definitions/register.js';
21
23
  import { EventEmitterMixin } from '../common/mixins/event-emitter.js';
22
24
  import { partMap } from '../common/part-map.js';
23
- import { addSafeEventListener, asNumber, createCounter, findElementFromEventPath, first, formatString, isLTR, last, wrap, } from '../common/util.js';
25
+ import { addSafeEventListener, asNumber, findElementFromEventPath, first, formatString, isEmpty, isLTR, last, wrap, } from '../common/util.js';
24
26
  import IgcIconComponent from '../icon/icon.js';
25
27
  import IgcCarouselIndicatorComponent from './carousel-indicator.js';
26
28
  import IgcCarouselIndicatorContainerComponent from './carousel-indicator-container.js';
@@ -28,40 +30,32 @@ import IgcCarouselSlideComponent from './carousel-slide.js';
28
30
  import { styles } from './themes/carousel.base.css.js';
29
31
  import { all } from './themes/container.js';
30
32
  import { styles as shared } from './themes/shared/carousel.common.css.js';
33
+ let nextId = 1;
34
+ const Slots = setSlots('indicator', 'previous-button', 'next-button');
31
35
  class IgcCarouselComponent extends EventEmitterMixin(LitElement) {
32
36
  static register() {
33
37
  registerComponent(IgcCarouselComponent, IgcCarouselIndicatorComponent, IgcCarouselIndicatorContainerComponent, IgcCarouselSlideComponent, IgcIconComponent, IgcButtonComponent);
34
38
  }
35
- get hasProjectedIndicators() {
36
- return this._projectedIndicators.length > 0;
39
+ get _hasProjectedIndicators() {
40
+ return !isEmpty(this._projectedIndicators);
37
41
  }
38
- get showIndicatorsLabel() {
42
+ get _showIndicatorsLabel() {
39
43
  return this.total > this.maximumIndicatorsCount;
40
44
  }
41
- get nextIndex() {
45
+ get _nextIndex() {
42
46
  return wrap(0, this.total - 1, this.current + 1);
43
47
  }
44
- get prevIndex() {
48
+ get _previousIndex() {
45
49
  return wrap(0, this.total - 1, this.current - 1);
46
50
  }
47
- _observerCallback({ changes: { added, attributes }, }) {
48
- const activeSlides = this.slides.filter((slide) => slide.active);
49
- if (activeSlides.length <= 1) {
50
- return;
51
- }
52
- const idx = this.slides.indexOf(added.length ? last(added).node : last(attributes).node);
53
- for (const [i, slide] of this.slides.entries()) {
54
- if (slide.active && i !== idx) {
55
- slide.active = false;
56
- }
57
- }
58
- this.activateSlide(this.slides[idx]);
51
+ get slides() {
52
+ return Array.from(this._slides);
59
53
  }
60
54
  get total() {
61
- return this.slides.length;
55
+ return this._slides.length;
62
56
  }
63
57
  get current() {
64
- return Math.max(0, this.slides.indexOf(this._activeSlide));
58
+ return Math.max(0, this._slides.indexOf(this._activeSlide));
65
59
  }
66
60
  get isPlaying() {
67
61
  return this._playing;
@@ -69,22 +63,30 @@ class IgcCarouselComponent extends EventEmitterMixin(LitElement) {
69
63
  get isPaused() {
70
64
  return this._paused;
71
65
  }
72
- contextChanged() {
66
+ _contextChanged() {
73
67
  this._context.setValue(this, true);
74
68
  }
75
- intervalChange() {
69
+ _intervalChange() {
76
70
  if (!this.isPlaying) {
77
71
  this._playing = true;
78
72
  }
79
- this.restartInterval();
73
+ this._restartInterval();
80
74
  }
81
75
  constructor() {
82
76
  super();
83
- this._carouselId = `igc-carousel-${IgcCarouselComponent.increment()}`;
77
+ this._carouselId = `igc-carousel-${nextId++}`;
84
78
  this._paused = false;
85
79
  this._hasKeyboardInteractionOnIndicators = false;
86
80
  this._hasPointerInteraction = false;
87
81
  this._hasInnerFocus = false;
82
+ this._slides = [];
83
+ this._projectedIndicators = [];
84
+ this._playing = false;
85
+ this._slots = addSlotController(this, {
86
+ slots: Slots,
87
+ onChange: this._handleSlotChange,
88
+ initial: true,
89
+ });
88
90
  this._context = new ContextProvider(this, {
89
91
  context: carouselContext,
90
92
  initialValue: this,
@@ -93,7 +95,6 @@ class IgcCarouselComponent extends EventEmitterMixin(LitElement) {
93
95
  this._indicatorsContainerRef = createRef();
94
96
  this._prevButtonRef = createRef();
95
97
  this._nextButtonRef = createRef();
96
- this._playing = false;
97
98
  this.disableLoop = false;
98
99
  this.disablePauseOnInteraction = false;
99
100
  this.hideNavigation = false;
@@ -111,34 +112,34 @@ class IgcCarouselComponent extends EventEmitterMixin(LitElement) {
111
112
  },
112
113
  });
113
114
  addThemingController(this, all);
114
- addSafeEventListener(this, 'pointerenter', this.handlePointerInteraction);
115
- addSafeEventListener(this, 'pointerleave', this.handlePointerInteraction);
116
- addSafeEventListener(this, 'focusin', this.handleFocusInteraction);
117
- addSafeEventListener(this, 'focusout', this.handleFocusInteraction);
115
+ addSafeEventListener(this, 'pointerenter', this._handlePointerInteraction);
116
+ addSafeEventListener(this, 'pointerleave', this._handlePointerInteraction);
117
+ addSafeEventListener(this, 'focusin', this._handleFocusInteraction);
118
+ addSafeEventListener(this, 'focusout', this._handleFocusInteraction);
118
119
  addGesturesController(this, {
119
120
  ref: this._carouselSlidesContainerRef,
120
121
  touchOnly: true,
121
122
  })
122
- .set('swipe-left', this.handleHorizontalSwipe)
123
- .set('swipe-right', this.handleHorizontalSwipe)
124
- .set('swipe-up', this.handleVerticalSwipe)
125
- .set('swipe-down', this.handleVerticalSwipe);
123
+ .set('swipe-left', this._handleHorizontalSwipe)
124
+ .set('swipe-right', this._handleHorizontalSwipe)
125
+ .set('swipe-up', this._handleVerticalSwipe)
126
+ .set('swipe-down', this._handleVerticalSwipe);
126
127
  addKeybindings(this, {
127
128
  ref: this._indicatorsContainerRef,
128
129
  bindingDefaults: { preventDefault: true },
129
130
  })
130
- .set(arrowLeft, this.handleArrowLeft)
131
- .set(arrowRight, this.handleArrowRight)
132
- .set(homeKey, this.handleHomeKey)
133
- .set(endKey, this.handleEndKey);
131
+ .set(arrowLeft, this._handleArrowLeft)
132
+ .set(arrowRight, this._handleArrowRight)
133
+ .set(homeKey, this._handleHomeKey)
134
+ .set(endKey, this._handleEndKey);
134
135
  addKeybindings(this, {
135
136
  ref: this._prevButtonRef,
136
137
  bindingDefaults: { preventDefault: true },
137
- }).setActivateHandler(this.handleNavigationInteractionPrevious);
138
+ }).setActivateHandler(this._handleNavigationInteractionPrevious);
138
139
  addKeybindings(this, {
139
140
  ref: this._nextButtonRef,
140
141
  bindingDefaults: { preventDefault: true },
141
- }).setActivateHandler(this.handleNavigationInteractionNext);
142
+ }).setActivateHandler(this._handleNavigationInteractionNext);
142
143
  createMutationController(this, {
143
144
  callback: this._observerCallback,
144
145
  filter: [IgcCarouselSlideComponent.tagName],
@@ -149,64 +150,82 @@ class IgcCarouselComponent extends EventEmitterMixin(LitElement) {
149
150
  },
150
151
  });
151
152
  }
152
- handleSlotChange() {
153
- if (this.total) {
154
- this.activateSlide(this.slides.findLast((slide) => slide.active) ?? first(this.slides));
153
+ async firstUpdated() {
154
+ await this.updateComplete;
155
+ if (!isEmpty(this._slides)) {
156
+ this._activateSlide(this._slides.findLast((slide) => slide.active) ?? first(this._slides));
157
+ }
158
+ }
159
+ _observerCallback({ changes: { added, attributes }, }) {
160
+ const activeSlides = this._slides.filter((slide) => slide.active);
161
+ if (activeSlides.length <= 1) {
162
+ return;
155
163
  }
164
+ const idx = this._slides.indexOf(added.length ? last(added).node : last(attributes).node);
165
+ for (const [i, slide] of this._slides.entries()) {
166
+ if (slide.active && i !== idx) {
167
+ slide.active = false;
168
+ }
169
+ }
170
+ this._activateSlide(this._slides[idx]);
156
171
  }
157
- handleIndicatorSlotChange() {
158
- this.requestUpdate();
172
+ _handleSlotChange(params) {
173
+ if (params.isDefault || params.isInitial) {
174
+ this._slides = this._slots.getAssignedElements('[default]', {
175
+ selector: IgcCarouselSlideComponent.tagName,
176
+ });
177
+ }
178
+ if (params.slot === 'indicator') {
179
+ this._projectedIndicators = this._slots.getAssignedElements('indicator', {
180
+ selector: IgcCarouselIndicatorComponent.tagName,
181
+ });
182
+ }
159
183
  }
160
- handlePointerInteraction(event) {
184
+ _handlePointerInteraction(event) {
161
185
  this._hasPointerInteraction = event.type === 'pointerenter';
162
186
  if (!this._hasInnerFocus) {
163
- this.handlePauseOnInteraction();
187
+ this._handlePauseOnInteraction();
164
188
  }
165
189
  }
166
- handleFocusInteraction(event) {
190
+ _handleFocusInteraction(event) {
167
191
  const node = event.relatedTarget;
168
192
  if (this.contains(node)) {
169
193
  return;
170
194
  }
171
195
  this._hasInnerFocus = event.type === 'focusin';
172
196
  if (!this._hasPointerInteraction) {
173
- this.handlePauseOnInteraction();
197
+ this._handlePauseOnInteraction();
174
198
  }
175
199
  }
176
- handlePauseOnInteraction() {
177
- if (!this.interval || this.disablePauseOnInteraction)
178
- return;
179
- if (this.isPlaying) {
180
- this.pause();
181
- this.emitEvent('igcPaused');
182
- }
183
- else {
184
- this.play();
185
- this.emitEvent('igcPlaying');
186
- }
200
+ async _handleIndicatorClick(event) {
201
+ const indicator = findElementFromEventPath(IgcCarouselIndicatorComponent.tagName, event);
202
+ const index = this._hasProjectedIndicators
203
+ ? this._projectedIndicators.indexOf(indicator)
204
+ : Array.from(this._defaultIndicators).indexOf(indicator);
205
+ this._handleInteraction(() => this.select(this._slides[index], index > this.current ? 'next' : 'prev'));
187
206
  }
188
- async handleArrowLeft() {
207
+ async _handleArrowLeft() {
189
208
  this._hasKeyboardInteractionOnIndicators = true;
190
- this.handleInteraction(isLTR(this) ? this.prev : this.next);
209
+ this._handleInteraction(isLTR(this) ? this.prev : this.next);
191
210
  }
192
- async handleArrowRight() {
211
+ async _handleArrowRight() {
193
212
  this._hasKeyboardInteractionOnIndicators = true;
194
- this.handleInteraction(isLTR(this) ? this.next : this.prev);
213
+ this._handleInteraction(isLTR(this) ? this.next : this.prev);
195
214
  }
196
- async handleHomeKey() {
215
+ async _handleHomeKey() {
197
216
  this._hasKeyboardInteractionOnIndicators = true;
198
- this.handleInteraction(() => this.select(isLTR(this) ? first(this.slides) : last(this.slides)));
217
+ this._handleInteraction(() => this.select(isLTR(this) ? first(this._slides) : last(this._slides)));
199
218
  }
200
- async handleEndKey() {
219
+ async _handleEndKey() {
201
220
  this._hasKeyboardInteractionOnIndicators = true;
202
- this.handleInteraction(() => this.select(isLTR(this) ? last(this.slides) : first(this.slides)));
221
+ this._handleInteraction(() => this.select(isLTR(this) ? last(this._slides) : first(this._slides)));
203
222
  }
204
- handleVerticalSwipe({ data: { direction } }) {
223
+ _handleVerticalSwipe({ data: { direction } }) {
205
224
  if (this.vertical) {
206
- this.handleInteraction(direction === 'up' ? this.next : this.prev);
225
+ this._handleInteraction(direction === 'up' ? this.next : this.prev);
207
226
  }
208
227
  }
209
- handleHorizontalSwipe({ data: { direction } }) {
228
+ _handleHorizontalSwipe({ data: { direction } }) {
210
229
  if (!this.vertical) {
211
230
  const callback = () => {
212
231
  if (isLTR(this)) {
@@ -214,68 +233,75 @@ class IgcCarouselComponent extends EventEmitterMixin(LitElement) {
214
233
  }
215
234
  return direction === 'left' ? this.prev : this.next;
216
235
  };
217
- this.handleInteraction(callback());
236
+ this._handleInteraction(callback());
218
237
  }
219
238
  }
220
- async handleIndicatorClick(event) {
221
- const indicator = findElementFromEventPath(IgcCarouselIndicatorComponent.tagName, event);
222
- const index = this.hasProjectedIndicators
223
- ? this._projectedIndicators.indexOf(indicator)
224
- : Array.from(this._defaultIndicators).indexOf(indicator);
225
- this.handleInteraction(() => this.select(this.slides[index], index > this.current ? 'next' : 'prev'));
226
- }
227
- handleNavigationInteractionNext() {
228
- this.handleInteraction(this.next);
239
+ _handleNavigationInteractionNext() {
240
+ this._handleInteraction(this.next);
229
241
  }
230
- handleNavigationInteractionPrevious() {
231
- this.handleInteraction(this.prev);
242
+ _handleNavigationInteractionPrevious() {
243
+ this._handleInteraction(this.prev);
232
244
  }
233
- async handleInteraction(callback) {
245
+ async _handleInteraction(callback) {
234
246
  if (this.interval) {
235
- this.resetInterval();
247
+ this._resetInterval();
236
248
  }
237
249
  if (await callback.call(this)) {
238
250
  this.emitEvent('igcSlideChanged', { detail: this.current });
239
251
  }
240
252
  if (this.interval) {
241
- this.restartInterval();
253
+ this._restartInterval();
242
254
  }
243
255
  }
244
- activateSlide(slide) {
256
+ _handlePauseOnInteraction() {
257
+ if (!this.interval || this.disablePauseOnInteraction)
258
+ return;
259
+ if (this.isPlaying) {
260
+ this.pause();
261
+ this.emitEvent('igcPaused');
262
+ }
263
+ else {
264
+ this.play();
265
+ this.emitEvent('igcPlaying');
266
+ }
267
+ }
268
+ _activateSlide(slide) {
245
269
  if (this._activeSlide) {
246
270
  this._activeSlide.active = false;
247
271
  }
248
272
  this._activeSlide = slide;
249
273
  this._activeSlide.active = true;
250
274
  if (this._hasKeyboardInteractionOnIndicators) {
251
- this.hasProjectedIndicators
275
+ this._hasProjectedIndicators
252
276
  ? this._projectedIndicators[this.current].focus()
253
277
  : this._defaultIndicators[this.current].focus();
254
278
  this._hasKeyboardInteractionOnIndicators = false;
255
279
  }
256
280
  }
257
- updateProjectedIndicators() {
258
- for (const [idx, slide] of this.slides.entries()) {
281
+ _updateProjectedIndicators() {
282
+ for (const [idx, slide] of this._slides.entries()) {
259
283
  const indicator = this._projectedIndicators[idx];
260
284
  indicator.active = slide.active;
261
285
  indicator.index = idx;
262
- this.setAttribute('aria-controls', slide.id);
286
+ }
287
+ if (this._activeSlide) {
288
+ this.setAttribute('aria-controls', this._activeSlide.id);
263
289
  }
264
290
  }
265
- resetInterval() {
291
+ _resetInterval() {
266
292
  if (this._lastInterval) {
267
293
  clearInterval(this._lastInterval);
268
294
  this._lastInterval = null;
269
295
  }
270
296
  }
271
- restartInterval() {
272
- this.resetInterval();
297
+ _restartInterval() {
298
+ this._resetInterval();
273
299
  if (asNumber(this.interval) > 0) {
274
300
  this._lastInterval = setInterval(() => {
275
301
  if (this.isPlaying &&
276
302
  this.total &&
277
- !(this.disableLoop && this.nextIndex === 0)) {
278
- this.select(this.slides[this.nextIndex], 'next');
303
+ !(this.disableLoop && this._nextIndex === 0)) {
304
+ this.select(this.slides[this._nextIndex], 'next');
279
305
  this.emitEvent('igcSlideChanged', { detail: this.current });
280
306
  }
281
307
  else {
@@ -284,18 +310,18 @@ class IgcCarouselComponent extends EventEmitterMixin(LitElement) {
284
310
  }, this.interval);
285
311
  }
286
312
  }
287
- async animateSlides(nextSlide, currentSlide, dir) {
313
+ async _animateSlides(nextSlide, currentSlide, dir) {
288
314
  if (dir === 'next') {
289
315
  currentSlide.previous = true;
290
316
  currentSlide.toggleAnimation('out');
291
- this.activateSlide(nextSlide);
317
+ this._activateSlide(nextSlide);
292
318
  await nextSlide.toggleAnimation('in');
293
319
  currentSlide.previous = false;
294
320
  }
295
321
  else {
296
322
  currentSlide.previous = true;
297
323
  currentSlide.toggleAnimation('in', 'reverse');
298
- this.activateSlide(nextSlide);
324
+ this._activateSlide(nextSlide);
299
325
  await nextSlide.toggleAnimation('out', 'reverse');
300
326
  currentSlide.previous = false;
301
327
  }
@@ -304,49 +330,49 @@ class IgcCarouselComponent extends EventEmitterMixin(LitElement) {
304
330
  if (!this.isPlaying) {
305
331
  this._paused = false;
306
332
  this._playing = true;
307
- this.restartInterval();
333
+ this._restartInterval();
308
334
  }
309
335
  }
310
336
  pause() {
311
337
  if (this.isPlaying) {
312
338
  this._playing = false;
313
339
  this._paused = true;
314
- this.resetInterval();
340
+ this._resetInterval();
315
341
  }
316
342
  }
317
343
  async next() {
318
- if (this.disableLoop && this.nextIndex === 0) {
344
+ if (this.disableLoop && this._nextIndex === 0) {
319
345
  this.pause();
320
346
  return false;
321
347
  }
322
- return await this.select(this.slides[this.nextIndex], 'next');
348
+ return await this.select(this._slides[this._nextIndex], 'next');
323
349
  }
324
350
  async prev() {
325
- if (this.disableLoop && this.prevIndex === this.total - 1) {
351
+ if (this.disableLoop && this._previousIndex === this.total - 1) {
326
352
  this.pause();
327
353
  return false;
328
354
  }
329
- return await this.select(this.slides[this.prevIndex], 'prev');
355
+ return await this.select(this._slides[this._previousIndex], 'prev');
330
356
  }
331
357
  async select(slideOrIndex, animationDirection) {
332
358
  let index;
333
359
  let slide;
334
360
  if (typeof slideOrIndex === 'number') {
335
361
  index = slideOrIndex;
336
- slide = this.slides.at(index);
362
+ slide = this._slides.at(index);
337
363
  }
338
364
  else {
339
365
  slide = slideOrIndex;
340
- index = this.slides.indexOf(slide);
366
+ index = this._slides.indexOf(slide);
341
367
  }
342
368
  if (index === this.current || index === -1 || !slide) {
343
369
  return false;
344
370
  }
345
371
  const dir = animationDirection ?? (index > this.current ? 'next' : 'prev');
346
- await this.animateSlides(slide, this._activeSlide, dir);
372
+ await this._animateSlides(slide, this._activeSlide, dir);
347
373
  return true;
348
374
  }
349
- navigationTemplate() {
375
+ _renderNavigation() {
350
376
  return html `
351
377
  <igc-button
352
378
  ${ref(this._prevButtonRef)}
@@ -355,7 +381,7 @@ class IgcCarouselComponent extends EventEmitterMixin(LitElement) {
355
381
  aria-label="Previous slide"
356
382
  aria-controls=${this._carouselId}
357
383
  ?disabled=${this.disableLoop && this.current === 0}
358
- @click=${this.handleNavigationInteractionPrevious}
384
+ @click=${this._handleNavigationInteractionPrevious}
359
385
  >
360
386
  <slot name="previous-button">
361
387
  <igc-icon
@@ -365,6 +391,7 @@ class IgcCarouselComponent extends EventEmitterMixin(LitElement) {
365
391
  ></igc-icon>
366
392
  </slot>
367
393
  </igc-button>
394
+
368
395
  <igc-button
369
396
  ${ref(this._nextButtonRef)}
370
397
  type="button"
@@ -372,7 +399,7 @@ class IgcCarouselComponent extends EventEmitterMixin(LitElement) {
372
399
  aria-label="Next slide"
373
400
  aria-controls=${this._carouselId}
374
401
  ?disabled=${this.disableLoop && this.current === this.total - 1}
375
- @click=${this.handleNavigationInteractionNext}
402
+ @click=${this._handleNavigationInteractionNext}
376
403
  >
377
404
  <slot name="next-button">
378
405
  <igc-icon
@@ -384,8 +411,8 @@ class IgcCarouselComponent extends EventEmitterMixin(LitElement) {
384
411
  </igc-button>
385
412
  `;
386
413
  }
387
- *renderIndicators() {
388
- for (const [i, slide] of this.slides.entries()) {
414
+ *_renderIndicators() {
415
+ for (const [i, slide] of this._slides.entries()) {
389
416
  const forward = slide.active ? 'visible' : 'hidden';
390
417
  const backward = slide.active ? 'hidden' : 'visible';
391
418
  yield html `
@@ -407,7 +434,7 @@ class IgcCarouselComponent extends EventEmitterMixin(LitElement) {
407
434
  `;
408
435
  }
409
436
  }
410
- indicatorTemplate() {
437
+ _renderIndicatorContainer() {
411
438
  const parts = {
412
439
  indicators: true,
413
440
  start: this.indicatorsOrientation === 'start',
@@ -419,20 +446,16 @@ class IgcCarouselComponent extends EventEmitterMixin(LitElement) {
419
446
  role="tablist"
420
447
  part=${partMap(parts)}
421
448
  >
422
- <slot
423
- name="indicator"
424
- @slotchange=${this.handleIndicatorSlotChange}
425
- @click=${this.handleIndicatorClick}
426
- >
427
- ${this.hasProjectedIndicators
428
- ? this.updateProjectedIndicators()
429
- : this.renderIndicators()}
449
+ <slot name="indicator" @click=${this._handleIndicatorClick}>
450
+ ${cache(this._hasProjectedIndicators
451
+ ? this._updateProjectedIndicators()
452
+ : this._renderIndicators())}
430
453
  </slot>
431
454
  </div>
432
455
  </igc-carousel-indicator-container>
433
456
  `;
434
457
  }
435
- labelTemplate() {
458
+ _renderLabel() {
436
459
  const parts = {
437
460
  label: true,
438
461
  indicators: true,
@@ -446,21 +469,19 @@ class IgcCarouselComponent extends EventEmitterMixin(LitElement) {
446
469
  `;
447
470
  }
448
471
  render() {
472
+ const hasNoIndicators = this.hideIndicators || this._showIndicatorsLabel;
473
+ const hasLabel = !this.hideIndicators && this._showIndicatorsLabel;
449
474
  return html `
450
475
  <section>
451
- ${this.hideNavigation ? nothing : this.navigationTemplate()}
452
- ${this.hideIndicators || this.showIndicatorsLabel
453
- ? nothing
454
- : this.indicatorTemplate()}
455
- ${!this.hideIndicators && this.showIndicatorsLabel
456
- ? this.labelTemplate()
457
- : nothing}
476
+ ${cache(this.hideNavigation ? nothing : this._renderNavigation())}
477
+ ${hasNoIndicators ? nothing : this._renderIndicatorContainer()}
478
+ ${hasLabel ? this._renderLabel() : nothing}
458
479
  <div
459
480
  ${ref(this._carouselSlidesContainerRef)}
460
481
  id=${this._carouselId}
461
482
  aria-live=${this.interval && this._playing ? 'off' : 'polite'}
462
483
  >
463
- <slot @slotchange=${this.handleSlotChange}></slot>
484
+ <slot></slot>
464
485
  </div>
465
486
  </section>
466
487
  `;
@@ -468,23 +489,16 @@ class IgcCarouselComponent extends EventEmitterMixin(LitElement) {
468
489
  }
469
490
  IgcCarouselComponent.styles = [styles, shared];
470
491
  IgcCarouselComponent.tagName = 'igc-carousel';
471
- IgcCarouselComponent.increment = createCounter();
472
492
  export default IgcCarouselComponent;
473
- __decorate([
474
- queryAll(IgcCarouselIndicatorComponent.tagName)
475
- ], IgcCarouselComponent.prototype, "_defaultIndicators", void 0);
476
- __decorate([
477
- queryAssignedElements({
478
- selector: IgcCarouselIndicatorComponent.tagName,
479
- slot: 'indicator',
480
- })
481
- ], IgcCarouselComponent.prototype, "_projectedIndicators", void 0);
482
493
  __decorate([
483
494
  state()
484
495
  ], IgcCarouselComponent.prototype, "_activeSlide", void 0);
485
496
  __decorate([
486
497
  state()
487
498
  ], IgcCarouselComponent.prototype, "_playing", void 0);
499
+ __decorate([
500
+ queryAll(IgcCarouselIndicatorComponent.tagName)
501
+ ], IgcCarouselComponent.prototype, "_defaultIndicators", void 0);
488
502
  __decorate([
489
503
  property({ type: Boolean, reflect: true, attribute: 'disable-loop' })
490
504
  ], IgcCarouselComponent.prototype, "disableLoop", void 0);
@@ -505,7 +519,7 @@ __decorate([
505
519
  property({ type: Boolean, reflect: true })
506
520
  ], IgcCarouselComponent.prototype, "vertical", void 0);
507
521
  __decorate([
508
- property({ reflect: false, attribute: 'indicators-orientation' })
522
+ property({ attribute: 'indicators-orientation' })
509
523
  ], IgcCarouselComponent.prototype, "indicatorsOrientation", void 0);
510
524
  __decorate([
511
525
  property({ attribute: 'indicators-label-format' })
@@ -514,27 +528,20 @@ __decorate([
514
528
  property({ attribute: 'slides-label-format' })
515
529
  ], IgcCarouselComponent.prototype, "slidesLabelFormat", void 0);
516
530
  __decorate([
517
- property({ type: Number, reflect: false })
531
+ property({ type: Number })
518
532
  ], IgcCarouselComponent.prototype, "interval", void 0);
519
533
  __decorate([
520
- property({
521
- type: Number,
522
- reflect: false,
523
- attribute: 'maximum-indicators-count',
524
- })
534
+ property({ type: Number, attribute: 'maximum-indicators-count' })
525
535
  ], IgcCarouselComponent.prototype, "maximumIndicatorsCount", void 0);
526
536
  __decorate([
527
537
  property({ attribute: 'animation-type' })
528
538
  ], IgcCarouselComponent.prototype, "animationType", void 0);
529
- __decorate([
530
- queryAssignedElements({ selector: IgcCarouselSlideComponent.tagName })
531
- ], IgcCarouselComponent.prototype, "slides", void 0);
532
539
  __decorate([
533
540
  watch('animationType'),
534
541
  watch('slidesLabelFormat'),
535
542
  watch('indicatorsLabelFormat')
536
- ], IgcCarouselComponent.prototype, "contextChanged", null);
543
+ ], IgcCarouselComponent.prototype, "_contextChanged", null);
537
544
  __decorate([
538
545
  watch('interval')
539
- ], IgcCarouselComponent.prototype, "intervalChange", null);
546
+ ], IgcCarouselComponent.prototype, "_intervalChange", null);
540
547
  //# sourceMappingURL=carousel.js.map