update-to-daisui-5.0 #1

Merged
baobeld merged 18 commits from update-to-daisui-5.0 into main 2025-03-27 13:19:01 -04:00
3 changed files with 62 additions and 1 deletions
Showing only changes of commit e3435878b2 - Show all commits

View file

@ -0,0 +1,29 @@
<script module lang="ts">
import { defineMeta } from '@storybook/addon-svelte-csf';
import { type ComponentProps } from 'svelte';
import Swap from './Swap.svelte';
const { Story } = defineMeta({
title: 'Actions/Swap',
component: Swap,
argTypes: {
style: {
control: 'radio',
options: [undefined, 'flip', 'rotate'],
},
},
});
</script>
{#snippet template(props: Partial<ComponentProps<typeof Swap>>)}
<Swap {...props}>
{#snippet on()}
ON
{/snippet}
{#snippet off()}
OFF
{/snippet}
</Swap>
{/snippet}
<Story name="Default" children={template} />

View file

@ -0,0 +1,31 @@
<script lang="ts" module>
export type SwapStyle = 'flip' | 'rotate';
</script>
<script lang="ts">
import type { Snippet } from 'svelte';
type Props = {
active?: boolean;
indeterminate?: Snippet;
on: Snippet;
off: Snippet;
style?: SwapStyle;
};
let { active, indeterminate, on, off, style }: Props = $props();
</script>
<label
class="swap"
class:swap-active={active}
class:swap-flip={style === 'flip'}
class:swap-rotate={style === 'rotate'}
>
<input type="checkbox" />
{#if indeterminate}
{@render indeterminate()}
{/if}
<div class="swap-on fill-current">{@render on()}</div>
<div class="swap-off fill-current">{@render off()}</div>
</label>

View file

@ -1,2 +1,3 @@
export { default as Button } from './Button.svelte';
export { default as Modal } from './Modal.svelte';
export { default as Swap } from './Swap.svelte';