Expand visual kit and chart factories
This commit is contained in:
1 parent
19f79ef8ef
commit
9e27c7bd34
21 files changed
+810
-52
No files matched your search
@@ -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" />
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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} />
|
||||
}
|
||||
@@ -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>
|
||||
)
|
||||
}
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
)
|
||||
}
|
||||
@@ -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 }}>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
)
|
||||
}
|
||||
@@ -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>
|
||||
)
|
||||
}
|
||||
@@ -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>
|
||||
)
|
||||
}
|
||||
@@ -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>
|
||||
|
||||
@@ -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'
|
||||
@@ -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%);
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
Reference in new issue
Block a user