@rustic-ai/ui-components 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/calendar/index.css +14 -1
- package/dist/components/calendar/index.js +1 -1
- package/dist/components/codeSnippet/index.css +14 -1
- package/dist/components/codeSnippet/index.js +1 -1
- package/dist/components/dynamicForm/index.css +14 -1
- package/dist/components/dynamicForm/index.js +1 -1
- package/dist/components/image/index.css +14 -1
- package/dist/components/image/index.js +1 -1
- package/dist/components/map/index.css +14 -1
- package/dist/components/map/index.js +1 -1
- package/dist/components/markdown/index.css +14 -1
- package/dist/components/markdown/index.js +1 -1
- package/dist/components/markdown/markedMarkdown.d.ts.map +1 -1
- package/dist/components/media/audio/index.css +14 -1
- package/dist/components/media/audio/index.js +1 -1
- package/dist/components/media/video/index.css +14 -1
- package/dist/components/media/video/index.js +1 -1
- package/dist/components/multipart/chatCompletion/index.css +14 -1
- package/dist/components/multipart/chatCompletion/index.js +1 -1
- package/dist/components/multipart/multipart/index.css +14 -1
- package/dist/components/multipart/multipart/index.js +1 -1
- package/dist/components/question/index.css +14 -1
- package/dist/components/question/index.js +1 -1
- package/dist/components/table/index.css +14 -1
- package/dist/components/table/index.js +1 -1
- package/dist/components/visualization/mermaidViz/index.css +14 -1
- package/dist/components/visualization/mermaidViz/index.js +1 -1
- package/dist/components/visualization/perspectiveViz/index.css +14 -1
- package/dist/components/visualization/perspectiveViz/index.js +1 -1
- package/dist/components/visualization/plotlyGraph/index.css +14 -1
- package/dist/components/visualization/plotlyGraph/index.js +1 -1
- package/dist/components/visualization/vegaLiteViz/index.css +14 -1
- package/dist/components/visualization/vegaLiteViz/index.js +1 -1
- package/dist/components/weather/index.css +14 -1
- package/dist/components/weather/index.js +1 -1
- package/dist/index.css +14 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -153,8 +153,21 @@ span.rustic-icon-large {
|
|
|
153
153
|
width: fit-content;
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
-
.rustic-markdown p {
|
|
156
|
+
.rustic-markdown p:first-child {
|
|
157
157
|
margin-block-start: 0;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.rustic-markdown p:last-child {
|
|
158
161
|
margin-block-end: 0;
|
|
159
162
|
}
|
|
160
163
|
|
|
164
|
+
.rustic-markdown table {
|
|
165
|
+
border-collapse: collapse;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.rustic-markdown th,
|
|
169
|
+
.rustic-markdown td {
|
|
170
|
+
padding: 8px;
|
|
171
|
+
text-align: left;
|
|
172
|
+
}
|
|
173
|
+
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,()=>(()=>{"use strict";var e={8010:(e,t,r)=>{r.d(t,{default:()=>a});var n=r(227);r(7159);const a=n.A},227:(e,t,r)=>{r.d(t,{A:()=>p});var n=r(8732),a=r(5642),i=r.n(a),o=r(785),s=r.n(o),l=r(7447),c=r.n(l),u=r(3840),d=r(2015),m=r(7159);const p=function(e){var t=(0,d.useState)(e.text),r=t[0],a=t[1],o=(0,d.useState)(""),l=o[0],p=o[1];function f(e){return"string"!=typeof e?(p("Some of the incoming text was not correctly formatted. Some data may be missing.")," [MISSING TEXT]"):e}function h(e){return(0,n.jsx)(s(),{component:"div",className:"rustic-markdown",dangerouslySetInnerHTML:{__html:(t=e,r=t.replace(/^[\u200B-\u200F\uFEFF]/,""),a=u.marked.parse(r,{async:!1,breaks:!0,gfm:!0}),c().sanitize(a))}});var t,r,a}return(0,d.useEffect)(function(){if(e.updatedData&&e.updatedData.length>0){var t=e.text,r=e.updatedData.at(-1);if(e.updatedData.length>1&&(null==r?void 0:r.updateType)===m.Ur.Replace)t=f(r.text);else for(var n=0,i=e.updatedData;n<i.length;n++){var o=i[n],s=o.updateType||m.Ur.Append,l=f(o.text);s===m.Ur.Append?t+=l:s===m.Ur.Replace&&(t=l)}a(t)}},[e.text,e.updatedData]),(0,n.jsxs)(n.Fragment,{children:[e.title&&(0,n.jsx)(s(),{variant:"h6",children:e.title}),e.description&&h(e.description),h(r),l&&(0,n.jsx)(i(),{severity:"error",children:l})]})}},7159:(e,t,r)=>{var n,a,i,o;r.d(t,{Ur:()=>a}),function(e){e.Running="running",e.Completed="completed",e.Error="error"}(n||(n={})),function(e){e.Append="append",e.Replace="replace"}(a||(a={})),function(e){e.Owner="owner",e.Member="member"}(i||(i={})),function(e){e.Human="human",e.Agent="agent"}(o||(o={}))},5642:e=>{e.exports=require("@mui/material/Alert")},785:e=>{e.exports=require("@mui/material/Typography")},7447:e=>{e.exports=require("dompurify")},3840:e=>{e.exports=require("marked")},2015:e=>{e.exports=require("react")},8732:e=>{e.exports=require("react/jsx-runtime")}},t={};function r(n){var a=t[n];if(void 0!==a)return a.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};r.r(n),r.d(n,{default:()=>M});var a=r(8732),i=r(785),o=r.n(i);const s=require("@mui/system/Box");var l=r.n(s),c=r(2015);const u=require("@mui/material/Card");var d=r.n(u);const m=require("@mui/material/IconButton");var p=r.n(m);const f=require("@mui/material/Modal");var h=r.n(f);const v=require("@mui/material/styles"),x=require("@mui/material/Tooltip");var j,b=r.n(x);!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(j||(j={}));var g=function(){return g=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},g.apply(this,arguments)};function y(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,a.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:g({},t),children:e.name})}const w=require("@mui/material/Box");var N=r.n(w);const O=require("@mui/material/TextField");var k=r.n(O);const S=require("@mui/material/useMediaQuery");var C=r.n(S);const A=require("@mui/system/Stack");var P=r.n(A);const q=require("@mui/system/useTheme");var H=r.n(q);const T=require("pdfjs-dist"),D=function(e){var t={zoomIn:{symbol:"zoom_in",label:"Zoom in"},zoomOut:{symbol:"zoom_out",label:"Zoom out"},close:{symbol:"close",label:"Close"},previousPage:{symbol:"arrow_back",label:"Previous page"},nextPage:{symbol:"arrow_forward",label:"Next page"}},r=(t[e.action].label.replaceAll(" ","-").toLowerCase(),t[e.action]);return(0,a.jsx)(b(),{title:r.label,children:(0,a.jsx)("span",{children:(0,a.jsx)(p(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,a.jsx)(y,{name:r.symbol})})})})};var F={pdf:function(e){var t,r=(0,c.useRef)(null),n=(0,c.useState)(1),i=n[0],s=n[1],l=(0,c.useState)(1),u=l[0],m=l[1],p=(0,c.useState)(1),f=p[0],h=p[1],v=(0,c.useState)(!1),x=v[0],j=v[1],b=(0,c.useState)(),g=b[0],y=b[1],w=H()(),O=C()(w.breakpoints.down("sm")),S=C()(w.breakpoints.between("sm","md"));if(t=e.url,!/\/[^/]+\.pdf$/.test(t))return(0,a.jsx)(d(),{variant:"outlined",className:"rustic-pdf-error",children:(0,a.jsx)(o(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var A=(0,c.useState)(function(){return O?.5:S?1:1.5}),q=A[0],F=A[1];function R(t){T.getDocument({url:e.url,httpHeaders:t}).promise.then(function(e){m(e.numPages),function(e){e.getPage(i).then(function(e){var t=e.getViewport({scale:q}),n=r.current;if(n){var a=n.getContext("2d");if(a){var i=window.devicePixelRatio||1;n.style.width="".concat(t.width,"px"),n.style.height="".concat(t.height,"px"),n.width=t.width*i,n.height=t.height*i;var o={canvasContext:a,viewport:t,transform:[i,0,0,i,0,0]};g&&g.cancel();var s=e.render(o);y(s),s.promise.then(function(){y(void 0)}).catch(function(e){console.error(e)})}}})}(e)}).catch(function(){j(!0)})}return(0,c.useEffect)(function(){T.GlobalWorkerOptions.workerSrc||(T.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(T.version,"/pdf.worker.mjs")),e.getAuthHeaders?e.getAuthHeaders().then(function(e){return R(e.headers)}).catch(function(){return j(!0)}):R()},[e.url,i,q]),x?(0,a.jsx)(d(),{variant:"outlined",className:"rustic-pdf-error",children:(0,a.jsx)(o(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,a.jsxs)(d(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,a.jsxs)(N(),{className:"rustic-pdf-viewer-header",children:[(0,a.jsx)(D,{action:"zoomOut",onClick:function(){F(function(e){return Math.max(e-.2,.2)})}}),(0,a.jsx)(D,{action:"zoomIn",onClick:function(){F(function(e){return e+.2})}})]}),(0,a.jsx)(N(),{className:"rustic-pdf-viewer-body",children:(0,a.jsx)(N(),{className:"rustic-pdf-viewer-body-inner",children:(0,a.jsx)("canvas",{ref:r})})}),(0,a.jsxs)(P(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,a.jsx)(D,{action:"previousPage",onClick:function(){i>1&&(s(i-1),h(i-1))},isDisabled:1===i}),(0,a.jsx)(o(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,a.jsx)(k(),{type:"number",value:f,onChange:function(e){var t=parseInt(e.target.value);h(t),!isNaN(t)&&t>=1&&t<=u&&s(t)},size:"small",className:"rustic-pdf-page-input"}),(0,a.jsxs)(o(),{variant:"body1",className:"rustic-page-indicator",children:["of ",u]}),(0,a.jsx)(D,{action:"nextPage",onClick:function(){i<u&&(s(i+1),h(i+1))},isDisabled:i===u})]})]})}};function R(e){var t=e.supportedViewers,r=void 0===t?F:t,n=e.showFullName,i=void 0===n||n,s=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}(e,["supportedViewers","showFullName"]),l=(0,v.useTheme)(),u=(0,c.useState)(!1),m=u[0],f=u[1];function x(){f(!1)}var j,g,w=s.file.url&&(j=s.file.url.split("."))[j.length-1].toLowerCase(),N=w&&r?r[w]:null,O=!!N,k=O?" rustic-cursor-pointer":"",S="rustic-file-preview ".concat(i?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width").concat(k),C=i?s.file.name:(g=s.file.name).length<=15?g:g.substring(0,12)+"...";return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(d(),{className:S,variant:"outlined",sx:{boxShadow:l.shadows[1]},onClick:function(){f(!0)},children:[(0,a.jsx)(o(),{variant:"subtitle2",className:"rustic-file-preview-name",children:C}),(0,a.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:s.children})]}),O&&(0,a.jsx)(h(),{open:m,onClose:x,className:"rustic-file-preview-modal",children:(0,a.jsxs)("div",{className:"rustic-modal-content",children:[(0,a.jsx)(b(),{title:"Close",children:(0,a.jsx)(p(),{onClick:x,className:"rustic-close-button",children:(0,a.jsx)(y,{name:"close"})})}),s.file.url&&(0,a.jsx)(N,{url:s.file.url,getAuthHeaders:s.getAuthHeaders})]})})]})}var _=r(8010),U=function(){return U=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},U.apply(this,arguments)};function E(e){return(0,a.jsx)(b(),{title:"Download",className:"rustic-shift-to-right-by-8",children:e.getAuthHeaders?(0,a.jsx)(p(),{onClick:function(){(0,e.getAuthHeaders)().then(function(t){return fetch(e.url,U({},t))}).then(function(e){return e.blob()}).then(function(t){var r=window.URL.createObjectURL(t),n=document.createElement("a");n.href=r,n.download=e.fileName,document.body.appendChild(n),n.click(),document.body.removeChild(n),window.URL.revokeObjectURL(r)}).catch(function(e){throw new Error("Error downloading file. "+e.message)})},children:(0,a.jsx)(y,{name:"download"})}):(0,a.jsx)(p(),{component:"a",href:e.url,download:e.fileName,children:(0,a.jsx)(y,{name:"download"})})})}const M=function(e){return(0,a.jsxs)(l(),{className:"rustic-multipart",children:[(e.title||e.description)&&(0,a.jsxs)("div",{children:[e.title&&(0,a.jsx)(o(),{variant:"h6",children:e.title}),e.description&&(0,a.jsx)(_.default,{text:e.description})]}),e.text&&(0,a.jsx)(_.default,{text:e.text}),(t=e.files.map(function(t,r){return(0,a.jsx)(R,{file:t,showFullName:e.showFullName,getAuthHeaders:e.getAuthHeaders,children:t.url&&(0,a.jsx)(E,{url:t.url,fileName:t.name,getAuthHeaders:e.getAuthHeaders})},r)}),(0,a.jsx)(l(),{className:"rustic-files",children:t}))]});var t};return n})());
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,()=>(()=>{"use strict";var e={8010:(e,t,r)=>{r.d(t,{default:()=>a});var n=r(227);r(7159);const a=n.A},227:(e,t,r)=>{r.d(t,{A:()=>f});var n=r(8732),a=r(5642),i=r.n(a),o=r(6182),s=r(785),l=r.n(s),c=r(7447),u=r.n(c),d=r(3840),p=r(2015),m=r(7159);const f=function(e){var t=(0,o.useTheme)(),r=(0,p.useState)(e.text),a=r[0],s=r[1],c=(0,p.useState)(""),f=c[0],h=c[1];function x(e){return"string"!=typeof e?(h("Some of the incoming text was not correctly formatted. Some data may be missing.")," [MISSING TEXT]"):e}function v(e){return(0,n.jsx)(l(),{component:"div",className:"rustic-markdown",dangerouslySetInnerHTML:{__html:(r=e,a=r.replace(/^[\u200B-\u200F\uFEFF]/,""),i=d.marked.parse(a,{async:!1,breaks:!0,gfm:!0}),u().sanitize(i))},sx:{"& table, & th, & td":{border:"1px solid ".concat(t.palette.divider)}}});var r,a,i}return(0,p.useEffect)(function(){if(e.updatedData&&e.updatedData.length>0){var t=e.text,r=e.updatedData.at(-1);if(e.updatedData.length>1&&(null==r?void 0:r.updateType)===m.Ur.Replace)t=x(r.text);else for(var n=0,a=e.updatedData;n<a.length;n++){var i=a[n],o=i.updateType||m.Ur.Append,l=x(i.text);o===m.Ur.Append?t+=l:o===m.Ur.Replace&&(t=l)}s(t)}},[e.text,e.updatedData]),(0,n.jsxs)(n.Fragment,{children:[e.title&&(0,n.jsx)(l(),{variant:"h6",children:e.title}),e.description&&v(e.description),v(a),f&&(0,n.jsx)(i(),{severity:"error",children:f})]})}},7159:(e,t,r)=>{var n,a,i,o;r.d(t,{Ur:()=>a}),function(e){e.Running="running",e.Completed="completed",e.Error="error"}(n||(n={})),function(e){e.Append="append",e.Replace="replace"}(a||(a={})),function(e){e.Owner="owner",e.Member="member"}(i||(i={})),function(e){e.Human="human",e.Agent="agent"}(o||(o={}))},5642:e=>{e.exports=require("@mui/material/Alert")},785:e=>{e.exports=require("@mui/material/Typography")},6182:e=>{e.exports=require("@mui/material/styles")},7447:e=>{e.exports=require("dompurify")},3840:e=>{e.exports=require("marked")},2015:e=>{e.exports=require("react")},8732:e=>{e.exports=require("react/jsx-runtime")}},t={};function r(n){var a=t[n];if(void 0!==a)return a.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};r.r(n),r.d(n,{default:()=>M});var a=r(8732),i=r(785),o=r.n(i);const s=require("@mui/system/Box");var l=r.n(s),c=r(2015);const u=require("@mui/material/Card");var d=r.n(u);const p=require("@mui/material/IconButton");var m=r.n(p);const f=require("@mui/material/Modal");var h=r.n(f),x=r(6182);const v=require("@mui/material/Tooltip");var b,j=r.n(v);!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(b||(b={}));var g=function(){return g=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},g.apply(this,arguments)};function y(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,a.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:g({},t),children:e.name})}const w=require("@mui/material/Box");var N=r.n(w);const O=require("@mui/material/TextField");var k=r.n(O);const S=require("@mui/material/useMediaQuery");var C=r.n(S);const A=require("@mui/system/Stack");var P=r.n(A);const q=require("@mui/system/useTheme");var T=r.n(q);const H=require("pdfjs-dist"),D=function(e){var t={zoomIn:{symbol:"zoom_in",label:"Zoom in"},zoomOut:{symbol:"zoom_out",label:"Zoom out"},close:{symbol:"close",label:"Close"},previousPage:{symbol:"arrow_back",label:"Previous page"},nextPage:{symbol:"arrow_forward",label:"Next page"}},r=(t[e.action].label.replaceAll(" ","-").toLowerCase(),t[e.action]);return(0,a.jsx)(j(),{title:r.label,children:(0,a.jsx)("span",{children:(0,a.jsx)(m(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,a.jsx)(y,{name:r.symbol})})})})};var F={pdf:function(e){var t,r=(0,c.useRef)(null),n=(0,c.useState)(1),i=n[0],s=n[1],l=(0,c.useState)(1),u=l[0],p=l[1],m=(0,c.useState)(1),f=m[0],h=m[1],x=(0,c.useState)(!1),v=x[0],b=x[1],j=(0,c.useState)(),g=j[0],y=j[1],w=T()(),O=C()(w.breakpoints.down("sm")),S=C()(w.breakpoints.between("sm","md"));if(t=e.url,!/\/[^/]+\.pdf$/.test(t))return(0,a.jsx)(d(),{variant:"outlined",className:"rustic-pdf-error",children:(0,a.jsx)(o(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var A=(0,c.useState)(function(){return O?.5:S?1:1.5}),q=A[0],F=A[1];function R(t){H.getDocument({url:e.url,httpHeaders:t}).promise.then(function(e){p(e.numPages),function(e){e.getPage(i).then(function(e){var t=e.getViewport({scale:q}),n=r.current;if(n){var a=n.getContext("2d");if(a){var i=window.devicePixelRatio||1;n.style.width="".concat(t.width,"px"),n.style.height="".concat(t.height,"px"),n.width=t.width*i,n.height=t.height*i;var o={canvasContext:a,viewport:t,transform:[i,0,0,i,0,0]};g&&g.cancel();var s=e.render(o);y(s),s.promise.then(function(){y(void 0)}).catch(function(e){console.error(e)})}}})}(e)}).catch(function(){b(!0)})}return(0,c.useEffect)(function(){H.GlobalWorkerOptions.workerSrc||(H.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(H.version,"/pdf.worker.mjs")),e.getAuthHeaders?e.getAuthHeaders().then(function(e){return R(e.headers)}).catch(function(){return b(!0)}):R()},[e.url,i,q]),v?(0,a.jsx)(d(),{variant:"outlined",className:"rustic-pdf-error",children:(0,a.jsx)(o(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,a.jsxs)(d(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,a.jsxs)(N(),{className:"rustic-pdf-viewer-header",children:[(0,a.jsx)(D,{action:"zoomOut",onClick:function(){F(function(e){return Math.max(e-.2,.2)})}}),(0,a.jsx)(D,{action:"zoomIn",onClick:function(){F(function(e){return e+.2})}})]}),(0,a.jsx)(N(),{className:"rustic-pdf-viewer-body",children:(0,a.jsx)(N(),{className:"rustic-pdf-viewer-body-inner",children:(0,a.jsx)("canvas",{ref:r})})}),(0,a.jsxs)(P(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,a.jsx)(D,{action:"previousPage",onClick:function(){i>1&&(s(i-1),h(i-1))},isDisabled:1===i}),(0,a.jsx)(o(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,a.jsx)(k(),{type:"number",value:f,onChange:function(e){var t=parseInt(e.target.value);h(t),!isNaN(t)&&t>=1&&t<=u&&s(t)},size:"small",className:"rustic-pdf-page-input"}),(0,a.jsxs)(o(),{variant:"body1",className:"rustic-page-indicator",children:["of ",u]}),(0,a.jsx)(D,{action:"nextPage",onClick:function(){i<u&&(s(i+1),h(i+1))},isDisabled:i===u})]})]})}};function R(e){var t=e.supportedViewers,r=void 0===t?F:t,n=e.showFullName,i=void 0===n||n,s=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}(e,["supportedViewers","showFullName"]),l=(0,x.useTheme)(),u=(0,c.useState)(!1),p=u[0],f=u[1];function v(){f(!1)}var b,g,w=s.file.url&&(b=s.file.url.split("."))[b.length-1].toLowerCase(),N=w&&r?r[w]:null,O=!!N,k=O?" rustic-cursor-pointer":"",S="rustic-file-preview ".concat(i?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width").concat(k),C=i?s.file.name:(g=s.file.name).length<=15?g:g.substring(0,12)+"...";return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(d(),{className:S,variant:"outlined",sx:{boxShadow:l.shadows[1]},onClick:function(){f(!0)},children:[(0,a.jsx)(o(),{variant:"subtitle2",className:"rustic-file-preview-name",children:C}),(0,a.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:s.children})]}),O&&(0,a.jsx)(h(),{open:p,onClose:v,className:"rustic-file-preview-modal",children:(0,a.jsxs)("div",{className:"rustic-modal-content",children:[(0,a.jsx)(j(),{title:"Close",children:(0,a.jsx)(m(),{onClick:v,className:"rustic-close-button",children:(0,a.jsx)(y,{name:"close"})})}),s.file.url&&(0,a.jsx)(N,{url:s.file.url,getAuthHeaders:s.getAuthHeaders})]})})]})}var _=r(8010),U=function(){return U=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},U.apply(this,arguments)};function E(e){return(0,a.jsx)(j(),{title:"Download",className:"rustic-shift-to-right-by-8",children:e.getAuthHeaders?(0,a.jsx)(m(),{onClick:function(){(0,e.getAuthHeaders)().then(function(t){return fetch(e.url,U({},t))}).then(function(e){return e.blob()}).then(function(t){var r=window.URL.createObjectURL(t),n=document.createElement("a");n.href=r,n.download=e.fileName,document.body.appendChild(n),n.click(),document.body.removeChild(n),window.URL.revokeObjectURL(r)}).catch(function(e){throw new Error("Error downloading file. "+e.message)})},children:(0,a.jsx)(y,{name:"download"})}):(0,a.jsx)(m(),{component:"a",href:e.url,download:e.fileName,children:(0,a.jsx)(y,{name:"download"})})})}const M=function(e){return(0,a.jsxs)(l(),{className:"rustic-multipart",children:[(e.title||e.description)&&(0,a.jsxs)("div",{children:[e.title&&(0,a.jsx)(o(),{variant:"h6",children:e.title}),e.description&&(0,a.jsx)(_.default,{text:e.description})]}),e.text&&(0,a.jsx)(_.default,{text:e.text}),(t=e.files.map(function(t,r){return(0,a.jsx)(R,{file:t,showFullName:e.showFullName,getAuthHeaders:e.getAuthHeaders,children:t.url&&(0,a.jsx)(E,{url:t.url,fileName:t.name,getAuthHeaders:e.getAuthHeaders})},r)}),(0,a.jsx)(l(),{className:"rustic-files",children:t}))]});var t};return n})());
|
|
@@ -12,8 +12,21 @@
|
|
|
12
12
|
flex-wrap: wrap;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
.rustic-markdown p {
|
|
15
|
+
.rustic-markdown p:first-child {
|
|
16
16
|
margin-block-start: 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.rustic-markdown p:last-child {
|
|
17
20
|
margin-block-end: 0;
|
|
18
21
|
}
|
|
19
22
|
|
|
23
|
+
.rustic-markdown table {
|
|
24
|
+
border-collapse: collapse;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.rustic-markdown th,
|
|
28
|
+
.rustic-markdown td {
|
|
29
|
+
padding: 8px;
|
|
30
|
+
text-align: left;
|
|
31
|
+
}
|
|
32
|
+
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,()=>(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,()=>(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var a in r)e.o(r,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:r[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{MessageProcessStatus:()=>h,ParticipantRole:()=>S,ParticipantType:()=>q,UpdateType:()=>j,default:()=>w});const r=require("react/jsx-runtime"),a=require("@mui/material"),n=require("@mui/material/Box");var i=e.n(n);const o=require("@mui/material/Chip");var s=e.n(o);const u=require("@mui/material/Stack");var d=e.n(u);const c=require("@mui/material/Typography");var l=e.n(c);const p=require("react"),m=require("uuid"),f=require("@mui/material/Alert");var y=e.n(f);const v=require("@mui/material/styles"),x=require("dompurify");var g=e.n(x);const b=require("marked");var h,j,S,q;!function(e){e.Running="running",e.Completed="completed",e.Error="error"}(h||(h={})),function(e){e.Append="append",e.Replace="replace"}(j||(j={})),function(e){e.Owner="owner",e.Member="member"}(S||(S={})),function(e){e.Human="human",e.Agent="agent"}(q||(q={}));const T=function(e){var t=(0,v.useTheme)(),a=(0,p.useState)(e.text),n=a[0],i=a[1],o=(0,p.useState)(""),s=o[0],u=o[1];function d(e){return"string"!=typeof e?(u("Some of the incoming text was not correctly formatted. Some data may be missing.")," [MISSING TEXT]"):e}function c(e){return(0,r.jsx)(l(),{component:"div",className:"rustic-markdown",dangerouslySetInnerHTML:{__html:(a=e,n=a.replace(/^[\u200B-\u200F\uFEFF]/,""),i=b.marked.parse(n,{async:!1,breaks:!0,gfm:!0}),g().sanitize(i))},sx:{"& table, & th, & td":{border:"1px solid ".concat(t.palette.divider)}}});var a,n,i}return(0,p.useEffect)(function(){if(e.updatedData&&e.updatedData.length>0){var t=e.text,r=e.updatedData.at(-1);if(e.updatedData.length>1&&(null==r?void 0:r.updateType)===j.Replace)t=d(r.text);else for(var a=0,n=e.updatedData;a<n.length;a++){var o=n[a],s=o.updateType||j.Append,u=d(o.text);s===j.Append?t+=u:s===j.Replace&&(t=u)}i(t)}},[e.text,e.updatedData]),(0,r.jsxs)(r.Fragment,{children:[e.title&&(0,r.jsx)(l(),{variant:"h6",children:e.title}),e.description&&c(e.description),c(n),s&&(0,r.jsx)(y(),{severity:"error",children:s})]})},w=function(e){var t=(0,p.useState)(e.data||""),n=t[0],o=t[1],u=(0,a.useTheme)(),c=(0,a.useMediaQuery)(u.breakpoints.down("md"))?"column":"row",f=e.options.map(function(t,a){return(0,r.jsx)(s(),{onClick:function(){return function(t){var r;o(t);var a=(new Date).toISOString(),n={id:(0,m.v4)(),timestamp:a,sender:e.sender,conversationId:e.conversationId,format:"questionResponse",data:{data:t,inReplyTo:e.messageId}};null===(r=e.ws)||void 0===r||r.send(n)}(t)},color:"secondary",size:"small",sx:n===t?{"&.Mui-disabled":{backgroundColor:"secondary.light",color:"text.primary"}}:{},className:"rustic-option",disabled:!!n||!e.ws,"aria-disabled":!!n||!e.ws,label:t},a)});return(0,r.jsxs)(i(),{className:"rustic-question",children:[(e.title||e.description)&&(0,r.jsxs)(i(),{className:"rustic-question-text",children:[e.title&&(0,r.jsx)(l(),{variant:"h6",className:"rustic-title",children:e.title}),e.description&&(0,r.jsx)(T,{text:e.description})]}),(0,r.jsx)(d(),{direction:c,className:"rustic-options-container",children:f})]})};return t})());
|
|
@@ -41,8 +41,21 @@ span.rustic-icon-large {
|
|
|
41
41
|
font-size: 32px;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
.rustic-markdown p {
|
|
44
|
+
.rustic-markdown p:first-child {
|
|
45
45
|
margin-block-start: 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.rustic-markdown p:last-child {
|
|
46
49
|
margin-block-end: 0;
|
|
47
50
|
}
|
|
48
51
|
|
|
52
|
+
.rustic-markdown table {
|
|
53
|
+
border-collapse: collapse;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.rustic-markdown th,
|
|
57
|
+
.rustic-markdown td {
|
|
58
|
+
padding: 8px;
|
|
59
|
+
text-align: left;
|
|
60
|
+
}
|
|
61
|
+
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,()=>(()=>{"use strict";var e={n:t=>{var a=t&&t.__esModule?()=>t.default:()=>t;return e.d(a,{a}),a},d:(t,a)=>{for(var r in a)e.o(a,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:a[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{MessageProcessStatus:()=>
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,()=>(()=>{"use strict";var e={n:t=>{var a=t&&t.__esModule?()=>t.default:()=>t;return e.d(a,{a}),a},d:(t,a)=>{for(var r in a)e.o(a,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:a[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{MessageProcessStatus:()=>H,ParticipantRole:()=>E,ParticipantType:()=>F,UpdateType:()=>K,default:()=>z});const a=require("react/jsx-runtime"),r=require("@mui/material"),n=require("@mui/material/Stack");var i=e.n(n);const c=require("@mui/material/Table");var o=e.n(c);const s=require("@mui/material/TableBody");var l=e.n(s);const u=require("@mui/material/TableCell");var d=e.n(u);const p=require("@mui/material/TableContainer");var m=e.n(p);const f=require("@mui/material/TableHead");var b=e.n(f);const y=require("@mui/material/TablePagination");var g=e.n(y);const v=require("@mui/material/TableRow");var h=e.n(v);const x=require("@mui/material/TableSortLabel");var j=e.n(x);const T=require("@mui/material/Tooltip");var S=e.n(T);const O=require("@mui/material/Typography");var q=e.n(O);const P=require("react");var w;!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(w||(w={}));var D=function(){return D=Object.assign||function(e){for(var t,a=1,r=arguments.length;a<r;a++)for(var n in t=arguments[a])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},D.apply(this,arguments)};function k(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,a.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:D({},t),children:e.name})}const A=require("@mui/material/Alert");var N=e.n(A);const R=require("@mui/material/styles"),M=require("dompurify");var _=e.n(M);const C=require("marked");var H,K,E,F;!function(e){e.Running="running",e.Completed="completed",e.Error="error"}(H||(H={})),function(e){e.Append="append",e.Replace="replace"}(K||(K={})),function(e){e.Owner="owner",e.Member="member"}(E||(E={})),function(e){e.Human="human",e.Agent="agent"}(F||(F={}));const I=function(e){var t=(0,R.useTheme)(),r=(0,P.useState)(e.text),n=r[0],i=r[1],c=(0,P.useState)(""),o=c[0],s=c[1];function l(e){return"string"!=typeof e?(s("Some of the incoming text was not correctly formatted. Some data may be missing.")," [MISSING TEXT]"):e}function u(e){return(0,a.jsx)(q(),{component:"div",className:"rustic-markdown",dangerouslySetInnerHTML:{__html:(r=e,n=r.replace(/^[\u200B-\u200F\uFEFF]/,""),i=C.marked.parse(n,{async:!1,breaks:!0,gfm:!0}),_().sanitize(i))},sx:{"& table, & th, & td":{border:"1px solid ".concat(t.palette.divider)}}});var r,n,i}return(0,P.useEffect)(function(){if(e.updatedData&&e.updatedData.length>0){var t=e.text,a=e.updatedData.at(-1);if(e.updatedData.length>1&&(null==a?void 0:a.updateType)===K.Replace)t=l(a.text);else for(var r=0,n=e.updatedData;r<n.length;r++){var c=n[r],o=c.updateType||K.Append,s=l(c.text);o===K.Append?t+=s:o===K.Replace&&(t=s)}i(t)}},[e.text,e.updatedData]),(0,a.jsxs)(a.Fragment,{children:[e.title&&(0,a.jsx)(q(),{variant:"h6",children:e.title}),e.description&&u(e.description),u(n),o&&(0,a.jsx)(N(),{severity:"error",children:o})]})};var U;function L(){return(0,a.jsx)(k,{name:"expand_all"})}!function(e){e.Ascending="asc",e.Descending="desc"}(U||(U={}));const z=function(e){if(0===e.data.length)return(0,a.jsx)(q(),{variant:"body2",children:"No data available"});var t,n,c,s=e.data.length>10,u=(0,P.useState)({}),p=u[0],f=u[1],y=(0,P.useState)(s?10:-1),v=y[0],x=y[1],T=(0,P.useState)(0),O=T[0],w=T[1],D=(0,r.useTheme)(),k=Array.from(new Set(e.data.flatMap(function(e){return Object.keys(e)}))),A=e.headers||k.map(function(e){return{dataKey:e}}),N=(t=e.data,n=Object.keys(p)[0],c=p[n],n&&c?t.slice().sort(function(e,t){var a=Object.keys(p)[0],r=p[a];return e[a]<t[a]?r===U.Descending?1:-1:e[a]>t[a]?r===U.Descending?-1:1:0}):t),R=N.slice(O*v,O*v+v),M=v>0?R:N;function _(e){if(!p[e])return L}return(0,a.jsxs)(i(),{className:"rustic-table",spacing:1,children:[e.title&&(0,a.jsx)(q(),{variant:"h6",className:"rustic-table-title",children:e.title}),e.description&&(0,a.jsx)(I,{text:e.description}),(0,a.jsx)(m(),{className:"rustic-table-container",children:(0,a.jsxs)(o(),{"aria-label":e.title||"a table of data",size:"small",stickyHeader:!0,children:[A.length>0&&(0,a.jsx)(b(),{children:(0,a.jsx)(h(),{children:A.map(function(e,t){return(0,a.jsx)(d(),{sortDirection:p[e.dataKey]||!1,children:(0,a.jsx)(S(),{title:(n=e.dataKey,i=p[n],i?Object.keys(U)[Object.values(U).indexOf(i)]:"Sort"),children:(0,a.jsx)(j(),{active:!0,direction:p[e.dataKey],onClick:function(){return function(e){f(function(t){var a,r,n={};switch(t[e]){case U.Ascending:(a={})[e]=U.Descending,n=a;break;case U.Descending:n={};break;default:(r={})[e]=U.Ascending,n=r}return n})}(e.dataKey)},className:"rustic-table-header",IconComponent:_(e.dataKey),children:e.label||(r=e.dataKey,r.charAt(0).toUpperCase()+r.slice(1))})})},"header-".concat(t));var r,n,i})})}),(0,a.jsx)(l(),{children:M.map(function(e,t){return(0,a.jsx)(h(),{children:A.map(function(r,n){return(0,a.jsx)(d(),{children:e[r.dataKey]},"cell-".concat(t,"-").concat(n))})},"row-".concat(t))})})]})}),s&&(0,a.jsx)(g(),{className:"rustic-table-pagination",component:"div",count:e.data.length,rowsPerPage:v,labelRowsPerPage:"Rows:",page:O,onPageChange:function(e,t){return w(t)},onRowsPerPageChange:function(e){x(+e.target.value),w(0)},sx:{"& .MuiTablePagination-selectLabel":{color:D.palette.text.disabled}},classes:{toolbar:"rustic-table-toolbar",input:"rustic-table-input",spacer:"rustic-table-spacer",displayedRows:"rustic-table-displayed-rows",actions:"rustic-table-actions"}})]})};return t})());
|
|
@@ -19,8 +19,21 @@
|
|
|
19
19
|
visibility: hidden;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
.rustic-markdown p {
|
|
22
|
+
.rustic-markdown p:first-child {
|
|
23
23
|
margin-block-start: 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.rustic-markdown p:last-child {
|
|
24
27
|
margin-block-end: 0;
|
|
25
28
|
}
|
|
26
29
|
|
|
30
|
+
.rustic-markdown table {
|
|
31
|
+
border-collapse: collapse;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.rustic-markdown th,
|
|
35
|
+
.rustic-markdown td {
|
|
36
|
+
padding: 8px;
|
|
37
|
+
text-align: left;
|
|
38
|
+
}
|
|
39
|
+
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,()=>(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,()=>(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>O});const r=require("react/jsx-runtime"),n=require("@mui/material/Stack");var a=e.n(n);const i=require("@mui/material/Typography");var o=e.n(i);const u=require("@mui/system/useTheme");var c=e.n(u);const d=require("mermaid");var s=e.n(d);const l=require("react"),p=require("uuid"),m=require("@mui/material/Alert");var f=e.n(m);const v=require("@mui/material/styles"),y=require("dompurify");var h=e.n(y);const g=require("marked");var x,b,j,S;!function(e){e.Running="running",e.Completed="completed",e.Error="error"}(x||(x={})),function(e){e.Append="append",e.Replace="replace"}(b||(b={})),function(e){e.Owner="owner",e.Member="member"}(j||(j={})),function(e){e.Human="human",e.Agent="agent"}(S||(S={}));const q=function(e){var t=(0,v.useTheme)(),n=(0,l.useState)(e.text),a=n[0],i=n[1],u=(0,l.useState)(""),c=u[0],d=u[1];function s(e){return"string"!=typeof e?(d("Some of the incoming text was not correctly formatted. Some data may be missing.")," [MISSING TEXT]"):e}function p(e){return(0,r.jsx)(o(),{component:"div",className:"rustic-markdown",dangerouslySetInnerHTML:{__html:(n=e,a=n.replace(/^[\u200B-\u200F\uFEFF]/,""),i=g.marked.parse(a,{async:!1,breaks:!0,gfm:!0}),h().sanitize(i))},sx:{"& table, & th, & td":{border:"1px solid ".concat(t.palette.divider)}}});var n,a,i}return(0,l.useEffect)(function(){if(e.updatedData&&e.updatedData.length>0){var t=e.text,r=e.updatedData.at(-1);if(e.updatedData.length>1&&(null==r?void 0:r.updateType)===b.Replace)t=s(r.text);else for(var n=0,a=e.updatedData;n<a.length;n++){var o=a[n],u=o.updateType||b.Append,c=s(o.text);u===b.Append?t+=c:u===b.Replace&&(t=c)}i(t)}},[e.text,e.updatedData]),(0,r.jsxs)(r.Fragment,{children:[e.title&&(0,r.jsx)(o(),{variant:"h6",children:e.title}),e.description&&p(e.description),p(a),c&&(0,r.jsx)(f(),{severity:"error",children:c})]})};var T=function(){return T=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},T.apply(this,arguments)};const O=function(e){var t=(0,l.useRef)(null),n=(0,l.useState)(),i=n[0],u=n[1],d=c()(),m=(0,p.v4)();return(0,l.useEffect)(function(){var r="dark"===d.palette.mode?"dark":"neutral",n=d.typography.fontFamily;t.current&&(s().initialize(T({theme:r,themeVariables:{fontFamily:n}},e.config)),s().render("mermaid-svg-".concat(m),e.diagram,t.current).then(function(e){t.current&&(t.current.innerHTML=e.svg),u("")}).catch(function(){var e;null===(e=t.current)||void 0===e||e.replaceChildren(),u("Failed to render the diagram.")}))}),(0,r.jsxs)(a(),{className:"rustic-mermaid-container",children:[e.title&&(0,r.jsx)(o(),{variant:"h6",children:e.title}),e.description&&(0,r.jsx)(q,{text:e.description}),(0,r.jsx)("div",{className:"rustic-mermaid",ref:t}),i&&(0,r.jsx)(o(),{variant:"body2",children:i})]})};return t})());
|
|
@@ -14,8 +14,21 @@ perspective-viewer-datagrid-toolbar {
|
|
|
14
14
|
display: none;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
.rustic-markdown p {
|
|
17
|
+
.rustic-markdown p:first-child {
|
|
18
18
|
margin-block-start: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.rustic-markdown p:last-child {
|
|
19
22
|
margin-block-end: 0;
|
|
20
23
|
}
|
|
21
24
|
|
|
25
|
+
.rustic-markdown table {
|
|
26
|
+
border-collapse: collapse;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.rustic-markdown th,
|
|
30
|
+
.rustic-markdown td {
|
|
31
|
+
padding: 8px;
|
|
32
|
+
text-align: left;
|
|
33
|
+
}
|
|
34
|
+
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,()=>(()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{MessageProcessStatus:()=>m,ParticipantRole:()=>g,ParticipantType:()=>b,UpdateType:()=>v,default:()=>E,globalPerspectiveWorker:()=>q,initPerspective:()=>O});const n=require("react/jsx-runtime"),r=(require("@finos/perspective-viewer-datagrid"),require("@finos/perspective-viewer-d3fc"),require("@finos/perspective-viewer/dist/css/pro.css"),require("@finos/perspective-viewer/dist/css/pro-dark.css"),require("@mui/material/styles")),o=require("@mui/material/Typography");var i=e.n(o);const a=require("@mui/system/Stack");var s=e.n(a);const u=require("react"),c=require("@mui/material/Alert");var l=e.n(c);const p=require("dompurify");var d=e.n(p);const f=require("marked");var m,v,g,b;!function(e){e.Running="running",e.Completed="completed",e.Error="error"}(m||(m={})),function(e){e.Append="append",e.Replace="replace"}(v||(v={})),function(e){e.Owner="owner",e.Member="member"}(g||(g={})),function(e){e.Human="human",e.Agent="agent"}(b||(b={}));const h=function(e){var t=(0,u.useState)(e.text),
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,()=>(()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{MessageProcessStatus:()=>m,ParticipantRole:()=>g,ParticipantType:()=>b,UpdateType:()=>v,default:()=>E,globalPerspectiveWorker:()=>q,initPerspective:()=>O});const n=require("react/jsx-runtime"),r=(require("@finos/perspective-viewer-datagrid"),require("@finos/perspective-viewer-d3fc"),require("@finos/perspective-viewer/dist/css/pro.css"),require("@finos/perspective-viewer/dist/css/pro-dark.css"),require("@mui/material/styles")),o=require("@mui/material/Typography");var i=e.n(o);const a=require("@mui/system/Stack");var s=e.n(a);const u=require("react"),c=require("@mui/material/Alert");var l=e.n(c);const p=require("dompurify");var d=e.n(p);const f=require("marked");var m,v,g,b;!function(e){e.Running="running",e.Completed="completed",e.Error="error"}(m||(m={})),function(e){e.Append="append",e.Replace="replace"}(v||(v={})),function(e){e.Owner="owner",e.Member="member"}(g||(g={})),function(e){e.Human="human",e.Agent="agent"}(b||(b={}));const h=function(e){var t=(0,r.useTheme)(),o=(0,u.useState)(e.text),a=o[0],s=o[1],c=(0,u.useState)(""),p=c[0],m=c[1];function g(e){return"string"!=typeof e?(m("Some of the incoming text was not correctly formatted. Some data may be missing.")," [MISSING TEXT]"):e}function b(e){return(0,n.jsx)(i(),{component:"div",className:"rustic-markdown",dangerouslySetInnerHTML:{__html:(r=e,o=r.replace(/^[\u200B-\u200F\uFEFF]/,""),a=f.marked.parse(o,{async:!1,breaks:!0,gfm:!0}),d().sanitize(a))},sx:{"& table, & th, & td":{border:"1px solid ".concat(t.palette.divider)}}});var r,o,a}return(0,u.useEffect)(function(){if(e.updatedData&&e.updatedData.length>0){var t=e.text,n=e.updatedData.at(-1);if(e.updatedData.length>1&&(null==n?void 0:n.updateType)===v.Replace)t=g(n.text);else for(var r=0,o=e.updatedData;r<o.length;r++){var i=o[r],a=i.updateType||v.Append,u=g(i.text);a===v.Append?t+=u:a===v.Replace&&(t=u)}s(t)}},[e.text,e.updatedData]),(0,n.jsxs)(n.Fragment,{children:[e.title&&(0,n.jsx)(i(),{variant:"h6",children:e.title}),e.description&&b(e.description),b(a),p&&(0,n.jsx)(l(),{severity:"error",children:p})]})},y=require("@finos/perspective");var x=e.n(y);const _=require("@finos/perspective/dist/wasm/perspective-server.wasm"),S=require("@finos/perspective-viewer");var w=e.n(S);const j=require("@finos/perspective-viewer/dist/wasm/perspective-viewer.wasm");var k,q;function O(){return k||(k=Promise.all([x().init_server(_),w().init_client(j)]).then(function(){return x().worker()}).then(function(e){q=e}))}var T=function(){return T=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},T.apply(this,arguments)};function P(e){return e?e.reduce(function(e,t){var n=t.dataKey,r=t.label;return e[n]=r||n,e},{}):{}}const E=function(e){if(0===e.data.length)return(0,n.jsx)(i(),{variant:"body2",children:"No data available."});var t=(0,u.useRef)(null),o=(0,r.useTheme)(),a=(0,u.useState)(!1),c=a[0],l=a[1],p=(0,u.useState)(q),d=p[0],f=p[1],m=o.palette.mode,v="dark"===m?"Pro Dark":"Pro Light",g=P(e.headers),b="\n /* General Button Styles */\n button, .button:hover, #editor-container, .editable, #settings_button {\n border-radius: 16px !important;\n color: ".concat(o.palette.text.primary," !important;\n /* TODO: add background color after updating the theme */\n }\n \n #settings_button {\n border: 1px solid ").concat(o.palette.primary.light," !important;\n }\n \n /* Hide border for aggregate Selector */\n .aggregate-selector:hover {\n border: none !important;\n }\n \n /* Input and Select Elements */\n input, select, .noselect, #add-expression, .dropdown-width-container, \n .pivot-column-border, .pivot-column, .column-selector-column-border {\n border-radius: 8px !important;\n }\n \n /* Change background color */\n #settings_panel, #column_settings_sidebar {\n background: ").concat("dark"===m?"dark":"white"," !important;\n background-image: none !important;\n }\n \n /* Expression Edit Button */\n .expression-edit-button {\n display: none;\n }\n \n /* Add padding to expression input */\n #editor-container, .editable {\n padding: 8px !important;\n }\n \n /* Change Button Font Size */\n .button select, .button {\n font-size: 12px !important;\n }\n \n /* Button and Icon Colors */\n #status_bar .hover-target:hover .button>span {\n display:none !important;\n }\n \n #status_bar .hover-target.modal-target .button>span {\n display:none !important;\n }\n \n .button select:hover, .psp-expression-editor__button:hover, \n .sidebar_close_button_inner:hover {\n background-color: ").concat(o.palette.primary.light," !important;\n }\n \n /* Hide unused buttons */\n #debug_open_button.sidebar_close_button, .reset-default-style-disabled, \n .expression-edit-button, #theme, #status, #status_bar .input-sizer {\n display: none !important;\n }\n \n #status_bar .hover-target:hover, #status_bar .hover-target.modal-target {\n height: fit-content !important;\n }\n\n /* Enable Scrolling */\n #plugin_selector_container.open, #status_bar, #menu-bar, #app_panel {\n overflow: auto !important;\n }\n\n #settings_button:hover {\n color: ").concat(o.palette.primary.contrastText," !important;\n background-color: ").concat(o.palette.primary.main," !important;\n }\n ");(0,u.useEffect)(function(){f(q)},[q]);var y,x,_,S,w,j,k,O,E,D=e.config&&(x=(y=e.config).groupBy,_=y.splitBy,S=y.aggregates,w=y.sort,j=y.filter,k=y.columns,O=null==w?void 0:w.map(function(e){return[g[e[0]]||e[0],e[1]]}),E=S&&Object.fromEntries(Object.entries(S).map(function(e){var t=e[0],n=e[1];return[g[t]||t,n]})),{group_by:null==x?void 0:x.map(function(e){return g[e]||e}),split_by:null==_?void 0:_.map(function(e){return g[e]||e}),aggregates:E,sort:O,filter:j&&function(e){return e.map(function(e){return[g[e[0]]||e[0],e[1],e[e.length-1]]})}(j),columns:null==k?void 0:k.map(function(e){return g[e]||e})});return(0,u.useEffect)(function(){var n=null,r=null,o=!0;if(d){var i=t.current;d.table(function(e,t){var n=P(t);return e.map(function(e){for(var t={},r=0,o=Object.entries(e);r<o.length;r++){var i=o[r],a=i[0],s=i[1];t[n[a]||a]=s}return t})}(e.data,e.headers)).then(function(e){if(n=e,o){if(i){if(i.shadowRoot){var t=new CSSStyleSheet;t.replaceSync(b),i.shadowRoot.adoptedStyleSheets.push(t)}return i.load(n)}}else n&&(n.delete({lazy:!0}),n=null)}).then(function(){var t,n,r;if(o&&i){var a={date_format:{dateStyle:(null===(t=e.config)||void 0===t?void 0:t.dateStyle)||"medium"}},s={};return null===(r=null===(n=e.config)||void 0===n?void 0:n.dateColumns)||void 0===r||r.forEach(function(e){s[e]=a}),i.restore(T(T({},D),{theme:v,title:e.title,settings:!1,columns_config:s}))}}).then(function(){if(o&&i)return i.getView()}).then(function(n){var i;if(o){r=n;var a=null===(i=e.config)||void 0===i?void 0:i.expansionDepth;if("number"==typeof a&&r)return r.set_depth(a).then(function(){t.current&&t.current.resize()})}else n&&n.delete()}).catch(function(){l(!0)})}return function(){o=!1,r&&r.delete(),n&&n.delete({lazy:!0})}},[d,e.data,v,e.config]),c?(0,n.jsx)(i(),{variant:"body2",children:"Failed to create table from data."}):(0,n.jsxs)(s(),{direction:"column",className:"rustic-perspective-viz",children:[e.title&&(0,n.jsx)(i(),{variant:"h6",children:e.title}),e.description&&(0,n.jsx)(h,{text:e.description}),(0,n.jsx)("perspective-viewer",{ref:t,style:{fontFamily:o.typography.fontFamily}})]})};return t})());
|
|
@@ -1,5 +1,18 @@
|
|
|
1
|
-
.rustic-markdown p {
|
|
1
|
+
.rustic-markdown p:first-child {
|
|
2
2
|
margin-block-start: 0;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.rustic-markdown p:last-child {
|
|
3
6
|
margin-block-end: 0;
|
|
4
7
|
}
|
|
5
8
|
|
|
9
|
+
.rustic-markdown table {
|
|
10
|
+
border-collapse: collapse;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.rustic-markdown th,
|
|
14
|
+
.rustic-markdown td {
|
|
15
|
+
padding: 8px;
|
|
16
|
+
text-align: left;
|
|
17
|
+
}
|
|
18
|
+
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,()=>(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,()=>(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>S});const r=require("react/jsx-runtime"),n=require("@mui/material/Typography");var a=e.n(n);const o=require("@mui/system/Box");var i=e.n(o);const u=require("react"),s=require("react-plotly.js");var c=e.n(s);const l=require("@mui/material/Alert");var p=e.n(l);const d=require("@mui/material/styles"),m=require("dompurify");var f=e.n(m);const y=require("marked");var v,g,x,b;!function(e){e.Running="running",e.Completed="completed",e.Error="error"}(v||(v={})),function(e){e.Append="append",e.Replace="replace"}(g||(g={})),function(e){e.Owner="owner",e.Member="member"}(x||(x={})),function(e){e.Human="human",e.Agent="agent"}(b||(b={}));const h=function(e){var t=(0,d.useTheme)(),n=(0,u.useState)(e.text),o=n[0],i=n[1],s=(0,u.useState)(""),c=s[0],l=s[1];function m(e){return"string"!=typeof e?(l("Some of the incoming text was not correctly formatted. Some data may be missing.")," [MISSING TEXT]"):e}function v(e){return(0,r.jsx)(a(),{component:"div",className:"rustic-markdown",dangerouslySetInnerHTML:{__html:(n=e,o=n.replace(/^[\u200B-\u200F\uFEFF]/,""),i=y.marked.parse(o,{async:!1,breaks:!0,gfm:!0}),f().sanitize(i))},sx:{"& table, & th, & td":{border:"1px solid ".concat(t.palette.divider)}}});var n,o,i}return(0,u.useEffect)(function(){if(e.updatedData&&e.updatedData.length>0){var t=e.text,r=e.updatedData.at(-1);if(e.updatedData.length>1&&(null==r?void 0:r.updateType)===g.Replace)t=m(r.text);else for(var n=0,a=e.updatedData;n<a.length;n++){var o=a[n],u=o.updateType||g.Append,s=m(o.text);u===g.Append?t+=s:u===g.Replace&&(t=s)}i(t)}},[e.text,e.updatedData]),(0,r.jsxs)(r.Fragment,{children:[e.title&&(0,r.jsx)(a(),{variant:"h6",children:e.title}),e.description&&v(e.description),v(o),c&&(0,r.jsx)(p(),{severity:"error",children:c})]})};var j=function(){return j=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},j.apply(this,arguments)};const S=function(e){var t=j(j({},e.plotParams),{className:"rustic-plotly"});return t.config=j(j({},t.config),{displaylogo:!1,responsive:!0,editable:!1}),(0,r.jsxs)(i(),{className:"rustic-plotly-container",children:[e.title&&(0,r.jsx)(a(),{variant:"h6",children:e.title}),e.description&&(0,r.jsx)(h,{text:e.description}),(0,r.jsx)(c(),j({},t))]})};return t})());
|
|
@@ -17,11 +17,24 @@
|
|
|
17
17
|
visibility: visible;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
.rustic-markdown p {
|
|
20
|
+
.rustic-markdown p:first-child {
|
|
21
21
|
margin-block-start: 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.rustic-markdown p:last-child {
|
|
22
25
|
margin-block-end: 0;
|
|
23
26
|
}
|
|
24
27
|
|
|
28
|
+
.rustic-markdown table {
|
|
29
|
+
border-collapse: collapse;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.rustic-markdown th,
|
|
33
|
+
.rustic-markdown td {
|
|
34
|
+
padding: 8px;
|
|
35
|
+
text-align: left;
|
|
36
|
+
}
|
|
37
|
+
|
|
25
38
|
.rustic-popover-menu ul {
|
|
26
39
|
padding: 0;
|
|
27
40
|
min-width: 100px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,()=>(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>Z});const r=require("react/jsx-runtime"),n=require("@mui/material/Typography");var a=e.n(n);const o=require("@mui/system/Box");var i=e.n(o);const c=require("@mui/system/Stack");var u=e.n(c);const s=require("@mui/system/useTheme");var l=e.n(s);const d=require("axios");var p=e.n(d);const f=require("react"),m=require("react-dom/server"),v=require("vega"),h=require("vega-embed");var y=e.n(h);const b=require("@mui/material/Alert");var g=e.n(b);const x=require("dompurify");var j=e.n(x);const w=require("marked");var O,S,q,k;!function(e){e.Running="running",e.Completed="completed",e.Error="error"}(O||(O={})),function(e){e.Append="append",e.Replace="replace"}(S||(S={})),function(e){e.Owner="owner",e.Member="member"}(q||(q={})),function(e){e.Human="human",e.Agent="agent"}(k||(k={}));const T=function(e){var t=(0,f.useState)(e.text),n=t[0],o=t[1],i=(0,f.useState)(""),c=i[0],u=i[1];function s(e){return"string"!=typeof e?(u("Some of the incoming text was not correctly formatted. Some data may be missing.")," [MISSING TEXT]"):e}function l(e){return(0,r.jsx)(a(),{component:"div",className:"rustic-markdown",dangerouslySetInnerHTML:{__html:(t=e,n=t.replace(/^[\u200B-\u200F\uFEFF]/,""),o=w.marked.parse(n,{async:!1,breaks:!0,gfm:!0}),j().sanitize(o))}});var t,n,o}return(0,f.useEffect)(function(){if(e.updatedData&&e.updatedData.length>0){var t=e.text,r=e.updatedData.at(-1);if(e.updatedData.length>1&&(null==r?void 0:r.updateType)===S.Replace)t=s(r.text);else for(var n=0,a=e.updatedData;n<a.length;n++){var i=a[n],c=i.updateType||S.Append,u=s(i.text);c===S.Append?t+=u:c===S.Replace&&(t=u)}o(t)}},[e.text,e.updatedData]),(0,r.jsxs)(r.Fragment,{children:[e.title&&(0,r.jsx)(a(),{variant:"h6",children:e.title}),e.description&&l(e.description),l(n),c&&(0,r.jsx)(g(),{severity:"error",children:c})]})},F=require("@mui/material"),I=require("@mui/material/Button");var A=e.n(I);const R=require("@mui/material/Drawer");var D=e.n(R);const N=require("@mui/material/IconButton");var P=e.n(N);const E=require("@mui/material/ListItemText");var M=e.n(E);const C=require("@mui/material/Menu");var _=e.n(C);const L=require("@mui/material/MenuItem");var z=e.n(L);const B=require("@mui/material/styles"),G=require("@mui/material/Tooltip");var H=e.n(G);const W=require("@mui/system");var J=function(){return J=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},J.apply(this,arguments)};function Q(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,r.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:J({},t),children:e.name})}var U=function(){return U=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},U.apply(this,arguments)};function V(e){var t=(0,f.useState)(!1),n=t[0],o=t[1],i=(0,f.useRef)(null),c=(0,B.useTheme)(),u=(0,F.useMediaQuery)(c.breakpoints.down("md")),s=u?D():_(),l={borderRadius:"".concat(c.shape.borderRadius,"px"),border:"1px solid ".concat(c.palette.divider)};function d(e){return(0,r.jsxs)(r.Fragment,{children:[e.startDecorator&&(0,r.jsx)(W.Box,{sx:{color:"primary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-start-icon",children:e.startDecorator}),(0,r.jsx)(M(),{children:(0,r.jsx)(a(),{variant:"body2",children:e.label})}),e.endDecorator&&(0,r.jsx)(W.Box,{sx:{color:"secondary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-end-icon",children:e.endDecorator})]})}u&&(l=U(U({},l),{borderRadius:"".concat(c.shape.borderRadius,"px ").concat(c.shape.borderRadius,"px 0 0"),borderBottom:0}));var p=e.menuItems.map(function(e){return e.href?(0,r.jsx)(z(),{component:"a",onClick:function(){return o(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:d(e)},e.label):(0,r.jsx)(z(),{onClick:function(t){e.onClick&&e.onClick(t),o(!1)},disabled:!e.onClick,children:d(e)},e.label)});var m,v,h=u?{}:{anchorEl:i.current};return(0,r.jsxs)(r.Fragment,{children:[(m={onClick:function(e){e.stopPropagation(),o(!0)},"aria-label":e.ariaLabel,ref:i,className:"rustic-popover-menu-button"},v=(0,r.jsx)(Q,{name:"more_vert"}),e.buttonText?(0,r.jsx)(A(),U({},m,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,r.jsx)(H(),{title:e.ariaLabel,children:(0,r.jsx)(P(),U({},m,{children:e.icon?e.icon:v}))})),(0,r.jsx)(s,U({open:n,onClose:function(){return o(!1)}},h,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":U(U({},l),{backgroundImage:"none",boxShadow:c.shadows[2]})},children:p}))]})}var X=function(){return X=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},X.apply(this,arguments)},K=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,o=t.length;a<o;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))},Y="source_0";const Z=function(e){var t=e.theme,n=void 0===t?{dark:"dark"}:t,o=e.refreshIntervalInMs,c=void 0===o?0:o,s=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}(e,["theme","refreshIntervalInMs"]),d=(0,f.useRef)(null),h=(0,f.useRef)(null),b=(0,f.useState)(!1),g=b[0],x=b[1],j=l()(),w="dark"===j.palette.mode,O=j.typography.fontFamily,q=function(e,t){var r={method:t.method||"GET",headers:t.headers,responseType:"text",data:t.body};return(s.getAuthHeaders?s.getAuthHeaders().then(function(e){return r.headers=X(X({},r.headers),e.headers),r}):Promise.resolve(r)).then(function(t){return p()(e,t)}).then(function(e){return e.data})};function k(){var e=v.loader();return s.getAuthHeaders&&(e.http=q),e}var F={backgroundColor:j.palette.primary.main,color:j.palette.background.paper,borderRadius:j.shape.borderRadius+"px",padding:"4px 8px",fontSize:j.typography.caption.fontSize,fontFamily:O,fontWeight:j.typography.caption.fontWeight},I={formatTooltip:function(e,t){return(0,m.renderToStaticMarkup)((0,r.jsx)("div",{role:"tooltip",className:"rustic-vega-lite-tooltip-content",style:F,children:Object.entries(e).map(function(e){var n=e[0],a=e[1];return(0,r.jsxs)("div",{children:[(0,r.jsxs)("strong",{children:[t(n),":"]})," ",t(a)]},n)})}))},disableDefaultStyle:!0,id:"rustic-vega-lite-tooltip"},A=[{label:"Save as SVG"},{label:"Save as PNG"}];function R(){var e,t;if(d.current&&s.spec){var r=X(X({config:{font:O}},s.options),{theme:w?n.dark:n.light,tooltip:I,actions:!1,loader:k()});(null===(t=null===(e=s.options)||void 0===e?void 0:e.config)||void 0===t?void 0:t.font)||(r.config.font=O);var a=X(X({},s.spec),{name:Y});delete a.title,y()(d.current,a,r).then(function(e){var t=e.embedOptions,r=e.embedOptions.downloadFileName||"visualization";["svg","png"].map(function(n,a){var o="object"==typeof t.scaleFactor?t.scaleFactor[n]:t.scaleFactor;e.view.toImageURL(n,o).then(function(e){A[a].href=e,A[a].downloadFileName="".concat(r,".").concat(n)})}),h.current=e.view,x(!1),c>0&&function(){var e=this;if(h.current&&s.spec){D.current&&(clearInterval(D.current),D.current=null);var t=s.spec.data;if(t&&"object"==typeof t&&"url"in t&&t.url){var r=setInterval(function(){return r=e,n=void 0,o=function(){var e,r,n;return function(e,t){var r,n,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=c(0),i.throw=c(1),i.return=c(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(u){return function(c){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(r=1,n&&(a=2&c[0]?n.return:c[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,c[1])).done)return a;switch(n=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,n=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==c[0]&&2!==c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],n=0}finally{r=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,u])}}}(this,function(a){switch(a.label){case 0:if(!h.current)return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,k().load(t.url)];case 2:return e=a.sent(),r=JSON.parse(e),n=v.changeset().remove(function(){return!0}).insert(r),h.current.change(Y,n).run(),[3,4];case 3:return a.sent(),x(!0),[3,4];case 4:return[2]}})},new((a=void 0)||(a=Promise))(function(e,t){function i(e){try{u(o.next(e))}catch(e){t(e)}}function c(e){try{u(o.throw(e))}catch(e){t(e)}}function u(t){var r;t.done?e(t.value):(r=t.value,r instanceof a?r:new a(function(e){e(r)})).then(i,c)}u((o=o.apply(r,n||[])).next())});var r,n,a,o},c);D.current=r}}}()}).catch(function(){x(!0)})}}(0,f.useEffect)(function(){if(d.current){var e=null;return(e=new ResizeObserver(function(e){e.some(function(e){return e.contentRect.width>0})&&requestAnimationFrame(function(){R()})})).observe(d.current),requestAnimationFrame(function(){R()}),window.addEventListener("resize",t),function(){window.removeEventListener("resize",t),null==e||e.disconnect()}}function t(){requestAnimationFrame(function(){R()})}},[s.spec,w]),(0,f.useEffect)(function(){var e=setTimeout(function(){if(s.updatedData&&s.updatedData.length>0&&h.current)try{var e=function(e){var t,r=[],n=!1;if(e){var a=e.at(-1);if((null==a?void 0:a.updateType)===S.Replace){if((null===(t=a.spec)||void 0===t?void 0:t.data)&&"values"in a.spec.data){var o=a.spec.data.values;Array.isArray(o)&&(n=!0,r=K([],o,!0))}}else e.forEach(function(e){var t;if((null===(t=e.spec)||void 0===t?void 0:t.data)&&"values"in e.spec.data){var a=e.spec.data.values;Array.isArray(a)&&(e.updateType===S.Append?r.push.apply(r,a):e.updateType===S.Replace&&(n=!0,r=K([],a,!0)))}})}return v.changeset().remove(function(){return n}).insert(r)}(s.updatedData);h.current.change(Y,e).run()}catch(e){console.error("Failed to update streaming data:",e)}},1);return function(){return clearTimeout(e)}},[s.updatedData]);var D=(0,f.useRef)(null);return(0,f.useEffect)(function(){return function(){D.current&&clearInterval(D.current)}},[]),g?(0,r.jsx)(a(),{variant:"body2",children:"Failed to load the chart."}):(0,r.jsxs)(u(),{direction:"column",className:"rustic-vega-lite-container",children:[(0,r.jsx)(i(),{justifyContent:"end",display:"flex",children:(0,r.jsx)(V,{menuItems:A,ariaLabel:"Download options"})}),s.title&&(0,r.jsx)(a(),{variant:"h6",children:s.title}),s.description&&(0,r.jsx)(T,{text:s.description}),(0,r.jsxs)(i(),{textAlign:"center",mt:1,children:["string"==typeof s.spec.title&&(0,r.jsx)(a(),{variant:"subtitle2",children:s.spec.title}),s.spec.description&&(0,r.jsx)(a(),{variant:"caption",children:s.spec.description})]}),(0,r.jsx)("div",{ref:d,className:"rustic-vega-lite"})]})};return t})());
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,()=>(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>Z});const r=require("react/jsx-runtime"),n=require("@mui/material/Typography");var a=e.n(n);const o=require("@mui/system/Box");var i=e.n(o);const c=require("@mui/system/Stack");var u=e.n(c);const s=require("@mui/system/useTheme");var l=e.n(s);const d=require("axios");var p=e.n(d);const f=require("react"),m=require("react-dom/server"),v=require("vega"),h=require("vega-embed");var y=e.n(h);const b=require("@mui/material/Alert");var x=e.n(b);const g=require("@mui/material/styles"),j=require("dompurify");var w=e.n(j);const O=require("marked");var S,q,T,k;!function(e){e.Running="running",e.Completed="completed",e.Error="error"}(S||(S={})),function(e){e.Append="append",e.Replace="replace"}(q||(q={})),function(e){e.Owner="owner",e.Member="member"}(T||(T={})),function(e){e.Human="human",e.Agent="agent"}(k||(k={}));const F=function(e){var t=(0,g.useTheme)(),n=(0,f.useState)(e.text),o=n[0],i=n[1],c=(0,f.useState)(""),u=c[0],s=c[1];function l(e){return"string"!=typeof e?(s("Some of the incoming text was not correctly formatted. Some data may be missing.")," [MISSING TEXT]"):e}function d(e){return(0,r.jsx)(a(),{component:"div",className:"rustic-markdown",dangerouslySetInnerHTML:{__html:(n=e,o=n.replace(/^[\u200B-\u200F\uFEFF]/,""),i=O.marked.parse(o,{async:!1,breaks:!0,gfm:!0}),w().sanitize(i))},sx:{"& table, & th, & td":{border:"1px solid ".concat(t.palette.divider)}}});var n,o,i}return(0,f.useEffect)(function(){if(e.updatedData&&e.updatedData.length>0){var t=e.text,r=e.updatedData.at(-1);if(e.updatedData.length>1&&(null==r?void 0:r.updateType)===q.Replace)t=l(r.text);else for(var n=0,a=e.updatedData;n<a.length;n++){var o=a[n],c=o.updateType||q.Append,u=l(o.text);c===q.Append?t+=u:c===q.Replace&&(t=u)}i(t)}},[e.text,e.updatedData]),(0,r.jsxs)(r.Fragment,{children:[e.title&&(0,r.jsx)(a(),{variant:"h6",children:e.title}),e.description&&d(e.description),d(o),u&&(0,r.jsx)(x(),{severity:"error",children:u})]})},I=require("@mui/material"),A=require("@mui/material/Button");var R=e.n(A);const D=require("@mui/material/Drawer");var N=e.n(D);const P=require("@mui/material/IconButton");var E=e.n(P);const M=require("@mui/material/ListItemText");var C=e.n(M);const _=require("@mui/material/Menu");var L=e.n(_);const z=require("@mui/material/MenuItem");var B=e.n(z);const G=require("@mui/material/Tooltip");var H=e.n(G);const W=require("@mui/system");var J=function(){return J=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},J.apply(this,arguments)};function Q(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,r.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:J({},t),children:e.name})}var U=function(){return U=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},U.apply(this,arguments)};function V(e){var t=(0,f.useState)(!1),n=t[0],o=t[1],i=(0,f.useRef)(null),c=(0,g.useTheme)(),u=(0,I.useMediaQuery)(c.breakpoints.down("md")),s=u?N():L(),l={borderRadius:"".concat(c.shape.borderRadius,"px"),border:"1px solid ".concat(c.palette.divider)};function d(e){return(0,r.jsxs)(r.Fragment,{children:[e.startDecorator&&(0,r.jsx)(W.Box,{sx:{color:"primary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-start-icon",children:e.startDecorator}),(0,r.jsx)(C(),{children:(0,r.jsx)(a(),{variant:"body2",children:e.label})}),e.endDecorator&&(0,r.jsx)(W.Box,{sx:{color:"secondary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-end-icon",children:e.endDecorator})]})}u&&(l=U(U({},l),{borderRadius:"".concat(c.shape.borderRadius,"px ").concat(c.shape.borderRadius,"px 0 0"),borderBottom:0}));var p=e.menuItems.map(function(e){return e.href?(0,r.jsx)(B(),{component:"a",onClick:function(){return o(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:d(e)},e.label):(0,r.jsx)(B(),{onClick:function(t){e.onClick&&e.onClick(t),o(!1)},disabled:!e.onClick,children:d(e)},e.label)});var m,v,h=u?{}:{anchorEl:i.current};return(0,r.jsxs)(r.Fragment,{children:[(m={onClick:function(e){e.stopPropagation(),o(!0)},"aria-label":e.ariaLabel,ref:i,className:"rustic-popover-menu-button"},v=(0,r.jsx)(Q,{name:"more_vert"}),e.buttonText?(0,r.jsx)(R(),U({},m,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,r.jsx)(H(),{title:e.ariaLabel,children:(0,r.jsx)(E(),U({},m,{children:e.icon?e.icon:v}))})),(0,r.jsx)(s,U({open:n,onClose:function(){return o(!1)}},h,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":U(U({},l),{backgroundImage:"none",boxShadow:c.shadows[2]})},children:p}))]})}var X=function(){return X=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},X.apply(this,arguments)},K=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,o=t.length;a<o;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))},Y="source_0";const Z=function(e){var t=e.theme,n=void 0===t?{dark:"dark"}:t,o=e.refreshIntervalInMs,c=void 0===o?0:o,s=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}(e,["theme","refreshIntervalInMs"]),d=(0,f.useRef)(null),h=(0,f.useRef)(null),b=(0,f.useState)(!1),x=b[0],g=b[1],j=l()(),w="dark"===j.palette.mode,O=j.typography.fontFamily,S=function(e,t){var r={method:t.method||"GET",headers:t.headers,responseType:"text",data:t.body};return(s.getAuthHeaders?s.getAuthHeaders().then(function(e){return r.headers=X(X({},r.headers),e.headers),r}):Promise.resolve(r)).then(function(t){return p()(e,t)}).then(function(e){return e.data})};function T(){var e=v.loader();return s.getAuthHeaders&&(e.http=S),e}var k={backgroundColor:j.palette.primary.main,color:j.palette.background.paper,borderRadius:j.shape.borderRadius+"px",padding:"4px 8px",fontSize:j.typography.caption.fontSize,fontFamily:O,fontWeight:j.typography.caption.fontWeight},I={formatTooltip:function(e,t){return(0,m.renderToStaticMarkup)((0,r.jsx)("div",{role:"tooltip",className:"rustic-vega-lite-tooltip-content",style:k,children:Object.entries(e).map(function(e){var n=e[0],a=e[1];return(0,r.jsxs)("div",{children:[(0,r.jsxs)("strong",{children:[t(n),":"]})," ",t(a)]},n)})}))},disableDefaultStyle:!0,id:"rustic-vega-lite-tooltip"},A=[{label:"Save as SVG"},{label:"Save as PNG"}];function R(){var e,t;if(d.current&&s.spec){var r=X(X({config:{font:O}},s.options),{theme:w?n.dark:n.light,tooltip:I,actions:!1,loader:T()});(null===(t=null===(e=s.options)||void 0===e?void 0:e.config)||void 0===t?void 0:t.font)||(r.config.font=O);var a=X(X({},s.spec),{name:Y});delete a.title,y()(d.current,a,r).then(function(e){var t=e.embedOptions,r=e.embedOptions.downloadFileName||"visualization";["svg","png"].map(function(n,a){var o="object"==typeof t.scaleFactor?t.scaleFactor[n]:t.scaleFactor;e.view.toImageURL(n,o).then(function(e){A[a].href=e,A[a].downloadFileName="".concat(r,".").concat(n)})}),h.current=e.view,g(!1),c>0&&function(){var e=this;if(h.current&&s.spec){D.current&&(clearInterval(D.current),D.current=null);var t=s.spec.data;if(t&&"object"==typeof t&&"url"in t&&t.url){var r=setInterval(function(){return r=e,n=void 0,o=function(){var e,r,n;return function(e,t){var r,n,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=c(0),i.throw=c(1),i.return=c(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(u){return function(c){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(r=1,n&&(a=2&c[0]?n.return:c[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,c[1])).done)return a;switch(n=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,n=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==c[0]&&2!==c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],n=0}finally{r=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,u])}}}(this,function(a){switch(a.label){case 0:if(!h.current)return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,T().load(t.url)];case 2:return e=a.sent(),r=JSON.parse(e),n=v.changeset().remove(function(){return!0}).insert(r),h.current.change(Y,n).run(),[3,4];case 3:return a.sent(),g(!0),[3,4];case 4:return[2]}})},new((a=void 0)||(a=Promise))(function(e,t){function i(e){try{u(o.next(e))}catch(e){t(e)}}function c(e){try{u(o.throw(e))}catch(e){t(e)}}function u(t){var r;t.done?e(t.value):(r=t.value,r instanceof a?r:new a(function(e){e(r)})).then(i,c)}u((o=o.apply(r,n||[])).next())});var r,n,a,o},c);D.current=r}}}()}).catch(function(){g(!0)})}}(0,f.useEffect)(function(){if(d.current){var e=null;return(e=new ResizeObserver(function(e){e.some(function(e){return e.contentRect.width>0})&&requestAnimationFrame(function(){R()})})).observe(d.current),requestAnimationFrame(function(){R()}),window.addEventListener("resize",t),function(){window.removeEventListener("resize",t),null==e||e.disconnect()}}function t(){requestAnimationFrame(function(){R()})}},[s.spec,w]),(0,f.useEffect)(function(){var e=setTimeout(function(){if(s.updatedData&&s.updatedData.length>0&&h.current)try{var e=function(e){var t,r=[],n=!1;if(e){var a=e.at(-1);if((null==a?void 0:a.updateType)===q.Replace){if((null===(t=a.spec)||void 0===t?void 0:t.data)&&"values"in a.spec.data){var o=a.spec.data.values;Array.isArray(o)&&(n=!0,r=K([],o,!0))}}else e.forEach(function(e){var t;if((null===(t=e.spec)||void 0===t?void 0:t.data)&&"values"in e.spec.data){var a=e.spec.data.values;Array.isArray(a)&&(e.updateType===q.Append?r.push.apply(r,a):e.updateType===q.Replace&&(n=!0,r=K([],a,!0)))}})}return v.changeset().remove(function(){return n}).insert(r)}(s.updatedData);h.current.change(Y,e).run()}catch(e){console.error("Failed to update streaming data:",e)}},1);return function(){return clearTimeout(e)}},[s.updatedData]);var D=(0,f.useRef)(null);return(0,f.useEffect)(function(){return function(){D.current&&clearInterval(D.current)}},[]),x?(0,r.jsx)(a(),{variant:"body2",children:"Failed to load the chart."}):(0,r.jsxs)(u(),{direction:"column",className:"rustic-vega-lite-container",children:[(0,r.jsx)(i(),{justifyContent:"end",display:"flex",children:(0,r.jsx)(V,{menuItems:A,ariaLabel:"Download options"})}),s.title&&(0,r.jsx)(a(),{variant:"h6",children:s.title}),s.description&&(0,r.jsx)(F,{text:s.description}),(0,r.jsxs)(i(),{textAlign:"center",mt:1,children:["string"==typeof s.spec.title&&(0,r.jsx)(a(),{variant:"subtitle2",children:s.spec.title}),s.spec.description&&(0,r.jsx)(a(),{variant:"caption",children:s.spec.description})]}),(0,r.jsx)("div",{ref:d,className:"rustic-vega-lite"})]})};return t})());
|
|
@@ -53,11 +53,24 @@ span.rustic-icon-large {
|
|
|
53
53
|
font-size: 32px;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
.rustic-markdown p {
|
|
56
|
+
.rustic-markdown p:first-child {
|
|
57
57
|
margin-block-start: 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.rustic-markdown p:last-child {
|
|
58
61
|
margin-block-end: 0;
|
|
59
62
|
}
|
|
60
63
|
|
|
64
|
+
.rustic-markdown table {
|
|
65
|
+
border-collapse: collapse;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.rustic-markdown th,
|
|
69
|
+
.rustic-markdown td {
|
|
70
|
+
padding: 8px;
|
|
71
|
+
text-align: left;
|
|
72
|
+
}
|
|
73
|
+
|
|
61
74
|
.rustic-popover-menu ul {
|
|
62
75
|
padding: 0;
|
|
63
76
|
min-width: 100px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["@rustic-ai/ui-components"]=r():e["@rustic-ai/ui-components"]=r()}(global,()=>(()=>{"use strict";var e={n:r=>{var t=r&&r.__esModule?()=>r.default:()=>r;return e.d(t,{a:t}),t},d:(r,t)=>{for(var n in t)e.o(t,n)&&!e.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:t[n]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};e.r(r),e.d(r,{MessageProcessStatus:()=>
|
|
1
|
+
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["@rustic-ai/ui-components"]=r():e["@rustic-ai/ui-components"]=r()}(global,()=>(()=>{"use strict";var e={n:r=>{var t=r&&r.__esModule?()=>r.default:()=>r;return e.d(t,{a:t}),t},d:(r,t)=>{for(var n in t)e.o(t,n)&&!e.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:t[n]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};e.r(r),e.d(r,{MessageProcessStatus:()=>w,ParticipantRole:()=>S,ParticipantType:()=>N,UpdateType:()=>T,default:()=>Y});const t=require("react/jsx-runtime"),n=require("@mui/material/Box");var a=e.n(n);const i=require("@mui/material/Card");var o=e.n(i);const c=require("@mui/material/Stack");var s=e.n(c);const u=require("@mui/material/Typography");var l=e.n(u);const d=require("react");var m;function p(e){var r=["Sun","Mon","Tues","Wed","Thurs","Fri","Sat"][new Date(1e3*e).getDay()];return{shortName:r,fullName:{Sun:"Sunday",Mon:"Monday",Tues:"Tuesday",Wed:"Wednesday",Thurs:"Thursday",Fri:"Friday",Sat:"Saturday"}[r]}}!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(m||(m={}));var h=function(){return h=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var a in r=arguments[t])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},h.apply(this,arguments)};function x(e){e.name.replaceAll("_","-");var r={};return e.color&&(r={color:e.color}),(0,t.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:h({},r),children:e.name})}const v=require("@mui/material/Alert");var f=e.n(v);const y=require("@mui/material/styles"),b=require("dompurify");var j=e.n(b);const g=require("marked");var w,T,S,N;!function(e){e.Running="running",e.Completed="completed",e.Error="error"}(w||(w={})),function(e){e.Append="append",e.Replace="replace"}(T||(T={})),function(e){e.Owner="owner",e.Member="member"}(S||(S={})),function(e){e.Human="human",e.Agent="agent"}(N||(N={}));const D=function(e){var r=(0,y.useTheme)(),n=(0,d.useState)(e.text),a=n[0],i=n[1],o=(0,d.useState)(""),c=o[0],s=o[1];function u(e){return"string"!=typeof e?(s("Some of the incoming text was not correctly formatted. Some data may be missing.")," [MISSING TEXT]"):e}function m(e){return(0,t.jsx)(l(),{component:"div",className:"rustic-markdown",dangerouslySetInnerHTML:{__html:(n=e,a=n.replace(/^[\u200B-\u200F\uFEFF]/,""),i=g.marked.parse(a,{async:!1,breaks:!0,gfm:!0}),j().sanitize(i))},sx:{"& table, & th, & td":{border:"1px solid ".concat(r.palette.divider)}}});var n,a,i}return(0,d.useEffect)(function(){if(e.updatedData&&e.updatedData.length>0){var r=e.text,t=e.updatedData.at(-1);if(e.updatedData.length>1&&(null==t?void 0:t.updateType)===T.Replace)r=u(t.text);else for(var n=0,a=e.updatedData;n<a.length;n++){var o=a[n],c=o.updateType||T.Append,s=u(o.text);c===T.Append?r+=s:c===T.Replace&&(r=s)}i(r)}},[e.text,e.updatedData]),(0,t.jsxs)(t.Fragment,{children:[e.title&&(0,t.jsx)(l(),{variant:"h6",children:e.title}),e.description&&m(e.description),m(a),c&&(0,t.jsx)(f(),{severity:"error",children:c})]})},q=require("@mui/material"),M=require("@mui/material/Button");var I=e.n(M);const O=require("@mui/material/Drawer");var F=e.n(O);const k=require("@mui/material/IconButton");var C=e.n(k);const P=require("@mui/material/ListItemText");var R=e.n(P);const _=require("@mui/material/Menu");var A=e.n(_);const H=require("@mui/material/MenuItem");var B=e.n(H);const E=require("@mui/material/Tooltip");var L=e.n(E);const W=require("@mui/system");var U=function(){return U=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var a in r=arguments[t])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},U.apply(this,arguments)};function G(e){var r=(0,d.useState)(!1),n=r[0],a=r[1],i=(0,d.useRef)(null),o=(0,y.useTheme)(),c=(0,q.useMediaQuery)(o.breakpoints.down("md")),s=c?F():A(),u={borderRadius:"".concat(o.shape.borderRadius,"px"),border:"1px solid ".concat(o.palette.divider)};function m(e){return(0,t.jsxs)(t.Fragment,{children:[e.startDecorator&&(0,t.jsx)(W.Box,{sx:{color:"primary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-start-icon",children:e.startDecorator}),(0,t.jsx)(R(),{children:(0,t.jsx)(l(),{variant:"body2",children:e.label})}),e.endDecorator&&(0,t.jsx)(W.Box,{sx:{color:"secondary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-end-icon",children:e.endDecorator})]})}c&&(u=U(U({},u),{borderRadius:"".concat(o.shape.borderRadius,"px ").concat(o.shape.borderRadius,"px 0 0"),borderBottom:0}));var p=e.menuItems.map(function(e){return e.href?(0,t.jsx)(B(),{component:"a",onClick:function(){return a(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:m(e)},e.label):(0,t.jsx)(B(),{onClick:function(r){e.onClick&&e.onClick(r),a(!1)},disabled:!e.onClick,children:m(e)},e.label)});var h,v,f=c?{}:{anchorEl:i.current};return(0,t.jsxs)(t.Fragment,{children:[(h={onClick:function(e){e.stopPropagation(),a(!0)},"aria-label":e.ariaLabel,ref:i,className:"rustic-popover-menu-button"},v=(0,t.jsx)(x,{name:"more_vert"}),e.buttonText?(0,t.jsx)(I(),U({},h,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,t.jsx)(L(),{title:e.ariaLabel,children:(0,t.jsx)(C(),U({},h,{children:e.icon?e.icon:v}))})),(0,t.jsx)(s,U({open:n,onClose:function(){return a(!1)}},f,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":U(U({},u),{backgroundImage:"none",boxShadow:o.shadows[2]})},children:p}))]})}const Y=function(e){var r=(0,d.useState)(e.units),n=r[0],i=r[1];function c(r){return"metric"===e.units&&"imperial"===n?Math.round(1.8*r+32):"imperial"===e.units&&"metric"===n?Math.round(r*(5/9)-32):Math.round(r)}var u=new Date(1e3*e.weather[0].timestamp),m=p(e.weather[0].timestamp).shortName,h=u.getDate(),v=u.getFullYear().toString().slice(2),f="".concat(m," ").concat(h,"/").concat(v," TODAY"),y="HIGH: ".concat(c(e.weather[0].temp.high)," / LOW: ").concat(c(e.weather[0].temp.high)),b=e.weather.map(function(e,r){if(0!==r)return(0,t.jsxs)(o(),{variant:"outlined",className:"rustic-daily-weather-card",children:[(0,t.jsx)(l(),{variant:"h5",component:"span",color:"text.secondary","aria-label":p(e.timestamp).fullName,children:p(e.timestamp).shortName}),(0,t.jsx)("img",{src:e.weatherIcon.icon,alt:e.weatherIcon.description}),(0,t.jsxs)(l(),{variant:"body2",color:"text.secondary",children:["High: ",c(e.temp.high),"°"]}),(0,t.jsxs)(l(),{variant:"body2",color:"text.secondary",children:["Low: ",c(e.temp.low),"°"]})]},r)});return(0,t.jsxs)(o(),{variant:"outlined",className:"rustic-weather",children:[e.title&&(0,t.jsx)(l(),{variant:"h6",children:e.title}),e.description&&(0,t.jsx)(D,{text:e.description}),(0,t.jsx)(G,{ariaLabel:"Temperature units",menuItems:[{label:"Celsius",endDecorator:"°C",onClick:function(){return i("metric")}},{label:"Fahrenheit",endDecorator:"°F",onClick:function(){return i("imperial")}}]}),(0,t.jsxs)(s(),{alignItems:"center",children:[(0,t.jsx)(l(),{variant:"h4",component:"span",children:e.location}),(0,t.jsxs)(s(),{direction:"row",alignItems:"center",spacing:1,className:"rustic-current-weather-description",children:[(0,t.jsx)("img",{src:e.weather[0].weatherIcon.icon,alt:""}),(0,t.jsx)(l(),{variant:"body2",children:e.weather[0].weatherIcon.description})]}),e.weather[0].temp.current&&(0,t.jsxs)(l(),{variant:"h1",component:"span",className:"rustic-current-temp",children:[c(e.weather[0].temp.current),"°",function(e){switch(e){case"imperial":return"F";case"metric":return"C"}}(n)]}),(0,t.jsxs)(s(),{direction:"row",spacing:2,children:[(0,t.jsx)(l(),{variant:"overline",children:f}),(0,t.jsx)(l(),{variant:"overline",children:y})]})]}),(0,t.jsx)(a(),{className:"rustic-daily-weather-container",children:b}),e.weatherProvider&&(0,t.jsxs)(s(),{alignItems:"center",direction:"row",spacing:1,alignSelf:"center",className:"rustic-weather-attribution",children:[(0,t.jsx)(x,{name:"cloud"}),(0,t.jsx)(l(),{variant:"body2",children:"Weather data provided by ".concat(e.weatherProvider)})]})]})};return r})());
|
package/dist/index.css
CHANGED
|
@@ -33,11 +33,24 @@
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
.rustic-markdown p {
|
|
36
|
+
.rustic-markdown p:first-child {
|
|
37
37
|
margin-block-start: 0;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.rustic-markdown p:last-child {
|
|
38
41
|
margin-block-end: 0;
|
|
39
42
|
}
|
|
40
43
|
|
|
44
|
+
.rustic-markdown table {
|
|
45
|
+
border-collapse: collapse;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.rustic-markdown th,
|
|
49
|
+
.rustic-markdown td {
|
|
50
|
+
padding: 8px;
|
|
51
|
+
text-align: left;
|
|
52
|
+
}
|
|
53
|
+
|
|
41
54
|
.rustic-code-snippet {
|
|
42
55
|
border-radius: 16px 16px 4px 4px;
|
|
43
56
|
max-width: calc(100vw - 100px);
|