-
-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
168 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 0 additions & 39 deletions
39
sites/docs/src/lib/components/demos/scroll-area-demo-always.svelte
This file was deleted.
Oops, something went wrong.
39 changes: 0 additions & 39 deletions
39
sites/docs/src/lib/components/demos/scroll-area-demo-auto.svelte
This file was deleted.
Oops, something went wrong.
77 changes: 77 additions & 0 deletions
77
sites/docs/src/lib/components/demos/scroll-area-demo-custom.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<script lang="ts"> | ||
import { ScrollArea, type WithoutChild } from "bits-ui"; | ||
import DemoContainer from "../demo-container.svelte"; | ||
import { cn } from "$lib/utils/styles.js"; | ||
type Props = WithoutChild<ScrollArea.RootProps> & { | ||
orientation: "vertical" | "horizontal" | "both"; | ||
viewportClasses?: string; | ||
}; | ||
let { | ||
ref = $bindable(null), | ||
orientation = "vertical", | ||
viewportClasses, | ||
children, | ||
...restProps | ||
}: Props = $props(); | ||
</script> | ||
|
||
{#snippet Scrollbar({ orientation }: { orientation: "vertical" | "horizontal" })} | ||
{#if orientation === "vertical"} | ||
<ScrollArea.Scrollbar | ||
{orientation} | ||
class="flex w-2.5 touch-none select-none rounded-full border-l border-l-transparent bg-muted p-px transition-all duration-200 hover:w-3 hover:bg-dark-10 data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out-0 data-[state=visible]:fade-in-0" | ||
> | ||
<ScrollArea.Thumb | ||
class="flex-1 rounded-full bg-muted-foreground data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out-0 data-[state=visible]:fade-in-0" | ||
/> | ||
</ScrollArea.Scrollbar> | ||
{:else} | ||
<ScrollArea.Scrollbar | ||
{orientation} | ||
class="flex h-2.5 touch-none select-none rounded-full border-t border-t-transparent bg-muted p-px transition-all duration-200 hover:h-3 hover:bg-dark-10 data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out-0 data-[state=visible]:fade-in-0" | ||
> | ||
<ScrollArea.Thumb | ||
class="rounded-full bg-muted-foreground data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out-0 data-[state=visible]:fade-in-0" | ||
/> | ||
</ScrollArea.Scrollbar> | ||
{/if} | ||
{/snippet} | ||
|
||
<DemoContainer size="sm"> | ||
<ScrollArea.Root | ||
bind:ref | ||
{...restProps} | ||
class="relative overflow-hidden rounded-[10px] border border-dark-10 bg-background-alt px-4 py-4 shadow-card" | ||
> | ||
<ScrollArea.Viewport | ||
class={cn("h-full max-h-[200px] w-full max-w-[200px]", viewportClasses)} | ||
> | ||
{#if children} | ||
{@render children?.()} | ||
{:else} | ||
<h4 | ||
class="mb-4 mt-2 text-xl font-semibold leading-none tracking-[-0.01em] text-foreground" | ||
> | ||
Scroll Area | ||
</h4> | ||
<p class="text-wrap text-sm leading-5 text-foreground-alt"> | ||
Lorem ipsum dolor sit, amet consectetur adipisicing elit. Dignissimos impedit | ||
rem, repellat deserunt ducimus quasi nisi voluptatem cumque aliquid esse ea | ||
deleniti eveniet incidunt! Deserunt minus laborum accusamus iusto dolorum. Lorem | ||
ipsum dolor sit, amet consectetur adipisicing elit. Blanditiis officiis error | ||
minima eos fugit voluptate excepturi eveniet dolore et, ratione impedit | ||
consequuntur dolorem hic quae corrupti autem? Dolorem, sit voluptatum. | ||
</p> | ||
{/if} | ||
</ScrollArea.Viewport> | ||
{#if orientation === "vertical" || orientation === "both"} | ||
{@render Scrollbar({ orientation: "vertical" })} | ||
{/if} | ||
{#if orientation === "horizontal" || orientation === "both"} | ||
{@render Scrollbar({ orientation: "horizontal" })} | ||
{/if} | ||
<ScrollArea.Corner /> | ||
</ScrollArea.Root> | ||
</DemoContainer> |
39 changes: 0 additions & 39 deletions
39
sites/docs/src/lib/components/demos/scroll-area-demo-scroll.svelte
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.