@svadmin/ui 0.115.0 → 0.116.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.
@@ -0,0 +1,167 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import { cn } from '../utils.js';
4
+
5
+ export interface StatisticTrendItem {
6
+ /** Label of the trend (e.g. '周同比', '日环比') */
7
+ label?: string;
8
+ /** Trend value (e.g. '12.5%', 18.2) */
9
+ value: string | number;
10
+ /** Trend direction */
11
+ direction: 'up' | 'down';
12
+ }
13
+
14
+ export interface StatisticCardProps {
15
+ /** Card title */
16
+ title?: string;
17
+ /** Tooltip explanation text */
18
+ tip?: string;
19
+ /** Main numerical value */
20
+ value?: string | number;
21
+ /** Prefix symbol (e.g. '¥', '$') */
22
+ prefix?: string;
23
+ /** Suffix symbol (e.g. '%', '人', '单') */
24
+ suffix?: string;
25
+ /** Decimal precision */
26
+ precision?: number;
27
+ /** Array of trend comparisons (e.g. YoY / MoM) */
28
+ trends?: StatisticTrendItem[];
29
+ /** Custom extra action in header */
30
+ extra?: Snippet;
31
+ /** Embedded chart or sparkline slot */
32
+ chart?: Snippet;
33
+ /** Bottom footer summary slot */
34
+ footer?: Snippet;
35
+ /** Card content slot */
36
+ children?: Snippet;
37
+ /** Card size */
38
+ size?: 'default' | 'small';
39
+ /** Additional CSS classes */
40
+ class?: string;
41
+ [key: string]: unknown;
42
+ }
43
+
44
+ let {
45
+ title,
46
+ tip,
47
+ value = 0,
48
+ prefix,
49
+ suffix,
50
+ precision,
51
+ trends = [],
52
+ extra,
53
+ chart,
54
+ footer,
55
+ children,
56
+ size = 'default',
57
+ class: className = '',
58
+ ...restProps
59
+ }: StatisticCardProps = $props();
60
+
61
+ const formattedValue = $derived.by(() => {
62
+ if (typeof value === 'number' && precision !== undefined) {
63
+ return value.toFixed(precision);
64
+ }
65
+ return String(value);
66
+ });
67
+ </script>
68
+
69
+ <div
70
+ data-svadmin-component="StatisticCard"
71
+ class={cn(
72
+ 'svadmin-statistic-card flex flex-col justify-between rounded-[4px] border border-border bg-card text-card-foreground shadow-sm hover:border-primary/40 transition-colors',
73
+ size === 'small' ? 'p-3 text-xs' : 'p-4 text-sm',
74
+ className
75
+ )}
76
+ {...restProps}
77
+ >
78
+ <!-- Card Header -->
79
+ {#if title || extra}
80
+ <div class="flex items-center justify-between pb-2 border-b border-border/60">
81
+ <div class="flex items-center gap-1.5 min-w-0">
82
+ {#if title}
83
+ <span class="font-medium text-xs text-muted-foreground truncate">{title}</span>
84
+ {/if}
85
+ {#if tip}
86
+ <span
87
+ title={tip}
88
+ class="inline-flex items-center justify-center w-3.5 h-3.5 rounded-full bg-muted text-[10px] text-muted-foreground/80 cursor-help"
89
+ >
90
+ ?
91
+ </span>
92
+ {/if}
93
+ </div>
94
+ {#if extra}
95
+ <div class="shrink-0 text-xs text-muted-foreground">
96
+ {@render extra()}
97
+ </div>
98
+ {/if}
99
+ </div>
100
+ {/if}
101
+
102
+ <!-- Main Metric Number -->
103
+ <div class="my-2.5">
104
+ <div class="flex items-baseline gap-1">
105
+ {#if prefix}
106
+ <span class="text-sm font-medium text-muted-foreground">{prefix}</span>
107
+ {/if}
108
+ <span class={cn('font-bold tracking-tight text-foreground font-mono leading-none', size === 'small' ? 'text-xl' : 'text-2xl sm:text-3xl')}>
109
+ {formattedValue}
110
+ </span>
111
+ {#if suffix}
112
+ <span class="text-xs text-muted-foreground font-normal ml-0.5">{suffix}</span>
113
+ {/if}
114
+ </div>
115
+
116
+ <!-- Trend Indicators (YoY / MoM) -->
117
+ {#if trends.length > 0}
118
+ <div class="flex flex-wrap items-center gap-3 mt-2 text-xs">
119
+ {#each trends as trend, idx (trend.label ? trend.label + idx : idx)}
120
+ <div class="flex items-center gap-1">
121
+ {#if trend.label}
122
+ <span class="text-muted-foreground text-[11px]">{trend.label}</span>
123
+ {/if}
124
+ <span
125
+ class={cn(
126
+ 'inline-flex items-center text-xs font-medium font-mono',
127
+ trend.direction === 'up' ? 'text-success' : 'text-destructive'
128
+ )}
129
+ >
130
+ {#if trend.direction === 'up'}
131
+ <svg class="w-3 h-3 shrink-0 mr-0.5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
132
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2.5" d="M5 10l7-7m0 0l7 7m-7-7v18" />
133
+ </svg>
134
+ {:else}
135
+ <svg class="w-3 h-3 shrink-0 mr-0.5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
136
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2.5" d="M19 14l-7 7m0 0l-7-7m7 7V3" />
137
+ </svg>
138
+ {/if}
139
+ {trend.value}
140
+ </span>
141
+ </div>
142
+ {/each}
143
+ </div>
144
+ {/if}
145
+ </div>
146
+
147
+ <!-- Chart / Sparkline Slot -->
148
+ {#if chart}
149
+ <div class="my-1.5 w-full">
150
+ {@render chart()}
151
+ </div>
152
+ {/if}
153
+
154
+ <!-- Body Content -->
155
+ {#if children}
156
+ <div class="mt-1 text-xs text-muted-foreground">
157
+ {@render children()}
158
+ </div>
159
+ {/if}
160
+
161
+ <!-- Footer -->
162
+ {#if footer}
163
+ <div class="mt-3 pt-2.5 border-t border-border/60 text-xs text-muted-foreground">
164
+ {@render footer()}
165
+ </div>
166
+ {/if}
167
+ </div>
@@ -0,0 +1,41 @@
1
+ import type { Snippet } from 'svelte';
2
+ export interface StatisticTrendItem {
3
+ /** Label of the trend (e.g. '周同比', '日环比') */
4
+ label?: string;
5
+ /** Trend value (e.g. '12.5%', 18.2) */
6
+ value: string | number;
7
+ /** Trend direction */
8
+ direction: 'up' | 'down';
9
+ }
10
+ export interface StatisticCardProps {
11
+ /** Card title */
12
+ title?: string;
13
+ /** Tooltip explanation text */
14
+ tip?: string;
15
+ /** Main numerical value */
16
+ value?: string | number;
17
+ /** Prefix symbol (e.g. '¥', '$') */
18
+ prefix?: string;
19
+ /** Suffix symbol (e.g. '%', '人', '单') */
20
+ suffix?: string;
21
+ /** Decimal precision */
22
+ precision?: number;
23
+ /** Array of trend comparisons (e.g. YoY / MoM) */
24
+ trends?: StatisticTrendItem[];
25
+ /** Custom extra action in header */
26
+ extra?: Snippet;
27
+ /** Embedded chart or sparkline slot */
28
+ chart?: Snippet;
29
+ /** Bottom footer summary slot */
30
+ footer?: Snippet;
31
+ /** Card content slot */
32
+ children?: Snippet;
33
+ /** Card size */
34
+ size?: 'default' | 'small';
35
+ /** Additional CSS classes */
36
+ class?: string;
37
+ [key: string]: unknown;
38
+ }
39
+ declare const StatisticCard: import("svelte").Component<StatisticCardProps, {}, "">;
40
+ type StatisticCard = ReturnType<typeof StatisticCard>;
41
+ export default StatisticCard;
package/dist/index.d.ts CHANGED
@@ -498,3 +498,13 @@ export type { RoleSwitcherProps, RoleItem } from './components/RoleSwitcher.svel
498
498
  export { default as RealtimeMonitorView } from './components/RealtimeMonitorView.svelte';
499
499
  export type { RealtimeMonitorViewProps, MetricCardItem } from './components/RealtimeMonitorView.svelte';
500
500
  export * from './components/icons/index.js';
501
+ export { default as CheckCard } from './components/CheckCard.svelte';
502
+ export type { CheckCardProps } from './components/CheckCard.svelte';
503
+ export { default as StatisticCard } from './components/StatisticCard.svelte';
504
+ export type { StatisticCardProps, StatisticTrendItem } from './components/StatisticCard.svelte';
505
+ export { default as MaskedText } from './components/SensitiveDataMask.svelte';
506
+ export { default as WaterMark } from './components/Watermark.svelte';
507
+ export { default as PricingCard } from './components/PricingCard.svelte';
508
+ export type { PricingCardProps, PricingFeature } from './components/PricingCard.svelte';
509
+ export { default as QuotaProgressBar } from './components/QuotaProgressBar.svelte';
510
+ export type { QuotaProgressBarProps } from './components/QuotaProgressBar.svelte';
package/dist/index.js CHANGED
@@ -389,3 +389,12 @@ export { default as RoleSwitcher } from './components/RoleSwitcher.svelte';
389
389
  export { default as RealtimeMonitorView } from './components/RealtimeMonitorView.svelte';
390
390
  // Enterprise business icons suite
391
391
  export * from './components/icons/index.js';
392
+ // Enterprise card-level selection and analytical statistics components
393
+ export { default as CheckCard } from './components/CheckCard.svelte';
394
+ export { default as StatisticCard } from './components/StatisticCard.svelte';
395
+ // Canonical compatibility aliases for security and masking
396
+ export { default as MaskedText } from './components/SensitiveDataMask.svelte';
397
+ export { default as WaterMark } from './components/Watermark.svelte';
398
+ // Enterprise SaaS billing, pricing, and quota management components
399
+ export { default as PricingCard } from './components/PricingCard.svelte';
400
+ export { default as QuotaProgressBar } from './components/QuotaProgressBar.svelte';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@svadmin/ui",
3
- "version": "0.115.0",
3
+ "version": "0.116.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.76.0",
91
+ "@svadmin/core": "^0.77.0",
92
92
  "@tanstack/svelte-query": "^6.1.48",
93
93
  "codemirror": "^6.0.0",
94
94
  "dashjs": "^4.7.4",
@@ -151,7 +151,7 @@
151
151
  }
152
152
  },
153
153
  "dependencies": {
154
- "@svadmin/devtools": "^0.6.5",
154
+ "@svadmin/devtools": "^0.6.6",
155
155
  "@svadmin/devtools-contract": "^0.3.1",
156
156
  "@vibeunion/devtools-devframe": "^0.1.0",
157
157
  "typebox": "^1.3.34",
@@ -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.0",
192
+ "@svadmin/ai-elements": "^0.14.1",
193
193
  "@sveltejs/vite-plugin-svelte": "^7.3.0",
194
194
  "@tailwindcss/cli": "4.3.3",
195
195
  "@testing-library/dom": "^10.4.1",