@momoi-labs/kiso-react 0.27.0 → 0.29.0
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/accent-selector.d.ts +1 -1
- package/dist/accent-selector.js +1 -0
- package/dist/app-shell.d.ts +1 -0
- package/dist/app-shell.js +4 -4
- package/dist/chart-sync.d.ts +1 -0
- package/dist/chart-sync.js +15 -0
- package/dist/chart.d.ts +9 -3
- package/dist/chart.js +17 -9
- package/dist/code-block.d.ts +5 -1
- package/dist/code-block.js +9 -6
- package/dist/feature-grid.d.ts +7 -0
- package/dist/feature-grid.js +11 -0
- package/dist/feature-list.d.ts +6 -0
- package/dist/feature-list.js +10 -0
- package/dist/header.d.ts +3 -2
- package/dist/header.js +2 -2
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/perspective-stack.d.ts +5 -0
- package/dist/perspective-stack.js +10 -0
- package/dist/site-footer.d.ts +5 -0
- package/dist/site-footer.js +7 -0
- package/dist/site-header.d.ts +18 -0
- package/dist/site-header.js +69 -0
- package/dist/site-heading.d.ts +11 -0
- package/dist/site-heading.js +8 -0
- package/dist/site-section.d.ts +19 -0
- package/dist/site-section.js +23 -0
- package/dist/styles.css +1 -1
- package/dist/tabs.d.ts +9 -2
- package/dist/tabs.js +4 -4
- package/dist/window-frame.d.ts +7 -0
- package/dist/window-frame.js +8 -0
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const accents: readonly ["violet", "terracotta", "teal", "cobalt", "nocturne", "tangerine", "red", "gold", "lime", "plum", "stone", "steel"];
|
|
1
|
+
export declare const accents: readonly ["violet", "terracotta", "teal", "cobalt", "nocturne", "tangerine", "red", "gold", "lime", "plum", "stone", "steel", "snes"];
|
|
2
2
|
export type Accent = (typeof accents)[number];
|
|
3
3
|
export declare function AccentSelector({ accent, onChange, options, preview, }: {
|
|
4
4
|
accent: string;
|
package/dist/accent-selector.js
CHANGED
package/dist/app-shell.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ type ApplicationShellSharedProps = Omit<React.ComponentProps<typeof AppShell>, "
|
|
|
29
29
|
primaryAction?: React.ReactNode;
|
|
30
30
|
header?: React.ReactNode;
|
|
31
31
|
headerVariant?: React.ComponentProps<typeof Header>["variant"];
|
|
32
|
+
headerSize?: React.ComponentProps<typeof Header>["size"];
|
|
32
33
|
panel?: React.ReactNode;
|
|
33
34
|
children: React.ReactNode;
|
|
34
35
|
};
|
package/dist/app-shell.js
CHANGED
|
@@ -37,12 +37,12 @@ function ApplicationShellNavigation({ navigation, navigationLabel, collapsible =
|
|
|
37
37
|
}
|
|
38
38
|
function ApplicationShell(props) {
|
|
39
39
|
if (props.layout === "topbar") {
|
|
40
|
-
const { brand, primaryAction, header, headerVariant, panel, bottomNav, children, layout: _layout, ...shellProps } = props;
|
|
41
|
-
return (_jsxs(AppShell, { ...shellProps, "data-layout": "topbar", children: [_jsxs(AppShellMain, { children: [_jsxs(Header, { variant: headerVariant, children: [brand, primaryAction, header] }), children] }), panel, bottomNav] }));
|
|
40
|
+
const { brand, primaryAction, header, headerVariant, headerSize, panel, bottomNav, children, layout: _layout, ...shellProps } = props;
|
|
41
|
+
return (_jsxs(AppShell, { ...shellProps, "data-layout": "topbar", children: [_jsxs(AppShellMain, { children: [_jsxs(Header, { variant: headerVariant, size: headerSize, children: [brand, primaryAction, header] }), children] }), panel, bottomNav] }));
|
|
42
42
|
}
|
|
43
43
|
return _jsx(ApplicationShellSidebar, { ...props });
|
|
44
44
|
}
|
|
45
|
-
function ApplicationShellSidebar({ brand, primaryAction, navigation, navigationLabel = "Primary", footer, header, headerVariant, panel, children, layout: _layout, collapsible = false, togglePlacement = "sidebar", collapsed, defaultCollapsed = false, onCollapsedChange, drawerOpen: controlledDrawer, onDrawerOpenChange, phoneNavigation = "drawer", ...shellProps }) {
|
|
45
|
+
function ApplicationShellSidebar({ brand, primaryAction, navigation, navigationLabel = "Primary", footer, header, headerVariant, headerSize, panel, children, layout: _layout, collapsible = false, togglePlacement = "sidebar", collapsed, defaultCollapsed = false, onCollapsedChange, drawerOpen: controlledDrawer, onDrawerOpenChange, phoneNavigation = "drawer", ...shellProps }) {
|
|
46
46
|
const [internalCollapsed, setInternalCollapsed] = React.useState(defaultCollapsed);
|
|
47
47
|
// Below 1024px the sidebar is not in the page; the same brand, action,
|
|
48
48
|
// navigation and footer open in a drawer from the header instead.
|
|
@@ -73,7 +73,7 @@ function ApplicationShellSidebar({ brand, primaryAction, navigation, navigationL
|
|
|
73
73
|
}
|
|
74
74
|
const toggle = collapsible ? (_jsx(Button, { ref: toggleRef, variant: "ghost", size: "sm", className: "sidebar-toggle btn-icon", "aria-controls": sidebarId, "aria-expanded": !isCollapsed, "aria-label": isCollapsed ? "Expand sidebar" : "Collapse sidebar", title: isCollapsed ? "Expand sidebar" : "Collapse sidebar", onClick: toggleSidebar, children: isCollapsed ? _jsx(PanelLeftOpen, { className: "icon", "aria-hidden": "true" }) : _jsx(PanelLeftClose, { className: "icon", "aria-hidden": "true" }) })) : null;
|
|
75
75
|
const menu = (_jsx(Button, { ref: menuRef, variant: "ghost", size: "sm", className: "app-shell-menu btn-icon", "aria-expanded": drawerOpen, "aria-label": "Open navigation", title: "Navigation", onClick: () => setDrawerOpen(true), children: _jsx(Menu, { className: "icon", "aria-hidden": "true" }) }));
|
|
76
|
-
return (_jsxs(AppShell, { ...shellProps, "data-phone-drawer": "true", "data-phone-navigation": phoneNavigation, children: [_jsxs(Sidebar, { ref: sidebarRef, id: sidebarId, collapsed: isCollapsed, children: [_jsx(SidebarHeader, { className: collapsible && togglePlacement === "sidebar" ? "sidebar-header-collapsible" : undefined, children: collapsible ? _jsxs(_Fragment, { children: [_jsxs("div", { className: "sidebar-expanded-content", children: [brand, primaryAction] }), togglePlacement === "sidebar" && toggle] }) : _jsxs(_Fragment, { children: [brand, primaryAction] }) }), _jsx(SidebarBody, { children: _jsx(ApplicationShellNavigation, { navigation: navigation, navigationLabel: navigationLabel, collapsible: collapsible }) }), footer && _jsx(SidebarFooter, { className: collapsible ? "sidebar-expanded-content" : undefined, children: footer })] }), _jsxs(AppShellMain, { children: [_jsxs(Header, { variant: headerVariant, "data-phone-only": header || (collapsible && togglePlacement === "header") ? undefined : "true", children: [menu, phoneNavigation === "bottom" && _jsx("div", { className: "app-shell-phone-brand", children: brand }), phoneNavigation === "bottom" && primaryAction && _jsx("div", { className: "app-shell-phone-action", children: primaryAction }), togglePlacement === "header" && toggle, header] }), children] }), panel, _jsx(Drawer, { open: drawerOpen, onOpenChange: setDrawerOpen, children: _jsxs(DrawerContent, { placement: "side", className: "app-shell-drawer", onCloseAutoFocus: (event) => {
|
|
76
|
+
return (_jsxs(AppShell, { ...shellProps, "data-phone-drawer": "true", "data-phone-navigation": phoneNavigation, children: [_jsxs(Sidebar, { ref: sidebarRef, id: sidebarId, collapsed: isCollapsed, children: [_jsx(SidebarHeader, { className: collapsible && togglePlacement === "sidebar" ? "sidebar-header-collapsible" : undefined, children: collapsible ? _jsxs(_Fragment, { children: [_jsxs("div", { className: "sidebar-expanded-content", children: [brand, primaryAction] }), togglePlacement === "sidebar" && toggle] }) : _jsxs(_Fragment, { children: [brand, primaryAction] }) }), _jsx(SidebarBody, { children: _jsx(ApplicationShellNavigation, { navigation: navigation, navigationLabel: navigationLabel, collapsible: collapsible }) }), footer && _jsx(SidebarFooter, { className: collapsible ? "sidebar-expanded-content" : undefined, children: footer })] }), _jsxs(AppShellMain, { children: [_jsxs(Header, { variant: headerVariant, size: headerSize, "data-phone-only": header || (collapsible && togglePlacement === "header") ? undefined : "true", children: [menu, phoneNavigation === "bottom" && _jsx("div", { className: "app-shell-phone-brand", children: brand }), phoneNavigation === "bottom" && primaryAction && _jsx("div", { className: "app-shell-phone-action", children: primaryAction }), togglePlacement === "header" && toggle, header] }), children] }), panel, _jsx(Drawer, { open: drawerOpen, onOpenChange: setDrawerOpen, children: _jsxs(DrawerContent, { placement: "side", className: "app-shell-drawer", onCloseAutoFocus: (event) => {
|
|
77
77
|
event.preventDefault();
|
|
78
78
|
menuRef.current?.focus();
|
|
79
79
|
}, children: [_jsxs(DrawerHeader, { children: [_jsx(VisuallyHidden.Root, { asChild: true, children: _jsx(DrawerTitle, { children: "Navigation" }) }), brand] }), _jsxs(DrawerBody, { onClick: (event) => {
|
package/dist/chart-sync.d.ts
CHANGED
|
@@ -10,3 +10,4 @@ export declare function toggleChartPin(id: string, timestamp: number): void;
|
|
|
10
10
|
export declare function clearChartPin(id: string): void;
|
|
11
11
|
export declare function chartPinned(id: string): number | null;
|
|
12
12
|
export declare function useChartSync(id: string): ChartSyncState;
|
|
13
|
+
export declare function useChartPinned(id: string): number | null;
|
package/dist/chart-sync.js
CHANGED
|
@@ -46,3 +46,18 @@ export function useChartSync(id) {
|
|
|
46
46
|
const snapshot = React.useCallback(() => groups.get(id)?.state ?? idle, [id]);
|
|
47
47
|
return React.useSyncExternalStore(subscribe, snapshot, () => idle);
|
|
48
48
|
}
|
|
49
|
+
/* Only the pinned timestamp: a spark chart labels it on its time axis, and
|
|
50
|
+
must not render again on every hovered sample. */
|
|
51
|
+
export function useChartPinned(id) {
|
|
52
|
+
const subscribe = React.useCallback((listener) => {
|
|
53
|
+
const found = group(id);
|
|
54
|
+
found.listeners.add(listener);
|
|
55
|
+
return () => {
|
|
56
|
+
found.listeners.delete(listener);
|
|
57
|
+
if (!found.listeners.size && groups.get(id) === found)
|
|
58
|
+
groups.delete(id);
|
|
59
|
+
};
|
|
60
|
+
}, [id]);
|
|
61
|
+
const snapshot = React.useCallback(() => groups.get(id)?.state.pinned ?? null, [id]);
|
|
62
|
+
return React.useSyncExternalStore(subscribe, snapshot, () => null);
|
|
63
|
+
}
|
package/dist/chart.d.ts
CHANGED
|
@@ -18,8 +18,14 @@ export type ChartProps = Omit<React.ComponentProps<"figure">, "children"> & {
|
|
|
18
18
|
series: readonly ChartSeries[];
|
|
19
19
|
label: string;
|
|
20
20
|
variant?: "line" | "stacked-area";
|
|
21
|
-
/** Overrides the inherited data-chart-layout, otherwise standard.
|
|
22
|
-
|
|
21
|
+
/** Overrides the inherited data-chart-layout, otherwise standard. `spark`
|
|
22
|
+
draws the plot alone: no value axis, grid or legend, and a time axis
|
|
23
|
+
with the first, the pinned and the last time. */
|
|
24
|
+
layout?: ChartLayout | "spark";
|
|
25
|
+
/** A reading under the title, such as the value at the pinned time. */
|
|
26
|
+
headline?: React.ReactNode;
|
|
27
|
+
/** A timestamp to pin when the group has no pin yet. */
|
|
28
|
+
defaultPinned?: number;
|
|
23
29
|
/** Overrides the inherited data-chart-legend, otherwise table. */
|
|
24
30
|
legend?: ChartLegendPlacement;
|
|
25
31
|
/** Columns of the table legend, in order. Default min, max, avg and current. */
|
|
@@ -44,4 +50,4 @@ export type ChartProps = Omit<React.ComponentProps<"figure">, "children"> & {
|
|
|
44
50
|
/** Localizes the fixed text. Chart passes the legend's keys on to ChartLegend. */
|
|
45
51
|
labels?: Partial<typeof defaultLabels> & NonNullable<ChartLegendProps["labels"]>;
|
|
46
52
|
} & ChartTreatmentProps;
|
|
47
|
-
export declare function Chart({ data, series, label, variant, layout:
|
|
53
|
+
export declare function Chart({ data, series, label, variant, layout: requestedLayout, legend: legendProp, summary, headline, defaultPinned, highlightSeries, onHighlightSeriesChange, height: heightProp, syncId, formatTime: formatTimeProp, timeZone, locale, formatValue, min, max, onRangeSelect, labels, chartStyle, chartLine, chartFill, ref, className, onKeyDown, ...props }: ChartProps): React.JSX.Element;
|
package/dist/chart.js
CHANGED
|
@@ -7,7 +7,7 @@ import { Area, CartesianGrid, ComposedChart, Line, ResponsiveContainer, Tooltip,
|
|
|
7
7
|
import { ChartLegend, ChartSeriesLabel } from "./chart-legend.js";
|
|
8
8
|
import { ChartDot, ChartPattern, pixelCurve, useChartPresentation, useChartStyle } from "./chart-style.js";
|
|
9
9
|
import { useChartFill } from "./chart-fill.js";
|
|
10
|
-
import { chartPinned, clearChartPin, setChartHover, toggleChartPin, useChartSync } from "./chart-sync.js";
|
|
10
|
+
import { chartPinned, clearChartPin, setChartHover, toggleChartPin, useChartPinned, useChartSync } from "./chart-sync.js";
|
|
11
11
|
import { chartColor, chartSlot, formatChartTime, formatChartValue, measured, validateChart } from "./chart-data.js";
|
|
12
12
|
import { dateFormat, validTimeZone } from "./time-zone.js";
|
|
13
13
|
const defaultLabels = {
|
|
@@ -17,8 +17,10 @@ const defaultLabels = {
|
|
|
17
17
|
summary: (label) => `${label}: summary`,
|
|
18
18
|
samples: (label, timeZone) => `${label}: collected samples, timestamps in ${timeZone}`,
|
|
19
19
|
};
|
|
20
|
-
export function Chart({ data, series, label, variant = "line", layout:
|
|
20
|
+
export function Chart({ data, series, label, variant = "line", layout: requestedLayout, legend: legendProp, summary, headline, defaultPinned, highlightSeries, onHighlightSeriesChange, height: heightProp, syncId, formatTime: formatTimeProp, timeZone, locale, formatValue = formatChartValue, min, max, onRangeSelect, labels, chartStyle, chartLine, chartFill, ref, className, onKeyDown, ...props }) {
|
|
21
21
|
const id = React.useId();
|
|
22
|
+
const spark = requestedLayout === "spark";
|
|
23
|
+
const layoutProp = spark ? "standard" : requestedLayout;
|
|
22
24
|
const text = { ...defaultLabels, ...labels };
|
|
23
25
|
const zoned = timeZone !== undefined || locale !== undefined;
|
|
24
26
|
const zone = timeZone ?? "UTC";
|
|
@@ -39,7 +41,7 @@ export function Chart({ data, series, label, variant = "line", layout: layoutPro
|
|
|
39
41
|
const legend = presentation.legend;
|
|
40
42
|
// An inherited split cannot hold a stack, so a stacked chart keeps one plot.
|
|
41
43
|
const layout = !layoutProp && presentation.layout === "split" && variant === "stacked-area" ? "standard" : presentation.layout;
|
|
42
|
-
const defaultHeight = layout === "compact" ? 165 : layout === "split" ? 90 : 200;
|
|
44
|
+
const defaultHeight = spark ? 80 : layout === "compact" ? 165 : layout === "split" ? 90 : 200;
|
|
43
45
|
// In an expanded DashboardPanel the plot takes the room the dialog leaves.
|
|
44
46
|
const expanded = useChartFill(frame, `${label}|${layout}|${legend}`, defaultHeight);
|
|
45
47
|
const height = heightProp ?? expanded.height ?? defaultHeight;
|
|
@@ -49,6 +51,11 @@ export function Chart({ data, series, label, variant = "line", layout: layoutPro
|
|
|
49
51
|
// through a Kiso store, not Recharts' syncId. An expanded Chart, or one
|
|
50
52
|
// without a syncId, keeps a group of its own.
|
|
51
53
|
const group = (expanded.fill ? undefined : syncId) ?? id;
|
|
54
|
+
const pinned = useChartPinned(group);
|
|
55
|
+
React.useEffect(() => {
|
|
56
|
+
if (defaultPinned !== undefined && chartPinned(group) === null)
|
|
57
|
+
toggleChartPin(group, defaultPinned);
|
|
58
|
+
}, [group, defaultPinned]);
|
|
52
59
|
const [source] = React.useState(() => ({}));
|
|
53
60
|
const inspected = React.useRef(null);
|
|
54
61
|
const pick = React.useRef(null);
|
|
@@ -158,8 +165,9 @@ export function Chart({ data, series, label, variant = "line", layout: layoutPro
|
|
|
158
165
|
paintDrag();
|
|
159
166
|
},
|
|
160
167
|
};
|
|
161
|
-
const renderPlot = (indices, lane) => _jsxs("div", { className: "chart-plot", style: { height }, "data-range-select": selectRange ? "" : undefined, children: [_jsx(ResponsiveContainer, { width: "100%", height: "100%", children: _jsxs(ComposedChart, { data: plot, syncId: layout === "split" ? id : undefined, syncMethod: "value", accessibilityLayer: true, "aria-label": lane ? `${label}: ${lane.label}` : label, "aria-describedby": `${id}-help`, margin: { top: 8, right: 20, bottom: 0, left: 0 }, ...pointerHandlers, children: [_jsx("defs", { children: indices.map(index => _jsx(ChartPattern, { id: `${id}-fill-${index}`, color: chartColor(chartSlot(series[index], index)), fill: fill }, series[index].key)) }), _jsx(CartesianGrid, { vertical: false, stroke: "var(--color-border)", strokeWidth: 0.5 }), _jsx(XAxis, { dataKey: "timestamp", type: "number", domain: ["dataMin", "dataMax"], scale: "time", axisLine: false, tickLine: false, tickFormatter: formatTime, minTickGap: 48,
|
|
162
|
-
:
|
|
168
|
+
const renderPlot = (indices, lane) => _jsxs("div", { className: "chart-plot", style: { height }, "data-range-select": selectRange ? "" : undefined, children: [_jsx(ResponsiveContainer, { width: "100%", height: "100%", children: _jsxs(ComposedChart, { data: plot, syncId: layout === "split" ? id : undefined, syncMethod: "value", accessibilityLayer: true, "aria-label": lane ? `${label}: ${lane.label}` : label, "aria-describedby": `${id}-help`, margin: spark ? { top: 4, right: 0, bottom: 0, left: 0 } : { top: 8, right: 20, bottom: 0, left: 0 }, ...pointerHandlers, children: [_jsx("defs", { children: indices.map(index => _jsx(ChartPattern, { id: `${id}-fill-${index}`, color: chartColor(chartSlot(series[index], index)), fill: fill }, series[index].key)) }), !spark && _jsx(CartesianGrid, { vertical: false, stroke: "var(--color-border)", strokeWidth: 0.5 }), _jsx(XAxis, { dataKey: "timestamp", type: "number", domain: ["dataMin", "dataMax"], scale: "time", axisLine: false, tickLine: false, tickFormatter: formatTime, minTickGap: spark ? 8 : 48, ticks: spark && data.length ? [...new Set([data[0].timestamp, ...(pinned !== null ? [pinned] : []), data.at(-1).timestamp])] : undefined, interval: spark ? 0 : undefined, tick: spark ? (tick) => _jsx("text", { x: tick.x, y: tick.y, dy: 12, textAnchor: tick.payload?.value === data[0]?.timestamp ? "start" : tick.payload?.value === data.at(-1)?.timestamp ? "end" : "middle", className: "chart-spark-tick", "data-pinned": tick.payload?.value === pinned || undefined, children: formatTime(tick.payload?.value ?? 0) })
|
|
169
|
+
: { fill: "var(--color-muted-foreground)" } }), _jsx(YAxis, { domain: layout === "split" ? [splitMin, splitMax]
|
|
170
|
+
: [min ?? (variant === "stacked-area" ? 0 : "auto"), max ?? "auto"], tickCount: 3, axisLine: false, tickLine: false, hide: spark, tickFormatter: formatValue, tick: { fill: "var(--color-muted-foreground)" }, width: 56 }), _jsx(Tooltip, { filterNull: false, isAnimationActive: false, cursor: { stroke: "var(--color-border-strong)", strokeDasharray: "3 3" }, content: ({ active, label: timestamp }) => _jsx(ChartReadout, { active: active, timestamp: Number(timestamp), data: data, series: series, formatTime: formatTime, displayValue: displayValue, sidebar: legend === "sidebar", onInspect: !lane || indices[0] === 0 ? inspect : undefined }) }), indices.map(index => {
|
|
163
171
|
const item = series[index];
|
|
164
172
|
const slot = chartSlot(item, index);
|
|
165
173
|
const dimmed = highlighted !== null && item.key !== highlighted;
|
|
@@ -180,7 +188,7 @@ export function Chart({ data, series, label, variant = "line", layout: layoutPro
|
|
|
180
188
|
return variant === "stacked-area" || fill !== "none"
|
|
181
189
|
? _jsx(Area, { ...common, type: curve, stackId: variant === "stacked-area" ? "total" : undefined, fill: textured ? `url(#${id}-fill-${index})` : chartColor(slot), fillOpacity: dimmed ? 0.06 : 0.2 }, item.key)
|
|
182
190
|
: _jsx(Line, { ...common, type: curve }, item.key);
|
|
183
|
-
}), _jsx(ChartSyncMarker, { group: group, source: source, plot: plot, data: data, series: series, indices: indices, stacked: variant === "stacked-area", line: line, highlighted: highlighted, pick: !lane || indices[0] === 0 ? pick : undefined, readout: legend !== "sidebar" && (!lane || indices[0] === 0), formatTime: formatTime, displayValue: displayValue })] }) }), selectRange && _jsx("div", { className: "chart-range-band", hidden: true, "aria-hidden": "true" })] });
|
|
191
|
+
}), _jsx(ChartSyncMarker, { group: group, source: source, plot: plot, data: data, series: series, indices: indices, stacked: variant === "stacked-area", line: line, highlighted: highlighted, pick: !lane || indices[0] === 0 ? pick : undefined, readout: !spark && legend !== "sidebar" && (!lane || indices[0] === 0), formatTime: formatTime, displayValue: displayValue })] }) }), selectRange && _jsx("div", { className: "chart-range-band", hidden: true, "aria-hidden": "true" })] });
|
|
184
192
|
const legendProps = { data, series, label: text.summary(label), variant: legend, summary, formatValue, formatTime,
|
|
185
193
|
highlightSeries: highlighted, onHighlightSeriesChange: highlight, labels };
|
|
186
194
|
// Only a sidebar follows the inspected timestamp, so only it subscribes.
|
|
@@ -193,7 +201,7 @@ export function Chart({ data, series, label, variant = "line", layout: layoutPro
|
|
|
193
201
|
return ref(element);
|
|
194
202
|
if (ref)
|
|
195
203
|
ref.current = element;
|
|
196
|
-
}, "data-slot": "chart", "data-layout": layout, "data-legend": legend, "data-line": line, "data-fill": fill, className: cn("framed-chart", className), "aria-labelledby": `${id}-title`, onKeyDown: event => {
|
|
204
|
+
}, "data-slot": "chart", "data-layout": spark ? "spark" : layout, "data-legend": legend, "data-line": line, "data-fill": fill, className: cn("framed-chart", className), "aria-labelledby": `${id}-title`, onKeyDown: event => {
|
|
197
205
|
onKeyDown?.(event);
|
|
198
206
|
if (event.defaultPrevented || drag.current)
|
|
199
207
|
return;
|
|
@@ -206,8 +214,8 @@ export function Chart({ data, series, label, variant = "line", layout: layoutPro
|
|
|
206
214
|
event.preventDefault();
|
|
207
215
|
toggleChartPin(group, inspected.current);
|
|
208
216
|
}
|
|
209
|
-
}, children: [_jsx("figcaption", { id: `${id}-title`, className: "t-h3", children: label }), _jsx("p", { id: `${id}-help`, className: "chart-help", children: text.help }), _jsxs("div", { className: "chart-body", children: [_jsx("div", { className: "chart-plots", children: hasData ? layout === "split" ? series.map((item, index) => _jsxs("div", { className: "chart-lane", children: [_jsxs("div", { className: "chart-lane-heading", children: [_jsx(ChartSeriesLabel, { series: item, index: index }), _jsx("span", { children: displayValue(data.at(-1)?.values[item.key]) })] }), renderPlot([index], item)] }, item.key)) : renderPlot(series.map((_, index) => index))
|
|
210
|
-
: _jsx("div", { className: "chart-empty hatch", style: { minHeight: height }, children: text.empty }) }), legend === "sidebar" && legendContent] }), legend !== "sidebar" && legendContent, _jsxs("details", { className: "disclosure chart-values", children: [_jsx("summary", { children: text.values }), _jsx("div", { className: "chart-table-scroll", children: _jsxs("table", { className: "chart-table", children: [_jsx("caption", { children: text.samples(label, zone) }), _jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { scope: "col", children: text.timestamp }), series.map(item => _jsx("th", { scope: "col", children: item.label }, item.key))] }) }), _jsx("tbody", { children: data.map(sample => _jsxs("tr", { children: [_jsx("th", { scope: "row", children: exactTime(sample.timestamp) }), series.map(item => _jsx("td", { children: measured(sample.values[item.key]) ? String(sample.values[item.key]) : text.notCollected }, item.key))] }, sample.timestamp)) })] }) })] })] });
|
|
217
|
+
}, children: [_jsx("figcaption", { id: `${id}-title`, className: "t-h3", children: label }), headline != null && _jsx("div", { className: "chart-headline", children: headline }), _jsx("p", { id: `${id}-help`, className: "chart-help", children: text.help }), _jsxs("div", { className: "chart-body", children: [_jsx("div", { className: "chart-plots", children: hasData ? layout === "split" ? series.map((item, index) => _jsxs("div", { className: "chart-lane", children: [_jsxs("div", { className: "chart-lane-heading", children: [_jsx(ChartSeriesLabel, { series: item, index: index }), _jsx("span", { children: displayValue(data.at(-1)?.values[item.key]) })] }), renderPlot([index], item)] }, item.key)) : renderPlot(series.map((_, index) => index))
|
|
218
|
+
: _jsx("div", { className: "chart-empty hatch", style: { minHeight: height }, children: text.empty }) }), !spark && legend === "sidebar" && legendContent] }), !spark && legend !== "sidebar" && legendContent, _jsxs("details", { className: cn("disclosure chart-values", spark && "chart-help"), open: spark || undefined, children: [_jsx("summary", { children: text.values }), _jsx("div", { className: "chart-table-scroll", children: _jsxs("table", { className: "chart-table", children: [_jsx("caption", { children: text.samples(label, zone) }), _jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { scope: "col", children: text.timestamp }), series.map(item => _jsx("th", { scope: "col", children: item.label }, item.key))] }) }), _jsx("tbody", { children: data.map(sample => _jsxs("tr", { children: [_jsx("th", { scope: "row", children: exactTime(sample.timestamp) }), series.map(item => _jsx("td", { children: measured(sample.values[item.key]) ? String(sample.values[item.key]) : text.notCollected }, item.key))] }, sample.timestamp)) })] }) })] })] });
|
|
211
219
|
}
|
|
212
220
|
// Observe Recharts' synchronized tooltip state after render. This keeps the
|
|
213
221
|
// sidebar on the same timestamp for mouse, keyboard, touch, and sibling panels.
|
package/dist/code-block.d.ts
CHANGED
|
@@ -17,5 +17,9 @@ export type CodeBlockProps = Omit<ComponentProps<"figure">, "children" | "title"
|
|
|
17
17
|
collapse?: [number, number][];
|
|
18
18
|
/** The value type for the copy action, as in "command". Shows Copy; needs Toasts. */
|
|
19
19
|
copy?: string;
|
|
20
|
+
/** A marker before each line, such as `$`, that Copy leaves out. Without a title, Copy sits beside the code. */
|
|
21
|
+
prompt?: string;
|
|
22
|
+
/** Wraps long lines instead of scrolling, for prose such as a prompt to an agent. */
|
|
23
|
+
wrap?: boolean;
|
|
20
24
|
};
|
|
21
|
-
export declare function CodeBlock({ code, highlight, title, terminal, lineNumbers, diff, added, removed, collapse, copy, className, ...props }: CodeBlockProps): import("react").JSX.Element;
|
|
25
|
+
export declare function CodeBlock({ code, highlight, title, terminal, lineNumbers, diff, added, removed, collapse, copy, prompt, wrap, className, ...props }: CodeBlockProps): import("react").JSX.Element;
|
package/dist/code-block.js
CHANGED
|
@@ -101,11 +101,11 @@ async function writeClipboard(text) {
|
|
|
101
101
|
if (!copied)
|
|
102
102
|
throw new Error("Copy failed");
|
|
103
103
|
}
|
|
104
|
-
function CopyButton({ code, label }) {
|
|
104
|
+
function CopyButton({ code, label, compact = false }) {
|
|
105
105
|
const notify = useToast();
|
|
106
106
|
const [copied, setCopied] = useState(false);
|
|
107
107
|
const name = label[0].toUpperCase() + label.slice(1);
|
|
108
|
-
return _jsxs(Button, { size: "xs", variant: "ghost", "aria-label": `${copied ? "Copied" : "Copy"} ${label}`, onClick: async () => {
|
|
108
|
+
return _jsxs(Button, { size: "xs", variant: "ghost", className: compact ? "btn-icon" : undefined, "aria-label": `${copied ? "Copied" : "Copy"} ${label}`, onClick: async () => {
|
|
109
109
|
try {
|
|
110
110
|
await writeClipboard(code);
|
|
111
111
|
notify("success", `${name} copied`);
|
|
@@ -115,9 +115,9 @@ function CopyButton({ code, label }) {
|
|
|
115
115
|
catch {
|
|
116
116
|
notify("error", `${name} was not copied`, "Clipboard access was blocked. Select the value and copy it manually.");
|
|
117
117
|
}
|
|
118
|
-
}, children: [copied ? _jsx(Check, { className: "icon", "aria-hidden": "true" }) : _jsx(Copy, { className: "icon", "aria-hidden": "true" }), copied ? "Copied" : "Copy"] });
|
|
118
|
+
}, children: [copied ? _jsx(Check, { className: "icon", "aria-hidden": "true" }) : _jsx(Copy, { className: "icon", "aria-hidden": "true" }), !compact && (copied ? "Copied" : "Copy")] });
|
|
119
119
|
}
|
|
120
|
-
export function CodeBlock({ code, highlight, title, terminal = false, lineNumbers = false, diff = false, added = [], removed = [], collapse = [], copy, className, ...props }) {
|
|
120
|
+
export function CodeBlock({ code, highlight, title, terminal = false, lineNumbers = false, diff = false, added = [], removed = [], collapse = [], copy, prompt, wrap = false, className, ...props }) {
|
|
121
121
|
const rows = code.split("\n");
|
|
122
122
|
const changes = rows.map((row, index) => diff
|
|
123
123
|
? (row[0] === "+" ? "added" : row[0] === "-" ? "removed" : undefined)
|
|
@@ -128,7 +128,10 @@ export function CodeBlock({ code, highlight, title, terminal = false, lineNumber
|
|
|
128
128
|
const [open, setOpen] = useState([]);
|
|
129
129
|
// A title captions the figure; without one, the header holds only controls.
|
|
130
130
|
const Header = title != null ? "figcaption" : "div";
|
|
131
|
-
|
|
131
|
+
// A block without a title or terminal mark keeps Copy beside the code, as
|
|
132
|
+
// an icon: a prompted command or a wrapped prompt.
|
|
133
|
+
const inline = Boolean(prompt || wrap) && title == null && !terminal;
|
|
134
|
+
const line = (index) => _jsxs("span", { className: "code-block-line", "data-change": changes[index], children: [lineNumbers && _jsx("span", { className: "code-block-number", "aria-hidden": "true", children: index + 1 }), markers && _jsx("span", { className: "code-block-marker", "aria-hidden": "true", children: changes[index] === "added" ? "+" : changes[index] === "removed" ? "−" : " " }), prompt && _jsx("span", { className: "code-block-prompt", "aria-hidden": "true", children: prompt }), changes[index] && _jsx("span", { className: "code-block-change", children: changes[index] === "added" ? "Added line: " : "Removed line: " }), lines[index], "\n"] }, index);
|
|
132
135
|
const body = [];
|
|
133
136
|
for (let index = 0; index < lines.length; index++) {
|
|
134
137
|
const range = collapse.findIndex(([from, to]) => from === index + 1 && to >= from && to <= lines.length);
|
|
@@ -145,5 +148,5 @@ export function CodeBlock({ code, highlight, title, terminal = false, lineNumber
|
|
|
145
148
|
body.push(line(folded));
|
|
146
149
|
index = to - 1;
|
|
147
150
|
}
|
|
148
|
-
return (_jsxs("figure", { className: cn("code-block", className), "data-slot": "code-block", "data-terminal": terminal || undefined, style: { "--code-block-digits": String(lines.length).length }, ...props, children: [_jsx(PanelShadow, {}), (title != null || terminal || copy) && _jsxs(Header, { className: "code-block-header", children: [terminal && _jsx(TerminalIcon, {}), title != null && _jsx("span", { className: "code-block-title", children: title }), copy && _jsx(CopyButton, { code: code, label: copy })] }), _jsx("pre", { children: _jsx("code", { children: body }) })] }));
|
|
151
|
+
return (_jsxs("figure", { className: cn("code-block", className), "data-slot": "code-block", "data-terminal": terminal || undefined, "data-layout": inline ? "inline" : undefined, "data-wrap": wrap || undefined, style: { "--code-block-digits": String(lines.length).length }, ...props, children: [_jsx(PanelShadow, {}), (title != null || terminal || (copy && !inline)) && _jsxs(Header, { className: "code-block-header", children: [terminal && _jsx(TerminalIcon, {}), title != null && _jsx("span", { className: "code-block-title", children: title }), copy && !inline && _jsx(CopyButton, { code: code, label: copy })] }), _jsx("pre", { children: _jsx("code", { children: body }) }), copy && inline && _jsx("div", { className: "code-block-copy", children: _jsx(CopyButton, { code: code, label: copy, compact: true }) })] }));
|
|
149
152
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare function FeatureGrid({ className, children, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
3
|
+
declare function FeatureGridItem({ className, title, titleAs: Title, children, ...props }: Omit<React.ComponentProps<"div">, "title"> & {
|
|
4
|
+
title: React.ReactNode;
|
|
5
|
+
titleAs?: "h2" | "h3" | "h4" | "p";
|
|
6
|
+
}): React.JSX.Element;
|
|
7
|
+
export { FeatureGrid, FeatureGridItem };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { clsx as cn } from "clsx";
|
|
3
|
+
import { Card } from "./card.js";
|
|
4
|
+
/* Short facts in joined cells. The cells wrap when the grid narrows. */
|
|
5
|
+
function FeatureGrid({ className, children, ...props }) {
|
|
6
|
+
return (_jsx(Card, { "data-slot": "feature-grid", className: cn("feature-grid", className), ...props, children: _jsx("div", { className: "feature-grid-cells", role: "list", children: children }) }));
|
|
7
|
+
}
|
|
8
|
+
function FeatureGridItem({ className, title, titleAs: Title = "h3", children, ...props }) {
|
|
9
|
+
return (_jsxs("div", { "data-slot": "feature-grid-item", role: "listitem", className: cn("feature-grid-item", className), ...props, children: [_jsx(Title, { className: "feature-grid-title", children: title }), children != null && _jsx("div", { className: "feature-grid-description", children: children })] }));
|
|
10
|
+
}
|
|
11
|
+
export { FeatureGrid, FeatureGridItem };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare function FeatureList({ className, ...props }: React.ComponentProps<"ul">): React.JSX.Element;
|
|
3
|
+
declare function FeatureListItem({ className, title, children, ...props }: Omit<React.ComponentProps<"li">, "title"> & {
|
|
4
|
+
title?: React.ReactNode;
|
|
5
|
+
}): React.JSX.Element;
|
|
6
|
+
export { FeatureList, FeatureListItem };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { clsx as cn } from "clsx";
|
|
3
|
+
/* Facts as a list: a short lead in the foreground, then its detail. */
|
|
4
|
+
function FeatureList({ className, ...props }) {
|
|
5
|
+
return _jsx("ul", { "data-slot": "feature-list", className: cn("feature-list", className), ...props });
|
|
6
|
+
}
|
|
7
|
+
function FeatureListItem({ className, title, children, ...props }) {
|
|
8
|
+
return (_jsxs("li", { "data-slot": "feature-list-item", className: cn(className), ...props, children: [title != null && _jsx("span", { className: "feature-list-title", children: title }), title != null && children != null && " ", children] }));
|
|
9
|
+
}
|
|
10
|
+
export { FeatureList, FeatureListItem };
|
package/dist/header.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare function Header({ className, variant, ...props }: React.ComponentProps<"header"> & {
|
|
3
|
-
variant?: "default" | "plain";
|
|
2
|
+
declare function Header({ className, variant, size, ...props }: React.ComponentProps<"header"> & {
|
|
3
|
+
variant?: "default" | "plain" | "floating";
|
|
4
|
+
size?: "compact" | "default" | "editorial";
|
|
4
5
|
}): React.JSX.Element;
|
|
5
6
|
export { Header };
|
package/dist/header.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { clsx as cn } from "clsx";
|
|
3
3
|
// Shared product chrome: brand, Navigation, and global status or actions.
|
|
4
4
|
// Location within the product is Breadcrumb, not Header.
|
|
5
|
-
function Header({ className, variant, ...props }) {
|
|
6
|
-
return (_jsx("header", { "data-slot": "header", "data-variant": variant, className: cn("topbar", className), ...props }));
|
|
5
|
+
function Header({ className, variant, size, ...props }) {
|
|
6
|
+
return (_jsx("header", { "data-slot": "header", "data-variant": variant, "data-size": size, className: cn("topbar", className), ...props }));
|
|
7
7
|
}
|
|
8
8
|
export { Header };
|
package/dist/index.d.ts
CHANGED
|
@@ -72,3 +72,11 @@ export * from "./steps.js";
|
|
|
72
72
|
export * from "./radio-group.js";
|
|
73
73
|
export * from "./file-dropzone.js";
|
|
74
74
|
export * from "./diagram.js";
|
|
75
|
+
export * from "./site-section.js";
|
|
76
|
+
export * from "./site-heading.js";
|
|
77
|
+
export * from "./site-header.js";
|
|
78
|
+
export * from "./site-footer.js";
|
|
79
|
+
export * from "./feature-grid.js";
|
|
80
|
+
export * from "./feature-list.js";
|
|
81
|
+
export * from "./window-frame.js";
|
|
82
|
+
export * from "./perspective-stack.js";
|
package/dist/index.js
CHANGED
|
@@ -72,3 +72,11 @@ export * from "./steps.js";
|
|
|
72
72
|
export * from "./radio-group.js";
|
|
73
73
|
export * from "./file-dropzone.js";
|
|
74
74
|
export * from "./diagram.js";
|
|
75
|
+
export * from "./site-section.js";
|
|
76
|
+
export * from "./site-heading.js";
|
|
77
|
+
export * from "./site-header.js";
|
|
78
|
+
export * from "./site-footer.js";
|
|
79
|
+
export * from "./feature-grid.js";
|
|
80
|
+
export * from "./feature-list.js";
|
|
81
|
+
export * from "./window-frame.js";
|
|
82
|
+
export * from "./perspective-stack.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { clsx as cn } from "clsx";
|
|
4
|
+
/* Pages or cards fanned in depth. The last child is in front; the one under
|
|
5
|
+
the pointer or focus comes forward. */
|
|
6
|
+
function PerspectiveStack({ className, children, width, style, ...props }) {
|
|
7
|
+
const items = React.Children.toArray(children);
|
|
8
|
+
return (_jsx("div", { "data-slot": "perspective-stack", className: cn("perspective-stack", className), style: { "--n": items.length, ...(width ? { "--perspective-stack-width": width } : {}), ...style }, ...props, children: items.map((item, index) => (_jsx("div", { className: "perspective-stack-item", style: { "--i": index }, children: item }, index))) }));
|
|
9
|
+
}
|
|
10
|
+
export { PerspectiveStack };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { clsx as cn } from "clsx";
|
|
3
|
+
/* The page's last line: a start, such as the copyright, and an end, such as links. */
|
|
4
|
+
function SiteFooter({ className, start, children, ...props }) {
|
|
5
|
+
return (_jsx("footer", { "data-slot": "site-footer", className: cn("site-footer", className), ...props, children: _jsxs("div", { className: "site-footer-inner", children: [_jsx("div", { className: "site-footer-start", children: start }), children != null && _jsx("div", { className: "site-footer-end", children: children })] }) }));
|
|
6
|
+
}
|
|
7
|
+
export { SiteFooter };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type SiteHeaderLabels = {
|
|
3
|
+
navigation: string;
|
|
4
|
+
open: string;
|
|
5
|
+
close: string;
|
|
6
|
+
};
|
|
7
|
+
declare function SiteHeader({ className, brand, links, actions, sticky, overlay, fold, labels: custom, ...props }: React.ComponentProps<"header"> & {
|
|
8
|
+
brand?: React.ReactNode;
|
|
9
|
+
links?: React.ReactNode;
|
|
10
|
+
actions?: React.ReactNode;
|
|
11
|
+
sticky?: boolean;
|
|
12
|
+
overlay?: boolean;
|
|
13
|
+
/** Below 760px: `menu` folds links and actions behind a toggle; `hide`
|
|
14
|
+
hides the links and keeps the actions in the bar. */
|
|
15
|
+
fold?: "menu" | "hide";
|
|
16
|
+
labels?: Partial<SiteHeaderLabels>;
|
|
17
|
+
}): React.JSX.Element;
|
|
18
|
+
export { SiteHeader };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { clsx as cn } from "clsx";
|
|
5
|
+
import { Menu, X } from "lucide-react";
|
|
6
|
+
import { Button } from "./button.js";
|
|
7
|
+
const defaultLabels = { navigation: "Main", open: "Open menu", close: "Close menu" };
|
|
8
|
+
function scrollParent(node) {
|
|
9
|
+
for (let parent = node.parentElement; parent; parent = parent.parentElement) {
|
|
10
|
+
const { overflowY } = getComputedStyle(parent);
|
|
11
|
+
if (/(auto|scroll|overlay)/.test(overflowY) && parent.scrollHeight > parent.clientHeight)
|
|
12
|
+
return parent;
|
|
13
|
+
}
|
|
14
|
+
return window;
|
|
15
|
+
}
|
|
16
|
+
/* The site's top bar: brand, links and actions. `sticky` keeps it at the top
|
|
17
|
+
and takes the tone of the SiteSection under it. `overlay` lays it over the
|
|
18
|
+
next section, transparent until that section scrolls away. Below 760px the
|
|
19
|
+
links and actions fold into a menu. */
|
|
20
|
+
function SiteHeader({ className, brand, links, actions, sticky = false, overlay = false, fold = "menu", labels: custom, ...props }) {
|
|
21
|
+
const labels = { ...defaultLabels, ...custom };
|
|
22
|
+
const root = React.useRef(null);
|
|
23
|
+
const toggle = React.useRef(null);
|
|
24
|
+
const menu = React.useId();
|
|
25
|
+
const [open, setOpen] = React.useState(false);
|
|
26
|
+
const [tone, setTone] = React.useState();
|
|
27
|
+
const [solid, setSolid] = React.useState(!overlay);
|
|
28
|
+
// Follows the section under the bar: its tone, and whether the overlaid one has gone.
|
|
29
|
+
React.useEffect(() => {
|
|
30
|
+
const header = root.current;
|
|
31
|
+
if (!header || (!sticky && !overlay))
|
|
32
|
+
return;
|
|
33
|
+
const next = header.nextElementSibling;
|
|
34
|
+
let frame = 0;
|
|
35
|
+
const update = () => {
|
|
36
|
+
frame = 0;
|
|
37
|
+
const box = header.getBoundingClientRect();
|
|
38
|
+
const under = document.elementsFromPoint(box.left + box.width / 2, box.bottom + 1)
|
|
39
|
+
.find(element => !header.contains(element))?.closest(".site-section");
|
|
40
|
+
setTone(under?.dataset.tone);
|
|
41
|
+
if (overlay)
|
|
42
|
+
setSolid(!next || !next.contains(under ?? null) || next.getBoundingClientRect().bottom <= box.bottom);
|
|
43
|
+
};
|
|
44
|
+
const schedule = () => { if (!frame)
|
|
45
|
+
frame = requestAnimationFrame(update); };
|
|
46
|
+
const target = scrollParent(header);
|
|
47
|
+
target.addEventListener("scroll", schedule, { passive: true });
|
|
48
|
+
window.addEventListener("resize", schedule);
|
|
49
|
+
update();
|
|
50
|
+
return () => { target.removeEventListener("scroll", schedule); window.removeEventListener("resize", schedule); cancelAnimationFrame(frame); };
|
|
51
|
+
}, [sticky, overlay]);
|
|
52
|
+
// The open menu closes on Escape, on a link and outside the bar.
|
|
53
|
+
React.useEffect(() => {
|
|
54
|
+
if (!open)
|
|
55
|
+
return;
|
|
56
|
+
const key = (event) => { if (event.key === "Escape") {
|
|
57
|
+
setOpen(false);
|
|
58
|
+
toggle.current?.focus();
|
|
59
|
+
} };
|
|
60
|
+
const pointer = (event) => { if (!root.current?.contains(event.target))
|
|
61
|
+
setOpen(false); };
|
|
62
|
+
document.addEventListener("keydown", key);
|
|
63
|
+
document.addEventListener("pointerdown", pointer);
|
|
64
|
+
return () => { document.removeEventListener("keydown", key); document.removeEventListener("pointerdown", pointer); };
|
|
65
|
+
}, [open]);
|
|
66
|
+
return (_jsx("header", { ref: root, "data-slot": "site-header", "data-sticky": sticky || overlay || undefined, "data-overlay": overlay || undefined, "data-solid": solid || undefined, "data-open": open || undefined, "data-tone": tone, "data-fold": fold, className: cn("site-header", className), ...props, children: _jsxs("div", { className: "site-header-inner", children: [brand != null && _jsx("div", { className: "site-header-brand", children: brand }), (links != null || actions != null) && _jsxs(_Fragment, { children: [fold === "menu" && _jsx(Button, { ref: toggle, variant: "ghost", size: "sm", className: "btn-icon site-header-toggle", "aria-expanded": open, "aria-controls": menu, "aria-label": open ? labels.close : labels.open, onClick: () => setOpen(value => !value), children: open ? _jsx(X, { className: "icon", "aria-hidden": "true" }) : _jsx(Menu, { className: "icon", "aria-hidden": "true" }) }), _jsxs("div", { id: menu, className: "site-header-nav", onClick: event => { if (event.target.closest("a"))
|
|
67
|
+
setOpen(false); }, children: [links != null && _jsx("nav", { "aria-label": labels.navigation, children: _jsx("ul", { className: "site-header-links", children: React.Children.map(links, link => link != null && _jsx("li", { children: link })) }) }), actions != null && _jsx("div", { className: "site-header-actions", children: actions })] })] })] }) }));
|
|
68
|
+
}
|
|
69
|
+
export { SiteHeader };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare function SiteHeading({ className, eyebrow, title, description, actions, level, size, align, ...props }: Omit<React.ComponentProps<"div">, "title"> & {
|
|
3
|
+
eyebrow?: React.ReactNode;
|
|
4
|
+
title: React.ReactNode;
|
|
5
|
+
description?: React.ReactNode;
|
|
6
|
+
actions?: React.ReactNode;
|
|
7
|
+
level?: 1 | 2 | 3;
|
|
8
|
+
size?: "display" | "section";
|
|
9
|
+
align?: "start" | "center";
|
|
10
|
+
}): React.JSX.Element;
|
|
11
|
+
export { SiteHeading };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { clsx as cn } from "clsx";
|
|
3
|
+
/* An eyebrow, a title and a description, with optional actions. */
|
|
4
|
+
function SiteHeading({ className, eyebrow, title, description, actions, level = 2, size = "section", align = "start", ...props }) {
|
|
5
|
+
const Title = `h${level}`;
|
|
6
|
+
return (_jsxs("div", { "data-slot": "site-heading", "data-size": size, "data-align": align, className: cn("site-heading", className), ...props, children: [eyebrow != null && _jsx("p", { className: "site-heading-eyebrow", children: eyebrow }), _jsx(Title, { className: "site-heading-title", children: title }), description != null && _jsx("p", { className: "site-heading-description", children: description }), actions != null && _jsx("div", { className: "site-heading-actions", children: actions })] }));
|
|
7
|
+
}
|
|
8
|
+
export { SiteHeading };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type SiteSectionTone = "default" | "inverse" | "accent";
|
|
3
|
+
export type SiteSectionSize = "sm" | "md" | "lg" | "half" | "full";
|
|
4
|
+
export type SiteSectionLayout = "stack" | "center" | "split" | "row" | "grid";
|
|
5
|
+
declare function SiteSection({ className, tone, size, variant, glow, ...props }: React.ComponentProps<"section"> & {
|
|
6
|
+
tone?: SiteSectionTone;
|
|
7
|
+
size?: SiteSectionSize;
|
|
8
|
+
variant?: "band" | "inset";
|
|
9
|
+
/** A soft light in the primary color, from the top, the start or the end. */
|
|
10
|
+
glow?: "top" | "start" | "end";
|
|
11
|
+
}): React.JSX.Element;
|
|
12
|
+
declare function SiteSectionHead({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
13
|
+
declare function SiteSectionBody({ className, layout, columns, ratio, children, style, ...props }: React.ComponentProps<"div"> & {
|
|
14
|
+
layout?: SiteSectionLayout;
|
|
15
|
+
columns?: 2 | 3 | 4;
|
|
16
|
+
ratio?: "1:1" | "1:2" | "2:1";
|
|
17
|
+
}): React.JSX.Element;
|
|
18
|
+
declare function SiteSectionFoot({ className, children, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
19
|
+
export { SiteSection, SiteSectionHead, SiteSectionBody, SiteSectionFoot };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { clsx as cn } from "clsx";
|
|
5
|
+
import { Card } from "./card.js";
|
|
6
|
+
const Context = React.createContext({ variant: "band" });
|
|
7
|
+
/* A full-width band of a site page. Its tone recolors everything inside. */
|
|
8
|
+
function SiteSection({ className, tone = "default", size = "md", variant = "band", glow, ...props }) {
|
|
9
|
+
return (_jsx(Context.Provider, { value: { variant }, children: _jsx("section", { "data-slot": "site-section", "data-tone": tone, "data-size": size, "data-variant": variant, "data-glow": glow, className: cn("site-section", className), ...props }) }));
|
|
10
|
+
}
|
|
11
|
+
function SiteSectionHead({ className, ...props }) {
|
|
12
|
+
return _jsx("div", { "data-slot": "site-section-head", className: cn("site-section-head", className), ...props });
|
|
13
|
+
}
|
|
14
|
+
/* The body lays its children out; an inset section frames them in a panel. */
|
|
15
|
+
function SiteSectionBody({ className, layout = "stack", columns, ratio, children, style, ...props }) {
|
|
16
|
+
const { variant } = React.useContext(Context);
|
|
17
|
+
const content = _jsx("div", { className: "site-section-content", children: children });
|
|
18
|
+
return (_jsx("div", { "data-slot": "site-section-body", "data-layout": layout, "data-ratio": layout === "split" ? ratio : undefined, className: cn("site-section-body", className), style: columns ? { "--site-section-columns": columns, ...style } : style, ...props, children: _jsx("div", { className: "site-section-inner", children: variant === "inset" ? _jsx(Card, { className: "site-section-panel", children: content }) : content }) }));
|
|
19
|
+
}
|
|
20
|
+
function SiteSectionFoot({ className, children, ...props }) {
|
|
21
|
+
return (_jsx("div", { "data-slot": "site-section-foot", className: cn("site-section-foot", className), ...props, children: _jsx("div", { className: "site-section-inner", children: children }) }));
|
|
22
|
+
}
|
|
23
|
+
export { SiteSection, SiteSectionHead, SiteSectionBody, SiteSectionFoot };
|
package/dist/styles.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap");
|
|
1
|
+
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600&family=JetBrains+Mono:wght@400;500&display=swap");
|
|
2
2
|
@import "@momoi-labs/kiso/tokens.css";
|
|
3
3
|
@import "@momoi-labs/kiso/ui.css";
|
|
4
4
|
|
package/dist/tabs.d.ts
CHANGED
|
@@ -10,7 +10,14 @@ type TabsProps = React.ComponentProps<typeof TabsPrimitive.Root> & {
|
|
|
10
10
|
sections?: boolean;
|
|
11
11
|
};
|
|
12
12
|
declare function Tabs({ sections, ...props }: TabsProps): React.JSX.Element;
|
|
13
|
-
declare function TabsList({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.List>
|
|
14
|
-
|
|
13
|
+
declare function TabsList({ className, variant, ...props }: React.ComponentProps<typeof TabsPrimitive.List> & {
|
|
14
|
+
/** `line` underlines the selected tab; `pills` fills it inside a framed group. */
|
|
15
|
+
variant?: "line" | "pills";
|
|
16
|
+
}): React.JSX.Element;
|
|
17
|
+
declare function TabsTrigger({ className, keyHint, children, ...props }: React.ComponentProps<typeof TabsPrimitive.Trigger> & {
|
|
18
|
+
/** A key shown before the label, such as the key of the tool the tab
|
|
19
|
+
describes. It is a hint only: Tabs binds no key to it. */
|
|
20
|
+
keyHint?: React.ReactNode;
|
|
21
|
+
}): React.JSX.Element;
|
|
15
22
|
declare function TabsContent({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Content>): React.JSX.Element;
|
|
16
23
|
export { Tabs, TabsList, TabsTrigger, TabsContent };
|
package/dist/tabs.js
CHANGED
|
@@ -69,11 +69,11 @@ function SectionedTabs({ value: controlled, defaultValue, onValueChange, classNa
|
|
|
69
69
|
}
|
|
70
70
|
return (_jsx(TabsPrimitive.Root, { "data-slot": "tabs", "data-sections": "true", "data-collapsed": collapsed ? "true" : undefined, className: className, value: value, onValueChange: select, ...props, children: laid }));
|
|
71
71
|
}
|
|
72
|
-
function TabsList({ className, ...props }) {
|
|
73
|
-
return (_jsx(TabsPrimitive.List, { "data-slot": "tabs-list", className: cn("tabs", className), ...props }));
|
|
72
|
+
function TabsList({ className, variant = "line", ...props }) {
|
|
73
|
+
return (_jsx(TabsPrimitive.List, { "data-slot": "tabs-list", "data-variant": variant === "line" ? undefined : variant, className: cn("tabs", className), ...props }));
|
|
74
74
|
}
|
|
75
|
-
function TabsTrigger({ className, ...props }) {
|
|
76
|
-
return (
|
|
75
|
+
function TabsTrigger({ className, keyHint, children, ...props }) {
|
|
76
|
+
return (_jsxs(TabsPrimitive.Trigger, { "data-slot": "tabs-trigger", className: cn("", className), ...props, children: [keyHint != null && _jsx("kbd", { className: "tabs-key", "aria-hidden": "true", children: keyHint }), children] }));
|
|
77
77
|
}
|
|
78
78
|
function TabsContent({ className, ...props }) {
|
|
79
79
|
return (_jsx(TabsPrimitive.Content, { "data-slot": "tabs-content", className: cn("", className), ...props }));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare function WindowFrame({ className, title, caption, variant, children, ...props }: Omit<React.ComponentProps<"figure">, "title"> & {
|
|
3
|
+
title?: React.ReactNode;
|
|
4
|
+
caption?: React.ReactNode;
|
|
5
|
+
variant?: "app" | "terminal";
|
|
6
|
+
}): React.JSX.Element;
|
|
7
|
+
export { WindowFrame };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { clsx as cn } from "clsx";
|
|
3
|
+
import { Card } from "./card.js";
|
|
4
|
+
/* Window chrome around an example: a screen, a terminal session or a page. */
|
|
5
|
+
function WindowFrame({ className, title, caption, variant = "app", children, ...props }) {
|
|
6
|
+
return (_jsxs("figure", { "data-slot": "window-frame", "data-variant": variant, className: cn("window-frame", className), ...props, children: [_jsxs(Card, { children: [_jsxs("div", { className: "window-frame-bar", children: [_jsxs("span", { className: "window-frame-dots", "aria-hidden": "true", children: [_jsx("i", {}), _jsx("i", {}), _jsx("i", {})] }), title != null && _jsx("span", { className: "window-frame-title", children: title })] }), _jsx("div", { className: "window-frame-body", children: children })] }), caption != null && _jsx("figcaption", { children: caption })] }));
|
|
7
|
+
}
|
|
8
|
+
export { WindowFrame };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momoi-labs/kiso-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"description": "Kiso React components built with shadcn/ui and Radix",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"prepack": "npm run build"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@momoi-labs/kiso": "^1.
|
|
35
|
+
"@momoi-labs/kiso": "^1.7.0",
|
|
36
36
|
"class-variance-authority": "0.7.1",
|
|
37
37
|
"clsx": "2.1.1",
|
|
38
38
|
"radix-ui": "1.6.7",
|