Skip to content

Commit 2245384

Browse files
committed
Finish updating shadcn-svelte
1 parent 5b32ae7 commit 2245384

File tree

11 files changed

+56
-58
lines changed

11 files changed

+56
-58
lines changed

components.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
},
1515
"typescript": true,
1616
"registry": "https://next.shadcn-svelte.com/registry"
17-
}
17+
}

src/lib/components/shared/NavBar.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<NavAnchor fuzzy href="/hobbies">Hobbies</NavAnchor>
1616
</div>
1717
<div class="flex-grow">
18-
<Button on:click={toggleMode} class="float-right" variant="outline" size="icon">
18+
<Button onclick={toggleMode} class="float-right" variant="outline" size="icon">
1919
<IconSun
2020
class="h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"
2121
/>

src/lib/components/ui/avatar/avatar-fallback.svelte

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
import { Avatar as AvatarPrimitive } from "bits-ui";
33
import { cn } from "$lib/utils.js";
44
5-
type $$Props = AvatarPrimitive.FallbackProps;
6-
7-
let className: $$Props["class"] = undefined;
8-
export { className as class };
5+
let {
6+
ref = $bindable(null),
7+
class: className,
8+
...restProps
9+
}: AvatarPrimitive.FallbackProps = $props();
910
</script>
1011

1112
<AvatarPrimitive.Fallback
13+
bind:ref
1214
class={cn("bg-muted flex h-full w-full items-center justify-center rounded-full", className)}
13-
{...$$restProps}
14-
>
15-
<slot />
16-
</AvatarPrimitive.Fallback>
15+
{...restProps}
16+
/>

src/lib/components/ui/avatar/avatar-image.svelte

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@
22
import { Avatar as AvatarPrimitive } from "bits-ui";
33
import { cn } from "$lib/utils.js";
44
5-
type $$Props = AvatarPrimitive.ImageProps;
6-
7-
let className: $$Props["class"] = undefined;
8-
export let src: $$Props["src"] = undefined;
9-
export let alt: $$Props["alt"] = undefined;
10-
export { className as class };
5+
let {
6+
ref = $bindable(null),
7+
class: className,
8+
...restProps
9+
}: AvatarPrimitive.ImageProps = $props();
1110
</script>
1211

1312
<AvatarPrimitive.Image
14-
{src}
15-
{alt}
13+
bind:ref
1614
class={cn("aspect-square h-full w-full", className)}
17-
{...$$restProps}
15+
{...restProps}
1816
/>

src/lib/components/ui/avatar/avatar.svelte

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@
22
import { Avatar as AvatarPrimitive } from "bits-ui";
33
import { cn } from "$lib/utils.js";
44
5-
type $$Props = AvatarPrimitive.Props;
6-
7-
let className: $$Props["class"] = undefined;
8-
export let delayMs: $$Props["delayMs"] = undefined;
9-
export { className as class };
5+
let {
6+
ref = $bindable(null),
7+
class: className,
8+
...restProps
9+
}: AvatarPrimitive.RootProps = $props();
1010
</script>
1111

1212
<AvatarPrimitive.Root
13-
{delayMs}
14-
class={cn("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full", className)}
15-
{...$$restProps}
16-
>
17-
<slot />
18-
</AvatarPrimitive.Root>
13+
bind:ref
14+
class={cn("relative flex size-10 shrink-0 overflow-hidden rounded-full", className)}
15+
{...restProps}
16+
/>
Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
<script lang="ts">
2+
import type { WithElementRef, WithoutChildren } from "bits-ui";
23
import type { HTMLAttributes } from "svelte/elements";
34
import { cn } from "$lib/utils.js";
45
5-
type $$Props = HTMLAttributes<HTMLDivElement>;
6-
7-
let className: $$Props["class"] = undefined;
8-
export { className as class };
6+
let {
7+
ref = $bindable(null),
8+
class: className,
9+
...restProps
10+
}: WithoutChildren<WithElementRef<HTMLAttributes<HTMLDivElement>>> = $props();
911
</script>
1012

11-
<div class={cn("bg-muted animate-pulse rounded-md", className)} {...$$restProps}></div>
13+
<div
14+
bind:this={ref}
15+
class={cn("bg-muted animate-pulse rounded-md", className)}
16+
{...restProps}
17+
></div>

src/lib/components/ui/sonner/sonner.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { Toaster as Sonner, type ToasterProps as SonnerProps } from "svelte-sonner";
33
import { mode } from "mode-watcher";
44
5-
type $$Props = SonnerProps;
5+
let restProps: SonnerProps = $props();
66
</script>
77

88
<Sonner
@@ -16,5 +16,5 @@
1616
cancelButton: "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",
1717
},
1818
}}
19-
{...$$restProps}
19+
{...restProps}
2020
/>

src/lib/components/ui/tooltip/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@ import Content from "./tooltip-content.svelte";
33

44
const Root = TooltipPrimitive.Root;
55
const Trigger = TooltipPrimitive.Trigger;
6+
const Provider = TooltipPrimitive.Provider;
67

78
export {
89
Root,
910
Trigger,
1011
Content,
12+
Provider,
1113
//
1214
Root as Tooltip,
1315
Content as TooltipContent,
1416
Trigger as TooltipTrigger,
17+
Provider as TooltipProvider,
1518
};
Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,21 @@
11
<script lang="ts">
22
import { Tooltip as TooltipPrimitive } from "bits-ui";
3-
import { cn, flyAndScale } from "$lib/utils.js";
3+
import { cn } from "$lib/utils.js";
44
5-
type $$Props = TooltipPrimitive.ContentProps;
6-
7-
let className: $$Props["class"] = undefined;
8-
export let sideOffset: $$Props["sideOffset"] = 4;
9-
export let transition: $$Props["transition"] = flyAndScale;
10-
export let transitionConfig: $$Props["transitionConfig"] = {
11-
y: 8,
12-
duration: 150,
13-
};
14-
export { className as class };
5+
let {
6+
ref = $bindable(null),
7+
class: className,
8+
sideOffset = 4,
9+
...restProps
10+
}: TooltipPrimitive.ContentProps = $props();
1511
</script>
1612

1713
<TooltipPrimitive.Content
18-
{transition}
19-
{transitionConfig}
14+
bind:ref
2015
{sideOffset}
2116
class={cn(
22-
"bg-popover text-popover-foreground z-50 overflow-hidden rounded-md border px-3 py-1.5 text-sm shadow-md",
17+
"bg-popover text-popover-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 overflow-hidden rounded-md border px-3 py-1.5 text-sm shadow-md",
2318
className
2419
)}
25-
{...$$restProps}
26-
>
27-
<slot />
28-
</TooltipPrimitive.Content>
20+
{...restProps}
21+
/>

src/lib/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { type ClassValue, clsx } from 'clsx';
2-
import { twMerge } from 'tailwind-merge';
1+
import { type ClassValue, clsx } from "clsx";
2+
import { twMerge } from "tailwind-merge";
33

44
export function cn(...inputs: ClassValue[]) {
55
return twMerge(clsx(inputs));

0 commit comments

Comments
 (0)