Bug: use clsx on svelte element classNames (#60)
use clsx on svelte element classNames
This commit is contained in:
parent
96d0d65dc5
commit
1fa98c204c
9 changed files with 17 additions and 14 deletions
BIN
bun.lockb
BIN
bun.lockb
Binary file not shown.
|
|
@ -74,6 +74,7 @@
|
||||||
"@prisma/client": "6.0.1",
|
"@prisma/client": "6.0.1",
|
||||||
"@tailwindcss/typography": "^0.5.15",
|
"@tailwindcss/typography": "^0.5.15",
|
||||||
"clerk-sveltekit": "https://pkg.pr.new/wobsoriano/clerk-sveltekit@ca15d4e",
|
"clerk-sveltekit": "https://pkg.pr.new/wobsoriano/clerk-sveltekit@ca15d4e",
|
||||||
|
"clsx": "^2.1.1",
|
||||||
"dayjs": "^1.11.13",
|
"dayjs": "^1.11.13",
|
||||||
"eslint_d": "^14.3.0",
|
"eslint_d": "^14.3.0",
|
||||||
"graphql": "^16.9.0",
|
"graphql": "^16.9.0",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { DaisyColor, DaisySize } from '$lib/types';
|
import type { DaisyColor, DaisySize } from '$lib/types';
|
||||||
|
import clsx from 'clsx';
|
||||||
import type { SvelteHTMLElements } from 'svelte/elements';
|
import type { SvelteHTMLElements } from 'svelte/elements';
|
||||||
import { twMerge } from 'tailwind-merge';
|
import { twMerge } from 'tailwind-merge';
|
||||||
|
|
||||||
|
|
@ -37,7 +38,7 @@
|
||||||
<button
|
<button
|
||||||
{...props}
|
{...props}
|
||||||
{disabled}
|
{disabled}
|
||||||
class={twMerge('btn', className)}
|
class={twMerge('btn', clsx(className))}
|
||||||
class:btn-active={active}
|
class:btn-active={active}
|
||||||
class:no-animation={!animation}
|
class:no-animation={!animation}
|
||||||
class:btn-block={block}
|
class:btn-block={block}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { DaisyColor, DaisySize } from '$lib/types';
|
import type { DaisyColor, DaisySize } from '$lib/types';
|
||||||
|
import clsx from 'clsx';
|
||||||
import type { Snippet } from 'svelte';
|
import type { Snippet } from 'svelte';
|
||||||
import type { HTMLInputTypeAttribute, SvelteHTMLElements } from 'svelte/elements';
|
import type { HTMLInputTypeAttribute, SvelteHTMLElements } from 'svelte/elements';
|
||||||
import { fade as fadeTransition } from 'svelte/transition';
|
import { fade as fadeTransition } from 'svelte/transition';
|
||||||
|
import { twMerge } from 'tailwind-merge';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
bordered?: boolean;
|
bordered?: boolean;
|
||||||
|
|
@ -21,17 +23,14 @@
|
||||||
|
|
||||||
let {
|
let {
|
||||||
bordered = false,
|
bordered = false,
|
||||||
|
class: className,
|
||||||
color,
|
color,
|
||||||
disabled,
|
|
||||||
error,
|
error,
|
||||||
fade,
|
fade,
|
||||||
start,
|
start,
|
||||||
end,
|
end,
|
||||||
label,
|
label,
|
||||||
name,
|
|
||||||
placeholder,
|
|
||||||
size,
|
size,
|
||||||
type = 'text',
|
|
||||||
...props
|
...props
|
||||||
}: Props = $props();
|
}: Props = $props();
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -82,7 +81,7 @@
|
||||||
{:else}
|
{:else}
|
||||||
{@render start?.()}
|
{@render start?.()}
|
||||||
{/if}
|
{/if}
|
||||||
<input {...props} {disabled} {name} {placeholder} {type} class="grow" />
|
<input {...props} class={twMerge('grow', clsx(className))} />
|
||||||
{#if typeof end === 'string'}
|
{#if typeof end === 'string'}
|
||||||
{end}
|
{end}
|
||||||
{:else}
|
{:else}
|
||||||
|
|
@ -90,6 +89,3 @@
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<style>
|
|
||||||
</style>
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import clsx from 'clsx';
|
||||||
import type { DaisyColor } from '$lib/types';
|
import type { DaisyColor } from '$lib/types';
|
||||||
import type { SvelteHTMLElements } from 'svelte/elements';
|
import type { SvelteHTMLElements } from 'svelte/elements';
|
||||||
import { twMerge } from 'tailwind-merge';
|
import { twMerge } from 'tailwind-merge';
|
||||||
|
|
@ -10,7 +11,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<progress
|
<progress
|
||||||
class={twMerge(className, 'progress')}
|
class={twMerge('progress', clsx(className))}
|
||||||
class:progress-primary={color === 'primary'}
|
class:progress-primary={color === 'primary'}
|
||||||
class:progress-secondary={color === 'secondary'}
|
class:progress-secondary={color === 'secondary'}
|
||||||
class:progress-accent={color === 'accent'}
|
class:progress-accent={color === 'accent'}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import clsx from 'clsx';
|
||||||
import type { Snippet } from 'svelte';
|
import type { Snippet } from 'svelte';
|
||||||
import type { SvelteHTMLElements } from 'svelte/elements';
|
import type { SvelteHTMLElements } from 'svelte/elements';
|
||||||
import { twMerge } from 'tailwind-merge';
|
import { twMerge } from 'tailwind-merge';
|
||||||
|
|
@ -9,4 +10,4 @@
|
||||||
let { children, class: className, ...props }: Props = $props();
|
let { children, class: className, ...props }: Props = $props();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div {...props} class={twMerge('skeleton', className)}>{@render children?.()}</div>
|
<div {...props} class={twMerge('skeleton', clsx(className))}>{@render children?.()}</div>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { DaisyColor } from '$lib/types';
|
import type { DaisyColor } from '$lib/types';
|
||||||
|
import clsx from 'clsx';
|
||||||
import type { SvelteHTMLElements } from 'svelte/elements';
|
import type { SvelteHTMLElements } from 'svelte/elements';
|
||||||
import { twMerge } from 'tailwind-merge';
|
import { twMerge } from 'tailwind-merge';
|
||||||
|
|
||||||
|
|
@ -13,7 +14,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class={twMerge('tooltip', className)}
|
class={twMerge('tooltip', clsx(className))}
|
||||||
class:tooltip-primary={color === 'primary'}
|
class:tooltip-primary={color === 'primary'}
|
||||||
class:tooltip-secondary={color === 'secondary'}
|
class:tooltip-secondary={color === 'secondary'}
|
||||||
class:tooltip-accent={color === 'accent'}
|
class:tooltip-accent={color === 'accent'}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { DaisyColor } from '$lib/types';
|
import type { DaisyColor } from '$lib/types';
|
||||||
|
import clsx from 'clsx';
|
||||||
import type { SvelteHTMLElements } from 'svelte/elements';
|
import type { SvelteHTMLElements } from 'svelte/elements';
|
||||||
import { twMerge } from 'tailwind-merge';
|
import { twMerge } from 'tailwind-merge';
|
||||||
|
|
||||||
|
|
@ -12,7 +13,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class={twMerge('divider', className)}
|
class={twMerge('divider', clsx(className))}
|
||||||
class:divider-neutral={color === 'neutral'}
|
class:divider-neutral={color === 'neutral'}
|
||||||
class:divider-primary={color === 'primary'}
|
class:divider-primary={color === 'primary'}
|
||||||
class:divider-secondary={color === 'secondary'}
|
class:divider-secondary={color === 'secondary'}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { DaisyColor } from '$lib/types';
|
import type { DaisyColor } from '$lib/types';
|
||||||
|
import clsx from 'clsx';
|
||||||
import type { SvelteHTMLElements } from 'svelte/elements';
|
import type { SvelteHTMLElements } from 'svelte/elements';
|
||||||
import { twMerge } from 'tailwind-merge';
|
import { twMerge } from 'tailwind-merge';
|
||||||
|
|
||||||
|
|
@ -9,7 +10,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<a
|
<a
|
||||||
class={twMerge(className, 'link')}
|
class={twMerge('link', clsx(className))}
|
||||||
class:link-primary={color === 'primary'}
|
class:link-primary={color === 'primary'}
|
||||||
class:link-secondary={color === 'secondary'}
|
class:link-secondary={color === 'secondary'}
|
||||||
class:link-accent={color === 'accent'}
|
class:link-accent={color === 'accent'}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue