@svadmin/ui 0.116.0 → 0.117.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 +167 -26
- package/dist/app.theme.css +167 -26
- package/dist/components/AboutSettings.svelte +1 -1
- package/dist/components/CopyableText.svelte +90 -0
- package/dist/components/CopyableText.svelte.d.ts +13 -0
- package/dist/components/Divider.svelte +89 -0
- package/dist/components/Divider.svelte.d.ts +19 -0
- package/dist/components/EllipsisText.svelte +78 -0
- package/dist/components/EllipsisText.svelte.d.ts +15 -0
- package/dist/components/FullscreenButton.svelte +88 -0
- package/dist/components/FullscreenButton.svelte.d.ts +10 -0
- package/dist/components/GlobalShortcuts.svelte +229 -0
- package/dist/components/GlobalShortcuts.svelte.d.ts +18 -0
- package/dist/components/Header.svelte +17 -1
- package/dist/components/Header.svelte.d.ts +3 -0
- package/dist/components/Layout.svelte +3 -0
- package/dist/components/Layout.svelte.d.ts +1 -0
- package/dist/components/LightFilter.svelte +281 -0
- package/dist/components/LightFilter.svelte.d.ts +36 -0
- package/dist/components/LockScreen.svelte +295 -0
- package/dist/components/LockScreen.svelte.d.ts +21 -0
- package/dist/components/PricingCard.svelte +12 -12
- package/dist/components/PricingCard.svelte.d.ts +12 -12
- package/dist/components/PricingTable.svelte +185 -0
- package/dist/components/PricingTable.svelte.d.ts +40 -0
- package/dist/components/ProCard.svelte +267 -0
- package/dist/components/ProCard.svelte.d.ts +56 -0
- package/dist/components/QuotaProgressBar.svelte +8 -8
- package/dist/components/QuotaProgressBar.svelte.d.ts +8 -8
- package/dist/components/TypographyEllipsis.svelte +12 -9
- package/dist/components/TypographyEllipsis.svelte.d.ts +9 -8
- package/dist/components/TypographyText.svelte +41 -3
- package/dist/components/TypographyText.svelte.d.ts +10 -2
- package/dist/components/UsageCard.svelte +97 -0
- package/dist/components/UsageCard.svelte.d.ts +26 -0
- package/dist/components/ui/badge/badge.svelte +156 -12
- package/dist/components/ui/badge/badge.svelte.d.ts +9 -0
- package/dist/components/ui/badge/index.d.ts +1 -1
- package/dist/index.d.ts +24 -3
- package/dist/index.js +15 -2
- package/package.json +5 -5
|
@@ -8,16 +8,17 @@
|
|
|
8
8
|
|
|
9
9
|
interface Props {
|
|
10
10
|
/** 折叠时保留的行数,对齐参考排版的 ellipsis.rows。 */
|
|
11
|
-
rows?: number;
|
|
11
|
+
rows?: number | undefined;
|
|
12
12
|
/** 内容超出时显示“展开 / 收起”,对齐参考排版的 ellipsis.expandable。 */
|
|
13
|
-
expandable?: boolean;
|
|
14
|
-
expanded?: boolean;
|
|
15
|
-
expandText?: string;
|
|
16
|
-
collapseText?: string;
|
|
13
|
+
expandable?: boolean | undefined;
|
|
14
|
+
expanded?: boolean | undefined;
|
|
15
|
+
expandText?: string | undefined;
|
|
16
|
+
collapseText?: string | undefined;
|
|
17
|
+
tooltip?: string | undefined;
|
|
17
18
|
/** 展开按钮的附加说明,例如“展开全部 12 条”。 */
|
|
18
|
-
expandLabel?: string;
|
|
19
|
-
class?: string;
|
|
20
|
-
onExpand?: (expanded: boolean) => void;
|
|
19
|
+
expandLabel?: string | undefined;
|
|
20
|
+
class?: string | undefined;
|
|
21
|
+
onExpand?: ((expanded: boolean) => void) | undefined;
|
|
21
22
|
children: Snippet;
|
|
22
23
|
}
|
|
23
24
|
|
|
@@ -27,6 +28,7 @@
|
|
|
27
28
|
expanded = $bindable(false),
|
|
28
29
|
expandText,
|
|
29
30
|
collapseText,
|
|
31
|
+
tooltip,
|
|
30
32
|
expandLabel,
|
|
31
33
|
class: className = '',
|
|
32
34
|
onExpand,
|
|
@@ -73,6 +75,7 @@
|
|
|
73
75
|
bind:this={contentEl}
|
|
74
76
|
class="svadmin-typography-ellipsis__content"
|
|
75
77
|
class:is-clamped={!expanded}
|
|
78
|
+
title={tooltip}
|
|
76
79
|
>
|
|
77
80
|
{@render children()}
|
|
78
81
|
</div>
|
|
@@ -120,4 +123,4 @@
|
|
|
120
123
|
outline-offset: var(--svadmin-focus-offset);
|
|
121
124
|
border-radius: var(--radius-sm);
|
|
122
125
|
}
|
|
123
|
-
</style>
|
|
126
|
+
</style>
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
interface Props {
|
|
3
3
|
/** 折叠时保留的行数,对齐参考排版的 ellipsis.rows。 */
|
|
4
|
-
rows?: number;
|
|
4
|
+
rows?: number | undefined;
|
|
5
5
|
/** 内容超出时显示“展开 / 收起”,对齐参考排版的 ellipsis.expandable。 */
|
|
6
|
-
expandable?: boolean;
|
|
7
|
-
expanded?: boolean;
|
|
8
|
-
expandText?: string;
|
|
9
|
-
collapseText?: string;
|
|
6
|
+
expandable?: boolean | undefined;
|
|
7
|
+
expanded?: boolean | undefined;
|
|
8
|
+
expandText?: string | undefined;
|
|
9
|
+
collapseText?: string | undefined;
|
|
10
|
+
tooltip?: string | undefined;
|
|
10
11
|
/** 展开按钮的附加说明,例如“展开全部 12 条”。 */
|
|
11
|
-
expandLabel?: string;
|
|
12
|
-
class?: string;
|
|
13
|
-
onExpand?: (expanded: boolean) => void;
|
|
12
|
+
expandLabel?: string | undefined;
|
|
13
|
+
class?: string | undefined;
|
|
14
|
+
onExpand?: ((expanded: boolean) => void) | undefined;
|
|
14
15
|
children: Snippet;
|
|
15
16
|
}
|
|
16
17
|
declare const TypographyEllipsis: import("svelte").Component<Props, {}, "expanded">;
|
|
@@ -2,11 +2,20 @@
|
|
|
2
2
|
import { tick, type Snippet } from 'svelte';
|
|
3
3
|
import { Check, Pencil, X } from '@lucide/svelte';
|
|
4
4
|
import CopyButton from './CopyButton.svelte';
|
|
5
|
+
import TypographyEllipsis from './TypographyEllipsis.svelte';
|
|
5
6
|
import { cn } from '../utils.js';
|
|
6
7
|
|
|
7
8
|
export type TypographyType = 'default' | 'secondary' | 'success' | 'warning' | 'danger';
|
|
8
9
|
|
|
9
|
-
interface
|
|
10
|
+
export interface TypographyEllipsisConfig {
|
|
11
|
+
rows?: number;
|
|
12
|
+
expandable?: boolean;
|
|
13
|
+
expandText?: string;
|
|
14
|
+
collapseText?: string;
|
|
15
|
+
tooltip?: boolean | string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface TypographyTextProps {
|
|
10
19
|
text?: string;
|
|
11
20
|
type?: TypographyType;
|
|
12
21
|
strong?: boolean;
|
|
@@ -18,6 +27,7 @@
|
|
|
18
27
|
copyable?: boolean;
|
|
19
28
|
copyLabel?: string;
|
|
20
29
|
copyDescription?: string;
|
|
30
|
+
ellipsis?: boolean | TypographyEllipsisConfig;
|
|
21
31
|
editable?: boolean;
|
|
22
32
|
editing?: boolean;
|
|
23
33
|
multiline?: boolean;
|
|
@@ -42,6 +52,7 @@
|
|
|
42
52
|
copyable = false,
|
|
43
53
|
copyLabel,
|
|
44
54
|
copyDescription,
|
|
55
|
+
ellipsis = false,
|
|
45
56
|
editable = false,
|
|
46
57
|
editing = $bindable(false),
|
|
47
58
|
multiline = false,
|
|
@@ -52,7 +63,18 @@
|
|
|
52
63
|
children,
|
|
53
64
|
onchange,
|
|
54
65
|
oncopied,
|
|
55
|
-
}:
|
|
66
|
+
}: TypographyTextProps = $props();
|
|
67
|
+
|
|
68
|
+
const isSingleEllipsis = $derived(ellipsis === true || (typeof ellipsis === 'object' && (!ellipsis.rows || ellipsis.rows === 1)));
|
|
69
|
+
const multiEllipsis = $derived(typeof ellipsis === 'object' && typeof ellipsis.rows === 'number' && ellipsis.rows > 1 ? ellipsis : null);
|
|
70
|
+
const ellipsisTooltip = $derived.by(() => {
|
|
71
|
+
if (!ellipsis) return undefined;
|
|
72
|
+
if (typeof ellipsis === 'object' && ellipsis.tooltip) {
|
|
73
|
+
return typeof ellipsis.tooltip === 'string' ? ellipsis.tooltip : text;
|
|
74
|
+
}
|
|
75
|
+
if (ellipsis === true) return text || undefined;
|
|
76
|
+
return undefined;
|
|
77
|
+
});
|
|
56
78
|
|
|
57
79
|
let draft = $state(text);
|
|
58
80
|
let input = $state<HTMLInputElement | HTMLTextAreaElement | null>(null);
|
|
@@ -117,7 +139,23 @@
|
|
|
117
139
|
</button>
|
|
118
140
|
</span>
|
|
119
141
|
{:else}
|
|
120
|
-
|
|
142
|
+
{#if multiEllipsis}
|
|
143
|
+
<TypographyEllipsis
|
|
144
|
+
rows={multiEllipsis.rows ?? 1}
|
|
145
|
+
expandable={multiEllipsis.expandable ?? false}
|
|
146
|
+
expandText={multiEllipsis.expandText}
|
|
147
|
+
collapseText={multiEllipsis.collapseText}
|
|
148
|
+
tooltip={ellipsisTooltip}
|
|
149
|
+
>
|
|
150
|
+
{#if children}{@render children()}{:else}{text}{/if}
|
|
151
|
+
</TypographyEllipsis>
|
|
152
|
+
{:else}
|
|
153
|
+
<span
|
|
154
|
+
class="svadmin-typography-text__content"
|
|
155
|
+
class:truncate={isSingleEllipsis && ellipsis !== false}
|
|
156
|
+
title={ellipsisTooltip}
|
|
157
|
+
>{#if children}{@render children()}{:else}{text}{/if}</span>
|
|
158
|
+
{/if}
|
|
121
159
|
{#if copyable}
|
|
122
160
|
<CopyButton value={text} description={copyDescription} label={copyLabel} oncopy={oncopied} class="svadmin-typography-text__action" />
|
|
123
161
|
{/if}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { type Snippet } from 'svelte';
|
|
2
2
|
export type TypographyType = 'default' | 'secondary' | 'success' | 'warning' | 'danger';
|
|
3
|
-
interface
|
|
3
|
+
export interface TypographyEllipsisConfig {
|
|
4
|
+
rows?: number;
|
|
5
|
+
expandable?: boolean;
|
|
6
|
+
expandText?: string;
|
|
7
|
+
collapseText?: string;
|
|
8
|
+
tooltip?: boolean | string;
|
|
9
|
+
}
|
|
10
|
+
export interface TypographyTextProps {
|
|
4
11
|
text?: string;
|
|
5
12
|
type?: TypographyType;
|
|
6
13
|
strong?: boolean;
|
|
@@ -12,6 +19,7 @@ interface Props {
|
|
|
12
19
|
copyable?: boolean;
|
|
13
20
|
copyLabel?: string;
|
|
14
21
|
copyDescription?: string;
|
|
22
|
+
ellipsis?: boolean | TypographyEllipsisConfig;
|
|
15
23
|
editable?: boolean;
|
|
16
24
|
editing?: boolean;
|
|
17
25
|
multiline?: boolean;
|
|
@@ -23,6 +31,6 @@ interface Props {
|
|
|
23
31
|
onchange?: (text: string) => void;
|
|
24
32
|
oncopied?: (text: string) => void;
|
|
25
33
|
}
|
|
26
|
-
declare const TypographyText: import("svelte").Component<
|
|
34
|
+
declare const TypographyText: import("svelte").Component<TypographyTextProps, {}, "text" | "editing">;
|
|
27
35
|
type TypographyText = ReturnType<typeof TypographyText>;
|
|
28
36
|
export default TypographyText;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import { cn } from '../utils.js';
|
|
4
|
+
import QuotaProgressBar, { type QuotaProgressBarProps } from './QuotaProgressBar.svelte';
|
|
5
|
+
import IconBilling from './icons/IconBilling.svelte';
|
|
6
|
+
|
|
7
|
+
export interface UsageMetric extends Omit<QuotaProgressBarProps, 'class'> {
|
|
8
|
+
key: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface UsageCardProps {
|
|
12
|
+
/** Card title, e.g. 'Plan & Usage' */
|
|
13
|
+
title?: string;
|
|
14
|
+
/** Current plan tier name, e.g. 'Pro Plan' */
|
|
15
|
+
tier?: string;
|
|
16
|
+
/** Next billing or renewal date string */
|
|
17
|
+
renewalDate?: string;
|
|
18
|
+
/** Metrics to track */
|
|
19
|
+
metrics?: UsageMetric[];
|
|
20
|
+
/** Upgrade button text */
|
|
21
|
+
upgradeText?: string;
|
|
22
|
+
/** Callback on upgrade button click */
|
|
23
|
+
onupgrade?: () => void;
|
|
24
|
+
/** Custom extra action in header */
|
|
25
|
+
extra?: Snippet;
|
|
26
|
+
/** Additional CSS classes */
|
|
27
|
+
class?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
let {
|
|
31
|
+
title = 'Plan Usage & Quotas',
|
|
32
|
+
tier = 'Pro Plan',
|
|
33
|
+
renewalDate,
|
|
34
|
+
metrics = [],
|
|
35
|
+
upgradeText = 'Upgrade Plan',
|
|
36
|
+
onupgrade,
|
|
37
|
+
extra,
|
|
38
|
+
class: className = '',
|
|
39
|
+
}: UsageCardProps = $props();
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<div
|
|
43
|
+
class={cn('rounded-xl border border-border bg-card p-6 text-card-foreground shadow-sm', className)}
|
|
44
|
+
data-svadmin-component="UsageCard"
|
|
45
|
+
>
|
|
46
|
+
<div class="flex items-start justify-between gap-4 border-b border-border/60 pb-5">
|
|
47
|
+
<div class="flex items-center gap-3">
|
|
48
|
+
<div class="flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary">
|
|
49
|
+
<IconBilling class="h-5 w-5" />
|
|
50
|
+
</div>
|
|
51
|
+
<div>
|
|
52
|
+
<div class="flex items-center gap-2">
|
|
53
|
+
<h3 class="text-base font-bold tracking-tight text-foreground">{title}</h3>
|
|
54
|
+
{#if tier}
|
|
55
|
+
<span class="rounded-full bg-primary/10 px-2.5 py-0.5 text-xs font-semibold text-primary">
|
|
56
|
+
{tier}
|
|
57
|
+
</span>
|
|
58
|
+
{/if}
|
|
59
|
+
</div>
|
|
60
|
+
{#if renewalDate}
|
|
61
|
+
<p class="mt-0.5 text-xs text-muted-foreground">Renews on {renewalDate}</p>
|
|
62
|
+
{/if}
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
<div class="flex items-center gap-2">
|
|
67
|
+
{#if extra}
|
|
68
|
+
{@render extra()}
|
|
69
|
+
{:else if onupgrade}
|
|
70
|
+
<button
|
|
71
|
+
type="button"
|
|
72
|
+
onclick={() => onupgrade()}
|
|
73
|
+
class="rounded-md bg-primary px-3.5 py-1.5 text-xs font-semibold text-primary-foreground transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
74
|
+
>
|
|
75
|
+
{upgradeText}
|
|
76
|
+
</button>
|
|
77
|
+
{/if}
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
|
|
81
|
+
{#if metrics.length > 0}
|
|
82
|
+
<div class="mt-5 space-y-4">
|
|
83
|
+
{#each metrics as metric (metric.key)}
|
|
84
|
+
<QuotaProgressBar
|
|
85
|
+
label={metric.label}
|
|
86
|
+
used={metric.used}
|
|
87
|
+
total={metric.total}
|
|
88
|
+
unit={metric.unit}
|
|
89
|
+
warningThreshold={metric.warningThreshold}
|
|
90
|
+
criticalThreshold={metric.criticalThreshold}
|
|
91
|
+
showPercent={metric.showPercent}
|
|
92
|
+
compact={metric.compact ?? false}
|
|
93
|
+
/>
|
|
94
|
+
{/each}
|
|
95
|
+
</div>
|
|
96
|
+
{/if}
|
|
97
|
+
</div>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import { type QuotaProgressBarProps } from './QuotaProgressBar.svelte';
|
|
3
|
+
export interface UsageMetric extends Omit<QuotaProgressBarProps, 'class'> {
|
|
4
|
+
key: string;
|
|
5
|
+
}
|
|
6
|
+
export interface UsageCardProps {
|
|
7
|
+
/** Card title, e.g. 'Plan & Usage' */
|
|
8
|
+
title?: string;
|
|
9
|
+
/** Current plan tier name, e.g. 'Pro Plan' */
|
|
10
|
+
tier?: string;
|
|
11
|
+
/** Next billing or renewal date string */
|
|
12
|
+
renewalDate?: string;
|
|
13
|
+
/** Metrics to track */
|
|
14
|
+
metrics?: UsageMetric[];
|
|
15
|
+
/** Upgrade button text */
|
|
16
|
+
upgradeText?: string;
|
|
17
|
+
/** Callback on upgrade button click */
|
|
18
|
+
onupgrade?: () => void;
|
|
19
|
+
/** Custom extra action in header */
|
|
20
|
+
extra?: Snippet;
|
|
21
|
+
/** Additional CSS classes */
|
|
22
|
+
class?: string;
|
|
23
|
+
}
|
|
24
|
+
declare const UsageCard: import("svelte").Component<UsageCardProps, {}, "">;
|
|
25
|
+
type UsageCard = ReturnType<typeof UsageCard>;
|
|
26
|
+
export default UsageCard;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { badgeVariants as resolveBadgeVariants, type BadgeVariant as BadgeVariantValue } from "./badge-variants.js";
|
|
3
3
|
|
|
4
4
|
export { badgeVariants, type BadgeVariant } from "./badge-variants.js";
|
|
5
|
+
export type BadgeStatus = 'success' | 'processing' | 'default' | 'error' | 'warning';
|
|
5
6
|
</script>
|
|
6
7
|
|
|
7
8
|
<script lang="ts">
|
|
@@ -15,26 +16,169 @@
|
|
|
15
16
|
class: className,
|
|
16
17
|
variant = "default",
|
|
17
18
|
size: sizeProp,
|
|
19
|
+
count,
|
|
20
|
+
overflowCount = 99,
|
|
21
|
+
dot = false,
|
|
22
|
+
status,
|
|
23
|
+
text,
|
|
24
|
+
offset,
|
|
25
|
+
showZero = false,
|
|
26
|
+
color,
|
|
18
27
|
children,
|
|
19
28
|
...restProps
|
|
20
29
|
}: WithElementRef<HTMLAnchorAttributes> & {
|
|
21
30
|
variant?: BadgeVariantValue;
|
|
22
31
|
size?: "default" | "compact";
|
|
32
|
+
count?: number | string | undefined;
|
|
33
|
+
overflowCount?: number | undefined;
|
|
34
|
+
dot?: boolean | undefined;
|
|
35
|
+
status?: BadgeStatus | undefined;
|
|
36
|
+
text?: string | undefined;
|
|
37
|
+
offset?: [number, number] | undefined;
|
|
38
|
+
showZero?: boolean | undefined;
|
|
39
|
+
color?: string | undefined;
|
|
23
40
|
} = $props();
|
|
24
41
|
|
|
25
42
|
const config = useComponentConfig();
|
|
26
43
|
const size = $derived(sizeProp ?? (config.density === "compact" || config.componentSize === "sm" ? "compact" : "default"));
|
|
44
|
+
|
|
45
|
+
const isArcoMode = $derived(count !== undefined || dot || status !== undefined);
|
|
46
|
+
|
|
47
|
+
const displayCount = $derived.by(() => {
|
|
48
|
+
if (count === undefined) return null;
|
|
49
|
+
if (typeof count === 'number') {
|
|
50
|
+
if (count === 0 && !showZero) return null;
|
|
51
|
+
if (count > overflowCount) return `${overflowCount}+`;
|
|
52
|
+
return String(count);
|
|
53
|
+
}
|
|
54
|
+
return count;
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const hasBadge = $derived(dot || displayCount !== null);
|
|
58
|
+
|
|
59
|
+
const offsetStyle = $derived.by(() => {
|
|
60
|
+
if (!offset) return '';
|
|
61
|
+
const [x, y] = offset;
|
|
62
|
+
return `transform: translate(calc(50% + ${x}px), calc(-50% + ${y}px));`;
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const statusColorClass = $derived.by(() => {
|
|
66
|
+
if (color) return '';
|
|
67
|
+
switch (status) {
|
|
68
|
+
case 'success':
|
|
69
|
+
return 'bg-success';
|
|
70
|
+
case 'processing':
|
|
71
|
+
return 'bg-primary';
|
|
72
|
+
case 'warning':
|
|
73
|
+
return 'bg-warning';
|
|
74
|
+
case 'error':
|
|
75
|
+
return 'bg-destructive';
|
|
76
|
+
case 'default':
|
|
77
|
+
default:
|
|
78
|
+
return 'bg-muted-foreground';
|
|
79
|
+
}
|
|
80
|
+
});
|
|
27
81
|
</script>
|
|
28
82
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
83
|
+
{#if status !== undefined && !children}
|
|
84
|
+
<!-- 独立状态徽标 (Status Badge) -->
|
|
85
|
+
<svelte:element
|
|
86
|
+
this={href ? "a" : "span"}
|
|
87
|
+
bind:this={ref}
|
|
88
|
+
data-svadmin-component="badge"
|
|
89
|
+
data-slot="badge-status"
|
|
90
|
+
data-status={status}
|
|
91
|
+
{href}
|
|
92
|
+
class={cn('inline-flex items-center gap-2 text-sm text-foreground', className)}
|
|
93
|
+
{...restProps}
|
|
94
|
+
>
|
|
95
|
+
<span class="relative flex h-2 w-2">
|
|
96
|
+
{#if status === 'processing'}
|
|
97
|
+
<span class={cn('absolute inline-flex h-full w-full animate-ping rounded-full opacity-75', statusColorClass)} style={color ? `background-color: ${color}` : undefined}></span>
|
|
98
|
+
{/if}
|
|
99
|
+
<span class={cn('relative inline-flex h-2 w-2 rounded-full', statusColorClass)} style={color ? `background-color: ${color}` : undefined}></span>
|
|
100
|
+
</span>
|
|
101
|
+
{#if text}
|
|
102
|
+
<span class="svadmin-badge-status-text select-none text-xs">{text}</span>
|
|
103
|
+
{/if}
|
|
104
|
+
</svelte:element>
|
|
105
|
+
{:else if isArcoMode && children}
|
|
106
|
+
<!-- 包裹宿主元素右上角角标 (Wrapped Badge) -->
|
|
107
|
+
<svelte:element
|
|
108
|
+
this={href ? "a" : "span"}
|
|
109
|
+
bind:this={ref}
|
|
110
|
+
data-svadmin-component="badge"
|
|
111
|
+
data-slot="badge-wrapper"
|
|
112
|
+
{href}
|
|
113
|
+
class={cn('relative inline-flex shrink-0 align-middle', className)}
|
|
114
|
+
{...restProps}
|
|
115
|
+
>
|
|
116
|
+
{@render children()}
|
|
117
|
+
{#if hasBadge}
|
|
118
|
+
{#if dot}
|
|
119
|
+
<span
|
|
120
|
+
data-slot="badge-dot"
|
|
121
|
+
class={cn(
|
|
122
|
+
'absolute top-0 right-0 z-10 h-2 w-2 rounded-full ring-2 ring-background transform translate-x-1/2 -translate-y-1/2',
|
|
123
|
+
status ? statusColorClass : 'bg-destructive',
|
|
124
|
+
)}
|
|
125
|
+
style={`${offsetStyle}${color ? ` background-color: ${color};` : ''}`}
|
|
126
|
+
></span>
|
|
127
|
+
{:else if displayCount !== null}
|
|
128
|
+
<span
|
|
129
|
+
data-slot="badge-count"
|
|
130
|
+
class={cn(
|
|
131
|
+
'absolute top-0 right-0 z-10 flex min-w-4.5 h-4.5 items-center justify-center rounded-full px-1.5 text-[11px] font-semibold leading-none shadow-xs ring-2 ring-background transform translate-x-1/2 -translate-y-1/2 whitespace-nowrap',
|
|
132
|
+
status ? cn(statusColorClass, 'text-primary-foreground') : 'bg-destructive text-destructive-foreground',
|
|
133
|
+
)}
|
|
134
|
+
style={`${offsetStyle}${color ? ` background-color: ${color};` : ''}`}
|
|
135
|
+
>
|
|
136
|
+
{displayCount}
|
|
137
|
+
</span>
|
|
138
|
+
{/if}
|
|
139
|
+
{/if}
|
|
140
|
+
</svelte:element>
|
|
141
|
+
{:else if isArcoMode && !children && hasBadge}
|
|
142
|
+
<!-- 独立数字角标或小红点 (Standalone Badge) -->
|
|
143
|
+
<svelte:element
|
|
144
|
+
this={href ? "a" : "span"}
|
|
145
|
+
bind:this={ref}
|
|
146
|
+
data-svadmin-component="badge"
|
|
147
|
+
data-slot="badge-standalone"
|
|
148
|
+
{href}
|
|
149
|
+
class={cn('inline-flex items-center align-middle', className)}
|
|
150
|
+
{...restProps}
|
|
151
|
+
>
|
|
152
|
+
{#if dot}
|
|
153
|
+
<span
|
|
154
|
+
class={cn('h-2 w-2 rounded-full', status ? statusColorClass : 'bg-destructive')}
|
|
155
|
+
style={color ? `background-color: ${color}` : undefined}
|
|
156
|
+
></span>
|
|
157
|
+
{:else if displayCount !== null}
|
|
158
|
+
<span
|
|
159
|
+
class={cn(
|
|
160
|
+
'flex min-w-4.5 h-4.5 items-center justify-center rounded-full px-1.5 text-[11px] font-semibold leading-none shadow-xs whitespace-nowrap',
|
|
161
|
+
status ? cn(statusColorClass, 'text-primary-foreground') : 'bg-destructive text-destructive-foreground',
|
|
162
|
+
)}
|
|
163
|
+
style={color ? `background-color: ${color}` : undefined}
|
|
164
|
+
>
|
|
165
|
+
{displayCount}
|
|
166
|
+
</span>
|
|
167
|
+
{/if}
|
|
168
|
+
</svelte:element>
|
|
169
|
+
{:else}
|
|
170
|
+
<!-- 原始基础标签 (Pill Variant Badge) -->
|
|
171
|
+
<svelte:element
|
|
172
|
+
this={href ? "a" : "span"}
|
|
173
|
+
bind:this={ref}
|
|
174
|
+
data-svadmin-component="badge"
|
|
175
|
+
data-slot="badge"
|
|
176
|
+
data-variant={variant}
|
|
177
|
+
data-size={size}
|
|
178
|
+
{href}
|
|
179
|
+
class={cn(resolveBadgeVariants({ variant }), className)}
|
|
180
|
+
{...restProps}
|
|
181
|
+
>
|
|
182
|
+
{@render children?.()}
|
|
183
|
+
</svelte:element>
|
|
184
|
+
{/if}
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import { type BadgeVariant as BadgeVariantValue } from "./badge-variants.js";
|
|
2
2
|
export { badgeVariants, type BadgeVariant } from "./badge-variants.js";
|
|
3
|
+
export type BadgeStatus = 'success' | 'processing' | 'default' | 'error' | 'warning';
|
|
3
4
|
import type { HTMLAnchorAttributes } from "svelte/elements";
|
|
4
5
|
import { type WithElementRef } from "../../../utils.js";
|
|
5
6
|
type $$ComponentProps = WithElementRef<HTMLAnchorAttributes> & {
|
|
6
7
|
variant?: BadgeVariantValue;
|
|
7
8
|
size?: "default" | "compact";
|
|
9
|
+
count?: number | string | undefined;
|
|
10
|
+
overflowCount?: number | undefined;
|
|
11
|
+
dot?: boolean | undefined;
|
|
12
|
+
status?: BadgeStatus | undefined;
|
|
13
|
+
text?: string | undefined;
|
|
14
|
+
offset?: [number, number] | undefined;
|
|
15
|
+
showZero?: boolean | undefined;
|
|
16
|
+
color?: string | undefined;
|
|
8
17
|
};
|
|
9
18
|
declare const Badge: import("svelte").Component<$$ComponentProps, {}, "ref">;
|
|
10
19
|
type Badge = ReturnType<typeof Badge>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as Badge } from "./badge.svelte";
|
|
2
|
-
export { badgeVariants, type BadgeVariant } from "./badge.svelte";
|
|
2
|
+
export { badgeVariants, type BadgeVariant, type BadgeStatus } from "./badge.svelte";
|
package/dist/index.d.ts
CHANGED
|
@@ -15,8 +15,8 @@ export { default as ScrollableTable } from './components/ScrollableTable.svelte'
|
|
|
15
15
|
export { default as CopyButton } from './components/CopyButton.svelte';
|
|
16
16
|
export { listPaginationItems } from './components/list-pagination.js';
|
|
17
17
|
export type { ListPaginationItem } from './components/list-pagination.js';
|
|
18
|
-
export { default as SegmentedControl } from './components/SegmentedControl.svelte';
|
|
19
|
-
export type { SegmentedControlOption } from './components/SegmentedControl.svelte';
|
|
18
|
+
export { default as SegmentedControl, default as Segmented } from './components/SegmentedControl.svelte';
|
|
19
|
+
export type { SegmentedControlOption, SegmentedControlOption as SegmentedOption } from './components/SegmentedControl.svelte';
|
|
20
20
|
export { default as RadioGroup, default as Radio } from './components/RadioGroup.svelte';
|
|
21
21
|
export type { RadioGroupOption } from './components/RadioGroup.svelte';
|
|
22
22
|
export { default as TagsInput, default as InputTag } from './components/TagsInput.svelte';
|
|
@@ -273,7 +273,7 @@ export { Switch } from './components/ui/switch/index.js';
|
|
|
273
273
|
export { Checkbox } from './components/ui/checkbox/index.js';
|
|
274
274
|
export { Badge } from './components/ui/badge/index.js';
|
|
275
275
|
export { default as Tag } from './components/Tag.svelte';
|
|
276
|
-
export { Separator
|
|
276
|
+
export { Separator } from './components/ui/separator/index.js';
|
|
277
277
|
export { default as Link } from './components/Link.svelte';
|
|
278
278
|
export { default as Title, default as Typography } from './components/Typography.svelte';
|
|
279
279
|
export type { TitleLevel } from './components/Typography.svelte';
|
|
@@ -508,3 +508,24 @@ export { default as PricingCard } from './components/PricingCard.svelte';
|
|
|
508
508
|
export type { PricingCardProps, PricingFeature } from './components/PricingCard.svelte';
|
|
509
509
|
export { default as QuotaProgressBar } from './components/QuotaProgressBar.svelte';
|
|
510
510
|
export type { QuotaProgressBarProps } from './components/QuotaProgressBar.svelte';
|
|
511
|
+
export { default as PricingTable } from './components/PricingTable.svelte';
|
|
512
|
+
export type { PricingTableProps, PricingPlan, FeatureComparisonRow, FeatureComparisonGroup, } from './components/PricingTable.svelte';
|
|
513
|
+
export { default as UsageCard } from './components/UsageCard.svelte';
|
|
514
|
+
export type { UsageCardProps, UsageMetric, } from './components/UsageCard.svelte';
|
|
515
|
+
export { default as EllipsisText } from './components/EllipsisText.svelte';
|
|
516
|
+
export type { EllipsisTextProps } from './components/EllipsisText.svelte';
|
|
517
|
+
export { default as CopyableText } from './components/CopyableText.svelte';
|
|
518
|
+
export type { CopyableTextProps } from './components/CopyableText.svelte';
|
|
519
|
+
export { default as FullscreenButton } from './components/FullscreenButton.svelte';
|
|
520
|
+
export { default as FullScreenButton } from './components/FullscreenButton.svelte';
|
|
521
|
+
export type { FullscreenButtonProps, FullScreenButtonProps } from './components/FullscreenButton.svelte';
|
|
522
|
+
export { default as Divider } from './components/Divider.svelte';
|
|
523
|
+
export type { DividerProps } from './components/Divider.svelte';
|
|
524
|
+
export { default as ProCard } from './components/ProCard.svelte';
|
|
525
|
+
export type { ProCardProps, ProCardTab } from './components/ProCard.svelte';
|
|
526
|
+
export { default as LightFilter } from './components/LightFilter.svelte';
|
|
527
|
+
export type { LightFilterProps, LightFilterItem, LightFilterOption } from './components/LightFilter.svelte';
|
|
528
|
+
export { default as LockScreen, default as ScreenLock } from './components/LockScreen.svelte';
|
|
529
|
+
export type { LockScreenUser } from './components/LockScreen.svelte';
|
|
530
|
+
export { default as GlobalShortcuts } from './components/GlobalShortcuts.svelte';
|
|
531
|
+
export type { ShortcutItem } from './components/GlobalShortcuts.svelte';
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ export { default as DataTableShell } from './components/DataTableShell.svelte';
|
|
|
14
14
|
export { default as ScrollableTable } from './components/ScrollableTable.svelte';
|
|
15
15
|
export { default as CopyButton } from './components/CopyButton.svelte';
|
|
16
16
|
export { listPaginationItems } from './components/list-pagination.js';
|
|
17
|
-
export { default as SegmentedControl } from './components/SegmentedControl.svelte';
|
|
17
|
+
export { default as SegmentedControl, default as Segmented } from './components/SegmentedControl.svelte';
|
|
18
18
|
export { default as RadioGroup, default as Radio } from './components/RadioGroup.svelte';
|
|
19
19
|
export { default as TagsInput, default as InputTag } from './components/TagsInput.svelte';
|
|
20
20
|
export { default as Slider } from './components/Slider.svelte';
|
|
@@ -216,7 +216,7 @@ export { Switch } from './components/ui/switch/index.js';
|
|
|
216
216
|
export { Checkbox } from './components/ui/checkbox/index.js';
|
|
217
217
|
export { Badge } from './components/ui/badge/index.js';
|
|
218
218
|
export { default as Tag } from './components/Tag.svelte';
|
|
219
|
-
export { Separator
|
|
219
|
+
export { Separator } from './components/ui/separator/index.js';
|
|
220
220
|
export { default as Link } from './components/Link.svelte';
|
|
221
221
|
export { default as Title, default as Typography } from './components/Typography.svelte';
|
|
222
222
|
export { default as Text } from './components/Text.svelte';
|
|
@@ -398,3 +398,16 @@ export { default as WaterMark } from './components/Watermark.svelte';
|
|
|
398
398
|
// Enterprise SaaS billing, pricing, and quota management components
|
|
399
399
|
export { default as PricingCard } from './components/PricingCard.svelte';
|
|
400
400
|
export { default as QuotaProgressBar } from './components/QuotaProgressBar.svelte';
|
|
401
|
+
export { default as PricingTable } from './components/PricingTable.svelte';
|
|
402
|
+
export { default as UsageCard } from './components/UsageCard.svelte';
|
|
403
|
+
// Enterprise typography, clipboard and layout controls
|
|
404
|
+
export { default as EllipsisText } from './components/EllipsisText.svelte';
|
|
405
|
+
export { default as CopyableText } from './components/CopyableText.svelte';
|
|
406
|
+
export { default as FullscreenButton } from './components/FullscreenButton.svelte';
|
|
407
|
+
export { default as FullScreenButton } from './components/FullscreenButton.svelte';
|
|
408
|
+
// Enterprise layout, filtering, card containers and workspace security
|
|
409
|
+
export { default as Divider } from './components/Divider.svelte';
|
|
410
|
+
export { default as ProCard } from './components/ProCard.svelte';
|
|
411
|
+
export { default as LightFilter } from './components/LightFilter.svelte';
|
|
412
|
+
export { default as LockScreen, default as ScreenLock } from './components/LockScreen.svelte';
|
|
413
|
+
export { default as GlobalShortcuts } from './components/GlobalShortcuts.svelte';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svadmin/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.117.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.
|
|
91
|
+
"@svadmin/core": "^0.78.0",
|
|
92
92
|
"@tanstack/svelte-query": "^6.1.48",
|
|
93
93
|
"codemirror": "^6.0.0",
|
|
94
94
|
"dashjs": "^4.7.4",
|
|
@@ -151,8 +151,8 @@
|
|
|
151
151
|
}
|
|
152
152
|
},
|
|
153
153
|
"dependencies": {
|
|
154
|
-
"@svadmin/devtools": "^0.6.
|
|
155
|
-
"@svadmin/devtools-contract": "^0.3.
|
|
154
|
+
"@svadmin/devtools": "^0.6.7",
|
|
155
|
+
"@svadmin/devtools-contract": "^0.3.2",
|
|
156
156
|
"@vibeunion/devtools-devframe": "^0.1.0",
|
|
157
157
|
"typebox": "^1.3.34",
|
|
158
158
|
"@floating-ui/dom": "^1.8.0",
|
|
@@ -189,7 +189,7 @@
|
|
|
189
189
|
"@codemirror/lang-markdown": "^6.5.2",
|
|
190
190
|
"@codemirror/lang-sql": "^6.10.0",
|
|
191
191
|
"@happy-dom/global-registrator": "^20.11.12",
|
|
192
|
-
"@svadmin/ai-elements": "^0.14.
|
|
192
|
+
"@svadmin/ai-elements": "^0.14.2",
|
|
193
193
|
"@sveltejs/vite-plugin-svelte": "^7.3.0",
|
|
194
194
|
"@tailwindcss/cli": "4.3.3",
|
|
195
195
|
"@testing-library/dom": "^10.4.1",
|