@momentum-design/components 0.122.5 → 0.122.7

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 (36) hide show
  1. package/dist/browser/index.js +428 -409
  2. package/dist/browser/index.js.map +4 -4
  3. package/dist/components/list/list.component.d.ts +12 -17
  4. package/dist/components/list/list.component.js +29 -39
  5. package/dist/components/listitem/listitem.component.d.ts +10 -0
  6. package/dist/components/listitem/listitem.component.js +7 -0
  7. package/dist/components/popover/popover.component.d.ts +7 -0
  8. package/dist/components/popover/popover.component.js +13 -0
  9. package/dist/components/popover/popover.constants.d.ts +1 -0
  10. package/dist/components/popover/popover.constants.js +1 -0
  11. package/dist/components/virtualizedlist/virtualizedlist.component.d.ts +244 -41
  12. package/dist/components/virtualizedlist/virtualizedlist.component.js +597 -78
  13. package/dist/components/virtualizedlist/virtualizedlist.constants.d.ts +7 -4
  14. package/dist/components/virtualizedlist/virtualizedlist.constants.js +7 -4
  15. package/dist/components/virtualizedlist/virtualizedlist.styles.js +17 -3
  16. package/dist/components/virtualizedlist/virtualizedlist.types.d.ts +12 -10
  17. package/dist/components/virtualizedlist/virtualizedlist.utils.d.ts +11 -0
  18. package/dist/components/virtualizedlist/virtualizedlist.utils.js +23 -0
  19. package/dist/custom-elements.json +2778 -1975
  20. package/dist/react/index.d.ts +7 -7
  21. package/dist/react/index.js +7 -7
  22. package/dist/react/virtualizedlist/index.d.ts +44 -6
  23. package/dist/react/virtualizedlist/index.js +44 -6
  24. package/dist/utils/mixins/AutoFocusOnMountMixin.js +2 -2
  25. package/dist/utils/mixins/ListNavigationMixin.d.ts +5 -2
  26. package/dist/utils/mixins/ListNavigationMixin.js +77 -68
  27. package/dist/utils/mixins/lifecycle/LifeCycleMixin.js +4 -0
  28. package/dist/utils/mixins/lifecycle/lifecycle.contants.d.ts +1 -0
  29. package/dist/utils/mixins/lifecycle/lifecycle.contants.js +1 -0
  30. package/dist/utils/range.d.ts +40 -0
  31. package/dist/utils/range.js +66 -0
  32. package/dist/utils/virtualIndexArray.d.ts +27 -0
  33. package/dist/utils/virtualIndexArray.js +42 -0
  34. package/package.json +2 -2
  35. package/dist/components/virtualizedlist/virtualizedlist.helper.test.d.ts +0 -22
  36. package/dist/components/virtualizedlist/virtualizedlist.helper.test.js +0 -82
@@ -1,5 +1,8 @@
1
1
  import type { CSSResult } from 'lit';
2
2
  import { Component } from '../../models';
3
+ import { ElementStoreChangeTypes } from '../../utils/controllers/ElementStore';
4
+ import type ListItem from '../listitem';
5
+ import type { BaseArray } from '../../utils/virtualIndexArray';
3
6
  declare const List_base: import("../../utils/mixins/index.types").Constructor<Component & import("../../utils/mixins/ListNavigationMixin").ListNavigationMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/lifecycle/CaptureDestroyEventForChildElement").CaptureDestroyEventForChildElementInterface> & typeof Component;
4
7
  /**
5
8
  * mdc-list component is used to display a group of list items. It is used as a container to wrap other list items.
@@ -25,39 +28,31 @@ declare class List extends List_base {
25
28
  * and pressing the up arrow on the first item will focus the last item.
26
29
  * If 'false', navigation will stop at the first or last item.
27
30
  *
28
- * @default ''
31
+ * @default 'true'
29
32
  */
30
33
  loop: 'true' | 'false';
31
34
  /**
32
35
  * The index of the item that should receive focus when the list is first rendered.
33
- * If the index is out of bounds, the first item (index 0) will receive focus.
36
+ * If the index is out of bounds, the focused element will be clamped to the nearest valid index.
34
37
  *
35
38
  * @default 0
36
39
  */
37
40
  initialFocus: number;
41
+ /** @internal */
42
+ protected focusWithin: boolean;
38
43
  constructor();
39
44
  connectedCallback(): void;
