@momentum-design/components 0.133.1 → 0.133.2

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.
@@ -6385,6 +6385,26 @@
6385
6385
  justify-content: var(--mdc-tab-content-justification);
6386
6386
  }
6387
6387
 
6388
+ :host::part(icon-container) {
6389
+ position: relative;
6390
+ }
6391
+
6392
+ :host([active])::part(regular-icon) {
6393
+ display: none;
6394
+ }
6395
+
6396
+ :host([active])::part(filled-icon) {
6397
+ display: block;
6398
+ }
6399
+
6400
+ :host::part(regular-icon) {
6401
+ display: block;
6402
+ }
6403
+
6404
+ :host::part(filled-icon) {
6405
+ display: none;
6406
+ }
6407
+
6388
6408
  :host::part(leading),
6389
6409
  :host::part(trailing) {
6390
6410
  display: flex;
@@ -6554,11 +6574,26 @@
6554
6574
  --mdc-tab-background-color: var(--mds-color-theme-button-secondary-active-normal);
6555
6575
  --mdc-tab-color: var(--mds-color-theme-text-primary-disabled);
6556
6576
  }
6557
- `,...yt()],Ty=DS;var Io=class extends le(Wd(ue)){constructor(){super(...arguments);this.active=pc.ACTIVE;this.variant=pc.VARIANT;this.handleTabActiveChange=t=>{let e=new CustomEvent("activechange",{detail:{tabId:this.tabId,active:t},bubbles:!0});this.dispatchEvent(e)}}connectedCallback(){super.connectedCallback(),this.role=tt.TAB,this.size=void 0,this.type=void 0,this.ariaStateKey="aria-selected",!this.tabId&&this.onerror&&this.onerror("tab id is required")}modifyIconName(t){this.iconName&&(t?(this.prevIconName=this.iconName,this.iconName=`${Ho(this.iconName)}-filled`):this.prevIconName&&(this.iconName=this.prevIconName))}setVariant(t){this.setAttribute("variant",Object.values(dm).includes(t)?t:pc.VARIANT)}setActive(t,e){super.setActive(t,e),this.modifyIconName(e)}executeAction(){this.handleTabActiveChange(this.active)}update(t){super.update(t),t.has("variant")&&this.setVariant(this.variant)}render(){return S`
6577
+ `,...yt()],Ty=DS;var Io=class extends le(Wd(ue)){constructor(){super(...arguments);this.active=pc.ACTIVE;this.variant=pc.VARIANT;this.handleTabActiveChange=t=>{let e=new CustomEvent("activechange",{detail:{tabId:this.tabId,active:t},bubbles:!0});this.dispatchEvent(e)}}connectedCallback(){super.connectedCallback(),this.role=tt.TAB,this.size=void 0,this.type=void 0,this.ariaStateKey="aria-selected",!this.tabId&&this.onerror&&this.onerror("tab id is required")}setVariant(t){this.setAttribute("variant",Object.values(dm).includes(t)?t:pc.VARIANT)}getFilledIconName(){return!this.iconName||this.iconName.endsWith("-filled")?void 0:`${Ho(this.iconName)}-filled`}executeAction(){this.handleTabActiveChange(this.active)}update(t){super.update(t),t.has("variant")&&this.setVariant(this.variant)}render(){return S`
6558
6578
  <div part="container">
6559
6579
  <div part="leading">
6560
6580
  <slot name="prefix">
6561
- ${this.iconName?S` <mdc-icon name="${this.iconName}" size="1" length-unit="rem" part="icon"></mdc-icon>`:K}
6581
+ ${this.iconName?S`
6582
+ <div part="icon-container">
6583
+ <mdc-icon
6584
+ name="${this.iconName}"
6585
+ size="1"
6586
+ length-unit="rem"
6587
+ part="regular-icon"
6588
+ ></mdc-icon>
6589
+ <mdc-icon
6590
+ name="${J(this.getFilledIconName())}"
6591
+ size="1"
6592
+ length-unit="rem"
6593
+ part="filled-icon"
6594
+ ></mdc-icon>
6595
+ </div>
6596
+ `:K}
6562
6597
  </slot>
