@svadmin/ui 0.131.2 → 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.
Files changed (55) hide show
  1. package/dist/app.css +640 -250
  2. package/dist/app.theme.css +640 -250
  3. package/dist/components/AboutSettings.svelte +1 -1
  4. package/dist/components/BackTop.svelte +62 -8
  5. package/dist/components/BackTop.svelte.d.ts +8 -3
  6. package/dist/components/Carousel.svelte +59 -19
  7. package/dist/components/Carousel.svelte.d.ts +3 -1
  8. package/dist/components/Collapse.svelte +11 -7
  9. package/dist/components/EmptyState.svelte +33 -18
  10. package/dist/components/EmptyState.svelte.d.ts +3 -1
  11. package/dist/components/FileUpload.svelte +6 -4
  12. package/dist/components/Link.svelte +19 -7
  13. package/dist/components/Link.svelte.d.ts +5 -3
  14. package/dist/components/NotificationHost.svelte +8 -8
  15. package/dist/components/RadioGroup.svelte +3 -1
  16. package/dist/components/RadioGroup.svelte.d.ts +1 -0
  17. package/dist/components/RangeSlider.svelte +47 -29
  18. package/dist/components/RangeSlider.svelte.d.ts +1 -0
  19. package/dist/components/Slider.svelte +39 -18
  20. package/dist/components/Slider.svelte.d.ts +1 -0
  21. package/dist/components/Space.svelte +27 -0
  22. package/dist/components/Space.svelte.d.ts +1 -0
  23. package/dist/components/Statistic.svelte +14 -5
  24. package/dist/components/Statistic.svelte.d.ts +2 -0
  25. package/dist/components/Steps.svelte +5 -3
  26. package/dist/components/StepsForm.svelte +4 -2
  27. package/dist/components/TableToolbar.svelte +132 -0
  28. package/dist/components/TableToolbar.svelte.d.ts +26 -0
  29. package/dist/components/Tag.svelte +1 -1
  30. package/dist/components/TagsInput.svelte +47 -2
  31. package/dist/components/TagsInput.svelte.d.ts +2 -0
  32. package/dist/components/Timeline.svelte +8 -5
  33. package/dist/components/Tree.svelte +6 -5
  34. package/dist/components/TypographyEllipsis.svelte +1 -1
  35. package/dist/components/content/DataState.svelte +2 -2
  36. package/dist/components/content/DescriptionList.svelte +25 -21
  37. package/dist/components/ui/alert/alert.svelte +42 -1
  38. package/dist/components/ui/alert/alert.svelte.d.ts +5 -0
  39. package/dist/components/ui/card/card.svelte +29 -3
  40. package/dist/components/ui/card/card.svelte.d.ts +5 -2
  41. package/dist/components/ui/input/input.svelte +74 -17
  42. package/dist/components/ui/input/input.svelte.d.ts +5 -1
  43. package/dist/components/ui/pagination/pagination-link.svelte +2 -8
  44. package/dist/components/ui/pagination/pagination-next.svelte +2 -5
  45. package/dist/components/ui/pagination/pagination-previous.svelte +2 -5
  46. package/dist/components/ui/progress/progress.svelte +15 -12
  47. package/dist/components/ui/switch/switch.svelte +17 -3
  48. package/dist/components/ui/switch/switch.svelte.d.ts +2 -0
  49. package/dist/components/ui/textarea/textarea.svelte +69 -15
  50. package/dist/components/ui/textarea/textarea.svelte.d.ts +3 -0
  51. package/dist/components.css +9 -1
  52. package/dist/index.d.ts +2 -1
  53. package/dist/index.js +3 -1
  54. package/dist/page-chrome.css +2 -1
  55. 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.131.2";
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
- let { threshold = 200, label = '回到顶部' }: { threshold?: number; label?: string } = $props();
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
- if (typeof window === 'undefined') return;
7
- const onScroll = () => { visible = window.scrollY >= threshold; };
8
- onScroll();
9
- window.addEventListener('scroll', onScroll, { passive: true });
10
- return () => window.removeEventListener('scroll', onScroll);
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
- window.scrollTo({ top: 0, behavior: 'smooth' });
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 type="button" class="svadmin-back-top" onclick={scrollTop}>{label}</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 $$ComponentProps = {
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
- declare const BackTop: import("svelte").Component<$$ComponentProps, {}, "">;
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 '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';
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
- ariaLabel = 'Carousel',
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 === 'undefined') return;
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('svadmin-carousel', className)}
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 variant="secondary" size="icon-sm" class="svadmin-carousel__prev" aria-label="Previous slide" onclick={() => go(index - 1)}><ChevronLeft size={16} /></Button>
83
- <Button variant="secondary" size="icon-sm" class="svadmin-carousel__next" aria-label="Next slide" onclick={() => go(index + 1)}><ChevronRight size={16} /></Button>
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 class="svadmin-carousel__dots" role="tablist" aria-label="Slides">
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 type="button" role="tab" aria-selected={item === index} aria-label={`Go to slide ${item + 1}`} onclick={() => go(item)}></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='true'] { width: 1.25rem; background: var(--primary); }
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 'svelte';
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;
@@ -139,28 +139,32 @@
139
139
  align-items: center;