40
45
  /**
41
46
  * @internal
42
47
  */
43
- get navItems(): HTMLElement[];
44
- /**
45
- * Update the tabIndex of the list items when a new item is added.
46
- *
47
- * @internal
48
- */
49
- private handleCreatedEvent;
50
- /**
51
- * Update the focus when an item is removed.
52
- * If there is a next item, focus it. If not, focus the previous item.
53
- *
54
- * @internal
55
- */
56
- private handleDestroyEvent;
48
+ protected get navItems(): BaseArray<HTMLElement>;
49
+ protected onElementStoreUpdate(item: ListItem, changeType: ElementStoreChangeTypes, index: number): void;
50
+ /** @internal */
51
+ private handleFocusEvent;
57
52
  /** @internal */
58
53
  private handleModifiedEvent;
59
54
  /** @internal */
60
- private isValidItem;
55
+ protected isValidItem(item: Element): boolean;
61
56
  render(): import("lit-html").TemplateResult<1>;
62
57
  static styles: Array<CSSResult>;
63
58
  }
@@ -40,49 +40,18 @@ class List extends ListNavigationMixin(CaptureDestroyEventForChildElement(Compon
40
40
  * and pressing the up arrow on the first item will focus the last item.
41
41
  * If 'false', navigation will stop at the first or last item.
42
42
  *
43
- * @default ''
43
+ * @default 'true'
44
44
  */
45
45
  this.loop = DEFAULTS.LOOP;
46
46
  /**
47
47
  * The index of the item that should receive focus when the list is first rendered.
48
- * If the index is out of bounds, the first item (index 0) will receive focus.
48
+ * If the index is out of bounds, the focused element will be clamped to the nearest valid index.
49
49
  *
50
50
  * @default 0
51
51
  */
52
52
  this.initialFocus = DEFAULTS.INITIAL_FOCUS;
53
- /**
54
- * Update the tabIndex of the list items when a new item is added.
55
- *
56
- * @internal
57
- */
58
- this.handleCreatedEvent = (event) => {
59
- const createdElement = event.target;
60
- if (!this.isValidItem(createdElement)) {
61
- return;
62
- }
63
- createdElement.tabIndex = -1;
64
- };
65
- /**
66
- * Update the focus when an item is removed.
67
- * If there is a next item, focus it. If not, focus the previous item.
68
- *
69
- * @internal
70
- */
71
- this.handleDestroyEvent = (event) => {
72
- const destroyedElement = event.detail.originalTarget;
73
- if (!this.isValidItem(destroyedElement) || destroyedElement.tabIndex !== 0) {
74
- return;
75
- }
76
- const destroyedItemIndex = this.navItems.findIndex(node => node === destroyedElement);
77
- if (destroyedItemIndex === -1) {
78
- return;
79
- }
80
- let newIndex = destroyedItemIndex + 1;
81
- if (newIndex >= this.navItems.length) {
82
- newIndex = destroyedItemIndex - 1;
83
- }
84
- this.resetTabIndexes(newIndex);
85
- };
53
+ /** @internal */
54
+ this.focusWithin = false;
86
55
  /** @internal */
87
56
  this.handleModifiedEvent = (event) => {
88
57
  const item = event.target;
@@ -97,19 +66,19 @@ class List extends ListNavigationMixin(CaptureDestroyEventForChildElement(Compon
97
66
  break;
98
67
  }
99
68
  };
100
- this.addEventListener(LIFE_CYCLE_EVENTS.CREATED, this.handleCreatedEvent);
101
69
  this.addEventListener(LIFE_CYCLE_EVENTS.MODIFIED, this.handleModifiedEvent);
102
- this.addEventListener(LIFE_CYCLE_EVENTS.DESTROYED, this.handleDestroyEvent);
70
+ this.addEventListener('focusin', this.handleFocusEvent);
71
+ this.addEventListener('focusout', this.handleFocusEvent);
103
72
  // This must be initialized after the destroyed event listener
104
73
  // to keep the element in the itemStore in order to move the focus correctly
105
74
  this.itemsStore = new ElementStore(this, {
106
75
  isValidItem: this.isValidItem,
76
+ onStoreUpdate: this.onElementStoreUpdate.bind(this),
107
77
  });
108
78
  }
109
79
  connectedCallback() {
110
80
  super.connectedCallback();
111
- // Set the role attribute for accessibility.
112
- this.setAttribute('role', ROLE.LIST);
81
+ this.role = ROLE.LIST;
113
82
  }
114
83
  /**
115
84
  * @internal
@@ -117,6 +86,27 @@ class List extends ListNavigationMixin(CaptureDestroyEventForChildElement(Compon
117
86
  get navItems() {
118
87
  return this.itemsStore.items;
119
88
  }
89
+ onElementStoreUpdate(item, changeType, index) {
90
+ if (changeType === 'added') {
91
+ // Update the tabIndex of the list items when a new item is added.
92
+ // eslint-disable-next-line no-param-reassign
93
+ item.tabIndex = -1;
94
+ }
95
+ else if (changeType === 'removed' && item.tabIndex === 0) {
96
+ let newIndex = index + 1;
97
+ if (newIndex >= this.navItems.length) {
98
+ newIndex = index - 1;
99
+ }
100
+ this.resetTabIndexes(newIndex, this.focusWithin);
101
+ }
102
+ }
103
+ /** @internal */
104
+ handleFocusEvent(event) {
105
+ // If previously focused element is being removed from the DOM, ignore the focusout event
106
+ if (!(event.type === 'focusout' && event.relatedTarget === null)) {
107
+ this.focusWithin = event.type === 'focusin';
108
+ }
109
+ }
120
110
  /** @internal */
121
111
  isValidItem(item) {
122
112
  return item.matches(`${LISTITEM_TAGNAME}:not([disabled])`);
@@ -106,6 +106,16 @@ declare class ListItem extends ListItem_base {
106
106
  * @default undefined
107
107
  */
108
108
  softDisabled?: boolean;
109
+ /**
110
+ * Data attribute to define the index of the list item in a list.
111
+ * This also set the `aria-posinset` attribute for accessibility purposes.
112
+ *
113
+ * It is required when the list item is used inside a virtualized list where the items are not sequentially rendered.
114
+ * It should be a zero-based index.
115
+ *
116
+ * @default undefined
117
+ */
118
+ dataIndex?: number;
109
119
  constructor();
110
120
  connectedCallback(): void;
111
121
  /**
@@ -183,6 +183,9 @@ class ListItem extends DisabledMixin(TabIndexMixin(LifeCycleMixin(Component))) {
183
183
  if (changedProperties.has('softDisabled')) {
184
184
  this.disableSlottedChildren(this.softDisabled);
185
185
  }
186
+ if (changedProperties.has('dataIndex')) {
187
+ this.ariaPosInSet = `${this.dataIndex !== undefined ? this.dataIndex + 1 : ''}`;
188
+ }
186
189
  }
187
190
  /**
188
191
  * Renders the trailing controls slot.
@@ -280,4 +283,8 @@ __decorate([
280
283
  property({ type: Boolean, reflect: true, attribute: 'soft-disabled' }),
281
284
  __metadata("design:type", Boolean)
282
285
  ], ListItem.prototype, "softDisabled", void 0);
286
+ __decorate([
287
+ property({ type: Number, reflect: true, attribute: 'data-index' }),
288
+ __metadata("design:type", Number)
289
+ ], ListItem.prototype, "dataIndex", void 0);
283
290
  export default ListItem;
@@ -323,6 +323,13 @@ declare class Popover extends Popover_base {
323
323
  * Useful for scenarios where both a popover and a tooltip are linked to the same trigger element.
324
324
  */
325
325
  keepConnectedTooltipOpen: boolean;
326
+ /**
327
+ * Whether to update the position of the Popover on every animation frame if required.
328
+ * While optimized for performance, it should be used sparingly and with caution.
329
+ *
330
+ * @default false
331
+ */
332
+ animationFrame: boolean;
326
333
  arrowElement: HTMLElement | null;
327
334
  /** @internal */
328
335
  private hoverTimer;
@@ -337,6 +337,13 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
337
337
  * Useful for scenarios where both a popover and a tooltip are linked to the same trigger element.
338
338
  */
339
339
  this.keepConnectedTooltipOpen = DEFAULTS.KEEP_CONNECTED_TOOLTIP_OPEN;
340
+ /**
341
+ * Whether to update the position of the Popover on every animation frame if required.
342
+ * While optimized for performance, it should be used sparingly and with caution.
343
+ *
344
+ * @default false
345
+ */
346
+ this.animationFrame = DEFAULTS.ANIMATION_FRAME;
340
347
  this.arrowElement = null;
341
348
  /** @internal */
342
349
  this.hoverTimer = null;
@@ -661,6 +668,8 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
661
668
  if (this.trigger.includes('mouseenter')) {
662
669
  this.utils.setupHoverBridge(placement);
663
670
  }
671
+ }, {
672
+ animationFrame: this.animationFrame,
664
673
  });
665
674
  };
666
675
  this.utils = new PopoverUtils(this);
@@ -1057,4 +1066,8 @@ __decorate([
1057
1066
  property({ type: Boolean, reflect: true, attribute: 'keep-connected-tooltip-open' }),
1058
1067
  __metadata("design:type", Boolean)
1059
1068
  ], Popover.prototype, "keepConnectedTooltipOpen", void 0);
1069
+ __decorate([
1070
+ property({ type: Boolean, reflect: true, attribute: 'animation-frame' }),
1071
+ __metadata("design:type", Boolean)
1072
+ ], Popover.prototype, "animationFrame", void 0);
1060
1073
  export default Popover;
@@ -56,5 +56,6 @@ declare const DEFAULTS: {
56
56
  readonly PROPAGATE_EVENT_ON_ESCAPE: false;
57
57
  readonly KEEP_CONNECTED_TOOLTIP_OPEN: false;
58
58
  readonly IS_BACKDROP_INVISIBLE: true;
59
+ readonly ANIMATION_FRAME: false;
59
60
  };
60
61
  export { TAG_NAME, POPOVER_PLACEMENT, COLOR, STRATEGY, TRIGGER, DEFAULTS };
@@ -58,5 +58,6 @@ const DEFAULTS = {
58
58
  PROPAGATE_EVENT_ON_ESCAPE: false,
59
59
  KEEP_CONNECTED_TOOLTIP_OPEN: false,
60
60
  IS_BACKDROP_INVISIBLE: true,
61
+ ANIMATION_FRAME: false,
61
62
  };
62
63
  export { TAG_NAME, POPOVER_PLACEMENT, COLOR, STRATEGY, TRIGGER, DEFAULTS };
@@ -1,91 +1,294 @@
1
- import { CSSResult, PropertyValues, TemplateResult } from 'lit';
2
- import { Virtualizer, VirtualItem } from '@tanstack/virtual-core';
3
- import { Ref } from 'lit/directives/ref.js';
4
- import { Component } from '../../models';
5
- import { SetListDataProps, VirtualizerProps } from './virtualizedlist.types';
1
+ import { type CSSResult, type PropertyValues } from 'lit';
2
+ import { type Range, ScrollToOptions, type VirtualItem } from '@tanstack/virtual-core';
3
+ import List from '../list/list.component';
4
+ import type { ElementStoreChangeTypes } from '../../utils/controllers/ElementStore';
5
+ import { type BaseArray } from '../../utils/virtualIndexArray';
6
+ import { VirtualizerProps, Virtualizer } from './virtualizedlist.types';
7
+ declare const VirtualizedList_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DataAriaLabelMixin").DataAriaLabelMixinInterface> & typeof List;
6
8
  /**
7
- * `mdc-virtualizedlist` component for creating custom virtualized lists.
8
- * IMPORTANT: This component does not create it's own list/list items.
9
- * Use the setlistdata callback prop to update client state in order to
10
- * Pass list/listitems as a child of this component, which this will virtuailze
11
- * This implementation handles dynamic lists as well as fixed sized lists.
9
+ * `mdc-virtualizedlist` is an extension of the `mdc-list` component that adds virtualization capabilities using
10
+ * the Tanstack Virtual library.
11
+ *
12
+ * This component is thin wrapper around the Tanstack libray to provide additional funtionalities such as
13
+ * keyboard navigation, focus management, scroll anchoring and accessibility features.
14
+ *
12
15
  * Please refer to [Tanstack Virtual Docs](https://tanstack.com/virtual/latest) for more in depth documentation.
13
16
  *
17
+ * ## Setup
18
+ *
19
+ * `virtualizerProps` is a required prop that requires at least two properties to be set: `count` and `estimateSize`.
20
+ * `count` is the total number of items in the list, and `estimateSize` is a function that returns the estimated
21
+ * size (in pixels) of each item in the list. `getItemKey` is also strongly recommended to be set to provide unique
22
+ * keys for each item in the list.
23
+ *
24
+ * ### Render list items
25
+ *
26
+ * To keep the component framework-agnostic, the rendering of the list items is left to the consumer.
27
+ *
28
+ * We need to render only the visible items. The list of visible items are provided by the `virtualitemschange` event.
29
+ * The event detail contains the `virtualItems` array, which contains the information for the rendering.
30
+ * List items must have an `data-index` attribute, the indexes are in the `virtualItems` list.
31
+ *
32
+ * ## Best practices
33
+ *
34
+ * ### List updates
35
+ *
36
+ * Tanstack needs only the count of the items in the list and the size of each item to perform virtualization.
37
+ * List updates happens when
38
+ * - when `virtualizerProps` property of the component instance changes
39
+ * - when `observe-size-changes` is set and the item's size changes (it uses ResizeObserver internally)
40
+ * - when `component.visualiser.measure` called manually.
41
+ *
42
+ * ### Header
43
+ *
44
+ * To add a header to the list, use the `mdc-listheader` component and place it in the `list-header` slot.
45
+ *
46
+ * ### Lists with dynamic content
47
+ *
48
+ * Unique keys for the list items are critical for dynamically changing list items or item's content.
49
+ * If the key change with the content it will cause scrollbar and content shuttering.
50
+ *
14
51
  * @tagname mdc-virtualizedlist
15
52
  *
16
53
  * @event scroll - (React: onScroll) Event that gets called when user scrolls inside of list.
54
+ * @event virtualitemschange - (React: onVirtualItemsChange) Event that gets called when the virtual items change.
17
55
  *
18
- * @slot - Client side List with nested list items.
56
+ * @slot default - This is a default/unnamed slot, where listitems can be placed.
57
+ * @slot list-header - This slot is used to pass a header for the list, which can be a `mdc-listheader` component.
19
58
  *
20
59
  * @csspart container - The container of the virtualized list.
21
60
  * @csspart scroll - The scrollable area of the virtualized list.
22
61
  */
23
- declare class VirtualizedList extends Component {
62
+ declare class VirtualizedList extends VirtualizedList_base {
24
63
  /**
25
64
  * Object that sets and updates the virtualizer with any relevant props.
26
- * There are two required object props in order to get virtualization to work properly.
27
- * count - The length of your list that you are virtualizing.
65
+ * There are three required object props in order to get virtualization to work properly.
66
+ *
67
+ * **count** - The length of your list that you are virtualizing.
28
68
  * As your list grows/shrinks, this component must be updated with the appropriate value
29
69
  * (Same with any other updated prop).
30
- * estimateSize - A function that returns the estimated size of your items.
70
+ *
71
+ * **estimateSize** - A function that returns the estimated size of your items.
31
72
  * If your list is fixed, this will just be the size of your items.
32
73
  * If your list is dynamic, try to return approximate the size of each item.
33
74
  *
75
+ * **getItemKey** - A function that returns a unique key for each item in your list based on its index.
76
+ *
34
77
  * A full list of possible props can be in
35
78
  * [Tanstack Virtualizer API Docs](https://tanstack.com/virtual/latest/docs/api/virtualizer)
36
79
  *
37
80
  */
38
81
  virtualizerProps: VirtualizerProps;
39
82
  /**
40
- * Callback that gets envoked when updates to the virtualizer interally occur.
41
- * This must be implemented in such a way that this function will trigger update to parent.
83
+ * Whether to loop navigation when reaching the end of the list.
84
+ * If 'true', pressing the down arrow on the last item will focus the first item,
85
+ * and pressing the up arrow on the first item will focus the last item.
86
+ * If 'false', navigation will stop at the first or last item.
87
+ *
88
+ * @default 'false'
89
+ */
90
+ loop: 'true' | 'false';
91
+ /**
92
+ * Enable automatic scroll anchoring when the list size changes.
93
+ * By default, list does not scroll to the very end it keeps the scroll position otherwise
94
+ * it try hold the scroll position on the last selected when list updates.
95
+ *
96
+ * It is handy when list size or list item sizes change dynamically (e.g., incoming messages in a chat app).
42
97
  *
43
- * virtualItems - Array that will be what the client displays on screen. Use this to render
44
- * a List of your choosing with these items nested inside as your ListItems.
45
- * measureElement - Ref to pass to each ListItem rendered client side.
46
- * Each ListItem should also be be passed key and a data-index (which can be found on the virtualItem).
47
- * listStyle - This should be passed as the style attribute to your List.
98
+ * @default false
99
+ */
100
+ scrollAnchoring: boolean;
101
+ /**
102
+ * When true, the list will observe size changes of its items and re-measure them as needed.
103
+ * This is useful if your list items can change size dynamically (e.g., due to content changes or window resizing).
48
104
  */
49
- setlistdata: (({ virtualItems, measureElement, listStyle }: SetListDataProps) => void) | null;
105
+ observeSizeChanges: boolean;
106
+ /**
107
+ * When true, the list items will be aligned to the bottom of the list, and it anchors scroll to the bottom
108
+ * until the first user scroll interaction.
109
+ *
110
+ * Note: It does not affect on the rendering order, the first item is still at the top of the list.
111
+ */
112
+ revertList: boolean;
113
+ /**
114
+ * The maximum gap (in pixels) between the very bottom of the list end the current scroll positioning
115
+ * It is used to calculate scroll anchoring.
116
+ */
117
+ atBottomThreshold: number;
118
+ /**
119
+ * The virtualizer instance created by the VirtualizerController.
120
+ */
121
+ virtualizer: Virtualizer | null;
122
+ /**
123
+ * The current virtual items being rendered.
124
+ */
125
+ get virtualItems(): VirtualItem[];
126
+ /**
127
+ * @internal
128
+ */
129
+ private virtualizedNavItems;
130
+ /**
131
+ * @internal
132
+ */
133
+ protected get navItems(): BaseArray<HTMLElement>;
134
+ /**
135
+ * A ref to the scrollable element within the list.
136
+ * @internal
137
+ */
138
+ private scrollRef;
139
+ /**
140
+ * Container wrapper ref
141
+ * @internal
142
+ */
143
+ private wrapperRef;
144
+ /**
145
+ * The container element that holds the virtualized list items.
146
+ * @internal
147
+ */
148
+ private containerRef;
50
149
  /**
51
150
  * @internal
52
151
  */
53
152
  private virtualizerController;
54
- scrollElementRef: Ref<HTMLDivElement>;
55
- virtualizer: Virtualizer<Element, Element> | null;
56
- virtualItems: Array<VirtualItem>;
153
+ /**
154
+ * The currently selected index in the list.
155
+ * If keyboard navigation is being used, this will be the focused item.
156
+ * If the list is clicked, this will be the last clicked item.
157
+ * @internal
158
+ */
159
+ private selectedIndex;
160
+ /**
161
+ * The key of the currently selected item.
162
+ * This is used to keep track where the selected item goes when the list changes size.
163
+ * @internal
164
+ */
165
+ private selectedKey;
166
+ /**
167
+ * The index of the first item in the current virtual items.
168
+ * @internal
169
+ */
170
+ private firstIndex;
171
+ /**
172
+ * The key of the first item in the current virtual items.
173
+ * @internal
174
+ */
175
+ private firstKey;
176
+ /**
177
+ * The indexes of items that are not in the current virtual items, but need to be rendered for focus purposes.
178
+ * @internal
179
+ */
180
+ private hiddenIndexes;
181
+ /**
182
+ * Is the scroll position at the bottom of the list?
183
+ *
184
+ * - 'no' - The scroll position is not at the bottom of the list.
185
+ * - 'yes' - The scroll position is at the bottom of the list.
186
+ * - 're-evaluate' - The scroll position needs to be re-evaluated on the next scroll event.
187
+ * @internal
188
+ */
189
+ private atBottomValue;
190
+ /**
191
+ * Getter for atBottom
192
+ * @internal
193
+ */
194
+ private get atBottom();
195
+ /**
196
+ * Setter for atBottom to handle side effects when the value changes.
197
+ * @param value - new value for atBottom
198
+ *
199
+ * @internal
200
+ */
201
+ private set atBottom(value);
202
+ /**
203
+ * rAF ID for the scroll to bottom action when atBottom is 'yes'.
204
+ * @internal
205
+ */
206
+ private atBottomTimer;
207
+ /**
208
+ * The total height of the list based on the virtualizer's calculations.
209
+ * @internal
210
+ */
211
+ private get totalListHeight();
212
+ /**
213
+ * Last recorded scroll position to help determine scroll direction.
214
+ * @internal
215
+ */
216
+ private lastScrollPosition;
217
+ /**
218
+ * List of functions executed aster the virtualizer finishes scrolling.
219
+ * @internal
220
+ */
221
+ private endOfScrollQueue;
57
222
  constructor();
223
+ /**
224
+ * Create the virtualizer controller and the virtualizer instance when the component is first connected to the DOM.
225
+ */
226
+ connectedCallback(): void;
227
+ disconnectedCallback(): void;
58
228
  /**
59
229
  * This override is necessary to update the virtualizer with relevant props
60
230
  * if the client updates any props (most commonly, count). Updating the options
61
231
  * this way ensures we don't initialize a new virtualizer upon very prop change.
62
232
  */
63
- update(changedProperties: PropertyValues): void;
233
+ update(changedProperties: PropertyValues<this>): Promise<void>;
234
+ /**
235
+ * Handles updates to the virtualizerProps property.
236
+ * @param prevProps - The previous virtualizerProps before the update.
237
+ * @internal
238
+ */
239
+ handleVirtualizerPropsUpdate(prevProps: VirtualizerProps): Promise<void>;
64
240
  /**
65
- * This is needed in order to ensure the initial render happens
241
+ * Sets the initial focus of the list based on the `initial-focus` prop and scrolls the item into view.
66
242
  */
67
- firstUpdated(changedProperties: PropertyValues): void;
243
+ protected setInitialFocus(): void;
244
+ private emitChangeEvent;
68
245
  /**
246
+ * Calculates the array of indexes to render. We add the selected index (and +1/-1) if it's
247
+ * outside the current range so the focus can be kept correctly.
248
+ *
249
+ * @param range - The current range of items being rendered
250
+ * @returns An array of indexes to render, including the selected index if it's outside the current range.
69
251
  * @internal
70
- * Update virtuailzer with the union of the two virtualizer options (current, passed in).
71
252
  */
72
- private setVirtualizerOptions;
73
- connectedCallback(): void;
253
+ protected virtualizerRangeExtractor(range: Range): number[];
254
+ /** @internal */
255
+ private updateHiddenItemsPosition;
256
+ /** @internal */
257
+ private isElementSelected;
258
+ /** @internal */
259
+ private setSelectedIndex;
260
+ protected onElementStoreUpdate(item: HTMLElement, changeType: ElementStoreChangeTypes): void;
261
+ protected handleElementFirstUpdateCompleted: (event: Event) => void;
74
262
  /**
263
+ * Handle the virtualizer's onChange event to emit the virtualitemschange event
264
+ * This is called when the internal state of the virtualizer changes.
265
+ *
75
266
  * @internal
76
- * Renders the list wrapper and invokes the callback which eventually will render in the slot.
77
- * Uses getTotalSize to update the height of the wrapper. This value is equal to the total size
78
- * OR the total estimated size (if you haven't physically scrolled the entire list)
79
- * Passes the virtualItems, measureElement, and listStyle to callback for client to pass in as child
267
+ */
268
+ protected onVListStateChangeHandler(_: Virtualizer, isScrolling: boolean): Promise<void>;
269
+ /**
270
+ * Refires the scroll event from the internal scroll container to the host element.
271
+ * Also updates whether the scroll is at the bottom of the list for scroll anchoring purposes.
80
272
  *
81
- * @returns The template result containing the list wrapper.
273
+ * @internal
82
274
  */
83
- private getVirtualizedListWrapper;
275
+ private onScrollHandler;
276
+ private checkAtBottom;
277
+ protected handleNavigationKeyDown(event: KeyboardEvent): void;
278
+ protected resetTabIndexes(index: number, focusElement?: boolean): void;
279
+ protected resetTabIndexAndSetFocus(newIndex: number, oldIndex?: number, focusNewItem?: boolean): void;
280
+ /** @internal */
281
+ private setAriaSetSize;
84
282
  /**
85
- * Refires the scroll event from the internal scroll container to the host element
283
+ * Scrolls to the bottom of the list if `atBottom` is 'yes'.
284
+ * @internal
86
285
  */
87
- private handleScroll;
88
- render(): TemplateResult<1>;
286
+ private scrollToBottom;
287
+ private clearScrollToBottomTimer;
288
+ scrollToIndex(index: number, options?: ScrollToOptions): void;
289
+ private syncUI;
290
+ private handleWheelEvent;
291
+ render(): import("lit-html").TemplateResult<1>;
89
292
  static styles: Array<CSSResult>;
90
293
  }
91
294
  export default VirtualizedList;