feat: 为Select组件实现DaisyUI样式

This commit is contained in:
2025-12-23 14:39:03 +08:00
parent be210a3e36
commit 00bd397986
3 changed files with 52 additions and 11 deletions

View File

@ -1,6 +1,6 @@
<script lang="ts">
import { Select as BitsSelect, type WithoutChildren } from 'bits-ui';
import { elasticOut, cubicOut } from 'svelte/easing';
import { cubicOut } from 'svelte/easing';
type Props = WithoutChildren<BitsSelect.ContentProps> & {
items: { value: string; label: string; disabled?: boolean }[];
@ -21,7 +21,7 @@
) {
const {
delay = 0,
duration = 1000,
duration = 200,
easing = cubicOut,
y = -6,
start = 0.95,
@ -59,11 +59,7 @@ transform: ${existingTransform} ${translate} ${scale};
{#snippet child({ wrapperProps, props, open })}
{#if open}
<div {...wrapperProps}>
<div
{...props}
in:selectTransition={{ easing: elasticOut }}
out:selectTransition={{ duration: 200 }}
>
<div {...props} transition:selectTransition>
<BitsSelect.ScrollUpButton>up</BitsSelect.ScrollUpButton>
<BitsSelect.Viewport class="p-1">
{#each items as { value, label, disabled } (value)}