File tree Expand file tree Collapse file tree 2 files changed +28
-10
lines changed
sites/docs/src/lib/registry Expand file tree Collapse file tree 2 files changed +28
-10
lines changed Original file line number Diff line number Diff line change 5
5
let {
6
6
ref = $bindable (null ),
7
7
value = $bindable (),
8
+ orientation = " horizontal" ,
8
9
class : className,
9
10
... restProps
10
11
}: WithoutChildrenOrChild <SliderPrimitive .RootProps > = $props ();
@@ -15,14 +16,23 @@ Discriminated Unions + Destructing (required for bindable) do not
15
16
get along, so we shut typescript up by casting `value` to `never`.
16
17
-->
17
18
<SliderPrimitive .Root
18
- bind:value ={value as never }
19
19
bind:ref
20
- class ={cn (" relative flex w-full touch-none select-none items-center" , className )}
20
+ bind:value ={value as never }
21
+ {orientation }
22
+ class ={cn (
23
+ " relative flex touch-none select-none items-center data-[orientation='vertical']:h-full data-[orientation='vertical']:min-h-44 data-[orientation='horizontal']:w-full data-[orientation='vertical']:w-auto data-[orientation='vertical']:flex-col" ,
24
+ className
25
+ )}
21
26
{...restProps }
22
27
>
23
28
{#snippet children ({ thumbs })}
24
- <span class =" bg-secondary relative h-2 w-full grow overflow-hidden rounded-full" >
25
- <SliderPrimitive .Range class =" bg-primary absolute h-full" />
29
+ <span
30
+ data-orientation ={orientation }
31
+ class =" bg-secondary relative grow overflow-hidden rounded-full data-[orientation='horizontal']:h-2 data-[orientation='vertical']:h-full data-[orientation='horizontal']:w-full data-[orientation='vertical']:w-2"
32
+ >
33
+ <SliderPrimitive .Range
34
+ class =" bg-primary absolute data-[orientation='horizontal']:h-full data-[orientation='vertical']:w-full"
35
+ />
26
36
</span >
27
37
{#each thumbs as thumb }
28
38
<SliderPrimitive .Thumb
Original file line number Diff line number Diff line change 4
4
5
5
let {
6
6
ref = $bindable (null ),
7
- class : className,
8
7
value = $bindable (),
8
+ orientation = " horizontal" ,
9
+ class : className,
9
10
... restProps
10
11
}: WithoutChildrenOrChild <SliderPrimitive .RootProps > = $props ();
11
-
12
- export { className as class };
13
12
</script >
14
13
15
14
<!--
@@ -19,12 +18,21 @@ get along, so we shut typescript up by casting `value` to `never`.
19
18
<SliderPrimitive .Root
20
19
bind:ref
21
20
bind:value ={value as never }
22
- class ={cn (" relative flex w-full touch-none select-none items-center" , className )}
21
+ {orientation }
22
+ class ={cn (
23
+ " relative flex touch-none select-none items-center data-[orientation='vertical']:h-full data-[orientation='vertical']:min-h-44 data-[orientation='horizontal']:w-full data-[orientation='vertical']:w-auto data-[orientation='vertical']:flex-col" ,
24
+ className
25
+ )}
23
26
{...restProps }
24
27
>
25
28
{#snippet children ({ thumbs })}
26
- <span class =" bg-primary/20 relative h-1.5 w-full grow overflow-hidden rounded-full" >
27
- <SliderPrimitive .Range class =" bg-primary absolute h-full" />
29
+ <span
30
+ data-orientation ={orientation }
31
+ class =" bg-primary/20 relative grow overflow-hidden rounded-full data-[orientation='horizontal']:h-1.5 data-[orientation='vertical']:h-full data-[orientation='horizontal']:w-full data-[orientation='vertical']:w-1.5"
32
+ >
33
+ <SliderPrimitive .Range
34
+ class =" bg-primary absolute data-[orientation='horizontal']:h-full data-[orientation='vertical']:w-full"
35
+ />
28
36
</span >
29
37
{#each thumbs as thumb }
30
38
<SliderPrimitive .Thumb
You can’t perform that action at this time.
0 commit comments