@siyahi/ui 0.1.9-next.35 → 0.1.9-next.37
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/DESIGN.md +80 -63
- package/README.md +10 -21
- package/THIRD_PARTY_NOTICES.md +15 -15
- package/agents/examples/chart-panels.tsx +0 -4
- package/agents/examples/metric-strip-headline.tsx +12 -0
- package/agents/examples/{section-cards-select.tsx → metric-strip-select.tsx} +5 -5
- package/agents/examples/metric-strip-trend.tsx +33 -0
- package/agents/examples/overview-dashboard.tsx +4 -4
- package/agents/examples/scatter-chart.tsx +0 -1
- package/agents/examples/stale-blocks.tsx +9 -9
- package/agents/examples/surfaces.tsx +1 -33
- package/agents/manifest.json +38 -53
- package/dist/components/registry/dashboardcn/kpi-row-card.d.ts +20 -6
- package/dist/components/registry/dashboardcn/kpi-row-card.js +52 -33
- package/dist/components/siyahi/callout.js +2 -1
- package/dist/components/siyahi/inline-code.d.ts +1 -1
- package/dist/components/siyahi/inline-code.js +1 -1
- package/dist/components/siyahi/page-header.js +1 -0
- package/dist/components/siyahi/panel-grid.d.ts +4 -6
- package/dist/components/siyahi/panel-grid.js +9 -12
- package/dist/components/siyahi/scatter-chart.d.ts +3 -3
- package/dist/components/siyahi/scatter-chart.js +6 -3
- package/dist/components/siyahi/siyahi-provider.d.ts +5 -15
- package/dist/components/siyahi/siyahi-provider.js +7 -17
- package/dist/index.d.ts +3 -4
- package/dist/index.js +3 -3
- package/dist/lib/chart-frame.d.ts +1 -1
- package/dist/lib/chart-frame.js +4 -2
- package/dist/lib/chart-series.d.ts +10 -2
- package/dist/lib/chart-series.js +10 -0
- package/dist/lib/fit-text.js +1 -1
- package/dist/lib/tone.d.ts +1 -1
- package/dist/lib/tone.js +1 -1
- package/package.json +2 -2
- package/registry.lock.json +0 -8
- package/styles/fallback-fonts.css +13 -13
- package/styles/fonts/m-plus-1-code-latin-ext-wght-normal.woff2 +0 -0
- package/styles/fonts/m-plus-1-code-latin-wght-normal.woff2 +0 -0
- package/styles/m-plus-1-code.css +21 -0
- package/styles/siyahi.css +166 -330
- package/agents/examples/section-cards-trend.tsx +0 -32
- package/agents/examples/section-cards.tsx +0 -48
- package/dist/components/registry/dashboard-01/section-cards.d.ts +0 -30
- package/dist/components/registry/dashboard-01/section-cards.js +0 -74
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Delta, SectionCards, Sparkline, useFormat, type SectionCard } from "@siyahi/ui";
|
|
2
|
-
|
|
3
|
-
export default function SectionCardsTrendExample() {
|
|
4
|
-
const { money, moneyCompact } = useFormat();
|
|
5
|
-
const items: SectionCard[] = [
|
|
6
|
-
{
|
|
7
|
-
label: "Revenue",
|
|
8
|
-
value: money(4512300),
|
|
9
|
-
badge: <Delta value={0.031} />,
|
|
10
|
-
trend: <Sparkline data={[3820000, 3950000, 4110000, 4020000, 4380000, 4512300]} />,
|
|
11
|
-
detail: "Month-end, last six months",
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
label: "Cash flow this year",
|
|
15
|
-
value: moneyCompact(-61200),
|
|
16
|
-
badge: <Delta value={-61200} format="money" />,
|
|
17
|
-
// A run of losses: the meaning colour, not a chart slot.
|
|
18
|
-
trend: <Sparkline data={[0, -8200, -14100, -30400, -52800, -61200]} color="var(--negative)" />,
|
|
19
|
-
detail: "Running total since April",
|
|
20
|
-
// The one figure on the page that needs a look, marked by the page: a falling cost would not be.
|
|
21
|
-
tone: "negative",
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
label: "Gift cards this year",
|
|
25
|
-
value: moneyCompact(38400),
|
|
26
|
-
badge: <Delta value={0.18} />,
|
|
27
|
-
trend: <Sparkline data={[4100, 0, 12800, 3300, 9900, 8300]} variant="line" curve="linear" />,
|
|
28
|
-
detail: "Sold each month",
|
|
29
|
-
},
|
|
30
|
-
];
|
|
31
|
-
return <SectionCards items={items} />;
|
|
32
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { Delta, SectionCards, type SectionCard, useFormat } from "@siyahi/ui";
|
|
2
|
-
|
|
3
|
-
export default function SectionCardsExample() {
|
|
4
|
-
const { money, moneyCompact } = useFormat();
|
|
5
|
-
const items: SectionCard[] = [
|
|
6
|
-
{
|
|
7
|
-
label: "Revenue",
|
|
8
|
-
value: money(4512300),
|
|
9
|
-
badge: <Delta value={0.031} />,
|
|
10
|
-
headline: "Up for the third month",
|
|
11
|
-
detail: "Paid orders, less refunds",
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
label: "Target",
|
|
15
|
-
value: money(4025000),
|
|
16
|
-
headline: "Set at the start of the quarter",
|
|
17
|
-
detail: "Across 4 stores",
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
label: "Ahead of target",
|
|
21
|
-
value: moneyCompact(487300),
|
|
22
|
-
badge: <Delta value={0.121} />,
|
|
23
|
-
headline: "Gross margin 14.2%",
|
|
24
|
-
detail: "Since April",
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
label: "Cash flow this year",
|
|
28
|
-
value: moneyCompact(-61200),
|
|
29
|
-
badge: <Delta value={-61200} format="money" />,
|
|
30
|
-
headline: "Two large inventory buys",
|
|
31
|
-
detail: "Before tax",
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
label: "Gift cards this year",
|
|
35
|
-
value: moneyCompact(38400),
|
|
36
|
-
badge: <Delta value={0.18} />,
|
|
37
|
-
headline: "Sold in 11 stores",
|
|
38
|
-
detail: "Paid at purchase",
|
|
39
|
-
},
|
|
40
|
-
];
|
|
41
|
-
return (
|
|
42
|
-
<div className="flex flex-col gap-6">
|
|
43
|
-
<SectionCards items={items.slice(0, 3)} />
|
|
44
|
-
<SectionCards items={items.slice(0, 4)} />
|
|
45
|
-
<SectionCards items={items} />
|
|
46
|
-
</div>
|
|
47
|
-
);
|
|
48
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import * as React$1 from "react";
|
|
2
|
-
//#region src/components/registry/dashboard-01/section-cards.d.ts
|
|
3
|
-
export interface SectionCard {
|
|
4
|
-
/** Muted label above the value. */
|
|
5
|
-
label: string;
|
|
6
|
-
value: React$1.ReactNode;
|
|
7
|
-
/** Outline badge, top right; usually a <Delta />. */
|
|
8
|
-
badge?: React$1.ReactNode;
|
|
9
|
-
/** A small chart under the value, usually a <Sparkline /> of the recent run. */
|
|
10
|
-
trend?: React$1.ReactNode;
|
|
11
|
-
/** Bold first footer line. */
|
|
12
|
-
headline?: React$1.ReactNode;
|
|
13
|
-
/** Muted second footer line. */
|
|
14
|
-
detail?: React$1.ReactNode;
|
|
15
|
-
/** In a picker, a tile that cannot be picked, such as one with nothing in it: faded, and its button disabled. */
|
|
16
|
-
disabled?: boolean | undefined;
|
|
17
|
-
/** Marks the tile as the exception on the page: a faint wash of the colour and an outline of it. */
|
|
18
|
-
tone?: "negative" | "warning" | undefined;
|
|
19
|
-
/** Marks the tile's data as old, with since when, such as "3 Nov": the tile greys out and says so. */
|
|
20
|
-
stale?: React$1.ReactNode;
|
|
21
|
-
}
|
|
22
|
-
export interface SectionCardsProps {
|
|
23
|
-
items: SectionCard[];
|
|
24
|
-
/** The label of the picked tile. */
|
|
25
|
-
selected?: string | undefined;
|
|
26
|
-
/** Makes each tile one button, so keep tile content non-interactive; gets the label of the tile picked. */
|
|
27
|
-
onSelect?: ((label: string) => void) | undefined;
|
|
28
|
-
}
|
|
29
|
-
export declare function SectionCards({ items, selected, onSelect }: SectionCardsProps): React$1.JSX.Element;
|
|
30
|
-
//#endregion
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { Badge } from "../../ui/badge.js";
|
|
3
|
-
import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "../../ui/card.js";
|
|
4
|
-
import { cn } from "../../../lib/utils.js";
|
|
5
|
-
import { StaleNote } from "../../siyahi/stale-note.js";
|
|
6
|
-
import { useSurface } from "../../siyahi/siyahi-provider.js";
|
|
7
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
import "react";
|
|
9
|
-
//#region src/components/registry/dashboard-01/section-cards.tsx
|
|
10
|
-
const COLUMNS = {
|
|
11
|
-
2: "@xl/main:grid-cols-2",
|
|
12
|
-
3: "@3xl/main:grid-cols-3",
|
|
13
|
-
4: "@xl/main:grid-cols-2 @5xl/main:grid-cols-4",
|
|
14
|
-
5: "@3xl/main:grid-cols-3 @7xl/main:grid-cols-5",
|
|
15
|
-
6: "@3xl/main:grid-cols-3"
|
|
16
|
-
};
|
|
17
|
-
function SectionCards({ items, selected, onSelect }) {
|
|
18
|
-
const surface = useSurface();
|
|
19
|
-
const ruled = surface === "ruled";
|
|
20
|
-
return /* @__PURE__ */ jsx("div", {
|
|
21
|
-
"data-surface": surface,
|
|
22
|
-
className: cn("@container/main", ruled && "overflow-hidden border-y"),
|
|
23
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
24
|
-
className: cn("grid grid-cols-1", ruled ? "-me-px -mb-px bg-card" : surface === "open" ? "gap-4" : "gap-2", COLUMNS[items.length] ?? COLUMNS[4]),
|
|
25
|
-
children: items.map((item) => /* @__PURE__ */ jsx("div", {
|
|
26
|
-
"data-slot": "section-card",
|
|
27
|
-
className: cn("min-w-0", ruled && "border-e border-b"),
|
|
28
|
-
children: /* @__PURE__ */ jsxs(Card, {
|
|
29
|
-
"data-tone": item.tone,
|
|
30
|
-
"data-stale": item.stale ? "" : void 0,
|
|
31
|
-
className: cn("@container/card h-full [--card-spacing:--spacing(3)]", onSelect && "relative", item.label === selected && "ring-2 ring-primary!", item.label === selected && ruled && "ring-inset", onSelect && item.disabled && "opacity-60"),
|
|
32
|
-
children: [
|
|
33
|
-
onSelect && /* @__PURE__ */ jsx("button", {
|
|
34
|
-
type: "button",
|
|
35
|
-
"aria-label": item.label,
|
|
36
|
-
"aria-pressed": item.label === selected,
|
|
37
|
-
disabled: item.disabled,
|
|
38
|
-
onClick: () => onSelect(item.label),
|
|
39
|
-
className: "absolute inset-0 z-10 rounded-[inherit] outline-none focus-visible:ring-3 focus-visible:ring-ring focus-visible:ring-inset"
|
|
40
|
-
}),
|
|
41
|
-
/* @__PURE__ */ jsxs(CardHeader, { children: [
|
|
42
|
-
/* @__PURE__ */ jsx(CardDescription, {
|
|
43
|
-
className: "font-mono text-2xs tracking-wider uppercase",
|
|
44
|
-
children: item.label
|
|
45
|
-
}),
|
|
46
|
-
item.stale && /* @__PURE__ */ jsx(StaleNote, { since: item.stale }),
|
|
47
|
-
/* @__PURE__ */ jsx(CardTitle, {
|
|
48
|
-
className: "text-2xl font-semibold tabular-nums",
|
|
49
|
-
children: item.value
|
|
50
|
-
}),
|
|
51
|
-
item.badge && /* @__PURE__ */ jsx(CardAction, { children: /* @__PURE__ */ jsx(Badge, {
|
|
52
|
-
variant: "outline",
|
|
53
|
-
children: item.badge
|
|
54
|
-
}) })
|
|
55
|
-
] }),
|
|
56
|
-
item.trend && /* @__PURE__ */ jsx(CardContent, { children: item.trend }),
|
|
57
|
-
(item.headline || item.detail) && /* @__PURE__ */ jsxs(CardFooter, {
|
|
58
|
-
className: "flex-col items-start gap-1 font-mono text-2xs tracking-wider uppercase",
|
|
59
|
-
children: [item.headline && /* @__PURE__ */ jsx("div", {
|
|
60
|
-
className: "flex flex-wrap gap-2 font-medium",
|
|
61
|
-
children: item.headline
|
|
62
|
-
}), item.detail && /* @__PURE__ */ jsx("div", {
|
|
63
|
-
className: "text-muted-foreground",
|
|
64
|
-
children: item.detail
|
|
65
|
-
})]
|
|
66
|
-
})
|
|
67
|
-
]
|
|
68
|
-
})
|
|
69
|
-
}, item.label))
|
|
70
|
-
})
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
//#endregion
|
|
74
|
-
export { SectionCards };
|