import { html, css, cssManager } from '@design.estate/dees-element'; import '@design.estate/dees-wcctools/demotools'; import './dees-panel.js'; import type { IStatsTile } from './dees-statsgrid.js'; export const demoFunc = () => { return html`
{ const output = document.querySelector('#action-output'); if (output) { output.textContent = 'Viewing revenue details: $125,420 (+12.5%)'; } } }, { name: 'Export Data', iconName: 'lucide:download', action: async () => { const output = document.querySelector('#action-output'); if (output) { output.textContent = 'Exporting revenue data to CSV...'; } } } ] }, { id: 'users', title: 'Active Users', value: 3847, type: 'number', icon: 'lucide:users', description: '324 new this week', actions: [ { name: 'View User List', iconName: 'lucide:list', action: async () => { const output = document.querySelector('#action-output'); if (output) { output.textContent = 'Opening user list...'; } } } ] }, { id: 'cpu', title: 'CPU Usage', value: 73, unit: '%', type: 'gauge', icon: 'lucide:cpu', gaugeOptions: { min: 0, max: 100, thresholds: [ { value: 0, color: 'hsl(142.1 76.2% 36.3%)' }, { value: 60, color: 'hsl(45.4 93.4% 47.5%)' }, { value: 80, color: 'hsl(0 84.2% 60.2%)' } ] } }, { id: 'storage', title: 'Storage Used', value: 65, type: 'percentage', icon: 'lucide:hard-drive', description: '650 GB of 1 TB', }, { id: 'latency', title: 'Response Time', value: 142, unit: 'ms', type: 'trend', icon: 'lucide:activity', trendData: [150, 145, 148, 142, 138, 140, 135, 145, 142], description: 'P95' }, { id: 'uptime', title: 'System Uptime', value: '99.95%', type: 'text', icon: 'lucide:check-circle', color: 'hsl(142.1 76.2% 36.3%)', description: 'Last 30 days' } ]} .gridActions=${[ { name: 'Refresh', iconName: 'lucide:refresh-cw', action: async () => { const grid = document.querySelector('dees-statsgrid'); if (grid) { grid.style.opacity = '0.5'; setTimeout(() => { grid.style.opacity = '1'; }, 300); } } }, { name: 'Export', iconName: 'lucide:share', action: async () => { const output = document.querySelector('#action-output'); if (output) { output.textContent = 'Exporting dashboard report...'; } } }, { name: 'Settings', iconName: 'lucide:settings', action: async () => { const output = document.querySelector('#action-output'); if (output) { output.textContent = 'Opening dashboard settings...'; } } } ]} .minTileWidth=${250} .gap=${16} >
Click on tile actions or grid actions to see the result...
Configuration Options
Each tile type supports different properties:
  • Number: value, unit, color, description
  • Gauge: value, unit, gaugeOptions (min, max, thresholds)
  • Percentage: value (0-100), color, description
  • Trend: value, unit, trendData array, description
  • Text: value (string), color, description

Compact Layout (180px tiles)

Spacious Layout (320px tiles)

{ const grid = document.querySelector('#interactive-grid') as any; if (!grid) return; const tile = grid.tiles.find((t: any) => t.id === 'counter'); tile.value = typeof tile.value === 'number' ? tile.value + 1 : 1; grid.tiles = [...grid.tiles]; } }, { name: 'Reset', iconName: 'lucide:rotate-ccw', action: async () => { const grid = document.querySelector('#interactive-grid') as any; if (!grid) return; const tile = grid.tiles.find((t: any) => t.id === 'counter'); tile.value = 0; grid.tiles = [...grid.tiles]; } } ] } ]} .gridActions=${[ { name: 'Start Live Updates', iconName: 'lucide:play', action: async function() { // Toggle live updates if (!(window as any).liveUpdateInterval) { (window as any).liveUpdateInterval = setInterval(() => { const grid = document.querySelector('#interactive-grid') as any; if (grid) { const tiles = [...grid.tiles]; // Update CPU gauge const cpuTile = tiles.find(t => t.id === 'live-cpu'); cpuTile.value = Math.max(0, Math.min(100, cpuTile.value + (Math.random() * 20 - 10))); // Update requests trend const requestsTile = tiles.find(t => t.id === 'live-requests'); const newValue = requestsTile.value + Math.round(Math.random() * 50 - 25); requestsTile.value = Math.max(800, newValue); requestsTile.trendData = [...requestsTile.trendData.slice(1), requestsTile.value]; // Update memory percentage const memoryTile = tiles.find(t => t.id === 'live-memory'); memoryTile.value = Math.max(0, Math.min(100, memoryTile.value + (Math.random() * 10 - 5))); grid.tiles = tiles; } }, 1000); this.name = 'Stop Live Updates'; this.iconName = 'lucide:pause'; } else { clearInterval((window as any).liveUpdateInterval); (window as any).liveUpdateInterval = null; this.name = 'Start Live Updates'; this.iconName = 'lucide:play'; } } } ]} .minTileWidth=${250} .gap=${16} >
${`const tiles: IStatsTile[] = [ { id: 'revenue', title: 'Total Revenue', value: 125420, unit: '$', type: 'number', icon: 'lucide:dollar-sign', description: '+12.5% from last month', actions: [ { name: 'View Details', iconName: 'lucide:trending-up', action: async () => { console.log('View revenue details'); } } ] }, { id: 'cpu', title: 'CPU Usage', value: 73, unit: '%', type: 'gauge', icon: 'lucide:cpu', gaugeOptions: { min: 0, max: 100, thresholds: [ { value: 0, color: 'hsl(142.1 76.2% 36.3%)' }, { value: 60, color: 'hsl(45.4 93.4% 47.5%)' }, { value: 80, color: 'hsl(0 84.2% 60.2%)' } ] } } ]; // Render the stats grid html\` console.log('Refresh') } ]} > \`;`}
`; };