@vllnt/ui 0.2.1-canary.b3f1dff → 0.2.1-canary.bb791f1
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/components/alert-pulse/alert-pulse.js +93 -0
- package/dist/components/alert-pulse/index.js +6 -0
- package/dist/components/context-lens/context-lens.js +98 -0
- package/dist/components/context-lens/index.js +6 -0
- package/dist/components/floating-toolbar/floating-toolbar.js +66 -0
- package/dist/components/floating-toolbar/index.js +6 -0
- package/dist/components/follow-mode/follow-mode.js +89 -0
- package/dist/components/follow-mode/index.js +6 -0
- package/dist/components/handoff-beacon/handoff-beacon.js +78 -0
- package/dist/components/handoff-beacon/index.js +6 -0
- package/dist/components/index.js +68 -0
- package/dist/components/jarvis-dock/index.js +6 -0
- package/dist/components/jarvis-dock/jarvis-dock.js +98 -0
- package/dist/components/multi-select-lasso/index.js +6 -0
- package/dist/components/multi-select-lasso/multi-select-lasso.js +76 -0
- package/dist/components/object-inspector/index.js +6 -0
- package/dist/components/object-inspector/object-inspector.js +136 -0
- package/dist/components/policy-delivery-panel/index.js +6 -0
- package/dist/components/policy-delivery-panel/policy-delivery-panel.js +99 -0
- package/dist/components/property-section/index.js +6 -0
- package/dist/components/property-section/property-section.js +101 -0
- package/dist/components/relationship-inspector/index.js +6 -0
- package/dist/components/relationship-inspector/relationship-inspector.js +102 -0
- package/dist/components/routing-assignment-panel/index.js +6 -0
- package/dist/components/routing-assignment-panel/routing-assignment-panel.js +122 -0
- package/dist/components/runtime-overview-panel/index.js +6 -0
- package/dist/components/runtime-overview-panel/runtime-overview-panel.js +89 -0
- package/dist/components/selection-halo/index.js +6 -0
- package/dist/components/selection-halo/selection-halo.js +72 -0
- package/dist/components/snap-guides/index.js +6 -0
- package/dist/components/snap-guides/snap-guides.js +45 -0
- package/dist/components/sticky-metric/index.js +6 -0
- package/dist/components/sticky-metric/sticky-metric.js +83 -0
- package/dist/components/threshold-ring/index.js +6 -0
- package/dist/components/threshold-ring/threshold-ring.js +160 -0
- package/dist/index.d.ts +1248 -12
- package/package.json +1 -1
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
forwardRef
|
|
5
|
+
} from "react";
|
|
6
|
+
import { cn } from "../../lib/utils";
|
|
7
|
+
const TONE_CLASS = {
|
|
8
|
+
danger: "text-red-600 dark:text-red-400",
|
|
9
|
+
neutral: "text-foreground",
|
|
10
|
+
primary: "text-blue-600 dark:text-blue-400",
|
|
11
|
+
success: "text-emerald-600 dark:text-emerald-400"
|
|
12
|
+
};
|
|
13
|
+
const DEFAULT_LABELS = {
|
|
14
|
+
paletteTrigger: "Open command palette",
|
|
15
|
+
region: "Jarvis dock"
|
|
16
|
+
};
|
|
17
|
+
const ActionButton = (props) => {
|
|
18
|
+
const { action } = props;
|
|
19
|
+
const tone = action.tone ?? "neutral";
|
|
20
|
+
const handleClick = () => {
|
|
21
|
+
action.onActivate();
|
|
22
|
+
};
|
|
23
|
+
return /* @__PURE__ */ jsxs(
|
|
24
|
+
"button",
|
|
25
|
+
{
|
|
26
|
+
className: "group relative flex h-12 w-12 flex-col items-center justify-center gap-0.5 rounded-md border border-transparent text-[10px] uppercase tracking-wide text-muted-foreground transition-colors hover:border-border hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
27
|
+
"data-jarvis-action": action.id,
|
|
28
|
+
"data-jarvis-tone": tone,
|
|
29
|
+
onClick: handleClick,
|
|
30
|
+
type: "button",
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ jsx(
|
|
33
|
+
"span",
|
|
34
|
+
{
|
|
35
|
+
"aria-hidden": "true",
|
|
36
|
+
className: cn(
|
|
37
|
+
"text-base leading-none transition-transform group-hover:scale-110",
|
|
38
|
+
TONE_CLASS[tone]
|
|
39
|
+
),
|
|
40
|
+
children: action.glyph
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: action.label }),
|
|
44
|
+
action.badge ? /* @__PURE__ */ jsx(
|
|
45
|
+
"span",
|
|
46
|
+
{
|
|
47
|
+
className: "absolute right-1 top-1 inline-flex min-h-[14px] min-w-[14px] items-center justify-center rounded-full bg-foreground px-1 text-[9px] font-medium text-background",
|
|
48
|
+
"data-jarvis-badge": true,
|
|
49
|
+
children: action.badge
|
|
50
|
+
}
|
|
51
|
+
) : null
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
const JarvisDock = forwardRef(
|
|
57
|
+
(props, ref) => {
|
|
58
|
+
const { actions, className, labels, onOpenPalette, ...rest } = props;
|
|
59
|
+
const resolvedLabels = { ...DEFAULT_LABELS, ...labels };
|
|
60
|
+
const handlePalette = () => {
|
|
61
|
+
onOpenPalette?.();
|
|
62
|
+
};
|
|
63
|
+
return /* @__PURE__ */ jsxs(
|
|
64
|
+
"nav",
|
|
65
|
+
{
|
|
66
|
+
"aria-label": resolvedLabels.region,
|
|
67
|
+
className: cn(
|
|
68
|
+
"inline-flex items-center gap-1 rounded-2xl border bg-background/90 p-1.5 shadow-md backdrop-blur",
|
|
69
|
+
className
|
|
70
|
+
),
|
|
71
|
+
"data-jarvis-dock": true,
|
|
72
|
+
ref,
|
|
73
|
+
...rest,
|
|
74
|
+
children: [
|
|
75
|
+
actions.map((action) => /* @__PURE__ */ jsx(ActionButton, { action }, action.id)),
|
|
76
|
+
onOpenPalette ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
77
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "mx-1 h-8 w-px bg-border" }),
|
|
78
|
+
/* @__PURE__ */ jsx(
|
|
79
|
+
"button",
|
|
80
|
+
{
|
|
81
|
+
"aria-label": resolvedLabels.paletteTrigger,
|
|
82
|
+
className: "flex h-12 w-12 items-center justify-center rounded-md border border-transparent text-base text-muted-foreground transition-colors hover:border-border hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
83
|
+
"data-jarvis-palette-trigger": true,
|
|
84
|
+
onClick: handlePalette,
|
|
85
|
+
type: "button",
|
|
86
|
+
children: /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: "\u2318" })
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
] }) : null
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
JarvisDock.displayName = "JarvisDock";
|
|
96
|
+
export {
|
|
97
|
+
JarvisDock
|
|
98
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
forwardRef
|
|
5
|
+
} from "react";
|
|
6
|
+
import { cn } from "../../lib/utils";
|
|
7
|
+
const DEFAULT_LABELS = {
|
|
8
|
+
plural: "items",
|
|
9
|
+
region: "Multi-select lasso",
|
|
10
|
+
singular: "item"
|
|
11
|
+
};
|
|
12
|
+
const normalizeRect = (rect) => {
|
|
13
|
+
const x = rect.width < 0 ? rect.x + rect.width : rect.x;
|
|
14
|
+
const y = rect.height < 0 ? rect.y + rect.height : rect.y;
|
|
15
|
+
const width = Math.abs(rect.width);
|
|
16
|
+
const height = Math.abs(rect.height);
|
|
17
|
+
return { height, width, x, y };
|
|
18
|
+
};
|
|
19
|
+
const MultiSelectLasso = forwardRef((props, ref) => {
|
|
20
|
+
const { className, count, hint, labels, rect, ...rest } = props;
|
|
21
|
+
if (!rect) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
const resolvedLabels = { ...DEFAULT_LABELS, ...labels };
|
|
25
|
+
const normalized = normalizeRect(rect);
|
|
26
|
+
if (normalized.width === 0 || normalized.height === 0) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
const noun = count === 1 ? resolvedLabels.singular : resolvedLabels.plural;
|
|
30
|
+
return /* @__PURE__ */ jsxs(
|
|
31
|
+
"div",
|
|
32
|
+
{
|
|
33
|
+
"aria-hidden": "true",
|
|
34
|
+
"aria-label": resolvedLabels.region,
|
|
35
|
+
className: cn(
|
|
36
|
+
"pointer-events-none absolute z-30 rounded-md border-2 border-blue-500/70 bg-blue-500/10",
|
|
37
|
+
className
|
|
38
|
+
),
|
|
39
|
+
"data-multi-select-lasso": true,
|
|
40
|
+
ref,
|
|
41
|
+
style: {
|
|
42
|
+
height: normalized.height,
|
|
43
|
+
left: normalized.x,
|
|
44
|
+
top: normalized.y,
|
|
45
|
+
width: normalized.width
|
|
46
|
+
},
|
|
47
|
+
...rest,
|
|
48
|
+
children: [
|
|
49
|
+
hint ? /* @__PURE__ */ jsx(
|
|
50
|
+
"span",
|
|
51
|
+
{
|
|
52
|
+
className: "absolute -top-7 left-0 rounded-md bg-foreground/90 px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide text-background",
|
|
53
|
+
"data-multi-select-hint": true,
|
|
54
|
+
children: hint
|
|
55
|
+
}
|
|
56
|
+
) : null,
|
|
57
|
+
typeof count === "number" ? /* @__PURE__ */ jsxs(
|
|
58
|
+
"span",
|
|
59
|
+
{
|
|
60
|
+
className: "absolute -bottom-7 right-0 rounded-full bg-foreground px-2 py-0.5 text-[10px] font-semibold text-background",
|
|
61
|
+
"data-multi-select-count": true,
|
|
62
|
+
children: [
|
|
63
|
+
count,
|
|
64
|
+
" ",
|
|
65
|
+
noun
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
) : null
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
});
|
|
73
|
+
MultiSelectLasso.displayName = "MultiSelectLasso";
|
|
74
|
+
export {
|
|
75
|
+
MultiSelectLasso
|
|
76
|
+
};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
forwardRef
|
|
5
|
+
} from "react";
|
|
6
|
+
import { cn } from "../../lib/utils";
|
|
7
|
+
const KIND_LABEL = {
|
|
8
|
+
agent: "Agent",
|
|
9
|
+
artifact: "Artifact",
|
|
10
|
+
input: "Input",
|
|
11
|
+
output: "Output",
|
|
12
|
+
run: "Run",
|
|
13
|
+
task: "Task"
|
|
14
|
+
};
|
|
15
|
+
const KIND_GLYPH = {
|
|
16
|
+
agent: "\u25C7",
|
|
17
|
+
artifact: "\u25CC",
|
|
18
|
+
input: "\u2198",
|
|
19
|
+
output: "\u2197",
|
|
20
|
+
run: "\u25B6",
|
|
21
|
+
task: "\u25A2"
|
|
22
|
+
};
|
|
23
|
+
const STATUS_DOT = {
|
|
24
|
+
complete: "bg-emerald-500",
|
|
25
|
+
failed: "bg-red-500",
|
|
26
|
+
idle: "bg-muted-foreground",
|
|
27
|
+
queued: "bg-amber-500",
|
|
28
|
+
running: "bg-blue-500 animate-pulse"
|
|
29
|
+
};
|
|
30
|
+
const STATUS_LABEL = {
|
|
31
|
+
complete: "Complete",
|
|
32
|
+
failed: "Failed",
|
|
33
|
+
idle: "Idle",
|
|
34
|
+
queued: "Queued",
|
|
35
|
+
running: "Running"
|
|
36
|
+
};
|
|
37
|
+
const DEFAULT_LABELS = {
|
|
38
|
+
empty: "No selection",
|
|
39
|
+
region: "Object inspector"
|
|
40
|
+
};
|
|
41
|
+
const KindChip = (props) => /* @__PURE__ */ jsxs(
|
|
42
|
+
"span",
|
|
43
|
+
{
|
|
44
|
+
"aria-label": KIND_LABEL[props.kind],
|
|
45
|
+
className: "inline-flex items-center gap-1 rounded-full border border-border bg-background px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground",
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: KIND_GLYPH[props.kind] }),
|
|
48
|
+
KIND_LABEL[props.kind]
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
const StatusDot = (props) => /* @__PURE__ */ jsxs(
|
|
53
|
+
"span",
|
|
54
|
+
{
|
|
55
|
+
"aria-label": `Status ${STATUS_LABEL[props.status]}`,
|
|
56
|
+
className: "inline-flex items-center gap-1 text-[10px] font-medium uppercase tracking-wide text-muted-foreground",
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ jsx(
|
|
59
|
+
"span",
|
|
60
|
+
{
|
|
61
|
+
"aria-hidden": "true",
|
|
62
|
+
className: cn("h-1.5 w-1.5 rounded-full", STATUS_DOT[props.status])
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
STATUS_LABEL[props.status]
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
const Header = (props) => /* @__PURE__ */ jsxs("header", { className: "flex flex-col gap-2", children: [
|
|
70
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
71
|
+
/* @__PURE__ */ jsx(KindChip, { kind: props.kind }),
|
|
72
|
+
/* @__PURE__ */ jsx(StatusDot, { status: props.status })
|
|
73
|
+
] }),
|
|
74
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
|
|
75
|
+
/* @__PURE__ */ jsx("h3", { className: "truncate text-sm font-semibold text-foreground", children: props.title }),
|
|
76
|
+
props.subtitle ? /* @__PURE__ */ jsx("p", { className: "truncate text-xs text-muted-foreground", children: props.subtitle }) : null
|
|
77
|
+
] })
|
|
78
|
+
] });
|
|
79
|
+
const ObjectInspector = forwardRef(
|
|
80
|
+
(props, ref) => {
|
|
81
|
+
const {
|
|
82
|
+
children,
|
|
83
|
+
className,
|
|
84
|
+
kind,
|
|
85
|
+
labels,
|
|
86
|
+
status = "idle",
|
|
87
|
+
subtitle,
|
|
88
|
+
title,
|
|
89
|
+
...rest
|
|
90
|
+
} = props;
|
|
91
|
+
const resolvedLabels = { ...DEFAULT_LABELS, ...labels };
|
|
92
|
+
if (!kind || !title) {
|
|
93
|
+
return /* @__PURE__ */ jsxs(
|
|
94
|
+
"section",
|
|
95
|
+
{
|
|
96
|
+
"aria-label": resolvedLabels.region,
|
|
97
|
+
className: cn(
|
|
98
|
+
"flex w-full flex-col items-center justify-center gap-1 rounded-2xl border bg-background p-6 text-center text-xs text-muted-foreground",
|
|
99
|
+
className
|
|
100
|
+
),
|
|
101
|
+
"data-object-inspector": true,
|
|
102
|
+
"data-object-state": "empty",
|
|
103
|
+
ref,
|
|
104
|
+
...rest,
|
|
105
|
+
children: [
|
|
106
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "text-lg", children: "\u25C7" }),
|
|
107
|
+
/* @__PURE__ */ jsx("span", { children: resolvedLabels.empty })
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
return /* @__PURE__ */ jsxs(
|
|
113
|
+
"section",
|
|
114
|
+
{
|
|
115
|
+
"aria-label": resolvedLabels.region,
|
|
116
|
+
className: cn(
|
|
117
|
+
"flex w-full flex-col gap-3 rounded-2xl border bg-background p-3 text-foreground",
|
|
118
|
+
className
|
|
119
|
+
),
|
|
120
|
+
"data-object-inspector": true,
|
|
121
|
+
"data-object-kind": kind,
|
|
122
|
+
"data-object-status": status,
|
|
123
|
+
ref,
|
|
124
|
+
...rest,
|
|
125
|
+
children: [
|
|
126
|
+
/* @__PURE__ */ jsx(Header, { kind, status, subtitle, title }),
|
|
127
|
+
children ? /* @__PURE__ */ jsx("div", { className: "space-y-2", children }) : null
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
);
|
|
133
|
+
ObjectInspector.displayName = "ObjectInspector";
|
|
134
|
+
export {
|
|
135
|
+
ObjectInspector
|
|
136
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
forwardRef
|
|
5
|
+
} from "react";
|
|
6
|
+
import { cn } from "../../lib/utils";
|
|
7
|
+
const STATUS_LABEL = {
|
|
8
|
+
advisory: "Advisory",
|
|
9
|
+
disabled: "Disabled",
|
|
10
|
+
enforced: "Enforced"
|
|
11
|
+
};
|
|
12
|
+
const STATUS_TONE = {
|
|
13
|
+
advisory: "border-amber-500/40 bg-amber-500/10 text-amber-700 dark:text-amber-300",
|
|
14
|
+
disabled: "border-border bg-muted/40 text-muted-foreground",
|
|
15
|
+
enforced: "border-emerald-500/40 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"
|
|
16
|
+
};
|
|
17
|
+
const DEFAULT_LABELS = {
|
|
18
|
+
empty: "No policies",
|
|
19
|
+
region: "Policy delivery"
|
|
20
|
+
};
|
|
21
|
+
const RowBody = (props) => {
|
|
22
|
+
const { policy } = props;
|
|
23
|
+
return /* @__PURE__ */ jsxs("span", { className: "flex flex-1 flex-col gap-0.5 text-left", children: [
|
|
24
|
+
/* @__PURE__ */ jsxs("span", { className: "flex items-center justify-between gap-2", children: [
|
|
25
|
+
/* @__PURE__ */ jsx("span", { className: "truncate text-xs font-medium text-foreground", children: policy.name }),
|
|
26
|
+
/* @__PURE__ */ jsx(
|
|
27
|
+
"span",
|
|
28
|
+
{
|
|
29
|
+
className: cn(
|
|
30
|
+
"rounded-full border px-1.5 py-0.5 text-[10px] uppercase tracking-wide",
|
|
31
|
+
STATUS_TONE[policy.status]
|
|
32
|
+
),
|
|
33
|
+
children: STATUS_LABEL[policy.status]
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
] }),
|
|
37
|
+
policy.description ? /* @__PURE__ */ jsx("span", { className: "truncate text-[10px] text-muted-foreground", children: policy.description }) : null
|
|
38
|
+
] });
|
|
39
|
+
};
|
|
40
|
+
const Row = (props) => {
|
|
41
|
+
const { policy } = props;
|
|
42
|
+
if (policy.onToggle) {
|
|
43
|
+
const handleClick = () => {
|
|
44
|
+
policy.onToggle?.();
|
|
45
|
+
};
|
|
46
|
+
return /* @__PURE__ */ jsx(
|
|
47
|
+
"button",
|
|
48
|
+
{
|
|
49
|
+
className: "flex w-full items-center gap-2 rounded-md border border-transparent px-2 py-1.5 text-left transition-colors hover:border-border hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
50
|
+
"data-policy-row": policy.id,
|
|
51
|
+
"data-policy-status": policy.status,
|
|
52
|
+
onClick: handleClick,
|
|
53
|
+
type: "button",
|
|
54
|
+
children: /* @__PURE__ */ jsx(RowBody, { policy })
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
return /* @__PURE__ */ jsx(
|
|
59
|
+
"div",
|
|
60
|
+
{
|
|
61
|
+
className: "flex w-full items-center gap-2 rounded-md px-2 py-1.5",
|
|
62
|
+
"data-policy-row": policy.id,
|
|
63
|
+
"data-policy-status": policy.status,
|
|
64
|
+
children: /* @__PURE__ */ jsx(RowBody, { policy })
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
const PolicyDeliveryPanel = forwardRef((props, ref) => {
|
|
69
|
+
const { className, labels, policies, title = "Policies", ...rest } = props;
|
|
70
|
+
const resolvedLabels = { ...DEFAULT_LABELS, ...labels };
|
|
71
|
+
return /* @__PURE__ */ jsxs(
|
|
72
|
+
"section",
|
|
73
|
+
{
|
|
74
|
+
"aria-label": resolvedLabels.region,
|
|
75
|
+
className: cn(
|
|
76
|
+
"flex w-full flex-col gap-2 rounded-lg border bg-background p-3 text-foreground",
|
|
77
|
+
className
|
|
78
|
+
),
|
|
79
|
+
"data-policy-delivery-panel": true,
|
|
80
|
+
ref,
|
|
81
|
+
...rest,
|
|
82
|
+
children: [
|
|
83
|
+
/* @__PURE__ */ jsx("header", { children: /* @__PURE__ */ jsx("h3", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: title }) }),
|
|
84
|
+
policies.length === 0 ? /* @__PURE__ */ jsx(
|
|
85
|
+
"p",
|
|
86
|
+
{
|
|
87
|
+
className: "px-2 py-3 text-center text-xs text-muted-foreground",
|
|
88
|
+
"data-policy-state": "empty",
|
|
89
|
+
children: resolvedLabels.empty
|
|
90
|
+
}
|
|
91
|
+
) : /* @__PURE__ */ jsx("ul", { className: "space-y-0.5", children: policies.map((policy) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Row, { policy }) }, policy.id)) })
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
});
|
|
96
|
+
PolicyDeliveryPanel.displayName = "PolicyDeliveryPanel";
|
|
97
|
+
export {
|
|
98
|
+
PolicyDeliveryPanel
|
|
99
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
forwardRef
|
|
5
|
+
} from "react";
|
|
6
|
+
import { cn } from "../../lib/utils";
|
|
7
|
+
const DEFAULT_LABELS = {
|
|
8
|
+
region: "Properties"
|
|
9
|
+
};
|
|
10
|
+
const Grid = (props) => /* @__PURE__ */ jsx(
|
|
11
|
+
"dl",
|
|
12
|
+
{
|
|
13
|
+
className: "grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1.5 px-3 pb-3 pt-1 text-xs",
|
|
14
|
+
"data-property-grid": true,
|
|
15
|
+
children: props.entries.map((entry) => /* @__PURE__ */ jsxs("div", { className: "contents", children: [
|
|
16
|
+
/* @__PURE__ */ jsxs(
|
|
17
|
+
"dt",
|
|
18
|
+
{
|
|
19
|
+
className: "flex flex-col text-muted-foreground",
|
|
20
|
+
"data-property-id": entry.id,
|
|
21
|
+
children: [
|
|
22
|
+
/* @__PURE__ */ jsx("span", { children: entry.label }),
|
|
23
|
+
entry.sublabel ? /* @__PURE__ */ jsx("span", { className: "text-[10px] uppercase tracking-wide text-muted-foreground/70", children: entry.sublabel }) : null
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
),
|
|
27
|
+
/* @__PURE__ */ jsx("dd", { className: "text-right text-foreground", children: entry.value })
|
|
28
|
+
] }, entry.id))
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
const Body = (props) => {
|
|
32
|
+
const grid = /* @__PURE__ */ jsx(Grid, { entries: props.entries });
|
|
33
|
+
if (!props.title) {
|
|
34
|
+
return grid;
|
|
35
|
+
}
|
|
36
|
+
if (props.collapsible) {
|
|
37
|
+
return /* @__PURE__ */ jsxs("details", { className: "group", open: true, children: [
|
|
38
|
+
/* @__PURE__ */ jsxs(
|
|
39
|
+
"summary",
|
|
40
|
+
{
|
|
41
|
+
className: "flex cursor-pointer items-center justify-between gap-2 px-3 py-2 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",
|
|
42
|
+
"data-property-summary": true,
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ jsx("span", { children: props.title }),
|
|
45
|
+
/* @__PURE__ */ jsx(
|
|
46
|
+
"span",
|
|
47
|
+
{
|
|
48
|
+
"aria-hidden": "true",
|
|
49
|
+
className: "text-muted-foreground/70 group-open:rotate-90",
|
|
50
|
+
children: "\u203A"
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
grid
|
|
57
|
+
] });
|
|
58
|
+
}
|
|
59
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
60
|
+
/* @__PURE__ */ jsx(
|
|
61
|
+
"header",
|
|
62
|
+
{
|
|
63
|
+
className: "flex items-center justify-between gap-2 border-b border-border px-3 py-2 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",
|
|
64
|
+
"data-property-header": true,
|
|
65
|
+
children: props.title
|
|
66
|
+
}
|
|
67
|
+
),
|
|
68
|
+
grid
|
|
69
|
+
] });
|
|
70
|
+
};
|
|
71
|
+
const PropertySection = forwardRef(
|
|
72
|
+
(props, ref) => {
|
|
73
|
+
const {
|
|
74
|
+
className,
|
|
75
|
+
collapsible = false,
|
|
76
|
+
entries,
|
|
77
|
+
labels,
|
|
78
|
+
title,
|
|
79
|
+
...rest
|
|
80
|
+
} = props;
|
|
81
|
+
const resolvedLabels = { ...DEFAULT_LABELS, ...labels };
|
|
82
|
+
return /* @__PURE__ */ jsx(
|
|
83
|
+
"section",
|
|
84
|
+
{
|
|
85
|
+
"aria-label": resolvedLabels.region,
|
|
86
|
+
className: cn(
|
|
87
|
+
"rounded-lg border bg-background text-foreground",
|
|
88
|
+
className
|
|
89
|
+
),
|
|
90
|
+
"data-property-section": true,
|
|
91
|
+
ref,
|
|
92
|
+
...rest,
|
|
93
|
+
children: /* @__PURE__ */ jsx(Body, { collapsible, entries, title })
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
PropertySection.displayName = "PropertySection";
|
|
99
|
+
export {
|
|
100
|
+
PropertySection
|
|
101
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
forwardRef
|
|
5
|
+
} from "react";
|
|
6
|
+
import { cn } from "../../lib/utils";
|
|
7
|
+
const DEFAULT_LABELS = {
|
|
8
|
+
empty: "No relationships",
|
|
9
|
+
inbound: "Inbound",
|
|
10
|
+
outbound: "Outbound",
|
|
11
|
+
region: "Relationship inspector"
|
|
12
|
+
};
|
|
13
|
+
const ARROW_GLYPH = {
|
|
14
|
+
inbound: "\u2190",
|
|
15
|
+
outbound: "\u2192"
|
|
16
|
+
};
|
|
17
|
+
const RowBody = (props) => {
|
|
18
|
+
const { edge } = props;
|
|
19
|
+
return /* @__PURE__ */ jsxs("span", { className: "flex flex-1 items-center gap-2", children: [
|
|
20
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "text-muted-foreground", children: ARROW_GLYPH[edge.direction] }),
|
|
21
|
+
/* @__PURE__ */ jsxs("span", { className: "flex flex-1 flex-col text-left", children: [
|
|
22
|
+
/* @__PURE__ */ jsx("span", { className: "truncate text-xs text-foreground", children: edge.target }),
|
|
23
|
+
edge.targetSublabel ? /* @__PURE__ */ jsx("span", { className: "truncate text-[10px] text-muted-foreground", children: edge.targetSublabel }) : null
|
|
24
|
+
] }),
|
|
25
|
+
/* @__PURE__ */ jsx("span", { className: "rounded-full border border-border bg-background px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-muted-foreground", children: edge.relation })
|
|
26
|
+
] });
|
|
27
|
+
};
|
|
28
|
+
const Row = (props) => {
|
|
29
|
+
const { edge } = props;
|
|
30
|
+
if (edge.onActivate) {
|
|
31
|
+
const handleClick = () => {
|
|
32
|
+
edge.onActivate?.();
|
|
33
|
+
};
|
|
34
|
+
return /* @__PURE__ */ jsx(
|
|
35
|
+
"button",
|
|
36
|
+
{
|
|
37
|
+
className: "flex w-full items-center gap-2 rounded-md border border-transparent px-2 py-1.5 text-left transition-colors hover:border-border hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
38
|
+
"data-relationship-direction": edge.direction,
|
|
39
|
+
"data-relationship-row": true,
|
|
40
|
+
onClick: handleClick,
|
|
41
|
+
type: "button",
|
|
42
|
+
children: /* @__PURE__ */ jsx(RowBody, { edge })
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
return /* @__PURE__ */ jsx(
|
|
47
|
+
"div",
|
|
48
|
+
{
|
|
49
|
+
className: "flex w-full items-center gap-2 rounded-md px-2 py-1.5",
|
|
50
|
+
"data-relationship-direction": edge.direction,
|
|
51
|
+
"data-relationship-row": true,
|
|
52
|
+
children: /* @__PURE__ */ jsx(RowBody, { edge })
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
const Group = (props) => {
|
|
57
|
+
const { edges, heading } = props;
|
|
58
|
+
if (edges.length === 0) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-1", "data-relationship-group": heading.toLowerCase(), children: [
|
|
62
|
+
/* @__PURE__ */ jsx("h4", { className: "px-2 text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: heading }),
|
|
63
|
+
/* @__PURE__ */ jsx("ul", { className: "space-y-0.5", children: edges.map((edge) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Row, { edge }) }, edge.id)) })
|
|
64
|
+
] });
|
|
65
|
+
};
|
|
66
|
+
const RelationshipInspector = forwardRef((props, ref) => {
|
|
67
|
+
const { className, edges, labels, title = "Relationships", ...rest } = props;
|
|
68
|
+
const resolvedLabels = { ...DEFAULT_LABELS, ...labels };
|
|
69
|
+
const inbound = edges.filter((edge) => edge.direction === "inbound");
|
|
70
|
+
const outbound = edges.filter((edge) => edge.direction === "outbound");
|
|
71
|
+
return /* @__PURE__ */ jsxs(
|
|
72
|
+
"section",
|
|
73
|
+
{
|
|
74
|
+
"aria-label": resolvedLabels.region,
|
|
75
|
+
className: cn(
|
|
76
|
+
"flex w-full flex-col gap-2 rounded-lg border bg-background p-3 text-foreground",
|
|
77
|
+
className
|
|
78
|
+
),
|
|
79
|
+
"data-relationship-inspector": true,
|
|
80
|
+
ref,
|
|
81
|
+
...rest,
|
|
82
|
+
children: [
|
|
83
|
+
/* @__PURE__ */ jsx("header", { children: /* @__PURE__ */ jsx("h3", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: title }) }),
|
|
84
|
+
edges.length === 0 ? /* @__PURE__ */ jsx(
|
|
85
|
+
"p",
|
|
86
|
+
{
|
|
87
|
+
className: "px-2 py-3 text-center text-xs text-muted-foreground",
|
|
88
|
+
"data-relationship-state": "empty",
|
|
89
|
+
children: resolvedLabels.empty
|
|
90
|
+
}
|
|
91
|
+
) : /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
92
|
+
/* @__PURE__ */ jsx(Group, { edges: inbound, heading: resolvedLabels.inbound }),
|
|
93
|
+
/* @__PURE__ */ jsx(Group, { edges: outbound, heading: resolvedLabels.outbound })
|
|
94
|
+
] })
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
});
|
|
99
|
+
RelationshipInspector.displayName = "RelationshipInspector";
|
|
100
|
+
export {
|
|
101
|
+
RelationshipInspector
|
|
102
|
+
};
|