@object-ui/plugin-ai 17.1.0 → 17.3.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/CHANGELOG.md +70 -0
- package/dist/index.umd.cjs +1 -1
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,75 @@
|
|
|
1
1
|
# @object-ui/plugin-ai
|
|
2
2
|
|
|
3
|
+
## 17.3.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [18cd432]
|
|
8
|
+
- Updated dependencies [532cf8b]
|
|
9
|
+
- Updated dependencies [680080a]
|
|
10
|
+
- Updated dependencies [a7651e6]
|
|
11
|
+
- Updated dependencies [d915c47]
|
|
12
|
+
- Updated dependencies [b71fc92]
|
|
13
|
+
- Updated dependencies [34595eb]
|
|
14
|
+
- Updated dependencies [3889ffb]
|
|
15
|
+
- Updated dependencies [5781fb1]
|
|
16
|
+
- Updated dependencies [9e9e9a9]
|
|
17
|
+
- Updated dependencies [56409c2]
|
|
18
|
+
- Updated dependencies [042e09d]
|
|
19
|
+
- Updated dependencies [9cbcbf4]
|
|
20
|
+
- Updated dependencies [85c4c9c]
|
|
21
|
+
- Updated dependencies [fd54c3e]
|
|
22
|
+
- Updated dependencies [4eeb932]
|
|
23
|
+
- Updated dependencies [23018cc]
|
|
24
|
+
- Updated dependencies [53811d1]
|
|
25
|
+
- Updated dependencies [d915c47]
|
|
26
|
+
- Updated dependencies [f44d872]
|
|
27
|
+
- Updated dependencies [509104a]
|
|
28
|
+
- Updated dependencies [825bbe3]
|
|
29
|
+
- Updated dependencies [5dd0127]
|
|
30
|
+
- Updated dependencies [06632e9]
|
|
31
|
+
- Updated dependencies [a4cff5b]
|
|
32
|
+
- Updated dependencies [175bd79]
|
|
33
|
+
- Updated dependencies [f833d3a]
|
|
34
|
+
- Updated dependencies [2a9513d]
|
|
35
|
+
- Updated dependencies [71be406]
|
|
36
|
+
- Updated dependencies [d22ae31]
|
|
37
|
+
- Updated dependencies [8d8094a]
|
|
38
|
+
- @object-ui/core@17.3.0
|
|
39
|
+
- @object-ui/components@17.3.0
|
|
40
|
+
- @object-ui/types@17.3.0
|
|
41
|
+
- @object-ui/react@17.3.0
|
|
42
|
+
|
|
43
|
+
## 17.2.0
|
|
44
|
+
|
|
45
|
+
### Patch Changes
|
|
46
|
+
|
|
47
|
+
- Updated dependencies [4ae0ac4]
|
|
48
|
+
- Updated dependencies [696e3c1]
|
|
49
|
+
- Updated dependencies [bca45cc]
|
|
50
|
+
- Updated dependencies [a889e31]
|
|
51
|
+
- Updated dependencies [09d30a4]
|
|
52
|
+
- Updated dependencies [4bf612c]
|
|
53
|
+
- Updated dependencies [335041c]
|
|
54
|
+
- Updated dependencies [b414983]
|
|
55
|
+
- Updated dependencies [256f8cc]
|
|
56
|
+
- Updated dependencies [d9668a7]
|
|
57
|
+
- Updated dependencies [cb82705]
|
|
58
|
+
- Updated dependencies [f572849]
|
|
59
|
+
- Updated dependencies [f6e8d78]
|
|
60
|
+
- Updated dependencies [ea96284]
|
|
61
|
+
- Updated dependencies [d3584c6]
|
|
62
|
+
- Updated dependencies [a8ad6c0]
|
|
63
|
+
- Updated dependencies [444457c]
|
|
64
|
+
- Updated dependencies [850033c]
|
|
65
|
+
- Updated dependencies [022e4c3]
|
|
66
|
+
- Updated dependencies [009e25d]
|
|
67
|
+
- Updated dependencies [726b89c]
|
|
68
|
+
- @object-ui/types@17.2.0
|
|
69
|
+
- @object-ui/components@17.2.0
|
|
70
|
+
- @object-ui/core@17.2.0
|
|
71
|
+
- @object-ui/react@17.2.0
|
|
72
|
+
|
|
3
73
|
## 17.1.0
|
|
4
74
|
|
|
5
75
|
### Patch Changes
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@object-ui/core"),require("react"),require("@object-ui/components"),require("lucide-react"),require("react/jsx-runtime")):typeof define==`function`&&define.amd?define([`exports`,`@object-ui/core`,`react`,`@object-ui/components`,`lucide-react`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUIPluginAI={},e.ObjectUICore,e.React,e.ObjectUIComponents,e.lucide_react,e.react_jsx_runtime))})(this,function(e,t,n,r,i,a){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var o=Object.create,s=Object.defineProperty,c=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,u=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty,f=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=l(t),a=0,o=i.length,u;a<o;a++)u=i[a],!d.call(e,u)&&u!==n&&s(e,u,{get:(e=>t[e]).bind(null,u),enumerable:!(r=c(t,u))||r.enumerable});return e};n=((e,t,n)=>(n=e==null?{}:o(u(e)),f(t||!e||!e.__esModule?s(n,`default`,{value:e,enumerable:!0}):n,e)))(n,1);var p=({schema:e,onApply:t,onRefresh:o})=>{let{suggestions:s=[],showConfidence:c=!0,showReasoning:l=!1,autoFill:u=!1}=e,[d,f]=(0,n.useState)(s),[p,m]=(0,n.useState)(new Set),[h,g]=(0,n.useState)(!1),[_,v]=(0,n.useState)(!1),y=e=>{t?.(e),m(t=>new Set(t).add(e.fieldName))},b=()=>{d.forEach(e=>t?.(e)),m(new Set(d.map(e=>e.fieldName)))},x=e=>{f(t=>t.filter(t=>t.fieldName!==e))},S=()=>{v(!0),o&&o(),setTimeout(()=>v(!1),1e3)};if(h||d.length===0)return null;let C=d.filter(e=>!p.has(e.fieldName)),w=e=>e>=.8?`text-green-600`:e>=.5?`text-yellow-600`:`text-red-600`;return(0,a.jsxs)(r.Card,{className:`border-blue-200 bg-blue-50/30`,children:[(0,a.jsx)(r.CardHeader,{className:`pb-2`,children:(0,a.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,a.jsxs)(r.CardTitle,{className:`text-sm flex items-center gap-2`,children:[(0,a.jsx)(i.Sparkles,{className:`h-4 w-4 text-blue-500`}),`AI Suggestions`,(0,a.jsxs)(r.Badge,{variant:`secondary`,className:`text-xs`,children:[C.length,` suggestion`,C.length===1?``:`s`]})]}),(0,a.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,onClick:S,disabled:_,className:`h-7`,children:(0,a.jsx)(i.RefreshCw,{className:`h-3 w-3 ${_?`animate-spin`:``}`})}),C.length>1&&(0,a.jsx)(r.Button,{variant:`outline`,size:`sm`,onClick:b,className:`h-7 text-xs`,children:`Apply All`}),(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,onClick:()=>g(!0),className:`h-7`,children:(0,a.jsx)(i.X,{className:`h-3 w-3`})})]})]})}),(0,a.jsxs)(r.CardContent,{className:`space-y-2 pt-0`,children:[C.map(e=>(0,a.jsxs)(`div`,{className:`flex items-center gap-3 p-2 rounded-md bg-white border text-sm`,children:[(0,a.jsx)(i.Lightbulb,{className:`h-4 w-4 text-yellow-500 shrink-0`}),(0,a.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,a.jsx)(`span`,{className:`font-medium`,children:e.fieldName}),(0,a.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,a.jsx)(`span`,{className:`font-mono text-blue-600 truncate`,children:typeof e.value==`object`?JSON.stringify(e.value):String(e.value)})]}),c&&(0,a.jsxs)(`div`,{className:`text-xs ${w(e.confidence)}`,children:[Math.round(e.confidence*100),`% confidence`]}),l&&e.reasoning&&(0,a.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:e.reasoning})]}),(0,a.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0 text-green-600 hover:text-green-700 hover:bg-green-50`,onClick:()=>y(e),children:(0,a.jsx)(i.Check,{className:`h-3.5 w-3.5`})}),(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0 text-red-500 hover:text-red-700 hover:bg-red-50`,onClick:()=>x(e.fieldName),children:(0,a.jsx)(i.X,{className:`h-3.5 w-3.5`})})]})]},e.fieldName)),p.size>0&&(0,a.jsxs)(`div`,{className:`text-xs text-green-600 flex items-center gap-1 pt-1`,children:[(0,a.jsx)(i.Check,{className:`h-3 w-3`}),p.size,` suggestion`,p.size===1?``:`s`,` applied`]})]})]})},m=({schema:e,onSelect:t,onDismiss:n})=>{let{recommendations:o=[],showScores:s=!1,layout:c=`list`,loading:l=!1,emptyMessage:u=`No recommendations available`}=e,d=e=>{t?.(e)},f=e=>{n?.(e)};if(l)return(0,a.jsx)(r.Card,{children:(0,a.jsxs)(r.CardContent,{className:`p-8 text-center`,children:[(0,a.jsx)(i.Sparkles,{className:`h-8 w-8 text-blue-500 mx-auto mb-3 animate-pulse`}),(0,a.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Generating recommendations...`})]})});if(o.length===0)return(0,a.jsx)(r.Card,{children:(0,a.jsx)(r.CardContent,{className:`p-8 text-center text-muted-foreground`,children:u})});let p=e=>{if(!s)return null;let t=Math.round(e*100);return(0,a.jsxs)(r.Badge,{variant:e>=.7?`default`:e>=.4?`secondary`:`outline`,className:`text-xs`,children:[t,`%`]})};return(0,a.jsxs)(r.Card,{children:[(0,a.jsx)(r.CardHeader,{children:(0,a.jsxs)(r.CardTitle,{className:`flex items-center gap-2 text-sm`,children:[(0,a.jsx)(i.Sparkles,{className:`h-4 w-4 text-blue-500`}),`Recommendations`,(0,a.jsx)(r.Badge,{variant:`secondary`,className:`text-xs`,children:o.length})]})}),(0,a.jsx)(r.CardContent,{children:c===`grid`?(0,a.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3`,children:o.map(e=>(0,a.jsx)(r.Card,{className:`cursor-pointer hover:shadow-md transition-shadow`,onClick:()=>d(e),children:(0,a.jsxs)(r.CardContent,{className:`p-4`,children:[(0,a.jsxs)(`div`,{className:`flex items-start justify-between mb-2`,children:[(0,a.jsx)(i.Star,{className:`h-4 w-4 text-yellow-500`}),p(e.score)]}),(0,a.jsx)(`h4`,{className:`font-medium text-sm mb-1`,children:e.title}),e.description&&(0,a.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-3`,children:e.description}),e.category&&(0,a.jsx)(r.Badge,{variant:`outline`,className:`text-xs mt-2`,children:e.category}),(0,a.jsxs)(`div`,{className:`flex items-center gap-1 mt-3`,children:[(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 text-green-600`,children:(0,a.jsx)(i.ThumbsUp,{className:`h-3 w-3`})}),(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 text-red-500`,children:(0,a.jsx)(i.ThumbsDown,{className:`h-3 w-3`})})]})]})},e.id))}):(0,a.jsx)(`div`,{className:`space-y-2`,children:o.map(e=>(0,a.jsxs)(`div`,{className:`flex items-start gap-3 p-3 rounded-lg border hover:bg-muted/30 transition-colors cursor-pointer`,onClick:()=>d(e),children:[(0,a.jsx)(`div`,{className:`mt-1 shrink-0`,children:(0,a.jsx)(i.Star,{className:`h-4 w-4 text-yellow-500`})}),(0,a.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,a.jsx)(`span`,{className:`font-medium text-sm`,children:e.title}),e.category&&(0,a.jsx)(r.Badge,{variant:`outline`,className:`text-xs`,children:e.category}),p(e.score)]}),e.description&&(0,a.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-2`,children:e.description})]}),(0,a.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[e.action&&(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,children:(0,a.jsx)(i.ExternalLink,{className:`h-3.5 w-3.5`})}),(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0 text-muted-foreground`,onClick:t=>{t.stopPropagation(),f(e)},children:(0,a.jsx)(i.X,{className:`h-3.5 w-3.5`})})]})]},e.id))})})]})},h=({schema:e,onSubmit:t})=>{let{placeholder:o=`Ask a question about your data...`,result:s,suggestions:c=[],showHistory:l=!1,history:u=[],loading:d=!1}=e,[f,p]=(0,n.useState)(``),[m,h]=(0,n.useState)(s),[g,_]=(0,n.useState)(!1),v=g||d,y=e=>{let n=e||f;n.trim()&&(_(!0),t?.(n),t?_(!1):setTimeout(()=>{h({query:n,summary:`Results for: "${n}"`,confidence:.85,data:[],columns:[]}),_(!1)},1e3))},b=e=>{p(e),y(e)};return(0,a.jsxs)(`div`,{className:`space-y-4`,children:[(0,a.jsx)(r.Card,{children:(0,a.jsxs)(r.CardContent,{className:`p-4`,children:[(0,a.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,a.jsxs)(`div`,{className:`relative flex-1`,children:[(0,a.jsx)(i.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,a.jsx)(r.Input,{value:f,onChange:e=>p(e.target.value),onKeyDown:e=>e.key===`Enter`&&y(),placeholder:o,className:`pl-10 pr-20`,disabled:v}),(0,a.jsx)(`div`,{className:`absolute right-2 top-1/2 -translate-y-1/2`,children:(0,a.jsx)(r.Button,{size:`sm`,onClick:()=>y(),disabled:v||!f.trim(),className:`h-7`,children:v?(0,a.jsx)(i.Loader2,{className:`h-3.5 w-3.5 animate-spin`}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.Sparkles,{className:`h-3.5 w-3.5 mr-1`}),`Ask`]})})})]})}),c.length>0&&!m&&(0,a.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:c.map((e,t)=>(0,a.jsx)(`button`,{onClick:()=>b(e),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:v,children:e},t))})]})}),m&&(0,a.jsxs)(r.Card,{children:[(0,a.jsx)(r.CardHeader,{className:`pb-2`,children:(0,a.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,a.jsxs)(r.CardTitle,{className:`text-sm flex items-center gap-2`,children:[(0,a.jsx)(i.Table,{className:`h-4 w-4`}),`Results`]}),m.confidence!==void 0&&(0,a.jsxs)(r.Badge,{variant:m.confidence>=.7?`default`:`secondary`,className:`text-xs`,children:[Math.round(m.confidence*100),`% match`]})]})}),(0,a.jsxs)(r.CardContent,{children:[m.summary&&(0,a.jsx)(`p`,{className:`text-sm text-muted-foreground mb-3`,children:m.summary}),m.data&&m.data.length>0&&m.columns&&(0,a.jsx)(`div`,{className:`border rounded-lg overflow-hidden`,children:(0,a.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,a.jsx)(`thead`,{className:`bg-muted`,children:(0,a.jsx)(`tr`,{children:m.columns.map((e,t)=>(0,a.jsx)(`th`,{className:`px-4 py-2 text-left font-medium`,children:e.label||e.name},t))})}),(0,a.jsx)(`tbody`,{children:m.data.map((e,t)=>(0,a.jsx)(`tr`,{className:`border-t`,children:m.columns.map((t,n)=>(0,a.jsx)(`td`,{className:`px-4 py-2`,children:String(e[t.name]??``)},n))},t))})]})}),(!m.data||m.data.length===0)&&(0,a.jsx)(`div`,{className:`text-center py-6 text-muted-foreground text-sm`,children:`No matching records found`})]})]}),l&&u.length>0&&(0,a.jsxs)(r.Card,{children:[(0,a.jsx)(r.CardHeader,{className:`pb-2`,children:(0,a.jsxs)(r.CardTitle,{className:`text-xs text-muted-foreground flex items-center gap-1`,children:[(0,a.jsx)(i.Clock,{className:`h-3 w-3`}),`Recent Queries`]})}),(0,a.jsx)(r.CardContent,{className:`space-y-1`,children:u.slice(0,5).map((e,t)=>(0,a.jsxs)(`button`,{onClick:()=>b(e.query),className:`w-full flex items-center gap-2 p-2 rounded-md text-sm text-left hover:bg-muted/50 transition-colors`,children:[(0,a.jsx)(i.ArrowRight,{className:`h-3 w-3 text-muted-foreground shrink-0`}),(0,a.jsx)(`span`,{className:`truncate`,children:e.query}),(0,a.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0 ml-auto`,children:new Date(e.timestamp).toLocaleDateString()})]},t))})]})]})};t.ComponentRegistry.register(`ai-form-assist`,p,{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}]}),t.ComponentRegistry.register(`ai-recommendations`,m,{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`}]}),t.ComponentRegistry.register(`nl-query`,h,{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}]}),e.AIFormAssist=p,e.AIRecommendations=m,e.NLQueryInput=h});
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@object-ui/core"),require("react"),require("@object-ui/components"),require("lucide-react"),require("react/jsx-runtime")):typeof define==`function`&&define.amd?define([`exports`,`@object-ui/core`,`react`,`@object-ui/components`,`lucide-react`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUIPluginAI={},e.ObjectUICore,e.React,e.ObjectUIComponents,e.lucide_react,e.react_jsx_runtime))})(this,function(e,t,n,r,i,a){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var o=Object.create,s=Object.defineProperty,c=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,u=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty,f=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=l(t),a=0,o=i.length,u;a<o;a++)u=i[a],!d.call(e,u)&&u!==n&&s(e,u,{get:(e=>t[e]).bind(null,u),enumerable:!(r=c(t,u))||r.enumerable});return e};n=((e,t,n)=>(n=e==null?{}:o(u(e)),f(t||!e||!e.__esModule||!d.call(e,`default`)?s(n,`default`,{value:e,enumerable:!0}):n,e)))(n,1);var p=({schema:e,onApply:t,onRefresh:o})=>{let{suggestions:s=[],showConfidence:c=!0,showReasoning:l=!1,autoFill:u=!1}=e,[d,f]=(0,n.useState)(s),[p,m]=(0,n.useState)(new Set),[h,g]=(0,n.useState)(!1),[_,v]=(0,n.useState)(!1),y=e=>{t?.(e),m(t=>new Set(t).add(e.fieldName))},b=()=>{d.forEach(e=>t?.(e)),m(new Set(d.map(e=>e.fieldName)))},x=e=>{f(t=>t.filter(t=>t.fieldName!==e))},S=()=>{v(!0),o&&o(),setTimeout(()=>v(!1),1e3)};if(h||d.length===0)return null;let C=d.filter(e=>!p.has(e.fieldName)),w=e=>e>=.8?`text-green-600`:e>=.5?`text-yellow-600`:`text-red-600`;return(0,a.jsxs)(r.Card,{className:`border-blue-200 bg-blue-50/30`,children:[(0,a.jsx)(r.CardHeader,{className:`pb-2`,children:(0,a.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,a.jsxs)(r.CardTitle,{className:`text-sm flex items-center gap-2`,children:[(0,a.jsx)(i.Sparkles,{className:`h-4 w-4 text-blue-500`}),`AI Suggestions`,(0,a.jsxs)(r.Badge,{variant:`secondary`,className:`text-xs`,children:[C.length,` suggestion`,C.length===1?``:`s`]})]}),(0,a.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,onClick:S,disabled:_,className:`h-7`,children:(0,a.jsx)(i.RefreshCw,{className:`h-3 w-3 ${_?`animate-spin`:``}`})}),C.length>1&&(0,a.jsx)(r.Button,{variant:`outline`,size:`sm`,onClick:b,className:`h-7 text-xs`,children:`Apply All`}),(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,onClick:()=>g(!0),className:`h-7`,children:(0,a.jsx)(i.X,{className:`h-3 w-3`})})]})]})}),(0,a.jsxs)(r.CardContent,{className:`space-y-2 pt-0`,children:[C.map(e=>(0,a.jsxs)(`div`,{className:`flex items-center gap-3 p-2 rounded-md bg-white border text-sm`,children:[(0,a.jsx)(i.Lightbulb,{className:`h-4 w-4 text-yellow-500 shrink-0`}),(0,a.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,a.jsx)(`span`,{className:`font-medium`,children:e.fieldName}),(0,a.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,a.jsx)(`span`,{className:`font-mono text-blue-600 truncate`,children:typeof e.value==`object`?JSON.stringify(e.value):String(e.value)})]}),c&&(0,a.jsxs)(`div`,{className:`text-xs ${w(e.confidence)}`,children:[Math.round(e.confidence*100),`% confidence`]}),l&&e.reasoning&&(0,a.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:e.reasoning})]}),(0,a.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0 text-green-600 hover:text-green-700 hover:bg-green-50`,onClick:()=>y(e),children:(0,a.jsx)(i.Check,{className:`h-3.5 w-3.5`})}),(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0 text-red-500 hover:text-red-700 hover:bg-red-50`,onClick:()=>x(e.fieldName),children:(0,a.jsx)(i.X,{className:`h-3.5 w-3.5`})})]})]},e.fieldName)),p.size>0&&(0,a.jsxs)(`div`,{className:`text-xs text-green-600 flex items-center gap-1 pt-1`,children:[(0,a.jsx)(i.Check,{className:`h-3 w-3`}),p.size,` suggestion`,p.size===1?``:`s`,` applied`]})]})]})},m=({schema:e,onSelect:t,onDismiss:n})=>{let{recommendations:o=[],showScores:s=!1,layout:c=`list`,loading:l=!1,emptyMessage:u=`No recommendations available`}=e,d=e=>{t?.(e)},f=e=>{n?.(e)};if(l)return(0,a.jsx)(r.Card,{children:(0,a.jsxs)(r.CardContent,{className:`p-8 text-center`,children:[(0,a.jsx)(i.Sparkles,{className:`h-8 w-8 text-blue-500 mx-auto mb-3 animate-pulse`}),(0,a.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Generating recommendations...`})]})});if(o.length===0)return(0,a.jsx)(r.Card,{children:(0,a.jsx)(r.CardContent,{className:`p-8 text-center text-muted-foreground`,children:u})});let p=e=>{if(!s)return null;let t=Math.round(e*100);return(0,a.jsxs)(r.Badge,{variant:e>=.7?`default`:e>=.4?`secondary`:`outline`,className:`text-xs`,children:[t,`%`]})};return(0,a.jsxs)(r.Card,{children:[(0,a.jsx)(r.CardHeader,{children:(0,a.jsxs)(r.CardTitle,{className:`flex items-center gap-2 text-sm`,children:[(0,a.jsx)(i.Sparkles,{className:`h-4 w-4 text-blue-500`}),`Recommendations`,(0,a.jsx)(r.Badge,{variant:`secondary`,className:`text-xs`,children:o.length})]})}),(0,a.jsx)(r.CardContent,{children:c===`grid`?(0,a.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3`,children:o.map(e=>(0,a.jsx)(r.Card,{className:`cursor-pointer hover:shadow-md transition-shadow`,onClick:()=>d(e),children:(0,a.jsxs)(r.CardContent,{className:`p-4`,children:[(0,a.jsxs)(`div`,{className:`flex items-start justify-between mb-2`,children:[(0,a.jsx)(i.Star,{className:`h-4 w-4 text-yellow-500`}),p(e.score)]}),(0,a.jsx)(`h4`,{className:`font-medium text-sm mb-1`,children:e.title}),e.description&&(0,a.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-3`,children:e.description}),e.category&&(0,a.jsx)(r.Badge,{variant:`outline`,className:`text-xs mt-2`,children:e.category}),(0,a.jsxs)(`div`,{className:`flex items-center gap-1 mt-3`,children:[(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 text-green-600`,children:(0,a.jsx)(i.ThumbsUp,{className:`h-3 w-3`})}),(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 text-red-500`,children:(0,a.jsx)(i.ThumbsDown,{className:`h-3 w-3`})})]})]})},e.id))}):(0,a.jsx)(`div`,{className:`space-y-2`,children:o.map(e=>(0,a.jsxs)(`div`,{className:`flex items-start gap-3 p-3 rounded-lg border hover:bg-muted/30 transition-colors cursor-pointer`,onClick:()=>d(e),children:[(0,a.jsx)(`div`,{className:`mt-1 shrink-0`,children:(0,a.jsx)(i.Star,{className:`h-4 w-4 text-yellow-500`})}),(0,a.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,a.jsx)(`span`,{className:`font-medium text-sm`,children:e.title}),e.category&&(0,a.jsx)(r.Badge,{variant:`outline`,className:`text-xs`,children:e.category}),p(e.score)]}),e.description&&(0,a.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-2`,children:e.description})]}),(0,a.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[e.action&&(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,children:(0,a.jsx)(i.ExternalLink,{className:`h-3.5 w-3.5`})}),(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0 text-muted-foreground`,onClick:t=>{t.stopPropagation(),f(e)},children:(0,a.jsx)(i.X,{className:`h-3.5 w-3.5`})})]})]},e.id))})})]})},h=({schema:e,onSubmit:t})=>{let{placeholder:o=`Ask a question about your data...`,result:s,suggestions:c=[],showHistory:l=!1,history:u=[],loading:d=!1}=e,[f,p]=(0,n.useState)(``),[m,h]=(0,n.useState)(s),[g,_]=(0,n.useState)(!1),v=g||d,y=e=>{let n=e||f;n.trim()&&(_(!0),t?.(n),t?_(!1):setTimeout(()=>{h({query:n,summary:`Results for: "${n}"`,confidence:.85,data:[],columns:[]}),_(!1)},1e3))},b=e=>{p(e),y(e)};return(0,a.jsxs)(`div`,{className:`space-y-4`,children:[(0,a.jsx)(r.Card,{children:(0,a.jsxs)(r.CardContent,{className:`p-4`,children:[(0,a.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,a.jsxs)(`div`,{className:`relative flex-1`,children:[(0,a.jsx)(i.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,a.jsx)(r.Input,{value:f,onChange:e=>p(e.target.value),onKeyDown:e=>e.key===`Enter`&&y(),placeholder:o,className:`pl-10 pr-20`,disabled:v}),(0,a.jsx)(`div`,{className:`absolute right-2 top-1/2 -translate-y-1/2`,children:(0,a.jsx)(r.Button,{size:`sm`,onClick:()=>y(),disabled:v||!f.trim(),className:`h-7`,children:v?(0,a.jsx)(i.Loader2,{className:`h-3.5 w-3.5 animate-spin`}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.Sparkles,{className:`h-3.5 w-3.5 mr-1`}),`Ask`]})})})]})}),c.length>0&&!m&&(0,a.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:c.map((e,t)=>(0,a.jsx)(`button`,{onClick:()=>b(e),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:v,children:e},t))})]})}),m&&(0,a.jsxs)(r.Card,{children:[(0,a.jsx)(r.CardHeader,{className:`pb-2`,children:(0,a.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,a.jsxs)(r.CardTitle,{className:`text-sm flex items-center gap-2`,children:[(0,a.jsx)(i.Table,{className:`h-4 w-4`}),`Results`]}),m.confidence!==void 0&&(0,a.jsxs)(r.Badge,{variant:m.confidence>=.7?`default`:`secondary`,className:`text-xs`,children:[Math.round(m.confidence*100),`% match`]})]})}),(0,a.jsxs)(r.CardContent,{children:[m.summary&&(0,a.jsx)(`p`,{className:`text-sm text-muted-foreground mb-3`,children:m.summary}),m.data&&m.data.length>0&&m.columns&&(0,a.jsx)(`div`,{className:`border rounded-lg overflow-hidden`,children:(0,a.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,a.jsx)(`thead`,{className:`bg-muted`,children:(0,a.jsx)(`tr`,{children:m.columns.map((e,t)=>(0,a.jsx)(`th`,{className:`px-4 py-2 text-left font-medium`,children:e.label||e.name},t))})}),(0,a.jsx)(`tbody`,{children:m.data.map((e,t)=>(0,a.jsx)(`tr`,{className:`border-t`,children:m.columns.map((t,n)=>(0,a.jsx)(`td`,{className:`px-4 py-2`,children:String(e[t.name]??``)},n))},t))})]})}),(!m.data||m.data.length===0)&&(0,a.jsx)(`div`,{className:`text-center py-6 text-muted-foreground text-sm`,children:`No matching records found`})]})]}),l&&u.length>0&&(0,a.jsxs)(r.Card,{children:[(0,a.jsx)(r.CardHeader,{className:`pb-2`,children:(0,a.jsxs)(r.CardTitle,{className:`text-xs text-muted-foreground flex items-center gap-1`,children:[(0,a.jsx)(i.Clock,{className:`h-3 w-3`}),`Recent Queries`]})}),(0,a.jsx)(r.CardContent,{className:`space-y-1`,children:u.slice(0,5).map((e,t)=>(0,a.jsxs)(`button`,{onClick:()=>b(e.query),className:`w-full flex items-center gap-2 p-2 rounded-md text-sm text-left hover:bg-muted/50 transition-colors`,children:[(0,a.jsx)(i.ArrowRight,{className:`h-3 w-3 text-muted-foreground shrink-0`}),(0,a.jsx)(`span`,{className:`truncate`,children:e.query}),(0,a.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0 ml-auto`,children:new Date(e.timestamp).toLocaleDateString()})]},t))})]})]})};t.ComponentRegistry.register(`ai-form-assist`,p,{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}]}),t.ComponentRegistry.register(`ai-recommendations`,m,{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`}]}),t.ComponentRegistry.register(`nl-query`,h,{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}]}),e.AIFormAssist=p,e.AIRecommendations=m,e.NLQueryInput=h});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@object-ui/plugin-ai",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.umd.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -24,19 +24,19 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"clsx": "^2.1.1",
|
|
27
|
-
"lucide-react": "^1.
|
|
27
|
+
"lucide-react": "^1.28.0",
|
|
28
28
|
"tailwind-merge": "^3.6.0",
|
|
29
|
-
"@object-ui/components": "17.
|
|
30
|
-
"@object-ui/core": "17.
|
|
31
|
-
"@object-ui/react": "17.
|
|
32
|
-
"@object-ui/types": "17.
|
|
29
|
+
"@object-ui/components": "17.3.0",
|
|
30
|
+
"@object-ui/core": "17.3.0",
|
|
31
|
+
"@object-ui/react": "17.3.0",
|
|
32
|
+
"@object-ui/types": "17.3.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@types/node": "^26.1.
|
|
36
|
-
"@types/react": "19.2.
|
|
37
|
-
"@types/react-dom": "19.2.
|
|
38
|
-
"@vitejs/plugin-react": "^6.0.
|
|
39
|
-
"vite": "^8.
|
|
35
|
+
"@types/node": "^26.1.2",
|
|
36
|
+
"@types/react": "19.2.18",
|
|
37
|
+
"@types/react-dom": "19.2.4",
|
|
38
|
+
"@vitejs/plugin-react": "^6.0.5",
|
|
39
|
+
"vite": "^8.2.0",
|
|
40
40
|
"vite-plugin-dts": "^5.0.3",
|
|
41
41
|
"vitest": "^4.1.10"
|
|
42
42
|
},
|