File size: 902 Bytes
82be208
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<script lang="ts">
	import { ChatFormPickerList, ChatFormPickerListItem } from '$lib/components/app/chat';

	interface Item {
		id: string;
		label: string;
	}

	const items: Item[] = Array.from({ length: 20 }, (_, i) => ({
		id: String(i),
		label: `item ${i}`
	}));

	let open = $state(false);
	let scrollTrigger = $state(0);
	let selectedIndex = $state(0);

	export function openPicker() {
		open = true;
	}
</script>

<div style="height: 5000px;">conversation</div>

{#if open}
	<div data-testid="picker-host">
		<ChatFormPickerList
			isLoading={false}
			itemKey={(it) => it.id}
			{items}
			{scrollTrigger}
			searchQuery=""
			{selectedIndex}
			showSearchInput={false}
		>
			{#snippet item(it, index, isSelected)}
				<ChatFormPickerListItem dataIndex={index} {isSelected} onclick={() => {}}>
					{it.label}
				</ChatFormPickerListItem>
			{/snippet}
		</ChatFormPickerList>
	</div>
{/if}