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
@@ -2,7 +2,6 @@
|
||||
import Button from '../button/Button.svelte'
|
||||
import { generateID } from '../forms/helper.js'
|
||||
import { Label } from '../index.js'
|
||||
import { Icon, PaperClip } from 'svelte-hero-icons'
|
||||
|
||||
interface Props {
|
||||
accept?: string
|
||||
@@ -51,12 +50,11 @@
|
||||
<div
|
||||
class="flex flex-row items-center -space-x-1 hover:space-x-1 z-20 h-8"
|
||||
>
|
||||
{#each previewURLs as file}
|
||||
<!-- svelte-ignore a11y_missing_attribute -->
|
||||
{#each previewURLs as file (file)}
|
||||
<img
|
||||
src={file}
|
||||
onload={() => URL.revokeObjectURL(file)}
|
||||
alt={file}
|
||||
alt=""
|
||||
class="w-8 h-8 object-cover rounded-full hover:w-16
|
||||
hover:h-16 transition-all border border-slate-200 ring-1
|
||||
ring-slate-50 dark:ring-zinc-950 bg-white dark:bg-zinc-950"
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy'
|
||||
|
||||
import { DocumentPlus, Icon } from 'svelte-hero-icons'
|
||||
import Label from '../forms/Label.svelte'
|
||||
import { generateID } from '../forms/helper.js'
|
||||
import { DocumentPlus, Icon } from 'svelte-hero-icons'
|
||||
import TextInput from './TextInput.svelte'
|
||||
|
||||
interface Props {
|
||||
@@ -43,11 +41,11 @@
|
||||
: ''}
|
||||
{url != undefined ? 'rounded-b-none' : ''}
|
||||
"
|
||||
ondrop={(event) => {
|
||||
ondrop={event => {
|
||||
event.preventDefault()
|
||||
files = event.dataTransfer?.files ?? null
|
||||
}}
|
||||
ondragover={(event) => {
|
||||
ondragover={event => {
|
||||
event.preventDefault()
|
||||
|
||||
if (event.dataTransfer) {
|
||||
@@ -55,7 +53,7 @@
|
||||
dragover = true
|
||||
}
|
||||
}}
|
||||
ondragleave={(e) => {
|
||||
ondragleave={e => {
|
||||
e.preventDefault()
|
||||
dragover = false
|
||||
}}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<script lang="ts">
|
||||
interface Props {
|
||||
import type { HTMLAttributes } from 'svelte/elements'
|
||||
|
||||
interface Props extends HTMLAttributes<HTMLSpanElement> {
|
||||
for?: string | undefined
|
||||
/**
|
||||
* The `text` prop will take precedence over the slot.
|
||||
@@ -7,7 +9,6 @@
|
||||
text?: string | undefined
|
||||
class?: string
|
||||
children?: import('svelte').Snippet
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
let {
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
disabled?: boolean
|
||||
children?: import('svelte').Snippet
|
||||
description?: import('svelte').Snippet
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
let {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
group?: string
|
||||
row?: boolean
|
||||
class?: string
|
||||
children?: import('svelte').Snippet<[any]>
|
||||
children?: import('svelte').Snippet<[{ group: string }]>
|
||||
}
|
||||
|
||||
let {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<script lang="ts">
|
||||
interface Props {
|
||||
defaultValue?: boolean
|
||||
checked?: boolean
|
||||
labelClass?: string
|
||||
class?: string
|
||||
@@ -9,7 +8,6 @@
|
||||
}
|
||||
|
||||
let {
|
||||
defaultValue = false,
|
||||
checked = $bindable(),
|
||||
labelClass = '',
|
||||
class: clazz = '',
|
||||
|
||||
@@ -34,10 +34,7 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import type {
|
||||
HTMLInputAttributes,
|
||||
HTMLInputTypeAttribute,
|
||||
} from 'svelte/elements'
|
||||
import type { HTMLInputAttributes } from 'svelte/elements'
|
||||
|
||||
import Label from '../forms/Label.svelte'
|
||||
import { generateID } from '../forms/helper.js'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts" generics="T">
|
||||
import { getContext, onMount, type Snippet } from 'svelte'
|
||||
import type { HTMLAttributes, HTMLOptionAttributes } from 'svelte/elements'
|
||||
<script lang="ts">
|
||||
import { getContext, type Snippet } from 'svelte'
|
||||
import type { IconSource } from 'svelte-hero-icons'
|
||||
import type { HTMLOptionAttributes } from 'svelte/elements'
|
||||
|
||||
interface Props extends Omit<HTMLOptionAttributes, 'prefix'> {
|
||||
children: Snippet
|
||||
@@ -10,7 +10,7 @@
|
||||
let { children, icon, ...rest }: Props = $props()
|
||||
|
||||
let optionElement = $state<HTMLOptionElement>()
|
||||
let option: any = $derived({
|
||||
let option = $derived({
|
||||
value: optionElement?.value ?? '',
|
||||
label: optionElement?.innerText?.trim() ?? '',
|
||||
icon: icon,
|
||||
@@ -29,7 +29,7 @@
|
||||
const context = getContext<SelectContext>('select')
|
||||
|
||||
$effect(() => {
|
||||
if (!context.options.find((v) => v == option)) {
|
||||
if (!context.options.find(v => v == option)) {
|
||||
context.options.push(option)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,28 +1,56 @@
|
||||
<script lang="ts" generics="T">
|
||||
import { run, createBubbler } from 'svelte/legacy'
|
||||
<script lang="ts" module>
|
||||
interface Props<T> extends Omit<HTMLSelectAttributes, 'size'> {
|
||||
value?: T | string | undefined
|
||||
placeholder?: string | undefined
|
||||
label?: string | undefined
|
||||
size?: ButtonSize
|
||||
shadow?: ButtonShadow
|
||||
id?: string
|
||||
class?: ClassValue
|
||||
baseClass?: ClassValue
|
||||
selectClass?: ClassValue
|
||||
customLabel?: import('svelte').Snippet
|
||||
children?: import('svelte').Snippet
|
||||
customOption?: import('svelte').Snippet<
|
||||
[
|
||||
{
|
||||
option: {
|
||||
value: string
|
||||
label: string
|
||||
icon?: IconSource
|
||||
disabled?: boolean
|
||||
}
|
||||
selected: boolean
|
||||
},
|
||||
]
|
||||
>
|
||||
oncontextmenu?: HTMLSelectAttributes['oncontextmenu']
|
||||
onchange?: HTMLSelectAttributes['onchange']
|
||||
}
|
||||
|
||||
const bubble = createBubbler()
|
||||
import {
|
||||
buttonColor,
|
||||
buttonSize,
|
||||
type ButtonShadow,
|
||||
type ButtonSize,
|
||||
buttonShadow,
|
||||
} from '../../button/Button.svelte'
|
||||
import Label from '../Label.svelte'
|
||||
import { generateID } from '../helper.js'
|
||||
import Menu from '../../popover/Menu.svelte'
|
||||
import MenuButton from '../../popover/MenuButton.svelte'
|
||||
import Popover from '../../popover/Popover.svelte'
|
||||
import { createEventDispatcher, onMount, setContext, tick } from 'svelte'
|
||||
export type { Props as SelectProps }
|
||||
</script>
|
||||
|
||||
<script lang="ts" generics="T">
|
||||
import { setContext, tick } from 'svelte'
|
||||
import {
|
||||
CheckCircle,
|
||||
ChevronDown,
|
||||
ChevronUpDown,
|
||||
Icon,
|
||||
type IconSource,
|
||||
} from 'svelte-hero-icons'
|
||||
import type { ClassValue, HTMLSelectAttributes } from 'svelte/elements'
|
||||
import {
|
||||
buttonColor,
|
||||
buttonShadow,
|
||||
buttonSize,
|
||||
type ButtonShadow,
|
||||
type ButtonSize,
|
||||
} from '../../button/Button.svelte'
|
||||
import Menu from '../../popover/Menu.svelte'
|
||||
import MenuButton from '../../popover/MenuButton.svelte'
|
||||
import Label from '../Label.svelte'
|
||||
import { generateID } from '../helper.js'
|
||||
|
||||
let open = $state(false)
|
||||
let element: HTMLSelectElement | undefined = $state()
|
||||
@@ -40,23 +68,6 @@
|
||||
options: [],
|
||||
})
|
||||
|
||||
interface Props extends Omit<HTMLSelectAttributes, 'size'> {
|
||||
value?: T | string | undefined
|
||||
placeholder?: string | undefined
|
||||
label?: string | undefined
|
||||
size?: ButtonSize
|
||||
shadow?: ButtonShadow
|
||||
id?: string
|
||||
class?: ClassValue
|
||||
baseClass?: ClassValue
|
||||
selectClass?: ClassValue
|
||||
customLabel?: import('svelte').Snippet
|
||||
children?: import('svelte').Snippet
|
||||
customOption?: import('svelte').Snippet<[any]>
|
||||
oncontextmenu?: HTMLSelectAttributes['oncontextmenu']
|
||||
onchange?: HTMLSelectAttributes['onchange']
|
||||
}
|
||||
|
||||
let {
|
||||
value = $bindable(undefined),
|
||||
placeholder = undefined,
|
||||
@@ -73,7 +84,7 @@
|
||||
oncontextmenu,
|
||||
onchange,
|
||||
...rest
|
||||
}: Props = $props()
|
||||
}: Props<T> = $props()
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col gap-1 {clazz} {baseClass}">
|
||||
@@ -96,10 +107,10 @@
|
||||
w-full min-w-full cursor-pointer pr-6 {buttonColor.secondary}
|
||||
{clazz} {selectClass}"
|
||||
bind:value
|
||||
onmousedown={(e) => {
|
||||
onmousedown={e => {
|
||||
e.preventDefault()
|
||||
}}
|
||||
onkeypress={(e) => {
|
||||
onkeypress={e => {
|
||||
e.preventDefault()
|
||||
open = !open
|
||||
}}
|
||||
@@ -114,7 +125,7 @@
|
||||
</select>
|
||||
{/snippet}
|
||||
|
||||
{#each context.options as option}
|
||||
{#each context.options as option (option)}
|
||||
{#if customOption}{@render customOption({
|
||||
option,
|
||||
selected: option.value == value,
|
||||
|
||||
Reference in new issue
Block a user