From 907366bc11171ac5c121e9b2ccd9c0d38e634164 Mon Sep 17 00:00:00 2001 From: Murillo Pinheiro de Oliveira Date: Wed, 28 Feb 2024 12:42:46 -0300 Subject: update: ui --- src/lib/shadcn/components/ui/button/button.svelte | 21 +++++ src/lib/shadcn/components/ui/button/index.js | 32 +++++++ src/lib/shadcn/components/ui/sheet/index.js | 99 ++++++++++++++++++++++ .../components/ui/sheet/sheet-content.svelte | 34 ++++++++ .../components/ui/sheet/sheet-description.svelte | 10 +++ .../shadcn/components/ui/sheet/sheet-footer.svelte | 12 +++ .../shadcn/components/ui/sheet/sheet-header.svelte | 9 ++ .../components/ui/sheet/sheet-overlay.svelte | 18 ++++ .../shadcn/components/ui/sheet/sheet-portal.svelte | 10 +++ .../shadcn/components/ui/sheet/sheet-title.svelte | 13 +++ 10 files changed, 258 insertions(+) create mode 100644 src/lib/shadcn/components/ui/button/button.svelte create mode 100644 src/lib/shadcn/components/ui/button/index.js create mode 100644 src/lib/shadcn/components/ui/sheet/index.js create mode 100644 src/lib/shadcn/components/ui/sheet/sheet-content.svelte create mode 100644 src/lib/shadcn/components/ui/sheet/sheet-description.svelte create mode 100644 src/lib/shadcn/components/ui/sheet/sheet-footer.svelte create mode 100644 src/lib/shadcn/components/ui/sheet/sheet-header.svelte create mode 100644 src/lib/shadcn/components/ui/sheet/sheet-overlay.svelte create mode 100644 src/lib/shadcn/components/ui/sheet/sheet-portal.svelte create mode 100644 src/lib/shadcn/components/ui/sheet/sheet-title.svelte (limited to 'src/lib') 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 @@ + + + + + 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 @@ + + + + + + + + + Close + + + 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 @@ + + + + + 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 @@ + + +
+ +
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 @@ + + +
+ +
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 @@ + + + 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 @@ + + + + + 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 @@ + + + + + -- cgit v1.2.3