@x33025/sveltely 0.0.55 → 0.0.57
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.
- package/dist/components/AnimatedNumber.demo.svelte +28 -0
- package/dist/components/AnimatedNumber.demo.svelte.d.ts +9 -0
- package/dist/components/AsyncButton.demo.svelte +24 -0
- package/dist/components/AsyncButton.demo.svelte.d.ts +23 -0
- package/dist/components/ChipInput.demo.svelte +18 -0
- package/dist/components/ChipInput.demo.svelte.d.ts +9 -0
- package/dist/components/Local/ComponentGrid.svelte +53 -0
- package/dist/components/Local/ComponentGrid.svelte.d.ts +14 -0
- package/dist/components/Local/HeroCard.svelte +51 -0
- package/dist/components/Local/HeroCard.svelte.d.ts +11 -0
- package/dist/components/NavigationStack/NavigationStack.svelte +8 -7
- package/dist/components/NavigationStack/NavigationStack.svelte.d.ts +1 -0
- package/dist/components/NavigationStack/Toolbar.svelte +5 -4
- package/dist/components/NavigationStack/Toolbar.svelte.d.ts +1 -0
- package/dist/components/Pagination.demo.svelte +27 -0
- package/dist/components/Pagination.demo.svelte.d.ts +10 -0
- package/dist/components/Popover/Popover.demo.svelte +35 -0
- package/dist/components/Popover/Popover.demo.svelte.d.ts +8 -0
- package/dist/components/Popover/Popover.svelte +11 -3
- package/dist/components/SearchInput.demo.svelte +18 -0
- package/dist/components/SearchInput.demo.svelte.d.ts +9 -0
- package/dist/components/SearchInput.svelte +39 -0
- package/dist/components/SearchInput.svelte.d.ts +9 -0
- package/dist/components/SegmentedPicker.demo.svelte +24 -0
- package/dist/components/SegmentedPicker.demo.svelte.d.ts +9 -0
- package/dist/components/SegmentedPicker.svelte +11 -1
- package/dist/components/SegmentedPicker.svelte.d.ts +1 -0
- package/dist/components/Sheet/Sheet.demo.svelte +38 -0
- package/dist/components/Sheet/Sheet.demo.svelte.d.ts +8 -0
- package/dist/components/Slider.demo.svelte +18 -0
- package/dist/components/Slider.demo.svelte.d.ts +9 -0
- package/dist/components/Spinner.demo.svelte +12 -0
- package/dist/components/Spinner.demo.svelte.d.ts +23 -0
- package/dist/components/Tooltip.demo.svelte +16 -0
- package/dist/components/Tooltip.demo.svelte.d.ts +23 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/style/index.css +77 -2
- package/dist/style.css +175 -57
- package/package.json +1 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
export const demo = {
|
|
3
|
+
name: 'AnimatedNumber',
|
|
4
|
+
description: 'Spring-driven numeric transitions.',
|
|
5
|
+
isProminent: false
|
|
6
|
+
};
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<script lang="ts">
|
|
10
|
+
import AnimatedNumber from './AnimatedNumber.svelte';
|
|
11
|
+
|
|
12
|
+
let value = $state(1234);
|
|
13
|
+
|
|
14
|
+
const bump = () => {
|
|
15
|
+
value += Math.round(100 + Math.random() * 900);
|
|
16
|
+
};
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<div class="vstack center gap-3">
|
|
20
|
+
<AnimatedNumber {value} class="text-3xl font-semibold text-zinc-900" />
|
|
21
|
+
<button
|
|
22
|
+
type="button"
|
|
23
|
+
class="rounded-full bg-zinc-900 px-3 py-2 text-sm text-white"
|
|
24
|
+
onclick={bump}
|
|
25
|
+
>
|
|
26
|
+
Change number
|
|
27
|
+
</button>
|
|
28
|
+
</div>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const demo: {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
isProminent: boolean;
|
|
5
|
+
};
|
|
6
|
+
import AnimatedNumber from './AnimatedNumber.svelte';
|
|
7
|
+
declare const AnimatedNumber: import("svelte").Component<Record<string, never>, {}, "">;
|
|
8
|
+
type AnimatedNumber = ReturnType<typeof AnimatedNumber>;
|
|
9
|
+
export default AnimatedNumber;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
export const demo = {
|
|
3
|
+
name: 'AsyncButton',
|
|
4
|
+
description: 'Async action button with loading and error states.'
|
|
5
|
+
};
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { SaveIcon } from '@lucide/svelte';
|
|
10
|
+
import AsyncButton from './AsyncButton.svelte';
|
|
11
|
+
|
|
12
|
+
const runDemo = async () => {
|
|
13
|
+
await new Promise<void>((resolve) => {
|
|
14
|
+
setTimeout(resolve, 1000);
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<AsyncButton
|
|
20
|
+
icon={SaveIcon}
|
|
21
|
+
label="Run async action"
|
|
22
|
+
action={runDemo}
|
|
23
|
+
class="rounded-full bg-zinc-900 px-3 py-2 text-sm text-white"
|
|
24
|
+
/>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const demo: {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
};
|
|
5
|
+
import AsyncButton from './AsyncButton.svelte';
|
|
6
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
7
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
8
|
+
$$bindings?: Bindings;
|
|
9
|
+
} & Exports;
|
|
10
|
+
(internal: unknown, props: {
|
|
11
|
+
$$events?: Events;
|
|
12
|
+
$$slots?: Slots;
|
|
13
|
+
}): Exports & {
|
|
14
|
+
$set?: any;
|
|
15
|
+
$on?: any;
|
|
16
|
+
};
|
|
17
|
+
z_$$bindings?: Bindings;
|
|
18
|
+
}
|
|
19
|
+
declare const AsyncButton: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
20
|
+
[evt: string]: CustomEvent<any>;
|
|
21
|
+
}, {}, {}, string>;
|
|
22
|
+
type AsyncButton = InstanceType<typeof AsyncButton>;
|
|
23
|
+
export default AsyncButton;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
export const demo = {
|
|
3
|
+
name: 'ChipInput',
|
|
4
|
+
description: 'Editable chip list with bindable tags.',
|
|
5
|
+
isProminent: false
|
|
6
|
+
};
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<script lang="ts">
|
|
10
|
+
import ChipInput from './ChipInput.svelte';
|
|
11
|
+
|
|
12
|
+
let tags = $state(['svelte', 'ui', 'search']);
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<div class="vstack w-full max-w-sm gap-2">
|
|
16
|
+
<ChipInput bind:tags />
|
|
17
|
+
<p class="text-xs text-zinc-500">Tags: {tags.join(', ')}</p>
|
|
18
|
+
</div>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const demo: {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
isProminent: boolean;
|
|
5
|
+
};
|
|
6
|
+
import ChipInput from './ChipInput.svelte';
|
|
7
|
+
declare const ChipInput: import("svelte").Component<Record<string, never>, {}, "">;
|
|
8
|
+
type ChipInput = ReturnType<typeof ChipInput>;
|
|
9
|
+
export default ChipInput;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Component } from 'svelte';
|
|
3
|
+
import HeroCard from './HeroCard.svelte';
|
|
4
|
+
|
|
5
|
+
type DemoEntry = {
|
|
6
|
+
component: Component;
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
isProminent: boolean;
|
|
10
|
+
columnSpan?: 1 | 2;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
type Props = {
|
|
14
|
+
demos: DemoEntry[];
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
let { demos }: Props = $props();
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<div
|
|
21
|
+
class="component-grid grid gap-4 overflow-auto p-6 md:grid-flow-dense md:grid-cols-2 xl:grid-cols-3"
|
|
22
|
+
>
|
|
23
|
+
{#each demos as entry}
|
|
24
|
+
{@const DemoComponent = entry.component}
|
|
25
|
+
<HeroCard
|
|
26
|
+
title={entry.name}
|
|
27
|
+
description={entry.description}
|
|
28
|
+
isProminent={entry.isProminent}
|
|
29
|
+
columnSpan={entry.columnSpan ?? 1}
|
|
30
|
+
>
|
|
31
|
+
<DemoComponent />
|
|
32
|
+
</HeroCard>
|
|
33
|
+
{/each}
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<style>
|
|
37
|
+
.component-grid :global(.hero-card) {
|
|
38
|
+
min-height: 14rem;
|
|
39
|
+
border: 1px solid rgb(228 228 231);
|
|
40
|
+
border-radius: 1rem;
|
|
41
|
+
box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
|
|
42
|
+
align-items: stretch;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.component-grid :global(.hero-card h1) {
|
|
46
|
+
font-size: 1rem;
|
|
47
|
+
line-height: 1.5rem;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.component-grid :global(.hero-card p) {
|
|
51
|
+
max-width: none;
|
|
52
|
+
}
|
|
53
|
+
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Component } from 'svelte';
|
|
2
|
+
type DemoEntry = {
|
|
3
|
+
component: Component;
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
isProminent: boolean;
|
|
7
|
+
columnSpan?: 1 | 2;
|
|
8
|
+
};
|
|
9
|
+
type Props = {
|
|
10
|
+
demos: DemoEntry[];
|
|
11
|
+
};
|
|
12
|
+
declare const ComponentGrid: Component<Props, {}, "">;
|
|
13
|
+
type ComponentGrid = ReturnType<typeof ComponentGrid>;
|
|
14
|
+
export default ComponentGrid;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
type Props = {
|
|
5
|
+
title?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
children?: Snippet;
|
|
8
|
+
isProminent?: boolean;
|
|
9
|
+
columnSpan?: 1 | 2;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
let { title, description = '', children, isProminent = false, columnSpan = 1 }: Props = $props();
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<div class="hero-card vstack gap-2" data-column-span={columnSpan}>
|
|
16
|
+
{#if title}
|
|
17
|
+
<h1 class="text-3xl font-semibold tracking-tight text-zinc-950">{title}</h1>
|
|
18
|
+
{#if description}
|
|
19
|
+
<p class="max-w-3xl text-sm text-zinc-600">{description}</p>
|
|
20
|
+
{/if}
|
|
21
|
+
{/if}
|
|
22
|
+
<div
|
|
23
|
+
class="hero-card-content center flex"
|
|
24
|
+
class:overflow-hidden={isProminent}
|
|
25
|
+
class:rounded-xl={isProminent}
|
|
26
|
+
class:bg-zinc-50={isProminent}
|
|
27
|
+
class:p-4={isProminent}
|
|
28
|
+
>
|
|
29
|
+
{#if children}
|
|
30
|
+
{@render children()}
|
|
31
|
+
{/if}
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<style>
|
|
36
|
+
.hero-card {
|
|
37
|
+
background: white;
|
|
38
|
+
padding: 1.5rem;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.hero-card-content {
|
|
42
|
+
min-height: 0;
|
|
43
|
+
flex: 1 1 auto;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@media (min-width: 48rem) {
|
|
47
|
+
.hero-card[data-column-span='2'] {
|
|
48
|
+
grid-column: span 2;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
</style>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
type Props = {
|
|
3
|
+
title?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
children?: Snippet;
|
|
6
|
+
isProminent?: boolean;
|
|
7
|
+
columnSpan?: 1 | 2;
|
|
8
|
+
};
|
|
9
|
+
declare const HeroCard: import("svelte").Component<Props, {}, "">;
|
|
10
|
+
type HeroCard = ReturnType<typeof HeroCard>;
|
|
11
|
+
export default HeroCard;
|
|
@@ -6,9 +6,10 @@
|
|
|
6
6
|
left?: Snippet;
|
|
7
7
|
right?: Snippet;
|
|
8
8
|
children?: Snippet;
|
|
9
|
+
chrome?: boolean;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
let { left, right, children }: Props = $props();
|
|
12
|
+
let { left, right, children, chrome = true }: Props = $props();
|
|
12
13
|
|
|
13
14
|
const existingContext = getContext<{
|
|
14
15
|
leftOpen?: boolean;
|
|
@@ -38,14 +39,14 @@
|
|
|
38
39
|
});
|
|
39
40
|
</script>
|
|
40
41
|
|
|
41
|
-
<div class="hstack size-full">
|
|
42
|
+
<div class="navigation-stack hstack size-full" data-chrome={chrome ? 'true' : 'false'}>
|
|
42
43
|
{#if left}
|
|
43
44
|
<div
|
|
44
|
-
class="h-full overflow-hidden
|
|
45
|
+
class="navigation-stack-sidebar navigation-stack-sidebar-left h-full overflow-hidden transition-all duration-300 ease-in-out"
|
|
45
46
|
style="width: {leftOpen ? 'var(--navigation-stack-sidebar-width)' : '0'}"
|
|
46
47
|
>
|
|
47
48
|
<div
|
|
48
|
-
class="vstack h-full overflow-auto
|
|
49
|
+
class="navigation-stack-sidebar-inner vstack h-full overflow-auto p-4"
|
|
49
50
|
style="width: var(--navigation-stack-sidebar-width);"
|
|
50
51
|
>
|
|
51
52
|
{@render left()}
|
|
@@ -53,7 +54,7 @@
|
|
|
53
54
|
</div>
|
|
54
55
|
{/if}
|
|
55
56
|
|
|
56
|
-
<div class="vstack flex-1">
|
|
57
|
+
<div class="navigation-stack-content vstack flex-1">
|
|
57
58
|
{#if children}
|
|
58
59
|
{@render children()}
|
|
59
60
|
{/if}
|
|
@@ -61,11 +62,11 @@
|
|
|
61
62
|
|
|
62
63
|
{#if right}
|
|
63
64
|
<div
|
|
64
|
-
class="h-full overflow-hidden
|
|
65
|
+
class="navigation-stack-sidebar navigation-stack-sidebar-right h-full overflow-hidden transition-all duration-300 ease-in-out"
|
|
65
66
|
style="width: {rightOpen ? 'var(--navigation-stack-sidebar-width)' : '0'}"
|
|
66
67
|
>
|
|
67
68
|
<div
|
|
68
|
-
class="vstack h-full overflow-auto
|
|
69
|
+
class="navigation-stack-sidebar-inner vstack h-full overflow-auto p-4"
|
|
69
70
|
style="width: var(--navigation-stack-sidebar-width);"
|
|
70
71
|
>
|
|
71
72
|
{@render right()}
|
|
@@ -4,19 +4,20 @@
|
|
|
4
4
|
interface Props {
|
|
5
5
|
header?: Snippet;
|
|
6
6
|
children?: Snippet;
|
|
7
|
+
chrome?: boolean;
|
|
7
8
|
}
|
|
8
9
|
|
|
9
|
-
let { header, children }: Props = $props();
|
|
10
|
+
let { header, children, chrome = true }: Props = $props();
|
|
10
11
|
</script>
|
|
11
12
|
|
|
12
|
-
<div class="vstack h-full">
|
|
13
|
+
<div class="navigation-stack-toolbar-shell vstack h-full" data-chrome={chrome ? 'true' : 'false'}>
|
|
13
14
|
{#if header}
|
|
14
|
-
<div class="flex items-center gap-2
|
|
15
|
+
<div class="navigation-stack-toolbar flex items-center gap-2 p-2">
|
|
15
16
|
{@render header()}
|
|
16
17
|
</div>
|
|
17
18
|
{/if}
|
|
18
19
|
|
|
19
|
-
<div class="vstack h-full">
|
|
20
|
+
<div class="navigation-stack-toolbar-content vstack h-full">
|
|
20
21
|
{#if children}
|
|
21
22
|
{@render children()}
|
|
22
23
|
{/if}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
export const demo = {
|
|
3
|
+
name: 'Pagination',
|
|
4
|
+
description: 'Pagination control with local demo state.',
|
|
5
|
+
isProminent: false,
|
|
6
|
+
columnSpan: 2
|
|
7
|
+
};
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import Pagination from './Pagination.svelte';
|
|
12
|
+
|
|
13
|
+
let data = $state({
|
|
14
|
+
view: 'list',
|
|
15
|
+
page: 3,
|
|
16
|
+
totalPages: 12,
|
|
17
|
+
hasNext: true
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const onPageChange = (page: number) => {
|
|
21
|
+
data = { ...data, page, hasNext: page < data.totalPages };
|
|
22
|
+
};
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<div class="w-fit">
|
|
26
|
+
<Pagination {data} showFirstLast={true} onPageChange={(page) => onPageChange(page)} />
|
|
27
|
+
</div>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const demo: {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
isProminent: boolean;
|
|
5
|
+
columnSpan: number;
|
|
6
|
+
};
|
|
7
|
+
import Pagination from './Pagination.svelte';
|
|
8
|
+
declare const Pagination: import("svelte").Component<Record<string, never>, {}, "">;
|
|
9
|
+
type Pagination = ReturnType<typeof Pagination>;
|
|
10
|
+
export default Pagination;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
export const demo = {
|
|
3
|
+
name: 'Popover',
|
|
4
|
+
description: 'Composable popover with trigger and content snippets.'
|
|
5
|
+
};
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import Popover from './Popover.svelte';
|
|
10
|
+
import SearchInput from '../SearchInput.svelte';
|
|
11
|
+
|
|
12
|
+
let search = $state('');
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<Popover align="center">
|
|
16
|
+
{#snippet trigger()}
|
|
17
|
+
<button
|
|
18
|
+
type="button"
|
|
19
|
+
class="rounded-full border border-zinc-300 px-3 py-2 text-sm text-zinc-800"
|
|
20
|
+
>
|
|
21
|
+
Open popover
|
|
22
|
+
</button>
|
|
23
|
+
{/snippet}
|
|
24
|
+
|
|
25
|
+
<div class="vstack gap-2">
|
|
26
|
+
<label for="popover-demo-search" class="text-sm font-medium text-zinc-700">Search</label>
|
|
27
|
+
<SearchInput
|
|
28
|
+
id="popover-demo-search"
|
|
29
|
+
bind:value={search}
|
|
30
|
+
placeholder="Type to search..."
|
|
31
|
+
confirmText="Enter"
|
|
32
|
+
class="w-64"
|
|
33
|
+
/>
|
|
34
|
+
</div>
|
|
35
|
+
</Popover>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const demo: {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
};
|
|
5
|
+
import Popover from './Popover.svelte';
|
|
6
|
+
declare const Popover: import("svelte").Component<Record<string, never>, {}, "">;
|
|
7
|
+
type Popover = ReturnType<typeof Popover>;
|
|
8
|
+
export default Popover;
|
|
@@ -224,6 +224,12 @@
|
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
+
function handleTriggerKeydown(event: KeyboardEvent) {
|
|
228
|
+
if (event.key !== 'Enter' && event.key !== ' ') return;
|
|
229
|
+
event.preventDefault();
|
|
230
|
+
toggle();
|
|
231
|
+
}
|
|
232
|
+
|
|
227
233
|
function handleOutsideClick(event: MouseEvent) {
|
|
228
234
|
if (!open) return;
|
|
229
235
|
if (isEventInPopoverTree(event)) return;
|
|
@@ -273,15 +279,17 @@
|
|
|
273
279
|
data-popover-parent-id={parentPopoverId ?? ''}
|
|
274
280
|
>
|
|
275
281
|
<div bind:this={triggerEl}>
|
|
276
|
-
<
|
|
277
|
-
type="button"
|
|
282
|
+
<div
|
|
278
283
|
class="text-left"
|
|
284
|
+
role="button"
|
|
285
|
+
tabindex="0"
|
|
279
286
|
onclick={toggle}
|
|
287
|
+
onkeydown={handleTriggerKeydown}
|
|
280
288
|
aria-expanded={open}
|
|
281
289
|
aria-haspopup="dialog"
|
|
282
290
|
>
|
|
283
291
|
{@render trigger()}
|
|
284
|
-
</
|
|
292
|
+
</div>
|
|
285
293
|
</div>
|
|
286
294
|
|
|
287
295
|
{#if open}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
export const demo = {
|
|
3
|
+
name: 'SearchInput',
|
|
4
|
+
description: 'Search field with icon, input, and optional confirmation hint.',
|
|
5
|
+
isProminent: false
|
|
6
|
+
};
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<script lang="ts">
|
|
10
|
+
import SearchInput from './SearchInput.svelte';
|
|
11
|
+
|
|
12
|
+
let value = $state('');
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<div class="vstack w-full max-w-sm gap-2">
|
|
16
|
+
<SearchInput bind:value placeholder="Search components..." confirmText="Enter" class="w-full" />
|
|
17
|
+
<p class="text-xs text-zinc-500">Value: {value || 'empty'}</p>
|
|
18
|
+
</div>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const demo: {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
isProminent: boolean;
|
|
5
|
+
};
|
|
6
|
+
import SearchInput from './SearchInput.svelte';
|
|
7
|
+
declare const SearchInput: import("svelte").Component<Record<string, never>, {}, "">;
|
|
8
|
+
type SearchInput = ReturnType<typeof SearchInput>;
|
|
9
|
+
export default SearchInput;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { SearchIcon } from '@lucide/svelte';
|
|
3
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
4
|
+
|
|
5
|
+
type Props = {
|
|
6
|
+
value?: string;
|
|
7
|
+
confirmText?: string | null;
|
|
8
|
+
inputClass?: string;
|
|
9
|
+
} & Omit<HTMLInputAttributes, 'children' | 'type' | 'value'>;
|
|
10
|
+
|
|
11
|
+
let {
|
|
12
|
+
value = $bindable(''),
|
|
13
|
+
confirmText = null,
|
|
14
|
+
inputClass = '',
|
|
15
|
+
class: className = '',
|
|
16
|
+
disabled = false,
|
|
17
|
+
placeholder = 'Search',
|
|
18
|
+
...props
|
|
19
|
+
}: Props = $props();
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<label class="search-input {className}" data-disabled={disabled ? 'true' : 'false'}>
|
|
23
|
+
<span class="search-input-icon" aria-hidden="true">
|
|
24
|
+
<SearchIcon class="size-4" />
|
|
25
|
+
</span>
|
|
26
|
+
<input
|
|
27
|
+
type="search"
|
|
28
|
+
bind:value
|
|
29
|
+
{disabled}
|
|
30
|
+
{placeholder}
|
|
31
|
+
class="search-input-field {inputClass}"
|
|
32
|
+
{...props}
|
|
33
|
+
/>
|
|
34
|
+
{#if confirmText}
|
|
35
|
+
<span class="search-input-confirm">
|
|
36
|
+
{confirmText}
|
|
37
|
+
</span>
|
|
38
|
+
{/if}
|
|
39
|
+
</label>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
2
|
+
type Props = {
|
|
3
|
+
value?: string;
|
|
4
|
+
confirmText?: string | null;
|
|
5
|
+
inputClass?: string;
|
|
6
|
+
} & Omit<HTMLInputAttributes, 'children' | 'type' | 'value'>;
|
|
7
|
+
declare const SearchInput: import("svelte").Component<Props, {}, "value">;
|
|
8
|
+
type SearchInput = ReturnType<typeof SearchInput>;
|
|
9
|
+
export default SearchInput;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
export const demo = {
|
|
3
|
+
name: 'SegmentedPicker',
|
|
4
|
+
description: 'Segmented selection between fixed options.',
|
|
5
|
+
isProminent: false
|
|
6
|
+
};
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<script lang="ts">
|
|
10
|
+
import SegmentedPicker from './SegmentedPicker.svelte';
|
|
11
|
+
|
|
12
|
+
const options = [
|
|
13
|
+
{ label: 'Day', value: 'day' },
|
|
14
|
+
{ label: 'Week', value: 'week', disabled: true },
|
|
15
|
+
{ label: 'Month', value: 'month' }
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
let value = $state('week');
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<div class="vstack center gap-2">
|
|
22
|
+
<SegmentedPicker {options} bind:value />
|
|
23
|
+
<p class="text-xs text-zinc-500">Selected: {value}</p>
|
|
24
|
+
</div>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const demo: {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
isProminent: boolean;
|
|
5
|
+
};
|
|
6
|
+
import SegmentedPicker from './SegmentedPicker.svelte';
|
|
7
|
+
declare const SegmentedPicker: import("svelte").Component<Record<string, never>, {}, "">;
|
|
8
|
+
type SegmentedPicker = ReturnType<typeof SegmentedPicker>;
|
|
9
|
+
export default SegmentedPicker;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
type Option = {
|
|
3
3
|
label: string;
|
|
4
4
|
value: string;
|
|
5
|
+
disabled?: boolean;
|
|
5
6
|
};
|
|
6
7
|
|
|
7
8
|
let {
|
|
@@ -22,7 +23,16 @@
|
|
|
22
23
|
class:segmented-picker-disabled={disabled}
|
|
23
24
|
>
|
|
24
25
|
{#each options as option}
|
|
25
|
-
{#if option.
|
|
26
|
+
{#if option.disabled}
|
|
27
|
+
<span
|
|
28
|
+
class={`segmented-picker-button segmented-picker-button-disabled ${
|
|
29
|
+
option.value === value ? 'segmented-picker-button-disabled-selected' : ''
|
|
30
|
+
}`}
|
|
31
|
+
aria-disabled="true"
|
|
32
|
+
>
|
|
33
|
+
{option.label}
|
|
34
|
+
</span>
|
|
35
|
+
{:else if option.value === value}
|
|
26
36
|
<span class="segmented-picker-button segmented-picker-button-active">{option.label}</span>
|
|
27
37
|
{:else}
|
|
28
38
|
<button
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
export const demo = {
|
|
3
|
+
name: 'Sheet',
|
|
4
|
+
description: 'Overlay sheet with local open state.'
|
|
5
|
+
};
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import Sheet from './Sheet.svelte';
|
|
10
|
+
|
|
11
|
+
let open = $state(false);
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<button
|
|
15
|
+
type="button"
|
|
16
|
+
class="rounded-full bg-zinc-900 px-3 py-2 text-sm text-white"
|
|
17
|
+
onclick={() => (open = true)}
|
|
18
|
+
>
|
|
19
|
+
Open sheet
|
|
20
|
+
</button>
|
|
21
|
+
|
|
22
|
+
<Sheet bind:open label="Example Sheet">
|
|
23
|
+
<div class="vstack gap-3">
|
|
24
|
+
<p class="text-sm text-zinc-700">This is a simple sheet example.</p>
|
|
25
|
+
<div class="rounded border border-gray-200/70 p-3 text-sm text-gray-700">
|
|
26
|
+
<div>Panel one content.</div>
|
|
27
|
+
<div class="mt-2">Panel two content.</div>
|
|
28
|
+
<div class="mt-2">Panel three content.</div>
|
|
29
|
+
</div>
|
|
30
|
+
<button
|
|
31
|
+
type="button"
|
|
32
|
+
class="rounded-full border border-zinc-300 px-3 py-2 text-sm text-zinc-800"
|
|
33
|
+
onclick={() => (open = false)}
|
|
34
|
+
>
|
|
35
|
+
Close
|
|
36
|
+
</button>
|
|
37
|
+
</div>
|
|
38
|
+
</Sheet>
|