@getcatalystiq/agent-plane-ui 0.1.18 → 0.1.20

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.
@@ -1,14 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var React3 = require('react');
3
+ var React4 = require('react');
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
- var useSWR = require('swr');
6
5
  var clsx = require('clsx');
7
6
  var tailwindMerge = require('tailwind-merge');
8
7
  var classVarianceAuthority = require('class-variance-authority');
9
8
 
10
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
11
-
12
9
  function _interopNamespace(e) {
13
10
  if (e && e.__esModule) return e;
14
11
  var n = Object.create(null);
@@ -27,11 +24,10 @@ function _interopNamespace(e) {
27
24
  return Object.freeze(n);
28
25
  }
29
26
 
30
- var React3__namespace = /*#__PURE__*/_interopNamespace(React3);
31
- var useSWR__default = /*#__PURE__*/_interopDefault(useSWR);
27
+ var React4__namespace = /*#__PURE__*/_interopNamespace(React4);
32
28
 
33
- var ClientContext = React3.createContext(null);
34
- var NavigationContext = React3.createContext(
29
+ var ClientContext = React4.createContext(null);
30
+ var NavigationContext = React4.createContext(
35
31
  null
36
32
  );
37
33
  function DefaultLink({ href, children, className }) {
@@ -45,11 +41,11 @@ function AgentPlaneProvider({
45
41
  basePath = "",
46
42
  children
47
43
  }) {
48
- const clientRef = React3.useRef(client);
44
+ const clientRef = React4.useRef(client);
49
45
  clientRef.current = client;
50
- const onAuthErrorRef = React3.useRef(onAuthError);
46
+ const onAuthErrorRef = React4.useRef(onAuthError);
51
47
  onAuthErrorRef.current = onAuthError;
52
- const clientValue = React3.useMemo(
48
+ const clientValue = React4.useMemo(
53
49
  () => ({
54
50
  // Expose a stable object whose `.client` always points to the latest ref.
55
51
  get client() {
@@ -62,7 +58,7 @@ function AgentPlaneProvider({
62
58
  // eslint-disable-next-line react-hooks/exhaustive-deps -- intentionally stable
63
59
  []
64
60
  );
65
- const navigationValue = React3.useMemo(
61
+ const navigationValue = React4.useMemo(
66
62
  () => ({
67
63
  onNavigate,
68
64
  LinkComponent,
@@ -73,7 +69,7 @@ function AgentPlaneProvider({
73
69
  return /* @__PURE__ */ jsxRuntime.jsx(ClientContext.Provider, { value: clientValue, children: /* @__PURE__ */ jsxRuntime.jsx(NavigationContext.Provider, { value: navigationValue, children }) });
74
70
  }
75
71
  function useAgentPlaneClient() {
76
- const ctx = React3.useContext(ClientContext);
72
+ const ctx = React4.useContext(ClientContext);
77
73
  if (!ctx) {
78
74
  throw new Error(
79
75
  "useAgentPlaneClient must be used within an <AgentPlaneProvider>"
@@ -82,7 +78,7 @@ function useAgentPlaneClient() {
82
78
  return ctx.client;
83
79
  }
84
80
  function useAuthError() {
85
- const ctx = React3.useContext(ClientContext);
81
+ const ctx = React4.useContext(ClientContext);
86
82
  if (!ctx) {
87
83
  throw new Error(
88
84
  "useAuthError must be used within an <AgentPlaneProvider>"
@@ -91,7 +87,7 @@ function useAuthError() {
91
87
  return ctx.onAuthError;
92
88
  }
93
89
  function useNavigation() {
94
- const ctx = React3.useContext(NavigationContext);
90
+ const ctx = React4.useContext(NavigationContext);
95
91
  if (!ctx) {
96
92
  throw new Error(
97
93
  "useNavigation must be used within an <AgentPlaneProvider>"
@@ -99,24 +95,6 @@ function useNavigation() {
99
95
  }
100
96
  return ctx;
101
97
  }
102
- function useApi(key, fetcher, options) {
103
- const client = useAgentPlaneClient();
104
- const onAuthError = useAuthError();
105
- return useSWR__default.default(
106
- key,
107
- () => fetcher(client),
108
- {
109
- revalidateOnFocus: false,
110
- errorRetryCount: 3,
111
- onError: (err) => {
112
- if (onAuthError && err && typeof err === "object" && "status" in err && err.status === 401) {
113
- onAuthError(err instanceof Error ? err : new Error(String(err)));
114
- }
115
- },
116
- ...options
117
- }
118
- );
119
- }
120
98
  function cn(...inputs) {
121
99
  return tailwindMerge.twMerge(clsx.clsx(inputs));
122
100
  }
@@ -148,7 +126,7 @@ var buttonVariants = classVarianceAuthority.cva(
148
126
  }
149
127
  }
150
128
  );
151
- var Button = React3__namespace.forwardRef(
129
+ var Button = React4__namespace.forwardRef(
152
130
  ({ className, variant, size, ...props }, ref) => {
153
131
  return /* @__PURE__ */ jsxRuntime.jsx(
154
132
  "button",
@@ -161,26 +139,6 @@ var Button = React3__namespace.forwardRef(
161
139
  }
162
140
  );
163
141
  Button.displayName = "Button";
164
- var Card = React3__namespace.forwardRef(
165
- ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("rounded-xl border bg-card text-card-foreground shadow", className), ...props })
166
- );
167
- Card.displayName = "Card";
168
- var CardHeader = React3__namespace.forwardRef(
169
- ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("flex flex-col space-y-1.5 p-6", className), ...props })
170
- );
171
- CardHeader.displayName = "CardHeader";
172
- var CardTitle = React3__namespace.forwardRef(
173
- ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("font-semibold leading-none tracking-tight", className), ...props })
174
- );
175
- CardTitle.displayName = "CardTitle";
176
- var CardDescription = React3__namespace.forwardRef(
177
- ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("text-sm text-muted-foreground", className), ...props })
178
- );
179
- CardDescription.displayName = "CardDescription";
180
- var CardContent = React3__namespace.forwardRef(
181
- ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("p-6 pt-0", className), ...props })
182
- );
183
- CardContent.displayName = "CardContent";
184
142
  var badgeVariants = classVarianceAuthority.cva(
185
143
  "inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
186
144
  {
@@ -200,7 +158,7 @@ var badgeVariants = classVarianceAuthority.cva(
200
158
  function Badge({ className, variant, ...props }) {
201
159
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(badgeVariants({ variant }), className), ...props });
202
160
  }
203
- var Input = React3__namespace.forwardRef(
161
+ var Input = React4__namespace.forwardRef(
204
162
  ({ className, type, ...props }, ref) => {
205
163
  return /* @__PURE__ */ jsxRuntime.jsx(
206
164
  "input",
@@ -217,25 +175,96 @@ var Input = React3__namespace.forwardRef(
217
175
  }
218
176
  );
219
177
  Input.displayName = "Input";
220
- function Skeleton({ className, ...props }) {
221
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("animate-pulse rounded-md bg-muted/50", className), ...props });
178
+ function FormField({ label, children, error, hint }) {
179
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
180
+ /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-xs font-medium text-muted-foreground", children: label }),
181
+ children,
182
+ hint && !error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground mt-1", children: hint }),
183
+ error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-destructive mt-1", children: error })
184
+ ] });
185
+ }
186
+ function Dialog({ open, onOpenChange, children }) {
187
+ React4__namespace.useEffect(() => {
188
+ if (!open) return;
189
+ function onKeyDown(e) {
190
+ if (e.key === "Escape") onOpenChange(false);
191
+ }
192
+ document.addEventListener("keydown", onKeyDown);
193
+ return () => document.removeEventListener("keydown", onKeyDown);
194
+ }, [open, onOpenChange]);
195
+ React4__namespace.useEffect(() => {
196
+ if (!open) return;
197
+ const prev = document.body.style.overflow;
198
+ document.body.style.overflow = "hidden";
199
+ return () => {
200
+ document.body.style.overflow = prev;
201
+ };
202
+ }, [open]);
203
+ if (!open) return null;
204
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "fixed inset-0 z-50 flex items-center justify-center", children: [
205
+ /* @__PURE__ */ jsxRuntime.jsx(
206
+ "div",
207
+ {
208
+ className: "absolute inset-0 bg-black/60 animate-dialog-overlay",
209
+ onClick: () => onOpenChange(false)
210
+ }
211
+ ),
212
+ children
213
+ ] });
214
+ }
215
+ function DialogContent({ className, children, ...props }) {
216
+ return /* @__PURE__ */ jsxRuntime.jsx(
217
+ "div",
218
+ {
219
+ className: cn(
220
+ "relative z-10 w-full bg-background border border-border rounded-xl shadow-2xl mx-4 max-h-[85vh] overflow-y-auto animate-dialog-content",
221
+ className
222
+ ),
223
+ onClick: (e) => e.stopPropagation(),
224
+ ...props,
225
+ children
226
+ }
227
+ );
228
+ }
229
+ function DialogHeader({ className, children, ...props }) {
230
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("px-6 pt-6 pb-0", className), ...props, children });
231
+ }
232
+ function DialogBody({ className, children, ...props }) {
233
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("px-6 py-4", className), ...props, children });
234
+ }
235
+ function DialogFooter({ className, children, ...props }) {
236
+ return /* @__PURE__ */ jsxRuntime.jsx(
237
+ "div",
238
+ {
239
+ className: cn("flex items-center justify-end gap-2 px-6 py-4 border-t border-border bg-muted/30 rounded-b-xl", className),
240
+ ...props,
241
+ children
242
+ }
243
+ );
244
+ }
245
+ function DialogTitle({ className, children, ...props }) {
246
+ return /* @__PURE__ */ jsxRuntime.jsx("h2", { className: cn("text-base font-semibold", className), ...props, children });
247
+ }
248
+ function DialogDescription({ className, children, ...props }) {
249
+ return /* @__PURE__ */ jsxRuntime.jsx("p", { className: cn("text-sm text-muted-foreground mt-1", className), ...props, children });
222
250
  }
223
251
 
224
252
  exports.AgentPlaneProvider = AgentPlaneProvider;
225
253
  exports.Badge = Badge;
226
254
  exports.Button = Button;
227
- exports.Card = Card;
228
- exports.CardContent = CardContent;
229
- exports.CardDescription = CardDescription;
230
- exports.CardHeader = CardHeader;
231
- exports.CardTitle = CardTitle;
255
+ exports.Dialog = Dialog;
256
+ exports.DialogBody = DialogBody;
257
+ exports.DialogContent = DialogContent;
258
+ exports.DialogDescription = DialogDescription;
259
+ exports.DialogFooter = DialogFooter;
260
+ exports.DialogHeader = DialogHeader;
261
+ exports.DialogTitle = DialogTitle;
262
+ exports.FormField = FormField;
232
263
  exports.Input = Input;
233
- exports.Skeleton = Skeleton;
234
264
  exports.badgeVariants = badgeVariants;
235
265
  exports.buttonVariants = buttonVariants;
236
266
  exports.cn = cn;
237
267
  exports.supportsClaudeRunner = supportsClaudeRunner;
238
268
  exports.useAgentPlaneClient = useAgentPlaneClient;
239
- exports.useApi = useApi;
240
269
  exports.useAuthError = useAuthError;
241
270
  exports.useNavigation = useNavigation;