update-to-daisui-5.0 (#1)

Co-authored-by: Benjamin Palko <benjaminpalko@hotmail.com>
Reviewed-on: #1
This commit is contained in:
Benjamin Palko 2025-03-27 13:19:01 -04:00
parent bf38f566c0
commit c001cc4907
40 changed files with 751 additions and 409 deletions

View file

@ -1,3 +1,8 @@
<script lang="ts" module>
export type ButtonShape = 'square' | 'circle';
export type ButtonStyle = 'outline' | 'dash' | 'soft' | 'ghost' | 'link';
</script>
<script lang="ts">
import type { DaisyColor, DaisySize } from '$lib/types';
import clsx from 'clsx';
@ -6,30 +11,26 @@
type Props = {
active?: boolean;
animation?: boolean;
block?: boolean;
color?: DaisyColor;
full?: boolean;
glass?: boolean;
shape?: 'circle' | 'square';
shape?: ButtonShape;
size?: DaisySize;
variant?: 'link' | 'outline';
style?: ButtonStyle;
wide?: boolean;
} & SvelteHTMLElements['button'];
let {
active = false,
animation = true,
block = false,
children,
class: className,
color,
full = false,
glass = false,
shape,
size,
style,
wide = false,
variant,
...props
}: Props = $props();
</script>
@ -38,30 +39,32 @@
{...props}
class={twMerge('btn', clsx(className))}
class:btn-active={active}
class:no-animation={!animation}
class:btn-block={block}
class:btn-neutral={color === 'neutral'}
class:btn-primary={color === 'primary'}
class:btn-secondary={color === 'secondary'}
class:btn-accent={color === 'accent'}
class:btn-ghost={color === 'ghost'}
class:btn-info={color === 'info'}
class:btn-success={color === 'success'}
class:btn-warning={color === 'warning'}
class:btn-error={color === 'error'}
class:btn-disabled={props.disabled}
class:w-full={full}
class:glass
class:btn-circle={shape === 'circle'}
class:btn-square={shape === 'square'}
class:btn-xs={size === 'xs'}
class:btn-sm={size === 'sm'}
class:btn-md={size === 'md'}
class:btn-lg={size === 'lg'}
class:btn-link={variant === 'link'}
class:btn-outline={variant === 'outline'}
class:btn-xl={size === 'xl'}
class:btn-outline={style === 'outline'}
class:btn-dash={style === 'dash'}
class:btn-soft={style === 'soft'}
class:btn-ghost={style === 'ghost'}
class:btn-link={style === 'link'}
class:btn-wide={wide}
>
{@render children?.()}
</button>
<style></style>
<style></style>