Expand visual kit and chart factories

This commit is contained in:
Mac mini git server 2026-05-30 23:18:02 +08:00
parent 19f79ef8ef
commit 9e27c7bd34
21 changed files with 810 additions and 52 deletions

View File

@ -38,6 +38,53 @@ templates/project-basic/ 新客户项目模板
doc/ 项目规划和实施文档
```
## 复用能力
### 屏幕适配
`@dev-screen-starter/screen-core` 提供 `ScreenStage`,默认以 `1920x1080` 为设计尺寸,通过 `fit` 缩放适配不同分辨率。业务页面只需要按设计稿绝对定位或栅格布局。
### 图表工厂
`@dev-screen-starter/charts` 提供 ECharts 容器和常用 option 工厂:
- `createLineOption`
- `createAreaTrendOption`
- `createBarOption`
- `createStackedBarOption`
- `createDualAxisOption`
- `createRankBarOption`
- `createPieOption`
- `createRosePieOption`
- `createGaugeOption`
- `createRadarOption`
- `mergeChartOption`
业务项目优先使用工厂函数,遇到客户定制需求时用 `mergeChartOption` 覆盖局部 option。
### visual-kit
`@dev-screen-starter/visual-kit` 提供常用大屏展示和装饰组件:
- `GlowPanel`
- `CornerFrame`
- `TitleBar`
- `SectionTitle`
- `Divider`
- `DigitalNumber`
- `FlipNumber`
- `StatusPill`
- `TrendBadge`
- `ScrollTable`
- `MarqueeList`
- `WaterLevel`
使用时需要在项目入口引入样式:
```ts
import '@dev-screen-starter/visual-kit/styles.css'
```
## 命令
```bash

View File

