@object-ui/plugin-ai 0.1.0 → 2.0.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/index.js +289 -289
- package/dist/index.umd.cjs +2 -2
- package/dist/src/AIFormAssist.d.ts +5 -1
- package/dist/src/AIFormAssist.d.ts.map +1 -1
- package/dist/src/AIRecommendations.d.ts +5 -1
- package/dist/src/AIRecommendations.d.ts.map +1 -1
- package/dist/src/NLQueryInput.d.ts +2 -0
- package/dist/src/NLQueryInput.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import { ComponentRegistry as
|
|
2
|
-
import ue, { useState as
|
|
3
|
-
import { Card as
|
|
4
|
-
import { Sparkles as
|
|
5
|
-
var
|
|
6
|
-
var
|
|
1
|
+
import { ComponentRegistry as Q } from "@object-ui/core";
|
|
2
|
+
import ue, { useState as A } from "react";
|
|
3
|
+
import { Card as T, CardHeader as Y, CardTitle as $, Badge as O, Button as y, CardContent as S, Input as xe } from "@object-ui/components";
|
|
4
|
+
import { Sparkles as M, RefreshCw as fe, X as H, Lightbulb as he, Check as te, Star as ae, ThumbsUp as pe, ThumbsDown as ge, ExternalLink as je, Search as be, Loader2 as Ne, Table as ve, Clock as ye, ArrowRight as we } from "lucide-react";
|
|
5
|
+
var z = { exports: {} }, F = {};
|
|
6
|
+
var re;
|
|
7
7
|
function Re() {
|
|
8
|
-
if (
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
function
|
|
12
|
-
var
|
|
13
|
-
if (
|
|
14
|
-
|
|
15
|
-
for (var
|
|
16
|
-
|
|
17
|
-
} else
|
|
18
|
-
return
|
|
19
|
-
$$typeof:
|
|
20
|
-
type:
|
|
21
|
-
key:
|
|
22
|
-
ref:
|
|
23
|
-
props:
|
|
8
|
+
if (re) return F;
|
|
9
|
+
re = 1;
|
|
10
|
+
var p = /* @__PURE__ */ Symbol.for("react.transitional.element"), g = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
11
|
+
function j(x, d, m) {
|
|
12
|
+
var b = null;
|
|
13
|
+
if (m !== void 0 && (b = "" + m), d.key !== void 0 && (b = "" + d.key), "key" in d) {
|
|
14
|
+
m = {};
|
|
15
|
+
for (var f in d)
|
|
16
|
+
f !== "key" && (m[f] = d[f]);
|
|
17
|
+
} else m = d;
|
|
18
|
+
return d = m.ref, {
|
|
19
|
+
$$typeof: p,
|
|
20
|
+
type: x,
|
|
21
|
+
key: b,
|
|
22
|
+
ref: d !== void 0 ? d : null,
|
|
23
|
+
props: m
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
return
|
|
26
|
+
return F.Fragment = g, F.jsx = j, F.jsxs = j, F;
|
|
27
27
|
}
|
|
28
|
-
var
|
|
29
|
-
var
|
|
28
|
+
var L = {};
|
|
29
|
+
var ne;
|
|
30
30
|
function Ee() {
|
|
31
|
-
return
|
|
32
|
-
function
|
|
31
|
+
return ne || (ne = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
32
|
+
function p(s) {
|
|
33
33
|
if (s == null) return null;
|
|
34
34
|
if (typeof s == "function")
|
|
35
35
|
return s.$$typeof === ce ? null : s.displayName || s.name || null;
|
|
36
36
|
if (typeof s == "string") return s;
|
|
37
37
|
switch (s) {
|
|
38
|
-
case
|
|
38
|
+
case _:
|
|
39
39
|
return "Fragment";
|
|
40
|
-
case
|
|
40
|
+
case u:
|
|
41
41
|
return "Profiler";
|
|
42
|
-
case
|
|
42
|
+
case l:
|
|
43
43
|
return "StrictMode";
|
|
44
|
-
case
|
|
44
|
+
case I:
|
|
45
45
|
return "Suspense";
|
|
46
|
-
case
|
|
46
|
+
case q:
|
|
47
47
|
return "SuspenseList";
|
|
48
48
|
case ie:
|
|
49
49
|
return "Activity";
|
|
@@ -52,98 +52,98 @@ function Ee() {
|
|
|
52
52
|
switch (typeof s.tag == "number" && console.error(
|
|
53
53
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
54
54
|
), s.$$typeof) {
|
|
55
|
-
case
|
|
55
|
+
case w:
|
|
56
56
|
return "Portal";
|
|
57
|
-
case
|
|
57
|
+
case P:
|
|
58
58
|
return s.displayName || "Context";
|
|
59
|
-
case
|
|
59
|
+
case k:
|
|
60
60
|
return (s._context.displayName || "Context") + ".Consumer";
|
|
61
|
-
case
|
|
62
|
-
var
|
|
63
|
-
return s = s.displayName, s || (s =
|
|
61
|
+
case r:
|
|
62
|
+
var a = s.render;
|
|
63
|
+
return s = s.displayName, s || (s = a.displayName || a.name || "", s = s !== "" ? "ForwardRef(" + s + ")" : "ForwardRef"), s;
|
|
64
64
|
case oe:
|
|
65
|
-
return
|
|
66
|
-
case
|
|
67
|
-
|
|
65
|
+
return a = s.displayName || null, a !== null ? a : p(s.type) || "Memo";
|
|
66
|
+
case V:
|
|
67
|
+
a = s._payload, s = s._init;
|
|
68
68
|
try {
|
|
69
|
-
return
|
|
69
|
+
return p(s(a));
|
|
70
70
|
} catch {
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
return null;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function g(s) {
|
|
76
76
|
return "" + s;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function j(s) {
|
|
79
79
|
try {
|
|
80
|
-
|
|
81
|
-
var
|
|
80
|
+
g(s);
|
|
81
|
+
var a = !1;
|
|
82
82
|
} catch {
|
|
83
|
-
|
|
83
|
+
a = !0;
|
|
84
84
|
}
|
|
85
|
-
if (
|
|
86
|
-
|
|
87
|
-
var
|
|
88
|
-
return
|
|
89
|
-
|
|
85
|
+
if (a) {
|
|
86
|
+
a = console;
|
|
87
|
+
var o = a.error, i = typeof Symbol == "function" && Symbol.toStringTag && s[Symbol.toStringTag] || s.constructor.name || "Object";
|
|
88
|
+
return o.call(
|
|
89
|
+
a,
|
|
90
90
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
91
|
-
|
|
92
|
-
),
|
|
91
|
+
i
|
|
92
|
+
), g(s);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
-
function
|
|
96
|
-
if (s ===
|
|
97
|
-
if (typeof s == "object" && s !== null && s.$$typeof ===
|
|
95
|
+
function x(s) {
|
|
96
|
+
if (s === _) return "<>";
|
|
97
|
+
if (typeof s == "object" && s !== null && s.$$typeof === V)
|
|
98
98
|
return "<...>";
|
|
99
99
|
try {
|
|
100
|
-
var
|
|
101
|
-
return
|
|
100
|
+
var a = p(s);
|
|
101
|
+
return a ? "<" + a + ">" : "<...>";
|
|
102
102
|
} catch {
|
|
103
103
|
return "<...>";
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
var s =
|
|
106
|
+
function d() {
|
|
107
|
+
var s = U.A;
|
|
108
108
|
return s === null ? null : s.getOwner();
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function m() {
|
|
111
111
|
return Error("react-stack-top-frame");
|
|
112
112
|
}
|
|
113
|
-
function
|
|
114
|
-
if (
|
|
115
|
-
var
|
|
116
|
-
if (
|
|
113
|
+
function b(s) {
|
|
114
|
+
if (X.call(s, "key")) {
|
|
115
|
+
var a = Object.getOwnPropertyDescriptor(s, "key").get;
|
|
116
|
+
if (a && a.isReactWarning) return !1;
|
|
117
117
|
}
|
|
118
118
|
return s.key !== void 0;
|
|
119
119
|
}
|
|
120
|
-
function
|
|
121
|
-
function
|
|
122
|
-
|
|
120
|
+
function f(s, a) {
|
|
121
|
+
function o() {
|
|
122
|
+
B || (B = !0, console.error(
|
|
123
123
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
124
|
-
|
|
124
|
+
a
|
|
125
125
|
));
|
|
126
126
|
}
|
|
127
|
-
|
|
128
|
-
get:
|
|
127
|
+
o.isReactWarning = !0, Object.defineProperty(s, "key", {
|
|
128
|
+
get: o,
|
|
129
129
|
configurable: !0
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
132
|
function v() {
|
|
133
|
-
var s =
|
|
134
|
-
return
|
|
133
|
+
var s = p(this.type);
|
|
134
|
+
return Z[s] || (Z[s] = !0, console.error(
|
|
135
135
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
136
136
|
)), s = this.props.ref, s !== void 0 ? s : null;
|
|
137
137
|
}
|
|
138
|
-
function
|
|
139
|
-
var
|
|
138
|
+
function N(s, a, o, i, D, G) {
|
|
139
|
+
var c = o.ref;
|
|
140
140
|
return s = {
|
|
141
|
-
$$typeof:
|
|
141
|
+
$$typeof: h,
|
|
142
142
|
type: s,
|
|
143
|
-
key:
|
|
144
|
-
props:
|
|
145
|
-
_owner:
|
|
146
|
-
}, (
|
|
143
|
+
key: a,
|
|
144
|
+
props: o,
|
|
145
|
+
_owner: i
|
|
146
|
+
}, (c !== void 0 ? c : null) !== null ? Object.defineProperty(s, "ref", {
|
|
147
147
|
enumerable: !1,
|
|
148
148
|
get: v
|
|
149
149
|
}) : Object.defineProperty(s, "ref", { enumerable: !1, value: null }), s._store = {}, Object.defineProperty(s._store, "validated", {
|
|
@@ -160,135 +160,135 @@ function Ee() {
|
|
|
160
160
|
configurable: !1,
|
|
161
161
|
enumerable: !1,
|
|
162
162
|
writable: !0,
|
|
163
|
-
value:
|
|
163
|
+
value: D
|
|
164
164
|
}), Object.defineProperty(s, "_debugTask", {
|
|
165
165
|
configurable: !1,
|
|
166
166
|
enumerable: !1,
|
|
167
167
|
writable: !0,
|
|
168
|
-
value:
|
|
168
|
+
value: G
|
|
169
169
|
}), Object.freeze && (Object.freeze(s.props), Object.freeze(s)), s;
|
|
170
170
|
}
|
|
171
|
-
function
|
|
172
|
-
var
|
|
173
|
-
if (
|
|
174
|
-
if (
|
|
175
|
-
if (de(
|
|
176
|
-
for (
|
|
177
|
-
|
|
178
|
-
Object.freeze && Object.freeze(
|
|
171
|
+
function n(s, a, o, i, D, G) {
|
|
172
|
+
var c = a.children;
|
|
173
|
+
if (c !== void 0)
|
|
174
|
+
if (i)
|
|
175
|
+
if (de(c)) {
|
|
176
|
+
for (i = 0; i < c.length; i++)
|
|
177
|
+
R(c[i]);
|
|
178
|
+
Object.freeze && Object.freeze(c);
|
|
179
179
|
} else
|
|
180
180
|
console.error(
|
|
181
181
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
182
182
|
);
|
|
183
|
-
else
|
|
184
|
-
if (
|
|
185
|
-
|
|
186
|
-
var
|
|
183
|
+
else R(c);
|
|
184
|
+
if (X.call(a, "key")) {
|
|
185
|
+
c = p(s);
|
|
186
|
+
var C = Object.keys(a).filter(function(me) {
|
|
187
187
|
return me !== "key";
|
|
188
188
|
});
|
|
189
|
-
|
|
189
|
+
i = 0 < C.length ? "{key: someKey, " + C.join(": ..., ") + ": ...}" : "{key: someKey}", se[c + i] || (C = 0 < C.length ? "{" + C.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
190
190
|
`A props object containing a "key" prop is being spread into JSX:
|
|
191
191
|
let props = %s;
|
|
192
192
|
<%s {...props} />
|
|
193
193
|
React keys must be passed directly to JSX without using spread:
|
|
194
194
|
let props = %s;
|
|
195
195
|
<%s key={someKey} {...props} />`,
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
),
|
|
196
|
+
i,
|
|
197
|
+
c,
|
|
198
|
+
C,
|
|
199
|
+
c
|
|
200
|
+
), se[c + i] = !0);
|
|
201
201
|
}
|
|
202
|
-
if (
|
|
203
|
-
|
|
204
|
-
for (var
|
|
205
|
-
|
|
206
|
-
} else
|
|
207
|
-
return
|
|
208
|
-
|
|
202
|
+
if (c = null, o !== void 0 && (j(o), c = "" + o), b(a) && (j(a.key), c = "" + a.key), "key" in a) {
|
|
203
|
+
o = {};
|
|
204
|
+
for (var J in a)
|
|
205
|
+
J !== "key" && (o[J] = a[J]);
|
|
206
|
+
} else o = a;
|
|
207
|
+
return c && f(
|
|
208
|
+
o,
|
|
209
209
|
typeof s == "function" ? s.displayName || s.name || "Unknown" : s
|
|
210
|
-
),
|
|
210
|
+
), N(
|
|
211
211
|
s,
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
212
|
+
c,
|
|
213
|
+
o,
|
|
214
|
+
d(),
|
|
215
|
+
D,
|
|
216
|
+
G
|
|
217
217
|
);
|
|
218
218
|
}
|
|
219
|
-
function
|
|
220
|
-
|
|
219
|
+
function R(s) {
|
|
220
|
+
E(s) ? s._store && (s._store.validated = 1) : typeof s == "object" && s !== null && s.$$typeof === V && (s._payload.status === "fulfilled" ? E(s._payload.value) && s._payload.value._store && (s._payload.value._store.validated = 1) : s._store && (s._store.validated = 1));
|
|
221
221
|
}
|
|
222
|
-
function
|
|
223
|
-
return typeof s == "object" && s !== null && s.$$typeof ===
|
|
222
|
+
function E(s) {
|
|
223
|
+
return typeof s == "object" && s !== null && s.$$typeof === h;
|
|
224
224
|
}
|
|
225
|
-
var
|
|
225
|
+
var t = ue, h = /* @__PURE__ */ Symbol.for("react.transitional.element"), w = /* @__PURE__ */ Symbol.for("react.portal"), _ = /* @__PURE__ */ Symbol.for("react.fragment"), l = /* @__PURE__ */ Symbol.for("react.strict_mode"), u = /* @__PURE__ */ Symbol.for("react.profiler"), k = /* @__PURE__ */ Symbol.for("react.consumer"), P = /* @__PURE__ */ Symbol.for("react.context"), r = /* @__PURE__ */ Symbol.for("react.forward_ref"), I = /* @__PURE__ */ Symbol.for("react.suspense"), q = /* @__PURE__ */ Symbol.for("react.suspense_list"), oe = /* @__PURE__ */ Symbol.for("react.memo"), V = /* @__PURE__ */ Symbol.for("react.lazy"), ie = /* @__PURE__ */ Symbol.for("react.activity"), ce = /* @__PURE__ */ Symbol.for("react.client.reference"), U = t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, X = Object.prototype.hasOwnProperty, de = Array.isArray, W = console.createTask ? console.createTask : function() {
|
|
226
226
|
return null;
|
|
227
227
|
};
|
|
228
|
-
|
|
228
|
+
t = {
|
|
229
229
|
react_stack_bottom_frame: function(s) {
|
|
230
230
|
return s();
|
|
231
231
|
}
|
|
232
232
|
};
|
|
233
|
-
var
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
)(),
|
|
237
|
-
|
|
238
|
-
var
|
|
239
|
-
return
|
|
233
|
+
var B, Z = {}, K = t.react_stack_bottom_frame.bind(
|
|
234
|
+
t,
|
|
235
|
+
m
|
|
236
|
+
)(), ee = W(x(m)), se = {};
|
|
237
|
+
L.Fragment = _, L.jsx = function(s, a, o) {
|
|
238
|
+
var i = 1e4 > U.recentlyCreatedOwnerStacks++;
|
|
239
|
+
return n(
|
|
240
240
|
s,
|
|
241
|
-
|
|
242
|
-
|
|
241
|
+
a,
|
|
242
|
+
o,
|
|
243
243
|
!1,
|
|
244
|
-
|
|
245
|
-
|
|
244
|
+
i ? Error("react-stack-top-frame") : K,
|
|
245
|
+
i ? W(x(s)) : ee
|
|
246
246
|
);
|
|
247
|
-
},
|
|
248
|
-
var
|
|
249
|
-
return
|
|
247
|
+
}, L.jsxs = function(s, a, o) {
|
|
248
|
+
var i = 1e4 > U.recentlyCreatedOwnerStacks++;
|
|
249
|
+
return n(
|
|
250
250
|
s,
|
|
251
|
-
|
|
252
|
-
|
|
251
|
+
a,
|
|
252
|
+
o,
|
|
253
253
|
!0,
|
|
254
|
-
|
|
255
|
-
|
|
254
|
+
i ? Error("react-stack-top-frame") : K,
|
|
255
|
+
i ? W(x(s)) : ee
|
|
256
256
|
);
|
|
257
257
|
};
|
|
258
|
-
})()),
|
|
258
|
+
})()), L;
|
|
259
259
|
}
|
|
260
|
-
var
|
|
260
|
+
var le;
|
|
261
261
|
function _e() {
|
|
262
|
-
return
|
|
262
|
+
return le || (le = 1, process.env.NODE_ENV === "production" ? z.exports = Re() : z.exports = Ee()), z.exports;
|
|
263
263
|
}
|
|
264
264
|
var e = _e();
|
|
265
|
-
const ke = ({ schema:
|
|
265
|
+
const ke = ({ schema: p, onApply: g, onRefresh: j }) => {
|
|
266
266
|
const {
|
|
267
|
-
suggestions:
|
|
268
|
-
showConfidence:
|
|
269
|
-
showReasoning:
|
|
270
|
-
autoFill:
|
|
271
|
-
} =
|
|
272
|
-
|
|
273
|
-
},
|
|
274
|
-
|
|
275
|
-
},
|
|
276
|
-
|
|
277
|
-
},
|
|
278
|
-
|
|
267
|
+
suggestions: x = [],
|
|
268
|
+
showConfidence: d = !0,
|
|
269
|
+
showReasoning: m = !1,
|
|
270
|
+
autoFill: b = !1
|
|
271
|
+
} = p, [f, v] = A(x), [N, n] = A(/* @__PURE__ */ new Set()), [R, E] = A(!1), [t, h] = A(!1), w = (r) => {
|
|
272
|
+
g?.(r), n((I) => new Set(I).add(r.fieldName));
|
|
273
|
+
}, _ = () => {
|
|
274
|
+
f.forEach((r) => g?.(r)), n(new Set(f.map((r) => r.fieldName)));
|
|
275
|
+
}, l = (r) => {
|
|
276
|
+
v((I) => I.filter((q) => q.fieldName !== r));
|
|
277
|
+
}, u = () => {
|
|
278
|
+
h(!0), j && j(), setTimeout(() => h(!1), 1e3);
|
|
279
279
|
};
|
|
280
|
-
if (
|
|
280
|
+
if (R || f.length === 0)
|
|
281
281
|
return null;
|
|
282
|
-
const
|
|
283
|
-
return /* @__PURE__ */ e.jsxs(
|
|
284
|
-
/* @__PURE__ */ e.jsx(
|
|
285
|
-
/* @__PURE__ */ e.jsxs(
|
|
286
|
-
/* @__PURE__ */ e.jsx(
|
|
282
|
+
const k = f.filter((r) => !N.has(r.fieldName)), P = (r) => r >= 0.8 ? "text-green-600" : r >= 0.5 ? "text-yellow-600" : "text-red-600";
|
|
283
|
+
return /* @__PURE__ */ e.jsxs(T, { className: "border-blue-200 bg-blue-50/30", children: [
|
|
284
|
+
/* @__PURE__ */ e.jsx(Y, { className: "pb-2", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
285
|
+
/* @__PURE__ */ e.jsxs($, { className: "text-sm flex items-center gap-2", children: [
|
|
286
|
+
/* @__PURE__ */ e.jsx(M, { className: "h-4 w-4 text-blue-500" }),
|
|
287
287
|
"AI Suggestions",
|
|
288
|
-
/* @__PURE__ */ e.jsxs(
|
|
289
|
-
|
|
288
|
+
/* @__PURE__ */ e.jsxs(O, { variant: "secondary", className: "text-xs", children: [
|
|
289
|
+
k.length,
|
|
290
290
|
" suggestion",
|
|
291
|
-
|
|
291
|
+
k.length !== 1 ? "s" : ""
|
|
292
292
|
] })
|
|
293
293
|
] }),
|
|
294
294
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
@@ -297,18 +297,18 @@ const ke = ({ schema: f }) => {
|
|
|
297
297
|
{
|
|
298
298
|
variant: "ghost",
|
|
299
299
|
size: "sm",
|
|
300
|
-
onClick:
|
|
301
|
-
disabled:
|
|
300
|
+
onClick: u,
|
|
301
|
+
disabled: t,
|
|
302
302
|
className: "h-7",
|
|
303
|
-
children: /* @__PURE__ */ e.jsx(fe, { className: `h-3 w-3 ${
|
|
303
|
+
children: /* @__PURE__ */ e.jsx(fe, { className: `h-3 w-3 ${t ? "animate-spin" : ""}` })
|
|
304
304
|
}
|
|
305
305
|
),
|
|
306
|
-
|
|
306
|
+
k.length > 1 && /* @__PURE__ */ e.jsx(
|
|
307
307
|
y,
|
|
308
308
|
{
|
|
309
309
|
variant: "outline",
|
|
310
310
|
size: "sm",
|
|
311
|
-
onClick:
|
|
311
|
+
onClick: _,
|
|
312
312
|
className: "h-7 text-xs",
|
|
313
313
|
children: "Apply All"
|
|
314
314
|
}
|
|
@@ -318,15 +318,15 @@ const ke = ({ schema: f }) => {
|
|
|
318
318
|
{
|
|
319
319
|
variant: "ghost",
|
|
320
320
|
size: "sm",
|
|
321
|
-
onClick: () =>
|
|
321
|
+
onClick: () => E(!0),
|
|
322
322
|
className: "h-7",
|
|
323
|
-
children: /* @__PURE__ */ e.jsx(
|
|
323
|
+
children: /* @__PURE__ */ e.jsx(H, { className: "h-3 w-3" })
|
|
324
324
|
}
|
|
325
325
|
)
|
|
326
326
|
] })
|
|
327
327
|
] }) }),
|
|
328
|
-
/* @__PURE__ */ e.jsxs(
|
|
329
|
-
|
|
328
|
+
/* @__PURE__ */ e.jsxs(S, { className: "space-y-2 pt-0", children: [
|
|
329
|
+
k.map((r) => /* @__PURE__ */ e.jsxs(
|
|
330
330
|
"div",
|
|
331
331
|
{
|
|
332
332
|
className: "flex items-center gap-3 p-2 rounded-md bg-white border text-sm",
|
|
@@ -334,15 +334,15 @@ const ke = ({ schema: f }) => {
|
|
|
334
334
|
/* @__PURE__ */ e.jsx(he, { className: "h-4 w-4 text-yellow-500 shrink-0" }),
|
|
335
335
|
/* @__PURE__ */ e.jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
336
336
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
337
|
-
/* @__PURE__ */ e.jsx("span", { className: "font-medium", children:
|
|
337
|
+
/* @__PURE__ */ e.jsx("span", { className: "font-medium", children: r.fieldName }),
|
|
338
338
|
/* @__PURE__ */ e.jsx("span", { className: "text-muted-foreground", children: "→" }),
|
|
339
|
-
/* @__PURE__ */ e.jsx("span", { className: "font-mono text-blue-600 truncate", children: typeof
|
|
339
|
+
/* @__PURE__ */ e.jsx("span", { className: "font-mono text-blue-600 truncate", children: typeof r.value == "object" ? JSON.stringify(r.value) : String(r.value) })
|
|
340
340
|
] }),
|
|
341
|
-
|
|
342
|
-
Math.round(
|
|
341
|
+
d && /* @__PURE__ */ e.jsxs("div", { className: `text-xs ${P(r.confidence)}`, children: [
|
|
342
|
+
Math.round(r.confidence * 100),
|
|
343
343
|
"% confidence"
|
|
344
344
|
] }),
|
|
345
|
-
|
|
345
|
+
m && r.reasoning && /* @__PURE__ */ e.jsx("div", { className: "text-xs text-muted-foreground mt-1", children: r.reasoning })
|
|
346
346
|
] }),
|
|
347
347
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
348
348
|
/* @__PURE__ */ e.jsx(
|
|
@@ -351,8 +351,8 @@ const ke = ({ schema: f }) => {
|
|
|
351
351
|
variant: "ghost",
|
|
352
352
|
size: "sm",
|
|
353
353
|
className: "h-7 w-7 p-0 text-green-600 hover:text-green-700 hover:bg-green-50",
|
|
354
|
-
onClick: () =>
|
|
355
|
-
children: /* @__PURE__ */ e.jsx(
|
|
354
|
+
onClick: () => w(r),
|
|
355
|
+
children: /* @__PURE__ */ e.jsx(te, { className: "h-3.5 w-3.5" })
|
|
356
356
|
}
|
|
357
357
|
),
|
|
358
358
|
/* @__PURE__ */ e.jsx(
|
|
@@ -361,216 +361,216 @@ const ke = ({ schema: f }) => {
|
|
|
361
361
|
variant: "ghost",
|
|
362
362
|
size: "sm",
|
|
363
363
|
className: "h-7 w-7 p-0 text-red-500 hover:text-red-700 hover:bg-red-50",
|
|
364
|
-
onClick: () =>
|
|
365
|
-
children: /* @__PURE__ */ e.jsx(
|
|
364
|
+
onClick: () => l(r.fieldName),
|
|
365
|
+
children: /* @__PURE__ */ e.jsx(H, { className: "h-3.5 w-3.5" })
|
|
366
366
|
}
|
|
367
367
|
)
|
|
368
368
|
] })
|
|
369
369
|
]
|
|
370
370
|
},
|
|
371
|
-
|
|
371
|
+
r.fieldName
|
|
372
372
|
)),
|
|
373
|
-
|
|
374
|
-
/* @__PURE__ */ e.jsx(
|
|
375
|
-
|
|
373
|
+
N.size > 0 && /* @__PURE__ */ e.jsxs("div", { className: "text-xs text-green-600 flex items-center gap-1 pt-1", children: [
|
|
374
|
+
/* @__PURE__ */ e.jsx(te, { className: "h-3 w-3" }),
|
|
375
|
+
N.size,
|
|
376
376
|
" suggestion",
|
|
377
|
-
|
|
377
|
+
N.size !== 1 ? "s" : "",
|
|
378
378
|
" applied"
|
|
379
379
|
] })
|
|
380
380
|
] })
|
|
381
381
|
] });
|
|
382
|
-
},
|
|
382
|
+
}, Te = ({ schema: p, onSelect: g, onDismiss: j }) => {
|
|
383
383
|
const {
|
|
384
|
-
recommendations:
|
|
385
|
-
showScores:
|
|
386
|
-
layout:
|
|
387
|
-
loading:
|
|
388
|
-
emptyMessage:
|
|
389
|
-
} =
|
|
390
|
-
|
|
391
|
-
},
|
|
392
|
-
|
|
384
|
+
recommendations: x = [],
|
|
385
|
+
showScores: d = !1,
|
|
386
|
+
layout: m = "list",
|
|
387
|
+
loading: b = !1,
|
|
388
|
+
emptyMessage: f = "No recommendations available"
|
|
389
|
+
} = p, v = (t) => {
|
|
390
|
+
g?.(t);
|
|
391
|
+
}, N = (t) => {
|
|
392
|
+
j?.(t);
|
|
393
393
|
};
|
|
394
|
-
if (
|
|
395
|
-
return /* @__PURE__ */ e.jsx(
|
|
396
|
-
/* @__PURE__ */ e.jsx(
|
|
394
|
+
if (b)
|
|
395
|
+
return /* @__PURE__ */ e.jsx(T, { children: /* @__PURE__ */ e.jsxs(S, { className: "p-8 text-center", children: [
|
|
396
|
+
/* @__PURE__ */ e.jsx(M, { className: "h-8 w-8 text-blue-500 mx-auto mb-3 animate-pulse" }),
|
|
397
397
|
/* @__PURE__ */ e.jsx("p", { className: "text-sm text-muted-foreground", children: "Generating recommendations..." })
|
|
398
398
|
] }) });
|
|
399
|
-
if (
|
|
400
|
-
return /* @__PURE__ */ e.jsx(
|
|
401
|
-
const
|
|
402
|
-
if (!
|
|
403
|
-
const
|
|
404
|
-
return /* @__PURE__ */ e.jsxs(
|
|
405
|
-
|
|
399
|
+
if (x.length === 0)
|
|
400
|
+
return /* @__PURE__ */ e.jsx(T, { children: /* @__PURE__ */ e.jsx(S, { className: "p-8 text-center text-muted-foreground", children: f }) });
|
|
401
|
+
const n = (t) => {
|
|
402
|
+
if (!d) return null;
|
|
403
|
+
const h = Math.round(t * 100), w = t >= 0.7 ? "default" : t >= 0.4 ? "secondary" : "outline";
|
|
404
|
+
return /* @__PURE__ */ e.jsxs(O, { variant: w, className: "text-xs", children: [
|
|
405
|
+
h,
|
|
406
406
|
"%"
|
|
407
407
|
] });
|
|
408
|
-
},
|
|
408
|
+
}, R = (t) => /* @__PURE__ */ e.jsxs(
|
|
409
409
|
"div",
|
|
410
410
|
{
|
|
411
411
|
className: "flex items-start gap-3 p-3 rounded-lg border hover:bg-muted/30 transition-colors cursor-pointer",
|
|
412
|
-
onClick: () =>
|
|
412
|
+
onClick: () => v(t),
|
|
413
413
|
children: [
|
|
414
|
-
/* @__PURE__ */ e.jsx("div", { className: "mt-1 shrink-0", children: /* @__PURE__ */ e.jsx(
|
|
414
|
+
/* @__PURE__ */ e.jsx("div", { className: "mt-1 shrink-0", children: /* @__PURE__ */ e.jsx(ae, { className: "h-4 w-4 text-yellow-500" }) }),
|
|
415
415
|
/* @__PURE__ */ e.jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
416
416
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 mb-1", children: [
|
|
417
|
-
/* @__PURE__ */ e.jsx("span", { className: "font-medium text-sm", children:
|
|
418
|
-
|
|
419
|
-
|
|
417
|
+
/* @__PURE__ */ e.jsx("span", { className: "font-medium text-sm", children: t.title }),
|
|
418
|
+
t.category && /* @__PURE__ */ e.jsx(O, { variant: "outline", className: "text-xs", children: t.category }),
|
|
419
|
+
n(t.score)
|
|
420
420
|
] }),
|
|
421
|
-
|
|
421
|
+
t.description && /* @__PURE__ */ e.jsx("p", { className: "text-xs text-muted-foreground line-clamp-2", children: t.description })
|
|
422
422
|
] }),
|
|
423
423
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
424
|
-
|
|
424
|
+
t.action && /* @__PURE__ */ e.jsx(y, { variant: "ghost", size: "sm", className: "h-7 w-7 p-0", children: /* @__PURE__ */ e.jsx(je, { className: "h-3.5 w-3.5" }) }),
|
|
425
425
|
/* @__PURE__ */ e.jsx(
|
|
426
426
|
y,
|
|
427
427
|
{
|
|
428
428
|
variant: "ghost",
|
|
429
429
|
size: "sm",
|
|
430
430
|
className: "h-7 w-7 p-0 text-muted-foreground",
|
|
431
|
-
onClick: (
|
|
432
|
-
|
|
431
|
+
onClick: (h) => {
|
|
432
|
+
h.stopPropagation(), N(t);
|
|
433
433
|
},
|
|
434
|
-
children: /* @__PURE__ */ e.jsx(
|
|
434
|
+
children: /* @__PURE__ */ e.jsx(H, { className: "h-3.5 w-3.5" })
|
|
435
435
|
}
|
|
436
436
|
)
|
|
437
437
|
] })
|
|
438
438
|
]
|
|
439
439
|
},
|
|
440
|
-
|
|
441
|
-
),
|
|
442
|
-
|
|
440
|
+
t.id
|
|
441
|
+
), E = (t) => /* @__PURE__ */ e.jsx(
|
|
442
|
+
T,
|
|
443
443
|
{
|
|
444
444
|
className: "cursor-pointer hover:shadow-md transition-shadow",
|
|
445
|
-
onClick: () =>
|
|
446
|
-
children: /* @__PURE__ */ e.jsxs(
|
|
445
|
+
onClick: () => v(t),
|
|
446
|
+
children: /* @__PURE__ */ e.jsxs(S, { className: "p-4", children: [
|
|
447
447
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-start justify-between mb-2", children: [
|
|
448
|
-
/* @__PURE__ */ e.jsx(
|
|
449
|
-
|
|
448
|
+
/* @__PURE__ */ e.jsx(ae, { className: "h-4 w-4 text-yellow-500" }),
|
|
449
|
+
n(t.score)
|
|
450
450
|
] }),
|
|
451
|
-
/* @__PURE__ */ e.jsx("h4", { className: "font-medium text-sm mb-1", children:
|
|
452
|
-
|
|
453
|
-
|
|
451
|
+
/* @__PURE__ */ e.jsx("h4", { className: "font-medium text-sm mb-1", children: t.title }),
|
|
452
|
+
t.description && /* @__PURE__ */ e.jsx("p", { className: "text-xs text-muted-foreground line-clamp-3", children: t.description }),
|
|
453
|
+
t.category && /* @__PURE__ */ e.jsx(O, { variant: "outline", className: "text-xs mt-2", children: t.category }),
|
|
454
454
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1 mt-3", children: [
|
|
455
455
|
/* @__PURE__ */ e.jsx(y, { variant: "ghost", size: "sm", className: "h-6 w-6 p-0 text-green-600", children: /* @__PURE__ */ e.jsx(pe, { className: "h-3 w-3" }) }),
|
|
456
456
|
/* @__PURE__ */ e.jsx(y, { variant: "ghost", size: "sm", className: "h-6 w-6 p-0 text-red-500", children: /* @__PURE__ */ e.jsx(ge, { className: "h-3 w-3" }) })
|
|
457
457
|
] })
|
|
458
458
|
] })
|
|
459
459
|
},
|
|
460
|
-
|
|
460
|
+
t.id
|
|
461
461
|
);
|
|
462
|
-
return /* @__PURE__ */ e.jsxs(
|
|
463
|
-
/* @__PURE__ */ e.jsx(
|
|
464
|
-
/* @__PURE__ */ e.jsx(
|
|
462
|
+
return /* @__PURE__ */ e.jsxs(T, { children: [
|
|
463
|
+
/* @__PURE__ */ e.jsx(Y, { children: /* @__PURE__ */ e.jsxs($, { className: "flex items-center gap-2 text-sm", children: [
|
|
464
|
+
/* @__PURE__ */ e.jsx(M, { className: "h-4 w-4 text-blue-500" }),
|
|
465
465
|
"Recommendations",
|
|
466
|
-
/* @__PURE__ */ e.jsx(
|
|
466
|
+
/* @__PURE__ */ e.jsx(O, { variant: "secondary", className: "text-xs", children: x.length })
|
|
467
467
|
] }) }),
|
|
468
|
-
/* @__PURE__ */ e.jsx(
|
|
468
|
+
/* @__PURE__ */ e.jsx(S, { children: m === "grid" ? /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3", children: x.map(E) }) : /* @__PURE__ */ e.jsx("div", { className: "space-y-2", children: x.map(R) }) })
|
|
469
469
|
] });
|
|
470
|
-
},
|
|
470
|
+
}, Se = ({ schema: p, onSubmit: g }) => {
|
|
471
471
|
const {
|
|
472
|
-
placeholder:
|
|
473
|
-
result:
|
|
474
|
-
suggestions:
|
|
475
|
-
showHistory:
|
|
476
|
-
history:
|
|
477
|
-
loading:
|
|
478
|
-
} =
|
|
479
|
-
const
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
query:
|
|
483
|
-
summary: `Results for: "${
|
|
472
|
+
placeholder: j = "Ask a question about your data...",
|
|
473
|
+
result: x,
|
|
474
|
+
suggestions: d = [],
|
|
475
|
+
showHistory: m = !1,
|
|
476
|
+
history: b = [],
|
|
477
|
+
loading: f = !1
|
|
478
|
+
} = p, [v, N] = A(""), [n, R] = A(x), [E, t] = A(!1), h = E || f, w = (l) => {
|
|
479
|
+
const u = l || v;
|
|
480
|
+
u.trim() && (t(!0), g?.(u), g ? t(!1) : setTimeout(() => {
|
|
481
|
+
R({
|
|
482
|
+
query: u,
|
|
483
|
+
summary: `Results for: "${u}"`,
|
|
484
484
|
confidence: 0.85,
|
|
485
485
|
data: [],
|
|
486
486
|
columns: []
|
|
487
|
-
}),
|
|
487
|
+
}), t(!1);
|
|
488
488
|
}, 1e3));
|
|
489
|
-
},
|
|
490
|
-
|
|
489
|
+
}, _ = (l) => {
|
|
490
|
+
N(l), w(l);
|
|
491
491
|
};
|
|
492
492
|
return /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
|
|
493
|
-
/* @__PURE__ */ e.jsx(
|
|
493
|
+
/* @__PURE__ */ e.jsx(T, { children: /* @__PURE__ */ e.jsxs(S, { className: "p-4", children: [
|
|
494
494
|
/* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ e.jsxs("div", { className: "relative flex-1", children: [
|
|
495
495
|
/* @__PURE__ */ e.jsx(be, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" }),
|
|
496
496
|
/* @__PURE__ */ e.jsx(
|
|
497
497
|
xe,
|
|
498
498
|
{
|
|
499
|
-
value:
|
|
500
|
-
onChange: (
|
|
501
|
-
onKeyDown: (
|
|
502
|
-
placeholder:
|
|
499
|
+
value: v,
|
|
500
|
+
onChange: (l) => N(l.target.value),
|
|
501
|
+
onKeyDown: (l) => l.key === "Enter" && w(),
|
|
502
|
+
placeholder: j,
|
|
503
503
|
className: "pl-10 pr-20",
|
|
504
|
-
disabled:
|
|
504
|
+
disabled: h
|
|
505
505
|
}
|
|
506
506
|
),
|
|
507
507
|
/* @__PURE__ */ e.jsx("div", { className: "absolute right-2 top-1/2 -translate-y-1/2", children: /* @__PURE__ */ e.jsx(
|
|
508
508
|
y,
|
|
509
509
|
{
|
|
510
510
|
size: "sm",
|
|
511
|
-
onClick: () =>
|
|
512
|
-
disabled:
|
|
511
|
+
onClick: () => w(),
|
|
512
|
+
disabled: h || !v.trim(),
|
|
513
513
|
className: "h-7",
|
|
514
|
-
children:
|
|
515
|
-
/* @__PURE__ */ e.jsx(
|
|
514
|
+
children: h ? /* @__PURE__ */ e.jsx(Ne, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
515
|
+
/* @__PURE__ */ e.jsx(M, { className: "h-3.5 w-3.5 mr-1" }),
|
|
516
516
|
"Ask"
|
|
517
517
|
] })
|
|
518
518
|
}
|
|
519
519
|
) })
|
|
520
520
|
] }) }),
|
|
521
|
-
|
|
521
|
+
d.length > 0 && !n && /* @__PURE__ */ e.jsx("div", { className: "mt-3 flex flex-wrap gap-2", children: d.map((l, u) => /* @__PURE__ */ e.jsx(
|
|
522
522
|
"button",
|
|
523
523
|
{
|
|
524
|
-
onClick: () =>
|
|
524
|
+
onClick: () => _(l),
|
|
525
525
|
className: "text-xs px-2.5 py-1 rounded-full border bg-muted/30 hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",
|
|
526
|
-
disabled:
|
|
527
|
-
children:
|
|
526
|
+
disabled: h,
|
|
527
|
+
children: l
|
|
528
528
|
},
|
|
529
|
-
|
|
529
|
+
u
|
|
530
530
|
)) })
|
|
531
531
|
] }) }),
|
|
532
|
-
|
|
533
|
-
/* @__PURE__ */ e.jsx(
|
|
534
|
-
/* @__PURE__ */ e.jsxs(
|
|
532
|
+
n && /* @__PURE__ */ e.jsxs(T, { children: [
|
|
533
|
+
/* @__PURE__ */ e.jsx(Y, { className: "pb-2", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
534
|
+
/* @__PURE__ */ e.jsxs($, { className: "text-sm flex items-center gap-2", children: [
|
|
535
535
|
/* @__PURE__ */ e.jsx(ve, { className: "h-4 w-4" }),
|
|
536
536
|
"Results"
|
|
537
537
|
] }),
|
|
538
|
-
|
|
539
|
-
Math.round(
|
|
538
|
+
n.confidence !== void 0 && /* @__PURE__ */ e.jsxs(O, { variant: n.confidence >= 0.7 ? "default" : "secondary", className: "text-xs", children: [
|
|
539
|
+
Math.round(n.confidence * 100),
|
|
540
540
|
"% match"
|
|
541
541
|
] })
|
|
542
542
|
] }) }),
|
|
543
|
-
/* @__PURE__ */ e.jsxs(
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
/* @__PURE__ */ e.jsx("thead", { className: "bg-muted", children: /* @__PURE__ */ e.jsx("tr", { children:
|
|
547
|
-
/* @__PURE__ */ e.jsx("tbody", { children:
|
|
543
|
+
/* @__PURE__ */ e.jsxs(S, { children: [
|
|
544
|
+
n.summary && /* @__PURE__ */ e.jsx("p", { className: "text-sm text-muted-foreground mb-3", children: n.summary }),
|
|
545
|
+
n.data && n.data.length > 0 && n.columns && /* @__PURE__ */ e.jsx("div", { className: "border rounded-lg overflow-hidden", children: /* @__PURE__ */ e.jsxs("table", { className: "w-full text-sm", children: [
|
|
546
|
+
/* @__PURE__ */ e.jsx("thead", { className: "bg-muted", children: /* @__PURE__ */ e.jsx("tr", { children: n.columns.map((l, u) => /* @__PURE__ */ e.jsx("th", { className: "px-4 py-2 text-left font-medium", children: l.label || l.name }, u)) }) }),
|
|
547
|
+
/* @__PURE__ */ e.jsx("tbody", { children: n.data.map((l, u) => /* @__PURE__ */ e.jsx("tr", { className: "border-t", children: n.columns.map((k, P) => /* @__PURE__ */ e.jsx("td", { className: "px-4 py-2", children: l[k.name] }, P)) }, u)) })
|
|
548
548
|
] }) }),
|
|
549
|
-
(!
|
|
549
|
+
(!n.data || n.data.length === 0) && /* @__PURE__ */ e.jsx("div", { className: "text-center py-6 text-muted-foreground text-sm", children: "No matching records found" })
|
|
550
550
|
] })
|
|
551
551
|
] }),
|
|
552
|
-
|
|
553
|
-
/* @__PURE__ */ e.jsx(
|
|
552
|
+
m && b.length > 0 && /* @__PURE__ */ e.jsxs(T, { children: [
|
|
553
|
+
/* @__PURE__ */ e.jsx(Y, { className: "pb-2", children: /* @__PURE__ */ e.jsxs($, { className: "text-xs text-muted-foreground flex items-center gap-1", children: [
|
|
554
554
|
/* @__PURE__ */ e.jsx(ye, { className: "h-3 w-3" }),
|
|
555
555
|
"Recent Queries"
|
|
556
556
|
] }) }),
|
|
557
|
-
/* @__PURE__ */ e.jsx(
|
|
557
|
+
/* @__PURE__ */ e.jsx(S, { className: "space-y-1", children: b.slice(0, 5).map((l, u) => /* @__PURE__ */ e.jsxs(
|
|
558
558
|
"button",
|
|
559
559
|
{
|
|
560
|
-
onClick: () =>
|
|
560
|
+
onClick: () => _(l.query),
|
|
561
561
|
className: "w-full flex items-center gap-2 p-2 rounded-md text-sm text-left hover:bg-muted/50 transition-colors",
|
|
562
562
|
children: [
|
|
563
563
|
/* @__PURE__ */ e.jsx(we, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
|
|
564
|
-
/* @__PURE__ */ e.jsx("span", { className: "truncate", children:
|
|
565
|
-
/* @__PURE__ */ e.jsx("span", { className: "text-xs text-muted-foreground shrink-0 ml-auto", children: new Date(
|
|
564
|
+
/* @__PURE__ */ e.jsx("span", { className: "truncate", children: l.query }),
|
|
565
|
+
/* @__PURE__ */ e.jsx("span", { className: "text-xs text-muted-foreground shrink-0 ml-auto", children: new Date(l.timestamp).toLocaleDateString() })
|
|
566
566
|
]
|
|
567
567
|
},
|
|
568
|
-
|
|
568
|
+
u
|
|
569
569
|
)) })
|
|
570
570
|
] })
|
|
571
571
|
] });
|
|
572
572
|
};
|
|
573
|
-
|
|
573
|
+
Q.register(
|
|
574
574
|
"ai-form-assist",
|
|
575
575
|
ke,
|
|
576
576
|
{
|
|
@@ -587,9 +587,9 @@ J.register(
|
|
|
587
587
|
]
|
|
588
588
|
}
|
|
589
589
|
);
|
|
590
|
-
|
|
590
|
+
Q.register(
|
|
591
591
|
"ai-recommendations",
|
|
592
|
-
|
|
592
|
+
Te,
|
|
593
593
|
{
|
|
594
594
|
label: "AI Recommendations",
|
|
595
595
|
category: "AI",
|
|
@@ -607,9 +607,9 @@ J.register(
|
|
|
607
607
|
]
|
|
608
608
|
}
|
|
609
609
|
);
|
|
610
|
-
|
|
610
|
+
Q.register(
|
|
611
611
|
"nl-query",
|
|
612
|
-
|
|
612
|
+
Se,
|
|
613
613
|
{
|
|
614
614
|
label: "Natural Language Query",
|
|
615
615
|
category: "AI",
|
|
@@ -623,6 +623,6 @@ J.register(
|
|
|
623
623
|
);
|
|
624
624
|
export {
|
|
625
625
|
ke as AIFormAssist,
|
|
626
|
-
|
|
627
|
-
|
|
626
|
+
Te as AIRecommendations,
|
|
627
|
+
Se as NLQueryInput
|
|
628
628
|
};
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(function(b,
|
|
1
|
+
(function(b,A){typeof exports=="object"&&typeof module<"u"?A(exports,require("@object-ui/core"),require("react"),require("@object-ui/components"),require("lucide-react")):typeof define=="function"&&define.amd?define(["exports","@object-ui/core","react","@object-ui/components","lucide-react"],A):(b=typeof globalThis<"u"?globalThis:b||self,A(b.ObjectUIPluginAI={},b.ObjectUICore,b.React,b.ObjectUIComponents,b.lucideReact))})(this,(function(b,A,S,t,c){"use strict";var D={exports:{}},P={};var W;function ae(){if(W)return P;W=1;var p=Symbol.for("react.transitional.element"),N=Symbol.for("react.fragment");function v(h,m,f){var y=null;if(f!==void 0&&(y=""+f),m.key!==void 0&&(y=""+m.key),"key"in m){f={};for(var g in m)g!=="key"&&(f[g]=m[g])}else f=m;return m=f.ref,{$$typeof:p,type:h,key:y,ref:m!==void 0?m:null,props:f}}return P.Fragment=N,P.jsx=v,P.jsxs=v,P}var I={};var G;function re(){return G||(G=1,process.env.NODE_ENV!=="production"&&(function(){function p(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===oe?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case T:return"Fragment";case x:return"Profiler";case i:return"StrictMode";case L:return"Suspense";case Y:return"SuspenseList";case ie:return"Activity"}if(typeof s=="object")switch(typeof s.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),s.$$typeof){case E:return"Portal";case F:return s.displayName||"Context";case R:return(s._context.displayName||"Context")+".Consumer";case n:var r=s.render;return s=s.displayName,s||(s=r.displayName||r.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case le:return r=s.displayName||null,r!==null?r:p(s.type)||"Memo";case B:r=s._payload,s=s._init;try{return p(s(r))}catch{}}return null}function N(s){return""+s}function v(s){try{N(s);var r=!1}catch{r=!0}if(r){r=console;var o=r.error,d=typeof Symbol=="function"&&Symbol.toStringTag&&s[Symbol.toStringTag]||s.constructor.name||"Object";return o.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",d),N(s)}}function h(s){if(s===T)return"<>";if(typeof s=="object"&&s!==null&&s.$$typeof===B)return"<...>";try{var r=p(s);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function m(){var s=M.A;return s===null?null:s.getOwner()}function f(){return Error("react-stack-top-frame")}function y(s){if($.call(s,"key")){var r=Object.getOwnPropertyDescriptor(s,"key").get;if(r&&r.isReactWarning)return!1}return s.key!==void 0}function g(s,r){function o(){Z||(Z=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}o.isReactWarning=!0,Object.defineProperty(s,"key",{get:o,configurable:!0})}function C(){var s=p(this.type);return K[s]||(K[s]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),s=this.props.ref,s!==void 0?s:null}function w(s,r,o,d,z,U){var u=o.ref;return s={$$typeof:j,type:s,key:r,props:o,_owner:d},(u!==void 0?u:null)!==null?Object.defineProperty(s,"ref",{enumerable:!1,get:C}):Object.defineProperty(s,"ref",{enumerable:!1,value:null}),s._store={},Object.defineProperty(s._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(s,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(s,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:z}),Object.defineProperty(s,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:U}),Object.freeze&&(Object.freeze(s.props),Object.freeze(s)),s}function l(s,r,o,d,z,U){var u=r.children;if(u!==void 0)if(d)if(ce(u)){for(d=0;d<u.length;d++)_(u[d]);Object.freeze&&Object.freeze(u)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else _(u);if($.call(r,"key")){u=p(s);var O=Object.keys(r).filter(function(de){return de!=="key"});d=0<O.length?"{key: someKey, "+O.join(": ..., ")+": ...}":"{key: someKey}",te[u+d]||(O=0<O.length?"{"+O.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
2
|
let props = %s;
|
|
3
3
|
<%s {...props} />
|
|
4
4
|
React keys must be passed directly to JSX without using spread:
|
|
5
5
|
let props = %s;
|
|
6
|
-
<%s key={someKey} {...props} />`,m,f,R,f),ee[f+m]=!0)}if(f=null,i!==void 0&&(w(i),f=""+i),v(r)&&(w(r.key),f=""+r.key),"key"in r){i={};for(var V in r)V!=="key"&&(i[V]=r[V])}else i=r;return f&&h(i,typeof s=="function"?s.displayName||s.name||"Unknown":s),c(s,f,i,x(),F,M)}function a(s){y(s)?s._store&&(s._store.validated=1):typeof s=="object"&&s!==null&&s.$$typeof===z&&(s._payload.status==="fulfilled"?y(s._payload.value)&&s._payload.value._store&&(s._payload.value._store.validated=1):s._store&&(s._store.validated=1))}function y(s){return typeof s=="object"&&s!==null&&s.$$typeof===_}var j=E,_=Symbol.for("react.transitional.element"),T=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),P=Symbol.for("react.profiler"),n=Symbol.for("react.consumer"),I=Symbol.for("react.context"),D=Symbol.for("react.forward_ref"),ae=Symbol.for("react.suspense"),ne=Symbol.for("react.suspense_list"),le=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),ie=Symbol.for("react.activity"),oe=Symbol.for("react.client.reference"),Y=j.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q=Object.prototype.hasOwnProperty,ce=Array.isArray,B=console.createTask?console.createTask:function(){return null};j={react_stack_bottom_frame:function(s){return s()}};var X,$={},Z=j.react_stack_bottom_frame.bind(j,d)(),K=B(N(d)),ee={};O.Fragment=l,O.jsx=function(s,r,i){var m=1e4>Y.recentlyCreatedOwnerStacks++;return S(s,r,i,!1,m?Error("react-stack-top-frame"):Z,m?B(N(s)):K)},O.jsxs=function(s,r,i){var m=1e4>Y.recentlyCreatedOwnerStacks++;return S(s,r,i,!0,m?Error("react-stack-top-frame"):Z,m?B(N(s)):K)}})()),O}var W;function re(){return W||(W=1,process.env.NODE_ENV==="production"?L.exports=se():L.exports=te()),L.exports}var e=re();const G=({schema:g})=>{const{suggestions:p=[],showConfidence:w=!0,showReasoning:N=!1,autoFill:x=!1}=g,[d,v]=E.useState(p),[h,C]=E.useState(new Set),[c,S]=E.useState(!1),[a,y]=E.useState(!1),j=n=>{console.log("Apply suggestion:",n),C(I=>new Set(I).add(n.fieldName))},_=()=>{console.log("Apply all suggestions:",d),C(new Set(d.map(n=>n.fieldName)))},T=n=>{v(I=>I.filter(D=>D.fieldName!==n))},l=()=>{y(!0),console.log("Refreshing AI suggestions..."),setTimeout(()=>y(!1),1e3)};if(c||d.length===0)return null;const u=d.filter(n=>!h.has(n.fieldName)),P=n=>n>=.8?"text-green-600":n>=.5?"text-yellow-600":"text-red-600";return e.jsxs(t.Card,{className:"border-blue-200 bg-blue-50/30",children:[e.jsx(t.CardHeader,{className:"pb-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(t.CardTitle,{className:"text-sm flex items-center gap-2",children:[e.jsx(o.Sparkles,{className:"h-4 w-4 text-blue-500"}),"AI Suggestions",e.jsxs(t.Badge,{variant:"secondary",className:"text-xs",children:[u.length," suggestion",u.length!==1?"s":""]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(t.Button,{variant:"ghost",size:"sm",onClick:l,disabled:a,className:"h-7",children:e.jsx(o.RefreshCw,{className:`h-3 w-3 ${a?"animate-spin":""}`})}),u.length>1&&e.jsx(t.Button,{variant:"outline",size:"sm",onClick:_,className:"h-7 text-xs",children:"Apply All"}),e.jsx(t.Button,{variant:"ghost",size:"sm",onClick:()=>S(!0),className:"h-7",children:e.jsx(o.X,{className:"h-3 w-3"})})]})]})}),e.jsxs(t.CardContent,{className:"space-y-2 pt-0",children:[u.map(n=>e.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-md bg-white border text-sm",children:[e.jsx(o.Lightbulb,{className:"h-4 w-4 text-yellow-500 shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:n.fieldName}),e.jsx("span",{className:"text-muted-foreground",children:"→"}),e.jsx("span",{className:"font-mono text-blue-600 truncate",children:typeof n.value=="object"?JSON.stringify(n.value):String(n.value)})]}),w&&e.jsxs("div",{className:`text-xs ${P(n.confidence)}`,children:[Math.round(n.confidence*100),"% confidence"]}),N&&n.reasoning&&e.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:n.reasoning})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx(t.Button,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-green-600 hover:text-green-700 hover:bg-green-50",onClick:()=>j(n),children:e.jsx(o.Check,{className:"h-3.5 w-3.5"})}),e.jsx(t.Button,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-red-500 hover:text-red-700 hover:bg-red-50",onClick:()=>T(n.fieldName),children:e.jsx(o.X,{className:"h-3.5 w-3.5"})})]})]},n.fieldName)),h.size>0&&e.jsxs("div",{className:"text-xs text-green-600 flex items-center gap-1 pt-1",children:[e.jsx(o.Check,{className:"h-3 w-3"}),h.size," suggestion",h.size!==1?"s":""," applied"]})]})]})},H=({schema:g})=>{const{recommendations:p=[],showScores:w=!1,layout:N="list",loading:x=!1,emptyMessage:d="No recommendations available"}=g,v=a=>{console.log("Selected recommendation:",a)},h=a=>{console.log("Dismissed recommendation:",a)};if(x)return e.jsx(t.Card,{children:e.jsxs(t.CardContent,{className:"p-8 text-center",children:[e.jsx(o.Sparkles,{className:"h-8 w-8 text-blue-500 mx-auto mb-3 animate-pulse"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Generating recommendations..."})]})});if(p.length===0)return e.jsx(t.Card,{children:e.jsx(t.CardContent,{className:"p-8 text-center text-muted-foreground",children:d})});const C=a=>{if(!w)return null;const y=Math.round(a*100),j=a>=.7?"default":a>=.4?"secondary":"outline";return e.jsxs(t.Badge,{variant:j,className:"text-xs",children:[y,"%"]})},c=a=>e.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg border hover:bg-muted/30 transition-colors cursor-pointer",onClick:()=>v(a),children:[e.jsx("div",{className:"mt-1 shrink-0",children:e.jsx(o.Star,{className:"h-4 w-4 text-yellow-500"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"font-medium text-sm",children:a.title}),a.category&&e.jsx(t.Badge,{variant:"outline",className:"text-xs",children:a.category}),C(a.score)]}),a.description&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:a.description})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[a.action&&e.jsx(t.Button,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",children:e.jsx(o.ExternalLink,{className:"h-3.5 w-3.5"})}),e.jsx(t.Button,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-muted-foreground",onClick:y=>{y.stopPropagation(),h(a)},children:e.jsx(o.X,{className:"h-3.5 w-3.5"})})]})]},a.id),S=a=>e.jsx(t.Card,{className:"cursor-pointer hover:shadow-md transition-shadow",onClick:()=>v(a),children:e.jsxs(t.CardContent,{className:"p-4",children:[e.jsxs("div",{className:"flex items-start justify-between mb-2",children:[e.jsx(o.Star,{className:"h-4 w-4 text-yellow-500"}),C(a.score)]}),e.jsx("h4",{className:"font-medium text-sm mb-1",children:a.title}),a.description&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-3",children:a.description}),a.category&&e.jsx(t.Badge,{variant:"outline",className:"text-xs mt-2",children:a.category}),e.jsxs("div",{className:"flex items-center gap-1 mt-3",children:[e.jsx(t.Button,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-green-600",children:e.jsx(o.ThumbsUp,{className:"h-3 w-3"})}),e.jsx(t.Button,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-red-500",children:e.jsx(o.ThumbsDown,{className:"h-3 w-3"})})]})]})},a.id);return e.jsxs(t.Card,{children:[e.jsx(t.CardHeader,{children:e.jsxs(t.CardTitle,{className:"flex items-center gap-2 text-sm",children:[e.jsx(o.Sparkles,{className:"h-4 w-4 text-blue-500"}),"Recommendations",e.jsx(t.Badge,{variant:"secondary",className:"text-xs",children:p.length})]})}),e.jsx(t.CardContent,{children:N==="grid"?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:p.map(S)}):e.jsx("div",{className:"space-y-2",children:p.map(c)})})]})},J=({schema:g})=>{const{placeholder:p="Ask a question about your data...",result:w,suggestions:N=[],showHistory:x=!1,history:d=[],loading:v=!1}=g,[h,C]=E.useState(""),[c,S]=E.useState(w),[a,y]=E.useState(!1),j=a||v,_=l=>{const u=l||h;u.trim()&&(y(!0),console.log("NL Query submitted:",u),setTimeout(()=>{S({query:u,summary:`Results for: "${u}"`,confidence:.85,data:[],columns:[]}),y(!1)},1e3))},T=l=>{C(l),_(l)};return e.jsxs("div",{className:"space-y-4",children:[e.jsx(t.Card,{children:e.jsxs(t.CardContent,{className:"p-4",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("div",{className:"relative flex-1",children:[e.jsx(o.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(t.Input,{value:h,onChange:l=>C(l.target.value),onKeyDown:l=>l.key==="Enter"&&_(),placeholder:p,className:"pl-10 pr-20",disabled:j}),e.jsx("div",{className:"absolute right-2 top-1/2 -translate-y-1/2",children:e.jsx(t.Button,{size:"sm",onClick:()=>_(),disabled:j||!h.trim(),className:"h-7",children:j?e.jsx(o.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):e.jsxs(e.Fragment,{children:[e.jsx(o.Sparkles,{className:"h-3.5 w-3.5 mr-1"}),"Ask"]})})})]})}),N.length>0&&!c&&e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:N.map((l,u)=>e.jsx("button",{onClick:()=>T(l),className:"text-xs px-2.5 py-1 rounded-full border bg-muted/30 hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",disabled:j,children:l},u))})]})}),c&&e.jsxs(t.Card,{children:[e.jsx(t.CardHeader,{className:"pb-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(t.CardTitle,{className:"text-sm flex items-center gap-2",children:[e.jsx(o.Table,{className:"h-4 w-4"}),"Results"]}),c.confidence!==void 0&&e.jsxs(t.Badge,{variant:c.confidence>=.7?"default":"secondary",className:"text-xs",children:[Math.round(c.confidence*100),"% match"]})]})}),e.jsxs(t.CardContent,{children:[c.summary&&e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:c.summary}),c.data&&c.data.length>0&&c.columns&&e.jsx("div",{className:"border rounded-lg overflow-hidden",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-muted",children:e.jsx("tr",{children:c.columns.map((l,u)=>e.jsx("th",{className:"px-4 py-2 text-left font-medium",children:l.label||l.name},u))})}),e.jsx("tbody",{children:c.data.map((l,u)=>e.jsx("tr",{className:"border-t",children:c.columns.map((P,n)=>e.jsx("td",{className:"px-4 py-2",children:l[P.name]},n))},u))})]})}),(!c.data||c.data.length===0)&&e.jsx("div",{className:"text-center py-6 text-muted-foreground text-sm",children:"No matching records found"})]})]}),x&&d.length>0&&e.jsxs(t.Card,{children:[e.jsx(t.CardHeader,{className:"pb-2",children:e.jsxs(t.CardTitle,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e.jsx(o.Clock,{className:"h-3 w-3"}),"Recent Queries"]})}),e.jsx(t.CardContent,{className:"space-y-1",children:d.slice(0,5).map((l,u)=>e.jsxs("button",{onClick:()=>T(l.query),className:"w-full flex items-center gap-2 p-2 rounded-md text-sm text-left hover:bg-muted/50 transition-colors",children:[e.jsx(o.ArrowRight,{className:"h-3 w-3 text-muted-foreground shrink-0"}),e.jsx("span",{className:"truncate",children:l.query}),e.jsx("span",{className:"text-xs text-muted-foreground shrink-0 ml-auto",children:new Date(l.timestamp).toLocaleDateString()})]},u))})]})]})};k.ComponentRegistry.register("ai-form-assist",G,{label:"AI Form Assist",category:"AI",inputs:[{name:"formId",type:"string",label:"Form ID"},{name:"objectName",type:"string",label:"Object Name"},{name:"fields",type:"array",label:"Fields to suggest"},{name:"suggestions",type:"code",label:"Suggestions Data"},{name:"autoFill",type:"boolean",label:"Auto Fill",defaultValue:!1},{name:"showConfidence",type:"boolean",label:"Show Confidence",defaultValue:!0},{name:"showReasoning",type:"boolean",label:"Show Reasoning",defaultValue:!1}]}),k.ComponentRegistry.register("ai-recommendations",H,{label:"AI Recommendations",category:"AI",inputs:[{name:"objectName",type:"string",label:"Object Name"},{name:"recommendations",type:"code",label:"Recommendations Data"},{name:"maxResults",type:"number",label:"Max Results",defaultValue:10},{name:"showScores",type:"boolean",label:"Show Scores",defaultValue:!1},{name:"layout",type:"enum",label:"Layout",enum:[{label:"List",value:"list"},{label:"Grid",value:"grid"},{label:"Carousel",value:"carousel"}],defaultValue:"list"},{name:"emptyMessage",type:"string",label:"Empty Message"}]}),k.ComponentRegistry.register("nl-query",J,{label:"Natural Language Query",category:"AI",inputs:[{name:"objectName",type:"string",label:"Object Name"},{name:"placeholder",type:"string",label:"Placeholder Text"},{name:"suggestions",type:"array",label:"Example Queries"},{name:"showHistory",type:"boolean",label:"Show History",defaultValue:!1}]}),b.AIFormAssist=G,b.AIRecommendations=H,b.NLQueryInput=J,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})}));
|
|
6
|
+
<%s key={someKey} {...props} />`,d,u,O,u),te[u+d]=!0)}if(u=null,o!==void 0&&(v(o),u=""+o),y(r)&&(v(r.key),u=""+r.key),"key"in r){o={};for(var q in r)q!=="key"&&(o[q]=r[q])}else o=r;return u&&g(o,typeof s=="function"?s.displayName||s.name||"Unknown":s),w(s,u,o,m(),z,U)}function _(s){k(s)?s._store&&(s._store.validated=1):typeof s=="object"&&s!==null&&s.$$typeof===B&&(s._payload.status==="fulfilled"?k(s._payload.value)&&s._payload.value._store&&(s._payload.value._store.validated=1):s._store&&(s._store.validated=1))}function k(s){return typeof s=="object"&&s!==null&&s.$$typeof===j}var a=S,j=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),x=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),F=Symbol.for("react.context"),n=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),Y=Symbol.for("react.suspense_list"),le=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),ie=Symbol.for("react.activity"),oe=Symbol.for("react.client.reference"),M=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=Object.prototype.hasOwnProperty,ce=Array.isArray,V=console.createTask?console.createTask:function(){return null};a={react_stack_bottom_frame:function(s){return s()}};var Z,K={},ee=a.react_stack_bottom_frame.bind(a,f)(),se=V(h(f)),te={};I.Fragment=T,I.jsx=function(s,r,o){var d=1e4>M.recentlyCreatedOwnerStacks++;return l(s,r,o,!1,d?Error("react-stack-top-frame"):ee,d?V(h(s)):se)},I.jsxs=function(s,r,o){var d=1e4>M.recentlyCreatedOwnerStacks++;return l(s,r,o,!0,d?Error("react-stack-top-frame"):ee,d?V(h(s)):se)}})()),I}var H;function ne(){return H||(H=1,process.env.NODE_ENV==="production"?D.exports=ae():D.exports=re()),D.exports}var e=ne();const J=({schema:p,onApply:N,onRefresh:v})=>{const{suggestions:h=[],showConfidence:m=!0,showReasoning:f=!1,autoFill:y=!1}=p,[g,C]=S.useState(h),[w,l]=S.useState(new Set),[_,k]=S.useState(!1),[a,j]=S.useState(!1),E=n=>{N?.(n),l(L=>new Set(L).add(n.fieldName))},T=()=>{g.forEach(n=>N?.(n)),l(new Set(g.map(n=>n.fieldName)))},i=n=>{C(L=>L.filter(Y=>Y.fieldName!==n))},x=()=>{j(!0),v&&v(),setTimeout(()=>j(!1),1e3)};if(_||g.length===0)return null;const R=g.filter(n=>!w.has(n.fieldName)),F=n=>n>=.8?"text-green-600":n>=.5?"text-yellow-600":"text-red-600";return e.jsxs(t.Card,{className:"border-blue-200 bg-blue-50/30",children:[e.jsx(t.CardHeader,{className:"pb-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(t.CardTitle,{className:"text-sm flex items-center gap-2",children:[e.jsx(c.Sparkles,{className:"h-4 w-4 text-blue-500"}),"AI Suggestions",e.jsxs(t.Badge,{variant:"secondary",className:"text-xs",children:[R.length," suggestion",R.length!==1?"s":""]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(t.Button,{variant:"ghost",size:"sm",onClick:x,disabled:a,className:"h-7",children:e.jsx(c.RefreshCw,{className:`h-3 w-3 ${a?"animate-spin":""}`})}),R.length>1&&e.jsx(t.Button,{variant:"outline",size:"sm",onClick:T,className:"h-7 text-xs",children:"Apply All"}),e.jsx(t.Button,{variant:"ghost",size:"sm",onClick:()=>k(!0),className:"h-7",children:e.jsx(c.X,{className:"h-3 w-3"})})]})]})}),e.jsxs(t.CardContent,{className:"space-y-2 pt-0",children:[R.map(n=>e.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-md bg-white border text-sm",children:[e.jsx(c.Lightbulb,{className:"h-4 w-4 text-yellow-500 shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:n.fieldName}),e.jsx("span",{className:"text-muted-foreground",children:"→"}),e.jsx("span",{className:"font-mono text-blue-600 truncate",children:typeof n.value=="object"?JSON.stringify(n.value):String(n.value)})]}),m&&e.jsxs("div",{className:`text-xs ${F(n.confidence)}`,children:[Math.round(n.confidence*100),"% confidence"]}),f&&n.reasoning&&e.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:n.reasoning})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx(t.Button,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-green-600 hover:text-green-700 hover:bg-green-50",onClick:()=>E(n),children:e.jsx(c.Check,{className:"h-3.5 w-3.5"})}),e.jsx(t.Button,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-red-500 hover:text-red-700 hover:bg-red-50",onClick:()=>i(n.fieldName),children:e.jsx(c.X,{className:"h-3.5 w-3.5"})})]})]},n.fieldName)),w.size>0&&e.jsxs("div",{className:"text-xs text-green-600 flex items-center gap-1 pt-1",children:[e.jsx(c.Check,{className:"h-3 w-3"}),w.size," suggestion",w.size!==1?"s":""," applied"]})]})]})},X=({schema:p,onSelect:N,onDismiss:v})=>{const{recommendations:h=[],showScores:m=!1,layout:f="list",loading:y=!1,emptyMessage:g="No recommendations available"}=p,C=a=>{N?.(a)},w=a=>{v?.(a)};if(y)return e.jsx(t.Card,{children:e.jsxs(t.CardContent,{className:"p-8 text-center",children:[e.jsx(c.Sparkles,{className:"h-8 w-8 text-blue-500 mx-auto mb-3 animate-pulse"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Generating recommendations..."})]})});if(h.length===0)return e.jsx(t.Card,{children:e.jsx(t.CardContent,{className:"p-8 text-center text-muted-foreground",children:g})});const l=a=>{if(!m)return null;const j=Math.round(a*100),E=a>=.7?"default":a>=.4?"secondary":"outline";return e.jsxs(t.Badge,{variant:E,className:"text-xs",children:[j,"%"]})},_=a=>e.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg border hover:bg-muted/30 transition-colors cursor-pointer",onClick:()=>C(a),children:[e.jsx("div",{className:"mt-1 shrink-0",children:e.jsx(c.Star,{className:"h-4 w-4 text-yellow-500"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"font-medium text-sm",children:a.title}),a.category&&e.jsx(t.Badge,{variant:"outline",className:"text-xs",children:a.category}),l(a.score)]}),a.description&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:a.description})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[a.action&&e.jsx(t.Button,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",children:e.jsx(c.ExternalLink,{className:"h-3.5 w-3.5"})}),e.jsx(t.Button,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-muted-foreground",onClick:j=>{j.stopPropagation(),w(a)},children:e.jsx(c.X,{className:"h-3.5 w-3.5"})})]})]},a.id),k=a=>e.jsx(t.Card,{className:"cursor-pointer hover:shadow-md transition-shadow",onClick:()=>C(a),children:e.jsxs(t.CardContent,{className:"p-4",children:[e.jsxs("div",{className:"flex items-start justify-between mb-2",children:[e.jsx(c.Star,{className:"h-4 w-4 text-yellow-500"}),l(a.score)]}),e.jsx("h4",{className:"font-medium text-sm mb-1",children:a.title}),a.description&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-3",children:a.description}),a.category&&e.jsx(t.Badge,{variant:"outline",className:"text-xs mt-2",children:a.category}),e.jsxs("div",{className:"flex items-center gap-1 mt-3",children:[e.jsx(t.Button,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-green-600",children:e.jsx(c.ThumbsUp,{className:"h-3 w-3"})}),e.jsx(t.Button,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-red-500",children:e.jsx(c.ThumbsDown,{className:"h-3 w-3"})})]})]})},a.id);return e.jsxs(t.Card,{children:[e.jsx(t.CardHeader,{children:e.jsxs(t.CardTitle,{className:"flex items-center gap-2 text-sm",children:[e.jsx(c.Sparkles,{className:"h-4 w-4 text-blue-500"}),"Recommendations",e.jsx(t.Badge,{variant:"secondary",className:"text-xs",children:h.length})]})}),e.jsx(t.CardContent,{children:f==="grid"?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:h.map(k)}):e.jsx("div",{className:"space-y-2",children:h.map(_)})})]})},Q=({schema:p,onSubmit:N})=>{const{placeholder:v="Ask a question about your data...",result:h,suggestions:m=[],showHistory:f=!1,history:y=[],loading:g=!1}=p,[C,w]=S.useState(""),[l,_]=S.useState(h),[k,a]=S.useState(!1),j=k||g,E=i=>{const x=i||C;x.trim()&&(a(!0),N?.(x),N?a(!1):setTimeout(()=>{_({query:x,summary:`Results for: "${x}"`,confidence:.85,data:[],columns:[]}),a(!1)},1e3))},T=i=>{w(i),E(i)};return e.jsxs("div",{className:"space-y-4",children:[e.jsx(t.Card,{children:e.jsxs(t.CardContent,{className:"p-4",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("div",{className:"relative flex-1",children:[e.jsx(c.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(t.Input,{value:C,onChange:i=>w(i.target.value),onKeyDown:i=>i.key==="Enter"&&E(),placeholder:v,className:"pl-10 pr-20",disabled:j}),e.jsx("div",{className:"absolute right-2 top-1/2 -translate-y-1/2",children:e.jsx(t.Button,{size:"sm",onClick:()=>E(),disabled:j||!C.trim(),className:"h-7",children:j?e.jsx(c.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):e.jsxs(e.Fragment,{children:[e.jsx(c.Sparkles,{className:"h-3.5 w-3.5 mr-1"}),"Ask"]})})})]})}),m.length>0&&!l&&e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:m.map((i,x)=>e.jsx("button",{onClick:()=>T(i),className:"text-xs px-2.5 py-1 rounded-full border bg-muted/30 hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",disabled:j,children:i},x))})]})}),l&&e.jsxs(t.Card,{children:[e.jsx(t.CardHeader,{className:"pb-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(t.CardTitle,{className:"text-sm flex items-center gap-2",children:[e.jsx(c.Table,{className:"h-4 w-4"}),"Results"]}),l.confidence!==void 0&&e.jsxs(t.Badge,{variant:l.confidence>=.7?"default":"secondary",className:"text-xs",children:[Math.round(l.confidence*100),"% match"]})]})}),e.jsxs(t.CardContent,{children:[l.summary&&e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:l.summary}),l.data&&l.data.length>0&&l.columns&&e.jsx("div",{className:"border rounded-lg overflow-hidden",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-muted",children:e.jsx("tr",{children:l.columns.map((i,x)=>e.jsx("th",{className:"px-4 py-2 text-left font-medium",children:i.label||i.name},x))})}),e.jsx("tbody",{children:l.data.map((i,x)=>e.jsx("tr",{className:"border-t",children:l.columns.map((R,F)=>e.jsx("td",{className:"px-4 py-2",children:i[R.name]},F))},x))})]})}),(!l.data||l.data.length===0)&&e.jsx("div",{className:"text-center py-6 text-muted-foreground text-sm",children:"No matching records found"})]})]}),f&&y.length>0&&e.jsxs(t.Card,{children:[e.jsx(t.CardHeader,{className:"pb-2",children:e.jsxs(t.CardTitle,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e.jsx(c.Clock,{className:"h-3 w-3"}),"Recent Queries"]})}),e.jsx(t.CardContent,{className:"space-y-1",children:y.slice(0,5).map((i,x)=>e.jsxs("button",{onClick:()=>T(i.query),className:"w-full flex items-center gap-2 p-2 rounded-md text-sm text-left hover:bg-muted/50 transition-colors",children:[e.jsx(c.ArrowRight,{className:"h-3 w-3 text-muted-foreground shrink-0"}),e.jsx("span",{className:"truncate",children:i.query}),e.jsx("span",{className:"text-xs text-muted-foreground shrink-0 ml-auto",children:new Date(i.timestamp).toLocaleDateString()})]},x))})]})]})};A.ComponentRegistry.register("ai-form-assist",J,{label:"AI Form Assist",category:"AI",inputs:[{name:"formId",type:"string",label:"Form ID"},{name:"objectName",type:"string",label:"Object Name"},{name:"fields",type:"array",label:"Fields to suggest"},{name:"suggestions",type:"code",label:"Suggestions Data"},{name:"autoFill",type:"boolean",label:"Auto Fill",defaultValue:!1},{name:"showConfidence",type:"boolean",label:"Show Confidence",defaultValue:!0},{name:"showReasoning",type:"boolean",label:"Show Reasoning",defaultValue:!1}]}),A.ComponentRegistry.register("ai-recommendations",X,{label:"AI Recommendations",category:"AI",inputs:[{name:"objectName",type:"string",label:"Object Name"},{name:"recommendations",type:"code",label:"Recommendations Data"},{name:"maxResults",type:"number",label:"Max Results",defaultValue:10},{name:"showScores",type:"boolean",label:"Show Scores",defaultValue:!1},{name:"layout",type:"enum",label:"Layout",enum:[{label:"List",value:"list"},{label:"Grid",value:"grid"},{label:"Carousel",value:"carousel"}],defaultValue:"list"},{name:"emptyMessage",type:"string",label:"Empty Message"}]}),A.ComponentRegistry.register("nl-query",Q,{label:"Natural Language Query",category:"AI",inputs:[{name:"objectName",type:"string",label:"Object Name"},{name:"placeholder",type:"string",label:"Placeholder Text"},{name:"suggestions",type:"array",label:"Example Queries"},{name:"showHistory",type:"boolean",label:"Show History",defaultValue:!1}]}),b.AIFormAssist=J,b.AIRecommendations=X,b.NLQueryInput=Q,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { AIFormAssistSchema } from '../../types/src';
|
|
2
|
+
import { AIFormAssistSchema, AIFieldSuggestion } from '../../types/src';
|
|
3
3
|
export interface AIFormAssistProps {
|
|
4
4
|
schema: AIFormAssistSchema;
|
|
5
|
+
/** Callback when a suggestion is applied */
|
|
6
|
+
onApply?: (suggestion: AIFieldSuggestion) => void;
|
|
7
|
+
/** Callback when suggestions are refreshed */
|
|
8
|
+
onRefresh?: () => void;
|
|
5
9
|
}
|
|
6
10
|
/**
|
|
7
11
|
* AIFormAssist - AI-powered form filling assistant
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AIFormAssist.d.ts","sourceRoot":"","sources":["../../src/AIFormAssist.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,KAAK,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"AIFormAssist.d.ts","sourceRoot":"","sources":["../../src/AIFormAssist.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAG9E,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,4CAA4C;IAC5C,OAAO,CAAC,EAAE,CAAC,UAAU,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAClD,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA0JpD,CAAC"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { AIRecommendationsSchema } from '../../types/src';
|
|
2
|
+
import { AIRecommendationsSchema, AIRecommendationItem } from '../../types/src';
|
|
3
3
|
export interface AIRecommendationsProps {
|
|
4
4
|
schema: AIRecommendationsSchema;
|
|
5
|
+
/** Callback when a recommendation is selected */
|
|
6
|
+
onSelect?: (item: AIRecommendationItem) => void;
|
|
7
|
+
/** Callback when a recommendation is dismissed */
|
|
8
|
+
onDismiss?: (item: AIRecommendationItem) => void;
|
|
5
9
|
}
|
|
6
10
|
/**
|
|
7
11
|
* AIRecommendations - AI-powered recommendation component
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AIRecommendations.d.ts","sourceRoot":"","sources":["../../src/AIRecommendations.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,uBAAuB,
|
|
1
|
+
{"version":3,"file":"AIRecommendations.d.ts","sourceRoot":"","sources":["../../src/AIRecommendations.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAGtF,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,uBAAuB,CAAC;IAChC,iDAAiD;IACjD,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAChD,kDAAkD;IAClD,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,oBAAoB,KAAK,IAAI,CAAC;CAClD;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAwI9D,CAAC"}
|
|
@@ -2,6 +2,8 @@ import { default as React } from 'react';
|
|
|
2
2
|
import { NLQuerySchema } from '../../types/src';
|
|
3
3
|
export interface NLQueryInputProps {
|
|
4
4
|
schema: NLQuerySchema;
|
|
5
|
+
/** Callback when a query is submitted */
|
|
6
|
+
onSubmit?: (query: string) => void;
|
|
5
7
|
}
|
|
6
8
|
/**
|
|
7
9
|
* NLQueryInput - Natural language query interface
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NLQueryInput.d.ts","sourceRoot":"","sources":["../../src/NLQueryInput.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,KAAK,EAAE,aAAa,EAAiB,MAAM,kBAAkB,CAAC;AAGrE,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"NLQueryInput.d.ts","sourceRoot":"","sources":["../../src/NLQueryInput.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,KAAK,EAAE,aAAa,EAAiB,MAAM,kBAAkB,CAAC;AAGrE,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,aAAa,CAAC;IACtB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;AAED;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA0LpD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@object-ui/plugin-ai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.umd.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"react": "^18.0.0 || ^19.0.0",
|
|
20
20
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
21
|
-
"@object-ui/core": "0.
|
|
22
|
-
"@object-ui/types": "0.
|
|
23
|
-
"@object-ui/components": "0.
|
|
24
|
-
"@object-ui/react": "0.
|
|
21
|
+
"@object-ui/core": "2.0.0",
|
|
22
|
+
"@object-ui/types": "2.0.0",
|
|
23
|
+
"@object-ui/components": "2.0.0",
|
|
24
|
+
"@object-ui/react": "2.0.0"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"clsx": "^2.1.0",
|