140
140
  gap: var(--svadmin-space-2);
141
141
  width: 100%;
142
- padding: var(--svadmin-space-3) var(--svadmin-space-4);
142
+ padding: 8px 13px;
143
+ font-size: var(--svadmin-text-body);
144
+ line-height: var(--svadmin-control-h-mini);
143
145
  border: 0;
144
- background: var(--muted);
146
+ background: var(--card);
145
147
  color: var(--foreground);
146
148
  text-align: start;
147
149
  cursor: pointer;
148
150
  }
149
151
  .svadmin-collapse__trigger:hover,
150
- .svadmin-collapse__trigger:focus-visible { background: var(--accent); outline: none; }
152
+ .svadmin-collapse__trigger:focus-visible { background: var(--svadmin-fill-2, var(--muted)); outline: none; }
151
153
  .svadmin-collapse__trigger[aria-expanded='true'] { background: var(--card); }
152
154
  .svadmin-collapse__label { display: grid; flex: 1; gap: 0.1rem; min-width: 0; }
153
- .svadmin-collapse__label strong { font-size: var(--svadmin-text-label); font-weight: 600; }
155
+ .svadmin-collapse__label strong { font-size: var(--svadmin-text-body); font-weight: 400; }
156
+ .svadmin-collapse__trigger[aria-expanded='true'] .svadmin-collapse__label strong { font-weight: 500; }
154
157
  .svadmin-collapse__label small { color: var(--muted-foreground); font-size: var(--svadmin-text-caption); }
155
158
  .svadmin-collapse__icon { display: inline-flex; flex: 0 0 auto; color: var(--muted-foreground); transition: transform var(--svadmin-motion-fast) var(--svadmin-motion-easing); }
156
159
  .svadmin-collapse__trigger.is-open .svadmin-collapse__icon { transform: rotate(180deg); }
157
- .svadmin-collapse__trigger:disabled { cursor: not-allowed; opacity: 0.5; }
160
+ .svadmin-collapse__trigger:disabled { cursor: not-allowed; opacity: 1; color: var(--svadmin-text-4); }
158
161
  .svadmin-collapse__content {
159
162
  display: grid;
160
163
  grid-template-rows: 0fr;
161
164
  border-block-start: 1px solid transparent;
162
165
  color: var(--muted-foreground);
163
- font-size: var(--svadmin-text-label);
166
+ font-size: var(--svadmin-text-body);
167
+ line-height: var(--svadmin-leading-body);
164
168
  transition:
165
169
  grid-template-rows var(--svadmin-motion-standard) var(--svadmin-motion-easing),
166
170
  border-color var(--svadmin-motion-standard) var(--svadmin-motion-easing);
@@ -174,4 +178,4 @@
174
178
  .svadmin-collapse__icon,
175
179
  .svadmin-collapse__content { transition: none; }
176
180
  }
177
- </style>
181
+ </style>
@@ -1,8 +1,9 @@
1
1
  <script lang="ts">
2
- import type { Snippet } from 'svelte';
3
- import { PackageOpen } from '@lucide/svelte';
4
- import { useTranslation } from '@svadmin/core';
5
- import { useComponentConfig } from './ConfigProvider.svelte';
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 === 'string' ? value : undefined;
34
+ return typeof value === "string" ? value : undefined;
30
35
  }
31
36
 
32
37
  const emptyDefaults = $derived(config.empty);
33
- const componentEmpty = $derived(config.componentDefaults['Empty'] ?? {});
34
- const resolvedTitle = $derived(title ?? emptyDefaults.title ?? textDefault(componentEmpty['title']) ?? i18n.t('empty.title'));
35
- const resolvedDescription = $derived(description ?? emptyDefaults.description ?? textDefault(componentEmpty['description']) ?? i18n.t('empty.description'));
36
- const resolvedImage = $derived(image ?? emptyDefaults.image ?? textDefault(componentEmpty['image']));
37
- const resolvedImageAlt = $derived(imageAlt ?? emptyDefaults.imageAlt ?? textDefault(componentEmpty['imageAlt']) ?? '');
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 { display: flex; align-items: flex-start; gap: 12px; padding: 16px; text-align: left; color: var(--foreground); }
67
- .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; }
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-label); line-height: var(--svadmin-leading-body); font-weight: 600; letter-spacing: 0; }
71
- p { margin: var(--svadmin-space-1) 0 0; font-size: var(--svadmin-text-label); line-height: var(--svadmin-leading-body); color: var(--muted-foreground); }
72
- .empty-state__action { margin-top: 12px; }
73
88
  </style>
@@ -1,4 +1,4 @@
1
- import type { Snippet } from 'svelte';
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, {}, "">;
@@ -477,10 +477,12 @@
477
477
 
478
478
  <style>
479
479
  .svadmin-file-upload-input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
