@momoi-labs/kiso-react 0.36.0 → 0.38.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/README.md +2 -1
- package/dist/accent-selector.d.ts +1 -1
- package/dist/accent-selector.js +3 -2
- package/dist/alert.d.ts +2 -1
- package/dist/alert.js +2 -2
- package/dist/app-shell.js +1 -1
- package/dist/chart-legend.js +4 -1
- package/dist/chart-style.d.ts +3 -1
- package/dist/chart-style.js +15 -7
- package/dist/chart.js +8 -4
- package/dist/pane-grid.d.ts +2 -1
- package/dist/pane-grid.js +2 -2
- package/dist/styles.css +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -85,7 +85,8 @@ Data and structure
|
|
|
85
85
|
- Split, Pane, and Splitter, a list-detail layout with a resizable divider.
|
|
86
86
|
- PaneGrid and GridPane, summary panes on twelve columns that the reader
|
|
87
87
|
resizes at the end edge and moves by the title. `onLayoutChange` reports
|
|
88
|
-
the rows and sizes for the product to persist.
|
|
88
|
+
the rows and sizes for the product to persist. `frame="none"` on a pane
|
|
89
|
+
draws no Card, for a pane that holds one TableFrame.
|
|
89
90
|
- LogView, LogViewLine, LogViewTime, and LogViewLevel.
|
|
90
91
|
- StepList, a run's steps with a state each, and StepBar, the same run as
|
|
91
92
|
one segment per step for a summary, a table cell, or a toast.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const accents: readonly ["violet", "terracotta", "teal", "cobalt", "nocturne", "tangerine", "red", "gold", "lime", "plum", "stone", "steel", "snes", "pine"];
|
|
1
|
+
export declare const accents: readonly ["violet", "terracotta", "teal", "cobalt", "nocturne", "tangerine", "red", "gold", "lime", "plum", "stone", "steel", "snes", "pine", "blueprint"];
|
|
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
|
@@ -15,8 +15,9 @@ export const accents = [
|
|
|
15
15
|
"steel",
|
|
16
16
|
"snes",
|
|
17
17
|
"pine",
|
|
18
|
+
"blueprint",
|
|
18
19
|
];
|
|
19
|
-
const label = (accent) => `${accent[0].toUpperCase()}${accent.slice(1)}`;
|
|
20
|
+
const label = (accent) => accent === "snes" ? "SNES" : `${accent[0].toUpperCase()}${accent.slice(1)}`;
|
|
20
21
|
export function AccentSelector({ accent, onChange, options = accents, preview = true, }) {
|
|
21
|
-
return (_jsxs("div", { className: "accent-row", children: [_jsxs("div", { className: "theme-row", children: [_jsx("span", { className: "t-label", children: "Accent" }), _jsx("div", { className: "accent-pills", role: "group", "aria-label": "Accent", children: options.map((option) => (_jsxs("button", { type: "button", className: "accent-pill", "aria-pressed": accent === option,
|
|
22
|
+
return (_jsxs("div", { className: "accent-row", children: [_jsxs("div", { className: "theme-row", children: [_jsx("span", { className: "t-label", children: "Accent" }), _jsx("div", { className: "accent-pills", role: "group", "aria-label": "Accent", children: options.map((option) => (_jsxs("button", { type: "button", className: "accent-pill", "aria-pressed": accent === option, onClick: () => onChange(option), children: [_jsx("span", { className: "accent-dot", "data-accent": option, "aria-hidden": "true" }), label(option)] }, option))) })] }), preview && (_jsxs("div", { className: "accent-preview", "data-accent": accent, "aria-hidden": "true", children: [_jsxs("span", { className: "accent-preview-sidebar", children: [_jsx("i", {}), _jsx("i", {}), _jsx("i", {}), _jsx("i", {})] }), _jsxs("span", { className: "accent-preview-main", children: [_jsx("i", { className: "accent-preview-title" }), _jsx("i", { className: "accent-preview-text" }), _jsx("i", { className: "accent-preview-link" }), _jsxs("span", { className: "accent-preview-actions", children: [_jsx("i", { className: "accent-preview-primary" }), _jsx("i", { className: "accent-preview-secondary" })] }), _jsx("i", { className: "accent-preview-selected" })] })] }))] }));
|
|
22
23
|
}
|
package/dist/alert.d.ts
CHANGED
|
@@ -11,11 +11,12 @@ type AlertLabels = {
|
|
|
11
11
|
hide?: string;
|
|
12
12
|
dismiss?: string;
|
|
13
13
|
};
|
|
14
|
-
declare function Alert({ className, variant, appearance, tape, animated, pulse, placement, onDismiss, labels, role, ref, children, ...props }: React.ComponentProps<"div"> & VariantProps<typeof alertVariants> & {
|
|
14
|
+
declare function Alert({ className, variant, appearance, tape, animated, pulse, placement, side, onDismiss, labels, role, ref, children, ...props }: React.ComponentProps<"div"> & VariantProps<typeof alertVariants> & {
|
|
15
15
|
tape?: AlertTape;
|
|
16
16
|
animated?: boolean;
|
|
17
17
|
pulse?: boolean;
|
|
18
18
|
placement?: "inline" | "overlay";
|
|
19
|
+
side?: "top" | "middle" | "bottom";
|
|
19
20
|
onDismiss?: () => void;
|
|
20
21
|
labels?: AlertLabels;
|
|
21
22
|
}): React.JSX.Element;
|
package/dist/alert.js
CHANGED
|
@@ -47,7 +47,7 @@ function useOverlaySlot(overlay, id) {
|
|
|
47
47
|
return { hidden: overlay && index !== -1 && !top, more: overlay && top ? stack.length - 1 : 0 };
|
|
48
48
|
}
|
|
49
49
|
const AlertDetailsContext = React.createContext(null);
|
|
50
|
-
function Alert({ className, variant = "info", appearance = "tinted", tape, animated = false, pulse = false, placement = "inline", onDismiss, labels, role, ref, children, ...props }) {
|
|
50
|
+
function Alert({ className, variant = "info", appearance = "tinted", tape, animated = false, pulse = false, placement = "inline", side = "top", onDismiss, labels, role, ref, children, ...props }) {
|
|
51
51
|
const severity = variant ?? "info";
|
|
52
52
|
const loud = appearance === "loud";
|
|
53
53
|
const id = React.useId();
|
|
@@ -84,7 +84,7 @@ function Alert({ className, variant = "info", appearance = "tinted", tape, anima
|
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
86
|
const resolvedTape = tape ?? (severity === "error" || severity === "warning" ? "top" : "none");
|
|
87
|
-
const alert = (_jsxs("div", { ref: setRef, "data-slot": "alert", "data-variant": variant, "data-appearance": appearance, "data-placement": placement, "data-tape": loud ? resolvedTape : undefined, "data-animated": loud && animated ? "true" : undefined, "data-pulse": loud && pulse ? "true" : undefined, role: role ?? (severity === "error" ? "alert" : "status"), hidden: hidden || undefined, className: cn(alertVariants({ variant, appearance }), placement === "overlay" && "alert-overlay", className), ...props, children: [loud && _jsx(LoudMark, { variant: severity }), _jsx(AlertDetailsContext.Provider, { value: { id: detailsId, open }, children: children }), (hasDetails || onDismiss || more > 0) && (_jsxs("div", { "data-slot": "alert-actions", className: "alert-actions", children: [more > 0 && (_jsxs("span", { className: "alert-count", "aria-label": `${more} more ${more === 1 ? "alert" : "alerts"}`, children: ["+", more] })), hasDetails && (_jsxs(Button, { size: "xs", className: "alert-details-toggle", "aria-expanded": open, "aria-controls": detailsId, onClick: () => setOpen((value) => !value), children: [_jsx(ChevronDown, { className: "icon icon-sm", "aria-hidden": "true" }), open ? (labels?.hide ?? "Hide details") : (labels?.show ?? "Details")] })), onDismiss && (_jsx(Button, { className: "btn-icon", size: "sm", variant: "ghost", "aria-label": labels?.dismiss ?? "Dismiss", onClick: dismiss, children: _jsx(X, { className: "icon icon-sm", "aria-hidden": "true" }) }))] }))] }));
|
|
87
|
+
const alert = (_jsxs("div", { ref: setRef, "data-slot": "alert", "data-variant": variant, "data-appearance": appearance, "data-placement": placement, "data-side": placement === "overlay" ? side : undefined, "data-tape": loud ? resolvedTape : undefined, "data-animated": loud && animated ? "true" : undefined, "data-pulse": loud && pulse ? "true" : undefined, role: role ?? (severity === "error" ? "alert" : "status"), hidden: hidden || undefined, className: cn(alertVariants({ variant, appearance }), placement === "overlay" && "alert-overlay", className), ...props, children: [loud && _jsx(LoudMark, { variant: severity }), _jsx(AlertDetailsContext.Provider, { value: { id: detailsId, open }, children: children }), (hasDetails || onDismiss || more > 0) && (_jsxs("div", { "data-slot": "alert-actions", className: "alert-actions", children: [more > 0 && (_jsxs("span", { className: "alert-count", "aria-label": `${more} more ${more === 1 ? "alert" : "alerts"}`, children: ["+", more] })), hasDetails && (_jsxs(Button, { size: "xs", className: "alert-details-toggle", "aria-expanded": open, "aria-controls": detailsId, onClick: () => setOpen((value) => !value), children: [_jsx(ChevronDown, { className: "icon icon-sm", "aria-hidden": "true" }), open ? (labels?.hide ?? "Hide details") : (labels?.show ?? "Details")] })), onDismiss && (_jsx(Button, { className: "btn-icon", size: "sm", variant: "ghost", "aria-label": labels?.dismiss ?? "Dismiss", onClick: dismiss, children: _jsx(X, { className: "icon icon-sm", "aria-hidden": "true" }) }))] }))] }));
|
|
88
88
|
return placement === "overlay" ? _jsx(PortalPrimitive.Root, { asChild: true, children: alert }) : alert;
|
|
89
89
|
}
|
|
90
90
|
function AlertContent({ className, ...props }) {
|
package/dist/app-shell.js
CHANGED
|
@@ -64,7 +64,7 @@ function ApplicationShellSidebar({ brand, primaryAction, navigation, navigationL
|
|
|
64
64
|
useIsomorphicLayoutEffect(() => {
|
|
65
65
|
const sidebar = sidebarRef.current;
|
|
66
66
|
const focused = sidebar?.ownerDocument.activeElement;
|
|
67
|
-
if (isCollapsed && focused && sidebar?.contains(focused) && !focused.getClientRects().length) {
|
|
67
|
+
if (isCollapsed && focused && sidebar?.contains(focused) && (!focused.getClientRects().length || sidebar.ownerDocument.defaultView?.getComputedStyle(focused).visibility === "hidden")) {
|
|
68
68
|
toggleRef.current?.focus();
|
|
69
69
|
}
|
|
70
70
|
}, [isCollapsed]);
|
package/dist/chart-legend.js
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
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 { clsx as cn } from "clsx";
|
|
4
5
|
import { chartColor, chartSlot, defaultChartSummary, formatChartTime, formatChartValue, measured, seriesSummary, validateChart } from "./chart-data.js";
|
|
6
|
+
import { ChartPattern } from "./chart-style.js";
|
|
5
7
|
const defaultLabels = {
|
|
6
8
|
series: "Series", current: "Current", notCollected: "Not collected",
|
|
7
9
|
min: "Min", max: "Max", avg: "Avg", p50: "p50", p75: "p75", p90: "p90", p95: "p95", p99: "p99",
|
|
8
10
|
};
|
|
9
11
|
export function ChartSeriesLabel({ series, index }) {
|
|
10
12
|
const slot = chartSlot(series, index);
|
|
11
|
-
|
|
13
|
+
const id = React.useId();
|
|
14
|
+
return _jsxs("span", { className: "chart-series-label", children: [_jsxs("svg", { className: "chart-series-swatch", "aria-hidden": "true", width: "28", height: "12", viewBox: "0 0 28 12", children: [_jsx("defs", { children: _jsx(ChartPattern, { id: `${id}-hatch`, color: chartColor(slot), fill: "none", hatch: slot }) }), _jsx("path", { className: "chart-series-line", d: "M0 6H28", stroke: chartColor(slot), strokeWidth: "2" }), _jsx("path", { className: "chart-series-hatch", d: "M1 1H27V11H1Z", stroke: chartColor(slot), strokeWidth: "1", fill: `url(#${id}-hatch)` })] }), _jsxs("span", { children: [slot, ". ", series.label] })] });
|
|
12
15
|
}
|
|
13
16
|
export function ChartLegend({ data, series, label, formatValue = formatChartValue, variant = "table", summary: stats = defaultChartSummary, activeTimestamp, formatTime = formatChartTime, highlightSeries, onHighlightSeriesChange, labels, className, ...props }) {
|
|
14
17
|
validateChart(data, series);
|
package/dist/chart-style.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export type ChartStyle = "solid" | "pixel" | "halftone" | "rounded";
|
|
|
6
6
|
export type ChartTreatment = {
|
|
7
7
|
line: ChartLine;
|
|
8
8
|
fill: ChartFill;
|
|
9
|
+
mono?: boolean;
|
|
9
10
|
};
|
|
10
11
|
export declare const chartStylePresets: Record<ChartStyle, ChartTreatment>;
|
|
11
12
|
export type ChartTreatmentProps = {
|
|
@@ -22,10 +23,11 @@ export declare function useChartPresentation(ref: React.RefObject<HTMLElement |
|
|
|
22
23
|
};
|
|
23
24
|
type CurveFactory = Exclude<NonNullable<React.ComponentProps<typeof Line>["type"]>, string>;
|
|
24
25
|
export declare const pixelCurve: CurveFactory;
|
|
25
|
-
export declare function ChartPattern({ id, color, fill }: {
|
|
26
|
+
export declare function ChartPattern({ id, color, fill, hatch }: {
|
|
26
27
|
id: string;
|
|
27
28
|
color: string;
|
|
28
29
|
fill: ChartFill;
|
|
30
|
+
hatch?: number;
|
|
29
31
|
}): React.JSX.Element;
|
|
30
32
|
export declare function ChartDot({ cx, cy, r, fill, opacity, line }: {
|
|
31
33
|
cx?: number;
|
package/dist/chart-style.js
CHANGED
|
@@ -12,10 +12,8 @@ const chartFills = ["none", "dots", "tint", "squares", "scanlines"];
|
|
|
12
12
|
// Geometry must update with a scoped appearance attribute, not just CSS paint.
|
|
13
13
|
export function useChartStyle(ref, override = {}, mounted = true) {
|
|
14
14
|
const [inherited, setInherited] = React.useState(chartStylePresets.solid);
|
|
15
|
-
const
|
|
15
|
+
const [mono, setMono] = React.useState(false);
|
|
16
16
|
React.useLayoutEffect(() => {
|
|
17
|
-
if (fixed)
|
|
18
|
-
return;
|
|
19
17
|
const element = ref.current;
|
|
20
18
|
if (!element)
|
|
21
19
|
return;
|
|
@@ -23,6 +21,7 @@ export function useChartStyle(ref, override = {}, mounted = true) {
|
|
|
23
21
|
const style = getComputedStyle(element);
|
|
24
22
|
const line = style.getPropertyValue("--chart-line").trim();
|
|
25
23
|
const fill = style.getPropertyValue("--chart-fill").trim();
|
|
24
|
+
setMono(style.getPropertyValue("--chart-palette").trim() === "mono");
|
|
26
25
|
setInherited(current => {
|
|
27
26
|
const next = { line: chartLines.includes(line) ? line : "straight", fill: chartFills.includes(fill) ? fill : "none" };
|
|
28
27
|
return next.line === current.line && next.fill === current.fill ? current : next;
|
|
@@ -30,11 +29,11 @@ export function useChartStyle(ref, override = {}, mounted = true) {
|
|
|
30
29
|
};
|
|
31
30
|
read();
|
|
32
31
|
const observer = new MutationObserver(read);
|
|
33
|
-
observer.observe(element.ownerDocument.documentElement, { attributes: true, subtree: true, attributeFilter: ["data-chart-style", "data-chart-line", "data-chart-fill"] });
|
|
32
|
+
observer.observe(element.ownerDocument.documentElement, { attributes: true, subtree: true, attributeFilter: ["data-chart-style", "data-chart-line", "data-chart-fill", "data-chart-palette"] });
|
|
34
33
|
return () => observer.disconnect();
|
|
35
|
-
}, [ref,
|
|
34
|
+
}, [ref, mounted]);
|
|
36
35
|
const base = override.chartStyle ? chartStylePresets[override.chartStyle] : inherited;
|
|
37
|
-
return { line: override.chartLine ?? base.line, fill: override.chartFill ?? base.fill };
|
|
36
|
+
return { line: override.chartLine ?? base.line, fill: override.chartFill ?? base.fill, mono };
|
|
38
37
|
}
|
|
39
38
|
const chartLayouts = ["standard", "compact", "split"];
|
|
40
39
|
const chartLegends = ["table", "inline", "sidebar"];
|
|
@@ -99,7 +98,16 @@ export const pixelCurve = context => {
|
|
|
99
98
|
};
|
|
100
99
|
/* The texture under a line. Dots and squares sit on a 4px screen; scanlines
|
|
101
100
|
are 1px rules every 3px. None and tint need no pattern. */
|
|
102
|
-
export function ChartPattern({ id, color, fill }) {
|
|
101
|
+
export function ChartPattern({ id, color, fill, hatch }) {
|
|
102
|
+
if (hatch) {
|
|
103
|
+
const kind = hatch % 5;
|
|
104
|
+
const size = kind === 1 ? 10 : kind === 4 ? 4 : 6;
|
|
105
|
+
return _jsx("pattern", { id: id, width: size, height: size, patternUnits: "userSpaceOnUse", children: kind === 1 ? _jsx("path", { d: "M-1 1L1 -1M0 10L10 0M9 11L11 9", stroke: color, strokeWidth: 1 })
|
|
106
|
+
: kind === 2 ? _jsx("path", { d: "M-1 5L1 7M0 0L6 6M5 -1L7 1", stroke: color, strokeWidth: 1 })
|
|
107
|
+
: kind === 3 ? _jsx("path", { d: "M1 1h1.5v1.5h-1.5zM4 4h1.5v1.5h-1.5z", fill: color })
|
|
108
|
+
: kind === 4 ? _jsx("path", { d: "M0 2H4", stroke: color, strokeWidth: 1 })
|
|
109
|
+
: _jsx("path", { d: "M3 0V6", stroke: color, strokeWidth: 1 }) });
|
|
110
|
+
}
|
|
103
111
|
if (fill === "scanlines")
|
|
104
112
|
return _jsx("pattern", { id: id, width: 4, height: 3, patternUnits: "userSpaceOnUse", children: _jsx("rect", { width: 4, height: 1, fill: color }) });
|
|
105
113
|
return _jsx("pattern", { id: id, width: 4, height: 4, patternUnits: "userSpaceOnUse", children: fill === "squares" ? _jsx("rect", { width: 2, height: 2, fill: color }) : _jsx("circle", { cx: 1, cy: 1, r: 0.8, fill: color }) });
|
package/dist/chart.js
CHANGED
|
@@ -36,7 +36,7 @@ export function Chart({ data, series, label, variant = "line", layout: requested
|
|
|
36
36
|
...(fractional ? { fractionalSecondDigits: 3 } : {}), timeZoneName: "longOffset" }).format(timestamp)
|
|
37
37
|
: formatChartTime;
|
|
38
38
|
const frame = React.useRef(null);
|
|
39
|
-
const { line, fill } = useChartStyle(frame, { chartStyle, chartLine, chartFill });
|
|
39
|
+
const { line, fill, mono } = useChartStyle(frame, { chartStyle, chartLine, chartFill });
|
|
40
40
|
const presentation = useChartPresentation(frame, layoutProp, legendProp);
|
|
41
41
|
const legend = presentation.legend;
|
|
42
42
|
// An inherited split cannot hold a stack, so a stacked chart keeps one plot.
|
|
@@ -165,7 +165,7 @@ export function Chart({ data, series, label, variant = "line", layout: requested
|
|
|
165
165
|
paintDrag();
|
|
166
166
|
},
|
|
167
167
|
};
|
|
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:
|
|
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, hatch: mono && variant === "stacked-area" ? chartSlot(series[index], index) : undefined }, series[index].key)) }), !spark && _jsx(CartesianGrid, { vertical: !!mono, stroke: "var(--color-border)", strokeWidth: 0.5 }), _jsx(XAxis, { dataKey: "timestamp", type: "number", domain: ["dataMin", "dataMax"], scale: "time", axisLine: false, tickLine: mono && !spark ? { stroke: "var(--color-border-strong)" } : 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
169
|
: { fill: "var(--color-muted-foreground)" } }), _jsx(YAxis, { domain: layout === "split" ? [splitMin, splitMax]
|
|
170
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 => {
|
|
171
171
|
const item = series[index];
|
|
@@ -180,13 +180,17 @@ export function Chart({ data, series, label, variant = "line", layout: requested
|
|
|
180
180
|
const at = dotProps.index ?? -1;
|
|
181
181
|
const isolated = measured(plot[at]?.values[index])
|
|
182
182
|
&& !measured(plot[at - 1]?.values[index]) && !measured(plot[at + 1]?.values[index]);
|
|
183
|
+
const every = Math.max(1, Math.ceil(plot.length / 12));
|
|
184
|
+
if (mono && !spark && !isolated && measured(plot[at]?.values[index]) && (at + index * Math.floor(every / 2)) % every === 0
|
|
185
|
+
&& dotProps.cx !== undefined && dotProps.cy !== undefined)
|
|
186
|
+
return _jsx("rect", { x: dotProps.cx - 2.5, y: dotProps.cy - 2.5, width: 5, height: 5, strokeWidth: 1, stroke: chartColor(slot), fill: slot % 2 ? "var(--color-card)" : chartColor(slot), opacity: dimmed ? 0.3 : 1 }, at);
|
|
183
187
|
return _jsx(ChartDot, { cx: dotProps.cx, cy: dotProps.cy, r: isolated ? 3 : 0, line: line, fill: chartColor(slot), opacity: dimmed ? 0.3 : 1 }, at);
|
|
184
188
|
}, activeDot: (dotProps) => _jsx(ChartDot, { ...dotProps, line: line, fill: chartColor(slot), opacity: dimmed ? 0.3 : 1 }) };
|
|
185
189
|
const curve = line === "stepped" ? pixelCurve : line === "curved" && variant === "line" ? "monotone" : "linear";
|
|
186
190
|
// A stack needs an area even without a fill; it uses the tint.
|
|
187
191
|
const textured = fill === "dots" || fill === "squares" || fill === "scanlines";
|
|
188
192
|
return variant === "stacked-area" || fill !== "none"
|
|
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)
|
|
193
|
+
? _jsx(Area, { ...common, type: curve, stackId: variant === "stacked-area" ? "total" : undefined, fill: textured || (mono && variant === "stacked-area") ? `url(#${id}-fill-${index})` : chartColor(slot), fillOpacity: mono && variant === "stacked-area" ? (dimmed ? 0.15 : slot % 5 === 2 ? 1 : 0.7) : dimmed ? 0.06 : 0.2 }, item.key)
|
|
190
194
|
: _jsx(Line, { ...common, type: curve }, item.key);
|
|
191
195
|
}), _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" })] });
|
|
192
196
|
const legendProps = { data, series, label: text.summary(label), variant: legend, summary, formatValue, formatTime,
|
|
@@ -201,7 +205,7 @@ export function Chart({ data, series, label, variant = "line", layout: requested
|
|
|
201
205
|
return ref(element);
|
|
202
206
|
if (ref)
|
|
203
207
|
ref.current = element;
|
|
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 => {
|
|
208
|
+
}, "data-slot": "chart", "data-variant": variant, "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 => {
|
|
205
209
|
onKeyDown?.(event);
|
|
206
210
|
if (event.defaultPrevented || drag.current)
|
|
207
211
|
return;
|
package/dist/pane-grid.d.ts
CHANGED
|
@@ -25,5 +25,6 @@ export type GridPaneProps = Omit<React.ComponentProps<"article">, "title" | "id"
|
|
|
25
25
|
size?: number;
|
|
26
26
|
newRow?: boolean;
|
|
27
27
|
actions?: React.ReactNode;
|
|
28
|
+
frame?: "default" | "none";
|
|
28
29
|
};
|
|
29
|
-
export declare function GridPane({ id, title, min: _min, size: _size, newRow: _newRow, actions, className, style, children, ...props }: GridPaneProps): React.JSX.Element;
|
|
30
|
+
export declare function GridPane({ id, title, min: _min, size: _size, newRow: _newRow, actions, frame, className, style, children, ...props }: GridPaneProps): React.JSX.Element;
|
package/dist/pane-grid.js
CHANGED
|
@@ -462,12 +462,12 @@ export function PaneGrid({ title, layout: controlled, defaultLayout, onLayoutCha
|
|
|
462
462
|
])),
|
|
463
463
|
]), _jsx("div", { ref: dropRef, className: "pane-grid-drop", "aria-hidden": "true", hidden: true })] })] }));
|
|
464
464
|
}
|
|
465
|
-
export function GridPane({ id, title, min: _min, size: _size, newRow: _newRow, actions, className, style, children, ...props }) {
|
|
465
|
+
export function GridPane({ id, title, min: _min, size: _size, newRow: _newRow, actions, frame = "default", className, style, children, ...props }) {
|
|
466
466
|
const context = React.useContext(PaneContext);
|
|
467
467
|
if (!context)
|
|
468
468
|
throw new Error("GridPane must be a child of PaneGrid.");
|
|
469
469
|
const { placement, api } = context;
|
|
470
|
-
return (_jsxs("article", { "data-slot": "grid-pane", "data-pane-id": id, className: cn("grid-pane card", className), style: { "--r": placement.row, "--c": placement.col, "--s": placement.span, ...style }, ...props, children: [_jsx(PanelShadow, {}), _jsxs("div", { "data-slot": "grid-pane-head", className: "grid-pane-head", ...(!placement.static && {
|
|
470
|
+
return (_jsxs("article", { "data-slot": "grid-pane", "data-pane-id": id, "data-frame": frame, className: cn("grid-pane", frame !== "none" && "card", className), style: { "--r": placement.row, "--c": placement.col, "--s": placement.span, ...style }, ...props, children: [frame !== "none" && _jsx(PanelShadow, {}), _jsxs("div", { "data-slot": "grid-pane-head", className: "grid-pane-head", ...(!placement.static && {
|
|
471
471
|
role: "button",
|
|
472
472
|
tabIndex: 0,
|
|
473
473
|
"aria-label": `Move ${title}`,
|
package/dist/styles.css
CHANGED
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
color: var(--color-foreground);
|
|
107
107
|
font-weight: var(--type-weight-medium);
|
|
108
108
|
}
|
|
109
|
-
.accent-pill:is([data-accent="gold"], [data-accent="lime"])
|
|
109
|
+
.accent-pill[aria-pressed="true"]:has(> :is([data-accent="gold"], [data-accent="lime"])) { border-color: var(--color-link); }
|
|
110
110
|
.accent-dot { width: var(--spacing-md); height: var(--spacing-md); border-radius: var(--radius-full); background: var(--color-primary); }
|
|
111
111
|
|
|
112
112
|
.accent-preview {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momoi-labs/kiso-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.38.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.16.0",
|
|
36
36
|
"class-variance-authority": "0.7.1",
|
|
37
37
|
"clsx": "2.1.1",
|
|
38
38
|
"radix-ui": "1.6.7",
|