Fix lint.

This commit is contained in:
Sam Rose 2025-01-27 17:40:51 +00:00
parent 136c633ff2
commit 87b081a06f
No known key found for this signature in database
4 changed files with 26 additions and 17 deletions

View File

@ -25,6 +25,12 @@ export interface Styles {
top: number
}
export type UpdateHandler = (
anchorBounds: DOMRect,
elementBounds: DOMRect,
styles: Styles
) => Styles
interface Opts {
anchor?: HTMLElement
align: string
@ -33,11 +39,7 @@ interface Opts {
minWidth?: number
useAnchorWidth: boolean
offset: number
customUpdate?: (
anchorBounds: DOMRect,
elementBounds: DOMRect,
styles: Styles
) => Styles
customUpdate?: UpdateHandler
resizable: boolean
wrap: boolean
}

View File

@ -1,3 +1,8 @@
<script lang="ts" context="module">
type O = any
type V = any
</script>
<script lang="ts" generics="O, V">
import "@spectrum-css/fieldgroup/dist/index-vars.css"
import "@spectrum-css/radio/dist/index-vars.css"
@ -8,8 +13,8 @@
export let options: O[] = []
export let disabled = false
export let readonly = false
export let getOptionLabel: (option: O) => string = (option: O) => `${option}`
export let getOptionValue: (option: O) => V = option => option as unknown as V
export let getOptionLabel = (option: O) => `${option}`
export let getOptionValue = (option: O) => option as unknown as V
const dispatch = createEventDispatcher<{ change: V[] }>()
@ -25,6 +30,8 @@
}
</script>
import context from "src/context"
<div class={`spectrum-FieldGroup spectrum-FieldGroup--${direction}`}>
{#if options && Array.isArray(options)}
{#each options as option}

View File

@ -1,3 +1,7 @@
<script lang="ts" context="module">
type O = any
</script>
<script lang="ts" generics="O">
import type { ChangeEventHandler } from "svelte/elements"
@ -14,8 +18,8 @@
export let disabled = false
export let readonly = false
export let options: O[] = []
export let getOptionLabel: (option: O) => string = option => `${option}`
export let getOptionValue: (option: O) => string = option => `${option}`
export let getOptionLabel = (option: O) => `${option}`
export let getOptionValue = (option: O) => `${option}`
const dispatch = createEventDispatcher<{
change: string

View File

@ -3,7 +3,9 @@
// @ts-expect-error no types for the version of svelte-portal we're on.
import Portal from "svelte-portal"
import { createEventDispatcher, getContext, onDestroy } from "svelte"
import positionDropdown, { Styles } from "../Actions/position_dropdown"
import positionDropdown, {
type UpdateHandler,
} from "../Actions/position_dropdown"
import clickOutside from "../Actions/click_outside"
import { fly } from "svelte/transition"
import Context from "../context"
@ -25,13 +27,7 @@
export let customHeight: string | undefined = undefined
export let animate = true
export let customZindex: string | undefined = undefined
export let handlePostionUpdate:
| ((
anchorBounds: DOMRect,
elementBounds: DOMRect,
styles: Styles
) => Styles)
| undefined = undefined
export let handlePostionUpdate: UpdateHandler | undefined = undefined
export let showPopover = true
export let clickOutsideOverride = false
export let resizable = true