@atmos.build/ui 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/inline-alert.d.ts +4 -4
- package/dist/components/inline-alert.js +3 -2
- package/dist/components/metric-grid.d.ts +3 -1
- package/dist/components/metric-grid.js +3 -2
- package/dist/components/spec-strip.d.ts +5 -0
- package/dist/components/spec-strip.js +3 -2
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
import type { ReactNode } from 'react';
|
|
2
3
|
export type InlineAlertTone = 'error' | 'warning' | 'info';
|
|
3
|
-
export interface InlineAlertProps {
|
|
4
|
+
export interface InlineAlertProps extends Omit<React.ComponentProps<'div'>, 'children'> {
|
|
4
5
|
tone?: InlineAlertTone;
|
|
5
6
|
children: ReactNode;
|
|
6
7
|
onDismiss?: () => void;
|
|
7
8
|
dismissLabel?: string;
|
|
8
|
-
className?: string;
|
|
9
9
|
}
|
|
10
|
-
export declare function InlineAlert({ tone, children, onDismiss, dismissLabel, className, }: InlineAlertProps):
|
|
11
|
-
export declare function InlineNotice({ tone, children, className, }: Pick<InlineAlertProps, 'tone' | 'children' | 'className'>):
|
|
10
|
+
export declare function InlineAlert({ tone, children, onDismiss, dismissLabel, className, ...props }: InlineAlertProps): React.JSX.Element;
|
|
11
|
+
export declare function InlineNotice({ tone, children, className, }: Pick<InlineAlertProps, 'tone' | 'children' | 'className'>): React.JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from 'react';
|
|
3
4
|
import { AlertTriangle, Info, X } from 'lucide-react';
|
|
4
5
|
import { cn } from '../lib/cn.js';
|
|
5
6
|
import { Button } from './button.js';
|
|
@@ -8,9 +9,9 @@ const toneClass = {
|
|
|
8
9
|
warning: 'border-warning/30 bg-warning/15 text-warning',
|
|
9
10
|
info: 'border-info/30 bg-info/15 text-info',
|
|
10
11
|
};
|
|
11
|
-
export function InlineAlert({ tone = 'error', children, onDismiss, dismissLabel, className, }) {
|
|
12
|
+
export function InlineAlert({ tone = 'error', children, onDismiss, dismissLabel, className, ...props }) {
|
|
12
13
|
const Icon = tone === 'info' ? Info : AlertTriangle;
|
|
13
|
-
return (_jsxs("div", { role: "alert", "data-slot": "inline-alert", "data-tone": tone, className: cn('flex items-start gap-2 rounded-md border px-3 py-2 text-xs', toneClass[tone], className), children: [_jsx(Icon, { className: "mt-0.5 size-3.5 shrink-0", strokeWidth: 1.5, "aria-hidden": true }), _jsx("span", { className: "flex-1 leading-relaxed", children: children }), onDismiss ? (_jsx(Button, { type: "button", variant: "ghost", size: "icon-xs", onClick: onDismiss, "aria-label": dismissLabel, className: "-mr-1 size-4 rounded text-current opacity-80 hover:bg-transparent hover:opacity-100", children: _jsx(X, { className: "size-3", strokeWidth: 1.5 }) })) : null] }));
|
|
14
|
+
return (_jsxs("div", { role: "alert", "data-slot": "inline-alert", "data-tone": tone, className: cn('flex items-start gap-2 rounded-md border px-3 py-2 text-xs', toneClass[tone], className), ...props, children: [_jsx(Icon, { className: "mt-0.5 size-3.5 shrink-0", strokeWidth: 1.5, "aria-hidden": true }), _jsx("span", { className: "flex-1 leading-relaxed", children: children }), onDismiss ? (_jsx(Button, { type: "button", variant: "ghost", size: "icon-xs", onClick: onDismiss, "aria-label": dismissLabel, className: "-mr-1 size-4 rounded text-current opacity-80 hover:bg-transparent hover:opacity-100", children: _jsx(X, { className: "size-3", strokeWidth: 1.5 }) })) : null] }));
|
|
14
15
|
}
|
|
15
16
|
export function InlineNotice({ tone = 'info', children, className, }) {
|
|
16
17
|
return (_jsx(InlineAlert, { tone: tone, className: className, children: children }));
|
|
@@ -21,8 +21,10 @@ export interface MetricTileProps extends Omit<React.ComponentProps<'div'>, 'titl
|
|
|
21
21
|
suffix?: React.ReactNode;
|
|
22
22
|
hint?: React.ReactNode;
|
|
23
23
|
tone?: MetricTone;
|
|
24
|
+
/** What the value is changing from, rendered as "before → after". See SpecStripItem.from. */
|
|
25
|
+
from?: React.ReactNode;
|
|
24
26
|
}
|
|
25
|
-
export declare function MetricTile({ label, value, suffix, hint, tone, className, ...props }: MetricTileProps): React.JSX.Element;
|
|
27
|
+
export declare function MetricTile({ label, value, suffix, hint, from, tone, className, ...props }: MetricTileProps): React.JSX.Element;
|
|
26
28
|
export interface MetricBreakdownItem {
|
|
27
29
|
key: string;
|
|
28
30
|
label: React.ReactNode;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import * as React from 'react';
|
|
4
|
+
import { ArrowRight } from 'lucide-react';
|
|
4
5
|
import { cn } from '../lib/cn.js';
|
|
5
6
|
const TONE_TEXT = {
|
|
6
7
|
neutral: 'text-foreground',
|
|
@@ -18,8 +19,8 @@ const PANEL_PADDING = { none: '', sm: 'p-3', md: 'p-4' };
|
|
|
18
19
|
export function MetricPanel({ title, action, padding = 'md', className, children, ...props }) {
|
|
19
20
|
return (_jsxs("div", { "data-slot": "metric-panel", className: cn('bg-muted min-w-0', PANEL_PADDING[padding], className), ...props, children: [title || action ? (_jsxs("div", { className: cn('mb-3 flex items-center justify-between gap-2', padding === 'none' && 'px-3 pt-3'), children: [title ? _jsx("p", { className: "text-xs font-medium", children: title }) : _jsx("span", {}), action] })) : null, children] }));
|
|
20
21
|
}
|
|
21
|
-
export function MetricTile({ label, value, suffix, hint, tone = 'neutral', className, ...props }) {
|
|
22
|
-
return (_jsxs("div", { "data-slot": "metric-tile", "data-tone": tone, className: cn('bg-muted min-w-0 p-3', className), ...props, children: [label ? _jsx("p", { className: "text-muted-foreground truncate text-xs", children: label }) : null, _jsxs("p", { className: cn('text-2xl font-semibold tracking-tight tabular-nums', label ? 'mt-2' : '', TONE_TEXT[tone]), children: [value, suffix ? (_jsx("span", { className: "text-muted-foreground ml-1 text-xs font-normal", children: suffix })) : null] }), hint ? _jsx("p", { className: "text-muted-foreground mt-1 text-[11px] leading-snug", children: hint }) : null] }));
|
|
22
|
+
export function MetricTile({ label, value, suffix, hint, from, tone = 'neutral', className, ...props }) {
|
|
23
|
+
return (_jsxs("div", { "data-slot": "metric-tile", "data-tone": tone, className: cn('bg-muted min-w-0 p-3', className), ...props, children: [label ? _jsx("p", { className: "text-muted-foreground truncate text-xs", children: label }) : null, _jsxs("p", { className: cn('text-2xl font-semibold tracking-tight tabular-nums', label ? 'mt-2' : '', TONE_TEXT[tone]), children: [from !== undefined ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "text-muted-foreground font-normal", children: from }), _jsx(ArrowRight, { className: "text-muted-foreground mx-1.5 inline size-4 align-[-0.05em]", strokeWidth: 1.5, "aria-hidden": true })] })) : null, value, suffix ? (_jsx("span", { className: "text-muted-foreground ml-1 text-xs font-normal", children: suffix })) : null] }), hint ? _jsx("p", { className: "text-muted-foreground mt-1 text-[11px] leading-snug", children: hint }) : null] }));
|
|
23
24
|
}
|
|
24
25
|
const TONE_BAR = {
|
|
25
26
|
neutral: 'bg-foreground/35',
|
|
@@ -4,6 +4,11 @@ export interface SpecStripItem {
|
|
|
4
4
|
label: string;
|
|
5
5
|
value: React.ReactNode;
|
|
6
6
|
suffix?: React.ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* What the value is changing from. Present, the item reads "before → after", which is what a
|
|
9
|
+
* shape being upgraded is: the new number alone says what you get without saying what moved.
|
|
10
|
+
*/
|
|
11
|
+
from?: React.ReactNode;
|
|
7
12
|
}
|
|
8
13
|
export interface SpecStripProps extends Omit<React.ComponentProps<'div'>, 'children'> {
|
|
9
14
|
items: SpecStripItem[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from 'react';
|
|
4
|
+
import { ArrowRight } from 'lucide-react';
|
|
4
5
|
import { cn } from '../lib/cn.js';
|
|
5
6
|
import { Separator } from './separator.js';
|
|
6
7
|
/**
|
|
@@ -11,5 +12,5 @@ import { Separator } from './separator.js';
|
|
|
11
12
|
* stops meaning anything.
|
|
12
13
|
*/
|
|
13
14
|
export function SpecStrip({ items, className, ...props }) {
|
|
14
|
-
return (_jsx("div", { "data-slot": "spec-strip", className: cn('flex items-stretch gap-3', className), ...props, children: items.map((item, index) => (_jsxs(React.Fragment, { children: [index > 0 ? _jsx(Separator, { orientation: "vertical", className: "bg-border/60" }) : null, _jsxs("div", { className: "flex min-w-0 flex-1 flex-col items-center gap-1.5 py-1", children: [_jsx("span", { className: "text-muted-foreground [&_svg]:size-5", "aria-hidden": true, children: item.icon }), _jsxs("span", { className: "truncate text-[17px] font-medium tabular-nums", children: [item.value, item.suffix ? (_jsx("span", { className: "text-muted-foreground ml-1 text-[12px] font-normal", children: item.suffix })) : null] }), _jsx("span", { className: "text-muted-foreground truncate text-[11.5px]", children: item.label })] })] }, item.label))) }));
|
|
15
|
+
return (_jsx("div", { "data-slot": "spec-strip", className: cn('flex items-stretch gap-3', className), ...props, children: items.map((item, index) => (_jsxs(React.Fragment, { children: [index > 0 ? _jsx(Separator, { orientation: "vertical", className: "bg-border/60" }) : null, _jsxs("div", { className: "flex min-w-0 flex-1 flex-col items-center gap-1.5 py-1", children: [_jsx("span", { className: "text-muted-foreground [&_svg]:size-5", "aria-hidden": true, children: item.icon }), _jsxs("span", { className: "truncate text-[17px] font-medium tabular-nums", children: [item.from !== undefined ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "text-muted-foreground font-normal", children: item.from }), _jsx(ArrowRight, { className: "text-muted-foreground mx-1 inline size-3.5 align-[-0.1em]", strokeWidth: 1.5, "aria-hidden": true })] })) : null, item.value, item.suffix ? (_jsx("span", { className: "text-muted-foreground ml-1 text-[12px] font-normal", children: item.suffix })) : null] }), _jsx("span", { className: "text-muted-foreground truncate text-[11.5px]", children: item.label })] })] }, item.label))) }));
|
|
15
16
|
}
|