Skip to content

Commit e2b8a03

Browse files
committed
chore: update sveltekit
1 parent bfde54b commit e2b8a03

File tree

5 files changed

+113
-4
lines changed

5 files changed

+113
-4
lines changed

bun.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@
463463
"name": "svelte-kit",
464464
"version": "0.0.1",
465465
"dependencies": {
466-
"@ark-ui/svelte": "workspace:*",
466+
"@ark-ui/svelte": "5.3.2",
467467
},
468468
"devDependencies": {
469469
"@sveltejs/adapter-auto": "^6.0.0",

templates/svelte-kit/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
1313
},
1414
"dependencies": {
15-
"@ark-ui/svelte": "workspace:*"
15+
"@ark-ui/svelte": "5.3.2"
1616
},
1717
"devDependencies": {
1818
"@sveltejs/adapter-auto": "^6.0.0",
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<script>
2+
let { children } = $props()
3+
</script>
4+
5+
<nav>
6+
<a href="/">Home</a>
7+
<a href="/select">Select</a>
8+
</nav>
9+
10+
<div style="padding: 1rem;">
11+
{@render children()}
12+
</div>
Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,38 @@
1-
<h1>Welcome to SvelteKit</h1>
2-
<p>Visit <a href="https://svelte.dev/docs/kit">svelte.dev/docs/kit</a> to read the documentation</p>
1+
<script lang="ts">
2+
import { Portal } from '@ark-ui/svelte/portal'
3+
import { Select, createListCollection } from '@ark-ui/svelte/select'
4+
import { ChevronDownIcon } from 'lucide-svelte'
5+
6+
const collection = createListCollection({
7+
items: ['Apple', 'Banana', 'Cherry', 'Date'],
8+
})
9+
</script>
10+
11+
<Select.Root {collection}>
12+
<Select.Label>Select Fruits</Select.Label>
13+
<Select.Control>
14+
<Select.Trigger style="display: flex; align-items: center; gap: 0.5rem">
15+
<Select.ValueText placeholder="Fruits" />
16+
<Select.Indicator>
17+
<ChevronDownIcon />
18+
</Select.Indicator>
19+
</Select.Trigger>
20+
<Select.ClearTrigger>Clear</Select.ClearTrigger>
21+
</Select.Control>
22+
<Portal>
23+
<Select.Positioner>
24+
<Select.Content>
25+
<Select.ItemGroup>
26+
<Select.ItemGroupLabel>Fruits</Select.ItemGroupLabel>
27+
{#each collection.items as item}
28+
<Select.Item {item}>
29+
<Select.ItemText>{item}</Select.ItemText>
30+
<Select.ItemIndicator>✓</Select.ItemIndicator>
31+
</Select.Item>
32+
{/each}
33+
</Select.ItemGroup>
34+
</Select.Content>
35+
</Select.Positioner>
36+
</Portal>
37+
<Select.HiddenSelect />
38+
</Select.Root>
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<script lang="ts">
2+
import { Portal } from '@ark-ui/svelte/portal'
3+
import { Select, createListCollection } from '@ark-ui/svelte/select'
4+
import { ChevronDownIcon } from 'lucide-svelte'
5+
6+
interface Item {
7+
label: string
8+
value: string
9+
disabled?: boolean
10+
}
11+
12+
let value = $state<string[]>([])
13+
14+
const collection = createListCollection<Item>({
15+
items: [
16+
{ label: 'React', value: 'react' },
17+
{ label: 'Solid', value: 'solid' },
18+
{ label: 'Vue', value: 'vue' },
19+
{ label: 'Svelte', value: 'svelte', disabled: true },
20+
],
21+
})
22+
23+
let selectedItems = $derived.by<Item[]>(() => {
24+
return collection.items.filter((item) => value.includes(item.value))
25+
})
26+
</script>
27+
28+
<Select.Root {collection} bind:value>
29+
<Select.Label>Select Framework</Select.Label>
30+
<Select.Control>
31+
<Select.Trigger style="display: flex; align-items: center; gap: 0.5rem">
32+
<Select.ValueText placeholder="Framework" />
33+
<Select.Indicator>
34+
<ChevronDownIcon />
35+
</Select.Indicator>
36+
</Select.Trigger>
37+
<Select.ClearTrigger>Clear</Select.ClearTrigger>
38+
</Select.Control>
39+
<Portal>
40+
<Select.Positioner>
41+
<Select.Content>
42+
<Select.ItemGroup>
43+
<Select.ItemGroupLabel>Frameworks</Select.ItemGroupLabel>
44+
{#each collection.items as item (item.value)}
45+
<Select.Item {item}>
46+
<Select.ItemText>{item.label}</Select.ItemText>
47+
<Select.ItemIndicator>✓</Select.ItemIndicator>
48+
</Select.Item>
49+
{/each}
50+
</Select.ItemGroup>
51+
</Select.Content>
52+
</Select.Positioner>
53+
</Portal>
54+
<Select.HiddenSelect />
55+
</Select.Root>
56+
57+
{#if selectedItems.length > 0}
58+
<div style="margin-top: 1rem;">
59+
<p>Selected: {selectedItems.map((item) => item.label).join(', ')}</p>
60+
</div>
61+
{/if}

0 commit comments

Comments
 (0)