aura-glass
Version:
A comprehensive glassmorphism design system for React applications with 142+ production-ready components
41 lines (38 loc) • 1.18 kB
JavaScript
'use client';
import { jsx } from 'react/jsx-runtime';
import { cn } from '../../lib/utilsComprehensive.js';
const DEFAULT_DATA = [0, 0];
function GlassSparkline({
data,
width = 120,
height = 32,
stroke = 'currentColor',
fill = 'none',
className,
...rest
}) {
const sparklineData = Array.isArray(data) && data.length ? data : DEFAULT_DATA;
const max = Math.max(...sparklineData);
const min = Math.min(...sparklineData);
const norm = v => height - 2 - (v - min) / (max - min || 1) * (height - 4);
const step = sparklineData.length > 1 ? (width - 4) / (sparklineData.length - 1) : 0;
const d = sparklineData.map((v, i) => `${i === 0 ? 'M' : 'L'} ${2 + i * step} ${norm(v)}`).join(' ');
return jsx("svg", {
"data-glass-component": true,
viewBox: `0 0 ${width} ${height}`,
width: width,
height: height,
className: cn('text-blue-300/90', className),
...rest,
children: jsx("path", {
d: d,
fill: fill,
stroke: stroke,
strokeWidth: 2,
strokeLinejoin: "round",
strokeLinecap: "round"
})
});
}
export { GlassSparkline, GlassSparkline as default };
//# sourceMappingURL=GlassSparkline.js.map