aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorMurillo Pinheiro de Oliveira <[email protected]>2024-02-28 12:42:46 -0300
committerMurillo Pinheiro de Oliveira <[email protected]>2024-02-28 12:42:46 -0300
commit907366bc11171ac5c121e9b2ccd9c0d38e634164 (patch)
tree3cc4774ebf7b8e25a41b76a2753a2957b22787c1 /src/lib
parentbd114379db9abd9d0414d9179816a23ef041ab01 (diff)
downloadcoinos-ui-907366bc11171ac5c121e9b2ccd9c0d38e634164.tar.gz
coinos-ui-907366bc11171ac5c121e9b2ccd9c0d38e634164.zip
update: ui
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/shadcn/components/ui/button/button.svelte21
-rw-r--r--src/lib/shadcn/components/ui/button/index.js32
-rw-r--r--src/lib/shadcn/components/ui/sheet/index.js99
-rw-r--r--src/lib/shadcn/components/ui/sheet/sheet-content.svelte34
-rw-r--r--src/lib/shadcn/components/ui/sheet/sheet-description.svelte10
-rw-r--r--src/lib/shadcn/components/ui/sheet/sheet-footer.svelte12
-rw-r--r--src/lib/shadcn/components/ui/sheet/sheet-header.svelte9
-rw-r--r--src/lib/shadcn/components/ui/sheet/sheet-overlay.svelte18
-rw-r--r--src/lib/shadcn/components/ui/sheet/sheet-portal.svelte10
-rw-r--r--src/lib/shadcn/components/ui/sheet/sheet-title.svelte13
10 files changed, 258 insertions, 0 deletions
diff --git a/src/lib/shadcn/components/ui/button/button.svelte b/src/lib/shadcn/components/ui/button/button.svelte
new file mode 100644
index 00000000..775b9f09
--- /dev/null
+++ b/src/lib/shadcn/components/ui/button/button.svelte
@@ -0,0 +1,21 @@
+<script>
+ import { Button as ButtonPrimitive } from "bits-ui";
+ import { cn } from "$lib/shadcn/utils";
+ import { buttonVariants } from ".";
+ let className = undefined;
+ export let variant = "default";
+ export let size = "default";
+ export let builders = [];
+ export { className as class };
+</script>
+
+<ButtonPrimitive.Root
+ {builders}
+ class={cn(buttonVariants({ variant, size, className }))}
+ type="button"
+ {...$$restProps}
+ on:click
+ on:keydown
+>
+ <slot />
+</ButtonPrimitive.Root>
diff --git a/src/lib/shadcn/components/ui/button/index.js b/src/lib/shadcn/components/ui/button/index.js
new file mode 100644
index 00000000..96d93665
--- /dev/null
+++ b/src/lib/shadcn/components/ui/button/index.js
@@ -0,0 +1,32 @@
+import Root from "./button.svelte";
+import { tv } from "tailwind-variants";
+const buttonVariants = tv({
+ base: "inline-flex items-center justify-center rounded-md text-sm font-medium whitespace-nowrap ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
+ variants: {
+ variant: {
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
+ destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
+ outline:
+ "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
+ ghost: "hover:bg-accent hover:text-accent-foreground",
+ link: "text-primary underline-offset-4 hover:underline",
+ },
+ size: {
+ default: "h-10 px-4 py-2",
+ sm: "h-9 rounded-md px-3",
+ lg: "h-11 rounded-md px-8",
+ icon: "h-10 w-10",
+ },
+ },
+ defaultVariants: {
+ variant: "default",
+ size: "default",
+ },
+});
+export {
+ Root,
+ //
+ Root as Button,
+ buttonVariants,
+};
diff --git a/src/lib/shadcn/components/ui/sheet/index.js b/src/lib/shadcn/components/ui/sheet/index.js
new file mode 100644
index 00000000..c892767c
--- /dev/null
+++ b/src/lib/shadcn/components/ui/sheet/index.js
@@ -0,0 +1,99 @@
+import { Dialog as SheetPrimitive } from "bits-ui";
+import { tv } from "tailwind-variants";
+import Portal from "./sheet-portal.svelte";
+import Overlay from "./sheet-overlay.svelte";
+import Content from "./sheet-content.svelte";
+import Header from "./sheet-header.svelte";
+import Footer from "./sheet-footer.svelte";
+import Title from "./sheet-title.svelte";
+import Description from "./sheet-description.svelte";
+const Root = SheetPrimitive.Root;
+const Close = SheetPrimitive.Close;
+const Trigger = SheetPrimitive.Trigger;
+export {
+ Root,
+ Close,
+ Trigger,
+ Portal,
+ Overlay,
+ Content,
+ Header,
+ Footer,
+ Title,
+ Description,
+ //
+ Root as Sheet,
+ Close as SheetClose,
+ Trigger as SheetTrigger,
+ Portal as SheetPortal,
+ Overlay as SheetOverlay,
+ Content as SheetContent,
+ Header as SheetHeader,
+ Footer as SheetFooter,
+ Title as SheetTitle,
+ Description as SheetDescription,
+};
+export const sheetVariants = tv({
+ base: "fixed z-50 gap-4 bg-background p-6 shadow-lg",
+ variants: {
+ side: {
+ top: "inset-x-0 top-0 border-b",
+ bottom: "inset-x-0 bottom-0 border-t",
+ left: "inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",
+ right: "inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",
+ },
+ },
+ defaultVariants: {
+ side: "right",
+ },
+});
+export const sheetTransitions = {
+ top: {
+ in: {
+ y: "-100%",
+ duration: 500,
+ opacity: 1,
+ },
+ out: {
+ y: "-100%",
+ duration: 300,
+ opacity: 1,
+ },
+ },
+ bottom: {
+ in: {
+ y: "100%",
+ duration: 500,
+ opacity: 1,
+ },
+ out: {
+ y: "100%",
+ duration: 300,
+ opacity: 1,
+ },
+ },
+ left: {
+ in: {
+ x: "-100%",
+ duration: 500,
+ opacity: 1,
+ },
+ out: {
+ x: "-100%",
+ duration: 300,
+ opacity: 1,
+ },
+ },
+ right: {
+ in: {
+ x: "100%",
+ duration: 500,
+ opacity: 1,
+ },
+ out: {
+ x: "100%",
+ duration: 300,
+ opacity: 1,
+ },
+ },
+};
diff --git a/src/lib/shadcn/components/ui/sheet/sheet-content.svelte b/src/lib/shadcn/components/ui/sheet/sheet-content.svelte
new file mode 100644
index 00000000..8e7a0ffd
--- /dev/null
+++ b/src/lib/shadcn/components/ui/sheet/sheet-content.svelte
@@ -0,0 +1,34 @@
+<script>
+ import { Dialog as SheetPrimitive } from "bits-ui";
+ import X from "lucide-svelte/icons/x";
+ import { SheetOverlay, SheetPortal, sheetTransitions, sheetVariants } from ".";
+ import { cn } from "$lib/shadcn/utils";
+ import { fly } from "svelte/transition";
+ let className = undefined;
+ export let side = "right";
+ export { className as class };
+ export let inTransition = fly;
+ export let inTransitionConfig = sheetTransitions[side ? side : "right"]["in"];
+ export let outTransition = fly;
+ export let outTransitionConfig = sheetTransitions[side ? side : "right"]["out"];
+</script>
+
+<SheetPortal>
+ <SheetOverlay />
+ <SheetPrimitive.Content
+ {inTransition}
+ {inTransitionConfig}
+ {outTransition}
+ {outTransitionConfig}
+ class={cn(sheetVariants({ side }), className)}
+ {...$$restProps}
+ >
+ <slot />
+ <SheetPrimitive.Close
+ class="absolute right-4 top-4 rounded-sm opacity-100 ring-offset-background hover:bg-swapee-purple transition-all focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-black dark:data-[state=open]:bg-white"
+ >
+ <X class="h-8 w-8" />
+ <span class="sr-only">Close</span>
+ </SheetPrimitive.Close>
+ </SheetPrimitive.Content>
+</SheetPortal>
diff --git a/src/lib/shadcn/components/ui/sheet/sheet-description.svelte b/src/lib/shadcn/components/ui/sheet/sheet-description.svelte
new file mode 100644
index 00000000..9f75b9f4
--- /dev/null
+++ b/src/lib/shadcn/components/ui/sheet/sheet-description.svelte
@@ -0,0 +1,10 @@
+<script>
+ import { Dialog as SheetPrimitive } from "bits-ui";
+ import { cn } from "$lib/shadcn/utils";
+ let className = undefined;
+ export { className as class };
+</script>
+
+<SheetPrimitive.Description class={cn("text-sm text-muted-foreground", className)} {...$$restProps}>
+ <slot />
+</SheetPrimitive.Description>
diff --git a/src/lib/shadcn/components/ui/sheet/sheet-footer.svelte b/src/lib/shadcn/components/ui/sheet/sheet-footer.svelte
new file mode 100644
index 00000000..3a958ac9
--- /dev/null
+++ b/src/lib/shadcn/components/ui/sheet/sheet-footer.svelte
@@ -0,0 +1,12 @@
+<script>
+ import { cn } from "$lib/shadcn/utils";
+ let className = undefined;
+ export { className as class };
+</script>
+
+<div
+ class={cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className)}
+ {...$$restProps}
+>
+ <slot />
+</div>
diff --git a/src/lib/shadcn/components/ui/sheet/sheet-header.svelte b/src/lib/shadcn/components/ui/sheet/sheet-header.svelte
new file mode 100644
index 00000000..c6c098a4
--- /dev/null
+++ b/src/lib/shadcn/components/ui/sheet/sheet-header.svelte
@@ -0,0 +1,9 @@
+<script>
+ import { cn } from "$lib/shadcn/utils";
+ let className = undefined;
+ export { className as class };
+</script>
+
+<div class={cn("flex flex-col space-y-2 text-center sm:text-left", className)} {...$$restProps}>
+ <slot />
+</div>
diff --git a/src/lib/shadcn/components/ui/sheet/sheet-overlay.svelte b/src/lib/shadcn/components/ui/sheet/sheet-overlay.svelte
new file mode 100644
index 00000000..8f308ce9
--- /dev/null
+++ b/src/lib/shadcn/components/ui/sheet/sheet-overlay.svelte
@@ -0,0 +1,18 @@
+<script>
+ import { Dialog as SheetPrimitive } from "bits-ui";
+ import { cn } from "$lib/shadcn/utils";
+ import { fade } from "svelte/transition";
+ let className = undefined;
+ export let transition = fade;
+ export let transitionConfig = {
+ duration: 150,
+ };
+ export { className as class };
+</script>
+
+<SheetPrimitive.Overlay
+ {transition}
+ {transitionConfig}
+ class={cn("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm ", className)}
+ {...$$restProps}
+/>
diff --git a/src/lib/shadcn/components/ui/sheet/sheet-portal.svelte b/src/lib/shadcn/components/ui/sheet/sheet-portal.svelte
new file mode 100644
index 00000000..c7384693
--- /dev/null
+++ b/src/lib/shadcn/components/ui/sheet/sheet-portal.svelte
@@ -0,0 +1,10 @@
+<script>
+ import { Dialog as SheetPrimitive } from "bits-ui";
+ import { cn } from "$lib/shadcn/utils";
+ let className = undefined;
+ export { className as class };
+</script>
+
+<SheetPrimitive.Portal class={cn(className)} {...$$restProps}>
+ <slot />
+</SheetPrimitive.Portal>
diff --git a/src/lib/shadcn/components/ui/sheet/sheet-title.svelte b/src/lib/shadcn/components/ui/sheet/sheet-title.svelte
new file mode 100644
index 00000000..1a285c75
--- /dev/null
+++ b/src/lib/shadcn/components/ui/sheet/sheet-title.svelte
@@ -0,0 +1,13 @@
+<script>
+ import { Dialog as SheetPrimitive } from "bits-ui";
+ import { cn } from "$lib/shadcn/utils";
+ let className = undefined;
+ export { className as class };
+</script>
+
+<SheetPrimitive.Title
+ class={cn("text-lg font-semibold text-foreground", className)}
+ {...$$restProps}
+>
+ <slot />
+</SheetPrimitive.Title>