@svadmin/ui 0.133.0 → 0.135.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 +265 -15
- package/dist/app.theme.css +265 -15
- package/dist/components/AboutSettings.svelte +1 -1
- package/dist/components/Affix.svelte +16 -5
- package/dist/components/Affix.svelte.d.ts +3 -0
- package/dist/components/Anchor.svelte +7 -3
- package/dist/components/Anchor.svelte.d.ts +2 -0
- package/dist/components/Breadcrumbs.svelte +24 -4
- package/dist/components/Breadcrumbs.svelte.d.ts +6 -0
- package/dist/components/EmptyState.svelte +2 -2
- package/dist/components/OtpInput.svelte +5 -0
- package/dist/components/OtpInput.svelte.d.ts +1 -0
- package/dist/components/RadioGroup.svelte +9 -1
- package/dist/components/RangeSlider.svelte +12 -7
- package/dist/components/Slider.svelte +12 -4
- package/dist/components/Statistic.svelte +2 -1
- package/dist/components/Steps.svelte +75 -2
- package/dist/components/Steps.svelte.d.ts +2 -0
- package/dist/components/Tag.svelte +50 -12
- package/dist/components/Tag.svelte.d.ts +7 -3
- package/dist/components/TagsInput.svelte +35 -18
- package/dist/components/Timeline.svelte +63 -5
- package/dist/components/Timeline.svelte.d.ts +2 -1
- package/dist/components/Toast.svelte +1 -1
- package/dist/components/content/DescriptionList.svelte +90 -64
- package/dist/components/content/DescriptionList.svelte.d.ts +5 -1
- package/dist/components/ui/avatar/avatar-variants.d.ts +3 -1
- package/dist/components/ui/avatar/avatar-variants.js +7 -1
- package/dist/components/ui/avatar/avatar.svelte +7 -4
- package/dist/components/ui/avatar/avatar.svelte.d.ts +3 -2
- package/dist/components/ui/avatar/index.d.ts +2 -2
- package/dist/components/ui/avatar/index.js +2 -2
- package/dist/components/ui/dialog/dialog-content.svelte +1 -1
- package/dist/components/ui/dialog/dialog-content.svelte.d.ts +1 -1
- package/dist/components/ui/input/input.svelte +6 -11
- package/dist/components/ui/textarea/textarea.svelte +21 -25
- package/dist/components.css +4 -1
- package/dist/icon-registry.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/intent-preload.d.ts +1 -1
- package/dist/intent-preload.js +1 -1
- package/dist/notifications.svelte.d.ts +1 -0
- package/dist/notifications.svelte.js +2 -0
- package/package.json +4 -4
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import { cn } from "../../utils.js";
|
|
3
4
|
|
|
4
5
|
export interface DescriptionItem {
|
|
5
6
|
label: string;
|
|
@@ -10,112 +11,137 @@
|
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
interface Props {
|
|
14
|
+
title?: string;
|
|
15
|
+
extra?: Snippet;
|
|
13
16
|
items?: DescriptionItem[];
|
|
14
17
|
columns?: 1 | 2 | 3 | 4;
|
|
15
|
-
layout?:
|
|
18
|
+
layout?: "vertical" | "horizontal";
|
|
19
|
+
size?: "small" | "default" | "large";
|
|
16
20
|
bordered?: boolean;
|
|
17
21
|
class?: string;
|
|
18
22
|
}
|
|
19
23
|
|
|
20
24
|
let {
|
|
25
|
+
title,
|
|
26
|
+
extra,
|
|
21
27
|
items = [],
|
|
22
28
|
columns = 1,
|
|
23
|
-
layout =
|
|
29
|
+
layout = "vertical",
|
|
30
|
+
size = "default",
|
|
24
31
|
bordered = false,
|
|
25
|
-
class: className =
|
|
32
|
+
class: className = "",
|
|
26
33
|
}: Props = $props();
|
|
27
34
|
|
|
28
|
-
const isHorizontal = $derived(layout ===
|
|
35
|
+
const isHorizontal = $derived(layout === "horizontal");
|
|
29
36
|
|
|
30
37
|
function spanClass(span: number | undefined): string {
|
|
31
|
-
if (!span || span <= 1) return
|
|
32
|
-
if (span >= 4) return
|
|
33
|
-
if (span === 3) return
|
|
34
|
-
return
|
|
38
|
+
if (!span || span <= 1) return "";
|
|
39
|
+
if (span >= 4) return "sm:col-span-4";
|
|
40
|
+
if (span === 3) return "sm:col-span-3";
|
|
41
|
+
return "sm:col-span-2";
|
|
35
42
|
}
|
|
36
43
|
|
|
37
44
|
const columnClass = $derived.by(() => {
|
|
38
45
|
switch (columns) {
|
|
39
46
|
case 4:
|
|
40
|
-
return
|
|
47
|
+
return "grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4";
|
|
41
48
|
case 3:
|
|
42
|
-
return
|
|
49
|
+
return "grid-cols-1 sm:grid-cols-2 lg:grid-cols-3";
|
|
43
50
|
case 2:
|
|
44
|
-
return
|
|
51
|
+
return "grid-cols-1 sm:grid-cols-2";
|
|
45
52
|
default:
|
|
46
|
-
return
|
|
53
|
+
return "grid-cols-1";
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const sizePadding = $derived.by(() => {
|
|
58
|
+
switch (size) {
|
|
59
|
+
case "small":
|
|
60
|
+
return "px-3 py-1.5 text-xs";
|
|
61
|
+
case "large":
|
|
62
|
+
return "px-5 py-3.5 text-sm sm:text-base";
|
|
63
|
+
case "default":
|
|
64
|
+
default:
|
|
65
|
+
return "px-4 py-2.5 text-xs sm:text-sm";
|
|
47
66
|
}
|
|
48
67
|
});
|
|
49
68
|
</script>
|
|
50
69
|
|
|
51
|
-
{
|
|
52
|
-
|
|
53
|
-
<
|
|
70
|
+
<div class={cn("svadmin-description-list-wrapper w-full", className)}>
|
|
71
|
+
{#if title || extra}
|
|
72
|
+
<div class="flex items-center justify-between pb-2 mb-2" data-slot="description-list-header">
|
|
73
|
+
{#if title}<h3 class="text-sm font-semibold text-foreground m-0">{title}</h3>{/if}
|
|
74
|
+
{#if extra}<div class="text-xs text-muted-foreground">{@render extra()}</div>{/if}
|
|
75
|
+
</div>
|
|
76
|
+
{/if}
|
|
77
|
+
{#if bordered}
|
|
78
|
+
<div class="overflow-hidden rounded-lg border border-border bg-card text-foreground">
|
|
79
|
+
<dl class={cn("grid divide-y divide-border/60 sm:divide-y-0", columnClass)}>
|
|
80
|
+
{#each items as item, idx (item.label ? `${item.label}-${idx}` : idx)}
|
|
81
|
+
<div
|
|
82
|
+
class={cn(
|
|
83
|
+
"flex flex-col border-b border-r border-border/40 last:border-b-0",
|
|
84
|
+
isHorizontal ? "sm:flex-row" : "",
|
|
85
|
+
spanClass(Math.min(item.span ?? 1, columns)),
|
|
86
|
+
)}
|
|
87
|
+
>
|
|
88
|
+
<dt
|
|
89
|
+
class={cn(
|
|
90
|
+
"svadmin-description-list__label shrink-0 border-b sm:border-b-0 sm:border-r border-border/30 bg-muted/30",
|
|
91
|
+
sizePadding,
|
|
92
|
+
isHorizontal ? "sm:w-1/3" : "",
|
|
93
|
+
)}
|
|
94
|
+
>
|
|
95
|
+
{item.label}
|
|
96
|
+
</dt>
|
|
97
|
+
<dd class={cn("svadmin-description-list__value bg-card", sizePadding)}>
|
|
98
|
+
{#if item.href}
|
|
99
|
+
<a class="text-primary underline-offset-4 hover:underline" href={item.href}>{String(item.value ?? "—")}</a>
|
|
100
|
+
{:else}
|
|
101
|
+
{item.value != null ? String(item.value) : "—"}
|
|
102
|
+
{/if}
|
|
103
|
+
{#if item.description}
|
|
104
|
+
<p class="mt-0.5 text-xs font-normal text-muted-foreground">{item.description}</p>
|
|
105
|
+
{/if}
|
|
106
|
+
</dd>
|
|
107
|
+
</div>
|
|
108
|
+
{/each}
|
|
109
|
+
</dl>
|
|
110
|
+
</div>
|
|
111
|
+
{:else}
|
|
112
|
+
<dl
|
|
113
|
+
class={cn(
|
|
114
|
+
"grid",
|
|
115
|
+
columnClass,
|
|
116
|
+
size === "small" ? "gap-x-4 gap-y-3" : size === "large" ? "gap-x-8 gap-y-6" : "gap-x-6 gap-y-5",
|
|
117
|
+
)}
|
|
118
|
+
>
|
|
54
119
|
{#each items as item, idx (item.label ? `${item.label}-${idx}` : idx)}
|
|
55
120
|
<div
|
|
56
121
|
class={cn(
|
|
57
|
-
|
|
58
|
-
isHorizontal ?
|
|
122
|
+
"min-w-0",
|
|
123
|
+
isHorizontal ? "flex items-baseline gap-2" : "",
|
|
59
124
|
spanClass(Math.min(item.span ?? 1, columns)),
|
|
60
125
|
)}
|
|
61
126
|
>
|
|
62
|
-
<dt
|
|
63
|
-
class={cn(
|
|
64
|
-
'svadmin-description-list__label shrink-0 border-b sm:border-b-0 sm:border-r border-border/30 bg-muted/30',
|
|
65
|
-
'px-4 py-2.5',
|
|
66
|
-
isHorizontal ? 'sm:w-1/3' : '',
|
|
67
|
-
)}
|
|
68
|
-
>
|
|
127
|
+
<dt class="svadmin-description-list__label">
|
|
69
128
|
{item.label}
|
|
70
129
|
</dt>
|
|
71
|
-
<dd class="svadmin-description-list__value
|
|
130
|
+
<dd class="svadmin-description-list__value">
|
|
72
131
|
{#if item.href}
|
|
73
|
-
<a class="text-primary underline-offset-4 hover:underline" href={item.href}>{String(item.value ??
|
|
132
|
+
<a class="text-primary underline-offset-4 hover:underline" href={item.href}>{String(item.value ?? "—")}</a>
|
|
74
133
|
{:else}
|
|
75
|
-
{item.value != null ? String(item.value) :
|
|
134
|
+
{item.value != null ? String(item.value) : "—"}
|
|
76
135
|
{/if}
|
|
77
136
|
{#if item.description}
|
|
78
|
-
<p class="mt-
|
|
137
|
+
<p class="mt-1 text-xs font-normal text-muted-foreground">{item.description}</p>
|
|
79
138
|
{/if}
|
|
80
139
|
</dd>
|
|
81
140
|
</div>
|
|
82
141
|
{/each}
|
|
83
142
|
</dl>
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
<dl
|
|
87
|
-
class={cn(
|
|
88
|
-
'grid',
|
|
89
|
-
columnClass,
|
|
90
|
-
'gap-x-6 gap-y-5',
|
|
91
|
-
className,
|
|
92
|
-
)}
|
|
93
|
-
>
|
|
94
|
-
{#each items as item, idx (item.label ? `${item.label}-${idx}` : idx)}
|
|
95
|
-
<div
|
|
96
|
-
class={cn(
|
|
97
|
-
'min-w-0',
|
|
98
|
-
isHorizontal ? 'flex items-baseline gap-2' : '',
|
|
99
|
-
spanClass(Math.min(item.span ?? 1, columns)),
|
|
100
|
-
)}
|
|
101
|
-
>
|
|
102
|
-
<dt class="svadmin-description-list__label">
|
|
103
|
-
{item.label}
|
|
104
|
-
</dt>
|
|
105
|
-
<dd class="svadmin-description-list__value">
|
|
106
|
-
{#if item.href}
|
|
107
|
-
<a class="text-primary underline-offset-4 hover:underline" href={item.href}>{String(item.value ?? '—')}</a>
|
|
108
|
-
{:else}
|
|
109
|
-
{item.value != null ? String(item.value) : '—'}
|
|
110
|
-
{/if}
|
|
111
|
-
{#if item.description}
|
|
112
|
-
<p class="mt-1 text-xs font-normal text-muted-foreground">{item.description}</p>
|
|
113
|
-
{/if}
|
|
114
|
-
</dd>
|
|
115
|
-
</div>
|
|
116
|
-
{/each}
|
|
117
|
-
</dl>
|
|
118
|
-
{/if}
|
|
143
|
+
{/if}
|
|
144
|
+
</div>
|
|
119
145
|
|
|
120
146
|
<style>
|
|
121
147
|
.svadmin-description-list__label {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
1
2
|
export interface DescriptionItem {
|
|
2
3
|
label: string;
|
|
3
4
|
value: unknown;
|
|
@@ -6,9 +7,12 @@ export interface DescriptionItem {
|
|
|
6
7
|
span?: number;
|
|
7
8
|
}
|
|
8
9
|
interface Props {
|
|
10
|
+
title?: string;
|
|
11
|
+
extra?: Snippet;
|
|
9
12
|
items?: DescriptionItem[];
|
|
10
13
|
columns?: 1 | 2 | 3 | 4;
|
|
11
|
-
layout?:
|
|
14
|
+
layout?: "vertical" | "horizontal";
|
|
15
|
+
size?: "small" | "default" | "large";
|
|
12
16
|
bordered?: boolean;
|
|
13
17
|
class?: string;
|
|
14
18
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export type AvatarSize = "default" | "sm" | "lg" | "xl";
|
|
2
|
-
export
|
|
2
|
+
export type AvatarShape = "circle" | "square";
|
|
3
|
+
export declare const avatarVariants: ({ size, shape, class: className, className: extraClassName, }?: {
|
|
3
4
|
size?: AvatarSize | null;
|
|
5
|
+
shape?: AvatarShape | null;
|
|
4
6
|
class?: string;
|
|
5
7
|
className?: string;
|
|
6
8
|
}) => string;
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
export const avatarVariants = ({ size = "default", class: className = "", className: extraClassName = "", } = {}) => [
|
|
1
|
+
export const avatarVariants = ({ size = "default", shape = "circle", class: className = "", className: extraClassName = "", } = {}) => [
|
|
2
|
+
"svadmin-avatar",
|
|
3
|
+
size && `svadmin-avatar-size--${size}`,
|
|
4
|
+
shape && `svadmin-avatar-shape--${shape}`,
|
|
5
|
+
className,
|
|
6
|
+
extraClassName,
|
|
7
|
+
].filter(Boolean).join(" ");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import { avatarVariants as resolveAvatarVariants, type AvatarSize as AvatarSizeValue } from "./avatar-variants.js";
|
|
2
|
+
import { avatarVariants as resolveAvatarVariants, type AvatarSize as AvatarSizeValue, type AvatarShape as AvatarShapeValue } from "./avatar-variants.js";
|
|
3
3
|
|
|
4
|
-
export { avatarVariants, type AvatarSize } from "./avatar-variants.js";
|
|
4
|
+
export { avatarVariants, type AvatarSize, type AvatarShape } from "./avatar-variants.js";
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
7
|
<script lang="ts">
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
type Props = WithElementRef<HTMLImgAttributes, HTMLImageElement> & {
|
|
12
12
|
size?: AvatarSizeValue;
|
|
13
|
+
shape?: AvatarShapeValue;
|
|
13
14
|
fallback?: string;
|
|
14
15
|
};
|
|
15
16
|
|
|
@@ -18,6 +19,7 @@
|
|
|
18
19
|
src,
|
|
19
20
|
alt = "",
|
|
20
21
|
size = "default",
|
|
22
|
+
shape = "circle",
|
|
21
23
|
fallback,
|
|
22
24
|
class: className,
|
|
23
25
|
...restProps
|
|
@@ -27,7 +29,7 @@
|
|
|
27
29
|
</script>
|
|
28
30
|
|
|
29
31
|
{#if src && !imgError}
|
|
30
|
-
<span data-size={size} class={cn(resolveAvatarVariants({ size }), className)}>
|
|
32
|
+
<span data-size={size} data-shape={shape} class={cn(resolveAvatarVariants({ size, shape }), className)}>
|
|
31
33
|
<img
|
|
32
34
|
bind:this={ref}
|
|
33
35
|
data-slot="avatar"
|
|
@@ -42,8 +44,9 @@
|
|
|
42
44
|
<span
|
|
43
45
|
data-slot="avatar-fallback"
|
|
44
46
|
data-size={size}
|
|
47
|
+
data-shape={shape}
|
|
45
48
|
class={cn(
|
|
46
|
-
resolveAvatarVariants({ size }),
|
|
49
|
+
resolveAvatarVariants({ size, shape }),
|
|
47
50
|
"svadmin-avatar-fallback",
|
|
48
51
|
className
|
|
49
52
|
)}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { type AvatarSize as AvatarSizeValue } from "./avatar-variants.js";
|
|
2
|
-
export { avatarVariants, type AvatarSize } from "./avatar-variants.js";
|
|
1
|
+
import { type AvatarSize as AvatarSizeValue, type AvatarShape as AvatarShapeValue } from "./avatar-variants.js";
|
|
2
|
+
export { avatarVariants, type AvatarSize, type AvatarShape } from "./avatar-variants.js";
|
|
3
3
|
import { type WithElementRef } from "../../../utils.js";
|
|
4
4
|
import type { HTMLImgAttributes } from "svelte/elements";
|
|
5
5
|
type Props = WithElementRef<HTMLImgAttributes, HTMLImageElement> & {
|
|
6
6
|
size?: AvatarSizeValue;
|
|
7
|
+
shape?: AvatarShapeValue;
|
|
7
8
|
fallback?: string;
|
|
8
9
|
};
|
|
9
10
|
declare const Avatar: import("svelte").Component<Props, {}, "ref">;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
1
|
+
export { default as Root, default as Avatar } from "./avatar.svelte";
|
|
2
|
+
export { avatarVariants, type AvatarSize, type AvatarShape } from "./avatar.svelte";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
1
|
+
export { default as Root, default as Avatar } from "./avatar.svelte";
|
|
2
|
+
export { avatarVariants } from "./avatar.svelte";
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
showCloseButton?: boolean;
|
|
25
25
|
/** 信息展示可点遮罩关闭。录入表单应传 false。 */
|
|
26
26
|
closeOnOverlayClick?: boolean;
|
|
27
|
-
/**
|
|
27
|
+
/** 建议宽度:400 / 520 / 720。不传则保持现有默认宽度。 */
|
|
28
28
|
size?: 'sm' | 'md' | 'lg';
|
|
29
29
|
/** 加载中时正文区保持最小高度,避免标题和按钮跳动。 */
|
|
30
30
|
loading?: boolean;
|
|
@@ -9,7 +9,7 @@ type $$ComponentProps = WithoutChildrenOrChild<DialogPrimitive.ContentProps> & {
|
|
|
9
9
|
showCloseButton?: boolean;
|
|
10
10
|
/** 信息展示可点遮罩关闭。录入表单应传 false。 */
|
|
11
11
|
closeOnOverlayClick?: boolean;
|
|
12
|
-
/**
|
|
12
|
+
/** 建议宽度:400 / 520 / 720。不传则保持现有默认宽度。 */
|
|
13
13
|
size?: 'sm' | 'md' | 'lg';
|
|
14
14
|
/** 加载中时正文区保持最小高度,避免标题和按钮跳动。 */
|
|
15
15
|
loading?: boolean;
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
data-input-state={inputState}
|
|
137
137
|
aria-invalid={ariaInvalid}
|
|
138
138
|
aria-busy={inputState === "loading" ? "true" : undefined}
|
|
139
|
-
class={cn("svadmin-input", hasWrapper && "border-0 shadow-none bg-transparent
|
|
139
|
+
class={cn("svadmin-input", hasWrapper && "border-0 shadow-none bg-transparent px-0 h-full", className)}
|
|
140
140
|
{type}
|
|
141
141
|
lang={isDateInput ? i18n.locale : undefined}
|
|
142
142
|
bind:value
|
|
@@ -176,18 +176,13 @@
|
|
|
176
176
|
</div>
|
|
177
177
|
{:else if hasWrapper}
|
|
178
178
|
<div
|
|
179
|
-
class={cn(
|
|
180
|
-
"svadmin-input-wrapper relative inline-flex items-center w-full rounded-sm border border-border bg-card px-2.5 transition-colors focus-within:ring-2 focus-within:ring-ring focus-within:border-ring",
|
|
181
|
-
size === "compact" || size === "mini" ? "h-7 text-xs" : "h-8 text-sm",
|
|
182
|
-
disabled && "opacity-50 cursor-not-allowed bg-muted",
|
|
183
|
-
className
|
|
184
|
-
)}
|
|
179
|
+
class={cn("svadmin-input-wrapper", className)}
|
|
185
180
|
data-slot="input-wrapper"
|
|
186
181
|
data-size={size}
|
|
187
182
|
data-input-state={inputState}
|
|
188
183
|
>
|
|
189
184
|
{#if prefix}
|
|
190
|
-
<span class="svadmin-input-prefix
|
|
185
|
+
<span class="svadmin-input-prefix" aria-hidden="true">
|
|
191
186
|
{@render prefix()}
|
|
192
187
|
</span>
|
|
193
188
|
{/if}
|
|
@@ -195,15 +190,15 @@
|
|
|
195
190
|
{#if allowClear && filled && !disabled}
|
|
196
191
|
<button
|
|
197
192
|
type="button"
|
|
198
|
-
class="svadmin-input-clear
|
|
193
|
+
class="svadmin-input-clear"
|
|
199
194
|
aria-label="Clear input"
|
|
200
195
|
onclick={clearInput}
|
|
201
196
|
>
|
|
202
|
-
<CircleX size={
|
|
197
|
+
<CircleX size={12} aria-hidden="true" />
|
|
203
198
|
</button>
|
|
204
199
|
{/if}
|
|
205
200
|
{#if suffix}
|
|
206
|
-
<span class="svadmin-input-suffix
|
|
201
|
+
<span class="svadmin-input-suffix" aria-hidden="true">
|
|
207
202
|
{@render suffix()}
|
|
208
203
|
</span>
|
|
209
204
|
{/if}
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
data-input-state={inputState}
|
|
90
90
|
aria-invalid={ariaInvalid}
|
|
91
91
|
aria-busy={inputState === "loading" ? "true" : undefined}
|
|
92
|
-
class={cn(uiTextarea().root, hasWrapper && "w-full border-0 shadow-none bg-transparent
|
|
92
|
+
class={cn(uiTextarea().root, hasWrapper && "w-full border-0 shadow-none bg-transparent resize-y", className)}
|
|
93
93
|
{disabled}
|
|
94
94
|
maxlength={maxLength}
|
|
95
95
|
bind:value
|
|
@@ -102,34 +102,30 @@
|
|
|
102
102
|
|
|
103
103
|
{#if hasWrapper}
|
|
104
104
|
<div
|
|
105
|
-
class={cn(
|
|
106
|
-
"svadmin-textarea-wrapper relative flex flex-col w-full rounded-sm border border-border bg-card p-3 transition-colors focus-within:ring-2 focus-within:ring-ring focus-within:border-ring",
|
|
107
|
-
disabled && "opacity-50 cursor-not-allowed bg-muted",
|
|
108
|
-
className
|
|
109
|
-
)}
|
|
105
|
+
class={cn("svadmin-textarea-wrapper", className)}
|
|
110
106
|
data-slot="textarea-wrapper"
|
|
111
107
|
data-input-state={inputState}
|
|
112
108
|
>
|
|
113
109
|
{@render textareaElement()}
|
|
114
|
-
|
|
115
|
-
<
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
110
|
+
{#if allowClear && filled && !disabled}
|
|
111
|
+
<button
|
|
112
|
+
type="button"
|
|
113
|
+
class="svadmin-textarea-clear"
|
|
114
|
+
aria-label="Clear textarea"
|
|
115
|
+
onclick={clearTextarea}
|
|
116
|
+
>
|
|
117
|
+
<CircleX size={12} aria-hidden="true" />
|
|
118
|
+
</button>
|
|
119
|
+
{/if}
|
|
120
|
+
{#if showWordLimit}
|
|
121
|
+
<span
|
|
122
|
+
class="svadmin-textarea-word-limit"
|
|
123
|
+
data-slot="textarea-word-limit"
|
|
124
|
+
data-limit-state={maxLength !== undefined && charCount >= maxLength ? "error" : undefined}
|
|
125
|
+
>
|
|
126
|
+
{charCount}{maxLength !== undefined ? ` / ${maxLength}` : ""}
|
|
127
|
+
</span>
|
|
128
|
+
{/if}
|
|
133
129
|
</div>
|
|
134
130
|
{:else}
|
|
135
131
|
{@render textareaElement()}
|
package/dist/components.css
CHANGED
|
@@ -467,6 +467,9 @@ h1, h2, h3, h4, h5, h6, [data-slot="card-title"] {
|
|
|
467
467
|
width: 4rem;
|
|
468
468
|
height: 4rem;
|
|
469
469
|
}
|
|
470
|
+
.svadmin-avatar:is([data-shape="square"], .svadmin-avatar-shape--square) {
|
|
471
|
+
border-radius: var(--radius-md);
|
|
472
|
+
}
|
|
470
473
|
[data-slot="avatar"] {
|
|
471
474
|
width: 100%;
|
|
472
475
|
height: 100%;
|
|
@@ -1336,7 +1339,7 @@ main {
|
|
|
1336
1339
|
outline: none;
|
|
1337
1340
|
transition: border-color 120ms ease, box-shadow 120ms ease;
|
|
1338
1341
|
}
|
|
1339
|
-
/* Inline variant keeps the
|
|
1342
|
+
/* Inline variant keeps the chevron and states without forcing full width. */
|
|
1340
1343
|
.svadmin-select--inline {
|
|
1341
1344
|
width: auto;
|
|
1342
1345
|
}
|
package/dist/icon-registry.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Icon registry — resolve icons by name instead of a hardcoded local map.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Upstream libraries resolve icons from a name (`<IconUser />` / `icon="user"`). svadmin keeps
|
|
5
5
|
* `@lucide/svelte` as the default set, but name resolution must be extensible:
|
|
6
6
|
* third-party plugins contribute icons without patching `Sidebar`, and a missing
|
|
7
7
|
* name must fail predictably instead of rendering nothing.
|
package/dist/index.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export { default as Toast } from './components/Toast.svelte';
|
|
|
43
43
|
export { default as NotificationHost } from './components/NotificationHost.svelte';
|
|
44
44
|
export { notification, notification as Notification, getNotifications, closeNotification, closeNotificationByKey, clearNotifications, createNotificationController, provideNotificationController, useNotificationController } from './notifications.svelte.js';
|
|
45
45
|
export type { NotificationOptions, NotificationRecord, NotificationTone, NotificationController } from './notifications.svelte.js';
|
|
46
|
-
export { default as Breadcrumbs } from './components/Breadcrumbs.svelte';
|
|
46
|
+
export { default as Breadcrumbs, type BreadcrumbItem } from './components/Breadcrumbs.svelte';
|
|
47
47
|
export { default as FieldRenderer } from './components/FieldRenderer.svelte';
|
|
48
48
|
export { default as EmptyState } from './components/EmptyState.svelte';
|
|
49
49
|
export { default as StatsCard } from './components/StatsCard.svelte';
|
|
@@ -292,7 +292,7 @@ export { default as ItemList, default as List } from './components/ItemList.svel
|
|
|
292
292
|
export type { ListItem } from './components/ItemList.svelte';
|
|
293
293
|
export { default as Tree } from './components/Tree.svelte';
|
|
294
294
|
export type { TreeNode, TreeCheckInfo, TreeDragInfo } from './components/Tree.svelte';
|
|
295
|
-
export { Avatar } from './components/ui/avatar/index.js';
|
|
295
|
+
export { Avatar, type AvatarShape } from './components/ui/avatar/index.js';
|
|
296
296
|
export { Skeleton } from './components/ui/skeleton/index.js';
|
|
297
297
|
export * as Sheet from './components/ui/sheet/index.js';
|
|
298
298
|
export * as Drawer from './components/ui/sheet/index.js';
|
package/dist/intent-preload.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Intent preload: start a dynamic import on hover, focus, or viewport entry.
|
|
3
3
|
*
|
|
4
|
-
* This is the part of
|
|
4
|
+
* This is the part of the component lazy-load plugin worth keeping. It does
|
|
5
5
|
* not rewrite imports. SSR never calls the loader; the host renders its fallback
|
|
6
6
|
* until the client preloads.
|
|
7
7
|
*/
|
package/dist/intent-preload.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Intent preload: start a dynamic import on hover, focus, or viewport entry.
|
|
3
3
|
*
|
|
4
|
-
* This is the part of
|
|
4
|
+
* This is the part of the component lazy-load plugin worth keeping. It does
|
|
5
5
|
* not rewrite imports. SSR never calls the loader; the host renders its fallback
|
|
6
6
|
* until the client preloads.
|
|
7
7
|
*/
|
|
@@ -26,6 +26,7 @@ export interface NotificationController {
|
|
|
26
26
|
success(title: string, description?: string, options?: Omit<NotificationOptions, 'title' | 'description' | 'tone'>): number;
|
|
27
27
|
warning(title: string, description?: string, options?: Omit<NotificationOptions, 'title' | 'description' | 'tone'>): number;
|
|
28
28
|
danger(title: string, description?: string, options?: Omit<NotificationOptions, 'title' | 'description' | 'tone'>): number;
|
|
29
|
+
error(title: string, description?: string, options?: Omit<NotificationOptions, 'title' | 'description' | 'tone'>): number;
|
|
29
30
|
}
|
|
30
31
|
export declare function createNotificationController(): NotificationController;
|
|
31
32
|
/**
|
|
@@ -49,6 +49,7 @@ export function createNotificationController() {
|
|
|
49
49
|
success: withTone('success'),
|
|
50
50
|
warning: withTone('warning'),
|
|
51
51
|
danger: withTone('danger'),
|
|
52
|
+
error: withTone('danger'),
|
|
52
53
|
};
|
|
53
54
|
}
|
|
54
55
|
const sharedController = createNotificationController();
|
|
@@ -125,4 +126,5 @@ export const notification = {
|
|
|
125
126
|
success: (title, description, options) => activeController().success(title, description, options),
|
|
126
127
|
warning: (title, description, options) => activeController().warning(title, description, options),
|
|
127
128
|
danger: (title, description, options) => activeController().danger(title, description, options),
|
|
129
|
+
error: (title, description, options) => activeController().error(title, description, options),
|
|
128
130
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svadmin/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.135.0",
|
|
4
4
|
"description": "Pre-built admin UI components — AdminApp, AutoTable, AutoForm, Sidebar, Layout",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"@codemirror/lang-json": "^6.0.0",
|
|
89
89
|
"@codemirror/lang-markdown": "^6.0.0",
|
|
90
90
|
"@codemirror/lang-sql": "^6.0.0",
|
|
91
|
-
"@svadmin/core": "^0.84.
|
|
91
|
+
"@svadmin/core": "^0.84.1",
|
|
92
92
|
"@tanstack/svelte-query": "^6.1.48",
|
|
93
93
|
"codemirror": "^6.0.0",
|
|
94
94
|
"dashjs": "^5.3.0",
|
|
@@ -151,7 +151,7 @@
|
|
|
151
151
|
}
|
|
152
152
|
},
|
|
153
153
|
"dependencies": {
|
|
154
|
-
"@svadmin/devtools": "^0.6.
|
|
154
|
+
"@svadmin/devtools": "^0.6.16",
|
|
155
155
|
"@svadmin/devtools-contract": "^0.3.3",
|
|
156
156
|
"@vibeunion/devtools-devframe": "^0.1.2",
|
|
157
157
|
"typebox": "^1.4.6",
|
|
@@ -190,7 +190,7 @@
|
|
|
190
190
|
"@codemirror/lang-markdown": "^6.5.2",
|
|
191
191
|
"@codemirror/lang-sql": "^6.10.0",
|
|
192
192
|
"@happy-dom/global-registrator": "^21.0.4",
|
|
193
|
-
"@svadmin/ai-elements": "^0.15.
|
|
193
|
+
"@svadmin/ai-elements": "^0.15.4",
|
|
194
194
|
"@sveltejs/vite-plugin-svelte": "^7.3.1",
|
|
195
195
|
"@tailwindcss/cli": "4.3.5",
|
|
196
196
|
"@testing-library/dom": "^10.4.2",
|