@ -9,11 +9,28 @@ export const orderTrend = {
values: [120, 240, 380, 520, 760, 920]
}
export const capacityTrend = {
xAxis: ['08:00', '10:00', '12:00', '14:00', '16:00', '18:00'],
series: [
{ name: '入库', values: [80, 132, 210, 286, 330, 382], color: '#63a4ff' },
{ name: '出库', values: [96, 188, 246, 318, 410, 476], color: '#56d08a' }
]
}
export const channelOrders = {
categories: ['小程序', 'App', '门店', '渠道商', '客服'],
values: [420, 360, 280, 190, 130]
}
export const stackedOrders = {
categories: ['华东', '华南', '华北', '西南', '东北'],
series: [
{ name: '标准', values: [420, 360, 310, 260, 180], color: '#63a4ff' },
{ name: '加急', values: [140, 126, 112, 88, 64], color: '#d8a13e' },
{ name: '售后', values: [68, 54, 49, 36, 28], color: '#ec646c' }
]
}
export const regionRank = {
categories: ['华东', '华南', '华北', '西南', '东北'],
values: [960, 820, 680, 520, 390]
@ -26,6 +43,20 @@ export const orderShare = [
{ name: '异常订单', value: 8 }
]
export const issueRose = [
{ name: '库存', value: 32 },
{ name: '履约', value: 26 },
{ name: '接口', value: 18 },
{ name: '人工', value: 14 },
{ name: '设备', value: 10 }
]
export const fulfillmentMix = {
categories: ['08:00', '10:00', '12:00', '14:00', '16:00', '18:00'],
orders: [120, 240, 380, 520, 760, 920],
rates: [82, 85, 86, 88, 89, 91]
}
export const qualityRadar = {
indicators: [
{ name: '响应', max: 100 },
@ -43,3 +74,10 @@ export const alertRows = [
{ time: '17:48', area: '华北仓', status: '接口抖动' },
{ time: '17:36', area: '西南仓', status: '人工介入' }
]
export const operationEvents = [
{ level: 'P1', message: '华东仓出库队列恢复', time: '18:31' },
{ level: 'P2', message: '华南库存同步延迟', time: '18:24' },
{ level: 'P2', message: '客服渠道峰值进入限流', time: '18:18' },
{ level: 'P3', message: '东北分仓设备巡检完成', time: '18:05' }
]

View File

@ -1,16 +1,39 @@
import {
createBarOption,
createAreaTrendOption,
createDualAxisOption,
createGaugeOption,
createLineOption,
createPieOption,
createRosePieOption,
createRadarOption,
createRankBarOption,
createStackedBarOption,
EChart
} from '@dev-screen-starter/charts'
import { DebugBadge } from '@dev-screen-starter/debug'
import { MetricCard, Panel, ScreenStage } from '@dev-screen-starter/screen-core'
import { CornerFrame, DigitalNumber, GlowPanel, ScrollTable, SectionTitle, StatusPill, WaterLevel } from '@dev-screen-starter/visual-kit'
import { alertRows, channelOrders, metrics, orderShare, orderTrend, qualityRadar, regionRank } from '../demo/mockData'
import {
CornerFrame,
Divider,
FlipNumber,
GlowPanel,
MarqueeList,
ScrollTable,
SectionTitle,
StatusPill,
TitleBar,
TrendBadge,
WaterLevel
} from '@dev-screen-starter/visual-kit'
import {
alertRows,
capacityTrend,
fulfillmentMix,
issueRose,
metrics,
operationEvents,
qualityRadar,
regionRank,
stackedOrders
} from '../demo/mockData'
export function DemoOverview() {
return (
@ -22,7 +45,8 @@ export function DemoOverview() {
<section className="visual-strip">
<CornerFrame>
<SectionTitle title="运行态" subtitle="visual-kit" />
<SectionTitle title="运行态" subtitle="visual-kit" size="sm" />
<Divider />
<div className="visual-status-row">
<StatusPill label="稳定" />
<StatusPill label="预警" status="warning" />
@ -30,8 +54,8 @@ export function DemoOverview() {
</div>
</CornerFrame>
<DigitalNumber label="综合效率" value="92.6" unit="%" tone="green" />
<WaterLevel label="产能水位" value={76} />
<FlipNumber label="综合效率" value="92.6" unit="%" tone="green" />
<WaterLevel label="产能水位" value={76} tone="blue" />
<GlowPanel title="实时告警" tone="amber">
<ScrollTable
@ -45,6 +69,25 @@ export function DemoOverview() {
</GlowPanel>
</section>
<section className="event-strip">
<TitleBar
title="运行事件"
subtitle="自动滚动列表"
action={<TrendBadge label="较昨日" value="4.8%" direction="up" tone="green" size="sm" />}
size="sm"
/>
<MarqueeList
rows={operationEvents}
renderRow={(row) => (
<div className="event-row">
<strong>{row.level}</strong>
<span>{row.message}</span>
<small>{row.time}</small>
</div>
)}
/>
</section>
<section className="metric-row">
{metrics.map((metric) => (
<MetricCard key={metric.label} {...metric} />
@ -52,24 +95,20 @@ export function DemoOverview() {
</section>
<section className="chart-grid">
<Panel title="折线图:订单趋势">
<Panel title="面积趋势:吞吐走势">
<EChart
option={createLineOption({
categories: orderTrend.xAxis,
values: orderTrend.values,
name: '订单',
color: '#63a4ff'
option={createAreaTrendOption({
categories: capacityTrend.xAxis,
series: capacityTrend.series
})}
/>
</Panel>
<Panel title="柱状图:渠道订单">
<Panel title="堆叠柱:区域订单">
<EChart
option={createBarOption({
categories: channelOrders.categories,
values: channelOrders.values,
name: '订单',
color: '#56d08a'
option={createStackedBarOption({
categories: stackedOrders.categories,
series: stackedOrders.series
})}
/>
</Panel>
@ -85,12 +124,20 @@ export function DemoOverview() {
/>
</Panel>
<Panel title="环图:订单结构">
<EChart option={createPieOption({ data: orderShare })} />
<Panel title="玫瑰图:异常来源">
<EChart option={createRosePieOption({ data: issueRose })} />
</Panel>
<Panel title="仪表盘:履约率">
<EChart option={createGaugeOption({ name: '履约率', value: 87, unit: '%', color: '#56d08a' })} />
<Panel title="双轴图:订单与履约">
<EChart
option={createDualAxisOption({
categories: fulfillmentMix.categories,
leftName: '订单',
rightName: '履约率',
bar: { name: '订单', values: fulfillmentMix.orders, color: '#63a4ff' },
line: { name: '履约率', values: fulfillmentMix.rates, color: '#d8a13e' }
})}
/>
</Panel>
<Panel title="雷达图:运营质量">
@ -103,6 +150,10 @@ export function DemoOverview() {
})}
/>
</Panel>
<Panel title="仪表盘:履约率" className="compact-panel">
<EChart option={createGaugeOption({ name: '履约率', value: 87, unit: '%', color: '#56d08a' })} />
</Panel>
</section>
<DebugBadge enabled scale={1} />

View File

@ -46,6 +46,45 @@ body {
letter-spacing: 0;
}
.event-strip {
background: rgb(8 22 36 / 72%);
border: 1px solid rgb(88 130 171 / 34%);
border-radius: 8px;
height: 150px;
left: 56px;
padding: 16px;
position: absolute;
top: 150px;
width: 580px;
}
.event-strip .vk-marquee-list {
margin-top: 10px;
}
.event-row {
align-items: center;
display: grid;
gap: 10px;
grid-template-columns: 34px 1fr 44px;
}
.event-row strong {
color: #eac66f;
font-size: 12px;
}
.event-row span {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.event-row small {
color: #88a1bd;
text-align: right;
}
.visual-strip {
align-items: stretch;
display: grid;
@ -62,7 +101,7 @@ body {
display: grid;
gap: 24px;
grid-template-columns: repeat(3, 1fr);
left: 56px;
left: 660px;
position: absolute;
right: 56px;
top: 230px;
@ -128,7 +167,7 @@ body {
bottom: 56px;
display: grid;
gap: 20px;
grid-template-columns: repeat(3, 1fr);
grid-template-columns: repeat(4, 1fr);
grid-template-rows: repeat(2, minmax(0, 1fr));
left: 56px;
position: absolute;
@ -136,6 +175,10 @@ body {
top: 420px;
}
.compact-panel {
grid-column: span 1;
}
.chart-host {
height: 100%;
width: 100%;

View File

@ -77,14 +77,31 @@ doc/
目标:提升项目交付效率。
计划内容:
已完成内容:
- 增加 `ChartPanel` 组合组件。
- 增加常用图表 option 工厂:
- 折线图
- 面积趋势图
- 柱状图
- 堆叠柱状图
- 双轴折线柱状图
- 饼图
- 玫瑰图
- 排名列表
- 仪表盘
- 雷达图
- 增加 `mergeChartOption`,支持项目按客户需求覆盖局部 ECharts option。
- 扩展 `visual-kit`:
- `TitleBar`
- `Divider`
- `FlipNumber`
- `TrendBadge`
- `MarqueeList`
- demo-screen 已改为使用图表工厂和 visual-kit 组合出项目型模板。
后续计划:
- 增加 `ChartPanel` 组合组件。
- 增加 mock/real 数据切换约定。
- 增加 `.env` 示例。
- 增加 Dockerfile 和 Nginx 静态部署模板。
@ -101,6 +118,22 @@ doc/
- 建立截图验收清单。
- 建立大屏上线检查清单。
## 9. 当前进度
最近完成:
- `visual-kit` 已独立导出样式,业务项目可直接引入。
- 基础装饰组件支持 `className`、`style`、`tone`、`size` 等通用属性。
- 图表工厂覆盖常用交付场景,并保留 ECharts 原生 option 覆盖能力。
- demo-screen 已包含状态区、运行事件、指标卡、趋势、堆叠、排行、玫瑰、双轴、雷达和仪表盘示例。
下一步建议:
- 做 `ChartPanel` 组合组件,把 `Panel + EChart + loading/empty/error` 固化下来。
- 给 `data` 包增加 mock/real 数据源切换。
- 增加 `.env.example` 和项目级接口配置约定。
- 对 `ScreenStage` 做 1366x768、1920x1080、4K 的浏览器截图验收。
## 8. 成功标准
- 新项目能通过模板快速创建。

View File

@ -46,10 +46,61 @@ type RadarChartInput = {
color?: string
}
type DualAxisChartInput = {
categories: string[]
leftName?: string
rightName?: string
bar: {
name: string
values: number[]
color?: string
}
line: {
name: string
values: number[]
color?: string
}
}
type RoseChartInput = {
data: DataPoint[]
radius?: string | [string, string]
}
const axisLine = { lineStyle: { color: '#35506c' } }
const axisLabel = { color: '#9fb4cc' }
const splitLine = { lineStyle: { color: '#173047' } }
function deepMerge<T extends Record<string, unknown>>(base: T, patch?: Partial<T>): T {
if (!patch) {
return base
}
const output: Record<string, unknown> = { ...base }
for (const [key, value] of Object.entries(patch)) {
const existing = output[key]
if (
value &&
existing &&
typeof value === 'object' &&
typeof existing === 'object' &&
!Array.isArray(value) &&
!Array.isArray(existing)
) {
output[key] = deepMerge(existing as Record<string, unknown>, value as Record<string, unknown>)
} else {
output[key] = value
}
}
return output as T
}
export function mergeChartOption(base: EChartsOption, patch?: EChartsOption): EChartsOption {
return deepMerge(base as Record<string, unknown>, patch as Record<string, unknown> | undefined) as EChartsOption
}
export function createLineOption(input: AxisChartInput | MultiSeriesInput): EChartsOption {
const series = 'series' in input
? input.series.map((item) => ({
@ -126,6 +177,100 @@ export function createBarOption(input: AxisChartInput | MultiSeriesInput): EChar
})
}
export function createStackedBarOption(input: MultiSeriesInput): EChartsOption {
return withChartDefaults({
legend: { top: 0, textStyle: axisLabel },
xAxis: {
type: 'category',
data: input.categories,
axisLine,
axisLabel
},
yAxis: {
type: 'value',
splitLine,
axisLabel
},
series: input.series.map((item) => ({
name: item.name,
type: 'bar',
stack: 'total',
data: item.values,
barMaxWidth: 32,
itemStyle: { color: item.color ?? '#63a4ff', borderRadius: [4, 4, 0, 0] }
}))
})
}
export function createAreaTrendOption(input: AxisChartInput | MultiSeriesInput): EChartsOption {
return mergeChartOption(createLineOption(input), {
grid: {
top: '14%',
right: 24,
bottom: 28,
left: 40,
containLabel: true
},
series: ('series' in input ? input.series : [input]).map((item) => ({
name: item.name,
type: 'line',
smooth: true,
data: item.values,
showSymbol: false,
areaStyle: {
opacity: 0.24,
color: item.color ?? '#63a4ff'
},
lineStyle: { color: item.color ?? '#63a4ff', width: 3 }
}))
})
}
export function createDualAxisOption(input: DualAxisChartInput): EChartsOption {
return withChartDefaults({
legend: { top: 0, textStyle: axisLabel },
xAxis: {
type: 'category',
data: input.categories,
axisLine,
axisLabel
},
yAxis: [
{
type: 'value',
name: input.leftName,
splitLine,
axisLabel
},
{
type: 'value',
name: input.rightName,
splitLine: { show: false },
axisLabel
}
],
series: [
{
name: input.bar.name,
type: 'bar',
data: input.bar.values,
barMaxWidth: 28,
itemStyle: { color: input.bar.color ?? '#56d08a', borderRadius: [4, 4, 0, 0] }
},
{
name: input.line.name,
type: 'line',
yAxisIndex: 1,
smooth: true,
data: input.line.values,
symbolSize: 8,
lineStyle: { color: input.line.color ?? '#d8a13e', width: 3 },
itemStyle: { color: input.line.color ?? '#d8a13e' }
}
]
})
}
export function createRankBarOption(input: AxisChartInput): EChartsOption {
return withChartDefaults({
grid: {
@ -190,6 +335,31 @@ export function createPieOption(input: PieChartInput): EChartsOption {
})
}
export function createRosePieOption(input: RoseChartInput): EChartsOption {
return withChartDefaults({
tooltip: {
trigger: 'item',
backgroundColor: '#101722',
borderColor: '#314154',
textStyle: { color: '#d7e4f2' }
},
legend: {
bottom: 0,
textStyle: axisLabel
},
series: [
{
type: 'pie',
roseType: 'area',
radius: input.radius ?? ['22%', '70%'],
center: ['50%', '44%'],
label: { color: '#d7e4f2' },
data: input.data
}
]
})
}
export function createGaugeOption(input: GaugeChartInput): EChartsOption {
const max = input.max ?? 100

View File

@ -1,13 +1,13 @@
import type { ReactNode } from 'react'
import type { VisualBaseProps } from './types'
type CornerFrameProps = {
className?: string
type CornerFrameProps = VisualBaseProps & {
children: ReactNode
}
export function CornerFrame({ className = '', children }: CornerFrameProps) {
export function CornerFrame({ className = '', children, style, tone = 'blue', size = 'md' }: CornerFrameProps) {
return (
<div className={`vk-corner-frame ${className}`}>
<div className={`vk-corner-frame tone-${tone} size-${size} ${className}`} style={style}>
<span className="corner corner-tl" />
<span className="corner corner-tr" />
<span className="corner corner-bl" />

View File

@ -1,13 +1,14 @@
import type { VisualBaseProps } from './types'
type DigitalNumberProps = {
label: string
value: string | number
unit?: string
tone?: 'blue' | 'green' | 'amber'
}
} & VisualBaseProps
export function DigitalNumber({ label, value, unit, tone = 'blue' }: DigitalNumberProps) {
export function DigitalNumber({ label, value, unit, tone = 'blue', size = 'md', className = '', style }: DigitalNumberProps) {
return (
<div className={`vk-digital-number tone-${tone}`}>
<div className={`vk-digital-number tone-${tone} size-${size} ${className}`} style={style}>
<span>{label}</span>
<strong>
{value}

View File

@ -0,0 +1,12 @@
import type { CSSProperties } from 'react'
import type { VisualTone } from './types'
type DividerProps = {
className?: string
style?: CSSProperties
tone?: VisualTone
}
export function Divider({ className = '', style, tone = 'blue' }: DividerProps) {
return <div className={`vk-divider tone-${tone} ${className}`} style={style} />
}

View File

@ -0,0 +1,30 @@
import type { CSSProperties } from 'react'
import type { VisualSize, VisualTone } from './types'
type FlipNumberProps = {
label?: string
value: string | number
unit?: string
className?: string
style?: CSSProperties
tone?: VisualTone
size?: VisualSize
}
export function FlipNumber({ label, value, unit, className = '', style, tone = 'blue', size = 'md' }: FlipNumberProps) {
const chars = String(value).split('')
return (
<div className={`vk-flip-number tone-${tone} size-${size} ${className}`} style={style}>
{label ? <span className="vk-flip-number-label">{label}</span> : null}
<div className="vk-flip-number-value">
{chars.map((char, index) => (
<span className={char === '.' || char === ',' ? 'is-symbol' : ''} key={`${char}-${index}`}>
{char}
</span>
))}
{unit ? <small>{unit}</small> : null}
</div>
</div>
)
}

View File

@ -1,15 +1,14 @@
import type { ReactNode } from 'react'
import type { VisualBaseProps } from './types'
type GlowPanelProps = {
type GlowPanelProps = VisualBaseProps & {
title?: string
tone?: 'blue' | 'green' | 'amber'
className?: string
children: ReactNode
}
export function GlowPanel({ title, tone = 'blue', className = '', children }: GlowPanelProps) {
export function GlowPanel({ title, tone = 'blue', size = 'md', className = '', style, children }: GlowPanelProps) {
return (
<section className={`vk-glow-panel tone-${tone} ${className}`}>
<section className={`vk-glow-panel tone-${tone} size-${size} ${className}`} style={style}>
{title ? <header>{title}</header> : null}
<div className="vk-glow-panel-body">{children}</div>
</section>

View File

@ -0,0 +1,27 @@
import type { CSSProperties, ReactNode } from 'react'
import type { VisualSize, VisualTone } from './types'
type MarqueeListProps<T> = {
rows: T[]
renderRow: (row: T, index: number) => ReactNode
className?: string
style?: CSSProperties
tone?: VisualTone
size?: VisualSize
}
export function MarqueeList<T>({ rows, renderRow, className = '', style, tone = 'blue', size = 'md' }: MarqueeListProps<T>) {
const visibleRows = rows.length > 0 ? [...rows, ...rows] : []
return (
<div className={`vk-marquee-list tone-${tone} size-${size} ${className}`} style={style}>
<div className="vk-marquee-list-track">
{visibleRows.map((row, index) => (
<div className="vk-marquee-list-row" key={index}>
{renderRow(row, index % Math.max(rows.length, 1))}
</div>
))}
</div>
</div>
)
}

View File

@ -1,3 +1,6 @@
import type { CSSProperties } from 'react'
import type { VisualSize, VisualTone } from './types'
type ScrollTableColumn<T> = {
key: keyof T
title: string
@ -7,11 +10,22 @@ type ScrollTableColumn<T> = {
type ScrollTableProps<T extends Record<string, string | number>> = {
columns: Array<ScrollTableColumn<T>>
rows: T[]
className?: string
style?: CSSProperties
tone?: VisualTone
size?: VisualSize
}
export function ScrollTable<T extends Record<string, string | number>>({ columns, rows }: ScrollTableProps<T>) {
export function ScrollTable<T extends Record<string, string | number>>({
columns,
rows,
className = '',
style,
tone = 'blue',
size = 'md'
}: ScrollTableProps<T>) {
return (
<div className="vk-scroll-table">
<div className={`vk-scroll-table tone-${tone} size-${size} ${className}`} style={style}>
<div className="vk-scroll-table-head">
{columns.map((column) => (
<span key={String(column.key)} style={{ width: column.width }}>

View File

@ -1,11 +1,18 @@
import type { CSSProperties } from 'react'
import type { VisualSize, VisualTone } from './types'
type SectionTitleProps = {
title: string
subtitle?: string
className?: string
style?: CSSProperties
tone?: VisualTone
size?: VisualSize
}
export function SectionTitle({ title, subtitle }: SectionTitleProps) {
export function SectionTitle({ title, subtitle, className = '', style, tone = 'blue', size = 'md' }: SectionTitleProps) {
return (
<div className="vk-section-title">
<div className={`vk-section-title tone-${tone} size-${size} ${className}`} style={style}>
<strong>{title}</strong>
{subtitle ? <span>{subtitle}</span> : null}
</div>

View File

@ -1,8 +1,18 @@
import type { CSSProperties } from 'react'
import type { VisualSize } from './types'
type StatusPillProps = {
label: string
status?: 'normal' | 'warning' | 'danger'
className?: string
style?: CSSProperties
size?: VisualSize
}
export function StatusPill({ label, status = 'normal' }: StatusPillProps) {
return <span className={`vk-status-pill status-${status}`}>{label}</span>
export function StatusPill({ label, status = 'normal', className = '', style, size = 'md' }: StatusPillProps) {
return (
<span className={`vk-status-pill status-${status} size-${size} ${className}`} style={style}>
{label}
</span>
)
}

View File

@ -0,0 +1,24 @@
import type { CSSProperties, ReactNode } from 'react'
import type { VisualSize, VisualTone } from './types'
type TitleBarProps = {
title: string
subtitle?: string
action?: ReactNode
className?: string
style?: CSSProperties
tone?: VisualTone
size?: VisualSize
}
export function TitleBar({ title, subtitle, action, className = '', style, tone = 'blue', size = 'md' }: TitleBarProps) {
return (
<div className={`vk-title-bar tone-${tone} size-${size} ${className}`} style={style}>
<div>
<strong>{title}</strong>
{subtitle ? <span>{subtitle}</span> : null}
</div>
{action ? <div className="vk-title-bar-action">{action}</div> : null}
</div>
)
}

View File

@ -0,0 +1,30 @@
import type { CSSProperties } from 'react'
import type { VisualSize, VisualTone } from './types'
type TrendBadgeProps = {
label: string
value: string | number
direction?: 'up' | 'down' | 'flat'
className?: string
style?: CSSProperties
tone?: VisualTone
size?: VisualSize
}
const directionMark = {
up: '+',
down: '-',
flat: ''
}
export function TrendBadge({ label, value, direction = 'flat', className = '', style, tone = 'blue', size = 'md' }: TrendBadgeProps) {
return (
<span className={`vk-trend-badge trend-${direction} tone-${tone} size-${size} ${className}`} style={style}>
<span>{label}</span>
<strong>
{directionMark[direction]}
{value}
</strong>
</span>
)
}

View File

@ -1,14 +1,16 @@
import type { VisualBaseProps } from './types'
type WaterLevelProps = {
label: string
value: number
unit?: string
}
} & VisualBaseProps
export function WaterLevel({ label, value, unit = '%' }: WaterLevelProps) {
export function WaterLevel({ label, value, unit = '%', tone = 'blue', size = 'md', className = '', style }: WaterLevelProps) {
const clamped = Math.min(100, Math.max(0, value))
return (
<div className="vk-water-level">
<div className={`vk-water-level tone-${tone} size-${size} ${className}`} style={style}>
<div className="vk-water-level-tank">
<div className="vk-water-level-fill" style={{ height: `${clamped}%` }} />
<strong>

View File

@ -1,7 +1,13 @@
export * from './GlowPanel'
export * from './CornerFrame'
export * from './SectionTitle'
export * from './TitleBar'
export * from './Divider'
export * from './DigitalNumber'
export * from './FlipNumber'
export * from './StatusPill'
export * from './TrendBadge'
export * from './ScrollTable'
export * from './MarqueeList'
export * from './WaterLevel'
export * from './types'

View File

@ -1,7 +1,8 @@
.vk-glow-panel,
.vk-corner-frame,
.vk-digital-number,
.vk-water-level {
.vk-water-level,
.vk-flip-number {
background: rgb(8 22 36 / 78%);
border: 1px solid rgb(88 130 171 / 38%);
border-radius: 8px;
@ -33,10 +34,17 @@
}
.vk-glow-panel.tone-green,
.vk-digital-number.tone-green {
.vk-digital-number.tone-green,
.vk-flip-number.tone-green {
border-color: rgb(86 208 138 / 42%);
}
.vk-glow-panel.tone-red,
.vk-digital-number.tone-red,
.vk-flip-number.tone-red {
border-color: rgb(236 100 108 / 42%);
}
.vk-corner-frame {
min-height: 0;
padding: 16px;
@ -66,6 +74,27 @@
width: 2px;
}
.vk-corner-frame.tone-green .corner::before,
.vk-corner-frame.tone-green .corner::after,
.vk-divider.tone-green::before,
.vk-divider.tone-green::after {
background: #56d08a;
}
.vk-corner-frame.tone-amber .corner::before,
.vk-corner-frame.tone-amber .corner::after,
.vk-divider.tone-amber::before,
.vk-divider.tone-amber::after {
background: #d8a13e;
}
.vk-corner-frame.tone-red .corner::before,
.vk-corner-frame.tone-red .corner::after,
.vk-divider.tone-red::before,
.vk-divider.tone-red::after {
background: #ec646c;
}
.corner-tl {
left: 8px;
top: 8px;
@ -122,12 +151,25 @@
right: 0;
}
.vk-title-bar {
align-items: center;
display: flex;
justify-content: space-between;
min-width: 0;
}
.vk-title-bar > div:first-child {
min-width: 0;
}
.vk-title-bar strong,
.vk-section-title strong {
color: #f0f7ff;
display: block;
font-size: 18px;
}
.vk-title-bar span,
.vk-section-title span {
color: #88a1bd;
display: block;
@ -135,6 +177,47 @@
margin-top: 4px;
}
.vk-title-bar.size-lg strong {
font-size: 24px;
}
.vk-title-bar.size-sm strong,
.vk-section-title.size-sm strong {
font-size: 15px;
}
.vk-title-bar-action {
color: #9fb4cc;
flex: 0 0 auto;
font-size: 12px;
}
.vk-divider {
height: 1px;
margin: 10px 0;
position: relative;
}
.vk-divider::before,
.vk-divider::after {
background: #63a4ff;
content: "";
height: 1px;
left: 0;
position: absolute;
top: 0;
}
.vk-divider::before {
opacity: 0.95;
width: 72px;
}
.vk-divider::after {
opacity: 0.2;
right: 0;
}
.vk-status-pill {
border: 1px solid rgb(86 208 138 / 45%);
border-radius: 999px;
@ -153,6 +236,12 @@
color: #ff9fa7;
}
.vk-status-pill.size-sm,
.vk-trend-badge.size-sm {
font-size: 11px;
padding: 4px 8px;
}
.vk-digital-number {
display: flex;
flex-direction: column;
@ -161,6 +250,7 @@
}
.vk-digital-number span,
.vk-flip-number-label,
.vk-water-level > span {
color: #9fb4cc;
font-size: 14px;
@ -179,6 +269,58 @@
margin-left: 6px;
}
.vk-flip-number {
display: flex;
flex-direction: column;
gap: 10px;
justify-content: center;
padding: 16px;
}
.vk-flip-number-value {
align-items: center;
display: flex;
gap: 4px;
}
.vk-flip-number-value span {
align-items: center;
background: linear-gradient(180deg, rgb(100 166 255 / 20%), rgb(9 24 40 / 58%));
border: 1px solid rgb(99 164 255 / 34%);
border-radius: 4px;
color: #f0f7ff;
display: inline-flex;
font-size: 34px;
font-weight: 800;
height: 48px;
justify-content: center;
min-width: 34px;
}
.vk-flip-number-value span.is-symbol {
background: transparent;
border-color: transparent;
min-width: 12px;
}
.vk-flip-number-value small {
color: #9fb4cc;
font-size: 16px;
margin-left: 4px;
}
.vk-flip-number.size-sm .vk-flip-number-value span {
font-size: 24px;
height: 34px;
min-width: 24px;
}
.vk-flip-number.size-lg .vk-flip-number-value span {
font-size: 44px;
height: 60px;
min-width: 44px;
}
.vk-water-level {
align-items: center;
display: flex;
@ -251,3 +393,64 @@
font-size: 12px;
padding: 6px 8px;
}
.vk-trend-badge {
align-items: center;
border: 1px solid rgb(99 164 255 / 34%);
border-radius: 999px;
color: #9fb4cc;
display: inline-flex;
font-size: 12px;
gap: 8px;
padding: 5px 10px;
}
.vk-trend-badge strong {
color: #d7e6f7;
font-weight: 800;
}
.vk-trend-badge.trend-up strong {
color: #9ee8b8;
}
.vk-trend-badge.trend-down strong {
color: #ff9fa7;
}
.vk-marquee-list {
height: 100%;
min-height: 0;
overflow: hidden;
}
.vk-marquee-list-track {
animation: vk-marquee-up 14s linear infinite;
display: flex;
flex-direction: column;
gap: 6px;
}
.vk-marquee-list-row {
background: rgb(99 164 255 / 8%);
border: 1px solid rgb(99 164 255 / 10%);
border-radius: 4px;
color: #d7e6f7;
font-size: 12px;
min-height: 28px;
padding: 6px 8px;
}
.vk-marquee-list:hover .vk-marquee-list-track {
animation-play-state: paused;
}
@keyframes vk-marquee-up {
from {
transform: translateY(0);
}
to {
transform: translateY(-50%);
}
}

View File

@ -0,0 +1,11 @@
import type { CSSProperties } from 'react'
export type VisualTone = 'blue' | 'green' | 'amber' | 'red'
export type VisualSize = 'sm' | 'md' | 'lg'
export type VisualBaseProps = {
className?: string
style?: CSSProperties
tone?: VisualTone
size?: VisualSize
}