fuma 2.0.28 → 2.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import type { HTMLInputAttributes } from 'svelte/elements'
|
|
4
4
|
import debounce from 'debounce'
|
|
5
5
|
import { toast } from 'svelte-sonner'
|
|
6
|
-
import { mdiClose } from '@mdi/js'
|
|
7
6
|
|
|
8
7
|
import { USE_COERCE_JSON } from '../../utils/constant.js'
|
|
9
8
|
import { Icon } from '../icon/index.js'
|
|
@@ -31,6 +30,7 @@
|
|
|
31
30
|
export let slotSuggestion: SnippetLike<[RelationItem]> = slotItem
|
|
32
31
|
export let input: HTMLInputAttributes | undefined = undefined
|
|
33
32
|
export let append: Snippet | undefined = undefined
|
|
33
|
+
export let disabled = false
|
|
34
34
|
|
|
35
35
|
let klass = ''
|
|
36
36
|
export { klass as class }
|
|
@@ -122,6 +122,7 @@
|
|
|
122
122
|
{:else}
|
|
123
123
|
<button
|
|
124
124
|
type="button"
|
|
125
|
+
{disabled}
|
|
125
126
|
on:click|stopPropagation={() => clear()}
|
|
126
127
|
class="input h-auto min-h-10 w-full grow items-start pt-2 pr-2"
|
|
127
128
|
>
|
|
@@ -24,6 +24,7 @@ declare class __sveltets_Render<RelationItem extends {
|
|
|
24
24
|
slotSuggestion?: SnippetLike<[RelationItem]> | undefined;
|
|
25
25
|
input?: HTMLInputAttributes | undefined;
|
|
26
26
|
append?: Snippet | undefined;
|
|
27
|
+
disabled?: boolean;
|
|
27
28
|
class?: string;
|
|
28
29
|
classList?: string;
|
|
29
30
|
inputElement?: HTMLInputElement | undefined;
|
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
options: Options
|
|
14
14
|
tippyProps?: TippyProps
|
|
15
15
|
placeholder?: string
|
|
16
|
+
disabled?: boolean
|
|
16
17
|
}
|
|
17
|
-
$: ({ value: _value, options, tippyProps, placeholder, ...props } = $$props as $$Props)
|
|
18
|
+
$: ({ value: _value, options, tippyProps, placeholder, disabled, ...props } = $$props as $$Props)
|
|
18
19
|
export let value = _value
|
|
19
20
|
|
|
20
21
|
$: _options = parseOptions(options)
|
|
@@ -43,7 +44,13 @@
|
|
|
43
44
|
<svelte:fragment slot="activator">
|
|
44
45
|
<FormControl {...props}>
|
|
45
46
|
{#snippet children({ key })}
|
|
46
|
-
<button
|
|
47
|
+
<button
|
|
48
|
+
bind:this={button}
|
|
49
|
+
id={key}
|
|
50
|
+
{disabled}
|
|
51
|
+
type="button"
|
|
52
|
+
class="input flex grow items-center pr-2"
|
|
53
|
+
>
|
|
47
54
|
{#if selectedOption}
|
|
48
55
|
{#if selectedOption.icon}
|
|
49
56
|
<Icon path={selectedOption.icon} size={21} class="opacity-70" />
|
|
@@ -1,23 +1,14 @@
|
|
|
1
1
|
<script lang="ts" context="module">
|
|
2
2
|
import { createSingleton, type TippyInstance } from '../../utils/tippy.js'
|
|
3
|
+
import type { CreateSingletonInstance } from 'tippy.js'
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
? createSingleton([], {
|
|
6
|
-
theme: 'dropdown',
|
|
7
|
-
arrow: false,
|
|
8
|
-
moveTransition: 'transform 0.1s ease-out',
|
|
9
|
-
interactive: true,
|
|
10
|
-
interactiveDebounce: 50
|
|
11
|
-
})
|
|
12
|
-
: null
|
|
13
|
-
|
|
5
|
+
let sigleton: CreateSingletonInstance | null = null
|
|
14
6
|
const tips: TippyInstance[] = []
|
|
15
7
|
</script>
|
|
16
8
|
|
|
17
9
|
<script lang="ts">
|
|
18
10
|
import { tippy, type TippyProps } from '../../utils/tippy.js'
|
|
19
11
|
import { onMount } from 'svelte'
|
|
20
|
-
import { browser } from '$app/environment'
|
|
21
12
|
import { beforeNavigate } from '$app/navigation'
|
|
22
13
|
import './dropdown.css'
|
|
23
14
|
|
|
@@ -56,6 +47,7 @@
|
|
|
56
47
|
trigger: 'click focus',
|
|
57
48
|
interactive: true,
|
|
58
49
|
interactiveDebounce: 50,
|
|
50
|
+
moveTransition: 'transform 0.1s ease-out',
|
|
59
51
|
appendTo: 'parent',
|
|
60
52
|
onShown() {
|
|
61
53
|
if (autofocus) focusables[0]?.select()
|
|
@@ -65,7 +57,11 @@
|
|
|
65
57
|
|
|
66
58
|
if (useSingleton && tip) {
|
|
67
59
|
tips.push(tip)
|
|
68
|
-
sigleton
|
|
60
|
+
if (!sigleton) {
|
|
61
|
+
sigleton = createSingleton(tips)
|
|
62
|
+
} else {
|
|
63
|
+
sigleton?.setInstances(tips)
|
|
64
|
+
}
|
|
69
65
|
}
|
|
70
66
|
|
|
71
67
|
const lastFocusable = focusables.at(-1)
|
|
@@ -76,6 +72,10 @@
|
|
|
76
72
|
if (useSingleton && tip) {
|
|
77
73
|
tips.splice(tips.indexOf(tip), 1)
|
|
78
74
|
tip.destroy()
|
|
75
|
+
if (tips.length === 0) {
|
|
76
|
+
sigleton?.destroy()
|
|
77
|
+
sigleton = null
|
|
78
|
+
}
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
})
|