@svadmin/ui 0.134.0 → 0.136.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 +20 -3
- package/dist/app.theme.css +20 -3
- 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/Calendar.svelte +121 -26
- package/dist/components/Calendar.svelte.d.ts +1 -0
- package/dist/components/Collapse.svelte +28 -0
- package/dist/components/Collapse.svelte.d.ts +2 -0
- package/dist/components/DatePicker.svelte +96 -13
- package/dist/components/DrawerForm.svelte +4 -1
- package/dist/components/DrawerForm.svelte.d.ts +1 -0
- package/dist/components/Image.svelte +84 -28
- package/dist/components/Image.svelte.d.ts +2 -0
- package/dist/components/InputGroup.svelte +7 -3
- package/dist/components/InputGroup.svelte.d.ts +1 -0
- package/dist/components/Menu.svelte +36 -2
- package/dist/components/Menu.svelte.d.ts +2 -0
- package/dist/components/ModalForm.svelte +4 -1
- package/dist/components/ModalForm.svelte.d.ts +1 -0
- package/dist/components/OtpInput.svelte +5 -0
- package/dist/components/OtpInput.svelte.d.ts +1 -0
- package/dist/components/QRCode.svelte +112 -7
- package/dist/components/QRCode.svelte.d.ts +9 -0
- package/dist/components/Steps.svelte +75 -2
- package/dist/components/Steps.svelte.d.ts +2 -0
- package/dist/components/Timeline.svelte +63 -5
- package/dist/components/Timeline.svelte.d.ts +2 -1
- package/dist/components/component-messages.d.ts +20 -0
- package/dist/components/component-messages.js +5 -0
- package/dist/components/content/DescriptionList.svelte +90 -64
- package/dist/components/content/DescriptionList.svelte.d.ts +5 -1
- package/dist/components/ui/alert/alert.svelte +12 -1
- package/dist/components/ui/alert/alert.svelte.d.ts +2 -0
- package/dist/components/ui/alert/index.d.ts +2 -2
- 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/badge/badge.svelte +5 -1
- package/dist/components/ui/badge/badge.svelte.d.ts +1 -0
- package/dist/components/ui/card/card.svelte +35 -1
- package/dist/components/ui/card/card.svelte.d.ts +3 -0
- package/dist/components/ui/skeleton/index.d.ts +1 -2
- package/dist/components/ui/skeleton/index.js +1 -2
- package/dist/components/ui/skeleton/skeleton.svelte +18 -6
- package/dist/components/ui/skeleton/skeleton.svelte.d.ts +4 -0
- package/dist/components/ui/tabs/tabs-context.d.svelte.ts +1 -0
- package/dist/components/ui/tabs/tabs-context.svelte.d.ts +4 -0
- package/dist/components/ui/tabs/tabs-list.svelte +14 -2
- package/dist/components/ui/tabs/tabs.svelte +17 -1
- package/dist/components/ui/tabs/tabs.svelte.d.ts +4 -0
- package/dist/components.css +6 -0
- package/dist/index.d.ts +3 -3
- package/package.json +4 -4
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { alertVariants as resolveAlertVariants, type AlertVariant as AlertVariantValue } from "./alert-variants.js";
|
|
5
5
|
|
|
6
6
|
export { alertVariants, type AlertVariant } from "./alert-variants.js";
|
|
7
|
+
export type AlertType = "info" | "success" | "warning" | "error" | AlertVariantValue;
|
|
7
8
|
</script>
|
|
8
9
|
|
|
9
10
|
<script lang="ts">
|
|
@@ -13,6 +14,7 @@
|
|
|
13
14
|
|
|
14
15
|
type Props = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
15
16
|
variant?: AlertVariantValue;
|
|
17
|
+
type?: AlertType;
|
|
16
18
|
closable?: boolean;
|
|
17
19
|
closeLabel?: string;
|
|
18
20
|
title?: string;
|
|
@@ -26,7 +28,8 @@
|
|
|
26
28
|
|
|
27
29
|
let {
|
|
28
30
|
ref = $bindable(null),
|
|
29
|
-
variant
|
|
31
|
+
variant: variantProp,
|
|
32
|
+
type: typeProp,
|
|
30
33
|
closable = false,
|
|
31
34
|
closeLabel = "Dismiss alert",
|
|
32
35
|
title,
|
|
@@ -40,6 +43,14 @@
|
|
|
40
43
|
...restProps
|
|
41
44
|
}: Props = $props();
|
|
42
45
|
|
|
46
|
+
const variant = $derived.by<AlertVariantValue>(() => {
|
|
47
|
+
if (variantProp) return variantProp;
|
|
48
|
+
if (typeProp === "error") return "destructive";
|
|
49
|
+
if (typeProp === "info") return "default";
|
|
50
|
+
if (typeProp === "success" || typeProp === "warning") return typeProp;
|
|
51
|
+
return (typeProp as AlertVariantValue) ?? "default";
|
|
52
|
+
});
|
|
53
|
+
|
|
43
54
|
const statusIcons = {
|
|
44
55
|
default: Info,
|
|
45
56
|
destructive: CircleAlert,
|
|
@@ -2,9 +2,11 @@ import { type WithElementRef } from "../../../utils.js";
|
|
|
2
2
|
import type { HTMLAttributes } from "svelte/elements";
|
|
3
3
|
import { type AlertVariant as AlertVariantValue } from "./alert-variants.js";
|
|
4
4
|
export { alertVariants, type AlertVariant } from "./alert-variants.js";
|
|
5
|
+
export type AlertType = "info" | "success" | "warning" | "error" | AlertVariantValue;
|
|
5
6
|
import type { Snippet } from "svelte";
|
|
6
7
|
type Props = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
7
8
|
variant?: AlertVariantValue;
|
|
9
|
+
type?: AlertType;
|
|
8
10
|
closable?: boolean;
|
|
9
11
|
closeLabel?: string;
|
|
10
12
|
title?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Alert, { type AlertVariant, alertVariants } from "./alert.svelte";
|
|
1
|
+
import Alert, { type AlertVariant, type AlertType, alertVariants } from "./alert.svelte";
|
|
2
2
|
import AlertTitle from "./alert-title.svelte";
|
|
3
3
|
import AlertDescription from "./alert-description.svelte";
|
|
4
|
-
export { Alert, AlertTitle, AlertDescription, Alert as Root, AlertTitle as Title, AlertDescription as Description, alertVariants, type AlertVariant, };
|
|
4
|
+
export { Alert, AlertTitle, AlertDescription, Alert as Root, AlertTitle as Title, AlertDescription as Description, alertVariants, type AlertVariant, type AlertType, };
|
|
@@ -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";
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
size: sizeProp,
|
|
19
19
|
count,
|
|
20
20
|
overflowCount = 99,
|
|
21
|
+
maxCount,
|
|
21
22
|
dot = false,
|
|
22
23
|
status,
|
|
23
24
|
text,
|
|
@@ -31,6 +32,7 @@
|
|
|
31
32
|
size?: "default" | "compact";
|
|
32
33
|
count?: number | string | undefined;
|
|
33
34
|
overflowCount?: number | undefined;
|
|
35
|
+
maxCount?: number | undefined;
|
|
34
36
|
dot?: boolean | undefined;
|
|
35
37
|
status?: BadgeStatus | undefined;
|
|
36
38
|
text?: string | undefined;
|
|
@@ -44,11 +46,13 @@
|
|
|
44
46
|
|
|
45
47
|
const isStatusMode = $derived(count !== undefined || dot || status !== undefined);
|
|
46
48
|
|
|
49
|
+
const effectiveOverflowCount = $derived(maxCount ?? overflowCount);
|
|
50
|
+
|
|
47
51
|
const displayCount = $derived.by(() => {
|
|
48
52
|
if (count === undefined) return null;
|
|
49
53
|
if (typeof count === 'number') {
|
|
50
54
|
if (count === 0 && !showZero) return null;
|
|
51
|
-
if (count >
|
|
55
|
+
if (count > effectiveOverflowCount) return `${effectiveOverflowCount}+`;
|
|
52
56
|
return String(count);
|
|
53
57
|
}
|
|
54
58
|
return count;
|
|
@@ -8,6 +8,7 @@ type $$ComponentProps = WithElementRef<HTMLAnchorAttributes> & {
|
|
|
8
8
|
size?: "default" | "compact";
|
|
9
9
|
count?: number | string | undefined;
|
|
10
10
|
overflowCount?: number | undefined;
|
|
11
|
+
maxCount?: number | undefined;
|
|
11
12
|
dot?: boolean | undefined;
|
|
12
13
|
status?: BadgeStatus | undefined;
|
|
13
14
|
text?: string | undefined;
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
2
3
|
import type { HTMLAttributes } from "svelte/elements";
|
|
3
4
|
import { cn, type WithElementRef } from "../../../utils.js";
|
|
4
5
|
import { Skeleton } from "../skeleton/index.js";
|
|
6
|
+
import CardHeader from "./card-header.svelte";
|
|
7
|
+
import CardTitle from "./card-title.svelte";
|
|
8
|
+
import CardAction from "./card-action.svelte";
|
|
9
|
+
import CardContent from "./card-content.svelte";
|
|
5
10
|
|
|
6
11
|
type Props = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
7
12
|
size?: "default" | "sm";
|
|
8
13
|
hoverable?: boolean;
|
|
9
14
|
bordered?: boolean;
|
|
10
15
|
loading?: boolean;
|
|
16
|
+
title?: string | Snippet;
|
|
17
|
+
extra?: Snippet;
|
|
11
18
|
};
|
|
12
19
|
|
|
13
20
|
let {
|
|
@@ -18,6 +25,8 @@
|
|
|
18
25
|
hoverable = false,
|
|
19
26
|
bordered = true,
|
|
20
27
|
loading = false,
|
|
28
|
+
title,
|
|
29
|
+
extra,
|
|
21
30
|
...restProps
|
|
22
31
|
}: Props = $props();
|
|
23
32
|
</script>
|
|
@@ -43,6 +52,31 @@
|
|
|
43
52
|
<Skeleton class="h-16 w-full mt-2" />
|
|
44
53
|
</div>
|
|
45
54
|
{:else}
|
|
46
|
-
{
|
|
55
|
+
{#if title || extra}
|
|
56
|
+
<CardHeader class="flex flex-row items-center justify-between pb-2">
|
|
57
|
+
{#if title}
|
|
58
|
+
<CardTitle>
|
|
59
|
+
{#if typeof title === "string"}
|
|
60
|
+
{title}
|
|
61
|
+
{:else}
|
|
62
|
+
<!-- string | Snippet 的联合在模板里无法自动收窄,这里显式断言。 -->
|
|
63
|
+
{@render (title as Snippet)()}
|
|
64
|
+
{/if}
|
|
65
|
+
</CardTitle>
|
|
66
|
+
{/if}
|
|
67
|
+
{#if extra}
|
|
68
|
+
<CardAction>
|
|
69
|
+
{@render extra()}
|
|
70
|
+
</CardAction>
|
|
71
|
+
{/if}
|
|
72
|
+
</CardHeader>
|
|
73
|
+
{/if}
|
|
74
|
+
{#if title || extra}
|
|
75
|
+
<CardContent>
|
|
76
|
+
{@render children?.()}
|
|
77
|
+
</CardContent>
|
|
78
|
+
{:else}
|
|
79
|
+
{@render children?.()}
|
|
80
|
+
{/if}
|
|
47
81
|
{/if}
|
|
48
82
|
</div>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
1
2
|
import type { HTMLAttributes } from "svelte/elements";
|
|
2
3
|
import { type WithElementRef } from "../../../utils.js";
|
|
3
4
|
type Props = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
@@ -5,6 +6,8 @@ type Props = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
|
5
6
|
hoverable?: boolean;
|
|
6
7
|
bordered?: boolean;
|
|
7
8
|
loading?: boolean;
|
|
9
|
+
title?: string | Snippet;
|
|
10
|
+
extra?: Snippet;
|
|
8
11
|
};
|
|
9
12
|
declare const Card: import("svelte").Component<Props, {}, "ref">;
|
|
10
13
|
type Card = ReturnType<typeof Card>;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { Root, Root as Skeleton };
|
|
1
|
+
export { default as Root, default as Skeleton } from "./skeleton.svelte";
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { Root, Root as Skeleton };
|
|
1
|
+
export { default as Root, default as Skeleton } from "./skeleton.svelte";
|
|
@@ -1,21 +1,33 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
2
3
|
import { cn, type WithElementRef } from "../../../utils.js";
|
|
3
4
|
import type { HTMLAttributes } from "svelte/elements";
|
|
4
5
|
|
|
5
6
|
type Props = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
6
7
|
class?: string;
|
|
8
|
+
loading?: boolean;
|
|
9
|
+
animation?: boolean;
|
|
10
|
+
children?: Snippet;
|
|
7
11
|
};
|
|
8
12
|
|
|
9
13
|
let {
|
|
10
14
|
ref = $bindable(null),
|
|
11
15
|
class: className,
|
|
16
|
+
loading = true,
|
|
17
|
+
animation = true,
|
|
18
|
+
children,
|
|
12
19
|
...restProps
|
|
13
20
|
}: Props = $props();
|
|
14
21
|
</script>
|
|
15
22
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
{#if !loading && children}
|
|
24
|
+
{@render children()}
|
|
25
|
+
{:else}
|
|
26
|
+
<div
|
|
27
|
+
bind:this={ref}
|
|
28
|
+
data-slot="skeleton"
|
|
29
|
+
data-animation={animation}
|
|
30
|
+
class={cn("svadmin-skeleton", !animation && "animate-none", className)}
|
|
31
|
+
{...restProps}
|
|
32
|
+
></div>
|
|
33
|
+
{/if}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
1
2
|
import { type WithElementRef } from "../../../utils.js";
|
|
2
3
|
import type { HTMLAttributes } from "svelte/elements";
|
|
3
4
|
type Props = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
4
5
|
class?: string;
|
|
6
|
+
loading?: boolean;
|
|
7
|
+
animation?: boolean;
|
|
8
|
+
children?: Snippet;
|
|
5
9
|
};
|
|
6
10
|
declare const Skeleton: import("svelte").Component<Props, {}, "ref">;
|
|
7
11
|
type Skeleton = ReturnType<typeof Skeleton>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './tabs-context.svelte.js';
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
export type TabsVariant = "default" | "line" | "card";
|
|
2
|
+
export type TabsOrientation = "horizontal" | "vertical";
|
|
1
3
|
export interface TabsContextValue {
|
|
2
4
|
readonly value: string;
|
|
5
|
+
readonly variant?: TabsVariant | undefined;
|
|
6
|
+
readonly orientation?: TabsOrientation | undefined;
|
|
3
7
|
select: (value: string) => void;
|
|
4
8
|
}
|
|
5
9
|
export declare const getTabsContext: () => TabsContextValue, setTabsContext: (context: TabsContextValue) => TabsContextValue;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { cn, type WithElementRef } from "../../../utils.js";
|
|
3
3
|
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
+
import { getTabsContext } from "./tabs-context.svelte.js";
|
|
4
5
|
|
|
5
6
|
type Props = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
6
7
|
variant?: "default" | "line" | "card";
|
|
@@ -10,13 +11,24 @@
|
|
|
10
11
|
|
|
11
12
|
let {
|
|
12
13
|
ref = $bindable(null),
|
|
13
|
-
variant
|
|
14
|
-
orientation
|
|
14
|
+
variant: variantProp,
|
|
15
|
+
orientation: orientationProp,
|
|
15
16
|
scrollable = false,
|
|
16
17
|
class: className,
|
|
17
18
|
children,
|
|
18
19
|
...restProps
|
|
19
20
|
}: Props = $props();
|
|
21
|
+
|
|
22
|
+
let tabs = $derived.by(() => {
|
|
23
|
+
try {
|
|
24
|
+
return getTabsContext();
|
|
25
|
+
} catch {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const variant = $derived(variantProp ?? tabs?.variant ?? "default");
|
|
31
|
+
const orientation = $derived(orientationProp ?? tabs?.orientation ?? "horizontal");
|
|
20
32
|
</script>
|
|
21
33
|
|
|
22
34
|
<div
|
|
@@ -1,26 +1,40 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { cn, type WithElementRef } from "../../../utils.js";
|
|
3
3
|
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
-
import { setTabsContext } from "./tabs-context.svelte.js";
|
|
4
|
+
import { setTabsContext, type TabsVariant, type TabsOrientation } from "./tabs-context.svelte.js";
|
|
5
5
|
|
|
6
6
|
type Props = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
7
7
|
value?: string;
|
|
8
|
+
type?: TabsVariant;
|
|
9
|
+
variant?: TabsVariant;
|
|
10
|
+
orientation?: TabsOrientation;
|
|
8
11
|
onValueChange?: (value: string) => void;
|
|
9
12
|
};
|
|
10
13
|
|
|
11
14
|
let {
|
|
12
15
|
ref = $bindable(null),
|
|
13
16
|
value = $bindable(""),
|
|
17
|
+
type,
|
|
18
|
+
variant: variantProp,
|
|
19
|
+
orientation = "horizontal",
|
|
14
20
|
onValueChange,
|
|
15
21
|
class: className,
|
|
16
22
|
children,
|
|
17
23
|
...restProps
|
|
18
24
|
}: Props = $props();
|
|
19
25
|
|
|
26
|
+
const resolvedVariant = $derived(type ?? variantProp ?? "default");
|
|
27
|
+
|
|
20
28
|
setTabsContext({
|
|
21
29
|
get value() {
|
|
22
30
|
return value;
|
|
23
31
|
},
|
|
32
|
+
get variant() {
|
|
33
|
+
return resolvedVariant;
|
|
34
|
+
},
|
|
35
|
+
get orientation() {
|
|
36
|
+
return orientation;
|
|
37
|
+
},
|
|
24
38
|
select(nextValue) {
|
|
25
39
|
if (nextValue === value) return;
|
|
26
40
|
value = nextValue;
|
|
@@ -32,6 +46,8 @@
|
|
|
32
46
|
<div
|
|
33
47
|
bind:this={ref}
|
|
34
48
|
data-slot="tabs"
|
|
49
|
+
data-variant={resolvedVariant}
|
|
50
|
+
data-orientation={orientation}
|
|
35
51
|
class={cn("svadmin-tabs", className)}
|
|
36
52
|
{...restProps}
|
|
37
53
|
>
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { type WithElementRef } from "../../../utils.js";
|
|
2
2
|
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
import { type TabsVariant, type TabsOrientation } from "./tabs-context.svelte.js";
|
|
3
4
|
type Props = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
4
5
|
value?: string;
|
|
6
|
+
type?: TabsVariant;
|
|
7
|
+
variant?: TabsVariant;
|
|
8
|
+
orientation?: TabsOrientation;
|
|
5
9
|
onValueChange?: (value: string) => void;
|
|
6
10
|
};
|
|
7
11
|
declare const Tabs: import("svelte").Component<Props, {}, "value" | "ref">;
|
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%;
|
|
@@ -1095,6 +1098,9 @@ main {
|
|
|
1095
1098
|
background: var(--muted);
|
|
1096
1099
|
animation: svadmin-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
|
|
1097
1100
|
}
|
|
1101
|
+
.svadmin-skeleton[data-animation="false"] {
|
|
1102
|
+
animation: none;
|
|
1103
|
+
}
|
|
1098
1104
|
@keyframes svadmin-pulse {
|
|
1099
1105
|
50% {
|
|
1100
1106
|
opacity: 0.5;
|
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';
|
|
@@ -473,7 +473,7 @@ export { default as Calendar } from './components/Calendar.svelte';
|
|
|
473
473
|
export type { CalendarEvent } from './components/Calendar.svelte';
|
|
474
474
|
export { default as Carousel } from './components/Carousel.svelte';
|
|
475
475
|
export { default as ImagePreview } from './components/ImagePreview.svelte';
|
|
476
|
-
export { default as QRCode } from './components/QRCode.svelte';
|
|
476
|
+
export { default as QRCode, type QRCodeStatus } from './components/QRCode.svelte';
|
|
477
477
|
export type { PreviewImage } from './components/ImagePreview.svelte';
|
|
478
478
|
export { default as Anchor } from './components/Anchor.svelte';
|
|
479
479
|
export type { AnchorItem } from './components/Anchor.svelte';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svadmin/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.136.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.2",
|
|
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.17",
|
|
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.5",
|
|
194
194
|
"@sveltejs/vite-plugin-svelte": "^7.3.1",
|
|
195
195
|
"@tailwindcss/cli": "4.3.5",
|
|
196
196
|
"@testing-library/dom": "^10.4.2",
|