Skip to content

Commit ed9c618

Browse files
feat: add per-package UI
1 parent 51cd091 commit ed9c618

File tree

5 files changed

+172
-88
lines changed

5 files changed

+172
-88
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"@sveltejs/kit": "^2.20.7",
2929
"@sveltejs/vite-plugin-svelte": "^5.0.3",
3030
"@tailwindcss/typography": "^0.5.16",
31-
"@tailwindcss/vite": "^4.1.4",
31+
"@tailwindcss/vite": "^4.1.5",
3232
"@total-typescript/ts-reset": "^0.6.1",
3333
"@types/eslint-config-prettier": "^6.11.3",
3434
"@types/node": "^22.15.2",
@@ -59,7 +59,7 @@
5959
"svelte-sonner": "https://pkg.pr.new/wobsoriano/svelte-sonner@126",
6060
"tailwind-merge": "^3.2.0",
6161
"tailwind-variants": "^1.0.0",
62-
"tailwindcss": "^4.1.4",
62+
"tailwindcss": "^4.1.5",
6363
"tslib": "^2.8.1",
6464
"tw-animate-css": "^1.2.8",
6565
"typescript": "^5.8.3",

pnpm-lock.yaml

Lines changed: 75 additions & 75 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!--
2+
@component
3+
4+
Based on https://bits-ui.com/docs/components/collapsible#best-practices
5+
-->
6+
<script lang="ts">
7+
import { Collapsible, type WithoutChildrenOrChild } from "bits-ui";
8+
import { slide, type SlideParams } from "svelte/transition";
9+
import type { Snippet } from "svelte";
10+
11+
let {
12+
ref = $bindable(null),
13+
duration = 200,
14+
axis = undefined,
15+
children,
16+
...restProps
17+
}: WithoutChildrenOrChild<Collapsible.ContentProps> & {
18+
duration?: number;
19+
axis?: SlideParams["axis"];
20+
children?: Snippet;
21+
} = $props();
22+
</script>
23+
24+
<Collapsible.Content forceMount bind:ref {...restProps}>
25+
{#snippet child({ props, open })}
26+
{#if open}
27+
<div {...props} transition:slide={{ duration, axis }} class="flex">
28+
{@render children?.()}
29+
</div>
30+
{/if}
31+
{/snippet}
32+
</Collapsible.Content>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { Collapsible as CollapsiblePrimitive } from "bits-ui";
2+
3+
const Root = CollapsiblePrimitive.Root;
4+
const Trigger = CollapsiblePrimitive.Trigger;
5+
const Content = CollapsiblePrimitive.Content;
6+
7+
export {
8+
Root,
9+
Content,
10+
Trigger,
11+
//
12+
Root as Collapsible,
13+
Content as CollapsibleContent,
14+
Trigger as CollapsibleTrigger,
15+
};

0 commit comments

Comments
 (0)