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 top: number
} }
export type UpdateHandler = (
anchorBounds: DOMRect,
elementBounds: DOMRect,
styles: Styles
) => Styles
interface Opts { interface Opts {
anchor?: HTMLElement anchor?: HTMLElement
align: string align: string
@ -33,11 +39,7 @@ interface Opts {
minWidth?: number minWidth?: number
useAnchorWidth: boolean useAnchorWidth: boolean
offset: number offset: number
customUpdate?: ( customUpdate?: UpdateHandler
anchorBounds: DOMRect,
elementBounds: DOMRect,
styles: Styles
) => Styles
resizable: boolean resizable: boolean
wrap: 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"> <script lang="ts" generics="O, V">
import "@spectrum-css/fieldgroup/dist/index-vars.css" import "@spectrum-css/fieldgroup/dist/index-vars.css"
import "@spectrum-css/radio/dist/index-vars.css" import "@spectrum-css/radio/dist/index-vars.css"
@ -8,8 +13,8 @@
export let options: O[] = [] export let options: O[] = []
export let disabled = false export let disabled = false
export let readonly = false export let readonly = false
export let getOptionLabel: (option: O) => string = (option: O) => `${option}` export let getOptionLabel = (option: O) => `${option}`
export let getOptionValue: (option: O) => V = option => option as unknown as V export let getOptionValue = (option: O) => option as unknown as V
const dispatch = createEventDispatcher<{ change: V[] }>() const dispatch = createEventDispatcher<{ change: V[] }>()
@ -25,6 +30,8 @@
} }
</script> </script>
import context from "src/context"
<div class={`spectrum-FieldGroup spectrum-FieldGroup--${direction}`}> <div class={`spectrum-FieldGroup spectrum-FieldGroup--${direction}`}>
{#if options && Array.isArray(options)} {#if options && Array.isArray(options)}
{#each options as option} {#each options as option}

View File

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

View File

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