@legendapp/list 3.4.0 → 3.6.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.
package/react.d.ts CHANGED
@@ -6,11 +6,14 @@ type ScrollEventTarget = Window | HTMLElement;
6
6
  interface ScrollViewMethods {
7
7
  getBoundingClientRect(): DOMRect | null | undefined;
8
8
  getCurrentScrollOffset(): number;
9
+ getRawScrollOffset(): number;
9
10
  getMaxScrollOffset(): number;
10
- getScrollableNode(): HTMLElement;
11
+ getScrollableNode(): HTMLElement | null;
11
12
  getScrollEventTarget(): ScrollEventTarget | null;
12
13
  getScrollResponder(): HTMLElement | null;
13
14
  isWindowScroll?(): boolean;
15
+ getContentNode?(): HTMLElement | null;
16
+ isScrollInRange?(): boolean;
14
17
  scrollBy(x: number, y: number): void;
15
18
  scrollTo(options: {
16
19
  x?: number;
@@ -249,6 +252,8 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
249
252
  index: number;
250
253
  viewOffset?: number | undefined;
251
254
  viewPosition?: number | undefined;
255
+ /** Alignment used only when the item exceeds the viewport. Omit to preserve viewPosition. */
256
+ viewPositionFallback?: "start" | "end";
252
257
  };
253
258
  /**
254
259
  * Initial scroll position in pixels.
@@ -675,6 +680,8 @@ type LegendListRef$1 = {
675
680
  index: number;
676
681
  viewOffset?: number | undefined;
677
682
  viewPosition?: number | undefined;
683
+ /** Alignment used only when the item exceeds the viewport. Omit to preserve viewPosition. */
684
+ viewPositionFallback?: "start" | "end";
678
685
  }): Promise<void>;
679
686
  /**
680
687
  * Scrolls to a specific item in the list.
@@ -689,6 +696,8 @@ type LegendListRef$1 = {
689
696
  item: any;
690
697
  viewOffset?: number | undefined;
691
698
  viewPosition?: number | undefined;
699
+ /** Alignment used only when the item exceeds the viewport. Omit to preserve viewPosition. */
700
+ viewPositionFallback?: "start" | "end";
692
701
  }): Promise<void>;
693
702
  /**
694
703
  * Scrolls to a specific offset in pixels.
@@ -787,6 +796,8 @@ interface ScrollIndexWithOffset {
787
796
  index: number;
788
797
  viewOffset?: number;
789
798
  viewPosition?: number;
799
+ /** Alignment used only when the item exceeds the viewport. Omit to preserve viewPosition. */
800
+ viewPositionFallback?: "start" | "end";
790
801
  }
791
802
  interface ScrollIndexWithOffsetPosition extends ScrollIndexWithOffset {
792
803
  viewPosition?: number;
@@ -836,6 +847,13 @@ type ScrollViewPropsWeb = Omit<LooseScrollViewProps, "style" | "contentContainer
836
847
  onLayout?: (event: LooseLayoutChangeEvent) => void;
837
848
  };
838
849
  type LegendListPropsOverrides<ItemT, TItemType extends string | undefined> = Omit<LegendListPropsBase<ItemT, ScrollViewPropsWeb, TItemType>, "anchoredEndSpace" | "refScrollView" | "renderScrollComponent" | "ListHeaderComponentStyle" | "ListFooterComponentStyle" | "onRefresh" | "progressViewOffset" | "refreshing"> & {
850
+ /**
851
+ * Web only: use an ancestor element's scrollbar instead of creating a scrollable list.
852
+ * Pass a state-backed callback ref value so changes to the element are observed.
853
+ * null waits for the element to mount; undefined uses the list's own scrollbar.
854
+ * Takes precedence over useWindowScroll. Not supported with renderScrollComponent.
855
+ */
856
+ scrollElement?: HTMLElement | null;
839
857
  anchoredEndSpace?: AnchoredEndSpaceConfig;
840
858
  refScrollView?: Ref<HTMLElement | ScrollViewMethods>;
841
859
  ListHeaderComponentStyle?: CSSProperties | undefined;
@@ -845,7 +863,7 @@ type LegendListProps<ItemT = any, TItemType extends string | undefined = string
845
863
  type LegendListRef = Omit<LegendListRef$1, "getAnimatableRef" | "getNativeScrollRef" | "getScrollableNode" | "getScrollResponder"> & {
846
864
  getAnimatableRef(): HTMLElement | ScrollViewMethods;
847
865
  getNativeScrollRef(): HTMLElement | ScrollViewMethods;
848
- getScrollableNode(): HTMLElement;
866
+ getScrollableNode(): HTMLElement | null;
849
867
  getScrollResponder(): HTMLElement | null;
850
868
  };
851
869
  type LegendListState = Omit<LegendListState$1, "elementAtIndex"> & {