@momoi-labs/kiso-react 0.24.0 → 0.26.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/alert-dialog.d.ts +1 -1
- package/dist/alert-dialog.js +3 -2
- package/dist/app-shell.d.ts +1 -1
- package/dist/app-shell.js +3 -2
- package/dist/card.d.ts +1 -1
- package/dist/card.js +4 -3
- package/dist/chart-data.d.ts +2 -0
- package/dist/chart-data.js +1 -0
- package/dist/code-block.js +2 -1
- package/dist/combobox.d.ts +35 -0
- package/dist/combobox.js +131 -0
- package/dist/command-palette.js +2 -1
- package/dist/diagram-routes.d.ts +116 -0
- package/dist/diagram-routes.js +1182 -0
- package/dist/diagram.d.ts +81 -7
- package/dist/diagram.js +254 -89
- package/dist/dialog.js +2 -1
- package/dist/drawer.js +2 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/log-view.js +8 -7
- package/dist/panel-shadow.d.ts +1 -0
- package/dist/panel-shadow.js +6 -0
- package/dist/status-badge.d.ts +16 -2
- package/dist/status-badge.js +9 -2
- package/dist/styles.css +10 -4
- package/dist/table.js +3 -2
- package/package.json +2 -2
package/dist/diagram.d.ts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { type LucideIcon } from "lucide-react";
|
|
3
|
+
import { type DiagramSeries } from "./chart-data.js";
|
|
4
|
+
import { type DiagramArrow, type DiagramCrossings, type DiagramEdgeLine, type DiagramEdgeRoute, type DiagramEdgeShape, type DiagramEdgeTone, type DiagramLabels } from "./diagram-routes.js";
|
|
5
|
+
export type { DiagramArrow, DiagramCrossings, DiagramEdgeLine, DiagramEdgeRoute, DiagramEdgeShape, DiagramEdgeTone, DiagramLabels, DiagramSeries };
|
|
3
6
|
export type DiagramKind = "route" | "service" | "repository" | "image" | "database";
|
|
4
7
|
export type DiagramBackground = "solid" | "dots" | "grid" | "crosses" | "construction" | "guides" | "fibers";
|
|
5
8
|
export type DiagramStatus = "stopped" | "failed";
|
|
6
|
-
export type
|
|
7
|
-
export type DiagramEdgeTone = "neutral" | "success" | "danger";
|
|
9
|
+
export type DiagramDirection = "right" | "down" | "grid";
|
|
8
10
|
export type DiagramBorderStyle = "solid" | "none" | "rail" | "dash" | "bevel" | "double" | "base" | "offset" | "manga" | "brush";
|
|
9
11
|
export type DiagramCornerStyle = "square" | "rounded" | "asym" | "pixel";
|
|
10
12
|
export type DiagramCornerSize = "off" | "small" | "medium" | "large";
|
|
11
13
|
export type DiagramCornerMarks = "none" | "ticks" | "brackets" | "arcs" | "diagonal" | "dots";
|
|
14
|
+
export type DiagramShadowStyle = "auto" | "none" | "hard" | "soft";
|
|
12
15
|
export type DiagramFrameProps = {
|
|
16
|
+
shadowStyle?: DiagramShadowStyle;
|
|
13
17
|
borderStyle?: DiagramBorderStyle;
|
|
14
18
|
cornerStyle?: DiagramCornerStyle;
|
|
15
19
|
cornerSize?: DiagramCornerSize;
|
|
@@ -18,15 +22,59 @@ export type DiagramFrameProps = {
|
|
|
18
22
|
export type DiagramProps = Omit<React.ComponentProps<"div">, "children"> & DiagramFrameProps & {
|
|
19
23
|
/** Names the drawing for assistive technology. */
|
|
20
24
|
label: string;
|
|
25
|
+
/** `right` (default) reads DiagramColumns left to right; `down` reads
|
|
26
|
+
DiagramRows top to bottom; `grid` lays bands of DiagramColumns on
|
|
27
|
+
shared columns, and each edge picks its route. */
|
|
28
|
+
direction?: DiagramDirection;
|
|
29
|
+
/** The number of shared columns in a grid. */
|
|
30
|
+
columns?: number;
|
|
31
|
+
/** How an edge draws where it crosses a frame or another edge. */
|
|
32
|
+
crossings?: DiagramCrossings;
|
|
33
|
+
/** `auto` turns a label on a vertical run when it fits. */
|
|
34
|
+
labels?: DiagramLabels;
|
|
35
|
+
/** How edges are drawn: `orthogonal` (default) with rounded elbows,
|
|
36
|
+
`curve`, `straight`, or `sketch`, hand drawn. A DiagramEdge's `shape`
|
|
37
|
+
overrides it. */
|
|
38
|
+
edges?: DiagramEdgeShape;
|
|
39
|
+
/** The head at the end of each edge. Unset is `triangle`, or `sketch` on a
|
|
40
|
+
sketched edge. A DiagramEdge's `arrow` overrides it. */
|
|
41
|
+
arrow?: DiagramArrow;
|
|
42
|
+
/** A footer inside the card, under a rule, such as the key of the series
|
|
43
|
+
edges built from DiagramEdgeKey. */
|
|
44
|
+
footer?: React.ReactNode;
|
|
21
45
|
/** Unset follows the page's canvas; a page with no canvas gets dots. */
|
|
22
46
|
background?: DiagramBackground;
|
|
23
47
|
strength?: "quiet" | "visible";
|
|
24
48
|
children: React.ReactNode;
|
|
25
49
|
};
|
|
26
|
-
declare function Diagram({ label, background, strength, borderStyle, cornerStyle, cornerSize, cornerMarks, className, children, ...props }: DiagramProps): React.JSX.Element;
|
|
50
|
+
declare function Diagram({ label, direction, columns, crossings, labels, edges: shape, arrow, footer, background, strength, borderStyle, cornerStyle, cornerSize, cornerMarks, shadowStyle, className, children, ...props }: DiagramProps): React.JSX.Element;
|
|
27
51
|
declare function DiagramColumn({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
52
|
+
export type DiagramRowProps = React.ComponentProps<"div"> & {
|
|
53
|
+
/** Where the row's nodes sit across the drawing. Center by default. */
|
|
54
|
+
justify?: "center" | "start" | "end" | "between";
|
|
55
|
+
};
|
|
56
|
+
declare function DiagramRow({ justify, className, ...props }: DiagramRowProps): React.JSX.Element;
|
|
57
|
+
export type DiagramGroupLine = "dashed" | "solid" | "dotted";
|
|
58
|
+
export type DiagramGroupTone = "neutral" | "primary" | "info" | "success" | "warning" | "danger";
|
|
59
|
+
export type DiagramGroupProps = Omit<React.ComponentProps<"div">, "title"> & {
|
|
60
|
+
/** The caption in front of the title, such as "Cluster". */
|
|
61
|
+
label?: string;
|
|
62
|
+
/** The name on the border, in weight. */
|
|
63
|
+
title: React.ReactNode;
|
|
64
|
+
/** A line under a rule at the bottom of the frame. */
|
|
65
|
+
footer?: React.ReactNode;
|
|
66
|
+
/** The frame's line: `dashed` (default), `solid` or `dotted`. */
|
|
67
|
+
line?: DiagramGroupLine;
|
|
68
|
+
/** The frame's colour: `neutral` (default) or a tone. */
|
|
69
|
+
tone?: DiagramGroupTone;
|
|
70
|
+
/** The title becomes a button that folds the group to its frame. */
|
|
71
|
+
collapsible?: boolean;
|
|
72
|
+
/** Open by default. */
|
|
73
|
+
defaultOpen?: boolean;
|
|
74
|
+
};
|
|
75
|
+
declare function DiagramGroup({ label, title, footer, line, tone, collapsible, defaultOpen, className, style, children, ...props }: DiagramGroupProps): React.JSX.Element;
|
|
28
76
|
export type DiagramNodeGroupProps = React.ComponentProps<"div"> & DiagramFrameProps;
|
|
29
|
-
declare function DiagramNodeGroup({ borderStyle, cornerStyle, cornerSize, cornerMarks, className, ...props }: DiagramNodeGroupProps): React.JSX.Element;
|
|
77
|
+
declare function DiagramNodeGroup({ borderStyle, cornerStyle, cornerSize, cornerMarks, shadowStyle, className, ...props }: DiagramNodeGroupProps): React.JSX.Element;
|
|
30
78
|
export type DiagramNodeProps = Omit<React.ComponentProps<"div">, "title" | "children"> & DiagramFrameProps & {
|
|
31
79
|
/** Edges refer to the node by this id. Unique within the Diagram. */
|
|
32
80
|
id: string;
|
|
@@ -45,7 +93,7 @@ export type DiagramNodeProps = Omit<React.ComponentProps<"div">, "title" | "chil
|
|
|
45
93
|
Elements, such as facts or a fold, render as they are. */
|
|
46
94
|
children?: React.ReactNode;
|
|
47
95
|
};
|
|
48
|
-
declare function DiagramNode({ id, title, kind, icon, label, accent, status, borderStyle, cornerStyle, cornerSize, cornerMarks, className, children, ...props }: DiagramNodeProps): React.JSX.Element;
|
|
96
|
+
declare function DiagramNode({ id, title, kind, icon, label, accent, status, borderStyle, cornerStyle, cornerSize, cornerMarks, shadowStyle, className, children, ...props }: DiagramNodeProps): React.JSX.Element;
|
|
49
97
|
export type DiagramFactProps = Omit<React.ComponentProps<"div">, "children"> & {
|
|
50
98
|
icon?: LucideIcon;
|
|
51
99
|
label: string;
|
|
@@ -97,8 +145,34 @@ export type DiagramEdgeProps = {
|
|
|
97
145
|
to: string;
|
|
98
146
|
/** Mono text on the run into the target, such as a port or a variable. */
|
|
99
147
|
label?: string;
|
|
148
|
+
/** In a grid, forces the route the edge would otherwise pick from where
|
|
149
|
+
its nodes are: `side`, `down` or `drop`. */
|
|
150
|
+
route?: DiagramEdgeRoute;
|
|
151
|
+
/** Overrides the Diagram's `edges` for this edge. */
|
|
152
|
+
shape?: DiagramEdgeShape;
|
|
153
|
+
/** Overrides the Diagram's `arrow` for this edge. */
|
|
154
|
+
arrow?: DiagramArrow;
|
|
155
|
+
} & ({
|
|
100
156
|
line?: DiagramEdgeLine;
|
|
101
157
|
tone?: DiagramEdgeTone;
|
|
158
|
+
series?: never;
|
|
159
|
+
flow?: never;
|
|
160
|
+
}
|
|
161
|
+
/** A kind of link, such as replication or backups: the chart colour of the
|
|
162
|
+
slot and a dash of its own, or `"neutral"`, grey with its own dash.
|
|
163
|
+
`flow` moves the dash toward the target. */
|
|
164
|
+
| {
|
|
165
|
+
series: DiagramSeries;
|
|
166
|
+
flow?: boolean;
|
|
167
|
+
line?: never;
|
|
168
|
+
tone?: never;
|
|
169
|
+
});
|
|
170
|
+
declare function DiagramEdge({ from, to, label, route, line, tone, series: named, flow, shape, arrow }: DiagramEdgeProps): null;
|
|
171
|
+
export type DiagramEdgeKeyProps = Omit<React.ComponentProps<"span">, "children"> & {
|
|
172
|
+
/** A chart slot, or `"neutral"`. */
|
|
173
|
+
series: DiagramSeries;
|
|
174
|
+
/** What the series means, such as "WAL to storage". */
|
|
175
|
+
children: React.ReactNode;
|
|
102
176
|
};
|
|
103
|
-
declare function
|
|
104
|
-
export { Diagram, DiagramColumn, DiagramNodeGroup, DiagramNode, DiagramFact, DiagramFold, DiagramFilter, DiagramSection, DiagramLine, DiagramEdge };
|
|
177
|
+
declare function DiagramEdgeKey({ series, className, children, ...props }: DiagramEdgeKeyProps): React.JSX.Element;
|
|
178
|
+
export { Diagram, DiagramColumn, DiagramRow, DiagramGroup, DiagramEdgeKey, DiagramNodeGroup, DiagramNode, DiagramFact, DiagramFold, DiagramFilter, DiagramSection, DiagramLine, DiagramEdge };
|
package/dist/diagram.js
CHANGED
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { PanelShadow } from "./panel-shadow.js";
|
|
2
3
|
import * as React from "react";
|
|
3
4
|
import { clsx as cn } from "clsx";
|
|
4
5
|
import { ChevronDown, ChevronUp, Container, Database, GitBranch, Route, Server } from "lucide-react";
|
|
5
6
|
import { Badge } from "./badge.js";
|
|
6
7
|
import { Card } from "./card.js";
|
|
8
|
+
import { seriesColor } from "./chart-data.js";
|
|
7
9
|
import { StatusBadge } from "./status-badge.js";
|
|
8
10
|
import { useIsomorphicLayoutEffect } from "./use-isomorphic-layout-effect.js";
|
|
11
|
+
import { draw, route, } from "./diagram-routes.js";
|
|
12
|
+
/* The number of dash patterns in ui.css. Series past it reuse a dash with a
|
|
13
|
+
new colour, so the pair stays unique. */
|
|
14
|
+
const DASHES = 5;
|
|
15
|
+
/* The router keys series by number, so the neutral series travels through
|
|
16
|
+
it as this slot. No chart slot is below 1. */
|
|
17
|
+
const NEUTRAL = -1;
|
|
18
|
+
const slotOf = (series) => series === "neutral" ? NEUTRAL : series;
|
|
19
|
+
const seriesOf = (slot) => slot === NEUTRAL ? "neutral" : slot;
|
|
20
|
+
/* The neutral series has a dash of its own, outside the five. */
|
|
21
|
+
const dashOf = (series) => series === "neutral" ? "neutral" : ((Math.max(1, Math.round(series)) - 1) % DASHES) + 1;
|
|
22
|
+
const colorOf = (slot) => seriesColor(seriesOf(slot));
|
|
9
23
|
const DiagramContext = React.createContext(null);
|
|
10
24
|
function useRegistry(part) {
|
|
11
25
|
const registry = React.useContext(DiagramContext);
|
|
@@ -23,42 +37,28 @@ const kinds = {
|
|
|
23
37
|
image: { label: "Container image", tone: "primary", icon: Container },
|
|
24
38
|
database: { label: "Database", tone: "info", icon: Database },
|
|
25
39
|
};
|
|
40
|
+
/* Heads other than the triangle, in the same 10 by 10 box with the tip at
|
|
41
|
+
x 10 and the marker's reference at x 9, so each sits where the triangle
|
|
42
|
+
does. Open heads are strokes; ui.css paints them. */
|
|
43
|
+
const heads = {
|
|
44
|
+
chevron: _jsx("path", { d: "M 2 1.5 L 9.5 5 L 2 8.5" }),
|
|
45
|
+
stealth: _jsx("path", { d: "M 0 0 L 10 5 L 0 10 L 3 5 z" }),
|
|
46
|
+
dot: _jsx("circle", { cx: "6.6", cy: "5", r: "3.4" }),
|
|
47
|
+
sketch: _jsx("path", { d: "M 0.6 1.8 Q 4.6 2.6 9.4 5.4 M 2 9.8 Q 5 6.8 9.6 4.9" }),
|
|
48
|
+
};
|
|
26
49
|
const statuses = {
|
|
27
50
|
stopped: { label: "Stopped", tone: "neutral" },
|
|
28
51
|
failed: { label: "Failed", tone: "danger" },
|
|
29
52
|
};
|
|
30
|
-
|
|
31
|
-
/* An edge is two paths. The trunk is the horizontal run out of the source,
|
|
32
|
-
shared by every edge that leaves it. It carries their line and tone when
|
|
33
|
-
they all agree, so a single dotted edge is dotted end to end; when they
|
|
34
|
-
differ it stays solid and neutral, since two styles on one line would
|
|
35
|
-
paint over each other. The branch is the rest, the turn onto the merge
|
|
36
|
-
column, the vertical run and the straight run into the target, and it
|
|
37
|
-
carries the edge's line and tone. */
|
|
38
|
-
function elbow(sx, sy, tx, ty, mid) {
|
|
39
|
-
const dy = ty - sy;
|
|
40
|
-
if (Math.abs(dy) < 1)
|
|
41
|
-
return { trunk: `M ${sx} ${sy} H ${mid}`, branch: `M ${mid} ${sy} H ${tx}` };
|
|
42
|
-
const r = Math.max(0, Math.min(RADIUS, Math.abs(dy) / 2, mid - sx, tx - mid));
|
|
43
|
-
const d = Math.sign(dy);
|
|
44
|
-
return {
|
|
45
|
-
trunk: `M ${sx} ${sy} H ${mid - r}`,
|
|
46
|
-
branch: [
|
|
47
|
-
`M ${mid - r} ${sy}`,
|
|
48
|
-
`Q ${mid} ${sy} ${mid} ${sy + d * r}`,
|
|
49
|
-
`V ${ty - d * r}`,
|
|
50
|
-
`Q ${mid} ${ty} ${mid + r} ${ty}`,
|
|
51
|
-
`H ${tx}`,
|
|
52
|
-
].join(" "),
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
function Diagram({ label, background, strength, borderStyle, cornerStyle, cornerSize, cornerMarks, className, children, ...props }) {
|
|
53
|
+
function Diagram({ label, direction = "right", columns, crossings = "none", labels = "auto", edges: shape, arrow, footer, background, strength, borderStyle, cornerStyle, cornerSize, cornerMarks, shadowStyle, className, children, ...props }) {
|
|
56
54
|
const frame = React.useRef(null);
|
|
57
55
|
const scroll = React.useRef(null);
|
|
56
|
+
const lanes = React.useRef(null);
|
|
57
|
+
const svg = React.useRef(null);
|
|
58
58
|
const nodes = React.useRef(new Map()).current;
|
|
59
|
-
const [
|
|
59
|
+
const [registered, setRegistered] = React.useState([]);
|
|
60
60
|
const [version, setVersion] = React.useState(0);
|
|
61
|
-
const [drawn, setDrawn] = React.useState({ paths: [], labels: [] });
|
|
61
|
+
const [drawn, setDrawn] = React.useState({ paths: [], labels: [], plates: [], dots: [] });
|
|
62
62
|
const marker = `${React.useId()}arrow`;
|
|
63
63
|
const register = React.useCallback((id, element) => {
|
|
64
64
|
if (element)
|
|
@@ -68,10 +68,12 @@ function Diagram({ label, background, strength, borderStyle, cornerStyle, corner
|
|
|
68
68
|
setVersion((value) => value + 1);
|
|
69
69
|
}, [nodes]);
|
|
70
70
|
const addEdge = React.useCallback((edge) => {
|
|
71
|
-
|
|
72
|
-
return () =>
|
|
71
|
+
setRegistered((list) => [...list, edge]);
|
|
72
|
+
return () => setRegistered((list) => list.filter((item) => item !== edge));
|
|
73
73
|
}, []);
|
|
74
|
-
const
|
|
74
|
+
const refresh = React.useCallback(() => setVersion((value) => value + 1), []);
|
|
75
|
+
const context = React.useMemo(() => ({ nodes, register, addEdge, refresh, direction }), [nodes, register, addEdge, refresh, direction]);
|
|
76
|
+
const labelSizes = React.useRef(new Map());
|
|
75
77
|
useIsomorphicLayoutEffect(() => {
|
|
76
78
|
const root = frame.current;
|
|
77
79
|
const region = scroll.current;
|
|
@@ -81,87 +83,244 @@ function Diagram({ label, background, strength, borderStyle, cornerStyle, corner
|
|
|
81
83
|
// wrapping only cramps it, so it takes its natural width and scrolls.
|
|
82
84
|
const fit = () => {
|
|
83
85
|
root.removeAttribute("data-overflow");
|
|
84
|
-
|
|
86
|
+
// A node wider than its stage, such as a card with an unbroken URL in
|
|
87
|
+
// a group, spills past the lanes without widening them, so its spill
|
|
88
|
+
// counts as well.
|
|
89
|
+
if (root.offsetWidth > region.clientWidth || root.scrollWidth > root.clientWidth + 1)
|
|
85
90
|
root.setAttribute("data-overflow", "");
|
|
86
91
|
};
|
|
87
|
-
const
|
|
92
|
+
const layout = (pass) => {
|
|
88
93
|
fit();
|
|
89
94
|
const origin = root.getBoundingClientRect();
|
|
95
|
+
const place = (rect) => ({
|
|
96
|
+
left: rect.left - origin.left, right: rect.right - origin.left,
|
|
97
|
+
top: rect.top - origin.top, bottom: rect.bottom - origin.top,
|
|
98
|
+
width: rect.width, height: rect.height,
|
|
99
|
+
});
|
|
100
|
+
// A node inside a folded group is hidden, so its edges reach the
|
|
101
|
+
// outermost folded group around it instead.
|
|
102
|
+
const elements = new Map(nodes);
|
|
103
|
+
const proxies = new Map();
|
|
104
|
+
const resolve = (id) => {
|
|
105
|
+
const element = nodes.get(id);
|
|
106
|
+
if (!element)
|
|
107
|
+
return null;
|
|
108
|
+
let folded = null;
|
|
109
|
+
for (let item = element.closest('.diagram-group[data-open="false"]'); item; item = item.parentElement?.closest('.diagram-group[data-open="false"]') ?? null)
|
|
110
|
+
folded = item;
|
|
111
|
+
if (!folded)
|
|
112
|
+
return id;
|
|
113
|
+
let proxy = proxies.get(folded);
|
|
114
|
+
if (!proxy) {
|
|
115
|
+
proxy = `group:${proxies.size}`;
|
|
116
|
+
proxies.set(folded, proxy);
|
|
117
|
+
elements.set(proxy, folded);
|
|
118
|
+
}
|
|
119
|
+
return proxy;
|
|
120
|
+
};
|
|
90
121
|
const box = (id) => {
|
|
91
|
-
const
|
|
92
|
-
if (!
|
|
122
|
+
const element = elements.get(id);
|
|
123
|
+
if (!element)
|
|
93
124
|
return null;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
125
|
+
const rect = place(element.getBoundingClientRect());
|
|
126
|
+
// A node in a DiagramNodeGroup is one part of a stacked card. Read
|
|
127
|
+
// top to bottom, its edges leave and enter the card's own top and
|
|
128
|
+
// bottom, so they never cross the parts above or below it.
|
|
129
|
+
const card = direction !== "right" && !proxies.has(element) ? element.closest(".diagram-node-group")?.getBoundingClientRect() : undefined;
|
|
130
|
+
if (card) {
|
|
131
|
+
rect.top = card.top - origin.top;
|
|
132
|
+
rect.bottom = card.bottom - origin.top;
|
|
133
|
+
rect.height = card.height;
|
|
134
|
+
}
|
|
135
|
+
// A folded frame carries its title on its top border, so an edge
|
|
136
|
+
// into its top ends just under the title instead of behind it.
|
|
137
|
+
const name = proxies.has(element) ? element.querySelector(":scope > .diagram-group-title")?.getBoundingClientRect() : undefined;
|
|
138
|
+
if (name) {
|
|
139
|
+
const top = name.bottom - origin.top;
|
|
140
|
+
rect.height -= top - rect.top;
|
|
141
|
+
rect.top = top;
|
|
142
|
+
}
|
|
143
|
+
return { ...rect, id, x: rect.left + rect.width / 2, y: rect.top + rect.height / 2 };
|
|
101
144
|
};
|
|
102
|
-
//
|
|
103
|
-
//
|
|
104
|
-
|
|
105
|
-
const measured =
|
|
106
|
-
const
|
|
107
|
-
|
|
145
|
+
// An edge inside one folded group is not drawn, and edges that now
|
|
146
|
+
// join the same ends with the same look are drawn once.
|
|
147
|
+
const seen = new Set();
|
|
148
|
+
const measured = registered.flatMap((edge) => {
|
|
149
|
+
const to = resolve(edge.to);
|
|
150
|
+
if (!to)
|
|
151
|
+
return [];
|
|
152
|
+
// Each source and target pair is drawn once per look, so edges whose
|
|
153
|
+
// source lists overlap after folding do not repeat a connection.
|
|
154
|
+
const looks = `${edge.series ?? ""}|${edge.line ?? ""}|${edge.tone ?? ""}|${edge.shape ?? ""}|${edge.head ?? ""}`;
|
|
155
|
+
const resolved = [...new Set(edge.from.map(resolve))].filter((id) => !!id && id !== to);
|
|
156
|
+
const folded = to !== edge.to || resolved.length !== edge.from.length || resolved.some((id, index) => id !== edge.from[index]);
|
|
157
|
+
const from = folded ? resolved.filter((id) => !seen.has(`${id}->${to}|${looks}`)) : resolved;
|
|
158
|
+
for (const id of from)
|
|
159
|
+
seen.add(`${id}->${to}|${looks}`);
|
|
160
|
+
if (!from.length)
|
|
161
|
+
return [];
|
|
162
|
+
const target = box(to);
|
|
163
|
+
const sources = from.flatMap((id) => {
|
|
108
164
|
const found = box(id);
|
|
109
|
-
return found ? [
|
|
165
|
+
return found ? [found] : [];
|
|
110
166
|
});
|
|
111
|
-
return target && sources.length ? [{ edge, target, sources }] : [];
|
|
167
|
+
return target && sources.length ? [{ edge: folded ? { ...edge, to, from } : edge, target, sources }] : [];
|
|
112
168
|
});
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
169
|
+
const all = [...new Set([...nodes.keys()].map(resolve))].flatMap((id) => {
|
|
170
|
+
const found = id ? box(id) : null;
|
|
171
|
+
return found ? [found] : [];
|
|
172
|
+
});
|
|
173
|
+
const groups = Array.from(lanes.current?.querySelectorAll(".diagram-group") ?? []);
|
|
174
|
+
// Open groups the routes keep their runs out of, unless they hold an
|
|
175
|
+
// end. A folded group is a node already; groups inside it have no box.
|
|
176
|
+
const walls = groups.flatMap((element, index) => {
|
|
177
|
+
if (proxies.has(element))
|
|
178
|
+
return [];
|
|
179
|
+
const rect = place(element.getBoundingClientRect());
|
|
180
|
+
return rect.width && rect.height ? [{ ...rect, id: `frame:${index}`, x: rect.left + rect.width / 2, y: rect.top + rect.height / 2 }] : [];
|
|
181
|
+
});
|
|
182
|
+
const routes = route(measured, all, direction, walls);
|
|
183
|
+
// An edge that comes into a group from the side needs room between
|
|
184
|
+
// the border and the node, so the line runs straight after crossing
|
|
185
|
+
// the border. Only the sides where edges come in get it.
|
|
186
|
+
const entering = new Map();
|
|
187
|
+
for (const route of routes) {
|
|
188
|
+
const end = route.points[route.points.length - 1];
|
|
189
|
+
const before = route.points[route.points.length - 2];
|
|
190
|
+
if (!route.arrow || !route.ends || !end || !before || Math.abs(end[1] - before[1]) >= 0.5)
|
|
191
|
+
continue;
|
|
192
|
+
const source = elements.get(route.ends[0]);
|
|
193
|
+
const target = elements.get(route.ends[1]);
|
|
194
|
+
let group = (target?.matches(".diagram-group") ? target.parentElement : target)?.closest(".diagram-group");
|
|
195
|
+
while (group && !(source && group.contains(source))) {
|
|
196
|
+
entering.set(group, (entering.get(group) ?? new Set()).add(end[0] > before[0] ? "left" : "right"));
|
|
197
|
+
group = group.parentElement?.closest(".diagram-group");
|
|
198
|
+
}
|
|
120
199
|
}
|
|
121
|
-
|
|
122
|
-
for (const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
200
|
+
let moved = false;
|
|
201
|
+
for (const group of groups) {
|
|
202
|
+
const sides = [...(entering.get(group) ?? [])].sort().join(" ");
|
|
203
|
+
if ((group.getAttribute("data-entry") ?? "") === sides)
|
|
204
|
+
continue;
|
|
205
|
+
if (sides)
|
|
206
|
+
group.setAttribute("data-entry", sides);
|
|
207
|
+
else
|
|
208
|
+
group.removeAttribute("data-entry");
|
|
209
|
+
moved = true;
|
|
210
|
+
}
|
|
211
|
+
// The room moved the nodes, so measure again; a second pass settles.
|
|
212
|
+
if (moved && pass < 2)
|
|
213
|
+
return layout(pass + 1);
|
|
214
|
+
const frames = groups.map((element) => ({
|
|
215
|
+
...place(element.getBoundingClientRect()),
|
|
216
|
+
radius: parseFloat(getComputedStyle(element).borderTopLeftRadius) || 0,
|
|
217
|
+
}));
|
|
218
|
+
// Labels are measured once and kept, since measuring makes the page lay
|
|
219
|
+
// out again. New labels are measured in one batch: the probes go in
|
|
220
|
+
// together and are read together. A loaded font clears what was kept.
|
|
221
|
+
const sizes = labelSizes.current;
|
|
222
|
+
const host = svg.current;
|
|
223
|
+
if (host) {
|
|
224
|
+
const probes = [...new Set(routes.flatMap((item) => item.label && !sizes.has(item.label.text) ? [item.label.text] : []))].map((text) => {
|
|
225
|
+
const probe = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
226
|
+
probe.setAttribute("class", "diagram-edge-label");
|
|
227
|
+
probe.textContent = text;
|
|
228
|
+
host.appendChild(probe);
|
|
229
|
+
return [text, probe];
|
|
138
230
|
});
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
231
|
+
for (const [text, probe] of probes) {
|
|
232
|
+
const { width, height } = probe.getBBox();
|
|
233
|
+
sizes.set(text, { width, height });
|
|
234
|
+
}
|
|
235
|
+
for (const [, probe] of probes)
|
|
236
|
+
probe.remove();
|
|
142
237
|
}
|
|
143
|
-
|
|
238
|
+
const measure = (text) => sizes.get(text) ?? { width: text.length * 7, height: 12 };
|
|
239
|
+
setDrawn(draw(routes, frames, crossings, labels, measure, { shape, arrow, boxes: new Map(all.map((item) => [item.id, item])) }));
|
|
144
240
|
};
|
|
241
|
+
const measure = () => layout(0);
|
|
145
242
|
measure();
|
|
146
243
|
const observer = new ResizeObserver(measure);
|
|
147
244
|
observer.observe(root);
|
|
148
245
|
observer.observe(region);
|
|
149
246
|
nodes.forEach((element) => observer.observe(element));
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
247
|
+
const fonts = typeof document !== "undefined" ? document.fonts : undefined;
|
|
248
|
+
const refont = () => {
|
|
249
|
+
labelSizes.current.clear();
|
|
250
|
+
measure();
|
|
251
|
+
};
|
|
252
|
+
fonts?.addEventListener("loadingdone", refont);
|
|
253
|
+
return () => {
|
|
254
|
+
observer.disconnect();
|
|
255
|
+
fonts?.removeEventListener("loadingdone", refont);
|
|
256
|
+
};
|
|
257
|
+
}, [direction, crossings, labels, shape, arrow, registered, nodes, version]);
|
|
258
|
+
return (_jsx(DiagramContext.Provider, { value: context, children: _jsxs("div", { ...props, "data-slot": "diagram", className: cn("card diagram", className), "data-direction": direction, "data-background-style": background, "data-background-strength": strength, children: [_jsx(PanelShadow, {}), _jsx("div", { ref: scroll, "data-slot": "diagram-scroll", className: "diagram-scroll", role: "group", "aria-label": label, tabIndex: 0, children: _jsxs("div", { ref: frame, "data-slot": "diagram-canvas", className: "diagram-canvas", children: [_jsx("div", { ref: lanes, "data-slot": "diagram-lanes", className: "diagram-lanes", "data-direction": direction, style: direction === "grid" && columns ? { "--diagram-columns": columns } : undefined, "data-border-style": borderStyle, "data-corner-style": cornerStyle, "data-corner-size": cornerSize, "data-corner-marks": cornerMarks, "data-shadow-style": shadowStyle, "data-edge-labels": registered.some((edge) => edge.label) || undefined, children: children }), _jsxs("svg", { ref: svg, className: "diagram-edges", "aria-hidden": "true", children: [_jsxs("defs", { children: [["neutral", "success", "danger"].map((tone) => (_jsx("marker", { id: `${marker}-${tone}`, className: "diagram-arrow", "data-tone": tone, viewBox: "0 0 10 10", refX: "9", refY: "5", markerWidth: "7", markerHeight: "7", orient: "auto-start-reverse", children: _jsx("path", { d: "M 0 0 L 10 5 L 0 10 z" }) }, tone))), [...new Set(registered.flatMap((edge) => edge.series ? [edge.series] : []))].map((series) => (_jsx("marker", { id: `${marker}-s${series}`, className: "diagram-arrow", style: { color: colorOf(series) }, viewBox: "0 0 10 10", refX: "9", refY: "5", markerWidth: "6", markerHeight: "6", orient: "auto-start-reverse", children: _jsx("path", { d: "M 0 0 L 10 5 L 0 10 z" }) }, series))), [...new Set(drawn.paths.flatMap((path) => path.arrow && path.head !== "triangle" && path.head !== "none"
|
|
259
|
+
? [`${path.head}|${path.series ? `s${path.series}` : path.tone ?? "neutral"}`] : []))].map((id) => {
|
|
260
|
+
const [head, paint] = id.split("|");
|
|
261
|
+
const series = paint.startsWith("s") ? Number(paint.slice(1)) : undefined;
|
|
262
|
+
const size = series ? "6" : "7";
|
|
263
|
+
return (_jsx("marker", { id: `${marker}-${head}-${paint}`, className: "diagram-arrow", "data-arrow": head, "data-tone": series ? undefined : paint, style: series ? { color: colorOf(series) } : undefined, viewBox: "0 0 10 10", refX: "9", refY: "5", markerWidth: size, markerHeight: size, orient: "auto-start-reverse", children: heads[head] }, id));
|
|
264
|
+
})] }), drawn.plates.map((plate) => (_jsx("rect", { className: "diagram-edge-plate", x: plate.x, y: plate.y, width: plate.width, height: plate.height }, plate.key))), drawn.paths.map((path) => {
|
|
265
|
+
const series = path.series;
|
|
266
|
+
const paint = series ? `s${series}` : path.tone ?? "neutral";
|
|
267
|
+
return (_jsxs(React.Fragment, { children: [path.knock && _jsx("path", { className: "diagram-edge-knock", d: path.knock }), _jsx("path", { d: path.d, "data-shape": path.shape && path.shape !== "orthogonal" ? path.shape : undefined, "data-line": series ? undefined : path.line, "data-tone": series ? undefined : path.tone, "data-series": series ? seriesOf(series) : undefined, "data-dash": series ? dashOf(seriesOf(series)) : undefined, "data-flow": (series && path.flow) || undefined, style: series ? { color: colorOf(series) } : undefined, markerEnd: !path.arrow || path.head === "none" ? undefined : `url(#${marker}-${path.head === "triangle" ? "" : `${path.head}-`}${paint})` })] }, path.key));
|
|
268
|
+
}), drawn.dots.map((dot) => (_jsx("circle", { className: "diagram-junction", cx: dot.x, cy: dot.y, r: "3", "data-tone": dot.series ? undefined : dot.tone, style: dot.series ? { color: colorOf(dot.series) } : undefined }, dot.key))), drawn.labels.map((item) => (_jsxs(React.Fragment, { children: [item.plate && _jsx("rect", { className: "diagram-edge-plate", x: item.plate.x, y: item.plate.y, width: item.plate.width, height: item.plate.height }), _jsx("text", { x: item.x, y: item.y, className: "diagram-edge-label", "data-anchor": item.anchor, "data-orient": item.rotate ? "vertical" : item.middle ? "inline" : undefined, transform: item.rotate ? `rotate(-90 ${item.x} ${item.y})` : undefined, children: item.lines.length > 1
|
|
269
|
+
? _jsxs(_Fragment, { children: [_jsx("tspan", { x: item.x, dy: "-1.2em", children: item.lines[0] }), _jsx("tspan", { x: item.x, dy: "1.2em", children: item.lines[1] })] })
|
|
270
|
+
: item.lines[0] })] }, item.key)))] })] }) }), footer != null && (_jsx("div", { "data-slot": "diagram-footer", className: "diagram-footer", children: _jsx("div", { className: "diagram-footer-items", children: footer }) }))] }) }));
|
|
153
271
|
}
|
|
272
|
+
/* A stage of a Diagram read left to right. */
|
|
154
273
|
function DiagramColumn({ className, ...props }) {
|
|
155
|
-
return _jsx("div", { ...props, "data-slot": "diagram-column", className: cn("diagram-column", className) });
|
|
274
|
+
return _jsx("div", { ...props, "data-slot": "diagram-column", className: cn("diagram-stage diagram-column", className) });
|
|
275
|
+
}
|
|
276
|
+
/* A stage of a Diagram read top to bottom: nodes side by side. The rows
|
|
277
|
+
share the width of the widest one, so `justify` can put a node under the
|
|
278
|
+
one it hangs from without a layout engine. */
|
|
279
|
+
function DiagramRow({ justify, className, ...props }) {
|
|
280
|
+
return _jsx("div", { ...props, "data-slot": "diagram-row", className: cn("diagram-stage diagram-row", className), "data-justify": justify });
|
|
281
|
+
}
|
|
282
|
+
/* A frame around one or more nodes, each still its own card, or around
|
|
283
|
+
other groups, with its name on the top border, a line and a colour.
|
|
284
|
+
Edges reach each node inside it. A DiagramNodeGroup is one card split by
|
|
285
|
+
rules; a DiagramGroup is a frame around cards. */
|
|
286
|
+
/* A collapsible group folds to one line: the title stays on the border, its
|
|
287
|
+
nodes show only their icon and title side by side, and edges to those
|
|
288
|
+
nodes reach the frame instead. The footer leaves while folded. The nodes
|
|
289
|
+
stay mounted, so they keep their state. */
|
|
290
|
+
function DiagramGroup({ label, title, footer, line, tone, collapsible = false, defaultOpen = true, className, style, children, ...props }) {
|
|
291
|
+
const name = React.useId();
|
|
292
|
+
const body = React.useId();
|
|
293
|
+
const registry = React.useContext(DiagramContext);
|
|
294
|
+
const [open, setOpen] = React.useState(defaultOpen);
|
|
295
|
+
// Folded, the frame keeps its size across the flow and gives up the rest,
|
|
296
|
+
// like a DiagramFold, so the stages beside it do not move: top to bottom
|
|
297
|
+
// and in a grid it keeps its width, left to right its height. The size
|
|
298
|
+
// belongs to the layout it was measured in; in another layout the folded
|
|
299
|
+
// frame takes its natural size.
|
|
300
|
+
const [size, setSize] = React.useState();
|
|
301
|
+
const kept = size && size.direction === registry?.direction
|
|
302
|
+
? size.direction === "right" ? { minBlockSize: size.height } : { inlineSize: size.width }
|
|
303
|
+
: undefined;
|
|
304
|
+
const frame = React.useRef(null);
|
|
305
|
+
const shown = !collapsible || open;
|
|
306
|
+
const text = _jsxs(_Fragment, { children: [label && _jsxs(_Fragment, { children: [_jsx("span", { className: "t-caps", children: label }), _jsx("span", { "aria-hidden": "true", children: "\u00B7" })] }), _jsx("strong", { children: title })] });
|
|
307
|
+
const Chevron = open ? ChevronUp : ChevronDown;
|
|
308
|
+
return (_jsxs("div", { ref: frame, role: "group", "aria-labelledby": name, ...props, "data-slot": "diagram-group", className: cn("diagram-group", className), "data-line": line, "data-tone": tone, "data-open": collapsible ? open : undefined, style: !shown && kept ? { ...style, ...kept } : style, children: [_jsx("span", { className: "diagram-group-title", children: collapsible ? (_jsxs("button", { type: "button", id: name, className: "diagram-group-toggle", "aria-expanded": open, "aria-controls": body, onClick: () => {
|
|
309
|
+
const rect = frame.current?.getBoundingClientRect();
|
|
310
|
+
if (open && rect)
|
|
311
|
+
setSize({ direction: registry?.direction, width: rect.width, height: rect.height });
|
|
312
|
+
setOpen(!open);
|
|
313
|
+
registry?.refresh();
|
|
314
|
+
}, children: [text, _jsx(Chevron, { className: "icon icon-sm", strokeWidth: 1.75, "aria-hidden": "true", focusable: "false" })] })) : _jsx("span", { id: name, className: "diagram-group-name", children: text }) }), _jsx("div", { id: body, className: "diagram-group-body", children: children }), footer != null && shown && _jsx("div", { className: "diagram-group-foot", children: footer })] }));
|
|
156
315
|
}
|
|
157
316
|
/* A group draws several nodes as one card, split by a rule, such as the
|
|
158
317
|
container that receives requests with the other containers under it.
|
|
159
318
|
Edges still reach each node on its own. The group carries the frame, so
|
|
160
319
|
its frame props replace the nodes' own. */
|
|
161
|
-
function DiagramNodeGroup({ borderStyle, cornerStyle, cornerSize, cornerMarks, className, ...props }) {
|
|
162
|
-
return (_jsx(Card, { ...props, "data-slot": "diagram-node-group", className: cn("diagram-node-group", className), "data-border-style": borderStyle, "data-corner-style": cornerStyle, "data-corner-size": cornerSize, "data-corner-marks": cornerMarks }));
|
|
320
|
+
function DiagramNodeGroup({ borderStyle, cornerStyle, cornerSize, cornerMarks, shadowStyle, className, ...props }) {
|
|
321
|
+
return (_jsx(Card, { ...props, "data-slot": "diagram-node-group", className: cn("diagram-node-group", className), "data-border-style": borderStyle, "data-corner-style": cornerStyle, "data-corner-size": cornerSize, "data-corner-marks": cornerMarks, "data-shadow-style": shadowStyle }));
|
|
163
322
|
}
|
|
164
|
-
function DiagramNode({ id, title, kind, icon, label, accent, status, borderStyle, cornerStyle, cornerSize, cornerMarks, className, children, ...props }) {
|
|
323
|
+
function DiagramNode({ id, title, kind, icon, label, accent, status, borderStyle, cornerStyle, cornerSize, cornerMarks, shadowStyle, className, children, ...props }) {
|
|
165
324
|
const { register } = useRegistry("DiagramNode");
|
|
166
325
|
const ref = React.useCallback((element) => register(id, element), [id, register]);
|
|
167
326
|
const spec = kind ? kinds[kind] : undefined;
|
|
@@ -171,7 +330,7 @@ function DiagramNode({ id, title, kind, icon, label, accent, status, borderStyle
|
|
|
171
330
|
const items = React.Children.toArray(children);
|
|
172
331
|
const text = items.filter((item) => typeof item === "string" || typeof item === "number");
|
|
173
332
|
const parts = items.filter((item) => typeof item !== "string" && typeof item !== "number");
|
|
174
|
-
return (_jsxs(Card, { ...props, ref: ref, "data-slot": "diagram-node", className: cn("diagram-node", className), "data-kind": kind, "data-tone": spec?.tone ?? "neutral", "data-accent": accent || undefined, "data-status": status, "data-border-style": borderStyle, "data-corner-style": cornerStyle, "data-corner-size": cornerSize, "data-corner-marks": cornerMarks, children: [caption && (_jsxs("span", { className: "diagram-node-kind", children: [glyph, _jsx("span", { className: "t-caps", children: caption })] })), title != null && (_jsxs("span", { className: "diagram-node-title", "data-lead": (!caption && !!glyph) || undefined, children: [!caption && glyph, title] })), text.length > 0 && _jsx("span", { className: "diagram-node-text mono", children: text }), status && (_jsx(StatusBadge, { tone: statuses[status].tone, className: "diagram-node-status", children: statuses[status].label })), parts] }));
|
|
333
|
+
return (_jsxs(Card, { ...props, ref: ref, "data-slot": "diagram-node", className: cn("diagram-node", className), "data-kind": kind, "data-tone": spec?.tone ?? "neutral", "data-accent": accent || undefined, "data-status": status, "data-border-style": borderStyle, "data-corner-style": cornerStyle, "data-corner-size": cornerSize, "data-corner-marks": cornerMarks, "data-shadow-style": shadowStyle, children: [caption && (_jsxs("span", { className: "diagram-node-kind", children: [glyph, _jsx("span", { className: "t-caps", children: caption })] })), title != null && (_jsxs("span", { className: "diagram-node-title", "data-lead": (!caption && !!glyph) || undefined, children: [!caption && glyph, title] })), text.length > 0 && _jsx("span", { className: "diagram-node-text mono", children: text }), status && (_jsx(StatusBadge, { tone: statuses[status].tone, className: "diagram-node-status", children: statuses[status].label })), parts] }));
|
|
175
334
|
}
|
|
176
335
|
/* One fact about a node as a line: its icon and name, the value on the
|
|
177
336
|
right. Long values wrap under the name before they widen the node. */
|
|
@@ -211,11 +370,17 @@ function DiagramLine({ end, onClick, className, children, ...props }) {
|
|
|
211
370
|
}
|
|
212
371
|
/* An edge renders nothing itself: it registers with the Diagram, which draws
|
|
213
372
|
it once the nodes are measured. */
|
|
214
|
-
function DiagramEdge({ from, to, label, line, tone }) {
|
|
373
|
+
function DiagramEdge({ from, to, label, route, line, tone, series: named, flow, shape, arrow }) {
|
|
215
374
|
const { addEdge } = useRegistry("DiagramEdge");
|
|
375
|
+
const series = named == null ? undefined : slotOf(named);
|
|
216
376
|
// Ids never contain a newline, so the join is a stable dependency.
|
|
217
377
|
const sources = (Array.isArray(from) ? from : [from]).join("\n");
|
|
218
|
-
React.useEffect(() => addEdge({ key: `${sources}->${to}`, from: sources.split("\n"), to, label, line, tone }), [addEdge, sources, to, label, line, tone]);
|
|
378
|
+
React.useEffect(() => addEdge({ key: `${sources}->${to}${series ? `#${series}` : ""}`, from: sources.split("\n"), to, label, route, line, tone, series, flow, shape, head: arrow }), [addEdge, sources, to, label, route, line, tone, series, flow, shape, arrow]);
|
|
219
379
|
return null;
|
|
220
380
|
}
|
|
221
|
-
|
|
381
|
+
/* A sample of a series edge, its colour and dash, with what it means. The
|
|
382
|
+
product lays these out as the drawing's key; the sample never moves. */
|
|
383
|
+
function DiagramEdgeKey({ series, className, children, ...props }) {
|
|
384
|
+
return (_jsxs("span", { ...props, "data-slot": "diagram-edge-key", className: cn("diagram-edge-key", className), children: [_jsx("svg", { viewBox: "0 0 28 6", "aria-hidden": "true", focusable: "false", style: { color: seriesColor(series) }, children: _jsx("path", { d: "M 2 3 H 26", "data-series": series, "data-dash": dashOf(series) }) }), children] }));
|
|
385
|
+
}
|
|
386
|
+
export { Diagram, DiagramColumn, DiagramRow, DiagramGroup, DiagramEdgeKey, DiagramNodeGroup, DiagramNode, DiagramFact, DiagramFold, DiagramFilter, DiagramSection, DiagramLine, DiagramEdge };
|
package/dist/dialog.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Adapted from shadcn/ui new-york-v4. See ../SHADCN-LICENSE.
|
|
2
2
|
"use client";
|
|
3
3
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { PanelShadow } from "./panel-shadow.js";
|
|
4
5
|
import { clsx as cn } from "clsx";
|
|
5
6
|
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
6
7
|
function Dialog({ ...props }) {
|
|
@@ -19,7 +20,7 @@ function DialogOverlay({ className, ...props }) {
|
|
|
19
20
|
return (_jsx(DialogPrimitive.Overlay, { "data-slot": "dialog-overlay", className: cn("kiso-react-overlay", className), ...props }));
|
|
20
21
|
}
|
|
21
22
|
function DialogContent({ className, children, ...props }) {
|
|
22
|
-
return (_jsxs(DialogPortal, { children: [_jsx(DialogOverlay, {}),
|
|
23
|
+
return (_jsxs(DialogPortal, { children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, { "aria-modal": "true", "data-slot": "dialog-content", className: cn("kiso-react-dialog marked", className), ...props, children: [_jsx(PanelShadow, {}), children] })] }));
|
|
23
24
|
}
|
|
24
25
|
function DialogHeader({ className, ...props }) {
|
|
25
26
|
return (_jsx("div", { "data-slot": "dialog-header", className: cn("dialog-header", className), ...props }));
|
package/dist/drawer.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { PanelShadow } from "./panel-shadow.js";
|
|
3
4
|
import { clsx as cn } from "clsx";
|
|
4
5
|
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
5
6
|
import { DialogBody, DialogClose, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogDescription, } from "./dialog.js";
|
|
@@ -12,6 +13,6 @@ function DrawerTrigger({ ...props }) {
|
|
|
12
13
|
return _jsx(DialogPrimitive.Trigger, { "data-slot": "drawer-trigger", ...props });
|
|
13
14
|
}
|
|
14
15
|
function DrawerContent({ className, placement = "bottom", children, ...props }) {
|
|
15
|
-
return (_jsxs(DialogPortal, { children: [_jsx(DialogOverlay, {}),
|
|
16
|
+
return (_jsxs(DialogPortal, { children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, { "aria-modal": "true", "data-slot": "drawer-content", "data-placement": placement, className: cn("kiso-react-drawer marked", className), ...props, children: [_jsx(PanelShadow, {}), children] })] }));
|
|
16
17
|
}
|
|
17
18
|
export { Drawer, DrawerTrigger, DrawerContent, DialogClose as DrawerClose, DialogHeader as DrawerHeader, DialogBody as DrawerBody, DialogFooter as DrawerFooter, DialogTitle as DrawerTitle, DialogDescription as DrawerDescription, };
|
package/dist/index.d.ts
CHANGED
|
@@ -7,9 +7,11 @@ export * from "./brand-mark.js";
|
|
|
7
7
|
export * from "./breadcrumb.js";
|
|
8
8
|
export * from "./button.js";
|
|
9
9
|
export * from "./card.js";
|
|
10
|
+
export * from "./panel-shadow.js";
|
|
10
11
|
export * from "./checkbox.js";
|
|
11
12
|
export * from "./chip-input.js";
|
|
12
13
|
export * from "./code-block.js";
|
|
14
|
+
export * from "./combobox.js";
|
|
13
15
|
export * from "./code-editor.js";
|
|
14
16
|
export * from "./filter-input.js";
|
|
15
17
|
export * from "./filter-expression.js";
|