diff --git a/README.md b/README.md index 9882f1f..9380b48 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/apps/demo-screen/src/demo/mockData.ts b/apps/demo-screen/src/demo/mockData.ts index 3f25941..ba40c51 100644 --- a/apps/demo-screen/src/demo/mockData.ts +++ b/apps/demo-screen/src/demo/mockData.ts @@ -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' } +] diff --git a/apps/demo-screen/src/pages/DemoOverview.tsx b/apps/demo-screen/src/pages/DemoOverview.tsx index c6c5d54..15820e3 100644 --- a/apps/demo-screen/src/pages/DemoOverview.tsx +++ b/apps/demo-screen/src/pages/DemoOverview.tsx @@ -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() {
- + +
@@ -30,8 +54,8 @@ export function DemoOverview() {
- - + +
+
+ } + size="sm" + /> + ( +
+ {row.level} + {row.message} + {row.time} +
+ )} + /> +
+
{metrics.map((metric) => ( @@ -52,24 +95,20 @@ export function DemoOverview() {
- + - + @@ -85,12 +124,20 @@ export function DemoOverview() { /> - - + + - - + + @@ -103,6 +150,10 @@ export function DemoOverview() { })} /> + + + +
diff --git a/apps/demo-screen/src/styles/screen.css b/apps/demo-screen/src/styles/screen.css index 2dc84bd..f117f21 100644 --- a/apps/demo-screen/src/styles/screen.css +++ b/apps/demo-screen/src/styles/screen.css @@ -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%; diff --git a/doc/project-plan.md b/doc/project-plan.md index b22f974..012358f 100644 --- a/doc/project-plan.md +++ b/doc/project-plan.md @@ -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. 成功标准 - 新项目能通过模板快速创建。 diff --git a/packages/charts/src/optionFactories.ts b/packages/charts/src/optionFactories.ts index 3e9ecf3..05ad90f 100644 --- a/packages/charts/src/optionFactories.ts +++ b/packages/charts/src/optionFactories.ts @@ -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>(base: T, patch?: Partial): T { + if (!patch) { + return base + } + + const output: Record = { ...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, value as Record) + } else { + output[key] = value + } + } + + return output as T +} + +export function mergeChartOption(base: EChartsOption, patch?: EChartsOption): EChartsOption { + return deepMerge(base as Record, patch as Record | 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 diff --git a/packages/visual-kit/src/CornerFrame.tsx b/packages/visual-kit/src/CornerFrame.tsx index 2d691c9..2dfd6b3 100644 --- a/packages/visual-kit/src/CornerFrame.tsx +++ b/packages/visual-kit/src/CornerFrame.tsx @@ -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 ( -
+
diff --git a/packages/visual-kit/src/DigitalNumber.tsx b/packages/visual-kit/src/DigitalNumber.tsx index d0f2f7b..020f141 100644 --- a/packages/visual-kit/src/DigitalNumber.tsx +++ b/packages/visual-kit/src/DigitalNumber.tsx @@ -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 ( -
+
{label} {value} diff --git a/packages/visual-kit/src/Divider.tsx b/packages/visual-kit/src/Divider.tsx new file mode 100644 index 0000000..e365c3d --- /dev/null +++ b/packages/visual-kit/src/Divider.tsx @@ -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
+} diff --git a/packages/visual-kit/src/FlipNumber.tsx b/packages/visual-kit/src/FlipNumber.tsx new file mode 100644 index 0000000..e51b93b --- /dev/null +++ b/packages/visual-kit/src/FlipNumber.tsx @@ -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 ( +
+ {label ? {label} : null} +
+ {chars.map((char, index) => ( + + {char} + + ))} + {unit ? {unit} : null} +
+
+ ) +} diff --git a/packages/visual-kit/src/GlowPanel.tsx b/packages/visual-kit/src/GlowPanel.tsx index 55bce6a..3a69d95 100644 --- a/packages/visual-kit/src/GlowPanel.tsx +++ b/packages/visual-kit/src/GlowPanel.tsx @@ -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 ( -
+
{title ?
{title}
: null}
{children}
diff --git a/packages/visual-kit/src/MarqueeList.tsx b/packages/visual-kit/src/MarqueeList.tsx new file mode 100644 index 0000000..a3fe2f0 --- /dev/null +++ b/packages/visual-kit/src/MarqueeList.tsx @@ -0,0 +1,27 @@ +import type { CSSProperties, ReactNode } from 'react' +import type { VisualSize, VisualTone } from './types' + +type MarqueeListProps = { + rows: T[] + renderRow: (row: T, index: number) => ReactNode + className?: string + style?: CSSProperties + tone?: VisualTone + size?: VisualSize +} + +export function MarqueeList({ rows, renderRow, className = '', style, tone = 'blue', size = 'md' }: MarqueeListProps) { + const visibleRows = rows.length > 0 ? [...rows, ...rows] : [] + + return ( +
+
+ {visibleRows.map((row, index) => ( +
+ {renderRow(row, index % Math.max(rows.length, 1))} +
+ ))} +
+
+ ) +} diff --git a/packages/visual-kit/src/ScrollTable.tsx b/packages/visual-kit/src/ScrollTable.tsx index 3ebfb81..2ffbedc 100644 --- a/packages/visual-kit/src/ScrollTable.tsx +++ b/packages/visual-kit/src/ScrollTable.tsx @@ -1,3 +1,6 @@ +import type { CSSProperties } from 'react' +import type { VisualSize, VisualTone } from './types' + type ScrollTableColumn = { key: keyof T title: string @@ -7,11 +10,22 @@ type ScrollTableColumn = { type ScrollTableProps> = { columns: Array> rows: T[] + className?: string + style?: CSSProperties + tone?: VisualTone + size?: VisualSize } -export function ScrollTable>({ columns, rows }: ScrollTableProps) { +export function ScrollTable>({ + columns, + rows, + className = '', + style, + tone = 'blue', + size = 'md' +}: ScrollTableProps) { return ( -
+
{columns.map((column) => ( diff --git a/packages/visual-kit/src/SectionTitle.tsx b/packages/visual-kit/src/SectionTitle.tsx index aba9f20..c53031c 100644 --- a/packages/visual-kit/src/SectionTitle.tsx +++ b/packages/visual-kit/src/SectionTitle.tsx @@ -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 ( -
+
{title} {subtitle ? {subtitle} : null}
diff --git a/packages/visual-kit/src/StatusPill.tsx b/packages/visual-kit/src/StatusPill.tsx index b123c85..e1a4a6b 100644 --- a/packages/visual-kit/src/StatusPill.tsx +++ b/packages/visual-kit/src/StatusPill.tsx @@ -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 {label} +export function StatusPill({ label, status = 'normal', className = '', style, size = 'md' }: StatusPillProps) { + return ( + + {label} + + ) } diff --git a/packages/visual-kit/src/TitleBar.tsx b/packages/visual-kit/src/TitleBar.tsx new file mode 100644 index 0000000..2732a57 --- /dev/null +++ b/packages/visual-kit/src/TitleBar.tsx @@ -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 ( +
+
+ {title} + {subtitle ? {subtitle} : null} +
+ {action ?
{action}
: null} +
+ ) +} diff --git a/packages/visual-kit/src/TrendBadge.tsx b/packages/visual-kit/src/TrendBadge.tsx new file mode 100644 index 0000000..05b6a1c --- /dev/null +++ b/packages/visual-kit/src/TrendBadge.tsx @@ -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 ( + + {label} + + {directionMark[direction]} + {value} + + + ) +} diff --git a/packages/visual-kit/src/WaterLevel.tsx b/packages/visual-kit/src/WaterLevel.tsx index c744f69..30b4b76 100644 --- a/packages/visual-kit/src/WaterLevel.tsx +++ b/packages/visual-kit/src/WaterLevel.tsx @@ -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 ( -
+
diff --git a/packages/visual-kit/src/index.ts b/packages/visual-kit/src/index.ts index 1d914bb..041b9f9 100644 --- a/packages/visual-kit/src/index.ts +++ b/packages/visual-kit/src/index.ts @@ -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' diff --git a/packages/visual-kit/src/styles.css b/packages/visual-kit/src/styles.css index aa3c528..973871e 100644 --- a/packages/visual-kit/src/styles.css +++ b/packages/visual-kit/src/styles.css @@ -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%); + } +} diff --git a/packages/visual-kit/src/types.ts b/packages/visual-kit/src/types.ts new file mode 100644 index 0000000..88555cb --- /dev/null +++ b/packages/visual-kit/src/types.ts @@ -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 +}