From da34c24f91446f55accb78ae9172ff8f91575feb Mon Sep 17 00:00:00 2001 From: R2m1liA <15258427350@163.com> Date: Mon, 22 Dec 2025 15:36:29 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=9E=E7=8E=B0Slect=E7=BB=84?= =?UTF-8?q?=E4=BB=B6/=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/components/ui/select/Select.svelte | 15 ++++++ .../components/ui/select/SelectContent.svelte | 54 +++++++++++++++++++ .../components/ui/select/SelectTrigger.svelte | 17 ++++++ src/lib/components/ui/select/index.ts | 3 ++ src/routes/layout.css | 1 + src/styles/select-motion.css | 13 +++++ 6 files changed, 103 insertions(+) create mode 100644 src/lib/components/ui/select/Select.svelte create mode 100644 src/lib/components/ui/select/SelectContent.svelte create mode 100644 src/lib/components/ui/select/SelectTrigger.svelte create mode 100644 src/lib/components/ui/select/index.ts create mode 100644 src/styles/select-motion.css diff --git a/src/lib/components/ui/select/Select.svelte b/src/lib/components/ui/select/Select.svelte new file mode 100644 index 0000000..8b2ca43 --- /dev/null +++ b/src/lib/components/ui/select/Select.svelte @@ -0,0 +1,15 @@ + + + + {@render children?.()} + diff --git a/src/lib/components/ui/select/SelectContent.svelte b/src/lib/components/ui/select/SelectContent.svelte new file mode 100644 index 0000000..1fe8d76 --- /dev/null +++ b/src/lib/components/ui/select/SelectContent.svelte @@ -0,0 +1,54 @@ + + + + + up + + {#each items as { value, label, disabled } (value)} + + {label} + + {/each} + + down + + + + diff --git a/src/lib/components/ui/select/SelectTrigger.svelte b/src/lib/components/ui/select/SelectTrigger.svelte new file mode 100644 index 0000000..713b46f --- /dev/null +++ b/src/lib/components/ui/select/SelectTrigger.svelte @@ -0,0 +1,17 @@ + + + + {@render children?.()} + diff --git a/src/lib/components/ui/select/index.ts b/src/lib/components/ui/select/index.ts new file mode 100644 index 0000000..96bfb56 --- /dev/null +++ b/src/lib/components/ui/select/index.ts @@ -0,0 +1,3 @@ +export { default as Select } from './Select.svelte'; +export { default as SelectTrigger } from './SelectTrigger.svelte'; +export { default as SelectContent } from './SelectContent.svelte'; diff --git a/src/routes/layout.css b/src/routes/layout.css index 421361e..80ce3db 100644 --- a/src/routes/layout.css +++ b/src/routes/layout.css @@ -1,4 +1,5 @@ @import "tailwindcss"; +@import "../styles/select-motion.css"; @plugin "@tailwindcss/forms"; @plugin "daisyui" { logs: false; diff --git a/src/styles/select-motion.css b/src/styles/select-motion.css new file mode 100644 index 0000000..dd39b22 --- /dev/null +++ b/src/styles/select-motion.css @@ -0,0 +1,13 @@ +@layer components { + .select-motion { + @apply transition-all duration-200 ease-out will-change-transform; + } + + .select-motion[data-state="open"] { + @apply pointer-events-auto translate-y-0 scale-100 opacity-100; + } + + .select-motion[data-state="closed"] { + @apply pointer-events-none -translate-y-2 scale-95 opacity-0; + } +}