fix: Fix lint errors (#559)
* cleanup: postactions styling * misc: fix first round of errors * pkg: remove vitest * fix: fix lint errors stage 2 * fix: fix lint errors stage 3 * fix: fix lint errors, stage 3 * misc: update eslint rules to warn for writable derived
This commit is contained in:
1 parent
1824245f13
commit
76c581123a
225 files changed
+1553
-2352
No files matched your search
@@ -1,12 +1,12 @@
|
||||
<script lang="ts">
|
||||
import { Button } from '../index.js'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import { Icon, XMark } from 'svelte-hero-icons'
|
||||
import { backOut, expoOut } from 'svelte/easing'
|
||||
import { fade, scale } from 'svelte/transition'
|
||||
import { focusTrap } from 'svelte-focus-trap'
|
||||
import Portal from '../popover/Portal.svelte'
|
||||
import { Icon, XMark } from 'svelte-hero-icons'
|
||||
import { backOut } from 'svelte/easing'
|
||||
import type { ClassValue } from 'svelte/elements'
|
||||
import { fade, scale } from 'svelte/transition'
|
||||
import { Button } from '../index.js'
|
||||
import Portal from '../popover/Portal.svelte'
|
||||
import type { Snippet } from 'svelte'
|
||||
|
||||
interface Props {
|
||||
action?: string | undefined
|
||||
@@ -14,9 +14,9 @@
|
||||
title?: string | undefined | null
|
||||
dismissable?: boolean
|
||||
class?: ClassValue
|
||||
customTitle?: import('svelte').Snippet
|
||||
children?: import('svelte').Snippet
|
||||
actions?: import('svelte').Snippet<[any]>
|
||||
customTitle?: Snippet
|
||||
children?: Snippet
|
||||
actions?: Snippet<[{ action: string }]>
|
||||
ondismissed?: () => void
|
||||
onaction?: () => void
|
||||
}
|
||||
@@ -34,20 +34,19 @@
|
||||
class: clazz = '',
|
||||
}: Props = $props()
|
||||
|
||||
let el: any = $state()
|
||||
let el = $state<HTMLElement>()
|
||||
</script>
|
||||
|
||||
<Portal>
|
||||
{#if open}
|
||||
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
||||
<!-- svelte-ignore a11y_no_noninteractive_element_interactions -->
|
||||
<div
|
||||
role="dialog"
|
||||
class="overflow-hidden fixed top-0 left-0 w-screen h-screen z-100
|
||||
flex flex-col items-center justify-center backdrop-blur-xs
|
||||
bg-white/50 dark:bg-black/50 box-border p-4"
|
||||
transition:fade|global={{ duration: 100 }}
|
||||
onclick={(e) => {
|
||||
onclick={e => {
|
||||
// @ts-expect-error html node hell
|
||||
if (!el.contains(e.target)) {
|
||||
open = false
|
||||
|
||||
@@ -55,7 +54,6 @@ bg-white/50 dark:bg-black/50 box-border p-4"
|
||||
}
|
||||
}}
|
||||
>
|
||||
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
||||
<div
|
||||
bind:this={el}
|
||||
use:focusTrap
|
||||
@@ -100,7 +98,7 @@ bg-white/50 dark:bg-black/50 box-border p-4"
|
||||
{#if actions}{@render actions({ action })}{:else}
|
||||
<Button
|
||||
class="w-full"
|
||||
onclick={(e) => {
|
||||
onclick={() => {
|
||||
onaction?.()
|
||||
open = false
|
||||
ondismissed?.()
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
? 'flex-col'
|
||||
: 'flex-row'}"
|
||||
>
|
||||
{#each $shownModal.actions as action}
|
||||
{#each $shownModal.actions as action (action)}
|
||||
<Button
|
||||
size="lg"
|
||||
class="flex-1 w-full"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { IconSource } from 'svelte-hero-icons'
|
||||
import { writable } from 'svelte/store'
|
||||
|
||||
export let shownModal = writable<Modal | undefined>(undefined)
|
||||
export const shownModal = writable<Modal | undefined>()
|
||||
|
||||
interface Modal {
|
||||
actions: Action[]
|
||||
@@ -18,7 +18,7 @@ type Action = {
|
||||
/**
|
||||
* What function to run when this action is clicked. If undefined, it'll close the window.
|
||||
*/
|
||||
action: () => any
|
||||
action: () => void
|
||||
type: 'danger' | 'secondary' | 'primary'
|
||||
content: string
|
||||
icon?: IconSource
|
||||
@@ -26,7 +26,7 @@ type Action = {
|
||||
}
|
||||
|
||||
export const action = (action?: {
|
||||
action?: () => any
|
||||
action?: () => void
|
||||
type?: 'danger' | 'secondary' | 'primary'
|
||||
content?: string
|
||||
icon?: IconSource
|
||||
|
||||
Reference in new issue
Block a user