@object-ui/plugin-ai 0.1.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/LICENSE +21 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +628 -0
- package/dist/index.umd.cjs +6 -0
- package/dist/src/AIFormAssist.d.ts +11 -0
- package/dist/src/AIFormAssist.d.ts.map +1 -0
- package/dist/src/AIRecommendations.d.ts +11 -0
- package/dist/src/AIRecommendations.d.ts.map +1 -0
- package/dist/src/NLQueryInput.d.ts +11 -0
- package/dist/src/NLQueryInput.d.ts.map +1 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.d.ts.map +1 -0
- package/package.json +46 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 ObjectQL
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,628 @@
|
|
|
1
|
+
import { ComponentRegistry as J } from "@object-ui/core";
|
|
2
|
+
import ue, { useState as k } from "react";
|
|
3
|
+
import { Card as E, CardHeader as F, CardTitle as z, Badge as A, Button as y, CardContent as _, Input as xe } from "@object-ui/components";
|
|
4
|
+
import { Sparkles as Y, RefreshCw as fe, X as G, Lightbulb as he, Check as ee, Star as se, 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 D = { exports: {} }, P = {};
|
|
6
|
+
var te;
|
|
7
|
+
function Re() {
|
|
8
|
+
if (te) return P;
|
|
9
|
+
te = 1;
|
|
10
|
+
var f = /* @__PURE__ */ Symbol.for("react.transitional.element"), h = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
11
|
+
function N(g, u, i) {
|
|
12
|
+
var j = null;
|
|
13
|
+
if (i !== void 0 && (j = "" + i), u.key !== void 0 && (j = "" + u.key), "key" in u) {
|
|
14
|
+
i = {};
|
|
15
|
+
for (var x in u)
|
|
16
|
+
x !== "key" && (i[x] = u[x]);
|
|
17
|
+
} else i = u;
|
|
18
|
+
return u = i.ref, {
|
|
19
|
+
$$typeof: f,
|
|
20
|
+
type: g,
|
|
21
|
+
key: j,
|
|
22
|
+
ref: u !== void 0 ? u : null,
|
|
23
|
+
props: i
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
return P.Fragment = h, P.jsx = N, P.jsxs = N, P;
|
|
27
|
+
}
|
|
28
|
+
var I = {};
|
|
29
|
+
var re;
|
|
30
|
+
function Ee() {
|
|
31
|
+
return re || (re = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
32
|
+
function f(s) {
|
|
33
|
+
if (s == null) return null;
|
|
34
|
+
if (typeof s == "function")
|
|
35
|
+
return s.$$typeof === ce ? null : s.displayName || s.name || null;
|
|
36
|
+
if (typeof s == "string") return s;
|
|
37
|
+
switch (s) {
|
|
38
|
+
case n:
|
|
39
|
+
return "Fragment";
|
|
40
|
+
case C:
|
|
41
|
+
return "Profiler";
|
|
42
|
+
case c:
|
|
43
|
+
return "StrictMode";
|
|
44
|
+
case ne:
|
|
45
|
+
return "Suspense";
|
|
46
|
+
case le:
|
|
47
|
+
return "SuspenseList";
|
|
48
|
+
case ie:
|
|
49
|
+
return "Activity";
|
|
50
|
+
}
|
|
51
|
+
if (typeof s == "object")
|
|
52
|
+
switch (typeof s.tag == "number" && console.error(
|
|
53
|
+
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
54
|
+
), s.$$typeof) {
|
|
55
|
+
case S:
|
|
56
|
+
return "Portal";
|
|
57
|
+
case O:
|
|
58
|
+
return s.displayName || "Context";
|
|
59
|
+
case a:
|
|
60
|
+
return (s._context.displayName || "Context") + ".Consumer";
|
|
61
|
+
case $:
|
|
62
|
+
var t = s.render;
|
|
63
|
+
return s = s.displayName, s || (s = t.displayName || t.name || "", s = s !== "" ? "ForwardRef(" + s + ")" : "ForwardRef"), s;
|
|
64
|
+
case oe:
|
|
65
|
+
return t = s.displayName || null, t !== null ? t : f(s.type) || "Memo";
|
|
66
|
+
case M:
|
|
67
|
+
t = s._payload, s = s._init;
|
|
68
|
+
try {
|
|
69
|
+
return f(s(t));
|
|
70
|
+
} catch {
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
function h(s) {
|
|
76
|
+
return "" + s;
|
|
77
|
+
}
|
|
78
|
+
function N(s) {
|
|
79
|
+
try {
|
|
80
|
+
h(s);
|
|
81
|
+
var t = !1;
|
|
82
|
+
} catch {
|
|
83
|
+
t = !0;
|
|
84
|
+
}
|
|
85
|
+
if (t) {
|
|
86
|
+
t = console;
|
|
87
|
+
var l = t.error, d = typeof Symbol == "function" && Symbol.toStringTag && s[Symbol.toStringTag] || s.constructor.name || "Object";
|
|
88
|
+
return l.call(
|
|
89
|
+
t,
|
|
90
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
91
|
+
d
|
|
92
|
+
), h(s);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function g(s) {
|
|
96
|
+
if (s === n) return "<>";
|
|
97
|
+
if (typeof s == "object" && s !== null && s.$$typeof === M)
|
|
98
|
+
return "<...>";
|
|
99
|
+
try {
|
|
100
|
+
var t = f(s);
|
|
101
|
+
return t ? "<" + t + ">" : "<...>";
|
|
102
|
+
} catch {
|
|
103
|
+
return "<...>";
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function u() {
|
|
107
|
+
var s = q.A;
|
|
108
|
+
return s === null ? null : s.getOwner();
|
|
109
|
+
}
|
|
110
|
+
function i() {
|
|
111
|
+
return Error("react-stack-top-frame");
|
|
112
|
+
}
|
|
113
|
+
function j(s) {
|
|
114
|
+
if (Q.call(s, "key")) {
|
|
115
|
+
var t = Object.getOwnPropertyDescriptor(s, "key").get;
|
|
116
|
+
if (t && t.isReactWarning) return !1;
|
|
117
|
+
}
|
|
118
|
+
return s.key !== void 0;
|
|
119
|
+
}
|
|
120
|
+
function x(s, t) {
|
|
121
|
+
function l() {
|
|
122
|
+
H || (H = !0, console.error(
|
|
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
|
+
t
|
|
125
|
+
));
|
|
126
|
+
}
|
|
127
|
+
l.isReactWarning = !0, Object.defineProperty(s, "key", {
|
|
128
|
+
get: l,
|
|
129
|
+
configurable: !0
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
function v() {
|
|
133
|
+
var s = f(this.type);
|
|
134
|
+
return X[s] || (X[s] = !0, console.error(
|
|
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
|
+
)), s = this.props.ref, s !== void 0 ? s : null;
|
|
137
|
+
}
|
|
138
|
+
function o(s, t, l, d, L, U) {
|
|
139
|
+
var m = l.ref;
|
|
140
|
+
return s = {
|
|
141
|
+
$$typeof: R,
|
|
142
|
+
type: s,
|
|
143
|
+
key: t,
|
|
144
|
+
props: l,
|
|
145
|
+
_owner: d
|
|
146
|
+
}, (m !== void 0 ? m : null) !== null ? Object.defineProperty(s, "ref", {
|
|
147
|
+
enumerable: !1,
|
|
148
|
+
get: v
|
|
149
|
+
}) : Object.defineProperty(s, "ref", { enumerable: !1, value: null }), s._store = {}, Object.defineProperty(s._store, "validated", {
|
|
150
|
+
configurable: !1,
|
|
151
|
+
enumerable: !1,
|
|
152
|
+
writable: !0,
|
|
153
|
+
value: 0
|
|
154
|
+
}), Object.defineProperty(s, "_debugInfo", {
|
|
155
|
+
configurable: !1,
|
|
156
|
+
enumerable: !1,
|
|
157
|
+
writable: !0,
|
|
158
|
+
value: null
|
|
159
|
+
}), Object.defineProperty(s, "_debugStack", {
|
|
160
|
+
configurable: !1,
|
|
161
|
+
enumerable: !1,
|
|
162
|
+
writable: !0,
|
|
163
|
+
value: L
|
|
164
|
+
}), Object.defineProperty(s, "_debugTask", {
|
|
165
|
+
configurable: !1,
|
|
166
|
+
enumerable: !1,
|
|
167
|
+
writable: !0,
|
|
168
|
+
value: U
|
|
169
|
+
}), Object.freeze && (Object.freeze(s.props), Object.freeze(s)), s;
|
|
170
|
+
}
|
|
171
|
+
function w(s, t, l, d, L, U) {
|
|
172
|
+
var m = t.children;
|
|
173
|
+
if (m !== void 0)
|
|
174
|
+
if (d)
|
|
175
|
+
if (de(m)) {
|
|
176
|
+
for (d = 0; d < m.length; d++)
|
|
177
|
+
r(m[d]);
|
|
178
|
+
Object.freeze && Object.freeze(m);
|
|
179
|
+
} else
|
|
180
|
+
console.error(
|
|
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
|
+
);
|
|
183
|
+
else r(m);
|
|
184
|
+
if (Q.call(t, "key")) {
|
|
185
|
+
m = f(s);
|
|
186
|
+
var T = Object.keys(t).filter(function(me) {
|
|
187
|
+
return me !== "key";
|
|
188
|
+
});
|
|
189
|
+
d = 0 < T.length ? "{key: someKey, " + T.join(": ..., ") + ": ...}" : "{key: someKey}", K[m + d] || (T = 0 < T.length ? "{" + T.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
190
|
+
`A props object containing a "key" prop is being spread into JSX:
|
|
191
|
+
let props = %s;
|
|
192
|
+
<%s {...props} />
|
|
193
|
+
React keys must be passed directly to JSX without using spread:
|
|
194
|
+
let props = %s;
|
|
195
|
+
<%s key={someKey} {...props} />`,
|
|
196
|
+
d,
|
|
197
|
+
m,
|
|
198
|
+
T,
|
|
199
|
+
m
|
|
200
|
+
), K[m + d] = !0);
|
|
201
|
+
}
|
|
202
|
+
if (m = null, l !== void 0 && (N(l), m = "" + l), j(t) && (N(t.key), m = "" + t.key), "key" in t) {
|
|
203
|
+
l = {};
|
|
204
|
+
for (var W in t)
|
|
205
|
+
W !== "key" && (l[W] = t[W]);
|
|
206
|
+
} else l = t;
|
|
207
|
+
return m && x(
|
|
208
|
+
l,
|
|
209
|
+
typeof s == "function" ? s.displayName || s.name || "Unknown" : s
|
|
210
|
+
), o(
|
|
211
|
+
s,
|
|
212
|
+
m,
|
|
213
|
+
l,
|
|
214
|
+
u(),
|
|
215
|
+
L,
|
|
216
|
+
U
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
function r(s) {
|
|
220
|
+
b(s) ? s._store && (s._store.validated = 1) : typeof s == "object" && s !== null && s.$$typeof === M && (s._payload.status === "fulfilled" ? b(s._payload.value) && s._payload.value._store && (s._payload.value._store.validated = 1) : s._store && (s._store.validated = 1));
|
|
221
|
+
}
|
|
222
|
+
function b(s) {
|
|
223
|
+
return typeof s == "object" && s !== null && s.$$typeof === R;
|
|
224
|
+
}
|
|
225
|
+
var p = ue, R = /* @__PURE__ */ Symbol.for("react.transitional.element"), S = /* @__PURE__ */ Symbol.for("react.portal"), n = /* @__PURE__ */ Symbol.for("react.fragment"), c = /* @__PURE__ */ Symbol.for("react.strict_mode"), C = /* @__PURE__ */ Symbol.for("react.profiler"), a = /* @__PURE__ */ Symbol.for("react.consumer"), O = /* @__PURE__ */ Symbol.for("react.context"), $ = /* @__PURE__ */ Symbol.for("react.forward_ref"), ne = /* @__PURE__ */ Symbol.for("react.suspense"), le = /* @__PURE__ */ Symbol.for("react.suspense_list"), oe = /* @__PURE__ */ Symbol.for("react.memo"), M = /* @__PURE__ */ Symbol.for("react.lazy"), ie = /* @__PURE__ */ Symbol.for("react.activity"), ce = /* @__PURE__ */ Symbol.for("react.client.reference"), q = p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Q = Object.prototype.hasOwnProperty, de = Array.isArray, V = console.createTask ? console.createTask : function() {
|
|
226
|
+
return null;
|
|
227
|
+
};
|
|
228
|
+
p = {
|
|
229
|
+
react_stack_bottom_frame: function(s) {
|
|
230
|
+
return s();
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
var H, X = {}, B = p.react_stack_bottom_frame.bind(
|
|
234
|
+
p,
|
|
235
|
+
i
|
|
236
|
+
)(), Z = V(g(i)), K = {};
|
|
237
|
+
I.Fragment = n, I.jsx = function(s, t, l) {
|
|
238
|
+
var d = 1e4 > q.recentlyCreatedOwnerStacks++;
|
|
239
|
+
return w(
|
|
240
|
+
s,
|
|
241
|
+
t,
|
|
242
|
+
l,
|
|
243
|
+
!1,
|
|
244
|
+
d ? Error("react-stack-top-frame") : B,
|
|
245
|
+
d ? V(g(s)) : Z
|
|
246
|
+
);
|
|
247
|
+
}, I.jsxs = function(s, t, l) {
|
|
248
|
+
var d = 1e4 > q.recentlyCreatedOwnerStacks++;
|
|
249
|
+
return w(
|
|
250
|
+
s,
|
|
251
|
+
t,
|
|
252
|
+
l,
|
|
253
|
+
!0,
|
|
254
|
+
d ? Error("react-stack-top-frame") : B,
|
|
255
|
+
d ? V(g(s)) : Z
|
|
256
|
+
);
|
|
257
|
+
};
|
|
258
|
+
})()), I;
|
|
259
|
+
}
|
|
260
|
+
var ae;
|
|
261
|
+
function _e() {
|
|
262
|
+
return ae || (ae = 1, process.env.NODE_ENV === "production" ? D.exports = Re() : D.exports = Ee()), D.exports;
|
|
263
|
+
}
|
|
264
|
+
var e = _e();
|
|
265
|
+
const ke = ({ schema: f }) => {
|
|
266
|
+
const {
|
|
267
|
+
suggestions: h = [],
|
|
268
|
+
showConfidence: N = !0,
|
|
269
|
+
showReasoning: g = !1,
|
|
270
|
+
autoFill: u = !1
|
|
271
|
+
} = f, [i, j] = k(h), [x, v] = k(/* @__PURE__ */ new Set()), [o, w] = k(!1), [r, b] = k(!1), p = (a) => {
|
|
272
|
+
console.log("Apply suggestion:", a), v((O) => new Set(O).add(a.fieldName));
|
|
273
|
+
}, R = () => {
|
|
274
|
+
console.log("Apply all suggestions:", i), v(new Set(i.map((a) => a.fieldName)));
|
|
275
|
+
}, S = (a) => {
|
|
276
|
+
j((O) => O.filter(($) => $.fieldName !== a));
|
|
277
|
+
}, n = () => {
|
|
278
|
+
b(!0), console.log("Refreshing AI suggestions..."), setTimeout(() => b(!1), 1e3);
|
|
279
|
+
};
|
|
280
|
+
if (o || i.length === 0)
|
|
281
|
+
return null;
|
|
282
|
+
const c = i.filter((a) => !x.has(a.fieldName)), C = (a) => a >= 0.8 ? "text-green-600" : a >= 0.5 ? "text-yellow-600" : "text-red-600";
|
|
283
|
+
return /* @__PURE__ */ e.jsxs(E, { className: "border-blue-200 bg-blue-50/30", children: [
|
|
284
|
+
/* @__PURE__ */ e.jsx(F, { className: "pb-2", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
285
|
+
/* @__PURE__ */ e.jsxs(z, { className: "text-sm flex items-center gap-2", children: [
|
|
286
|
+
/* @__PURE__ */ e.jsx(Y, { className: "h-4 w-4 text-blue-500" }),
|
|
287
|
+
"AI Suggestions",
|
|
288
|
+
/* @__PURE__ */ e.jsxs(A, { variant: "secondary", className: "text-xs", children: [
|
|
289
|
+
c.length,
|
|
290
|
+
" suggestion",
|
|
291
|
+
c.length !== 1 ? "s" : ""
|
|
292
|
+
] })
|
|
293
|
+
] }),
|
|
294
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
295
|
+
/* @__PURE__ */ e.jsx(
|
|
296
|
+
y,
|
|
297
|
+
{
|
|
298
|
+
variant: "ghost",
|
|
299
|
+
size: "sm",
|
|
300
|
+
onClick: n,
|
|
301
|
+
disabled: r,
|
|
302
|
+
className: "h-7",
|
|
303
|
+
children: /* @__PURE__ */ e.jsx(fe, { className: `h-3 w-3 ${r ? "animate-spin" : ""}` })
|
|
304
|
+
}
|
|
305
|
+
),
|
|
306
|
+
c.length > 1 && /* @__PURE__ */ e.jsx(
|
|
307
|
+
y,
|
|
308
|
+
{
|
|
309
|
+
variant: "outline",
|
|
310
|
+
size: "sm",
|
|
311
|
+
onClick: R,
|
|
312
|
+
className: "h-7 text-xs",
|
|
313
|
+
children: "Apply All"
|
|
314
|
+
}
|
|
315
|
+
),
|
|
316
|
+
/* @__PURE__ */ e.jsx(
|
|
317
|
+
y,
|
|
318
|
+
{
|
|
319
|
+
variant: "ghost",
|
|
320
|
+
size: "sm",
|
|
321
|
+
onClick: () => w(!0),
|
|
322
|
+
className: "h-7",
|
|
323
|
+
children: /* @__PURE__ */ e.jsx(G, { className: "h-3 w-3" })
|
|
324
|
+
}
|
|
325
|
+
)
|
|
326
|
+
] })
|
|
327
|
+
] }) }),
|
|
328
|
+
/* @__PURE__ */ e.jsxs(_, { className: "space-y-2 pt-0", children: [
|
|
329
|
+
c.map((a) => /* @__PURE__ */ e.jsxs(
|
|
330
|
+
"div",
|
|
331
|
+
{
|
|
332
|
+
className: "flex items-center gap-3 p-2 rounded-md bg-white border text-sm",
|
|
333
|
+
children: [
|
|
334
|
+
/* @__PURE__ */ e.jsx(he, { className: "h-4 w-4 text-yellow-500 shrink-0" }),
|
|
335
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
336
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
337
|
+
/* @__PURE__ */ e.jsx("span", { className: "font-medium", children: a.fieldName }),
|
|
338
|
+
/* @__PURE__ */ e.jsx("span", { className: "text-muted-foreground", children: "→" }),
|
|
339
|
+
/* @__PURE__ */ e.jsx("span", { className: "font-mono text-blue-600 truncate", children: typeof a.value == "object" ? JSON.stringify(a.value) : String(a.value) })
|
|
340
|
+
] }),
|
|
341
|
+
N && /* @__PURE__ */ e.jsxs("div", { className: `text-xs ${C(a.confidence)}`, children: [
|
|
342
|
+
Math.round(a.confidence * 100),
|
|
343
|
+
"% confidence"
|
|
344
|
+
] }),
|
|
345
|
+
g && a.reasoning && /* @__PURE__ */ e.jsx("div", { className: "text-xs text-muted-foreground mt-1", children: a.reasoning })
|
|
346
|
+
] }),
|
|
347
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
348
|
+
/* @__PURE__ */ e.jsx(
|
|
349
|
+
y,
|
|
350
|
+
{
|
|
351
|
+
variant: "ghost",
|
|
352
|
+
size: "sm",
|
|
353
|
+
className: "h-7 w-7 p-0 text-green-600 hover:text-green-700 hover:bg-green-50",
|
|
354
|
+
onClick: () => p(a),
|
|
355
|
+
children: /* @__PURE__ */ e.jsx(ee, { className: "h-3.5 w-3.5" })
|
|
356
|
+
}
|
|
357
|
+
),
|
|
358
|
+
/* @__PURE__ */ e.jsx(
|
|
359
|
+
y,
|
|
360
|
+
{
|
|
361
|
+
variant: "ghost",
|
|
362
|
+
size: "sm",
|
|
363
|
+
className: "h-7 w-7 p-0 text-red-500 hover:text-red-700 hover:bg-red-50",
|
|
364
|
+
onClick: () => S(a.fieldName),
|
|
365
|
+
children: /* @__PURE__ */ e.jsx(G, { className: "h-3.5 w-3.5" })
|
|
366
|
+
}
|
|
367
|
+
)
|
|
368
|
+
] })
|
|
369
|
+
]
|
|
370
|
+
},
|
|
371
|
+
a.fieldName
|
|
372
|
+
)),
|
|
373
|
+
x.size > 0 && /* @__PURE__ */ e.jsxs("div", { className: "text-xs text-green-600 flex items-center gap-1 pt-1", children: [
|
|
374
|
+
/* @__PURE__ */ e.jsx(ee, { className: "h-3 w-3" }),
|
|
375
|
+
x.size,
|
|
376
|
+
" suggestion",
|
|
377
|
+
x.size !== 1 ? "s" : "",
|
|
378
|
+
" applied"
|
|
379
|
+
] })
|
|
380
|
+
] })
|
|
381
|
+
] });
|
|
382
|
+
}, Se = ({ schema: f }) => {
|
|
383
|
+
const {
|
|
384
|
+
recommendations: h = [],
|
|
385
|
+
showScores: N = !1,
|
|
386
|
+
layout: g = "list",
|
|
387
|
+
loading: u = !1,
|
|
388
|
+
emptyMessage: i = "No recommendations available"
|
|
389
|
+
} = f, j = (r) => {
|
|
390
|
+
console.log("Selected recommendation:", r);
|
|
391
|
+
}, x = (r) => {
|
|
392
|
+
console.log("Dismissed recommendation:", r);
|
|
393
|
+
};
|
|
394
|
+
if (u)
|
|
395
|
+
return /* @__PURE__ */ e.jsx(E, { children: /* @__PURE__ */ e.jsxs(_, { className: "p-8 text-center", children: [
|
|
396
|
+
/* @__PURE__ */ e.jsx(Y, { className: "h-8 w-8 text-blue-500 mx-auto mb-3 animate-pulse" }),
|
|
397
|
+
/* @__PURE__ */ e.jsx("p", { className: "text-sm text-muted-foreground", children: "Generating recommendations..." })
|
|
398
|
+
] }) });
|
|
399
|
+
if (h.length === 0)
|
|
400
|
+
return /* @__PURE__ */ e.jsx(E, { children: /* @__PURE__ */ e.jsx(_, { className: "p-8 text-center text-muted-foreground", children: i }) });
|
|
401
|
+
const v = (r) => {
|
|
402
|
+
if (!N) return null;
|
|
403
|
+
const b = Math.round(r * 100), p = r >= 0.7 ? "default" : r >= 0.4 ? "secondary" : "outline";
|
|
404
|
+
return /* @__PURE__ */ e.jsxs(A, { variant: p, className: "text-xs", children: [
|
|
405
|
+
b,
|
|
406
|
+
"%"
|
|
407
|
+
] });
|
|
408
|
+
}, o = (r) => /* @__PURE__ */ e.jsxs(
|
|
409
|
+
"div",
|
|
410
|
+
{
|
|
411
|
+
className: "flex items-start gap-3 p-3 rounded-lg border hover:bg-muted/30 transition-colors cursor-pointer",
|
|
412
|
+
onClick: () => j(r),
|
|
413
|
+
children: [
|
|
414
|
+
/* @__PURE__ */ e.jsx("div", { className: "mt-1 shrink-0", children: /* @__PURE__ */ e.jsx(se, { className: "h-4 w-4 text-yellow-500" }) }),
|
|
415
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
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: r.title }),
|
|
418
|
+
r.category && /* @__PURE__ */ e.jsx(A, { variant: "outline", className: "text-xs", children: r.category }),
|
|
419
|
+
v(r.score)
|
|
420
|
+
] }),
|
|
421
|
+
r.description && /* @__PURE__ */ e.jsx("p", { className: "text-xs text-muted-foreground line-clamp-2", children: r.description })
|
|
422
|
+
] }),
|
|
423
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
424
|
+
r.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
|
+
/* @__PURE__ */ e.jsx(
|
|
426
|
+
y,
|
|
427
|
+
{
|
|
428
|
+
variant: "ghost",
|
|
429
|
+
size: "sm",
|
|
430
|
+
className: "h-7 w-7 p-0 text-muted-foreground",
|
|
431
|
+
onClick: (b) => {
|
|
432
|
+
b.stopPropagation(), x(r);
|
|
433
|
+
},
|
|
434
|
+
children: /* @__PURE__ */ e.jsx(G, { className: "h-3.5 w-3.5" })
|
|
435
|
+
}
|
|
436
|
+
)
|
|
437
|
+
] })
|
|
438
|
+
]
|
|
439
|
+
},
|
|
440
|
+
r.id
|
|
441
|
+
), w = (r) => /* @__PURE__ */ e.jsx(
|
|
442
|
+
E,
|
|
443
|
+
{
|
|
444
|
+
className: "cursor-pointer hover:shadow-md transition-shadow",
|
|
445
|
+
onClick: () => j(r),
|
|
446
|
+
children: /* @__PURE__ */ e.jsxs(_, { className: "p-4", children: [
|
|
447
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex items-start justify-between mb-2", children: [
|
|
448
|
+
/* @__PURE__ */ e.jsx(se, { className: "h-4 w-4 text-yellow-500" }),
|
|
449
|
+
v(r.score)
|
|
450
|
+
] }),
|
|
451
|
+
/* @__PURE__ */ e.jsx("h4", { className: "font-medium text-sm mb-1", children: r.title }),
|
|
452
|
+
r.description && /* @__PURE__ */ e.jsx("p", { className: "text-xs text-muted-foreground line-clamp-3", children: r.description }),
|
|
453
|
+
r.category && /* @__PURE__ */ e.jsx(A, { variant: "outline", className: "text-xs mt-2", children: r.category }),
|
|
454
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1 mt-3", children: [
|
|
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
|
+
/* @__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
|
+
] })
|
|
458
|
+
] })
|
|
459
|
+
},
|
|
460
|
+
r.id
|
|
461
|
+
);
|
|
462
|
+
return /* @__PURE__ */ e.jsxs(E, { children: [
|
|
463
|
+
/* @__PURE__ */ e.jsx(F, { children: /* @__PURE__ */ e.jsxs(z, { className: "flex items-center gap-2 text-sm", children: [
|
|
464
|
+
/* @__PURE__ */ e.jsx(Y, { className: "h-4 w-4 text-blue-500" }),
|
|
465
|
+
"Recommendations",
|
|
466
|
+
/* @__PURE__ */ e.jsx(A, { variant: "secondary", className: "text-xs", children: h.length })
|
|
467
|
+
] }) }),
|
|
468
|
+
/* @__PURE__ */ e.jsx(_, { children: g === "grid" ? /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3", children: h.map(w) }) : /* @__PURE__ */ e.jsx("div", { className: "space-y-2", children: h.map(o) }) })
|
|
469
|
+
] });
|
|
470
|
+
}, Te = ({ schema: f }) => {
|
|
471
|
+
const {
|
|
472
|
+
placeholder: h = "Ask a question about your data...",
|
|
473
|
+
result: N,
|
|
474
|
+
suggestions: g = [],
|
|
475
|
+
showHistory: u = !1,
|
|
476
|
+
history: i = [],
|
|
477
|
+
loading: j = !1
|
|
478
|
+
} = f, [x, v] = k(""), [o, w] = k(N), [r, b] = k(!1), p = r || j, R = (n) => {
|
|
479
|
+
const c = n || x;
|
|
480
|
+
c.trim() && (b(!0), console.log("NL Query submitted:", c), setTimeout(() => {
|
|
481
|
+
w({
|
|
482
|
+
query: c,
|
|
483
|
+
summary: `Results for: "${c}"`,
|
|
484
|
+
confidence: 0.85,
|
|
485
|
+
data: [],
|
|
486
|
+
columns: []
|
|
487
|
+
}), b(!1);
|
|
488
|
+
}, 1e3));
|
|
489
|
+
}, S = (n) => {
|
|
490
|
+
v(n), R(n);
|
|
491
|
+
};
|
|
492
|
+
return /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
|
|
493
|
+
/* @__PURE__ */ e.jsx(E, { children: /* @__PURE__ */ e.jsxs(_, { className: "p-4", children: [
|
|
494
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ e.jsxs("div", { className: "relative flex-1", children: [
|
|
495
|
+
/* @__PURE__ */ e.jsx(be, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" }),
|
|
496
|
+
/* @__PURE__ */ e.jsx(
|
|
497
|
+
xe,
|
|
498
|
+
{
|
|
499
|
+
value: x,
|
|
500
|
+
onChange: (n) => v(n.target.value),
|
|
501
|
+
onKeyDown: (n) => n.key === "Enter" && R(),
|
|
502
|
+
placeholder: h,
|
|
503
|
+
className: "pl-10 pr-20",
|
|
504
|
+
disabled: p
|
|
505
|
+
}
|
|
506
|
+
),
|
|
507
|
+
/* @__PURE__ */ e.jsx("div", { className: "absolute right-2 top-1/2 -translate-y-1/2", children: /* @__PURE__ */ e.jsx(
|
|
508
|
+
y,
|
|
509
|
+
{
|
|
510
|
+
size: "sm",
|
|
511
|
+
onClick: () => R(),
|
|
512
|
+
disabled: p || !x.trim(),
|
|
513
|
+
className: "h-7",
|
|
514
|
+
children: p ? /* @__PURE__ */ e.jsx(Ne, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
515
|
+
/* @__PURE__ */ e.jsx(Y, { className: "h-3.5 w-3.5 mr-1" }),
|
|
516
|
+
"Ask"
|
|
517
|
+
] })
|
|
518
|
+
}
|
|
519
|
+
) })
|
|
520
|
+
] }) }),
|
|
521
|
+
g.length > 0 && !o && /* @__PURE__ */ e.jsx("div", { className: "mt-3 flex flex-wrap gap-2", children: g.map((n, c) => /* @__PURE__ */ e.jsx(
|
|
522
|
+
"button",
|
|
523
|
+
{
|
|
524
|
+
onClick: () => S(n),
|
|
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: p,
|
|
527
|
+
children: n
|
|
528
|
+
},
|
|
529
|
+
c
|
|
530
|
+
)) })
|
|
531
|
+
] }) }),
|
|
532
|
+
o && /* @__PURE__ */ e.jsxs(E, { children: [
|
|
533
|
+
/* @__PURE__ */ e.jsx(F, { className: "pb-2", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
534
|
+
/* @__PURE__ */ e.jsxs(z, { className: "text-sm flex items-center gap-2", children: [
|
|
535
|
+
/* @__PURE__ */ e.jsx(ve, { className: "h-4 w-4" }),
|
|
536
|
+
"Results"
|
|
537
|
+
] }),
|
|
538
|
+
o.confidence !== void 0 && /* @__PURE__ */ e.jsxs(A, { variant: o.confidence >= 0.7 ? "default" : "secondary", className: "text-xs", children: [
|
|
539
|
+
Math.round(o.confidence * 100),
|
|
540
|
+
"% match"
|
|
541
|
+
] })
|
|
542
|
+
] }) }),
|
|
543
|
+
/* @__PURE__ */ e.jsxs(_, { children: [
|
|
544
|
+
o.summary && /* @__PURE__ */ e.jsx("p", { className: "text-sm text-muted-foreground mb-3", children: o.summary }),
|
|
545
|
+
o.data && o.data.length > 0 && o.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: o.columns.map((n, c) => /* @__PURE__ */ e.jsx("th", { className: "px-4 py-2 text-left font-medium", children: n.label || n.name }, c)) }) }),
|
|
547
|
+
/* @__PURE__ */ e.jsx("tbody", { children: o.data.map((n, c) => /* @__PURE__ */ e.jsx("tr", { className: "border-t", children: o.columns.map((C, a) => /* @__PURE__ */ e.jsx("td", { className: "px-4 py-2", children: n[C.name] }, a)) }, c)) })
|
|
548
|
+
] }) }),
|
|
549
|
+
(!o.data || o.data.length === 0) && /* @__PURE__ */ e.jsx("div", { className: "text-center py-6 text-muted-foreground text-sm", children: "No matching records found" })
|
|
550
|
+
] })
|
|
551
|
+
] }),
|
|
552
|
+
u && i.length > 0 && /* @__PURE__ */ e.jsxs(E, { children: [
|
|
553
|
+
/* @__PURE__ */ e.jsx(F, { className: "pb-2", children: /* @__PURE__ */ e.jsxs(z, { className: "text-xs text-muted-foreground flex items-center gap-1", children: [
|
|
554
|
+
/* @__PURE__ */ e.jsx(ye, { className: "h-3 w-3" }),
|
|
555
|
+
"Recent Queries"
|
|
556
|
+
] }) }),
|
|
557
|
+
/* @__PURE__ */ e.jsx(_, { className: "space-y-1", children: i.slice(0, 5).map((n, c) => /* @__PURE__ */ e.jsxs(
|
|
558
|
+
"button",
|
|
559
|
+
{
|
|
560
|
+
onClick: () => S(n.query),
|
|
561
|
+
className: "w-full flex items-center gap-2 p-2 rounded-md text-sm text-left hover:bg-muted/50 transition-colors",
|
|
562
|
+
children: [
|
|
563
|
+
/* @__PURE__ */ e.jsx(we, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
|
|
564
|
+
/* @__PURE__ */ e.jsx("span", { className: "truncate", children: n.query }),
|
|
565
|
+
/* @__PURE__ */ e.jsx("span", { className: "text-xs text-muted-foreground shrink-0 ml-auto", children: new Date(n.timestamp).toLocaleDateString() })
|
|
566
|
+
]
|
|
567
|
+
},
|
|
568
|
+
c
|
|
569
|
+
)) })
|
|
570
|
+
] })
|
|
571
|
+
] });
|
|
572
|
+
};
|
|
573
|
+
J.register(
|
|
574
|
+
"ai-form-assist",
|
|
575
|
+
ke,
|
|
576
|
+
{
|
|
577
|
+
label: "AI Form Assist",
|
|
578
|
+
category: "AI",
|
|
579
|
+
inputs: [
|
|
580
|
+
{ name: "formId", type: "string", label: "Form ID" },
|
|
581
|
+
{ name: "objectName", type: "string", label: "Object Name" },
|
|
582
|
+
{ name: "fields", type: "array", label: "Fields to suggest" },
|
|
583
|
+
{ name: "suggestions", type: "code", label: "Suggestions Data" },
|
|
584
|
+
{ name: "autoFill", type: "boolean", label: "Auto Fill", defaultValue: !1 },
|
|
585
|
+
{ name: "showConfidence", type: "boolean", label: "Show Confidence", defaultValue: !0 },
|
|
586
|
+
{ name: "showReasoning", type: "boolean", label: "Show Reasoning", defaultValue: !1 }
|
|
587
|
+
]
|
|
588
|
+
}
|
|
589
|
+
);
|
|
590
|
+
J.register(
|
|
591
|
+
"ai-recommendations",
|
|
592
|
+
Se,
|
|
593
|
+
{
|
|
594
|
+
label: "AI Recommendations",
|
|
595
|
+
category: "AI",
|
|
596
|
+
inputs: [
|
|
597
|
+
{ name: "objectName", type: "string", label: "Object Name" },
|
|
598
|
+
{ name: "recommendations", type: "code", label: "Recommendations Data" },
|
|
599
|
+
{ name: "maxResults", type: "number", label: "Max Results", defaultValue: 10 },
|
|
600
|
+
{ name: "showScores", type: "boolean", label: "Show Scores", defaultValue: !1 },
|
|
601
|
+
{ name: "layout", type: "enum", label: "Layout", enum: [
|
|
602
|
+
{ label: "List", value: "list" },
|
|
603
|
+
{ label: "Grid", value: "grid" },
|
|
604
|
+
{ label: "Carousel", value: "carousel" }
|
|
605
|
+
], defaultValue: "list" },
|
|
606
|
+
{ name: "emptyMessage", type: "string", label: "Empty Message" }
|
|
607
|
+
]
|
|
608
|
+
}
|
|
609
|
+
);
|
|
610
|
+
J.register(
|
|
611
|
+
"nl-query",
|
|
612
|
+
Te,
|
|
613
|
+
{
|
|
614
|
+
label: "Natural Language Query",
|
|
615
|
+
category: "AI",
|
|
616
|
+
inputs: [
|
|
617
|
+
{ name: "objectName", type: "string", label: "Object Name" },
|
|
618
|
+
{ name: "placeholder", type: "string", label: "Placeholder Text" },
|
|
619
|
+
{ name: "suggestions", type: "array", label: "Example Queries" },
|
|
620
|
+
{ name: "showHistory", type: "boolean", label: "Show History", defaultValue: !1 }
|
|
621
|
+
]
|
|
622
|
+
}
|
|
623
|
+
);
|
|
624
|
+
export {
|
|
625
|
+
ke as AIFormAssist,
|
|
626
|
+
Se as AIRecommendations,
|
|
627
|
+
Te as NLQueryInput
|
|
628
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
(function(b,k){typeof exports=="object"&&typeof module<"u"?k(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"],k):(b=typeof globalThis<"u"?globalThis:b||self,k(b.ObjectUIPluginAI={},b.ObjectUICore,b.React,b.ObjectUIComponents,b.lucideReact))})(this,(function(b,k,E,t,o){"use strict";var L={exports:{}},A={};var U;function se(){if(U)return A;U=1;var g=Symbol.for("react.transitional.element"),p=Symbol.for("react.fragment");function w(N,x,d){var v=null;if(d!==void 0&&(v=""+d),x.key!==void 0&&(v=""+x.key),"key"in x){d={};for(var h in x)h!=="key"&&(d[h]=x[h])}else d=x;return x=d.ref,{$$typeof:g,type:N,key:v,ref:x!==void 0?x:null,props:d}}return A.Fragment=p,A.jsx=w,A.jsxs=w,A}var O={};var q;function te(){return q||(q=1,process.env.NODE_ENV!=="production"&&(function(){function g(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 l:return"Fragment";case P:return"Profiler";case u:return"StrictMode";case ae:return"Suspense";case ne: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 T:return"Portal";case I:return s.displayName||"Context";case n:return(s._context.displayName||"Context")+".Consumer";case D: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:g(s.type)||"Memo";case z:r=s._payload,s=s._init;try{return g(s(r))}catch{}}return null}function p(s){return""+s}function w(s){try{p(s);var r=!1}catch{r=!0}if(r){r=console;var i=r.error,m=typeof Symbol=="function"&&Symbol.toStringTag&&s[Symbol.toStringTag]||s.constructor.name||"Object";return i.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",m),p(s)}}function N(s){if(s===l)return"<>";if(typeof s=="object"&&s!==null&&s.$$typeof===z)return"<...>";try{var r=g(s);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function x(){var s=Y.A;return s===null?null:s.getOwner()}function d(){return Error("react-stack-top-frame")}function v(s){if(Q.call(s,"key")){var r=Object.getOwnPropertyDescriptor(s,"key").get;if(r&&r.isReactWarning)return!1}return s.key!==void 0}function h(s,r){function i(){X||(X=!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))}i.isReactWarning=!0,Object.defineProperty(s,"key",{get:i,configurable:!0})}function C(){var s=g(this.type);return $[s]||($[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 c(s,r,i,m,F,M){var f=i.ref;return s={$$typeof:_,type:s,key:r,props:i,_owner:m},(f!==void 0?f: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:F}),Object.defineProperty(s,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:M}),Object.freeze&&(Object.freeze(s.props),Object.freeze(s)),s}function S(s,r,i,m,F,M){var f=r.children;if(f!==void 0)if(m)if(ce(f)){for(m=0;m<f.length;m++)a(f[m]);Object.freeze&&Object.freeze(f)}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 a(f);if(Q.call(r,"key")){f=g(s);var R=Object.keys(r).filter(function(de){return de!=="key"});m=0<R.length?"{key: someKey, "+R.join(": ..., ")+": ...}":"{key: someKey}",ee[f+m]||(R=0<R.length?"{"+R.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
|
+
let props = %s;
|
|
3
|
+
<%s {...props} />
|
|
4
|
+
React keys must be passed directly to JSX without using spread:
|
|
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"})}));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { AIFormAssistSchema } from '../../types/src';
|
|
3
|
+
export interface AIFormAssistProps {
|
|
4
|
+
schema: AIFormAssistSchema;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* AIFormAssist - AI-powered form filling assistant
|
|
8
|
+
* Provides intelligent field suggestions based on context and historical data.
|
|
9
|
+
*/
|
|
10
|
+
export declare const AIFormAssist: React.FC<AIFormAssistProps>;
|
|
11
|
+
//# sourceMappingURL=AIFormAssist.d.ts.map
|
|
@@ -0,0 +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,EAAqB,MAAM,kBAAkB,CAAC;AAG9E,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,kBAAkB,CAAC;CAC5B;AAED;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAyJpD,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { AIRecommendationsSchema } from '../../types/src';
|
|
3
|
+
export interface AIRecommendationsProps {
|
|
4
|
+
schema: AIRecommendationsSchema;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* AIRecommendations - AI-powered recommendation component
|
|
8
|
+
* Displays intelligent recommendations based on context and user behavior.
|
|
9
|
+
*/
|
|
10
|
+
export declare const AIRecommendations: React.FC<AIRecommendationsProps>;
|
|
11
|
+
//# sourceMappingURL=AIRecommendations.d.ts.map
|
|
@@ -0,0 +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,EAAwB,MAAM,kBAAkB,CAAC;AAGtF,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,uBAAuB,CAAC;CACjC;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAwI9D,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { NLQuerySchema } from '../../types/src';
|
|
3
|
+
export interface NLQueryInputProps {
|
|
4
|
+
schema: NLQuerySchema;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* NLQueryInput - Natural language query interface
|
|
8
|
+
* Allows users to query data using natural language, with AI-powered parsing.
|
|
9
|
+
*/
|
|
10
|
+
export declare const NLQueryInput: React.FC<NLQueryInputProps>;
|
|
11
|
+
//# sourceMappingURL=NLQueryInput.d.ts.map
|
|
@@ -0,0 +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;CACvB;AAED;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAsLpD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@object-ui/plugin-ai",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/index.umd.cjs",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"require": "./dist/index.umd.cjs"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
20
|
+
"react-dom": "^18.0.0 || ^19.0.0",
|
|
21
|
+
"@object-ui/core": "0.5.0",
|
|
22
|
+
"@object-ui/types": "0.5.0",
|
|
23
|
+
"@object-ui/components": "0.5.0",
|
|
24
|
+
"@object-ui/react": "0.5.0"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"clsx": "^2.1.0",
|
|
28
|
+
"lucide-react": "^0.344.0",
|
|
29
|
+
"tailwind-merge": "^2.2.1"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@types/node": "^25.2.2",
|
|
33
|
+
"@types/react": "^19.2.13",
|
|
34
|
+
"@types/react-dom": "^19.2.3",
|
|
35
|
+
"@vitejs/plugin-react": "^5.1.3",
|
|
36
|
+
"vite": "^7.3.1",
|
|
37
|
+
"vite-plugin-dts": "^4.5.4",
|
|
38
|
+
"vitest": "^4.0.18"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "vite build",
|
|
42
|
+
"clean": "rm -rf dist",
|
|
43
|
+
"test": "vitest run",
|
|
44
|
+
"lint": "eslint ."
|
|
45
|
+
}
|
|
46
|
+
}
|