480
- .svadmin-file-upload-dropzone { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 88px; border: 1px dashed var(--border); border-radius: 6px; cursor: pointer; }
481
- .svadmin-file-upload-dropzone[aria-disabled="true"] { cursor: not-allowed; opacity: 0.6; }
482
- .svadmin-file-upload-list { display: grid; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }
483
- .svadmin-file-upload-list li { display: flex; align-items: center; gap: 8px; min-width: 0; }
480
+ /* Official drag trigger: 2px radius, dashed neutral border, fill-1, 50px vertical padding. */
481
+ .svadmin-file-upload-dropzone { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 50px 0; border: 1px dashed var(--border); border-radius: 2px; background: var(--svadmin-fill-1, var(--muted)); color: var(--foreground); cursor: pointer; }
482
+ .svadmin-file-upload-dropzone:hover:not([aria-disabled="true"]) { border-color: var(--svadmin-text-3, var(--border)); background: var(--svadmin-fill-3, var(--muted)); }
483
+ .svadmin-file-upload-dropzone[aria-disabled="true"] { cursor: not-allowed; opacity: 1; border-color: var(--svadmin-text-4); background: var(--svadmin-fill-1, var(--muted)); color: var(--svadmin-text-4); }
484
+ .svadmin-file-upload-list { display: grid; gap: 12px; margin: 12px 0 0; padding: 0; list-style: none; }
485
+ .svadmin-file-upload-list li { display: flex; align-items: center; gap: 8px; min-width: 0; box-sizing: border-box; padding: 8px 10px 8px 12px; border-radius: 2px; background: var(--svadmin-fill-1, var(--muted)); font-size: var(--svadmin-text-body); }
484
486
  .svadmin-file-upload-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
485
487
  .svadmin-file-upload-status { color: var(--muted-foreground); font-size: 0.875rem; }
486
488
  </style>
@@ -1,19 +1,25 @@
1
1
  <script lang="ts">
2
- import type { Snippet } from 'svelte';
3
- import type { HTMLAnchorAttributes } from 'svelte/elements';
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 = 'default' | 'success' | 'warning' | 'danger';
7
+ type LinkStatus = "default" | "success" | "warning" | "danger";
6
8
 
7
9
  let {
8
10
  href,
9
11
  disabled = false,
10
- status = 'default',
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 ? 'true' : undefined}
30
+ aria-disabled={disabled ? "true" : undefined}
25
31
  data-slot="link"
26
32
  data-status={status}
27
- class={['svadmin-link', className]}
28
- >{@render children?.()}</a>
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 'svelte';
2
- import type { HTMLAnchorAttributes } from 'svelte/elements';
3
- type LinkStatus = 'default' | 'success' | 'warning' | 'danger';
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, {}, "">;
@@ -37,17 +37,17 @@
37
37
  {/each}
38
38
 
39
39
  <style>
40
- .svadmin-notification-host { position: fixed; z-index: 80; inset-block-start: 1rem; inset-inline-end: 1rem; display: grid; width: min(22rem, calc(100vw - 2rem)); gap: var(--svadmin-space-2); pointer-events: none; }
41
- .svadmin-notification-host[data-placement='top-left'] { inset-inline-start: 1rem; inset-inline-end: auto; }
42
- .svadmin-notification-host[data-placement='bottom-right'] { inset-block-start: auto; inset-block-end: 1rem; }
43
- .svadmin-notification-host[data-placement='bottom-left'] { inset-block-start: auto; inset-block-end: 1rem; inset-inline-start: 1rem; inset-inline-end: auto; }
44
- .svadmin-notification-host__item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--svadmin-space-3); padding: var(--svadmin-space-3); border: 1px solid var(--border); border-inline-start: 3px solid var(--info); border-radius: var(--radius-md); background: var(--card); color: var(--foreground); box-shadow: var(--shadow-overlay, 0 10px 28px color-mix(in srgb, var(--foreground) 16%, transparent)); pointer-events: auto; }
40
+ .svadmin-notification-host { position: fixed; z-index: 80; inset-block-start: 20px; inset-inline-end: 20px; display: grid; width: min(340px, calc(100vw - 40px)); gap: 20px; pointer-events: none; }
41
+ .svadmin-notification-host[data-placement='top-left'] { inset-inline-start: 20px; inset-inline-end: auto; }
42
+ .svadmin-notification-host[data-placement='bottom-right'] { inset-block-start: auto; inset-block-end: 20px; }
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-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
- .svadmin-notification-host__title { margin: 0; font-size: var(--svadmin-text-body); font-weight: 600; }
49
- .svadmin-notification-host__description { margin: var(--svadmin-space-1) 0 0; color: var(--muted-foreground); font-size: var(--svadmin-text-label); line-height: var(--svadmin-leading-body); }
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-label); font-weight: 600; cursor: pointer; }
48
+ .svadmin-notification-host__title { margin: 0 0 4px; font-size: var(--svadmin-text-section); font-weight: 500; }
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-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="svadmin-radio-group__options">
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}>
@@ -10,6 +10,7 @@ interface Props<T extends string = string> {
10
10
  name?: string | undefined;
11
11
  legend?: string;
12
12
  ariaLabel?: string;
13
+ direction?: 'horizontal' | 'vertical';
13
14
  disabled?: boolean;
14
15
  required?: boolean;
15
16
  invalid?: boolean;