Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: muti select action #1062

Merged
merged 22 commits into from
Oct 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update
  • Loading branch information
hyoban committed Oct 24, 2024
commit 6fef9619ade077408bad0ace670006f599a7950b
53 changes: 34 additions & 19 deletions packages/components/src/ui/scroll-area/ScrollArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,24 +125,39 @@ export const ScrollArea = React.forwardRef<
scrollbarClassName?: string
flex?: boolean
mask?: boolean
onScroll?: (e: React.UIEvent<HTMLDivElement>) => void
}
>(({ flex, children, rootClassName, viewportClassName, scrollbarClassName, mask = false }, ref) => {
const [viewportRef, setViewportRef] = React.useState<HTMLDivElement | null>(null)
React.useImperativeHandle(ref, () => viewportRef as HTMLDivElement)
>(
(
{
flex,
children,
rootClassName,
viewportClassName,
scrollbarClassName,
mask = false,
onScroll,
},
ref,
) => {
const [viewportRef, setViewportRef] = React.useState<HTMLDivElement | null>(null)
React.useImperativeHandle(ref, () => viewportRef as HTMLDivElement)

return (
<ScrollElementContext.Provider value={viewportRef}>
<Root className={rootClassName}>
<Viewport
ref={setViewportRef}
onWheel={stopPropagation}
className={cn(flex ? "[&>div]:!flex [&>div]:!flex-col" : "", viewportClassName)}
mask={mask}
>
{children}
</Viewport>
<Scrollbar className={scrollbarClassName} />
</Root>
</ScrollElementContext.Provider>
)
})
return (
<ScrollElementContext.Provider value={viewportRef}>
<Root className={rootClassName}>
<Viewport
ref={setViewportRef}
onWheel={stopPropagation}
className={cn(flex ? "[&>div]:!flex [&>div]:!flex-col" : "", viewportClassName)}
mask={mask}
onScroll={onScroll}
>
{children}
</Viewport>
<Scrollbar className={scrollbarClassName} />
</Root>
</ScrollElementContext.Provider>
)
},
)
Loading