Skip to content

Commit 2af89d3

Browse files
committed
🛠️ Update WithoutChild type import + format scroll-area.ts file
1 parent 0eaf2ab commit 2af89d3

File tree

4 files changed

+18
-25
lines changed

4 files changed

+18
-25
lines changed
Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
import Scrollbar from "./scroll-area-scrollbar.svelte";
21
import Root from "./scroll-area.svelte";
32
import Mask from "./scroll-area-mask.svelte";
3+
import Scrollbar from "./scroll-area-scrollbar.svelte";
44

55
export {
6-
Root,
7-
Scrollbar,
8-
Mask,
9-
//
10-
Root as ScrollArea,
11-
Scrollbar as ScrollAreaScrollbar,
12-
Mask as ScrollAreaMask,
6+
Root,
7+
Scrollbar,
8+
Mask,
9+
Root as ScrollArea,
10+
Scrollbar as ScrollAreaScrollbar,
11+
Mask as ScrollAreaMask,
1312
};

src/components/ui/scroll-area/scroll-area-scrollbar.svelte

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<script lang="ts">
2+
import type { WithoutChild } from "@/types/components";
3+
4+
import { cn } from "@/utils/cn";
25
import { ScrollArea as ScrollAreaPrimitive } from "bits-ui";
3-
import { cn, type WithoutChild } from "@/utils/cn";
46
import { useHasPrimaryTouch } from "@/hooks/use-has-primary-touch";
57
68
let {

src/components/ui/scroll-area/scroll-area.svelte

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
<script lang="ts">
2-
import { cn, type WithoutChild } from "@/utils/cn";
3-
import { ScrollArea as ScrollAreaPrimitive } from "bits-ui";
2+
import type { WithoutChild } from "@/types/components";
3+
4+
import { cn } from "@/utils/cn";
5+
import { useHasPrimaryTouch } from "@/hooks/use-has-primary-touch";
6+
47
import { Scrollbar } from "./index.js";
58
import ScrollAreaMask from "./scroll-area-mask.svelte";
6-
import { useHasPrimaryTouch } from "@/hooks/use-has-primary-touch";
9+
import { ScrollArea as ScrollAreaPrimitive } from "bits-ui";
710
811
type Mask = {
912
top: boolean;

src/utils/cn.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
11
import { type ClassValue, clsx } from "clsx";
22
import { twMerge } from "tailwind-merge";
3-
3+
44
export function cn(...inputs: ClassValue[]) {
5-
return twMerge(clsx(inputs));
5+
return twMerge(clsx(inputs));
66
}
7-
8-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
9-
export type WithoutChild<T> = T extends { child?: any } ? Omit<T, "child"> : T;
10-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
11-
export type WithoutChildren<T> = T extends { children?: any }
12-
? Omit<T, "children">
13-
: T;
14-
export type WithoutChildrenOrChild<T> = WithoutChildren<WithoutChild<T>>;
15-
export type WithElementRef<T, U extends HTMLElement = HTMLElement> = T & {
16-
ref?: U | null;
17-
};

0 commit comments

Comments
 (0)