@stubber/ui 1.8.2 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/carousel/carousel-content.svelte +29 -0
- package/dist/components/carousel/carousel-content.svelte.d.ts +19 -0
- package/dist/components/carousel/carousel-item.svelte +20 -0
- package/dist/components/carousel/carousel-item.svelte.d.ts +19 -0
- package/dist/components/carousel/carousel-next.svelte +28 -0
- package/dist/components/carousel/carousel-next.svelte.d.ts +17 -0
- package/dist/components/carousel/carousel-previous.svelte +28 -0
- package/dist/components/carousel/carousel-previous.svelte.d.ts +17 -0
- package/dist/components/carousel/carousel.svelte +85 -0
- package/dist/components/carousel/carousel.svelte.d.ts +22 -0
- package/dist/components/carousel/context.d.ts +32 -0
- package/dist/components/carousel/context.js +12 -0
- package/dist/components/carousel/index.d.ts +5 -0
- package/dist/components/carousel/index.js +5 -0
- package/dist/components/toggle/index.d.ts +76 -0
- package/dist/components/toggle/index.js +23 -0
- package/dist/components/toggle/toggle.svelte +18 -0
- package/dist/components/toggle/toggle.svelte.d.ts +25 -0
- package/package.json +2 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script>import emblaCarouselSvelte from "embla-carousel-svelte";
|
|
2
|
+
import { getEmblaContext } from "./context.js";
|
|
3
|
+
import { cn } from "../../utils/shadcn-utils.js";
|
|
4
|
+
let className = void 0;
|
|
5
|
+
export { className as class };
|
|
6
|
+
const { orientation, options, plugins, onInit } = getEmblaContext("<Carousel.Content/>");
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<div
|
|
10
|
+
class="overflow-hidden"
|
|
11
|
+
use:emblaCarouselSvelte={{
|
|
12
|
+
options: {
|
|
13
|
+
container: "[data-embla-container]",
|
|
14
|
+
slides: "[data-embla-slide]",
|
|
15
|
+
...$options,
|
|
16
|
+
axis: $orientation === "horizontal" ? "x" : "y",
|
|
17
|
+
},
|
|
18
|
+
plugins: $plugins,
|
|
19
|
+
}}
|
|
20
|
+
on:emblaInit={onInit}
|
|
21
|
+
>
|
|
22
|
+
<div
|
|
23
|
+
class={cn("flex", $orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col", className)}
|
|
24
|
+
data-embla-container=""
|
|
25
|
+
{...$$restProps}
|
|
26
|
+
>
|
|
27
|
+
<slot />
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: HTMLAttributes<HTMLDivElement>;
|
|
5
|
+
events: {
|
|
6
|
+
[evt: string]: CustomEvent<any>;
|
|
7
|
+
};
|
|
8
|
+
slots: {
|
|
9
|
+
default: {};
|
|
10
|
+
};
|
|
11
|
+
exports?: {} | undefined;
|
|
12
|
+
bindings?: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
export type CarouselContentProps = typeof __propDef.props;
|
|
15
|
+
export type CarouselContentEvents = typeof __propDef.events;
|
|
16
|
+
export type CarouselContentSlots = typeof __propDef.slots;
|
|
17
|
+
export default class CarouselContent extends SvelteComponent<CarouselContentProps, CarouselContentEvents, CarouselContentSlots> {
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script>import { getEmblaContext } from "./context.js";
|
|
2
|
+
import { cn } from "../../utils/shadcn-utils.js";
|
|
3
|
+
let className = void 0;
|
|
4
|
+
export { className as class };
|
|
5
|
+
const { orientation } = getEmblaContext("<Carousel.Item/>");
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<div
|
|
9
|
+
role="group"
|
|
10
|
+
aria-roledescription="slide"
|
|
11
|
+
class={cn(
|
|
12
|
+
"min-w-0 shrink-0 grow-0 basis-full",
|
|
13
|
+
$orientation === "horizontal" ? "pl-4" : "pt-4",
|
|
14
|
+
className
|
|
15
|
+
)}
|
|
16
|
+
data-embla-slide=""
|
|
17
|
+
{...$$restProps}
|
|
18
|
+
>
|
|
19
|
+
<slot />
|
|
20
|
+
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: HTMLAttributes<HTMLDivElement>;
|
|
5
|
+
events: {
|
|
6
|
+
[evt: string]: CustomEvent<any>;
|
|
7
|
+
};
|
|
8
|
+
slots: {
|
|
9
|
+
default: {};
|
|
10
|
+
};
|
|
11
|
+
exports?: {} | undefined;
|
|
12
|
+
bindings?: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
export type CarouselItemProps = typeof __propDef.props;
|
|
15
|
+
export type CarouselItemEvents = typeof __propDef.events;
|
|
16
|
+
export type CarouselItemSlots = typeof __propDef.slots;
|
|
17
|
+
export default class CarouselItem extends SvelteComponent<CarouselItemProps, CarouselItemEvents, CarouselItemSlots> {
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script>import { getEmblaContext } from "./context.js";
|
|
2
|
+
import { cn } from "../../utils/shadcn-utils.js";
|
|
3
|
+
import { Button } from "../button/index.js";
|
|
4
|
+
let className = void 0;
|
|
5
|
+
export { className as class };
|
|
6
|
+
export let variant = "outline";
|
|
7
|
+
export let size = "icon";
|
|
8
|
+
const { orientation, canScrollNext, scrollNext, handleKeyDown } = getEmblaContext("<Carousel.Next/>");
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<Button
|
|
12
|
+
{variant}
|
|
13
|
+
{size}
|
|
14
|
+
class={cn(
|
|
15
|
+
"absolute h-8 w-8 touch-manipulation rounded-full",
|
|
16
|
+
$orientation === "horizontal"
|
|
17
|
+
? "-right-12 top-1/2 -translate-y-1/2"
|
|
18
|
+
: "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
|
|
19
|
+
className
|
|
20
|
+
)}
|
|
21
|
+
disabled={!$canScrollNext}
|
|
22
|
+
on:click={scrollNext}
|
|
23
|
+
on:keydown={handleKeyDown}
|
|
24
|
+
{...$$restProps}
|
|
25
|
+
>
|
|
26
|
+
<i class="far fa-arrow-right h-4 w-4" />
|
|
27
|
+
<span class="sr-only">Next slide</span>
|
|
28
|
+
</Button>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import { type Props } from "../button/index.js";
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: Props;
|
|
5
|
+
events: {
|
|
6
|
+
[evt: string]: CustomEvent<any>;
|
|
7
|
+
};
|
|
8
|
+
slots: {};
|
|
9
|
+
exports?: {} | undefined;
|
|
10
|
+
bindings?: string | undefined;
|
|
11
|
+
};
|
|
12
|
+
export type CarouselNextProps = typeof __propDef.props;
|
|
13
|
+
export type CarouselNextEvents = typeof __propDef.events;
|
|
14
|
+
export type CarouselNextSlots = typeof __propDef.slots;
|
|
15
|
+
export default class CarouselNext extends SvelteComponent<CarouselNextProps, CarouselNextEvents, CarouselNextSlots> {
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script>import { getEmblaContext } from "./context.js";
|
|
2
|
+
import { cn } from "../../utils/shadcn-utils.js";
|
|
3
|
+
import { Button } from "../button/index.js";
|
|
4
|
+
let className = void 0;
|
|
5
|
+
export { className as class };
|
|
6
|
+
export let variant = "outline";
|
|
7
|
+
export let size = "icon";
|
|
8
|
+
const { orientation, canScrollPrev, scrollPrev, handleKeyDown } = getEmblaContext("<Carousel.Previous/>");
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<Button
|
|
12
|
+
{variant}
|
|
13
|
+
{size}
|
|
14
|
+
class={cn(
|
|
15
|
+
"absolute h-8 w-8 touch-manipulation rounded-full",
|
|
16
|
+
$orientation === "horizontal"
|
|
17
|
+
? "-left-12 top-1/2 -translate-y-1/2"
|
|
18
|
+
: "-top-12 left-1/2 -translate-x-1/2 rotate-90",
|
|
19
|
+
className
|
|
20
|
+
)}
|
|
21
|
+
disabled={!$canScrollPrev}
|
|
22
|
+
on:click={scrollPrev}
|
|
23
|
+
on:keydown={handleKeyDown}
|
|
24
|
+
{...$$restProps}
|
|
25
|
+
>
|
|
26
|
+
<i class="far fa-arrow-left h-4 w-4" />
|
|
27
|
+
<span class="sr-only">Previous slide</span>
|
|
28
|
+
</Button>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import { type Props } from "../button/index.js";
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: Props;
|
|
5
|
+
events: {
|
|
6
|
+
[evt: string]: CustomEvent<any>;
|
|
7
|
+
};
|
|
8
|
+
slots: {};
|
|
9
|
+
exports?: {} | undefined;
|
|
10
|
+
bindings?: string | undefined;
|
|
11
|
+
};
|
|
12
|
+
export type CarouselPreviousProps = typeof __propDef.props;
|
|
13
|
+
export type CarouselPreviousEvents = typeof __propDef.events;
|
|
14
|
+
export type CarouselPreviousSlots = typeof __propDef.slots;
|
|
15
|
+
export default class CarouselPrevious extends SvelteComponent<CarouselPreviousProps, CarouselPreviousEvents, CarouselPreviousSlots> {
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<script>import { writable } from "svelte/store";
|
|
2
|
+
import { onDestroy } from "svelte";
|
|
3
|
+
import { setEmblaContext } from "./context.js";
|
|
4
|
+
import { cn } from "../../utils/shadcn-utils.js";
|
|
5
|
+
export let opts = {};
|
|
6
|
+
export let plugins = [];
|
|
7
|
+
export let api = void 0;
|
|
8
|
+
export let orientation = "horizontal";
|
|
9
|
+
let className = void 0;
|
|
10
|
+
export { className as class };
|
|
11
|
+
const apiStore = writable(void 0);
|
|
12
|
+
const orientationStore = writable(orientation);
|
|
13
|
+
const canScrollPrev = writable(false);
|
|
14
|
+
const canScrollNext = writable(false);
|
|
15
|
+
const optionsStore = writable(opts);
|
|
16
|
+
const pluginStore = writable(plugins);
|
|
17
|
+
const scrollSnapsStore = writable([]);
|
|
18
|
+
const selectedIndexStore = writable(0);
|
|
19
|
+
$: orientationStore.set(orientation);
|
|
20
|
+
$: pluginStore.set(plugins);
|
|
21
|
+
$: optionsStore.set(opts);
|
|
22
|
+
function scrollPrev() {
|
|
23
|
+
api?.scrollPrev();
|
|
24
|
+
}
|
|
25
|
+
function scrollNext() {
|
|
26
|
+
api?.scrollNext();
|
|
27
|
+
}
|
|
28
|
+
function scrollTo(index, jump) {
|
|
29
|
+
api?.scrollTo(index, jump);
|
|
30
|
+
}
|
|
31
|
+
function onSelect(api2) {
|
|
32
|
+
if (!api2) return;
|
|
33
|
+
canScrollPrev.set(api2.canScrollPrev());
|
|
34
|
+
canScrollNext.set(api2.canScrollNext());
|
|
35
|
+
selectedIndexStore.set(api2.selectedScrollSnap());
|
|
36
|
+
}
|
|
37
|
+
$: if (api) {
|
|
38
|
+
onSelect(api);
|
|
39
|
+
api.on("select", onSelect);
|
|
40
|
+
api.on("reInit", onSelect);
|
|
41
|
+
}
|
|
42
|
+
function handleKeyDown(e) {
|
|
43
|
+
if (e.key === "ArrowLeft") {
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
scrollPrev();
|
|
46
|
+
} else if (e.key === "ArrowRight") {
|
|
47
|
+
e.preventDefault();
|
|
48
|
+
scrollNext();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
setEmblaContext({
|
|
52
|
+
api: apiStore,
|
|
53
|
+
scrollPrev,
|
|
54
|
+
scrollNext,
|
|
55
|
+
orientation: orientationStore,
|
|
56
|
+
canScrollNext,
|
|
57
|
+
canScrollPrev,
|
|
58
|
+
handleKeyDown,
|
|
59
|
+
options: optionsStore,
|
|
60
|
+
plugins: pluginStore,
|
|
61
|
+
onInit,
|
|
62
|
+
scrollSnaps: scrollSnapsStore,
|
|
63
|
+
selectedIndex: selectedIndexStore,
|
|
64
|
+
scrollTo
|
|
65
|
+
});
|
|
66
|
+
function onInit(event) {
|
|
67
|
+
api = event.detail;
|
|
68
|
+
apiStore.set(api);
|
|
69
|
+
scrollSnapsStore.set(api.scrollSnapList());
|
|
70
|
+
}
|
|
71
|
+
onDestroy(() => {
|
|
72
|
+
api?.off("select", onSelect);
|
|
73
|
+
});
|
|
74
|
+
</script>
|
|
75
|
+
|
|
76
|
+
<div
|
|
77
|
+
class={cn("relative", className)}
|
|
78
|
+
on:mouseenter
|
|
79
|
+
on:mouseleave
|
|
80
|
+
role="region"
|
|
81
|
+
aria-roledescription="carousel"
|
|
82
|
+
{...$$restProps}
|
|
83
|
+
>
|
|
84
|
+
<slot />
|
|
85
|
+
</div>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import { type CarouselProps } from "./context.js";
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: CarouselProps;
|
|
5
|
+
events: {
|
|
6
|
+
mouseenter: MouseEvent;
|
|
7
|
+
mouseleave: MouseEvent;
|
|
8
|
+
} & {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {
|
|
12
|
+
default: {};
|
|
13
|
+
};
|
|
14
|
+
exports?: {} | undefined;
|
|
15
|
+
bindings?: string | undefined;
|
|
16
|
+
};
|
|
17
|
+
type CarouselProps_ = typeof __propDef.props;
|
|
18
|
+
export { CarouselProps_ as CarouselProps };
|
|
19
|
+
export type CarouselEvents = typeof __propDef.events;
|
|
20
|
+
export type CarouselSlots = typeof __propDef.slots;
|
|
21
|
+
export default class Carousel extends SvelteComponent<CarouselProps_, CarouselEvents, CarouselSlots> {
|
|
22
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { EmblaCarouselSvelteType } from "embla-carousel-svelte";
|
|
2
|
+
import type emblaCarouselSvelte from "embla-carousel-svelte";
|
|
3
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
+
import type { Readable, Writable } from "svelte/store";
|
|
5
|
+
export type CarouselAPI = NonNullable<NonNullable<EmblaCarouselSvelteType["$$_attributes"]>["on:emblaInit"]> extends (evt: CustomEvent<infer CarouselAPI>) => void ? CarouselAPI : never;
|
|
6
|
+
type EmblaCarouselConfig = NonNullable<Parameters<typeof emblaCarouselSvelte>[1]>;
|
|
7
|
+
export type CarouselOptions = EmblaCarouselConfig["options"];
|
|
8
|
+
export type CarouselPlugins = EmblaCarouselConfig["plugins"];
|
|
9
|
+
export type CarouselProps = {
|
|
10
|
+
opts?: CarouselOptions;
|
|
11
|
+
plugins?: CarouselPlugins;
|
|
12
|
+
api?: CarouselAPI;
|
|
13
|
+
orientation?: "horizontal" | "vertical";
|
|
14
|
+
} & HTMLAttributes<HTMLDivElement>;
|
|
15
|
+
type EmblaContext = {
|
|
16
|
+
api: Writable<CarouselAPI | undefined>;
|
|
17
|
+
orientation: Writable<"horizontal" | "vertical">;
|
|
18
|
+
scrollNext: () => void;
|
|
19
|
+
scrollPrev: () => void;
|
|
20
|
+
canScrollNext: Readable<boolean>;
|
|
21
|
+
canScrollPrev: Readable<boolean>;
|
|
22
|
+
handleKeyDown: (e: KeyboardEvent) => void;
|
|
23
|
+
options: Writable<CarouselOptions>;
|
|
24
|
+
plugins: Writable<CarouselPlugins>;
|
|
25
|
+
onInit: (e: CustomEvent<CarouselAPI>) => void;
|
|
26
|
+
scrollTo: (index: number, jump?: boolean) => void;
|
|
27
|
+
scrollSnaps: Readable<number[]>;
|
|
28
|
+
selectedIndex: Readable<number>;
|
|
29
|
+
};
|
|
30
|
+
export declare function setEmblaContext(config: EmblaContext): EmblaContext;
|
|
31
|
+
export declare function getEmblaContext(name?: string): EmblaContext;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { getContext, hasContext, setContext } from "svelte";
|
|
2
|
+
const EMBLA_CAROUSEL_CONTEXT = Symbol("EMBLA_CAROUSEL_CONTEXT");
|
|
3
|
+
export function setEmblaContext(config) {
|
|
4
|
+
setContext(EMBLA_CAROUSEL_CONTEXT, config);
|
|
5
|
+
return config;
|
|
6
|
+
}
|
|
7
|
+
export function getEmblaContext(name = "This component") {
|
|
8
|
+
if (!hasContext(EMBLA_CAROUSEL_CONTEXT)) {
|
|
9
|
+
throw new Error(`${name} must be used within a <Carousel.Root> component`);
|
|
10
|
+
}
|
|
11
|
+
return getContext(EMBLA_CAROUSEL_CONTEXT);
|
|
12
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as Root } from "./carousel.svelte";
|
|
2
|
+
export { default as Content } from "./carousel-content.svelte";
|
|
3
|
+
export { default as Item } from "./carousel-item.svelte";
|
|
4
|
+
export { default as Previous } from "./carousel-previous.svelte";
|
|
5
|
+
export { default as Next } from "./carousel-next.svelte";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as Root } from "./carousel.svelte";
|
|
2
|
+
export { default as Content } from "./carousel-content.svelte";
|
|
3
|
+
export { default as Item } from "./carousel-item.svelte";
|
|
4
|
+
export { default as Previous } from "./carousel-previous.svelte";
|
|
5
|
+
export { default as Next } from "./carousel-next.svelte";
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { type VariantProps } from "tailwind-variants";
|
|
2
|
+
import Root from "./toggle.svelte";
|
|
3
|
+
export declare const toggleVariants: import("tailwind-variants").TVReturnType<{
|
|
4
|
+
variant: {
|
|
5
|
+
default: string;
|
|
6
|
+
outline: string;
|
|
7
|
+
};
|
|
8
|
+
size: {
|
|
9
|
+
default: string;
|
|
10
|
+
sm: string;
|
|
11
|
+
lg: string;
|
|
12
|
+
};
|
|
13
|
+
}, undefined, "ring-offset-background hover:bg-muted hover:text-muted-foreground focus-visible:ring-ring data-[state=on]:bg-accent data-[state=on]:text-accent-foreground inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", import("tailwind-variants/dist/config.d.ts").TVConfig<{
|
|
14
|
+
variant: {
|
|
15
|
+
default: string;
|
|
16
|
+
outline: string;
|
|
17
|
+
};
|
|
18
|
+
size: {
|
|
19
|
+
default: string;
|
|
20
|
+
sm: string;
|
|
21
|
+
lg: string;
|
|
22
|
+
};
|
|
23
|
+
}, {
|
|
24
|
+
variant: {
|
|
25
|
+
default: string;
|
|
26
|
+
outline: string;
|
|
27
|
+
};
|
|
28
|
+
size: {
|
|
29
|
+
default: string;
|
|
30
|
+
sm: string;
|
|
31
|
+
lg: string;
|
|
32
|
+
};
|
|
33
|
+
}>, {
|
|
34
|
+
variant: {
|
|
35
|
+
default: string;
|
|
36
|
+
outline: string;
|
|
37
|
+
};
|
|
38
|
+
size: {
|
|
39
|
+
default: string;
|
|
40
|
+
sm: string;
|
|
41
|
+
lg: string;
|
|
42
|
+
};
|
|
43
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
44
|
+
variant: {
|
|
45
|
+
default: string;
|
|
46
|
+
outline: string;
|
|
47
|
+
};
|
|
48
|
+
size: {
|
|
49
|
+
default: string;
|
|
50
|
+
sm: string;
|
|
51
|
+
lg: string;
|
|
52
|
+
};
|
|
53
|
+
}, undefined, "ring-offset-background hover:bg-muted hover:text-muted-foreground focus-visible:ring-ring data-[state=on]:bg-accent data-[state=on]:text-accent-foreground inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", import("tailwind-variants/dist/config.d.ts").TVConfig<{
|
|
54
|
+
variant: {
|
|
55
|
+
default: string;
|
|
56
|
+
outline: string;
|
|
57
|
+
};
|
|
58
|
+
size: {
|
|
59
|
+
default: string;
|
|
60
|
+
sm: string;
|
|
61
|
+
lg: string;
|
|
62
|
+
};
|
|
63
|
+
}, {
|
|
64
|
+
variant: {
|
|
65
|
+
default: string;
|
|
66
|
+
outline: string;
|
|
67
|
+
};
|
|
68
|
+
size: {
|
|
69
|
+
default: string;
|
|
70
|
+
sm: string;
|
|
71
|
+
lg: string;
|
|
72
|
+
};
|
|
73
|
+
}>, unknown, unknown, undefined>>;
|
|
74
|
+
export type Variant = VariantProps<typeof toggleVariants>["variant"];
|
|
75
|
+
export type Size = VariantProps<typeof toggleVariants>["size"];
|
|
76
|
+
export { Root, Root as Toggle, };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { tv } from "tailwind-variants";
|
|
2
|
+
import Root from "./toggle.svelte";
|
|
3
|
+
export const toggleVariants = tv({
|
|
4
|
+
base: "ring-offset-background hover:bg-muted hover:text-muted-foreground focus-visible:ring-ring data-[state=on]:bg-accent data-[state=on]:text-accent-foreground inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
5
|
+
variants: {
|
|
6
|
+
variant: {
|
|
7
|
+
default: "bg-transparent",
|
|
8
|
+
outline: "border-input hover:bg-accent hover:text-accent-foreground border bg-transparent",
|
|
9
|
+
},
|
|
10
|
+
size: {
|
|
11
|
+
default: "h-10 px-3",
|
|
12
|
+
sm: "h-9 px-2.5",
|
|
13
|
+
lg: "h-11 px-5",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
defaultVariants: {
|
|
17
|
+
variant: "default",
|
|
18
|
+
size: "default",
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
export { Root,
|
|
22
|
+
//
|
|
23
|
+
Root as Toggle, };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script>import { Toggle as TogglePrimitive } from "bits-ui";
|
|
2
|
+
import { toggleVariants } from "./index.js";
|
|
3
|
+
import { cn } from "../../utils/shadcn-utils.js";
|
|
4
|
+
let className = void 0;
|
|
5
|
+
export let variant = "default";
|
|
6
|
+
export let size = "default";
|
|
7
|
+
export let pressed = void 0;
|
|
8
|
+
export { className as class };
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<TogglePrimitive.Root
|
|
12
|
+
bind:pressed
|
|
13
|
+
class={cn(toggleVariants({ variant, size, className }))}
|
|
14
|
+
{...$$restProps}
|
|
15
|
+
on:click
|
|
16
|
+
>
|
|
17
|
+
<slot />
|
|
18
|
+
</TogglePrimitive.Root>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import { Toggle as TogglePrimitive } from "bits-ui";
|
|
3
|
+
import { type Size, type Variant } from "./index.js";
|
|
4
|
+
declare const __propDef: {
|
|
5
|
+
props: {
|
|
6
|
+
disabled?: boolean | undefined;
|
|
7
|
+
pressed?: boolean | undefined | undefined;
|
|
8
|
+
onPressedChange?: import("bits-ui/dist/internal/types.js").OnChangeFn<boolean> | undefined;
|
|
9
|
+
asChild?: boolean | undefined | undefined;
|
|
10
|
+
el?: HTMLButtonElement | undefined;
|
|
11
|
+
} & import("svelte/elements.js").HTMLButtonAttributes & {
|
|
12
|
+
variant?: Variant;
|
|
13
|
+
size?: Size;
|
|
14
|
+
};
|
|
15
|
+
slots: {
|
|
16
|
+
default: {};
|
|
17
|
+
};
|
|
18
|
+
events: TogglePrimitive.Events;
|
|
19
|
+
};
|
|
20
|
+
export type ToggleProps = typeof __propDef.props;
|
|
21
|
+
export type ToggleEvents = typeof __propDef.events;
|
|
22
|
+
export type ToggleSlots = typeof __propDef.slots;
|
|
23
|
+
export default class Toggle extends SvelteComponent<ToggleProps, ToggleEvents, ToggleSlots> {
|
|
24
|
+
}
|
|
25
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stubber/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "vite dev",
|
|
6
6
|
"build": "vite build && pnpm run package && node ./fix_dts_imports.js",
|
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
"bits-ui": "^0.22.0",
|
|
69
69
|
"clsx": "^2.1.1",
|
|
70
70
|
"cmdk-sv": "^0.0.18",
|
|
71
|
+
"embla-carousel-svelte": "^8.6.0",
|
|
71
72
|
"svelte-popperjs": "^1.3.2",
|
|
72
73
|
"svelte-select": "^5.6.0",
|
|
73
74
|
"svelte-sonner": "^0.3.28",
|