@hyvnt/hyvui 0.2.0 → 0.3.0
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/README.md +264 -253
- package/dist/components/ambient/CornerBrackets.svelte +83 -87
- package/dist/components/ambient/DataStream.svelte +111 -94
- package/dist/components/ambient/GlyphMark.svelte +69 -69
- package/dist/components/ambient/GridOverlay.svelte +26 -28
- package/dist/components/ambient/ParallaxLayer.svelte +37 -41
- package/dist/components/ambient/ScanBand.svelte +95 -91
- package/dist/components/ambient/SignalRing.svelte +100 -100
- package/dist/components/ambient/ThreadLine.svelte +71 -78
- package/dist/components/ambient/Vignette.svelte +24 -26
- package/dist/components/depth/DepthLayer.svelte +22 -27
- package/dist/components/depth/DepthStage.svelte +63 -62
- package/dist/components/depth/FloatCard.svelte +113 -104
- package/dist/components/depth/HorizonGrid.svelte +216 -160
- package/dist/components/depth/Plinth.svelte +52 -57
- package/dist/components/display/Avatar.svelte +64 -69
- package/dist/components/display/Badge.svelte +59 -63
- package/dist/components/display/Blockquote.svelte +31 -34
- package/dist/components/display/CodeBlock.svelte +71 -76
- package/dist/components/display/MetricCard.svelte +77 -83
- package/dist/components/display/Table.svelte +99 -104
- package/dist/components/feedback/Alert.svelte +71 -76
- package/dist/components/feedback/EmptyState.svelte +68 -68
- package/dist/components/feedback/ErrorState.svelte +73 -73
- package/dist/components/feedback/Skeleton.svelte +52 -52
- package/dist/components/feedback/StatusDot.svelte +49 -54
- package/dist/components/feedback/StatusLine.svelte +122 -122
- package/dist/components/feedback/Toast.svelte +130 -136
- package/dist/components/inputs/Button.svelte +240 -237
- package/dist/components/inputs/Checkbox.svelte +104 -105
- package/dist/components/inputs/FileUpload.svelte +165 -163
- package/dist/components/inputs/Input.svelte +145 -147
- package/dist/components/inputs/Select.svelte +156 -150
- package/dist/components/inputs/Textarea.svelte +153 -154
- package/dist/components/inputs/Toggle.svelte +120 -120
- package/dist/components/layout/Card.svelte +70 -76
- package/dist/components/layout/Drawer.svelte +133 -109
- package/dist/components/layout/Grid.svelte +118 -43
- package/dist/components/layout/Grid.svelte.d.ts +8 -2
- package/dist/components/layout/Modal.svelte +176 -159
- package/dist/components/layout/Panel.svelte +49 -54
- package/dist/components/layout/Popover.svelte +178 -67
- package/dist/components/layout/Popover.svelte.d.ts +10 -1
- package/dist/components/layout/Stack.svelte +53 -53
- package/dist/components/navigation/Breadcrumb.svelte +70 -73
- package/dist/components/navigation/DropdownMenu.svelte +167 -124
- package/dist/components/navigation/DropdownMenu.svelte.d.ts +12 -2
- package/dist/components/navigation/SidebarNav.svelte +86 -90
- package/dist/components/navigation/Tabs.svelte +81 -86
- package/dist/components/navigation/Topbar.svelte +85 -85
- package/dist/components/patterns/ActionBar.svelte +71 -76
- package/dist/components/patterns/ConfirmDialog.svelte +63 -64
- package/dist/components/patterns/PageHeader.svelte +109 -114
- package/dist/components/patterns/SearchBar.svelte +54 -59
- package/dist/components/patterns/TerminalBoot.svelte +104 -104
- package/dist/components/primitives/Divider.svelte +26 -29
- package/dist/components/primitives/Icon.svelte +44 -49
- package/dist/components/primitives/Label.svelte +39 -44
- package/dist/components/primitives/Surface.svelte +89 -87
- package/dist/components/primitives/Text.svelte +98 -98
- package/dist/components/scenes/ArchiveScene.svelte +92 -95
- package/dist/components/scenes/ArchiveScene.svelte.d.ts +7 -1
- package/dist/components/scenes/LogScene.svelte +72 -77
- package/dist/components/scenes/NarrativeScene.svelte +91 -92
- package/dist/components/scenes/ReadoutScene.svelte +120 -107
- package/dist/components/scenes/ReadoutScene.svelte.d.ts +3 -1
- package/dist/components/scenes/StageScene.svelte +97 -104
- package/dist/examples/FieldReport.svelte +226 -223
- package/dist/examples/ObservationDeck.svelte +333 -317
- package/dist/examples/SignalLost.svelte +191 -191
- package/dist/styles.css +113 -0
- package/dist/system/actions/echo.js +9 -9
- package/dist/system/actions/resolve.js +9 -9
- package/dist/system/actions/reveal.js +1 -1
- package/dist/system/actions/surface.js +13 -1
- package/dist/system/depth/depth.css +49 -49
- package/dist/system/depth/depth.js +1 -1
- package/dist/system/expressions.css +80 -80
- package/dist/system/override-template.css +72 -72
- package/dist/system/register.css +74 -74
- package/dist/system/scroll-lock.d.ts +6 -0
- package/dist/system/scroll-lock.js +23 -0
- package/dist/tokens/tokens.css +100 -86
- package/dist/tokens/tokens.js +4 -4
- package/dist/utils/motion.js +1 -1
- package/package.json +67 -60
|
@@ -1,104 +1,99 @@
|
|
|
1
|
-
<script lang="ts">
|
|
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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
.hyvui-table-row {
|
|
101
|
-
transition: none;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
</style>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '../../utils/cn.js';
|
|
3
|
+
import EmptyState from '../feedback/EmptyState.svelte';
|
|
4
|
+
import type { Snippet } from 'svelte';
|
|
5
|
+
|
|
6
|
+
interface TableColumn {
|
|
7
|
+
key: string;
|
|
8
|
+
label: string;
|
|
9
|
+
align?: 'left' | 'center' | 'right';
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface Props {
|
|
13
|
+
/** Column definitions. */
|
|
14
|
+
columns?: TableColumn[];
|
|
15
|
+
/** Row data objects. */
|
|
16
|
+
rows?: Record<string, any>[];
|
|
17
|
+
/** Additional CSS classes. */
|
|
18
|
+
class?: string;
|
|
19
|
+
/** Custom empty state slot. */
|
|
20
|
+
empty?: Snippet;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
let { columns = [], rows = [], class: className = '', empty }: Props = $props();
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
{#if rows.length === 0}
|
|
27
|
+
{#if empty}
|
|
28
|
+
{@render empty()}
|
|
29
|
+
{:else}
|
|
30
|
+
<EmptyState title="no data" />
|
|
31
|
+
{/if}
|
|
32
|
+
{:else}
|
|
33
|
+
<div class={cn('hyvui-table-wrap', className)}>
|
|
34
|
+
<table class="hyvui-table">
|
|
35
|
+
<thead>
|
|
36
|
+
<tr>
|
|
37
|
+
{#each columns as col}
|
|
38
|
+
<th class="hyvui-table-th" style:text-align={col.align ?? 'left'}>{col.label}</th>
|
|
39
|
+
{/each}
|
|
40
|
+
</tr>
|
|
41
|
+
</thead>
|
|
42
|
+
<tbody>
|
|
43
|
+
{#each rows as row}
|
|
44
|
+
<tr class="hyvui-table-row">
|
|
45
|
+
{#each columns as col}
|
|
46
|
+
<td class="hyvui-table-td" style:text-align={col.align ?? 'left'}>
|
|
47
|
+
{row[col.key] ?? ''}
|
|
48
|
+
</td>
|
|
49
|
+
{/each}
|
|
50
|
+
</tr>
|
|
51
|
+
{/each}
|
|
52
|
+
</tbody>
|
|
53
|
+
</table>
|
|
54
|
+
</div>
|
|
55
|
+
{/if}
|
|
56
|
+
|
|
57
|
+
<style>
|
|
58
|
+
.hyvui-table-wrap {
|
|
59
|
+
overflow-x: auto;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.hyvui-table {
|
|
63
|
+
width: 100%;
|
|
64
|
+
border-collapse: collapse;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.hyvui-table-th {
|
|
68
|
+
font-family: var(--font-mono);
|
|
69
|
+
font-size: 0.68rem;
|
|
70
|
+
font-weight: 400;
|
|
71
|
+
letter-spacing: 0.14em;
|
|
72
|
+
text-transform: uppercase;
|
|
73
|
+
color: var(--muted-strong);
|
|
74
|
+
padding: 0.625rem 0.75rem;
|
|
75
|
+
border-bottom: 1px solid var(--line);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.hyvui-table-td {
|
|
79
|
+
font-family: var(--font-body);
|
|
80
|
+
font-size: 1rem;
|
|
81
|
+
color: var(--text-soft);
|
|
82
|
+
padding: 0.625rem 0.75rem;
|
|
83
|
+
border-bottom: 1px solid var(--line);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.hyvui-table-row {
|
|
87
|
+
transition: background-color var(--transition-fast);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.hyvui-table-row:hover {
|
|
91
|
+
background-color: rgba(199, 156, 87, 0.04);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
@media (prefers-reduced-motion: reduce) {
|
|
95
|
+
.hyvui-table-row {
|
|
96
|
+
transition: none;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
</style>
|
|
@@ -1,76 +1,71 @@
|
|
|
1
|
-
<script lang="ts">
|
|
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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
font-size: 0.9rem;
|
|
73
|
-
color: var(--text-soft);
|
|
74
|
-
line-height: 1.5;
|
|
75
|
-
}
|
|
76
|
-
</style>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '../../utils/cn.js';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
/** Alert variant determining accent color. */
|
|
7
|
+
variant?: 'info' | 'warn' | 'error' | 'ok';
|
|
8
|
+
/** Optional title text. */
|
|
9
|
+
title?: string;
|
|
10
|
+
/** Additional CSS classes. */
|
|
11
|
+
class?: string;
|
|
12
|
+
/** Alert body content. */
|
|
13
|
+
children?: Snippet;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let { variant = 'info', title = '', class: className = '', children }: Props = $props();
|
|
17
|
+
|
|
18
|
+
const colorMap: Record<string, string> = {
|
|
19
|
+
info: 'var(--signal)',
|
|
20
|
+
warn: 'var(--status-warn)',
|
|
21
|
+
error: 'var(--status-fail)',
|
|
22
|
+
ok: 'var(--status-ok)'
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const bgMap: Record<string, string> = {
|
|
26
|
+
info: 'rgba(121, 166, 163, 0.06)',
|
|
27
|
+
warn: 'rgba(199, 156, 87, 0.06)',
|
|
28
|
+
error: 'rgba(182, 106, 72, 0.06)',
|
|
29
|
+
ok: 'rgba(121, 166, 163, 0.06)'
|
|
30
|
+
};
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<div
|
|
34
|
+
class={cn('hyvui-alert', className)}
|
|
35
|
+
style:border-left-color={colorMap[variant]}
|
|
36
|
+
style:background-color={bgMap[variant]}
|
|
37
|
+
role="alert"
|
|
38
|
+
>
|
|
39
|
+
{#if title}
|
|
40
|
+
<div class="hyvui-alert-title">{title}</div>
|
|
41
|
+
{/if}
|
|
42
|
+
{#if children}
|
|
43
|
+
<div class="hyvui-alert-body">
|
|
44
|
+
{@render children()}
|
|
45
|
+
</div>
|
|
46
|
+
{/if}
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<style>
|
|
50
|
+
.hyvui-alert {
|
|
51
|
+
border-left: 2px solid;
|
|
52
|
+
padding: 0.75rem 1rem;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.hyvui-alert-title {
|
|
56
|
+
font-family: var(--font-mono);
|
|
57
|
+
font-size: 0.75rem;
|
|
58
|
+
font-weight: 400;
|
|
59
|
+
letter-spacing: 0.08em;
|
|
60
|
+
text-transform: uppercase;
|
|
61
|
+
color: var(--text-soft);
|
|
62
|
+
margin-bottom: 0.375rem;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.hyvui-alert-body {
|
|
66
|
+
font-family: var(--font-body);
|
|
67
|
+
font-size: 0.9rem;
|
|
68
|
+
color: var(--text-soft);
|
|
69
|
+
line-height: 1.5;
|
|
70
|
+
}
|
|
71
|
+
</style>
|
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
</script>
|
|
23
|
-
|
|
24
|
-
<div class={cn('hyvui-empty', className)}>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
</div>
|
|
35
|
-
|
|
36
|
-
<style>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
</style>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '../../utils/cn.js';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
/** Primary message. */
|
|
7
|
+
title?: string;
|
|
8
|
+
/** Secondary description text. */
|
|
9
|
+
description?: string;
|
|
10
|
+
/** Additional CSS classes. */
|
|
11
|
+
class?: string;
|
|
12
|
+
/** Optional CTA slot (e.g. a Button). */
|
|
13
|
+
children?: Snippet;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let {
|
|
17
|
+
title = 'nothing here yet',
|
|
18
|
+
description = '',
|
|
19
|
+
class: className = '',
|
|
20
|
+
children
|
|
21
|
+
}: Props = $props();
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<div class={cn('hyvui-empty', className)}>
|
|
25
|
+
<p class="hyvui-empty-title">{title}</p>
|
|
26
|
+
{#if description}
|
|
27
|
+
<p class="hyvui-empty-desc">{description}</p>
|
|
28
|
+
{/if}
|
|
29
|
+
{#if children}
|
|
30
|
+
<div class="hyvui-empty-action">
|
|
31
|
+
{@render children()}
|
|
32
|
+
</div>
|
|
33
|
+
{/if}
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<style>
|
|
37
|
+
.hyvui-empty {
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
align-items: center;
|
|
41
|
+
text-align: center;
|
|
42
|
+
padding: 2rem;
|
|
43
|
+
gap: 0.75rem;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.hyvui-empty-title {
|
|
47
|
+
font-family: var(--font-body);
|
|
48
|
+
font-size: 1.2rem;
|
|
49
|
+
font-weight: 400;
|
|
50
|
+
line-height: 0.93;
|
|
51
|
+
letter-spacing: -0.04em;
|
|
52
|
+
color: var(--text);
|
|
53
|
+
margin: 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.hyvui-empty-desc {
|
|
57
|
+
font-family: var(--font-body);
|
|
58
|
+
font-size: 0.9rem;
|
|
59
|
+
color: var(--muted);
|
|
60
|
+
line-height: 1.5;
|
|
61
|
+
max-width: 24rem;
|
|
62
|
+
margin: 0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.hyvui-empty-action {
|
|
66
|
+
margin-top: 0.5rem;
|
|
67
|
+
}
|
|
68
|
+
</style>
|
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
<script lang="ts">
|
|
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
|
-
</script>
|
|
27
|
-
|
|
28
|
-
<div class={cn('hyvui-error', className)}>
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
</div>
|
|
40
|
-
|
|
41
|
-
<style>
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
</style>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '../../utils/cn.js';
|
|
3
|
+
import StatusDot from './StatusDot.svelte';
|
|
4
|
+
import Button from '../inputs/Button.svelte';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
/** Error condition title. Describes the condition, not the cause. */
|
|
8
|
+
title?: string;
|
|
9
|
+
/** Additional description text. */
|
|
10
|
+
description?: string;
|
|
11
|
+
/** Shows a retry button. */
|
|
12
|
+
retry?: boolean;
|
|
13
|
+
/** Additional CSS classes. */
|
|
14
|
+
class?: string;
|
|
15
|
+
/** Fires when the retry button is clicked. */
|
|
16
|
+
onretry?: () => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
let {
|
|
20
|
+
title = 'the signal needs rest',
|
|
21
|
+
description = '',
|
|
22
|
+
retry = false,
|
|
23
|
+
class: className = '',
|
|
24
|
+
onretry
|
|
25
|
+
}: Props = $props();
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<div class={cn('hyvui-error', className)}>
|
|
29
|
+
<StatusDot status="fail" size={8} />
|
|
30
|
+
<p class="hyvui-error-title">{title}</p>
|
|
31
|
+
{#if description}
|
|
32
|
+
<p class="hyvui-error-desc">{description}</p>
|
|
33
|
+
{/if}
|
|
34
|
+
{#if retry}
|
|
35
|
+
<div class="hyvui-error-action">
|
|
36
|
+
<Button variant="ghost" onclick={() => onretry?.()}>retry</Button>
|
|
37
|
+
</div>
|
|
38
|
+
{/if}
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<style>
|
|
42
|
+
.hyvui-error {
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
align-items: center;
|
|
46
|
+
text-align: center;
|
|
47
|
+
padding: 2rem;
|
|
48
|
+
gap: 0.75rem;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.hyvui-error-title {
|
|
52
|
+
font-family: var(--font-body);
|
|
53
|
+
font-size: 1.2rem;
|
|
54
|
+
font-weight: 400;
|
|
55
|
+
line-height: 0.93;
|
|
56
|
+
letter-spacing: -0.04em;
|
|
57
|
+
color: var(--text);
|
|
58
|
+
margin: 0;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.hyvui-error-desc {
|
|
62
|
+
font-family: var(--font-body);
|
|
63
|
+
font-size: 0.9rem;
|
|
64
|
+
color: var(--muted);
|
|
65
|
+
line-height: 1.5;
|
|
66
|
+
max-width: 24rem;
|
|
67
|
+
margin: 0;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.hyvui-error-action {
|
|
71
|
+
margin-top: 0.5rem;
|
|
72
|
+
}
|
|
73
|
+
</style>
|