@momoi-labs/kiso-react 0.16.0 → 0.16.2
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/app-shell.js +1 -1
- package/dist/diagram.js +19 -6
- package/package.json +2 -2
package/dist/app-shell.js
CHANGED
|
@@ -72,7 +72,7 @@ function ApplicationShellSidebar({ brand, primaryAction, navigation, navigationL
|
|
|
72
72
|
}
|
|
73
73
|
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;
|
|
74
74
|
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" }) }));
|
|
75
|
-
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 }), togglePlacement === "header" && toggle, header] }), children] }), panel, _jsx(Drawer, { open: drawerOpen, onOpenChange: setDrawerOpen, children: _jsxs(DrawerContent, { placement: "side", className: "app-shell-drawer", onCloseAutoFocus: (event) => {
|
|
75
|
+
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
76
|
event.preventDefault();
|
|
77
77
|
menuRef.current?.focus();
|
|
78
78
|
}, children: [_jsxs(DrawerHeader, { children: [_jsx(VisuallyHidden.Root, { asChild: true, children: _jsx(DrawerTitle, { children: "Navigation" }) }), brand] }), _jsxs(DrawerBody, { onClick: (event) => {
|
package/dist/diagram.js
CHANGED
|
@@ -29,10 +29,12 @@ const statuses = {
|
|
|
29
29
|
};
|
|
30
30
|
const RADIUS = 8;
|
|
31
31
|
/* An edge is two paths. The trunk is the horizontal run out of the source,
|
|
32
|
-
shared by every edge that leaves it
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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. */
|
|
36
38
|
function elbow(sx, sy, tx, ty, mid) {
|
|
37
39
|
const dy = ty - sy;
|
|
38
40
|
if (Math.abs(dy) < 1)
|
|
@@ -102,7 +104,10 @@ function Diagram({ label, background, strength, borderStyle, cornerStyle, corner
|
|
|
102
104
|
// labels never land on the same spot. One edge enters at the middle.
|
|
103
105
|
const measured = edges.flatMap((edge) => {
|
|
104
106
|
const target = box(edge.to);
|
|
105
|
-
const sources = edge.from.
|
|
107
|
+
const sources = edge.from.flatMap((id) => {
|
|
108
|
+
const found = box(id);
|
|
109
|
+
return found ? [{ ...found, id }] : [];
|
|
110
|
+
});
|
|
106
111
|
return target && sources.length ? [{ edge, target, sources }] : [];
|
|
107
112
|
});
|
|
108
113
|
const entries = new Map();
|
|
@@ -113,6 +118,14 @@ function Diagram({ label, background, strength, borderStyle, cornerStyle, corner
|
|
|
113
118
|
entries.set(item.edge, item.target.top + (item.target.height * (index + 1)) / (group.length + 1));
|
|
114
119
|
});
|
|
115
120
|
}
|
|
121
|
+
const leaving = new Map();
|
|
122
|
+
for (const edge of edges)
|
|
123
|
+
for (const id of edge.from)
|
|
124
|
+
leaving.set(id, [...(leaving.get(id) ?? []), edge]);
|
|
125
|
+
const trunkStyle = (id) => {
|
|
126
|
+
const [first, ...rest] = leaving.get(id) ?? [];
|
|
127
|
+
return first && rest.every((edge) => edge.line === first.line && edge.tone === first.tone) ? { line: first.line, tone: first.tone } : {};
|
|
128
|
+
};
|
|
116
129
|
const next = { paths: [], labels: [] };
|
|
117
130
|
for (const { edge, target, sources } of measured) {
|
|
118
131
|
const ty = entries.get(edge) ?? target.y;
|
|
@@ -120,7 +133,7 @@ function Diagram({ label, background, strength, borderStyle, cornerStyle, corner
|
|
|
120
133
|
const mid = (start + target.left) / 2;
|
|
121
134
|
sources.forEach((source, index) => {
|
|
122
135
|
const { trunk, branch } = elbow(source.right, source.y, target.left, ty, mid);
|
|
123
|
-
next.paths.push({ key: `${edge.key}:${index}:trunk`, d: trunk, arrow: false });
|
|
136
|
+
next.paths.push({ key: `${edge.key}:${index}:trunk`, d: trunk, arrow: false, ...trunkStyle(source.id) });
|
|
124
137
|
next.paths.push({ key: `${edge.key}:${index}`, d: branch, line: edge.line, tone: edge.tone, arrow: true });
|
|
125
138
|
});
|
|
126
139
|
// The label sits on the edge's own run into the target, above the line.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momoi-labs/kiso-react",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.2",
|
|
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": "^0.20.
|
|
35
|
+
"@momoi-labs/kiso": "^0.20.3",
|
|
36
36
|
"class-variance-authority": "0.7.1",
|
|
37
37
|
"clsx": "2.1.1",
|
|
38
38
|
"radix-ui": "1.6.7",
|