@momoi-labs/kiso-react 0.14.0 → 0.16.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 +7 -2
- package/dist/app-shell.d.ts +12 -0
- package/dist/app-shell.js +48 -5
- package/dist/bottom-nav.d.ts +8 -0
- package/dist/bottom-nav.js +18 -0
- package/dist/chart.js +1 -1
- package/dist/chip-input.js +7 -1
- package/dist/code-editor.d.ts +12 -0
- package/dist/code-editor.js +40 -0
- package/dist/command-palette.js +16 -1
- package/dist/diagram.d.ts +54 -4
- package/dist/diagram.js +87 -15
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/lifecycle.d.ts +3 -1
- package/dist/lifecycle.js +24 -3
- package/dist/pane-grid.js +10 -4
- package/dist/styles.css +13 -1
- package/dist/tabs.d.ts +10 -1
- package/dist/tabs.js +66 -3
- package/package.json +2 -2
package/dist/alert-dialog.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Button } from "./button.js";
|
|
|
4
4
|
declare function AlertDialog({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Root>): React.JSX.Element;
|
|
5
5
|
declare function AlertDialogTrigger({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>): React.JSX.Element;
|
|
6
6
|
declare function AlertDialogPortal({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Portal>): React.JSX.Element;
|
|
7
|
-
declare function AlertDialogOverlay({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>): React.JSX.Element;
|
|
7
|
+
declare function AlertDialogOverlay({ className, onMouseDown, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>): React.JSX.Element;
|
|
8
8
|
declare function AlertDialogContent({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Content>): React.JSX.Element;
|
|
9
9
|
declare function AlertDialogHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
10
10
|
declare function AlertDialogFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
package/dist/alert-dialog.js
CHANGED
|
@@ -13,8 +13,13 @@ function AlertDialogTrigger({ ...props }) {
|
|
|
13
13
|
function AlertDialogPortal({ ...props }) {
|
|
14
14
|
return (_jsx(AlertDialogPrimitive.Portal, { "data-slot": "alert-dialog-portal", ...props }));
|
|
15
15
|
}
|
|
16
|
-
function AlertDialogOverlay({ className, ...props }) {
|
|
17
|
-
return (_jsx(AlertDialogPrimitive.Overlay, { "data-slot": "alert-dialog-overlay",
|
|
16
|
+
function AlertDialogOverlay({ className, onMouseDown, ...props }) {
|
|
17
|
+
return (_jsx(AlertDialogPrimitive.Overlay, { "data-slot": "alert-dialog-overlay",
|
|
18
|
+
// The dialog stays open on a backdrop tap, so focus must stay in it.
|
|
19
|
+
onMouseDown: (event) => {
|
|
20
|
+
onMouseDown?.(event);
|
|
21
|
+
event.preventDefault();
|
|
22
|
+
}, className: cn("kiso-react-overlay", className), ...props }));
|
|
18
23
|
}
|
|
19
24
|
function AlertDialogContent({ className, ...props }) {
|
|
20
25
|
return (_jsxs(AlertDialogPortal, { children: [_jsx(AlertDialogOverlay, {}), _jsx(AlertDialogPrimitive.Content, { "aria-modal": "true", "data-slot": "alert-dialog-content", className: cn("kiso-react-dialog marked", className), ...props })] }));
|
package/dist/app-shell.d.ts
CHANGED
|
@@ -42,9 +42,19 @@ type ApplicationShellSidebarProps = ApplicationShellSharedProps & {
|
|
|
42
42
|
collapsed?: boolean;
|
|
43
43
|
defaultCollapsed?: boolean;
|
|
44
44
|
onCollapsedChange?: (collapsed: boolean) => void;
|
|
45
|
+
/** Below 1024px the sidebar opens as a drawer. Control it to close the
|
|
46
|
+
* drawer from a destination it cannot see, such as a menu in a portal. */
|
|
47
|
+
drawerOpen?: boolean;
|
|
48
|
+
onDrawerOpenChange?: (open: boolean) => void;
|
|
49
|
+
/** Below 700px, "bottom" moves the destinations to a BottomNav. */
|
|
50
|
+
phoneNavigation?: "drawer" | "bottom";
|
|
51
|
+
bottomNav?: never;
|
|
45
52
|
};
|
|
46
53
|
type ApplicationShellTopbarProps = ApplicationShellSharedProps & {
|
|
47
54
|
layout: "topbar";
|
|
55
|
+
/** A BottomNav for phones, below 700px. */
|
|
56
|
+
bottomNav?: React.ReactNode;
|
|
57
|
+
phoneNavigation?: never;
|
|
48
58
|
navigation?: never;
|
|
49
59
|
navigationLabel?: never;
|
|
50
60
|
footer?: never;
|
|
@@ -53,6 +63,8 @@ type ApplicationShellTopbarProps = ApplicationShellSharedProps & {
|
|
|
53
63
|
collapsed?: never;
|
|
54
64
|
defaultCollapsed?: never;
|
|
55
65
|
onCollapsedChange?: never;
|
|
66
|
+
drawerOpen?: never;
|
|
67
|
+
onDrawerOpenChange?: never;
|
|
56
68
|
};
|
|
57
69
|
type ApplicationShellProps = ApplicationShellSidebarProps | ApplicationShellTopbarProps;
|
|
58
70
|
declare function ApplicationShell(props: ApplicationShellProps): React.JSX.Element;
|
package/dist/app-shell.js
CHANGED
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import { clsx as cn } from "clsx";
|
|
6
|
-
import { PanelLeftClose, PanelLeftOpen, PanelRight } from "lucide-react";
|
|
6
|
+
import { Ellipsis, Menu, PanelLeftClose, PanelLeftOpen, PanelRight } from "lucide-react";
|
|
7
|
+
import { Drawer, DrawerBody, DrawerContent, DrawerHeader, DrawerTitle } from "./drawer.js";
|
|
8
|
+
import { VisuallyHidden } from "radix-ui";
|
|
9
|
+
import { BottomNav, BottomNavBadge, BottomNavLink } from "./bottom-nav.js";
|
|
7
10
|
import { Button } from "./button.js";
|
|
8
11
|
import { Header } from "./header.js";
|
|
9
12
|
import { useIsomorphicLayoutEffect } from "./use-isomorphic-layout-effect.js";
|
|
@@ -33,13 +36,23 @@ function ApplicationShellNavigation({ navigation, navigationLabel, collapsible =
|
|
|
33
36
|
}
|
|
34
37
|
function ApplicationShell(props) {
|
|
35
38
|
if (props.layout === "topbar") {
|
|
36
|
-
const { brand, primaryAction, header, headerVariant, panel, children, layout: _layout, ...shellProps } = props;
|
|
37
|
-
return (_jsxs(AppShell, { ...shellProps, "data-layout": "topbar", children: [_jsxs(AppShellMain, { children: [_jsxs(Header, { variant: headerVariant, children: [brand, primaryAction, header] }), children] }), panel] }));
|
|
39
|
+
const { brand, primaryAction, header, headerVariant, panel, bottomNav, children, layout: _layout, ...shellProps } = props;
|
|
40
|
+
return (_jsxs(AppShell, { ...shellProps, "data-layout": "topbar", children: [_jsxs(AppShellMain, { children: [_jsxs(Header, { variant: headerVariant, children: [brand, primaryAction, header] }), children] }), panel, bottomNav] }));
|
|
38
41
|
}
|
|
39
42
|
return _jsx(ApplicationShellSidebar, { ...props });
|
|
40
43
|
}
|
|
41
|
-
function ApplicationShellSidebar({ brand, primaryAction, navigation, navigationLabel = "Primary", footer, header, headerVariant, panel, children, layout: _layout, collapsible = false, togglePlacement = "sidebar", collapsed, defaultCollapsed = false, onCollapsedChange, ...shellProps }) {
|
|
44
|
+
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 }) {
|
|
42
45
|
const [internalCollapsed, setInternalCollapsed] = React.useState(defaultCollapsed);
|
|
46
|
+
// Below 1024px the sidebar is not in the page; the same brand, action,
|
|
47
|
+
// navigation and footer open in a drawer from the header instead.
|
|
48
|
+
const [innerDrawer, setInnerDrawer] = React.useState(false);
|
|
49
|
+
const drawerOpen = controlledDrawer ?? innerDrawer;
|
|
50
|
+
const setDrawerOpen = (open) => {
|
|
51
|
+
if (controlledDrawer === undefined)
|
|
52
|
+
setInnerDrawer(open);
|
|
53
|
+
onDrawerOpenChange?.(open);
|
|
54
|
+
};
|
|
55
|
+
const menuRef = React.useRef(null);
|
|
43
56
|
const isCollapsed = collapsible && (collapsed ?? internalCollapsed);
|
|
44
57
|
const sidebarId = React.useId();
|
|
45
58
|
const sidebarRef = React.useRef(null);
|
|
@@ -58,6 +71,36 @@ function ApplicationShellSidebar({ brand, primaryAction, navigation, navigationL
|
|
|
58
71
|
onCollapsedChange?.(next);
|
|
59
72
|
}
|
|
60
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;
|
|
61
|
-
|
|
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) => {
|
|
76
|
+
event.preventDefault();
|
|
77
|
+
menuRef.current?.focus();
|
|
78
|
+
}, children: [_jsxs(DrawerHeader, { children: [_jsx(VisuallyHidden.Root, { asChild: true, children: _jsx(DrawerTitle, { children: "Navigation" }) }), brand] }), _jsxs(DrawerBody, { onClick: (event) => {
|
|
79
|
+
// A destination, or anything the product marks as one, leaves
|
|
80
|
+
// the drawer: the page it opens is the point.
|
|
81
|
+
if (event.target.closest("a[href], [data-slot='navigation-link'], [data-shell-navigate]"))
|
|
82
|
+
setDrawerOpen(false);
|
|
83
|
+
}, children: [primaryAction, _jsx(ApplicationShellNavigation, { navigation: navigation, navigationLabel: navigationLabel, collapsible: false }), footer && _jsx("div", { className: "app-shell-drawer-footer", children: footer })] })] }) }), phoneNavigation === "bottom" && _jsx(ApplicationShellBottomNav, { navigation: navigation, navigationLabel: navigationLabel, footer: footer })] }));
|
|
84
|
+
}
|
|
85
|
+
/* The bar holds five destinations at most. With more, the first four stay in
|
|
86
|
+
the bar and the rest, with the footer, open from More in a bottom sheet. */
|
|
87
|
+
function ApplicationShellBottomNav({ navigation, navigationLabel, footer }) {
|
|
88
|
+
const [moreOpen, setMoreOpen] = React.useState(false);
|
|
89
|
+
const destinations = navigation.flatMap(group => group.destinations);
|
|
90
|
+
const overflow = destinations.length > 5;
|
|
91
|
+
const inBar = overflow ? destinations.slice(0, 4) : destinations;
|
|
92
|
+
const rest = navigation
|
|
93
|
+
.map(group => ({ ...group, destinations: group.destinations.filter(destination => !inBar.includes(destination)) }))
|
|
94
|
+
.filter(group => group.destinations.length > 0);
|
|
95
|
+
const link = (destination, index) => (_jsxs(BottomNavLink, { href: destination.href, active: destination.active, onClick: (event) => {
|
|
96
|
+
if (!destination.onClick)
|
|
97
|
+
return;
|
|
98
|
+
event.preventDefault();
|
|
99
|
+
destination.onClick();
|
|
100
|
+
}, children: [destination.leading && _jsx("span", { className: "bottom-nav-icon", "aria-hidden": "true", children: destination.leading }), _jsx("span", { children: destination.label }), (typeof destination.trailing === "string" || typeof destination.trailing === "number") && _jsx(BottomNavBadge, { children: destination.trailing })] }, `${destination.href}-${index}`));
|
|
101
|
+
return _jsxs(_Fragment, { children: [_jsxs(BottomNav, { "aria-label": navigationLabel, children: [inBar.map(link), overflow && _jsx(BottomNavLink, { asChild: true, active: rest.some(group => group.destinations.some(destination => destination.active)), children: _jsxs("button", { type: "button", "aria-haspopup": "dialog", "aria-expanded": moreOpen, onClick: () => setMoreOpen(true), children: [_jsx("span", { className: "bottom-nav-icon", "aria-hidden": "true", children: _jsx(Ellipsis, { className: "icon" }) }), _jsx("span", { children: "More" })] }) })] }), overflow && _jsx(Drawer, { open: moreOpen, onOpenChange: setMoreOpen, children: _jsxs(DrawerContent, { placement: "bottom", className: "app-shell-drawer app-shell-more", children: [_jsx(DrawerHeader, { children: _jsx(DrawerTitle, { children: "More" }) }), _jsxs(DrawerBody, { onClick: (event) => {
|
|
102
|
+
if (event.target.closest("a[href], [data-slot='navigation-link'], [data-shell-navigate]"))
|
|
103
|
+
setMoreOpen(false);
|
|
104
|
+
}, children: [_jsx(ApplicationShellNavigation, { navigation: rest, navigationLabel: `${navigationLabel}, more` }), footer && _jsx("div", { className: "app-shell-drawer-footer", children: footer })] })] }) })] });
|
|
62
105
|
}
|
|
63
106
|
export { AppShell, AppShellMain, AppShellPanel, AppShellPanelToggle, ApplicationShell };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare function BottomNav({ className, children, ...props }: React.ComponentProps<"nav">): React.JSX.Element;
|
|
3
|
+
declare function BottomNavLink({ className, active, asChild, ...props }: React.ComponentProps<"a"> & {
|
|
4
|
+
active?: boolean;
|
|
5
|
+
asChild?: boolean;
|
|
6
|
+
}): React.JSX.Element;
|
|
7
|
+
declare function BottomNavBadge({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
8
|
+
export { BottomNav, BottomNavLink, BottomNavBadge };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { clsx as cn } from "clsx";
|
|
3
|
+
import { Slot } from "radix-ui";
|
|
4
|
+
// A phone's main navigation, fixed to the bottom edge below 700px and not
|
|
5
|
+
// rendered above it. The product keeps the same destinations in its header or
|
|
6
|
+
// sidebar for wider screens, decides which one is current, and passes
|
|
7
|
+
// `asChild` to keep a router's own link component.
|
|
8
|
+
function BottomNav({ className, children, ...props }) {
|
|
9
|
+
return (_jsx("nav", { "data-slot": "bottom-nav", className: cn("bottom-nav", className), ...props, children: _jsx("ul", { className: "bottom-nav-list", children: children }) }));
|
|
10
|
+
}
|
|
11
|
+
function BottomNavLink({ className, active = false, asChild = false, ...props }) {
|
|
12
|
+
const Comp = asChild ? Slot.Root : "a";
|
|
13
|
+
return (_jsx("li", { "data-slot": "bottom-nav-item", children: _jsx(Comp, { "data-slot": "bottom-nav-link", "aria-current": active ? "page" : undefined, className: cn("bottom-nav-link", className), ...props }) }));
|
|
14
|
+
}
|
|
15
|
+
function BottomNavBadge({ className, ...props }) {
|
|
16
|
+
return _jsx("span", { "data-slot": "bottom-nav-badge", className: cn("bottom-nav-badge", className), ...props });
|
|
17
|
+
}
|
|
18
|
+
export { BottomNav, BottomNavLink, BottomNavBadge };
|
package/dist/chart.js
CHANGED
|
@@ -47,7 +47,7 @@ export function Chart({ data, series, label, variant = "line", layout = "standar
|
|
|
47
47
|
else
|
|
48
48
|
splitMin -= Math.max(1, Math.abs(splitMin) * 0.1);
|
|
49
49
|
}
|
|
50
|
-
const renderPlot = (indices, lane) => _jsx("div", { className: "chart-plot", style: { height }, children: _jsx(ResponsiveContainer, { width: "100%", height: "100%", children: _jsxs(ComposedChart, { data: plot, syncId: syncId ?? (layout === "split" ? id : undefined), syncMethod: "value", accessibilityLayer: true, "aria-label": lane ? `${label}: ${lane.label}` : label, "aria-describedby": `${id}-help`, margin: { top: 8, right:
|
|
50
|
+
const renderPlot = (indices, lane) => _jsx("div", { className: "chart-plot", style: { height }, children: _jsx(ResponsiveContainer, { width: "100%", height: "100%", children: _jsxs(ComposedChart, { data: plot, syncId: 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 }, children: [_jsx("defs", { children: indices.map(index => _jsx(ChartPattern, { id: `${id}-halftone-${index}`, color: chartColor(chartSlot(series[index], index)) }, 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, tick: { fill: "var(--color-muted-foreground)" } }), _jsx(YAxis, { domain: layout === "split" ? [splitMin, splitMax]
|
|
51
51
|
: [min ?? (variant === "stacked-area" ? 0 : "auto"), max ?? "auto"], tickCount: 3, axisLine: false, tickLine: false, 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: legend === "sidebar" && (!lane || indices[0] === 0) ? setActiveTimestamp : undefined }) }), indices.map(index => {
|
|
52
52
|
const item = series[index];
|
|
53
53
|
const slot = chartSlot(item, index);
|
package/dist/chip-input.js
CHANGED
|
@@ -114,6 +114,11 @@ function ChipInputList({ className, "aria-label": ariaLabel = "Suggestions", ...
|
|
|
114
114
|
setOpen(true);
|
|
115
115
|
return () => setOpen(false);
|
|
116
116
|
}, [setOpen]);
|
|
117
|
+
// Near the bottom of a phone screen the list would open out of sight.
|
|
118
|
+
React.useEffect(() => {
|
|
119
|
+
if (open)
|
|
120
|
+
listRef.current?.scrollIntoView?.({ block: "nearest" });
|
|
121
|
+
}, [open, listRef]);
|
|
117
122
|
return (_jsx("div", { id: listId, ref: listRef, role: "listbox", hidden: !open, "aria-label": ariaLabel, "data-slot": "chip-input-list", className: cn("menu chip-input-list", className), ...props }));
|
|
118
123
|
}
|
|
119
124
|
function ChipInputOption({ className, disabled = false, onSelect, onClick, ...props }) {
|
|
@@ -168,7 +173,8 @@ function EditableSegment({ slot, className, value, placeholder, display, onCommi
|
|
|
168
173
|
}
|
|
169
174
|
if (draft !== null) {
|
|
170
175
|
return (_jsxs(_Fragment, { children: [_jsx("input", { ref: editorRef, "data-slot": `${slot}-input`, className: cn(className, "is-editing"), "aria-label": editLabel, value: draft, autoFocus: true, size: 1, style: {
|
|
171
|
-
|
|
176
|
+
// The segment's own padding comes on top of the text.
|
|
177
|
+
width: `calc(${Math.min(Math.max(draft.length + 1, 6), maxWidth)}ch + 2 * var(--spacing-sm))`,
|
|
172
178
|
}, onChange: (event) => setDraft(event.target.value), onBlur: () => commit(draft), onCompositionStart: () => { composing.current = true; }, onCompositionEnd: () => { composing.current = false; }, onKeyDown: (event) => {
|
|
173
179
|
event.stopPropagation();
|
|
174
180
|
if (composing.current || event.nativeEvent.isComposing || event.keyCode === 229)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ComponentProps, type ReactNode } from "react";
|
|
2
|
+
/** Paints a value. Return HTML as `{ __html }`, as from Prism; nothing leaves the text plain. */
|
|
3
|
+
export type CodeEditorHighlight = (code: string) => ReactNode | {
|
|
4
|
+
__html: string;
|
|
5
|
+
};
|
|
6
|
+
export type CodeEditorProps = Omit<ComponentProps<"textarea">, "children" | "value" | "defaultValue" | "wrap"> & {
|
|
7
|
+
value?: string;
|
|
8
|
+
defaultValue?: string;
|
|
9
|
+
highlight?: CodeEditorHighlight;
|
|
10
|
+
lineNumbers?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare function CodeEditor({ className, value, defaultValue, highlight, lineNumbers, rows, disabled, onChange, onScroll, ref, ...props }: CodeEditorProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useRef, useState } from "react";
|
|
4
|
+
import { clsx as cn } from "clsx";
|
|
5
|
+
import { useIsomorphicLayoutEffect } from "./use-isomorphic-layout-effect.js";
|
|
6
|
+
function isHTML(painted) {
|
|
7
|
+
return typeof painted === "object" && painted !== null && "__html" in painted;
|
|
8
|
+
}
|
|
9
|
+
export function CodeEditor({ className, value, defaultValue = "", highlight, lineNumbers = true, rows = 5, disabled, onChange, onScroll, ref, ...props }) {
|
|
10
|
+
const [uncontrolled, setUncontrolled] = useState(defaultValue);
|
|
11
|
+
const code = value ?? uncontrolled;
|
|
12
|
+
const input = useRef(null);
|
|
13
|
+
const gutter = useRef(null);
|
|
14
|
+
const layer = useRef(null);
|
|
15
|
+
// A disabled value is plain text in the disabled color, like any field.
|
|
16
|
+
const painted = disabled ? undefined : highlight?.(code);
|
|
17
|
+
const highlighted = painted != null && painted !== false && painted !== "";
|
|
18
|
+
const lines = code.split("\n").length;
|
|
19
|
+
// Layers move with the textarea instead of scrolling, so they never clamp
|
|
20
|
+
// at a different extent than the textarea does.
|
|
21
|
+
function sync() {
|
|
22
|
+
const { scrollTop = 0, scrollLeft = 0 } = input.current ?? {};
|
|
23
|
+
if (gutter.current)
|
|
24
|
+
gutter.current.style.transform = `translateY(${-scrollTop}px)`;
|
|
25
|
+
if (layer.current)
|
|
26
|
+
layer.current.style.transform = `translate(${-scrollLeft}px, ${-scrollTop}px)`;
|
|
27
|
+
}
|
|
28
|
+
// A layer that mounts while the textarea is scrolled starts in step.
|
|
29
|
+
useIsomorphicLayoutEffect(sync);
|
|
30
|
+
return (_jsxs("div", { className: cn("field-control code-editor", className), "data-slot": "code-editor", "data-highlighted": highlighted, "data-line-numbers": lineNumbers, children: [lineNumbers && _jsx("div", { className: "code-editor-gutter", "aria-hidden": "true", style: { "--code-editor-digits": String(lines).length }, children: _jsx("div", { ref: gutter, children: Array.from({ length: lines }, (_, index) => _jsx("span", { children: index + 1 }, index)) }) }), _jsxs("div", { className: "code-editor-code", children: [highlighted && _jsx("div", { className: "code-editor-highlight", "aria-hidden": "true", children: isHTML(painted)
|
|
31
|
+
? _jsx("div", { ref: layer, dangerouslySetInnerHTML: painted })
|
|
32
|
+
: _jsx("div", { ref: layer, children: painted }) }), _jsx("textarea", { autoCapitalize: "off", autoComplete: "off", autoCorrect: "off", spellCheck: false, ...props, ref: (node) => {
|
|
33
|
+
input.current = node;
|
|
34
|
+
if (typeof ref === "function")
|
|
35
|
+
return ref(node);
|
|
36
|
+
if (ref)
|
|
37
|
+
ref.current = node;
|
|
38
|
+
}, className: "code-editor-input", rows: rows, wrap: "off", disabled: disabled, value: code, onChange: (event) => { if (value === undefined)
|
|
39
|
+
setUncontrolled(event.target.value); onChange?.(event); }, onScroll: (event) => { sync(); onScroll?.(event); } })] })] }));
|
|
40
|
+
}
|
package/dist/command-palette.js
CHANGED
|
@@ -24,7 +24,22 @@ function CommandPalette({ className, label = "Command palette", children, ...pro
|
|
|
24
24
|
const composing = React.useRef(false);
|
|
25
25
|
const listId = React.useId();
|
|
26
26
|
const listRef = React.useRef(null);
|
|
27
|
-
|
|
27
|
+
// A palette opened by a shortcut or a controlled button has no Radix
|
|
28
|
+
// trigger, so remember where focus was and return it there. The input
|
|
29
|
+
// takes focus as it mounts, so read it while rendering the open state.
|
|
30
|
+
const returnFocus = React.useRef(null);
|
|
31
|
+
const wasOpen = React.useRef(false);
|
|
32
|
+
if (props.open && !wasOpen.current && typeof document !== "undefined") {
|
|
33
|
+
returnFocus.current = document.activeElement;
|
|
34
|
+
}
|
|
35
|
+
wasOpen.current = Boolean(props.open);
|
|
36
|
+
return (_jsx(DialogPrimitive.Root, { "data-slot": "command-palette", ...props, children: _jsxs(DialogPortal, { children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, { "aria-modal": "true", onCloseAutoFocus: (event) => {
|
|
37
|
+
const target = returnFocus.current;
|
|
38
|
+
if (target?.isConnected && target !== document.body) {
|
|
39
|
+
event.preventDefault();
|
|
40
|
+
target.focus();
|
|
41
|
+
}
|
|
42
|
+
}, onEscapeKeyDown: (event) => {
|
|
28
43
|
if (composing.current || event.isComposing || event.keyCode === 229)
|
|
29
44
|
event.preventDefault();
|
|
30
45
|
}, "data-slot": "command-palette-content", className: cn("palette kiso-react-palette", className), children: [_jsx(VisuallyHidden.Root, { asChild: true, children: _jsx(DialogPrimitive.Title, { children: label }) }), _jsx(CommandPaletteContext.Provider, { value: { composing, activeId, setActiveId, listId, listRef }, children: children })] })] }) }));
|
package/dist/diagram.d.ts
CHANGED
|
@@ -25,22 +25,72 @@ export type DiagramProps = Omit<React.ComponentProps<"div">, "children"> & Diagr
|
|
|
25
25
|
};
|
|
26
26
|
declare function Diagram({ label, background, strength, borderStyle, cornerStyle, cornerSize, cornerMarks, className, children, ...props }: DiagramProps): React.JSX.Element;
|
|
27
27
|
declare function DiagramColumn({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
28
|
+
export type DiagramNodeGroupProps = React.ComponentProps<"div"> & DiagramFrameProps;
|
|
29
|
+
declare function DiagramNodeGroup({ borderStyle, cornerStyle, cornerSize, cornerMarks, className, ...props }: DiagramNodeGroupProps): React.JSX.Element;
|
|
28
30
|
export type DiagramNodeProps = Omit<React.ComponentProps<"div">, "title" | "children"> & DiagramFrameProps & {
|
|
29
31
|
/** Edges refer to the node by this id. Unique within the Diagram. */
|
|
30
32
|
id: string;
|
|
31
|
-
/** The name in weight. It never wraps.
|
|
32
|
-
|
|
33
|
+
/** The name in weight. It never wraps. A node that only holds parts, such
|
|
34
|
+
as a DiagramFold, leaves it out. */
|
|
35
|
+
title?: React.ReactNode;
|
|
33
36
|
/** Default icon, label and tone. `icon` and `label` override it. */
|
|
34
37
|
kind?: DiagramKind;
|
|
35
38
|
icon?: LucideIcon;
|
|
39
|
+
/** The caption above the title. Without one, the icon leads the title. */
|
|
36
40
|
label?: string;
|
|
37
41
|
/** Marks the node the screen is about. */
|
|
38
42
|
accent?: boolean;
|
|
39
43
|
status?: DiagramStatus;
|
|
40
|
-
/**
|
|
44
|
+
/** Text renders under the title in mono, with its line breaks kept.
|
|
45
|
+
Elements, such as facts or a fold, render as they are. */
|
|
41
46
|
children?: React.ReactNode;
|
|
42
47
|
};
|
|
43
48
|
declare function DiagramNode({ id, title, kind, icon, label, accent, status, borderStyle, cornerStyle, cornerSize, cornerMarks, className, children, ...props }: DiagramNodeProps): React.JSX.Element;
|
|
49
|
+
export type DiagramFactProps = Omit<React.ComponentProps<"div">, "children"> & {
|
|
50
|
+
icon?: LucideIcon;
|
|
51
|
+
label: string;
|
|
52
|
+
/** The value, right-aligned in mono. */
|
|
53
|
+
children?: React.ReactNode;
|
|
54
|
+
/** Said, muted, when there is no value. */
|
|
55
|
+
empty?: string;
|
|
56
|
+
};
|
|
57
|
+
declare function DiagramFact({ icon: Icon, label, empty, className, children, ...props }: DiagramFactProps): React.JSX.Element;
|
|
58
|
+
export type DiagramFoldProps = Omit<React.ComponentProps<"div">, "title"> & {
|
|
59
|
+
title: React.ReactNode;
|
|
60
|
+
/** The number of things the fold holds, shown next to the title. */
|
|
61
|
+
count?: number;
|
|
62
|
+
/** Open by default. */
|
|
63
|
+
defaultOpen?: boolean;
|
|
64
|
+
};
|
|
65
|
+
declare function DiagramFold({ title, count, defaultOpen, className, children, ...props }: DiagramFoldProps): React.JSX.Element;
|
|
66
|
+
export type DiagramFilterOption = {
|
|
67
|
+
value: string;
|
|
68
|
+
label: string;
|
|
69
|
+
count: number;
|
|
70
|
+
};
|
|
71
|
+
export type DiagramFilterProps = Omit<React.ComponentProps<"div">, "onChange"> & {
|
|
72
|
+
options: DiagramFilterOption[];
|
|
73
|
+
/** The option shown alone, or null for all of them. */
|
|
74
|
+
value: string | null;
|
|
75
|
+
onValueChange: (value: string | null) => void;
|
|
76
|
+
};
|
|
77
|
+
declare function DiagramFilter({ options, value, onValueChange, className, ...props }: DiagramFilterProps): React.JSX.Element;
|
|
78
|
+
export type DiagramSectionProps = Omit<React.ComponentProps<"div">, "title"> & {
|
|
79
|
+
/** Without a title the lines sit flat, with no tree. */
|
|
80
|
+
title?: React.ReactNode;
|
|
81
|
+
icon?: LucideIcon;
|
|
82
|
+
count?: number;
|
|
83
|
+
/** A control at the end of the heading, such as an add button. */
|
|
84
|
+
action?: React.ReactNode;
|
|
85
|
+
};
|
|
86
|
+
declare function DiagramSection({ title, icon: Icon, count, action, className, children, ...props }: DiagramSectionProps): React.JSX.Element;
|
|
87
|
+
export type DiagramLineProps = Omit<React.ComponentProps<"div">, "onClick"> & {
|
|
88
|
+
/** Right-aligned detail, such as a target or a state. */
|
|
89
|
+
end?: React.ReactNode;
|
|
90
|
+
/** Makes the line a button. */
|
|
91
|
+
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
92
|
+
};
|
|
93
|
+
declare function DiagramLine({ end, onClick, className, children, ...props }: DiagramLineProps): React.JSX.Element;
|
|
44
94
|
export type DiagramEdgeProps = {
|
|
45
95
|
/** One source id, or several that merge into the target. */
|
|
46
96
|
from: string | string[];
|
|
@@ -51,4 +101,4 @@ export type DiagramEdgeProps = {
|
|
|
51
101
|
tone?: DiagramEdgeTone;
|
|
52
102
|
};
|
|
53
103
|
declare function DiagramEdge({ from, to, label, line, tone }: DiagramEdgeProps): null;
|
|
54
|
-
export { Diagram, DiagramColumn, DiagramNode, DiagramEdge };
|
|
104
|
+
export { Diagram, DiagramColumn, DiagramNodeGroup, DiagramNode, DiagramFact, DiagramFold, DiagramFilter, DiagramSection, DiagramLine, DiagramEdge };
|
package/dist/diagram.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { clsx as cn } from "clsx";
|
|
4
|
-
import { Container, Database, GitBranch, Route, Server } from "lucide-react";
|
|
4
|
+
import { ChevronDown, ChevronUp, Container, Database, GitBranch, Route, Server } from "lucide-react";
|
|
5
|
+
import { Badge } from "./badge.js";
|
|
5
6
|
import { Card } from "./card.js";
|
|
6
7
|
import { StatusBadge } from "./status-badge.js";
|
|
7
8
|
import { useIsomorphicLayoutEffect } from "./use-isomorphic-layout-effect.js";
|
|
@@ -51,6 +52,7 @@ function elbow(sx, sy, tx, ty, mid) {
|
|
|
51
52
|
}
|
|
52
53
|
function Diagram({ label, background, strength, borderStyle, cornerStyle, cornerSize, cornerMarks, className, children, ...props }) {
|
|
53
54
|
const frame = React.useRef(null);
|
|
55
|
+
const scroll = React.useRef(null);
|
|
54
56
|
const nodes = React.useRef(new Map()).current;
|
|
55
57
|
const [edges, setEdges] = React.useState([]);
|
|
56
58
|
const [version, setVersion] = React.useState(0);
|
|
@@ -70,9 +72,18 @@ function Diagram({ label, background, strength, borderStyle, cornerStyle, corner
|
|
|
70
72
|
const context = React.useMemo(() => ({ nodes, register, addEdge }), [nodes, register, addEdge]);
|
|
71
73
|
useIsomorphicLayoutEffect(() => {
|
|
72
74
|
const root = frame.current;
|
|
73
|
-
|
|
75
|
+
const region = scroll.current;
|
|
76
|
+
if (!root || !region)
|
|
74
77
|
return;
|
|
78
|
+
// Lay the drawing out wrapped to the panel first. If it still overflows,
|
|
79
|
+
// wrapping only cramps it, so it takes its natural width and scrolls.
|
|
80
|
+
const fit = () => {
|
|
81
|
+
root.removeAttribute("data-overflow");
|
|
82
|
+
if (root.offsetWidth > region.clientWidth)
|
|
83
|
+
root.setAttribute("data-overflow", "");
|
|
84
|
+
};
|
|
75
85
|
const measure = () => {
|
|
86
|
+
fit();
|
|
76
87
|
const origin = root.getBoundingClientRect();
|
|
77
88
|
const box = (id) => {
|
|
78
89
|
const rect = nodes.get(id)?.getBoundingClientRect();
|
|
@@ -81,48 +92,109 @@ function Diagram({ label, background, strength, borderStyle, cornerStyle, corner
|
|
|
81
92
|
return {
|
|
82
93
|
left: rect.left - origin.left,
|
|
83
94
|
right: rect.right - origin.left,
|
|
95
|
+
top: rect.top - origin.top,
|
|
96
|
+
height: rect.height,
|
|
84
97
|
y: rect.top - origin.top + rect.height / 2,
|
|
85
98
|
};
|
|
86
99
|
};
|
|
87
|
-
|
|
88
|
-
|
|
100
|
+
// Each edge into a target gets its own entry point, spread down the
|
|
101
|
+
// target's side in the order of their sources, so their arrows and
|
|
102
|
+
// labels never land on the same spot. One edge enters at the middle.
|
|
103
|
+
const measured = edges.flatMap((edge) => {
|
|
89
104
|
const target = box(edge.to);
|
|
90
|
-
if (!target)
|
|
91
|
-
continue;
|
|
92
105
|
const sources = edge.from.map(box).filter((b) => b !== null);
|
|
93
|
-
|
|
94
|
-
|
|
106
|
+
return target && sources.length ? [{ edge, target, sources }] : [];
|
|
107
|
+
});
|
|
108
|
+
const entries = new Map();
|
|
109
|
+
const top = (item) => Math.min(...item.sources.map((s) => s.y));
|
|
110
|
+
for (const id of new Set(measured.map((item) => item.edge.to))) {
|
|
111
|
+
const group = measured.filter((item) => item.edge.to === id).sort((a, b) => top(a) - top(b));
|
|
112
|
+
group.forEach((item, index) => {
|
|
113
|
+
entries.set(item.edge, item.target.top + (item.target.height * (index + 1)) / (group.length + 1));
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
const next = { paths: [], labels: [] };
|
|
117
|
+
for (const { edge, target, sources } of measured) {
|
|
118
|
+
const ty = entries.get(edge) ?? target.y;
|
|
95
119
|
const start = Math.max(...sources.map((s) => s.right));
|
|
96
120
|
const mid = (start + target.left) / 2;
|
|
97
121
|
sources.forEach((source, index) => {
|
|
98
|
-
const { trunk, branch } = elbow(source.right, source.y, target.left,
|
|
122
|
+
const { trunk, branch } = elbow(source.right, source.y, target.left, ty, mid);
|
|
99
123
|
next.paths.push({ key: `${edge.key}:${index}:trunk`, d: trunk, arrow: false });
|
|
100
124
|
next.paths.push({ key: `${edge.key}:${index}`, d: branch, line: edge.line, tone: edge.tone, arrow: true });
|
|
101
125
|
});
|
|
102
|
-
// The label sits on the
|
|
126
|
+
// The label sits on the edge's own run into the target, above the line.
|
|
103
127
|
if (edge.label)
|
|
104
|
-
next.labels.push({ key: edge.key, x: mid, y:
|
|
128
|
+
next.labels.push({ key: edge.key, x: mid, y: ty - RADIUS, text: edge.label });
|
|
105
129
|
}
|
|
106
130
|
setDrawn(next);
|
|
107
131
|
};
|
|
108
132
|
measure();
|
|
109
133
|
const observer = new ResizeObserver(measure);
|
|
110
134
|
observer.observe(root);
|
|
135
|
+
observer.observe(region);
|
|
111
136
|
nodes.forEach((element) => observer.observe(element));
|
|
112
137
|
return () => observer.disconnect();
|
|
113
138
|
}, [edges, nodes, version]);
|
|
114
|
-
return (_jsx(DiagramContext.Provider, { value: context, children: _jsx("div", { ...props, "data-slot": "diagram", className: cn("card diagram", className), "data-background-style": background, "data-background-strength": strength, children: _jsx("div", { "data-slot": "diagram-scroll", className: "diagram-scroll", role: "
|
|
139
|
+
return (_jsx(DiagramContext.Provider, { value: context, children: _jsx("div", { ...props, "data-slot": "diagram", className: cn("card diagram", className), "data-background-style": background, "data-background-strength": strength, children: _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", { "data-slot": "diagram-lanes", className: "diagram-lanes", "data-border-style": borderStyle, "data-corner-style": cornerStyle, "data-corner-size": cornerSize, "data-corner-marks": cornerMarks, "data-edge-labels": edges.some((edge) => edge.label) || undefined, children: children }), _jsxs("svg", { className: "diagram-edges", "aria-hidden": "true", children: [_jsx("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))) }), drawn.paths.map((path) => (_jsx("path", { d: path.d, "data-line": path.line, "data-tone": path.tone, markerEnd: path.arrow ? `url(#${marker}-${path.tone ?? "neutral"})` : undefined }, path.key))), drawn.labels.map((item) => (_jsx("text", { x: item.x, y: item.y, className: "diagram-edge-label", children: item.text }, item.key)))] })] }) }) }) }));
|
|
115
140
|
}
|
|
116
141
|
function DiagramColumn({ className, ...props }) {
|
|
117
142
|
return _jsx("div", { ...props, "data-slot": "diagram-column", className: cn("diagram-column", className) });
|
|
118
143
|
}
|
|
144
|
+
/* A group draws several nodes as one card, split by a rule, such as the
|
|
145
|
+
container that receives requests with the other containers under it.
|
|
146
|
+
Edges still reach each node on its own. The group carries the frame, so
|
|
147
|
+
its frame props replace the nodes' own. */
|
|
148
|
+
function DiagramNodeGroup({ borderStyle, cornerStyle, cornerSize, cornerMarks, className, ...props }) {
|
|
149
|
+
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 }));
|
|
150
|
+
}
|
|
119
151
|
function DiagramNode({ id, title, kind, icon, label, accent, status, borderStyle, cornerStyle, cornerSize, cornerMarks, className, children, ...props }) {
|
|
120
152
|
const { register } = useRegistry("DiagramNode");
|
|
121
153
|
const ref = React.useCallback((element) => register(id, element), [id, register]);
|
|
122
154
|
const spec = kind ? kinds[kind] : undefined;
|
|
123
155
|
const Icon = icon ?? spec?.icon;
|
|
124
156
|
const caption = label ?? spec?.label;
|
|
125
|
-
|
|
157
|
+
const glyph = Icon && _jsx(Icon, { className: "icon icon-sm", strokeWidth: 1.75, "aria-hidden": "true", focusable: "false" });
|
|
158
|
+
const items = React.Children.toArray(children);
|
|
159
|
+
const text = items.filter((item) => typeof item === "string" || typeof item === "number");
|
|
160
|
+
const parts = items.filter((item) => typeof item !== "string" && typeof item !== "number");
|
|
161
|
+
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] }));
|
|
162
|
+
}
|
|
163
|
+
/* One fact about a node as a line: its icon and name, the value on the
|
|
164
|
+
right. Long values wrap under the name before they widen the node. */
|
|
165
|
+
function DiagramFact({ icon: Icon, label, empty, className, children, ...props }) {
|
|
166
|
+
const value = children ?? null;
|
|
167
|
+
return (_jsxs("div", { ...props, "data-slot": "diagram-fact", className: cn("diagram-fact", className), children: [_jsxs("span", { className: "diagram-fact-label", children: [Icon && _jsx(Icon, { className: "icon icon-sm", strokeWidth: 1.75, "aria-hidden": "true", focusable: "false" }), label] }), value != null && value !== false
|
|
168
|
+
? _jsx("span", { className: "diagram-fact-value mono", children: value })
|
|
169
|
+
: _jsx("span", { className: "diagram-fact-value muted", children: empty })] }));
|
|
170
|
+
}
|
|
171
|
+
/* A part of a node that folds under a header. Folded, its body stays in the
|
|
172
|
+
layout with no height, so the node keeps its width and the edges do not
|
|
173
|
+
move sideways. */
|
|
174
|
+
function DiagramFold({ title, count, defaultOpen = true, className, children, ...props }) {
|
|
175
|
+
const [open, setOpen] = React.useState(defaultOpen);
|
|
176
|
+
const body = React.useId();
|
|
177
|
+
const Chevron = open ? ChevronUp : ChevronDown;
|
|
178
|
+
return (_jsxs("div", { ...props, "data-slot": "diagram-fold", className: cn("diagram-fold", className), "data-open": open, children: [_jsxs("button", { type: "button", className: "diagram-fold-head", "aria-expanded": open, "aria-controls": body, onClick: () => setOpen(!open), children: [_jsxs("span", { className: "diagram-fold-title", children: [title, count != null && _jsx(Badge, { className: "badge-count", children: count })] }), _jsx(Chevron, { className: "icon icon-sm", strokeWidth: 1.75, "aria-hidden": "true", focusable: "false" })] }), _jsx("div", { id: body, className: "diagram-fold-body", children: children })] }));
|
|
179
|
+
}
|
|
180
|
+
/* Chips that show one kind of line at a time. The first chip shows all of
|
|
181
|
+
them with their total. Render it only when there is more than one kind. */
|
|
182
|
+
function DiagramFilter({ options, value, onValueChange, className, ...props }) {
|
|
183
|
+
const total = options.reduce((sum, option) => sum + option.count, 0);
|
|
184
|
+
return (_jsxs("div", { role: "group", "aria-label": "Show", ...props, "data-slot": "diagram-filter", className: cn("diagram-filter", className), children: [_jsxs("button", { type: "button", "aria-pressed": value === null, onClick: () => onValueChange(null), children: ["All ", total] }), options.map((option) => (_jsxs("button", { type: "button", "aria-pressed": value === option.value, onClick: () => onValueChange(option.value), children: [option.label, " ", option.count] }, option.value)))] }));
|
|
185
|
+
}
|
|
186
|
+
/* One kind of thing a node lists: a heading with its count and action, and
|
|
187
|
+
its lines hanging from the heading as a tree. */
|
|
188
|
+
function DiagramSection({ title, icon: Icon, count, action, className, children, ...props }) {
|
|
189
|
+
return (_jsxs("div", { ...props, "data-slot": "diagram-section", className: cn("diagram-section", className), "data-flat": title == null || undefined, children: [title != null && (_jsxs("div", { className: "diagram-section-head", children: [_jsxs("span", { className: "diagram-section-title", children: [Icon && _jsx(Icon, { className: "icon icon-sm", strokeWidth: 1.75, "aria-hidden": "true", focusable: "false" }), title, count != null && _jsx(Badge, { className: "badge-count", children: count })] }), action] })), children] }));
|
|
190
|
+
}
|
|
191
|
+
/* One line of a section: a name in mono and, on the right, where it goes. */
|
|
192
|
+
function DiagramLine({ end, onClick, className, children, ...props }) {
|
|
193
|
+
const content = _jsxs(_Fragment, { children: [_jsx("span", { className: "diagram-line-name mono", children: children }), end != null && _jsx("span", { className: "diagram-line-end", children: end })] });
|
|
194
|
+
if (onClick) {
|
|
195
|
+
return (_jsx("button", { ...props, type: "button", "data-slot": "diagram-line", className: cn("diagram-line", className), onClick: onClick, children: content }));
|
|
196
|
+
}
|
|
197
|
+
return _jsx("div", { ...props, "data-slot": "diagram-line", className: cn("diagram-line", className), children: content });
|
|
126
198
|
}
|
|
127
199
|
/* An edge renders nothing itself: it registers with the Diagram, which draws
|
|
128
200
|
it once the nodes are measured. */
|
|
@@ -133,4 +205,4 @@ function DiagramEdge({ from, to, label, line, tone }) {
|
|
|
133
205
|
React.useEffect(() => addEdge({ key: `${sources}->${to}`, from: sources.split("\n"), to, label, line, tone }), [addEdge, sources, to, label, line, tone]);
|
|
134
206
|
return null;
|
|
135
207
|
}
|
|
136
|
-
export { Diagram, DiagramColumn, DiagramNode, DiagramEdge };
|
|
208
|
+
export { Diagram, DiagramColumn, DiagramNodeGroup, DiagramNode, DiagramFact, DiagramFold, DiagramFilter, DiagramSection, DiagramLine, DiagramEdge };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,12 +2,14 @@ export * from "./alert.js";
|
|
|
2
2
|
export * from "./alert-dialog.js";
|
|
3
3
|
export * from "./app-shell.js";
|
|
4
4
|
export * from "./badge.js";
|
|
5
|
+
export * from "./bottom-nav.js";
|
|
5
6
|
export * from "./brand-mark.js";
|
|
6
7
|
export * from "./breadcrumb.js";
|
|
7
8
|
export * from "./button.js";
|
|
8
9
|
export * from "./card.js";
|
|
9
10
|
export * from "./checkbox.js";
|
|
10
11
|
export * from "./chip-input.js";
|
|
12
|
+
export * from "./code-editor.js";
|
|
11
13
|
export * from "./filter-input.js";
|
|
12
14
|
export * from "./filter-expression.js";
|
|
13
15
|
export * from "./command-palette.js";
|
package/dist/index.js
CHANGED
|
@@ -3,12 +3,14 @@ export * from "./alert.js";
|
|
|
3
3
|
export * from "./alert-dialog.js";
|
|
4
4
|
export * from "./app-shell.js";
|
|
5
5
|
export * from "./badge.js";
|
|
6
|
+
export * from "./bottom-nav.js";
|
|
6
7
|
export * from "./brand-mark.js";
|
|
7
8
|
export * from "./breadcrumb.js";
|
|
8
9
|
export * from "./button.js";
|
|
9
10
|
export * from "./card.js";
|
|
10
11
|
export * from "./checkbox.js";
|
|
11
12
|
export * from "./chip-input.js";
|
|
13
|
+
export * from "./code-editor.js";
|
|
12
14
|
export * from "./filter-input.js";
|
|
13
15
|
export * from "./filter-expression.js";
|
|
14
16
|
export * from "./command-palette.js";
|
package/dist/lifecycle.d.ts
CHANGED
|
@@ -3,5 +3,7 @@ export type LifecycleProps = Omit<React.ComponentProps<"div">, "children"> & {
|
|
|
3
3
|
status: React.ReactNode;
|
|
4
4
|
actions?: React.ReactNode;
|
|
5
5
|
destructive?: React.ReactNode;
|
|
6
|
+
/** The title of the sheet that holds the actions on a phone. */
|
|
7
|
+
actionsLabel?: string;
|
|
6
8
|
};
|
|
7
|
-
export declare function Lifecycle({ status, actions, destructive, className, ...props }: LifecycleProps): React.JSX.Element;
|
|
9
|
+
export declare function Lifecycle({ status, actions, destructive, actionsLabel, className, ...props }: LifecycleProps): React.JSX.Element;
|
package/dist/lifecycle.js
CHANGED
|
@@ -1,10 +1,31 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
2
3
|
import { clsx as cn } from "clsx";
|
|
4
|
+
import { Ellipsis } from "lucide-react";
|
|
5
|
+
import { Button } from "./button.js";
|
|
6
|
+
import { Drawer, DrawerBody, DrawerContent, DrawerHeader, DrawerTitle, DrawerTrigger } from "./drawer.js";
|
|
3
7
|
/* The header row of a detail screen: what the thing is, what you can do to
|
|
4
8
|
it, and the one action you do not want to hit by accident. Status is read,
|
|
5
9
|
the verbs are pressed, and the destructive action sits outside both with a
|
|
6
10
|
wider gap. A screen with no verbs passes none, and the middle group is
|
|
7
|
-
dropped rather than rendered as an empty bordered box.
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
dropped rather than rendered as an empty bordered box.
|
|
12
|
+
|
|
13
|
+
On a phone the verbs and the destructive action do not fit beside the
|
|
14
|
+
status, so they move to a sheet behind one button. Picking one closes the
|
|
15
|
+
sheet, unless it opened a dialog of its own, which then sits over it. */
|
|
16
|
+
export function Lifecycle({ status, actions, destructive, actionsLabel = "Actions", className, ...props }) {
|
|
17
|
+
const [open, setOpen] = React.useState(false);
|
|
18
|
+
const sheet = React.useRef(null);
|
|
19
|
+
return _jsxs("div", { ...props, "data-slot": "lifecycle", className: cn("lifecycle", className), children: [_jsx("div", { className: "cluster cluster-status", role: "group", "aria-label": "Status", children: status }), actions ? _jsx("div", { className: "cluster cluster-verbs", role: "group", "aria-label": "Actions", children: actions }) : null, destructive, actions || destructive ? (_jsxs(Drawer, { open: open, onOpenChange: setOpen, children: [_jsx(DrawerTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "sm", className: "lifecycle-more btn-icon", "aria-label": `More ${actionsLabel.toLowerCase()}`, title: actionsLabel, children: _jsx(Ellipsis, { className: "icon", "aria-hidden": "true" }) }) }), _jsxs(DrawerContent, { ref: sheet, placement: "bottom", children: [_jsx(DrawerHeader, { children: _jsx(DrawerTitle, { children: actionsLabel }) }), _jsx(DrawerBody, { children: _jsxs("div", { className: "lifecycle-sheet", onClick: (event) => {
|
|
20
|
+
if (!event.target.closest("button:not(:disabled), a[href]"))
|
|
21
|
+
return;
|
|
22
|
+
// An action that owns its confirmation renders it inside the
|
|
23
|
+
// sheet; closing the sheet would unmount both. Its dialog
|
|
24
|
+
// opens over the sheet instead.
|
|
25
|
+
requestAnimationFrame(() => {
|
|
26
|
+
const dialogs = document.querySelectorAll("[role='dialog'][data-state='open'], [role='alertdialog'][data-state='open']");
|
|
27
|
+
if (![...dialogs].some((dialog) => dialog !== sheet.current))
|
|
28
|
+
setOpen(false);
|
|
29
|
+
});
|
|
30
|
+
}, children: [actions, destructive] }) })] })] })) : null] });
|
|
10
31
|
}
|
package/dist/pane-grid.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { clsx as cn } from "clsx";
|
|
5
|
+
import { GripVertical } from "lucide-react";
|
|
5
6
|
import { useIsomorphicLayoutEffect } from "./use-isomorphic-layout-effect.js";
|
|
6
7
|
const COLUMNS = 12;
|
|
7
8
|
/* A drag ends on release, on cancellation, or when capture is lost. */
|
|
@@ -362,7 +363,11 @@ export function PaneGrid({ title, layout: controlled, defaultLayout, onLayoutCha
|
|
|
362
363
|
return;
|
|
363
364
|
event.preventDefault();
|
|
364
365
|
const handle = event.currentTarget;
|
|
365
|
-
|
|
366
|
+
// A pointer the browser has already handed to scrolling cannot be captured.
|
|
367
|
+
try {
|
|
368
|
+
handle.setPointerCapture(event.pointerId);
|
|
369
|
+
}
|
|
370
|
+
catch { /* the gesture stays a scroll */ }
|
|
366
371
|
const start = { x: event.clientX, y: event.clientY };
|
|
367
372
|
let active = false;
|
|
368
373
|
let target = null;
|
|
@@ -380,14 +385,15 @@ export function PaneGrid({ title, layout: controlled, defaultLayout, onLayoutCha
|
|
|
380
385
|
target.invalid = exceeds(id, target);
|
|
381
386
|
paint(target);
|
|
382
387
|
};
|
|
383
|
-
const stop = () => {
|
|
388
|
+
const stop = (ended) => {
|
|
384
389
|
handle.removeEventListener("pointermove", move);
|
|
385
390
|
for (const type of RELEASE)
|
|
386
391
|
handle.removeEventListener(type, stop);
|
|
387
392
|
pane.classList.remove("dragging");
|
|
388
393
|
delete bodyRef.current?.dataset.dragging;
|
|
389
394
|
paint(null);
|
|
390
|
-
|
|
395
|
+
// A cancelled gesture, such as a touch that became a scroll, moves nothing.
|
|
396
|
+
if (ended.type === "pointercancel" || !active || !target || target.invalid)
|
|
391
397
|
return;
|
|
392
398
|
const rows = plan(id, target);
|
|
393
399
|
if (rows)
|
|
@@ -472,7 +478,7 @@ export function GridPane({ id, title, min: _min, size: _size, newRow: _newRow, a
|
|
|
472
478
|
else
|
|
473
479
|
return;
|
|
474
480
|
event.preventDefault();
|
|
475
|
-
}, children: [_jsx("h3", { "data-slot": "grid-pane-title", className: "grid-pane-title t-h3", children: title }), placement.debug && _jsxs("span", { className: "grid-pane-meta", children: ["size=", placement.size, " \u00B7 min=", placement.min, " \u00B7 max=", placement.max] }), actions != null && _jsx("div", { "data-slot": "grid-pane-actions", className: "grid-pane-actions", children: actions })] }), _jsx("div", { "data-slot": "grid-pane-body", className: "grid-pane-body", children: children }), !placement.compact && (_jsx("div", { "data-slot": "grid-pane-resizer", className: "grid-pane-resizer", role: "separator", tabIndex: 0, "aria-orientation": "vertical", "aria-label": `Resize ${title}`, "aria-valuenow": placement.size, "aria-valuemin": placement.min, "aria-valuemax": placement.max, "aria-disabled": placement.min === placement.max || undefined, onPointerDown: (event) => api.startResize(id, event), onKeyDown: (event) => {
|
|
481
|
+
}, children: [_jsx(GripVertical, { className: "icon grid-pane-grip", "aria-hidden": "true" }), _jsx("h3", { "data-slot": "grid-pane-title", className: "grid-pane-title t-h3", children: title }), placement.debug && _jsxs("span", { className: "grid-pane-meta", children: ["size=", placement.size, " \u00B7 min=", placement.min, " \u00B7 max=", placement.max] }), actions != null && _jsx("div", { "data-slot": "grid-pane-actions", className: "grid-pane-actions", children: actions })] }), _jsx("div", { "data-slot": "grid-pane-body", className: "grid-pane-body", children: children }), !placement.compact && (_jsx("div", { "data-slot": "grid-pane-resizer", className: "grid-pane-resizer", role: "separator", tabIndex: 0, "aria-orientation": "vertical", "aria-label": `Resize ${title}`, "aria-valuenow": placement.size, "aria-valuemin": placement.min, "aria-valuemax": placement.max, "aria-disabled": placement.min === placement.max || undefined, onPointerDown: (event) => api.startResize(id, event), onKeyDown: (event) => {
|
|
476
482
|
if (event.key === "ArrowRight")
|
|
477
483
|
api.resize(id, placement.size + 1);
|
|
478
484
|
else if (event.key === "ArrowLeft")
|
package/dist/styles.css
CHANGED
|
@@ -210,6 +210,7 @@
|
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
@media (pointer: coarse) {
|
|
213
|
+
.accent-pill { height: auto; min-height: var(--size-touch-min); }
|
|
213
214
|
/* Reserve the extended target in layout so adjacent controls cannot overlap. */
|
|
214
215
|
.kiso-checkbox { margin: calc((var(--size-touch-min) - var(--size-icon-md)) / 2); }
|
|
215
216
|
.kiso-react-switch {
|
|
@@ -285,6 +286,7 @@
|
|
|
285
286
|
[data-slot="select-trigger"]:disabled { cursor: not-allowed; }
|
|
286
287
|
[data-slot="select-item"] { justify-content: space-between; }
|
|
287
288
|
[data-slot="select-content"] {
|
|
289
|
+
min-width: var(--radix-select-trigger-width);
|
|
288
290
|
max-height: var(--radix-select-content-available-height);
|
|
289
291
|
overflow: hidden;
|
|
290
292
|
}
|
|
@@ -331,7 +333,7 @@
|
|
|
331
333
|
max-height: min(32rem, var(--radix-popover-content-available-height));
|
|
332
334
|
overflow-y: auto; overscroll-behavior: contain; padding: 0;
|
|
333
335
|
}
|
|
334
|
-
.detail-select-option { display: grid; grid-template-columns: minmax(
|
|
336
|
+
.detail-select-option { display: grid; grid-template-columns: minmax(min-content, 8rem) minmax(0, 1fr); gap: var(--spacing-lg); padding: var(--spacing-md); border-bottom: 1px solid var(--color-border); }
|
|
335
337
|
.detail-select-option:last-child { border-bottom: 0; }
|
|
336
338
|
.detail-select-option:not([data-disabled]) { cursor: pointer; }
|
|
337
339
|
@media (hover: hover) {
|
|
@@ -431,13 +433,23 @@
|
|
|
431
433
|
inset-inline: 0;
|
|
432
434
|
inset-block-end: 0;
|
|
433
435
|
max-height: 85dvh;
|
|
436
|
+
padding-block-end: env(safe-area-inset-bottom);
|
|
434
437
|
border-start-start-radius: var(--radius-surface);
|
|
435
438
|
border-start-end-radius: var(--radius-surface);
|
|
436
439
|
}
|
|
440
|
+
/* The shell's navigation opens from the edge its sidebar sat on, and leaves
|
|
441
|
+
a strip of the page showing so it reads as over the page, not a new one. */
|
|
442
|
+
.kiso-react-drawer.app-shell-drawer[data-placement="side"] {
|
|
443
|
+
inset-inline-start: 0;
|
|
444
|
+
inset-inline-end: auto;
|
|
445
|
+
width: min(20rem, calc(100vw - var(--spacing-3xl)));
|
|
446
|
+
border-radius: 0 var(--radius-surface) var(--radius-surface) 0;
|
|
447
|
+
}
|
|
437
448
|
/* Header and footer stay put; the body takes the leftover height. */
|
|
438
449
|
.kiso-react-drawer [data-slot="dialog-body"] {
|
|
439
450
|
flex: 1 1 auto;
|
|
440
451
|
overflow-y: auto;
|
|
452
|
+
align-content: start;
|
|
441
453
|
}
|
|
442
454
|
|
|
443
455
|
@media (forced-colors: active) {
|
package/dist/tabs.d.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Tabs as TabsPrimitive } from "radix-ui";
|
|
3
|
-
|
|
3
|
+
type TabsProps = React.ComponentProps<typeof TabsPrimitive.Root> & {
|
|
4
|
+
/**
|
|
5
|
+
* Below 1024px, show each panel under a header of its own, one open at a
|
|
6
|
+
* time, instead of a strip of triggers that cannot fit a phone. The panels
|
|
7
|
+
* are the same elements in both layouts, so crossing the breakpoint (a
|
|
8
|
+
* phone turned sideways) keeps what they hold: an edited form, a terminal.
|
|
9
|
+
*/
|
|
10
|
+
sections?: boolean;
|
|
11
|
+
};
|
|
12
|
+
declare function Tabs({ sections, ...props }: TabsProps): React.JSX.Element;
|
|
4
13
|
declare function TabsList({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.List>): React.JSX.Element;
|
|
5
14
|
declare function TabsTrigger({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Trigger>): React.JSX.Element;
|
|
6
15
|
declare function TabsContent({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Content>): React.JSX.Element;
|
package/dist/tabs.js
CHANGED
|
@@ -1,10 +1,73 @@
|
|
|
1
1
|
// Adapted from shadcn/ui new-york-v4. See ../SHADCN-LICENSE.
|
|
2
2
|
"use client";
|
|
3
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
+
import * as React from "react";
|
|
4
5
|
import { clsx as cn } from "clsx";
|
|
6
|
+
import { ChevronDown } from "lucide-react";
|
|
5
7
|
import { Tabs as TabsPrimitive } from "radix-ui";
|
|
6
|
-
function Tabs({ ...props }) {
|
|
7
|
-
|
|
8
|
+
function Tabs({ sections = false, ...props }) {
|
|
9
|
+
if (!sections)
|
|
10
|
+
return _jsx(TabsPrimitive.Root, { "data-slot": "tabs", ...props });
|
|
11
|
+
return _jsx(SectionedTabs, { ...props });
|
|
12
|
+
}
|
|
13
|
+
/** Children with fragments opened, so a conditional group still counts.
|
|
14
|
+
* Keys carry the fragment's, so two groups never share one. */
|
|
15
|
+
function flatten(children, prefix = "") {
|
|
16
|
+
return React.Children.toArray(children).flatMap((child) => {
|
|
17
|
+
if (!React.isValidElement(child))
|
|
18
|
+
return [child];
|
|
19
|
+
if (child.type === React.Fragment)
|
|
20
|
+
return flatten(child.props.children, `${prefix}${child.key}/`);
|
|
21
|
+
return [prefix ? React.cloneElement(child, { key: `${prefix}${child.key}` }) : child];
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function SectionedTabs({ value: controlled, defaultValue, onValueChange, className, children, ...props }) {
|
|
25
|
+
const [inner, setInner] = React.useState(defaultValue);
|
|
26
|
+
const value = controlled ?? inner;
|
|
27
|
+
// Closing the open section is a phone's own state: the selected tab stays,
|
|
28
|
+
// so a wider screen never shows a card with no panel. It belongs to the
|
|
29
|
+
// value it closed, so any other way to a panel (a tab, a link in a panel
|
|
30
|
+
// that sets the value) opens it.
|
|
31
|
+
const [collapsedFor, setCollapsedFor] = React.useState();
|
|
32
|
+
const [shown, setShown] = React.useState(value);
|
|
33
|
+
if (shown !== value) {
|
|
34
|
+
setShown(value);
|
|
35
|
+
setCollapsedFor(undefined);
|
|
36
|
+
}
|
|
37
|
+
const collapsed = value !== undefined && collapsedFor === value;
|
|
38
|
+
const select = (next) => {
|
|
39
|
+
if (controlled === undefined)
|
|
40
|
+
setInner(next);
|
|
41
|
+
onValueChange?.(next);
|
|
42
|
+
};
|
|
43
|
+
const items = flatten(children);
|
|
44
|
+
const triggers = [];
|
|
45
|
+
for (const item of items) {
|
|
46
|
+
if (!React.isValidElement(item) || item.type !== TabsList)
|
|
47
|
+
continue;
|
|
48
|
+
for (const trigger of flatten(item.props.children)) {
|
|
49
|
+
if (!React.isValidElement(trigger) || trigger.type !== TabsTrigger)
|
|
50
|
+
continue;
|
|
51
|
+
triggers.push({ value: trigger.props.value, label: trigger.props.children, disabled: trigger.props.disabled });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const laid = [];
|
|
55
|
+
for (const item of items) {
|
|
56
|
+
if (React.isValidElement(item) && item.type === TabsContent) {
|
|
57
|
+
const trigger = triggers.find((one) => one.value === item.props.value);
|
|
58
|
+
if (trigger) {
|
|
59
|
+
const open = trigger.value === value && !collapsed;
|
|
60
|
+
laid.push(_jsxs("button", { type: "button", "data-slot": "tabs-section", className: "tabs-section", "data-state": open ? "open" : "closed", "aria-expanded": open, disabled: trigger.disabled, onClick: () => {
|
|
61
|
+
if (trigger.value !== value)
|
|
62
|
+
select(trigger.value);
|
|
63
|
+
else
|
|
64
|
+
setCollapsedFor(collapsed ? undefined : value);
|
|
65
|
+
}, children: [_jsx("span", { className: "tabs-section-label", children: trigger.label }), _jsx(ChevronDown, { className: "icon tabs-section-chevron", "aria-hidden": "true" })] }, `section-${trigger.value}`));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
laid.push(item);
|
|
69
|
+
}
|
|
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 }));
|
|
8
71
|
}
|
|
9
72
|
function TabsList({ className, ...props }) {
|
|
10
73
|
return (_jsx(TabsPrimitive.List, { "data-slot": "tabs-list", className: cn("tabs", className), ...props }));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momoi-labs/kiso-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.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": "^0.
|
|
35
|
+
"@momoi-labs/kiso": "^0.20.0",
|
|
36
36
|
"class-variance-authority": "0.7.1",
|
|
37
37
|
"clsx": "2.1.1",
|
|
38
38
|
"radix-ui": "1.6.7",
|