From 3208ce772359317889b60d6ddd631bc59f8216bb Mon Sep 17 00:00:00 2001 From: YieldRay Date: Mon, 23 Dec 2024 23:22:06 +0800 Subject: [PATCH] rename --- src/composition/RecycleScroller/index.ts | 1 - .../VirtualScroller.stories.tsx} | 8 ++++---- .../VirtualScroller.tsx} | 14 +++++++------- src/composition/VirtualScroller/index.ts | 1 + src/composition/index.ts | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) delete mode 100644 src/composition/RecycleScroller/index.ts rename src/composition/{RecycleScroller/RecycleScroller.stories.tsx => VirtualScroller/VirtualScroller.stories.tsx} (81%) rename src/composition/{RecycleScroller/RecycleScroller.tsx => VirtualScroller/VirtualScroller.tsx} (93%) create mode 100644 src/composition/VirtualScroller/index.ts diff --git a/src/composition/RecycleScroller/index.ts b/src/composition/RecycleScroller/index.ts deleted file mode 100644 index c235172..0000000 --- a/src/composition/RecycleScroller/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './RecycleScroller' diff --git a/src/composition/RecycleScroller/RecycleScroller.stories.tsx b/src/composition/VirtualScroller/VirtualScroller.stories.tsx similarity index 81% rename from src/composition/RecycleScroller/RecycleScroller.stories.tsx rename to src/composition/VirtualScroller/VirtualScroller.stories.tsx index 10c1546..8076f55 100644 --- a/src/composition/RecycleScroller/RecycleScroller.stories.tsx +++ b/src/composition/VirtualScroller/VirtualScroller.stories.tsx @@ -1,9 +1,9 @@ import type { Meta, StoryObj } from '@storybook/react' -import { RecycleScroller } from './RecycleScroller' +import { VirtualScroller } from './VirtualScroller' -const meta: Meta = { - title: 'composition/RecycleScroller', - component: RecycleScroller, +const meta: Meta = { + title: 'composition/VirtualScroller', + component: VirtualScroller, tags: ['autodocs'], } diff --git a/src/composition/RecycleScroller/RecycleScroller.tsx b/src/composition/VirtualScroller/VirtualScroller.tsx similarity index 93% rename from src/composition/RecycleScroller/RecycleScroller.tsx rename to src/composition/VirtualScroller/VirtualScroller.tsx index dad0ebe..b25b7aa 100644 --- a/src/composition/RecycleScroller/RecycleScroller.tsx +++ b/src/composition/VirtualScroller/VirtualScroller.tsx @@ -8,7 +8,7 @@ import { useState, } from 'react' -interface RecycleScrollerProps { +interface VirtualScrollerProps { data: T[] itemHeight: number windowHeight: number @@ -17,15 +17,15 @@ interface RecycleScrollerProps { defaultRevealedIndex?: number } -export interface RecycleScrollerHandle { +export interface VirtualScrollerHandle { scrollToIndex: (index: number) => void } /** * @experimental - * Highly experimental! + * Working in progress, DO NOT USE */ -export const RecycleScroller = forwardRef(function RecycleScroller( +export const VirtualScroller = forwardRef(function VirtualScroller( { data, itemHeight, @@ -33,8 +33,8 @@ export const RecycleScroller = forwardRef(function RecycleScroller( children, bufferSize = 3, defaultRevealedIndex = 0, - }: RecycleScrollerProps, - ref: React.ForwardedRef, + }: VirtualScrollerProps, + ref: React.ForwardedRef, ) { const containerRef = useRef(null) const [isScrolling, setIsScrolling] = useState(false) @@ -80,7 +80,7 @@ export const RecycleScroller = forwardRef(function RecycleScroller( scrollingTimeoutRef.current = setTimeout(() => { setIsScrolling(false) - }, 150) + }, 33.333) }, [], ) diff --git a/src/composition/VirtualScroller/index.ts b/src/composition/VirtualScroller/index.ts new file mode 100644 index 0000000..290e433 --- /dev/null +++ b/src/composition/VirtualScroller/index.ts @@ -0,0 +1 @@ +export * from './VirtualScroller' diff --git a/src/composition/index.ts b/src/composition/index.ts index 9e60998..4445749 100644 --- a/src/composition/index.ts +++ b/src/composition/index.ts @@ -4,7 +4,6 @@ export * from './Details' export * from './IconRippleButton' export * from './NestedMenu' export * from './PopoverHolder' -export * from './RecycleScroller' export * from './Scrim' export * from './ScrollArea' export * from './Select' @@ -13,3 +12,4 @@ export * from './SodaImage' export * from './SodaTransition' export * from './Table' export * from './TooltipHolder' +export * from './VirtualScroller'