@svadmin/ui 0.132.0 → 0.133.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/dist/app.css +267 -81
- package/dist/app.theme.css +267 -81
- package/dist/components/AboutSettings.svelte +1 -1
- package/dist/components/BackTop.svelte +62 -8
- package/dist/components/BackTop.svelte.d.ts +8 -3
- package/dist/components/Carousel.svelte +59 -19
- package/dist/components/Carousel.svelte.d.ts +3 -1
- package/dist/components/Collapse.svelte +5 -2
- package/dist/components/EmptyState.svelte +33 -18
- package/dist/components/EmptyState.svelte.d.ts +3 -1
- package/dist/components/Link.svelte +19 -7
- package/dist/components/Link.svelte.d.ts +5 -3
- package/dist/components/NotificationHost.svelte +2 -2
- package/dist/components/RadioGroup.svelte +3 -1
- package/dist/components/RadioGroup.svelte.d.ts +1 -0
- package/dist/components/RangeSlider.svelte +47 -29
- package/dist/components/RangeSlider.svelte.d.ts +1 -0
- package/dist/components/Slider.svelte +39 -18
- package/dist/components/Slider.svelte.d.ts +1 -0
- package/dist/components/Space.svelte +27 -0
- package/dist/components/Space.svelte.d.ts +1 -0
- package/dist/components/Statistic.svelte +11 -2
- package/dist/components/Statistic.svelte.d.ts +2 -0
- package/dist/components/StepsForm.svelte +4 -2
- package/dist/components/TableToolbar.svelte +132 -0
- package/dist/components/TableToolbar.svelte.d.ts +26 -0
- package/dist/components/TagsInput.svelte +47 -2
- package/dist/components/TagsInput.svelte.d.ts +2 -0
- package/dist/components/ui/alert/alert.svelte +42 -1
- package/dist/components/ui/alert/alert.svelte.d.ts +5 -0
- package/dist/components/ui/card/card.svelte +29 -3
- package/dist/components/ui/card/card.svelte.d.ts +5 -2
- package/dist/components/ui/input/input.svelte +74 -17
- package/dist/components/ui/input/input.svelte.d.ts +5 -1
- package/dist/components/ui/progress/progress.svelte +3 -2
- package/dist/components/ui/switch/switch.svelte +17 -3
- package/dist/components/ui/switch/switch.svelte.d.ts +2 -0
- package/dist/components/ui/textarea/textarea.svelte +69 -15
- package/dist/components/ui/textarea/textarea.svelte.d.ts +3 -0
- package/dist/components.css +9 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -1
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
const resources = $derived(adminContext.resources.filter((resource) => resource.meta?.['aboutVisible'] !== false));
|
|
12
12
|
const providerNames = $derived(adminContext.getDataProviderNames());
|
|
13
13
|
let { version: suppliedVersion, headingLevel = 'h1' }: { version?: string; headingLevel?: 'h1' | 'h2' } = $props();
|
|
14
|
-
const buildVersion = "0.
|
|
14
|
+
const buildVersion = "0.133.0";
|
|
15
15
|
const version = $derived(suppliedVersion ?? (
|
|
16
16
|
buildVersion.startsWith('__')
|
|
17
17
|
? (i18n.locale === 'zh-CN' ? '开发构建(未提供版本)' : 'Development build (version unavailable)')
|
|
@@ -1,20 +1,74 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import { ChevronUp } from "@lucide/svelte";
|
|
4
|
+
import { cn } from "../utils.js";
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
threshold?: number;
|
|
8
|
+
target?: string | HTMLElement | Window | undefined;
|
|
9
|
+
label?: string;
|
|
10
|
+
class?: string;
|
|
11
|
+
children?: Snippet;
|
|
12
|
+
onclick?: () => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let {
|
|
16
|
+
threshold = 200,
|
|
17
|
+
target,
|
|
18
|
+
label = "回到顶部",
|
|
19
|
+
class: className = "",
|
|
20
|
+
children,
|
|
21
|
+
onclick,
|
|
22
|
+
}: Props = $props();
|
|
23
|
+
|
|
3
24
|
let visible = $state(false);
|
|
4
25
|
|
|
26
|
+
function resolveTarget(): HTMLElement | Window | null {
|
|
27
|
+
if (typeof window === "undefined") return null;
|
|
28
|
+
if (!target) return window;
|
|
29
|
+
if (typeof target === "string") return document.querySelector(target);
|
|
30
|
+
return target;
|
|
31
|
+
}
|
|
32
|
+
|
|
5
33
|
$effect(() => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
34
|
+
const el = resolveTarget();
|
|
35
|
+
if (!el) return;
|
|
36
|
+
const check = () => {
|
|
37
|
+
const isWin = el === window || (typeof Window !== "undefined" && el instanceof Window);
|
|
38
|
+
const scrollY = isWin ? (window.scrollY ?? window.pageYOffset ?? 0) : (el as HTMLElement).scrollTop;
|
|
39
|
+
visible = scrollY >= threshold;
|
|
40
|
+
};
|
|
41
|
+
check();
|
|
42
|
+
el.addEventListener("scroll", check, { passive: true });
|
|
43
|
+
return () => el.removeEventListener("scroll", check);
|
|
11
44
|
});
|
|
12
45
|
|
|
13
46
|
function scrollTop() {
|
|
14
|
-
|
|
47
|
+
const el = resolveTarget();
|
|
48
|
+
if (!el) return;
|
|
49
|
+
const isWin = el === window || (typeof Window !== "undefined" && el instanceof Window);
|
|
50
|
+
if (isWin) {
|
|
51
|
+
el.scrollTo({ top: 0, behavior: "smooth" });
|
|
52
|
+
} else {
|
|
53
|
+
el.scrollTo({ top: 0, behavior: "smooth" });
|
|
54
|
+
}
|
|
55
|
+
onclick?.();
|
|
15
56
|
}
|
|
16
57
|
</script>
|
|
17
58
|
|
|
18
59
|
{#if visible}
|
|
19
|
-
<button
|
|
60
|
+
<button
|
|
61
|
+
type="button"
|
|
62
|
+
class={cn("svadmin-back-top", className)}
|
|
63
|
+
onclick={scrollTop}
|
|
64
|
+
aria-label={label}
|
|
65
|
+
title={label}
|
|
66
|
+
data-svadmin-component="BackTop"
|
|
67
|
+
>
|
|
68
|
+
{#if children}
|
|
69
|
+
{@render children()}
|
|
70
|
+
{:else}
|
|
71
|
+
<ChevronUp size={16} aria-hidden="true" />
|
|
72
|
+
{/if}
|
|
73
|
+
</button>
|
|
20
74
|
{/if}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
type
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
interface Props {
|
|
2
3
|
threshold?: number;
|
|
4
|
+
target?: string | HTMLElement | Window | undefined;
|
|
3
5
|
label?: string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
class?: string;
|
|
7
|
+
children?: Snippet;
|
|
8
|
+
onclick?: () => void;
|
|
9
|
+
}
|
|
10
|
+
declare const BackTop: import("svelte").Component<Props, {}, "">;
|
|
6
11
|
type BackTop = ReturnType<typeof BackTop>;
|
|
7
12
|
export default BackTop;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { Snippet } from
|
|
3
|
-
import { ChevronLeft, ChevronRight } from
|
|
4
|
-
import { onDestroy } from
|
|
5
|
-
import { Button } from
|
|
6
|
-
import { cn } from
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import { ChevronLeft, ChevronRight } from "@lucide/svelte";
|
|
4
|
+
import { onDestroy } from "svelte";
|
|
5
|
+
import { Button } from "./ui/button/index.js";
|
|
6
|
+
import { cn } from "../utils.js";
|
|
7
7
|
|
|
8
8
|
interface Props {
|
|
9
9
|
count: number;
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
autoPlay?: boolean;
|
|
12
12
|
interval?: number;
|
|
13
13
|
loop?: boolean;
|
|
14
|
+
arrowType?: "always" | "hover" | "never";
|
|
15
|
+
indicatorType?: "dot" | "line";
|
|
14
16
|
ariaLabel?: string;
|
|
15
17
|
children?: Snippet<[number]>;
|
|
16
18
|
class?: string;
|
|
@@ -23,9 +25,11 @@
|
|
|
23
25
|
autoPlay = false,
|
|
24
26
|
interval = 5000,
|
|
25
27
|
loop = true,
|
|
26
|
-
|
|
28
|
+
arrowType = "hover",
|
|
29
|
+
indicatorType = "dot",
|
|
30
|
+
ariaLabel = "Carousel",
|
|
27
31
|
children,
|
|
28
|
-
class: className =
|
|
32
|
+
class: className = "",
|
|
29
33
|
onchange,
|
|
30
34
|
}: Props = $props();
|
|
31
35
|
|
|
@@ -48,7 +52,7 @@
|
|
|
48
52
|
$effect(() => {
|
|
49
53
|
if (timer) clearInterval(timer);
|
|
50
54
|
timer = undefined;
|
|
51
|
-
if (!autoPlay || paused || count <= 1 || typeof window ===
|
|
55
|
+
if (!autoPlay || paused || count <= 1 || typeof window === "undefined") return;
|
|
52
56
|
timer = setInterval(() => go(index + 1), interval);
|
|
53
57
|
return () => {
|
|
54
58
|
if (timer) clearInterval(timer);
|
|
@@ -62,7 +66,9 @@
|
|
|
62
66
|
</script>
|
|
63
67
|
|
|
64
68
|
<section
|
|
65
|
-
class={cn(
|
|
69
|
+
class={cn("svadmin-carousel", className)}
|
|
70
|
+
data-arrow-type={arrowType}
|
|
71
|
+
data-indicator-type={indicatorType}
|
|
66
72
|
aria-label={ariaLabel}
|
|
67
73
|
aria-roledescription="carousel"
|
|
68
74
|
onmouseenter={() => (paused = true)}
|
|
@@ -70,7 +76,7 @@
|
|
|
70
76
|
onfocusin={() => (paused = true)}
|
|
71
77
|
onfocusout={() => (paused = false)}
|
|
72
78
|
>
|
|
73
|
-
<div class="svadmin-carousel__viewport">
|
|
79
|
+
<div class="svadmin-carousel__viewport group">
|
|
74
80
|
<div class="svadmin-carousel__track" style:transform={`translateX(-${index * 100}%)`}>
|
|
75
81
|
{#each Array.from({ length: count }, (_, item) => item) as item (item)}
|
|
76
82
|
<div class="svadmin-carousel__slide" role="group" aria-roledescription="slide" aria-label={`${item + 1} / ${count}`} aria-hidden={item !== index}>
|
|
@@ -78,15 +84,47 @@
|
|
|
78
84
|
</div>
|
|
79
85
|
{/each}
|
|
80
86
|
</div>
|
|
81
|
-
{#if count > 1}
|
|
82
|
-
<Button
|
|
83
|
-
|
|
87
|
+
{#if count > 1 && arrowType !== "never"}
|
|
88
|
+
<Button
|
|
89
|
+
variant="secondary"
|
|
90
|
+
size="icon-sm"
|
|
91
|
+
class={cn(
|
|
92
|
+
"svadmin-carousel__prev shadow-md transition-opacity duration-200",
|
|
93
|
+
arrowType === "hover" && "opacity-0 group-hover:opacity-100 focus-visible:opacity-100"
|
|
94
|
+
)}
|
|
95
|
+
aria-label="Previous slide"
|
|
96
|
+
onclick={() => go(index - 1)}
|
|
97
|
+
>
|
|
98
|
+
<ChevronLeft size={16} />
|
|
99
|
+
</Button>
|
|
100
|
+
<Button
|
|
101
|
+
variant="secondary"
|
|
102
|
+
size="icon-sm"
|
|
103
|
+
class={cn(
|
|
104
|
+
"svadmin-carousel__next shadow-md transition-opacity duration-200",
|
|
105
|
+
arrowType === "hover" && "opacity-0 group-hover:opacity-100 focus-visible:opacity-100"
|
|
106
|
+
)}
|
|
107
|
+
aria-label="Next slide"
|
|
108
|
+
onclick={() => go(index + 1)}
|
|
109
|
+
>
|
|
110
|
+
<ChevronRight size={16} />
|
|
111
|
+
</Button>
|
|
84
112
|
{/if}
|
|
85
113
|
</div>
|
|
86
114
|
{#if count > 1}
|
|
87
|
-
<div
|
|
115
|
+
<div
|
|
116
|
+
class={cn("svadmin-carousel__dots", indicatorType === "line" && "svadmin-carousel__dots--line")}
|
|
117
|
+
role="tablist"
|
|
118
|
+
aria-label="Slides"
|
|
119
|
+
>
|
|
88
120
|
{#each Array.from({ length: count }, (_, item) => item) as item (item)}
|
|
89
|
-
<button
|
|
121
|
+
<button
|
|
122
|
+
type="button"
|
|
123
|
+
role="tab"
|
|
124
|
+
aria-selected={item === index}
|
|
125
|
+
aria-label={`Go to slide ${item + 1}`}
|
|
126
|
+
onclick={() => go(item)}
|
|
127
|
+
></button>
|
|
90
128
|
{/each}
|
|
91
129
|
</div>
|
|
92
130
|
{/if}
|
|
@@ -97,11 +135,13 @@
|
|
|
97
135
|
.svadmin-carousel__viewport { position: relative; overflow: hidden; border-radius: var(--radius-lg); }
|
|
98
136
|
.svadmin-carousel__track { display: flex; transition: transform 220ms ease; }
|
|
99
137
|
.svadmin-carousel__slide { flex: 0 0 100%; min-width: 0; }
|
|
100
|
-
.svadmin-carousel__prev, .svadmin-carousel__next { position: absolute; inset-block-start: 50%; transform: translateY(-50%); }
|
|
138
|
+
.svadmin-carousel__prev, .svadmin-carousel__next { position: absolute; inset-block-start: 50%; transform: translateY(-50%); z-index: 10; }
|
|
101
139
|
.svadmin-carousel__prev { inset-inline-start: var(--svadmin-space-2); }
|
|
102
140
|
.svadmin-carousel__next { inset-inline-end: var(--svadmin-space-2); }
|
|
103
141
|
.svadmin-carousel__dots { display: flex; justify-content: center; gap: var(--svadmin-space-1); }
|
|
104
|
-
.svadmin-carousel__dots button { width: 0.5rem; height: 0.5rem; padding: 0; border: 0; border-radius: 999px; background: var(--border); }
|
|
105
|
-
.svadmin-carousel__dots button[aria-selected=
|
|
142
|
+
.svadmin-carousel__dots button { width: 0.5rem; height: 0.5rem; padding: 0; border: 0; border-radius: 999px; background: var(--border); transition: all 200ms ease; cursor: pointer; }
|
|
143
|
+
.svadmin-carousel__dots button[aria-selected="true"] { width: 1.25rem; background: var(--primary); }
|
|
144
|
+
.svadmin-carousel__dots--line button { width: 1rem; height: 3px; border-radius: 1px; }
|
|
145
|
+
.svadmin-carousel__dots--line button[aria-selected="true"] { width: 1.75rem; }
|
|
106
146
|
@media (prefers-reduced-motion: reduce) { .svadmin-carousel__track { transition: none; } }
|
|
107
|
-
</style>
|
|
147
|
+
</style>
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import type { Snippet } from
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
2
|
interface Props {
|
|
3
3
|
count: number;
|
|
4
4
|
index?: number;
|
|
5
5
|
autoPlay?: boolean;
|
|
6
6
|
interval?: number;
|
|
7
7
|
loop?: boolean;
|
|
8
|
+
arrowType?: "always" | "hover" | "never";
|
|
9
|
+
indicatorType?: "dot" | "line";
|
|
8
10
|
ariaLabel?: string;
|
|
9
11
|
children?: Snippet<[number]>;
|
|
10
12
|
class?: string;
|
|
@@ -140,6 +140,8 @@
|
|
|
140
140
|
gap: var(--svadmin-space-2);
|
|
141
141
|
width: 100%;
|
|
142
142
|
padding: 8px 13px;
|
|
143
|
+
font-size: var(--svadmin-text-body);
|
|
144
|
+
line-height: var(--svadmin-control-h-mini);
|
|
143
145
|
border: 0;
|
|
144
146
|
background: var(--card);
|
|
145
147
|
color: var(--foreground);
|
|
@@ -161,7 +163,8 @@
|
|
|
161
163
|
grid-template-rows: 0fr;
|
|
162
164
|
border-block-start: 1px solid transparent;
|
|
163
165
|
color: var(--muted-foreground);
|
|
164
|
-
font-size: var(--svadmin-text-
|
|
166
|
+
font-size: var(--svadmin-text-body);
|
|
167
|
+
line-height: var(--svadmin-leading-body);
|
|
165
168
|
transition:
|
|
166
169
|
grid-template-rows var(--svadmin-motion-standard) var(--svadmin-motion-easing),
|
|
167
170
|
border-color var(--svadmin-motion-standard) var(--svadmin-motion-easing);
|
|
@@ -175,4 +178,4 @@
|
|
|
175
178
|
.svadmin-collapse__icon,
|
|
176
179
|
.svadmin-collapse__content { transition: none; }
|
|
177
180
|
}
|
|
178
|
-
</style>
|
|
181
|
+
</style>
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { Snippet } from
|
|
3
|
-
import { PackageOpen } from
|
|
4
|
-
import { useTranslation } from
|
|
5
|
-
import { useComponentConfig } from
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import { PackageOpen } from "@lucide/svelte";
|
|
4
|
+
import { useTranslation } from "@svadmin/core";
|
|
5
|
+
import { useComponentConfig } from "./ConfigProvider.svelte";
|
|
6
|
+
import { cn } from "../utils.js";
|
|
6
7
|
|
|
7
8
|
const i18n = useTranslation();
|
|
8
9
|
const config = useComponentConfig();
|
|
@@ -13,6 +14,8 @@
|
|
|
13
14
|
image,
|
|
14
15
|
imageAlt,
|
|
15
16
|
icon,
|
|
17
|
+
layout = "vertical",
|
|
18
|
+
class: className = "",
|
|
16
19
|
children,
|
|
17
20
|
}: {
|
|
18
21
|
title?: string;
|
|
@@ -22,23 +25,26 @@
|
|
|
22
25
|
imageAlt?: string;
|
|
23
26
|
/** Optional custom icon slot; ignored when `image` is set. */
|
|
24
27
|
icon?: Snippet;
|
|
28
|
+
layout?: "vertical" | "horizontal";
|
|
29
|
+
class?: string;
|
|
25
30
|
children?: Snippet;
|
|
26
31
|
} = $props();
|
|
27
32
|
|
|
28
33
|
function textDefault(value: unknown): string | undefined {
|
|
29
|
-
return typeof value ===
|
|
34
|
+
return typeof value === "string" ? value : undefined;
|
|
30
35
|
}
|
|
31
36
|
|
|
32
37
|
const emptyDefaults = $derived(config.empty);
|
|
33
|
-
const componentEmpty = $derived(config.componentDefaults[
|
|
34
|
-
const resolvedTitle = $derived(title ?? emptyDefaults.title ?? textDefault(componentEmpty[
|
|
35
|
-
const resolvedDescription = $derived(description ?? emptyDefaults.description ?? textDefault(componentEmpty[
|
|
36
|
-
const resolvedImage = $derived(image ?? emptyDefaults.image ?? textDefault(componentEmpty[
|
|
37
|
-
const resolvedImageAlt = $derived(imageAlt ?? emptyDefaults.imageAlt ?? textDefault(componentEmpty[
|
|
38
|
+
const componentEmpty = $derived(config.componentDefaults["Empty"] ?? {});
|
|
39
|
+
const resolvedTitle = $derived(title ?? emptyDefaults.title ?? textDefault(componentEmpty["title"]) ?? i18n.t("empty.title"));
|
|
40
|
+
const resolvedDescription = $derived(description ?? emptyDefaults.description ?? textDefault(componentEmpty["description"]) ?? i18n.t("empty.description"));
|
|
41
|
+
const resolvedImage = $derived(image ?? emptyDefaults.image ?? textDefault(componentEmpty["image"]));
|
|
42
|
+
const resolvedImageAlt = $derived(imageAlt ?? emptyDefaults.imageAlt ?? textDefault(componentEmpty["imageAlt"]) ?? "");
|
|
38
43
|
</script>
|
|
39
44
|
|
|
40
45
|
<div
|
|
41
|
-
class="empty-state"
|
|
46
|
+
class={cn("empty-state", layout === "vertical" ? "empty-state--vertical" : "empty-state--horizontal", className)}
|
|
47
|
+
data-layout={layout}
|
|
42
48
|
role="status"
|
|
43
49
|
aria-live="polite"
|
|
44
50
|
>
|
|
@@ -48,7 +54,7 @@
|
|
|
48
54
|
{:else if icon}
|
|
49
55
|
{@render icon()}
|
|
50
56
|
{:else}
|
|
51
|
-
<PackageOpen size={16} />
|
|
57
|
+
<PackageOpen size={layout === "vertical" ? 32 : 16} />
|
|
52
58
|
{/if}
|
|
53
59
|
</span>
|
|
54
60
|
<div class="empty-state__body">
|
|
@@ -63,11 +69,20 @@
|
|
|
63
69
|
</div>
|
|
64
70
|
|
|
65
71
|
<style>
|
|
66
|
-
.empty-state {
|
|
67
|
-
.empty-
|
|
72
|
+
.empty-state { color: var(--foreground); }
|
|
73
|
+
.empty-state--horizontal { display: flex; align-items: flex-start; gap: 12px; padding: 16px; text-align: left; }
|
|
74
|
+
.empty-state--horizontal .empty-state__icon { display: flex; align-items: center; justify-content: center; flex: 0 0 32px; height: 32px; border-radius: 6px; background: var(--muted); color: var(--muted-foreground); overflow: hidden; }
|
|
75
|
+
.empty-state--horizontal .empty-state__body { min-width: 0; flex: 1; overflow-wrap: anywhere; }
|
|
76
|
+
.empty-state--horizontal h3 { margin: 0; font-size: var(--svadmin-text-body); line-height: 1.5715; font-weight: 500; letter-spacing: 0; }
|
|
77
|
+
.empty-state--horizontal p { margin: 4px 0 0; font-size: var(--svadmin-text-body); line-height: 1.5715; color: var(--muted-foreground); }
|
|
78
|
+
.empty-state--horizontal .empty-state__action { margin-top: 12px; }
|
|
79
|
+
|
|
80
|
+
.empty-state--vertical { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; text-align: center; }
|
|
81
|
+
.empty-state--vertical .empty-state__icon { display: flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 50%; background: var(--muted); color: var(--muted-foreground); overflow: hidden; margin-bottom: 12px; }
|
|
82
|
+
.empty-state--vertical .empty-state__body { display: flex; flex-direction: column; align-items: center; max-width: 24rem; }
|
|
83
|
+
.empty-state--vertical h3 { margin: 0; font-size: var(--svadmin-text-section); font-weight: 600; color: var(--foreground); }
|
|
84
|
+
.empty-state--vertical p { margin: 6px 0 0; font-size: var(--svadmin-text-label); color: var(--muted-foreground); line-height: 1.5; }
|
|
85
|
+
.empty-state--vertical .empty-state__action { margin-top: 16px; }
|
|
86
|
+
|
|
68
87
|
.empty-state__image { width: 100%; height: 100%; object-fit: contain; }
|
|
69
|
-
.empty-state__body { min-width: 0; flex: 1; overflow-wrap: anywhere; }
|
|
70
|
-
h3 { margin: 0; font-size: var(--svadmin-text-body); line-height: 1.5715; font-weight: 500; letter-spacing: 0; }
|
|
71
|
-
p { margin: 4px 0 0; font-size: var(--svadmin-text-body); line-height: 1.5715; color: var(--muted-foreground); }
|
|
72
|
-
.empty-state__action { margin-top: 12px; }
|
|
73
88
|
</style>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Snippet } from
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
2
|
type $$ComponentProps = {
|
|
3
3
|
title?: string;
|
|
4
4
|
description?: string;
|
|
@@ -7,6 +7,8 @@ type $$ComponentProps = {
|
|
|
7
7
|
imageAlt?: string;
|
|
8
8
|
/** Optional custom icon slot; ignored when `image` is set. */
|
|
9
9
|
icon?: Snippet;
|
|
10
|
+
layout?: "vertical" | "horizontal";
|
|
11
|
+
class?: string;
|
|
10
12
|
children?: Snippet;
|
|
11
13
|
};
|
|
12
14
|
declare const EmptyState: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { Snippet } from
|
|
3
|
-
import type { HTMLAnchorAttributes } from
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import type { HTMLAnchorAttributes } from "svelte/elements";
|
|
4
|
+
import { ExternalLink } from "@lucide/svelte";
|
|
5
|
+
import { cn } from "../utils.js";
|
|
4
6
|
|
|
5
|
-
type LinkStatus =
|
|
7
|
+
type LinkStatus = "default" | "success" | "warning" | "danger";
|
|
6
8
|
|
|
7
9
|
let {
|
|
8
10
|
href,
|
|
9
11
|
disabled = false,
|
|
10
|
-
status =
|
|
12
|
+
status = "default",
|
|
13
|
+
hoverable = true,
|
|
14
|
+
icon = false,
|
|
11
15
|
class: className,
|
|
12
16
|
children,
|
|
13
17
|
...rest
|
|
14
18
|
}: HTMLAnchorAttributes & {
|
|
15
19
|
disabled?: boolean;
|
|
16
20
|
status?: LinkStatus;
|
|
21
|
+
hoverable?: boolean;
|
|
22
|
+
icon?: boolean;
|
|
17
23
|
children?: Snippet;
|
|
18
24
|
} = $props();
|
|
19
25
|
</script>
|
|
@@ -21,8 +27,14 @@
|
|
|
21
27
|
<a
|
|
22
28
|
{...rest}
|
|
23
29
|
href={disabled ? undefined : href}
|
|
24
|
-
aria-disabled={disabled ?
|
|
30
|
+
aria-disabled={disabled ? "true" : undefined}
|
|
25
31
|
data-slot="link"
|
|
26
32
|
data-status={status}
|
|
27
|
-
|
|
28
|
-
|
|
33
|
+
data-hoverable={hoverable ? "true" : undefined}
|
|
34
|
+
class={cn("svadmin-link inline-flex items-center gap-1", !hoverable && "hover:bg-transparent", className)}
|
|
35
|
+
>
|
|
36
|
+
{@render children?.()}
|
|
37
|
+
{#if icon}
|
|
38
|
+
<ExternalLink class="size-3.5 shrink-0 opacity-70" aria-hidden="true" />
|
|
39
|
+
{/if}
|
|
40
|
+
</a>
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import type { Snippet } from
|
|
2
|
-
import type { HTMLAnchorAttributes } from
|
|
3
|
-
type LinkStatus =
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
import type { HTMLAnchorAttributes } from "svelte/elements";
|
|
3
|
+
type LinkStatus = "default" | "success" | "warning" | "danger";
|
|
4
4
|
type $$ComponentProps = HTMLAnchorAttributes & {
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
status?: LinkStatus;
|
|
7
|
+
hoverable?: boolean;
|
|
8
|
+
icon?: boolean;
|
|
7
9
|
children?: Snippet;
|
|
8
10
|
};
|
|
9
11
|
declare const Link: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
.svadmin-notification-host[data-placement='top-left'] { inset-inline-start: 20px; inset-inline-end: auto; }
|
|
42
42
|
.svadmin-notification-host[data-placement='bottom-right'] { inset-block-start: auto; inset-block-end: 20px; }
|
|
43
43
|
.svadmin-notification-host[data-placement='bottom-left'] { inset-block-start: auto; inset-block-end: 20px; inset-inline-start: 20px; inset-inline-end: auto; }
|
|
44
|
-
.svadmin-notification-host__item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; width: 340px; max-width: 100%; padding: 20px; border: 1px solid var(--border); border-inline-start: 3px solid var(--info); border-radius: 4px; background: var(--card); color: var(--foreground); box-shadow: var(--svadmin-shadow-
|
|
44
|
+
.svadmin-notification-host__item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; width: 340px; max-width: 100%; padding: 20px; border: 1px solid var(--border); border-inline-start: 3px solid var(--info); border-radius: 4px; background: var(--card); color: var(--foreground); box-shadow: var(--svadmin-shadow-notification, 0 4px 12px rgb(0 0 0 / 0.15)); pointer-events: auto; }
|
|
45
45
|
.svadmin-notification-host__item[data-tone='success'] { border-inline-start-color: var(--success); }
|
|
46
46
|
.svadmin-notification-host__item[data-tone='warning'] { border-inline-start-color: var(--warning); }
|
|
47
47
|
.svadmin-notification-host__item[data-tone='danger'] { border-inline-start-color: var(--destructive); }
|
|
48
48
|
.svadmin-notification-host__title { margin: 0 0 4px; font-size: var(--svadmin-text-section); font-weight: 500; }
|
|
49
49
|
.svadmin-notification-host__description { margin: 0; color: var(--foreground); font-size: var(--svadmin-text-body); line-height: 1.5715; }
|
|
50
|
-
.svadmin-notification-host__action { margin-block-start: var(--svadmin-space-2); padding: 0; border: 0; background: transparent; color: var(--primary); font-size: var(--svadmin-text-
|
|
50
|
+
.svadmin-notification-host__action { margin-block-start: var(--svadmin-space-2); padding: 0; border: 0; background: transparent; color: var(--primary); font-size: var(--svadmin-text-body); font-weight: 500; cursor: pointer; }
|
|
51
51
|
.svadmin-notification-host__close { align-self: start; width: 1.5rem; height: 1.5rem; padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted-foreground); cursor: pointer; }
|
|
52
52
|
.svadmin-notification-host__close:hover { background: var(--muted); color: var(--foreground); }
|
|
53
53
|
.svadmin-notification-host__close:focus-visible { outline: var(--svadmin-focus-width) solid var(--ring); outline-offset: var(--svadmin-focus-offset); }
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
name?: string | undefined;
|
|
16
16
|
legend?: string;
|
|
17
17
|
ariaLabel?: string;
|
|
18
|
+
direction?: 'horizontal' | 'vertical';
|
|
18
19
|
disabled?: boolean;
|
|
19
20
|
required?: boolean;
|
|
20
21
|
invalid?: boolean;
|
|
@@ -29,6 +30,7 @@
|
|
|
29
30
|
name,
|
|
30
31
|
legend,
|
|
31
32
|
ariaLabel,
|
|
33
|
+
direction = 'vertical',
|
|
32
34
|
disabled = false,
|
|
33
35
|
required = false,
|
|
34
36
|
invalid = false,
|
|
@@ -250,7 +252,7 @@
|
|
|
250
252
|
aria-label={legend ? undefined : ariaLabel}
|
|
251
253
|
>
|
|
252
254
|
{#if legend}<legend>{legend}</legend>{/if}
|
|
253
|
-
<div class=
|
|
255
|
+
<div class={cn('svadmin-radio-group__options', direction === 'horizontal' ? 'svadmin-radio-group__options--horizontal flex flex-wrap items-center gap-4' : 'grid gap-2')} data-direction={direction}>
|
|
254
256
|
{#each options as option, index (option.value)}
|
|
255
257
|
{@const inputId = `${instanceId}-radio-${index}`}
|
|
256
258
|
<label class="svadmin-radio-group__option" class:svadmin-radio-group__option--disabled={disabled || option.disabled} for={inputId}>
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
describedby?: string;
|
|
19
19
|
ariaLabel?: string;
|
|
20
20
|
showValue?: boolean;
|
|
21
|
+
marks?: Record<number, string>;
|
|
21
22
|
class?: string;
|
|
22
23
|
onchange?: (value: RangeSliderValue) => void;
|
|
23
24
|
}
|
|
@@ -34,6 +35,7 @@
|
|
|
34
35
|
describedby,
|
|
35
36
|
ariaLabel,
|
|
36
37
|
showValue = false,
|
|
38
|
+
marks,
|
|
37
39
|
class: className = '',
|
|
38
40
|
onchange,
|
|
39
41
|
}: Props = $props();
|
|
@@ -57,36 +59,52 @@
|
|
|
57
59
|
}
|
|
58
60
|
</script>
|
|
59
61
|
|
|
60
|
-
<div class={cn('svadmin-range-slider', className)} data-invalid={invalid ? 'true' : undefined}>
|
|
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
|
-
|
|
62
|
+
<div class={cn('svadmin-range-slider flex flex-col w-full gap-1', className)} data-invalid={invalid ? 'true' : undefined}>
|
|
63
|
+
<div class="flex items-center gap-2 w-full">
|
|
64
|
+
{#if minName}<input type="hidden" name={minName} value={lower} />{/if}
|
|
65
|
+
{#if maxName}<input type="hidden" name={maxName} value={upper} />{/if}
|
|
66
|
+
<div class="svadmin-range-slider__tracks">
|
|
67
|
+
<input
|
|
68
|
+
type="range"
|
|
69
|
+
value={lower}
|
|
70
|
+
{min}
|
|
71
|
+
max={upper}
|
|
72
|
+
{step}
|
|
73
|
+
disabled={disabled}
|
|
74
|
+
aria-label={ariaLabel ? `${ariaLabel} minimum` : 'Minimum'}
|
|
75
|
+
aria-invalid={invalid || undefined}
|
|
76
|
+
aria-describedby={describedby}
|
|
77
|
+
oninput={(event) => update('min', (event.currentTarget as HTMLInputElement).value)}
|
|
78
|
+
/>
|
|
79
|
+
<input
|
|
80
|
+
type="range"
|
|
81
|
+
value={upper}
|
|
82
|
+
min={lower}
|
|
83
|
+
{max}
|
|
84
|
+
{step}
|
|
85
|
+
disabled={disabled}
|
|
86
|
+
aria-label={ariaLabel ? `${ariaLabel} maximum` : 'Maximum'}
|
|
87
|
+
aria-invalid={invalid || undefined}
|
|
88
|
+
aria-describedby={describedby}
|
|
89
|
+
oninput={(event) => update('max', (event.currentTarget as HTMLInputElement).value)}
|
|
90
|
+
/>
|
|
91
|
+
</div>
|
|
92
|
+
{#if showValue}<output>{lower} - {upper}</output>{/if}
|
|
88
93
|
</div>
|
|
89
|
-
{#if
|
|
94
|
+
{#if marks && Object.keys(marks).length > 0}
|
|
95
|
+
<div class="relative w-full h-5 text-[11px] text-muted-foreground select-none" data-slot="slider-marks">
|
|
96
|
+
{#each Object.entries(marks) as [markVal, label] (markVal)}
|
|
97
|
+
{@const valNum = Number(markVal)}
|
|
98
|
+
{@const pct = boundsValid ? Math.min(100, Math.max(0, ((valNum - min) / (max - min)) * 100)) : 0}
|
|
99
|
+
<span
|
|
100
|
+
class="absolute -translate-x-1/2 hover:text-foreground transition-colors"
|
|
101
|
+
style={`left: ${pct}%;`}
|
|
102
|
+
>
|
|
103
|
+
{label}
|
|
104
|
+
</span>
|
|
105
|
+
{/each}
|
|
106
|
+
</div>
|
|
107
|
+
{/if}
|
|
90
108
|
</div>
|
|
91
109
|
|
|
92
110
|
<style>
|