6563
6598
  ${this.text?S` <mdc-text
6564
6599
  type=${this.active?ot.BODY_MIDSIZE_BOLD:ot.BODY_MIDSIZE_MEDIUM}
@@ -7425,7 +7460,7 @@
7425
7460
  ::slotted(mdc-listitem) {
7426
7461
  position: relative;
7427
7462
  }
7428
- `],Yy=tI;var jy=z.constructTagName("virtualizedlist"),Srt=z.constructTagName("virtualizedwrapper"),jn={VIRTUALIZER_PROPS:{count:0,estimateSize:()=>0,getItemKey:n=>n},LOOP:"false",SCROLL_ANCHORING:!1,IS_AT_BOTTOM_THRESHOLD:16};var dr=class extends Wt(Pi){constructor(){super();this.virtualizerProps=jn.VIRTUALIZER_PROPS;this.loop=jn.LOOP;this.scrollAnchoring=jn.SCROLL_ANCHORING;this.observeSizeChanges=!1;this.revertList=!1;this.atBottomThreshold=jn.IS_AT_BOTTOM_THRESHOLD;this.virtualizer=null;this.virtualizedNavItems=null;this.virtualizerController=null;this.selectedIndex=this.initialFocus;this.selectedKey=null;this.firstIndex=0;this.firstKey=null;this.hiddenIndexes=[];this.atBottomValue="no";this.atBottomTimer=-1;this.lastScrollPosition=0;this.endOfScrollQueue=[];this.resizeObserver=null;this.handleElementFirstUpdateCompleted=t=>{var e,o;this.observeSizeChanges&&this.navItems.find(l=>l===t.target)!==void 0&&((o=(e=this.virtualizer)==null?void 0:e.measureElement)==null||o.call(e,t.target))};this.orientation=kn.VERTICAL,this.addEventListener("wheel",this.handleWheelEvent.bind(this)),this.addEventListener(Jt.FIRST_UPDATE_COMPLETED,this.handleElementFirstUpdateCompleted.bind(this))}get virtualItems(){var t,e;return(e=(t=this.virtualizer)==null?void 0:t.getVirtualItems())!=null?e:[]}get navItems(){var t,e,o,l;if(((t=this.virtualizedNavItems)==null?void 0:t.items)!==super.navItems){let c=(l=(o=(e=this.virtualizer)==null?void 0:e.options)==null?void 0:o.indexAttribute)!=null?l:"data-index";this.virtualizedNavItems=new xc(super.navItems,f=>Number(f.getAttribute(c)),()=>this.virtualizerProps.count)}return this.virtualizedNavItems}get atBottom(){return this.atBottomValue}set atBottom(t){(this.atBottomValue!==t||t==="yes"&&this.atBottomTimer===-1)&&(this.atBottomValue=t,t==="yes"?this.scrollToBottom():this.clearScrollToBottomTimer())}get totalListHeight(){var t,e;return(e=(t=this.virtualizer)==null?void 0:t.getTotalSize())!=null?e:0}connectedCallback(){this.virtualizerController=new Ec(this,{...this.virtualizerProps,horizontal:!1,getScrollElement:()=>this.scrollRef,onChange:this.onVListStateChangeHandler.bind(this),rangeExtractor:this.virtualizerRangeExtractor.bind(this)}),this.virtualizer=this.virtualizerController.getVirtualizer(),super.connectedCallback(),this.role=null,this.atBottom=this.revertList&&this.scrollAnchoring?"yes":"no",this.resizeObserver=new ResizeObserver(this.handleResizeObserverCallback.bind(this)),this.resizeObserver.observe(this)}disconnectedCallback(){super.disconnectedCallback(),this.clearScrollToBottomTimer(),this.virtualizerController=null,this.virtualizer=null,this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}async update(t){super.update(t),t.has("orientation")&&this.orientation!==kn.VERTICAL&&(this.orientation=kn.VERTICAL),t.has("virtualizerProps")&&await this.handleVirtualizerPropsUpdate(t.get("virtualizerProps")),t.has("observeSizeChanges")&&this.navItems.forEach(e=>{var o,l;this.observeSizeChanges&&((l=(o=this.virtualizer)==null?void 0:o.measureElement)==null||l.call(o,e))}),t.has("scrollAnchoring")&&(this.scrollAnchoring?this.checkAtBottom():this.atBottom="no"),t.has("revertList")&&this.revertList&&this.scrollAnchoring&&(this.atBottom="yes"),t.has("atBottomThreshold")&&this.scrollAnchoring&&this.checkAtBottom()}async handleVirtualizerPropsUpdate(t){var l,c;let{virtualizer:e}=this;if(!e)return;let o=e.measurementsCache.slice();if(e.setOptions({...e.options,...this.virtualizerProps}),this.virtualizerProps.count!==(t==null?void 0:t.count)&&(this.emitChangeEvent(),this.syncUI()),this.scrollAnchoring&&o.length>0){let f=Math.abs(this.virtualizerProps.count-((l=t==null?void 0:t.count)!=null?l:0)),y=this.selectedIndex,A=this.firstKey,F=new Tc(y-f,y+f,{includeEnd:!0}),W=(c=Array.from(F).find(Z=>e.options.getItemKey(Z)===this.selectedKey))!=null?c:this.selectedIndex;if(this.setSelectedIndex(W),this.requestUpdate(),await this.updateComplete,this.atBottom==="yes"){this.scrollToBottom();return}if(this.focusWithin&&y!==this.selectedIndex||!this.focusWithin&&this.firstKey!==A){let Z=e.measurementsCache[this.selectedIndex].end-o[y].end;this.scrollRef.scrollTop+=Z}}}setInitialFocus(){setTimeout(async()=>{if(!this.virtualizer)return;let{scrollToIndex:t}=this.virtualizer;if(this.setSelectedIndex(this.initialFocus),this.selectedIndex>=this.navItems.length)return;t(this.selectedIndex,{align:"center"}),this.navItems.find(this.isElementSelected,this)&&this.resetTabIndexes(this.selectedIndex,!1)},0)}emitChangeEvent(){var e,o,l,c,f;(o=(e=this.virtualizerProps).onChange)==null||o.call(e,this.virtualizer,this.virtualizer.isScrolling);let t={virtualizer:this.virtualizer,virtualItems:(f=(c=(l=this.virtualizer)==null?void 0:l.getVirtualItems)==null?void 0:c.call(l))!=null?f:[]};this.dispatchEvent(new CustomEvent("virtualitemschange",{detail:t,bubbles:!1,cancelable:!1}))}virtualizerRangeExtractor(t){var y,A,F,W;let{navItems:e,virtualizerProps:o,virtualizer:l}=this,c=(A=(y=o.rangeExtractor)==null?void 0:y.call(o,t))!=null?A:Im(t);return this.hiddenIndexes.forEach(Q=>{let Z=e.at(Q);Z&&(Z.removeAttribute("data-virtualized-hidden"),Z.style.removeProperty("--mdc-virtualizedlist-hidden-top"))}),this.firstIndex=t.startIndex,this.firstKey=(W=(F=this.virtualizer)==null?void 0:F.options.getItemKey(this.firstIndex))!=null?W:null,this.hiddenIndexes.length=0,[this.selectedIndex-1,this.selectedIndex,this.selectedIndex+1].forEach(Q=>{var Z;c.includes(Q)||(Q<t.startIndex&&Q>=0&&(c.unshift(Q),this.hiddenIndexes.push(Q)),Q>t.endIndex&&Q<((Z=l==null?void 0:l.options.count)!=null?Z:0)&&(c.push(Q),this.hiddenIndexes.push(Q)))}),this.updateHiddenItemsPosition(t),c.sort((Q,Z)=>Q-Z),c}updateHiddenItemsPosition(t){let{navItems:e,virtualizerProps:o,virtualizer:l}=this;if(!l||o.count===0)return;let{measurementsCache:c}=l;this.hiddenIndexes.forEach(f=>{let y=e.at(f);if(y){let A=Math.max(t.startIndex-t.overscan,0),F=c[A],W=c[f];y.setAttribute("data-virtualized-hidden","true"),y.style.setProperty("--mdc-virtualizedlist-hidden-top",`${W.start-F.start}px`)}})}isElementSelected(t){var e;return((e=this.virtualizer)==null?void 0:e.indexFromElement(t))===this.selectedIndex}setSelectedIndex(t){if(this.virtualizer){let{count:e,getItemKey:o}=this.virtualizer.options;this.selectedIndex=Math.max(0,Math.min(e-1,t)),this.selectedKey=o(t)}}onElementStoreUpdate(t,e){if(e==="added"){let o=this.isElementSelected(t);t.tabIndex=o?0:-1,this.setAriaSetSize(t)}else e==="removed"&&t.tabIndex===0&&queueMicrotask(()=>{this.resetTabIndexes(this.selectedIndex,this.focusWithin)})}async onVListStateChangeHandler(t,e){this.syncUI(),await this.updateComplete,this.requestUpdate(),!e&&this.endOfScrollQueue.length>0&&(this.endOfScrollQueue.forEach(o=>o()),this.endOfScrollQueue.length=0),this.checkAtBottom(),this.emitChangeEvent()}onScrollHandler(t){let e=t.target;this.atBottom==="re-evaluate"||e.scrollTop<this.lastScrollPosition?this.atBottom="no":this.checkAtBottom(),this.lastScrollPosition=e.scrollTop}checkAtBottom(){let{clientHeight:t,scrollHeight:e,scrollTop:o}=this.scrollRef;this.scrollAnchoring&&this.virtualizer&&this.atBottom==="no"&&e>t-this.atBottomThreshold&&!this.virtualizer.isScrolling&&(this.atBottom=e-o<=t+this.atBottomThreshold?"yes":"no")}handleNavigationKeyDown(t){var o,l,c,f;switch(this.getActionForKeyEvent(t)){case q.HOME:{(l=(o=this.virtualizer)==null?void 0:o.scrollToIndex)==null||l.call(o,0,{align:"start"}),this.endOfScrollQueue.push(()=>this.resetTabIndexes(0));break}case q.END:{let y=this.virtualizerProps.count-1;(f=(c=this.virtualizer)==null?void 0:c.scrollToIndex)==null||f.call(c,y,{align:"end"}),this.endOfScrollQueue.push(()=>this.resetTabIndexes(y));break}case q.UP:{this.atBottom="re-evaluate";break}default:}super.handleNavigationKeyDown(t)}resetTabIndexes(t,e=!0){super.resetTabIndexes(t,e),this.setSelectedIndex(t)}resetTabIndexAndSetFocus(t,e,o=!0,l=o){if(this.navItems.find(y=>{var A;return((A=this.virtualizer)==null?void 0:A.indexFromElement(y))===t})===void 0)return this.scrollToIndex(t,{}),this.endOfScrollQueue.push(()=>{super.resetTabIndexAndSetFocus(t,e,o,l),this.setSelectedIndex(t)}),!0;let f=super.resetTabIndexAndSetFocus(t,e,o,l);return this.setSelectedIndex(t),f}setAriaSetSize(t){var e,o;t.setAttribute("aria-setsize",`${(o=(e=this.virtualizer)==null?void 0:e.options.count)!=null?o:-1}`)}scrollToBottom(){if(this.clearScrollToBottomTimer(),this.atBottom==="yes"&&this.scrollRef){let{clientHeight:t,scrollHeight:e,scrollTop:o}=this.scrollRef;this.totalListHeight>t&&(this.scrollRef.scrollTop+=e-t-o),this.atBottomTimer=requestAnimationFrame(this.scrollToBottom.bind(this))}}clearScrollToBottomTimer(){cancelAnimationFrame(this.atBottomTimer),this.atBottomTimer=-1}scrollToIndex(t,e){var o,l;(l=(o=this.virtualizer).scrollToIndex)==null||l.call(o,t,e),this.atBottom=this.scrollAnchoring&&t+1===this.virtualizerProps.count?"yes":"no"}syncUI(){var l;let t=this.virtualItems.find(({index:c})=>!this.hiddenIndexes.includes(c)),e=(l=t==null?void 0:t.start)!=null?l:0;window.getComputedStyle(this);let o=0;this.revertList&&this.scrollRef.clientHeight>=this.totalListHeight&&(o=this.scrollRef.clientHeight-this.totalListHeight),this.wrapperRef.style.height=`${this.totalListHeight}px`,this.containerRef.style.transform=`translateY(${o+e}px)`}handleWheelEvent(t){t.deltaY<0&&(this.atBottom="re-evaluate")}handleResizeObserverCallback(){requestAnimationFrame(()=>{this.revertList&&this.scrollRef.clientHeight>=this.totalListHeight&&this.syncUI()})}render(){var t;return S`
7463
+ `],Yy=tI;var jy=z.constructTagName("virtualizedlist"),Irt=z.constructTagName("virtualizedwrapper"),jn={VIRTUALIZER_PROPS:{count:0,estimateSize:()=>0,getItemKey:n=>n},LOOP:"false",SCROLL_ANCHORING:!1,IS_AT_BOTTOM_THRESHOLD:16};var dr=class extends Wt(Pi){constructor(){super();this.virtualizerProps=jn.VIRTUALIZER_PROPS;this.loop=jn.LOOP;this.scrollAnchoring=jn.SCROLL_ANCHORING;this.observeSizeChanges=!1;this.revertList=!1;this.atBottomThreshold=jn.IS_AT_BOTTOM_THRESHOLD;this.virtualizer=null;this.virtualizedNavItems=null;this.virtualizerController=null;this.selectedIndex=this.initialFocus;this.selectedKey=null;this.firstIndex=0;this.firstKey=null;this.hiddenIndexes=[];this.atBottomValue="no";this.atBottomTimer=-1;this.lastScrollPosition=0;this.endOfScrollQueue=[];this.resizeObserver=null;this.handleElementFirstUpdateCompleted=t=>{var e,o;this.observeSizeChanges&&this.navItems.find(l=>l===t.target)!==void 0&&((o=(e=this.virtualizer)==null?void 0:e.measureElement)==null||o.call(e,t.target))};this.orientation=kn.VERTICAL,this.addEventListener("wheel",this.handleWheelEvent.bind(this)),this.addEventListener(Jt.FIRST_UPDATE_COMPLETED,this.handleElementFirstUpdateCompleted.bind(this))}get virtualItems(){var t,e;return(e=(t=this.virtualizer)==null?void 0:t.getVirtualItems())!=null?e:[]}get navItems(){var t,e,o,l;if(((t=this.virtualizedNavItems)==null?void 0:t.items)!==super.navItems){let c=(l=(o=(e=this.virtualizer)==null?void 0:e.options)==null?void 0:o.indexAttribute)!=null?l:"data-index";this.virtualizedNavItems=new xc(super.navItems,f=>Number(f.getAttribute(c)),()=>this.virtualizerProps.count)}return this.virtualizedNavItems}get atBottom(){return this.atBottomValue}set atBottom(t){(this.atBottomValue!==t||t==="yes"&&this.atBottomTimer===-1)&&(this.atBottomValue=t,t==="yes"?this.scrollToBottom():this.clearScrollToBottomTimer())}get totalListHeight(){var t,e;return(e=(t=this.virtualizer)==null?void 0:t.getTotalSize())!=null?e:0}connectedCallback(){this.virtualizerController=new Ec(this,{...this.virtualizerProps,horizontal:!1,getScrollElement:()=>this.scrollRef,onChange:this.onVListStateChangeHandler.bind(this),rangeExtractor:this.virtualizerRangeExtractor.bind(this)}),this.virtualizer=this.virtualizerController.getVirtualizer(),super.connectedCallback(),this.role=null,this.atBottom=this.revertList&&this.scrollAnchoring?"yes":"no",this.resizeObserver=new ResizeObserver(this.handleResizeObserverCallback.bind(this)),this.resizeObserver.observe(this)}disconnectedCallback(){super.disconnectedCallback(),this.clearScrollToBottomTimer(),this.virtualizerController=null,this.virtualizer=null,this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}async update(t){super.update(t),t.has("orientation")&&this.orientation!==kn.VERTICAL&&(this.orientation=kn.VERTICAL),t.has("virtualizerProps")&&await this.handleVirtualizerPropsUpdate(t.get("virtualizerProps")),t.has("observeSizeChanges")&&this.navItems.forEach(e=>{var o,l;this.observeSizeChanges&&((l=(o=this.virtualizer)==null?void 0:o.measureElement)==null||l.call(o,e))}),t.has("scrollAnchoring")&&(this.scrollAnchoring?this.checkAtBottom():this.atBottom="no"),t.has("revertList")&&this.revertList&&this.scrollAnchoring&&(this.atBottom="yes"),t.has("atBottomThreshold")&&this.scrollAnchoring&&this.checkAtBottom()}async handleVirtualizerPropsUpdate(t){var l,c;let{virtualizer:e}=this;if(!e)return;let o=e.measurementsCache.slice();if(e.setOptions({...e.options,...this.virtualizerProps}),this.virtualizerProps.count!==(t==null?void 0:t.count)&&(this.emitChangeEvent(),this.syncUI()),this.scrollAnchoring&&o.length>0){let f=Math.abs(this.virtualizerProps.count-((l=t==null?void 0:t.count)!=null?l:0)),y=this.selectedIndex,A=this.firstKey,F=new Tc(y-f,y+f,{includeEnd:!0}),W=(c=Array.from(F).find(Z=>e.options.getItemKey(Z)===this.selectedKey))!=null?c:this.selectedIndex;if(this.setSelectedIndex(W),this.requestUpdate(),await this.updateComplete,this.atBottom==="yes"){this.scrollToBottom();return}if(this.focusWithin&&y!==this.selectedIndex||!this.focusWithin&&this.firstKey!==A){let Z=e.measurementsCache[this.selectedIndex].end-o[y].end;this.scrollRef.scrollTop+=Z}}}setInitialFocus(){setTimeout(async()=>{if(!this.virtualizer)return;let{scrollToIndex:t}=this.virtualizer;if(this.setSelectedIndex(this.initialFocus),this.selectedIndex>=this.navItems.length)return;t(this.selectedIndex,{align:"center"}),this.navItems.find(this.isElementSelected,this)&&this.resetTabIndexes(this.selectedIndex,!1)},0)}emitChangeEvent(){var e,o,l,c,f;(o=(e=this.virtualizerProps).onChange)==null||o.call(e,this.virtualizer,this.virtualizer.isScrolling);let t={virtualizer:this.virtualizer,virtualItems:(f=(c=(l=this.virtualizer)==null?void 0:l.getVirtualItems)==null?void 0:c.call(l))!=null?f:[]};this.dispatchEvent(new CustomEvent("virtualitemschange",{detail:t,bubbles:!1,cancelable:!1}))}virtualizerRangeExtractor(t){var y,A,F,W;let{navItems:e,virtualizerProps:o,virtualizer:l}=this,c=(A=(y=o.rangeExtractor)==null?void 0:y.call(o,t))!=null?A:Im(t);return this.hiddenIndexes.forEach(Q=>{let Z=e.at(Q);Z&&(Z.removeAttribute("data-virtualized-hidden"),Z.style.removeProperty("--mdc-virtualizedlist-hidden-top"))}),this.firstIndex=t.startIndex,this.firstKey=(W=(F=this.virtualizer)==null?void 0:F.options.getItemKey(this.firstIndex))!=null?W:null,this.hiddenIndexes.length=0,[this.selectedIndex-1,this.selectedIndex,this.selectedIndex+1].forEach(Q=>{var Z;c.includes(Q)||(Q<t.startIndex&&Q>=0&&(c.unshift(Q),this.hiddenIndexes.push(Q)),Q>t.endIndex&&Q<((Z=l==null?void 0:l.options.count)!=null?Z:0)&&(c.push(Q),this.hiddenIndexes.push(Q)))}),this.updateHiddenItemsPosition(t),c.sort((Q,Z)=>Q-Z),c}updateHiddenItemsPosition(t){let{navItems:e,virtualizerProps:o,virtualizer:l}=this;if(!l||o.count===0)return;let{measurementsCache:c}=l;this.hiddenIndexes.forEach(f=>{let y=e.at(f);if(y){let A=Math.max(t.startIndex-t.overscan,0),F=c[A],W=c[f];y.setAttribute("data-virtualized-hidden","true"),y.style.setProperty("--mdc-virtualizedlist-hidden-top",`${W.start-F.start}px`)}})}isElementSelected(t){var e;return((e=this.virtualizer)==null?void 0:e.indexFromElement(t))===this.selectedIndex}setSelectedIndex(t){if(this.virtualizer){let{count:e,getItemKey:o}=this.virtualizer.options;this.selectedIndex=Math.max(0,Math.min(e-1,t)),this.selectedKey=o(t)}}onElementStoreUpdate(t,e){if(e==="added"){let o=this.isElementSelected(t);t.tabIndex=o?0:-1,this.setAriaSetSize(t)}else e==="removed"&&t.tabIndex===0&&queueMicrotask(()=>{this.resetTabIndexes(this.selectedIndex,this.focusWithin)})}async onVListStateChangeHandler(t,e){this.syncUI(),await this.updateComplete,this.requestUpdate(),!e&&this.endOfScrollQueue.length>0&&(this.endOfScrollQueue.forEach(o=>o()),this.endOfScrollQueue.length=0),this.checkAtBottom(),this.emitChangeEvent()}onScrollHandler(t){let e=t.target;this.atBottom==="re-evaluate"||e.scrollTop<this.lastScrollPosition?this.atBottom="no":this.checkAtBottom(),this.lastScrollPosition=e.scrollTop}checkAtBottom(){let{clientHeight:t,scrollHeight:e,scrollTop:o}=this.scrollRef;this.scrollAnchoring&&this.virtualizer&&this.atBottom==="no"&&e>t-this.atBottomThreshold&&!this.virtualizer.isScrolling&&(this.atBottom=e-o<=t+this.atBottomThreshold?"yes":"no")}handleNavigationKeyDown(t){var o,l,c,f;switch(this.getActionForKeyEvent(t)){case q.HOME:{(l=(o=this.virtualizer)==null?void 0:o.scrollToIndex)==null||l.call(o,0,{align:"start"}),this.endOfScrollQueue.push(()=>this.resetTabIndexes(0));break}case q.END:{let y=this.virtualizerProps.count-1;(f=(c=this.virtualizer)==null?void 0:c.scrollToIndex)==null||f.call(c,y,{align:"end"}),this.endOfScrollQueue.push(()=>this.resetTabIndexes(y));break}case q.UP:{this.atBottom="re-evaluate";break}default:}super.handleNavigationKeyDown(t)}resetTabIndexes(t,e=!0){super.resetTabIndexes(t,e),this.setSelectedIndex(t)}resetTabIndexAndSetFocus(t,e,o=!0,l=o){if(this.navItems.find(y=>{var A;return((A=this.virtualizer)==null?void 0:A.indexFromElement(y))===t})===void 0)return this.scrollToIndex(t,{}),this.endOfScrollQueue.push(()=>{super.resetTabIndexAndSetFocus(t,e,o,l),this.setSelectedIndex(t)}),!0;let f=super.resetTabIndexAndSetFocus(t,e,o,l);return this.setSelectedIndex(t),f}setAriaSetSize(t){var e,o;t.setAttribute("aria-setsize",`${(o=(e=this.virtualizer)==null?void 0:e.options.count)!=null?o:-1}`)}scrollToBottom(){if(this.clearScrollToBottomTimer(),this.atBottom==="yes"&&this.scrollRef){let{clientHeight:t,scrollHeight:e,scrollTop:o}=this.scrollRef;this.totalListHeight>t&&(this.scrollRef.scrollTop+=e-t-o),this.atBottomTimer=requestAnimationFrame(this.scrollToBottom.bind(this))}}clearScrollToBottomTimer(){cancelAnimationFrame(this.atBottomTimer),this.atBottomTimer=-1}scrollToIndex(t,e){var o,l;(l=(o=this.virtualizer).scrollToIndex)==null||l.call(o,t,e),this.atBottom=this.scrollAnchoring&&t+1===this.virtualizerProps.count?"yes":"no"}syncUI(){var l;let t=this.virtualItems.find(({index:c})=>!this.hiddenIndexes.includes(c)),e=(l=t==null?void 0:t.start)!=null?l:0;window.getComputedStyle(this);let o=0;this.revertList&&this.scrollRef.clientHeight>=this.totalListHeight&&(o=this.scrollRef.clientHeight-this.totalListHeight),this.wrapperRef.style.height=`${this.totalListHeight}px`,this.containerRef.style.transform=`translateY(${o+e}px)`}handleWheelEvent(t){t.deltaY<0&&(this.atBottom="re-evaluate")}handleResizeObserverCallback(){requestAnimationFrame(()=>{this.revertList&&this.scrollRef.clientHeight>=this.totalListHeight&&this.syncUI()})}render(){var t;return S`
7429
7464
  <slot name="list-header"></slot>
7430
7465
  <div part="scroll" tabindex="-1" @scroll="${this.onScrollHandler}">
7431
7466
  <div part="wrapper">