@rustic-ai/ui-components 0.0.32 → 0.0.34
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/dynamicForm/index.js +1 -1
- package/dist/components/filePreview/filePreview.d.ts +1 -0
- package/dist/components/filePreview/filePreview.d.ts.map +1 -1
- package/dist/components/helper.d.ts +6 -1
- package/dist/components/helper.d.ts.map +1 -1
- package/dist/components/icon/index.js +1 -1
- package/dist/components/index.d.ts +8 -6
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/input/baseInput/baseInput.d.ts.map +1 -1
- package/dist/components/input/emoji/emoji.d.ts +1 -0
- package/dist/components/input/emoji/emoji.d.ts.map +1 -1
- package/dist/components/input/emoji/index.js +1 -1
- package/dist/components/input/multimodal/multimodalInput/index.css +5 -2
- package/dist/components/input/multimodal/multimodalInput/index.js +1 -1
- package/dist/components/input/multimodal/multimodalInput/multimodalInput.d.ts +2 -2
- package/dist/components/input/multimodal/multimodalInput/multimodalInput.d.ts.map +1 -1
- package/dist/components/input/multimodal/uploader/index.css +4 -0
- package/dist/components/input/multimodal/uploader/index.js +1 -1
- package/dist/components/input/multimodal/uploader/uploader.d.ts.map +1 -1
- package/dist/components/input/textInput/index.css +1 -2
- package/dist/components/input/textInput/index.js +1 -1
- package/dist/components/messageCanvas/actions/copy/index.js +1 -1
- package/dist/components/messageCanvas/actions/index.js +1 -1
- package/dist/components/messageCanvas/actions/textToSpeech/index.js +1 -1
- package/dist/components/messageSpace/index.css +8 -2
- package/dist/components/messageSpace/index.js +1 -1
- package/dist/components/messageSpace/messageSpace.d.ts.map +1 -1
- package/dist/components/multipart/chatCompletion/chatCompletion.d.ts +11 -0
- package/dist/components/multipart/chatCompletion/chatCompletion.d.ts.map +1 -0
- package/dist/components/multipart/{index.css → chatCompletion/index.css} +4 -0
- package/dist/components/multipart/chatCompletion/index.d.ts +4 -0
- package/dist/components/multipart/chatCompletion/index.d.ts.map +1 -0
- package/dist/components/multipart/chatCompletion/index.js +1 -0
- package/dist/components/multipart/multipart/index.css +149 -0
- package/dist/components/multipart/{index.d.ts → multipart/index.d.ts} +1 -1
- package/dist/components/multipart/multipart/index.d.ts.map +1 -0
- package/dist/components/multipart/{index.js → multipart/index.js} +1 -1
- package/dist/components/multipart/{multipart.d.ts → multipart/multipart.d.ts} +2 -2
- package/dist/components/multipart/multipart/multipart.d.ts.map +1 -0
- package/dist/components/prompts/index.css +5 -0
- package/dist/components/prompts/index.d.ts +4 -0
- package/dist/components/prompts/index.d.ts.map +1 -0
- package/dist/components/prompts/index.js +1 -0
- package/dist/components/prompts/prompts.d.ts +12 -0
- package/dist/components/prompts/prompts.d.ts.map +1 -0
- package/dist/components/sharedDescription.d.ts +5 -0
- package/dist/components/sharedDescription.d.ts.map +1 -0
- package/dist/components/text/index.js +1 -1
- package/dist/components/types.d.ts +69 -4
- package/dist/components/types.d.ts.map +1 -1
- package/dist/components/visualization/perspectiveViz/index.js +1 -1
- package/dist/components/visualization/perspectiveViz/perspectiveViz.d.ts.map +1 -1
- package/dist/components/weather/index.js +1 -1
- package/dist/index.css +18 -4
- package/dist/index.js +1 -1
- package/dist/rusticTheme.d.ts +0 -1
- package/dist/rusticTheme.d.ts.map +1 -1
- package/dist/rusticTheme.js +1 -1
- package/package.json +35 -28
- package/dist/components/multipart/index.d.ts.map +0 -1
- package/dist/components/multipart/multipart.d.ts.map +0 -1
|
@@ -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,{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 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,{default:()=>S});const n=require("react/jsx-runtime"),r=require("@mui/material/Chip");var s=e.n(r);const o=require("@mui/system/Box");var a=e.n(o);const i=require("react");var c=e.n(i);const u=require("@mui/material/Typography");var l=e.n(u),d=function(){return d=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},d.apply(this,arguments)};const m=function(e){var t=e.messages[0],r=e.messages.slice(1),s=e.supportedElements[t.format];return(0,n.jsx)(n.Fragment,{children:s?c().createElement(s,d(d({sender:e.sender,ws:e.ws,messageId:t.id,conversationId:t.conversationId},t.data),r.length>0&&{updatedData:r.map((function(e){return e.data}))})):(0,n.jsxs)(l(),{variant:"body2",children:["Unsupported element format: ",t.format]})})};var f=function(){return f=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},f.apply(this,arguments)};function p(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,n.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:f({},t),children:e.name})}const v=require("@mui/material"),g=require("@mui/material/Card");var y=e.n(g);const h=require("@mui/material/Stack");var j,b=e.n(h);!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(j||(j={}));const w=function(e){return(0,n.jsx)(l(),{variant:"caption",color:"text.secondary",className:"rustic-timestamp",children:(t=e.timestamp,r=new Date(t),s=navigator.language,o={month:"short",day:"numeric"},a=new Date,i=r.getFullYear()!==a.getFullYear(),c=i?" at ":", ",i&&(o.year="numeric"),r.toLocaleDateString(s,o)+c+r.toLocaleTimeString(s,{hour:"numeric",minute:"2-digit",hour12:!0}))});var t,r,s,o,a,i,c},x=(0,i.forwardRef)((function(e,t){var r=(0,v.useTheme)(),s=e.inReplyTo?e.inReplyTo:e.message;return(0,n.jsxs)(b(),{id:s.id,className:"rustic-message-canvas",ref:t,children:[(0,n.jsxs)(b(),{direction:"row",alignItems:"center",spacing:1,className:"rustic-header",children:[e.getProfileComponent&&e.getProfileComponent(s),(0,n.jsx)(w,{timestamp:s.timestamp})]}),e.getActionsComponent&&e.getActionsComponent(e.message)&&(0,n.jsx)(y(),{variant:"outlined",className:"rustic-message-actions-container",sx:{boxShadow:r.shadows[1]},children:e.getActionsComponent(s)}),(0,n.jsxs)(y(),{variant:"outlined",className:"rustic-message-container",children:[e.children,e.inReplyTo&&(0,n.jsxs)(l(),{variant:"caption",color:"text.secondary",className:"rustic-footer",children:["Submitted by ",e.message.sender.name," at ",(0,n.jsx)(w,{timestamp:e.message.timestamp})]})]})]})}));var O=function(){return O=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},O.apply(this,arguments)},E=function(e,t,n){if(n||2===arguments.length)for(var r,s=0,o=t.length;s<o;s++)!r&&s in t||(r||(r=Array.prototype.slice.call(t,0,s)),r[s]=t[s]);return e.concat(r||Array.prototype.slice.call(t))};function R(e,t){var n;if(!(n=t.format.includes("update")?t.threadId:t.format.includes("Response")?t.inReplyTo:t.id))return e;var r=O({},e),s=(r[n]||[])[0];return t.format.includes("update")&&s&&s.sender.id!==t.sender.id&&(n=t.id),r[n]||(r[n]=[]),t.format.includes("Response")&&s?r[n]=[O(O({},s),{data:O(O({},s.data),t.data)}),t]:r[n]=E(E([],r[n],!0),[t],!1),r}function T(e){var t,r,o,c=(0,i.useRef)(null),u=(0,i.useRef)(null),l=(0,i.useRef)(),d=(0,i.useState)(!0),f=d[0],v=d[1],g=(0,i.useState)(!0),y=g[0],h=g[1],j=(0,i.useState)(!1),b=j[0],w=j[1],E=(0,i.useState)({}),T=E[0],S=E[1],C=Object.keys(T).length,N=(r=C,o=(0,i.useRef)(0),(0,i.useEffect)((function(){o.current=r})),o.current);function A(){h(!0),l.current&&clearTimeout(l.current),l.current=setTimeout((function(){h(!1)}),2e3)}function P(){var e=u.current,t=c.current;if(e&&t){var n=e.getBoundingClientRect().bottom,r=t.getBoundingClientRect().bottom;v(r-1<=n)}}function q(){if(function(){var e,t=null===(e=u.current)||void 0===e?void 0:e.querySelectorAll("video");return!t||0===t.length||Array.from(t).every((function(e){return e.readyState>=1}))}()){var e=u.current;w(!0),e&&setTimeout((function(){A(),e.scrollTop=e.scrollHeight}),0)}else setTimeout(q,1)}function D(e){S((function(t){return R(t,e)}))}return(0,i.useEffect)((function(){var e=u.current;if(P(),e)return e.addEventListener("scroll",P),window.addEventListener("resize",P),function(){e.removeEventListener("scroll",P),window.removeEventListener("resize",P)}}),[f]),(0,i.useEffect)((function(){q()}),[b]),(0,i.useEffect)((function(){f&&0!==N&&C>N&&(A(),q())}),[f,Object.keys(T).length]),(0,i.useEffect)((function(){var t,n={};null===(t=e.receivedMessages)||void 0===t||t.forEach((function(e){var t=R(n,e);n=t})),S(n)}),[null===(t=e.receivedMessages)||void 0===t?void 0:t.length]),(0,i.useEffect)((function(){e.ws.onReceive&&e.ws.onReceive(D)}),[]),(0,n.jsxs)(a(),{className:"rustic-message-space",children:[(0,n.jsxs)(a(),{ref:u,className:"rustic-message-container",children:[Object.keys(T).map((function(t,r){var s,o=T[t],a=o[o.length-1],i=a.format.includes("Response"),u=i&&{inReplyTo:o[0]};return"prompts"!==a.format?(0,n.jsx)(x,O({message:a},u,{getActionsComponent:e.getActionsComponent,getProfileComponent:e.getProfileComponent,ref:r===C-1?c:null,children:(0,n.jsx)(m,{ws:e.ws,sender:e.sender,messages:i?[o[0]]:o,supportedElements:e.supportedElements})}),t):"inConversation"===(null===(s=a.data)||void 0===s?void 0:s.position)?(0,n.jsx)("div",{ref:r===C-1?c:null,children:(0,n.jsx)(m,{ws:e.ws,sender:e.sender,messages:i?[o[0]]:o,supportedElements:e.supportedElements})},t):void 0})),!f&&!y&&(0,n.jsx)(s(),{variant:"rusticSecondary",className:"rustic-scroll-down-button",size:"medium",onClick:q,label:(0,n.jsxs)(n.Fragment,{children:[e.scrollDownLabel,(0,n.jsx)(p,{name:"arrow_downward"})]})})]}),function(t){var r,s=Object.values(t).flat(),o=s[s.length-1];return"prompts"===(null==o?void 0:o.format)&&"inConversation"!==(null===(r=null==o?void 0:o.data)||void 0===r?void 0:r.position)?(0,n.jsx)(m,{ws:e.ws,sender:e.sender,messages:[o],supportedElements:e.supportedElements}):null}(T)]})}T.defaultProps={scrollDownLabel:"Scroll down"};const S=T;return t})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageSpace.d.ts","sourceRoot":"","sources":["../../../src/components/messageSpace/messageSpace.tsx"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAA;AAQ3B,OAAsB,EACpB,KAAK,qBAAqB,EAC3B,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE9E,MAAM,WAAW,iBAAkB,SAAQ,qBAAqB;IAC9D,0LAA0L;IAC1L,EAAE,EAAE,eAAe,CAAA;IACnB,0GAA0G;IAC1G,MAAM,EAAE,MAAM,CAAA;IACd,2GAA2G;IAC3G,iBAAiB,EAAE,YAAY,CAAA;IAC/B,2IAA2I;IAC3I,gBAAgB,CAAC,EAAE,OAAO,EAAE,CAAA;IAC5B,yEAAyE;IACzE,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AA6DD;;;;;;EAME;AAEF,iBAAwB,YAAY,CAAC,KAAK,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"messageSpace.d.ts","sourceRoot":"","sources":["../../../src/components/messageSpace/messageSpace.tsx"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAA;AAQ3B,OAAsB,EACpB,KAAK,qBAAqB,EAC3B,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE9E,MAAM,WAAW,iBAAkB,SAAQ,qBAAqB;IAC9D,0LAA0L;IAC1L,EAAE,EAAE,eAAe,CAAA;IACnB,0GAA0G;IAC1G,MAAM,EAAE,MAAM,CAAA;IACd,2GAA2G;IAC3G,iBAAiB,EAAE,YAAY,CAAA;IAC/B,2IAA2I;IAC3I,gBAAgB,CAAC,EAAE,OAAO,EAAE,CAAA;IAC5B,yEAAyE;IACzE,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AA6DD;;;;;;EAME;AAEF,iBAAwB,YAAY,CAAC,KAAK,EAAE,iBAAiB,2CAmN5D;kBAnNuB,YAAY;;;;;eAAZ,YAAY"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import '../../../index.css';
|
|
2
|
+
import '../multipart/multipart.css';
|
|
3
|
+
import type { ChatCompletionProps } from '../../types';
|
|
4
|
+
/**
|
|
5
|
+
* The `ChatCompletion` component provides a flexible message interface
|
|
6
|
+
* that supports both textual content and file attachments within a single message.
|
|
7
|
+
* Its data structure closely mirrors OpenAI's [ChatCompletionRequest](https://platform.openai.com/docs/api-reference/chat),
|
|
8
|
+
* eliminating the need for data conversion to the Chat Completion format.
|
|
9
|
+
*/
|
|
10
|
+
export default function ChatCompletion(props: ChatCompletionProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=chatCompletion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chatCompletion.d.ts","sourceRoot":"","sources":["../../../../src/components/multipart/chatCompletion/chatCompletion.tsx"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAA;AAC3B,OAAO,4BAA4B,CAAA;AAUnC,OAAO,KAAK,EAAE,mBAAmB,EAAW,MAAM,aAAa,CAAA;AAS/D;;;;;GAKG;AAEH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,KAAK,EAAE,mBAAmB,2CAwDhE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/multipart/chatCompletion/index.ts"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,cAAc,MAAM,kBAAkB,CAAA;AAE7C,eAAe,cAAc,CAAA"}
|
|
@@ -0,0 +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={9767:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(8732),i=(r(2015),function(){return i=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},i.apply(this,arguments)});function a(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,n.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:i({},t),children:e.name})}},3110:(e,t,r)=>{r.d(t,{default:()=>n});const n=r(9767).A},2500:(e,t,r)=>{r.d(t,{default:()=>n}),r(1737);const n=r(7131).A},1737:(e,t,r)=>{r(8732),r(5642),r(785),r(7447),r(2015)},7131:(e,t,r)=>{r.d(t,{A:()=>l});var n=r(8732),i=r(785),a=r.n(i),o=r(7447),s=r.n(o);r(2015);const l=function(e){return(0,n.jsx)(a(),{variant:"body2",className:"rustic-text",children:s().sanitize(e.text)})}},5642:e=>{e.exports=require("@mui/material/Alert")},785:e=>{e.exports=require("@mui/material/Typography")},7447:e=>{e.exports=require("dompurify")},2015:e=>{e.exports=require("react")},8732:e=>{e.exports=require("react/jsx-runtime")}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,r),a.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 i=r(8732);const a=require("@mui/material/Box");var o=r.n(a);const s=require("@mui/material/IconButton");var l=r.n(s);const c=require("@mui/material/Tooltip");var u=r.n(c),d=r(2015);const m=require("@mui/material/Card");var p=r.n(m);const f=require("@mui/material/Modal");var h=r.n(f);const x=require("@mui/material/styles");var v,j=r(785),b=r.n(j);!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(v||(v={}));var y=r(9767);const w=require("@mui/material/TextField");var g=r.n(w);const N=require("@mui/material/useMediaQuery");var C=r.n(N);const k=require("@mui/system/Stack");var P=r.n(k);const q=require("@mui/system/useTheme");var O=r.n(q);const S=require("pdfjs-dist"),T=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,i.jsx)(u(),{title:r.label,children:(0,i.jsx)("span",{children:(0,i.jsx)(l(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,i.jsx)(y.A,{name:r.symbol})})})})};var _={pdf:function(e){var t,r=(0,d.useRef)(null),n=(0,d.useState)(1),a=n[0],s=n[1],l=(0,d.useState)(1),c=l[0],u=l[1],m=(0,d.useState)(1),f=m[0],h=m[1],x=(0,d.useState)(!1),v=x[0],j=x[1],y=(0,d.useState)(),w=y[0],N=y[1],k=O()(),q=C()(k.breakpoints.down("sm")),_=C()(k.breakpoints.between("sm","md"));if(t=e.url,!/\/[^/]+\.pdf$/.test(t))return(0,i.jsx)(p(),{variant:"outlined",className:"rustic-pdf-error",children:(0,i.jsx)(b(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var A=(0,d.useState)((function(){return q?.5:_?1:1.5})),F=A[0],D=A[1];return(0,d.useEffect)((function(){S.GlobalWorkerOptions.workerSrc||(S.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(S.version,"/pdf.worker.mjs")),S.getDocument({url:"".concat(e.url)}).promise.then((function(e){u(e.numPages),function(e){e.getPage(a).then((function(e){var t=e.getViewport({scale:F}),n=r.current;if(n){var i=n.getContext("2d");if(i){var a=window.devicePixelRatio||1;n.style.width="".concat(t.width,"px"),n.style.height="".concat(t.height,"px"),n.width=t.width*a,n.height=t.height*a;var o={canvasContext:i,viewport:t,transform:[a,0,0,a,0,0]};w&&w.cancel();var s=e.render(o);N(s),s.promise.then((function(){N(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){j(!0)}))}),[e.url,a,F]),v?(0,i.jsx)(p(),{variant:"outlined",className:"rustic-pdf-error",children:(0,i.jsx)(b(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,i.jsxs)(p(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,i.jsxs)(o(),{className:"rustic-pdf-viewer-header",children:[(0,i.jsx)(T,{action:"zoomOut",onClick:function(){D((function(e){return Math.max(e-.2,.2)}))}}),(0,i.jsx)(T,{action:"zoomIn",onClick:function(){D((function(e){return e+.2}))}})]}),(0,i.jsx)(o(),{className:"rustic-pdf-viewer-body",children:(0,i.jsx)(o(),{className:"rustic-pdf-viewer-body-inner",children:(0,i.jsx)("canvas",{ref:r})})}),(0,i.jsxs)(P(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,i.jsx)(T,{action:"previousPage",onClick:function(){a>1&&(s(a-1),h(a-1))},isDisabled:1===a}),(0,i.jsx)(b(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,i.jsx)(g(),{type:"number",value:f,onChange:function(e){var t=parseInt(e.target.value);h(t),!isNaN(t)&&t>=1&&t<=c&&s(t)},size:"small",className:"rustic-pdf-page-input"}),(0,i.jsxs)(b(),{variant:"body1",className:"rustic-page-indicator",children:["of ",c]}),(0,i.jsx)(T,{action:"nextPage",onClick:function(){a<c&&(s(a+1),h(a+1))},isDisabled:a===c})]})]})}};function A(e){var t=(0,x.useTheme)(),r=(0,d.useState)(!1),n=r[0],a=r[1];function o(){a(!1)}var s,c,m=e.file.url&&(s=e.file.url.split("."))[s.length-1].toLowerCase(),f=m&&e.supportedViewers?e.supportedViewers[m]:null,v=!!f,j=e.showFullName?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width",w=v?" rustic-cursor-pointer":"",g="rustic-file-preview ".concat(j).concat(w),N=e.showFullName?e.file.name:(c=e.file.name).length<=15?c:c.substring(0,12)+"...";return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(p(),{className:g,variant:"outlined",sx:{boxShadow:t.shadows[1]},onClick:function(){a(!0)},children:[(0,i.jsx)(b(),{variant:"subtitle2",className:"rustic-file-preview-name",children:N}),(0,i.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:e.children})]}),v&&(0,i.jsx)(h(),{open:n,onClose:o,className:"rustic-file-preview-modal",children:(0,i.jsxs)("div",{className:"rustic-modal-content",children:[(0,i.jsx)(u(),{title:"Close",children:(0,i.jsx)(l(),{onClick:o,className:"rustic-close-button",children:(0,i.jsx)(y.A,{name:"close"})})}),e.file.url&&(0,i.jsx)(f,{url:e.file.url})]})})]})}A.defaultProps={supportedViewers:_,showFullName:!0};var F=r(3110),D=r(2500);function z(e){return new URL(e).pathname.split("/").pop()}const M=function(e){return(0,i.jsx)(o(),{className:"rustic-multipart",children:e.messages.map((function(t){return"string"==typeof t.content?(0,i.jsx)(D.default,{text:t.content}):(r=t.content,n=[],a="",r.map((function(t){if("text"===t.type)a+=t.text;else if(t.type.endsWith("_url")){var r=t[t.type].url,o={url:r,name:t[t.type].name||z(r)},s=(0,i.jsx)(A,{file:o,showFullName:e.showFullName,children:o.url&&(0,i.jsx)(u(),{title:"Download",className:"rustic-shift-to-right-by-8",children:(0,i.jsx)(l(),{component:"a",href:o.url,download:o.name,children:(0,i.jsx)(F.default,{name:"download"})})})});n.push(s)}})),(0,i.jsxs)(i.Fragment,{children:[a.length>0&&(0,i.jsx)(D.default,{text:a}),n.length>0&&(0,i.jsx)(o(),{className:"rustic-files",children:n})]}));var r,n,a}))})};return n})()));
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
.rustic-multipart {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: 16px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
body {
|
|
8
|
+
margin: 0;
|
|
9
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
|
10
|
+
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
|
11
|
+
sans-serif;
|
|
12
|
+
-webkit-font-smoothing: antialiased;
|
|
13
|
+
-moz-osx-font-smoothing: grayscale;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
code {
|
|
17
|
+
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
|
18
|
+
monospace;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.rustic-fit-container {
|
|
22
|
+
object-fit: contain;
|
|
23
|
+
width: 100%;
|
|
24
|
+
height: 100%;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.rustic-files {
|
|
28
|
+
display: flex;
|
|
29
|
+
gap: 8px;
|
|
30
|
+
flex-wrap: wrap;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.rustic-cursor-pointer {
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.rustic-align-self-center {
|
|
38
|
+
align-self: center;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.rustic-shift-to-right-by-8 {
|
|
42
|
+
margin-right: -8px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.rustic-file-preview {
|
|
46
|
+
position: relative;
|
|
47
|
+
display: flex;
|
|
48
|
+
align-items: center;
|
|
49
|
+
padding: 8px 16px;
|
|
50
|
+
justify-content: space-between;
|
|
51
|
+
height: 56px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.rustic-fixed-file-preview-width {
|
|
55
|
+
width: 220px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.rustic-flexible-file-preview-width {
|
|
59
|
+
min-width: 220px;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.rustic-file-preview-name {
|
|
63
|
+
margin-right: 8px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.rustic-file-preview-modal {
|
|
67
|
+
width: 90vw;
|
|
68
|
+
height: 90vh;
|
|
69
|
+
display: flex;
|
|
70
|
+
align-self: center;
|
|
71
|
+
justify-self: center;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.rustic-file-preview-modal .rustic-modal-content {
|
|
75
|
+
position: relative;
|
|
76
|
+
width: 100%;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.rustic-modal-content .rustic-close-button {
|
|
80
|
+
position: absolute;
|
|
81
|
+
top: 16px;
|
|
82
|
+
right: 16px;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
span.rustic-icon-large {
|
|
86
|
+
font-size: 32px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.rustic-pdf-viewer {
|
|
90
|
+
width: 100%;
|
|
91
|
+
height: 100%;
|
|
92
|
+
display: flex;
|
|
93
|
+
flex-direction: column;
|
|
94
|
+
padding: 16px;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.rustic-pdf-error {
|
|
98
|
+
padding: 16px;
|
|
99
|
+
width: fit-content;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.rustic-pdf-viewer .rustic-pdf-viewer-header {
|
|
103
|
+
display: flex;
|
|
104
|
+
align-items: center;
|
|
105
|
+
margin-bottom: 8px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.rustic-pdf-viewer .rustic-pdf-canvas {
|
|
109
|
+
flex: 1;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.rustic-pdf-viewer .rustic-pdf-page-input > div {
|
|
113
|
+
height: 24px;
|
|
114
|
+
width: 56px;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.rustic-pdf-viewer .rustic-pdf-page-input input {
|
|
118
|
+
text-align: center;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.rustic-pdf-viewer
|
|
122
|
+
.rustic-pdf-page-input
|
|
123
|
+
input[type='number']::-webkit-inner-spin-button {
|
|
124
|
+
display: none;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.rustic-pdf-viewer .rustic-page-indicator {
|
|
128
|
+
display: flex;
|
|
129
|
+
align-items: center;
|
|
130
|
+
gap: 8px;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.rustic-pdf-viewer-body {
|
|
134
|
+
flex: 1;
|
|
135
|
+
display: flex;
|
|
136
|
+
justify-content: center;
|
|
137
|
+
overflow: auto;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.rustic-pdf-viewer-body-inner {
|
|
141
|
+
overflow: auto;
|
|
142
|
+
width: fit-content;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.rustic-text {
|
|
146
|
+
white-space: break-spaces;
|
|
147
|
+
overflow-wrap: break-word;
|
|
148
|
+
}
|
|
149
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/multipart/multipart/index.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAA;AAExB,OAAO,SAAS,MAAM,aAAa,CAAA;AAEnC,mBAAmB,aAAa,CAAA;AAChC,eAAe,SAAS,CAAA"}
|
|
@@ -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 i in t)e.o(t,i)&&!e.o(r,i)&&Object.defineProperty(r,i,{enumerable:!0,get:t[i]})},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,{default:()=>R});const t=require("react/jsx-runtime"),i=require("@mui/material/IconButton");var n=e.n(i);const a=require("@mui/material/Tooltip");var o=e.n(a);const s=require("@mui/system/Box");var l=e.n(s);const c=require("react"),u=require("@mui/material/Card");var d=e.n(u);const m=require("@mui/material/Modal");var f=e.n(m);const p=require("@mui/material/styles"),h=require("@mui/material/Typography");var x
|
|
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 i in t)e.o(t,i)&&!e.o(r,i)&&Object.defineProperty(r,i,{enumerable:!0,get:t[i]})},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,{default:()=>R});const t=require("react/jsx-runtime"),i=require("@mui/material/IconButton");var n=e.n(i);const a=require("@mui/material/Tooltip");var o=e.n(a);const s=require("@mui/system/Box");var l=e.n(s);const c=require("react"),u=require("@mui/material/Card");var d=e.n(u);const m=require("@mui/material/Modal");var f=e.n(m);const p=require("@mui/material/styles"),h=require("@mui/material/Typography");var v,x=e.n(h);!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(v||(v={}));var j=function(){return j=Object.assign||function(e){for(var r,t=1,i=arguments.length;t<i;t++)for(var n in r=arguments[t])Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);return e},j.apply(this,arguments)};function b(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:j({},r),children:e.name})}const w=require("@mui/material/Box");var y=e.n(w);const g=require("@mui/material/TextField");var N=e.n(g);const C=require("@mui/material/useMediaQuery");var k=e.n(C);const P=require("@mui/system/Stack");var q=e.n(P);const O=require("@mui/system/useTheme");var S=e.n(O);const T=require("pdfjs-dist"),_=function(e){var r={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"}},i=(r[e.action].label.replaceAll(" ","-").toLowerCase(),r[e.action]);return(0,t.jsx)(o(),{title:i.label,children:(0,t.jsx)("span",{children:(0,t.jsx)(n(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,t.jsx)(b,{name:i.symbol})})})})};var F={pdf:function(e){var r,i=(0,c.useRef)(null),n=(0,c.useState)(1),a=n[0],o=n[1],s=(0,c.useState)(1),l=s[0],u=s[1],m=(0,c.useState)(1),f=m[0],p=m[1],h=(0,c.useState)(!1),v=h[0],j=h[1],b=(0,c.useState)(),w=b[0],g=b[1],C=S()(),P=k()(C.breakpoints.down("sm")),O=k()(C.breakpoints.between("sm","md"));if(r=e.url,!/\/[^/]+\.pdf$/.test(r))return(0,t.jsx)(d(),{variant:"outlined",className:"rustic-pdf-error",children:(0,t.jsx)(x(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var F=(0,c.useState)((function(){return P?.5:O?1:1.5})),D=F[0],z=F[1];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")),T.getDocument({url:"".concat(e.url)}).promise.then((function(e){u(e.numPages),function(e){e.getPage(a).then((function(e){var r=e.getViewport({scale:D}),t=i.current;if(t){var n=t.getContext("2d");if(n){var a=window.devicePixelRatio||1;t.style.width="".concat(r.width,"px"),t.style.height="".concat(r.height,"px"),t.width=r.width*a,t.height=r.height*a;var o={canvasContext:n,viewport:r,transform:[a,0,0,a,0,0]};w&&w.cancel();var s=e.render(o);g(s),s.promise.then((function(){g(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){j(!0)}))}),[e.url,a,D]),v?(0,t.jsx)(d(),{variant:"outlined",className:"rustic-pdf-error",children:(0,t.jsx)(x(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,t.jsxs)(d(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,t.jsxs)(y(),{className:"rustic-pdf-viewer-header",children:[(0,t.jsx)(_,{action:"zoomOut",onClick:function(){z((function(e){return Math.max(e-.2,.2)}))}}),(0,t.jsx)(_,{action:"zoomIn",onClick:function(){z((function(e){return e+.2}))}})]}),(0,t.jsx)(y(),{className:"rustic-pdf-viewer-body",children:(0,t.jsx)(y(),{className:"rustic-pdf-viewer-body-inner",children:(0,t.jsx)("canvas",{ref:i})})}),(0,t.jsxs)(q(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,t.jsx)(_,{action:"previousPage",onClick:function(){a>1&&(o(a-1),p(a-1))},isDisabled:1===a}),(0,t.jsx)(x(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,t.jsx)(N(),{type:"number",value:f,onChange:function(e){var r=parseInt(e.target.value);p(r),!isNaN(r)&&r>=1&&r<=l&&o(r)},size:"small",className:"rustic-pdf-page-input"}),(0,t.jsxs)(x(),{variant:"body1",className:"rustic-page-indicator",children:["of ",l]}),(0,t.jsx)(_,{action:"nextPage",onClick:function(){a<l&&(o(a+1),p(a+1))},isDisabled:a===l})]})]})}};function D(e){var r=(0,p.useTheme)(),i=(0,c.useState)(!1),a=i[0],s=i[1];function l(){s(!1)}var u,m,h=e.file.url&&(u=e.file.url.split("."))[u.length-1].toLowerCase(),v=h&&e.supportedViewers?e.supportedViewers[h]:null,j=!!v,w=e.showFullName?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width",y=j?" rustic-cursor-pointer":"",g="rustic-file-preview ".concat(w).concat(y),N=e.showFullName?e.file.name:(m=e.file.name).length<=15?m:m.substring(0,12)+"...";return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(d(),{className:g,variant:"outlined",sx:{boxShadow:r.shadows[1]},onClick:function(){s(!0)},children:[(0,t.jsx)(x(),{variant:"subtitle2",className:"rustic-file-preview-name",children:N}),(0,t.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:e.children})]}),j&&(0,t.jsx)(f(),{open:a,onClose:l,className:"rustic-file-preview-modal",children:(0,t.jsxs)("div",{className:"rustic-modal-content",children:[(0,t.jsx)(o(),{title:"Close",children:(0,t.jsx)(n(),{onClick:l,className:"rustic-close-button",children:(0,t.jsx)(b,{name:"close"})})}),e.file.url&&(0,t.jsx)(v,{url:e.file.url})]})})]})}D.defaultProps={supportedViewers:F,showFullName:!0};const z=require("dompurify");var M=e.n(z);const I=function(e){return(0,t.jsx)(x(),{variant:"body2",className:"rustic-text",children:M().sanitize(e.text)})},R=function(e){return(0,t.jsxs)(l(),{className:"rustic-multipart",children:[e.text&&(0,t.jsx)(I,{text:e.text}),(r=e.files.map((function(r,i){return(0,t.jsx)(D,{file:r,showFullName:e.showFullName,children:r.url&&(0,t.jsx)(o(),{title:"Download",className:"rustic-shift-to-right-by-8",children:(0,t.jsx)(n(),{component:"a",href:r.url,download:r.name,children:(0,t.jsx)(b,{name:"download"})})})},i)})),(0,t.jsx)(l(),{className:"rustic-files",children:r}))]});var r};return r})()));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import '
|
|
1
|
+
import '../../../index.css';
|
|
2
2
|
import './multipart.css';
|
|
3
|
-
import type { MultipartProps } from '
|
|
3
|
+
import type { MultipartProps } from '../../types';
|
|
4
4
|
/** The `Multipart` component is a versatile message format designed to accommodate both textual content and file attachments within a single message interface. */
|
|
5
5
|
export default function Multipart(props: MultipartProps): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
//# sourceMappingURL=multipart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multipart.d.ts","sourceRoot":"","sources":["../../../../src/components/multipart/multipart/multipart.tsx"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAA;AAC3B,OAAO,iBAAiB,CAAA;AAUxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD,mKAAmK;AACnK,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,KAAK,EAAE,cAAc,2CA8BtD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/prompts/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAA;AAEtB,OAAO,OAAO,MAAM,WAAW,CAAA;AAE/B,eAAe,OAAO,CAAA"}
|
|
@@ -0,0 +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 o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},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"),o=require("@mui/material/Box");var n=e.n(o);const a=require("@mui/material/Chip");var i=e.n(a);require("react");const u=require("uuid"),s=function(e){var t=e.prompts.map((function(t,o){return(0,r.jsx)(i(),{onClick:function(){return r=t,o=(new Date).toISOString(),n={id:(0,u.v4)(),timestamp:o,sender:e.sender,conversationId:e.conversationId,format:"text",data:{text:r}},void e.ws.send(n);var r,o,n},variant:"rusticSecondary",size:"small",className:"rustic-prompt",label:t},o)}));return(0,r.jsx)(n(),{className:e.className,children:t})};return t})()));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import './prompts.css';
|
|
2
|
+
import type { PromptsProps } from '../types';
|
|
3
|
+
/** The `Prompts` component renders a list of actionable prompts that users can click to send a predefined message.
|
|
4
|
+
|
|
5
|
+
To use the `Prompts` component within `MessageSpace`, you need to add prompts to the supportedElements map and include an additional property, `position`, in the `data` field of the message.
|
|
6
|
+
The `position` property determines where the prompts are displayed and can be one of the following:
|
|
7
|
+
|
|
8
|
+
- `inConversation`: Prompts are displayed at the top, integrated with other chat messages.
|
|
9
|
+
- `hoverOverInput` (default): Prompts are displayed above the input field at the bottom of the chat interface. Note that prompts with this position will only appear if they are part of the last message in the message list.
|
|
10
|
+
*/
|
|
11
|
+
export default function Prompts(props: PromptsProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../src/components/prompts/prompts.tsx"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAA;AAOtB,OAAO,KAAK,EAAW,YAAY,EAAE,MAAM,UAAU,CAAA;AAErD;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,KAAK,EAAE,YAAY,2CAkClD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sharedDescription.d.ts","sourceRoot":"","sources":["../../src/components/sharedDescription.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAEzD,eAAO,MAAM,yBAAyB,EAAE,SAIvC,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,SAmB/B,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,SAwB3B,CAAA"}
|
|
@@ -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={
|
|
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={1737:(e,t,r)=>{r.d(t,{A:()=>p});var o=r(8732),a=r(5642),n=r.n(a),i=r(785),s=r.n(i),u=r(7447),d=r.n(u),c=r(2015);const p=function(e){var t=(0,c.useState)(d().sanitize(e.text)),r=t[0],a=t[1],i=(0,c.useState)(""),u=i[0],p=i[1];return(0,c.useEffect)((function(){if(e.updatedData&&e.updatedData.length>0){for(var t=e.text,r=0,o=e.updatedData;r<o.length;r++){var n=o[r];"string"!=typeof n.text&&(t+=" [MISSING TEXT]",p("Some of the incoming text was not correctly formatted. Some data may be missing.")),t+=n.text}a(d().sanitize(t))}}),[e.text,e.updatedData]),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(s(),{variant:"body2",children:r}),u&&(0,o.jsx)(n(),{severity:"error",children:u})]})}},7131:(e,t,r)=>{r.d(t,{A:()=>u});var o=r(8732),a=r(785),n=r.n(a),i=r(7447),s=r.n(i);r(2015);const u=function(e){return(0,o.jsx)(n(),{variant:"body2",className:"rustic-text",children:s().sanitize(e.text)})}},5642:e=>{e.exports=require("@mui/material/Alert")},785:e=>{e.exports=require("@mui/material/Typography")},7447:e=>{e.exports=require("dompurify")},2015:e=>{e.exports=require("react")},8732:e=>{e.exports=require("react/jsx-runtime")}},t={};function r(o){var a=t[o];if(void 0!==a)return a.exports;var n=t[o]={exports:{}};return e[o](n,n.exports,r),n.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 o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},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 o={};r.r(o),r.d(o,{StreamingText:()=>a.A,Text:()=>n.A,default:()=>i});var a=r(1737),n=r(7131);const i=n.A;return o})()));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import type React from 'react';
|
|
2
2
|
import type { MessageSpaceProps } from './messageSpace/messageSpace';
|
|
3
3
|
export type MessageData = {
|
|
4
4
|
[key: string]: any;
|
|
@@ -192,6 +192,8 @@ export interface BaseInputProps {
|
|
|
192
192
|
enableSpeechToText?: boolean;
|
|
193
193
|
/** Specifies the maximum number of emoji search results to display when the user enters a search query. The search query is triggered when the user types in a format like `:text`. */
|
|
194
194
|
maximumEmojiSearchResults?: number;
|
|
195
|
+
/** URL to fetch the emoji data from. You need to host the emoji data by yourself. If not provided, the default url will be used. */
|
|
196
|
+
emojiDataSource?: string;
|
|
195
197
|
}
|
|
196
198
|
export interface TextInputProps extends Omit<BaseInputProps, 'send' | 'isSendEnabled'> {
|
|
197
199
|
/** WebSocket connection to send and receive messages to and from a backend.*/
|
|
@@ -208,14 +210,14 @@ export interface UploadOption {
|
|
|
208
210
|
export interface UploaderProps {
|
|
209
211
|
/** The types of files that are allowed to be selected for upload. For safety reasons, only allow file types that can be handled by your server. Avoid accepting executable file types like .exe, .bat, or .msi. For more information, refer to the [mdn web docs](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers). */
|
|
210
212
|
acceptedFileTypes: string;
|
|
211
|
-
/** The API endpoint where files will be uploaded. File id will be appended to the end of API endpoint. */
|
|
213
|
+
/** The API endpoint where files will be uploaded. File id will be appended to the end of API endpoint. The response should include the URL of the uploaded file, and the send button will not be enabled until all files have been uploaded. */
|
|
212
214
|
uploadFileEndpoint: string;
|
|
213
215
|
/** The API endpoint to delete/cancel uploaded files. File id will be appended to the end of API endpoint. */
|
|
214
216
|
deleteFileEndpoint: string;
|
|
215
217
|
/** Used in the API request to link the file with the message that's going to be sent. */
|
|
216
218
|
messageId: string;
|
|
217
|
-
/** A function to handle changes in the file list. The parent component should use this to track file names and handle submit accordingly. */
|
|
218
|
-
onFileUpdate: (action: 'add' | 'remove', fileName: string) => void;
|
|
219
|
+
/** A function to handle changes in the file list. The parent component should use this to track file names and handle submit accordingly. Url is only required for the 'update' action. */
|
|
220
|
+
onFileUpdate: (action: 'add' | 'remove' | 'update', fileName: string, url?: string) => void;
|
|
219
221
|
/** Optional HTML div where the errors should be shown. */
|
|
220
222
|
errorMessagesContainer?: HTMLDivElement;
|
|
221
223
|
/** Optional HTML div where the filePreviews should be shown. */
|
|
@@ -232,6 +234,8 @@ export interface UploaderProps {
|
|
|
232
234
|
};
|
|
233
235
|
/** Defines the available options for file upload, displayed within a popover menu. If no options are provided, an upload icon button will be displayed by default.*/
|
|
234
236
|
uploadOptions?: UploadOption[];
|
|
237
|
+
/** A function to fetch and format existing file data when a file upload fails due to a conflict error (HTTP status code 409). The returned value will be used to determine a unique file name by appending an incremented number to the base name. */
|
|
238
|
+
listFiles?: () => Promise<FileData[]>;
|
|
235
239
|
}
|
|
236
240
|
export type MultimodalInputProps = TextInputProps & Omit<UploaderProps, 'messageId' | 'onFileUpdate' | 'filePreviewsContainer' | 'errorMessagesContainer'>;
|
|
237
241
|
export interface ConversationProps {
|
|
@@ -250,6 +254,15 @@ export interface QuestionFormat extends DataFormat {
|
|
|
250
254
|
}
|
|
251
255
|
export interface QuestionProps extends QuestionFormat, ConversationProps {
|
|
252
256
|
}
|
|
257
|
+
export interface PromptsFormat {
|
|
258
|
+
/** A list of prompt strings for users to select from. These prompts will be displayed as interactive elements in the UI. */
|
|
259
|
+
prompts: string[];
|
|
260
|
+
position?: 'inConversation' | 'hoverOverInput';
|
|
261
|
+
}
|
|
262
|
+
export interface PromptsProps extends PromptsFormat, ConversationProps {
|
|
263
|
+
/** An optional className to apply to the prompts container. */
|
|
264
|
+
className?: string;
|
|
265
|
+
}
|
|
253
266
|
export interface PDFViewerProps {
|
|
254
267
|
/** The url of the PDF file to be displayed. */
|
|
255
268
|
url: string;
|
|
@@ -294,4 +307,56 @@ export interface FormFormat extends DataFormat {
|
|
|
294
307
|
}
|
|
295
308
|
export interface DynamicFormProps extends FormFormat, ConversationProps {
|
|
296
309
|
}
|
|
310
|
+
interface ContentBase {
|
|
311
|
+
type: 'text' | 'image_url' | 'input_audio' | 'file_url';
|
|
312
|
+
}
|
|
313
|
+
export interface ContentTextPart extends ContentBase {
|
|
314
|
+
type: 'text';
|
|
315
|
+
text: string;
|
|
316
|
+
}
|
|
317
|
+
export interface ContentImagePart extends ContentBase {
|
|
318
|
+
type: 'image_url';
|
|
319
|
+
image_url: {
|
|
320
|
+
url: string;
|
|
321
|
+
detail?: string;
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
export interface ContentAudioPart extends ContentBase {
|
|
325
|
+
type: 'input_audio';
|
|
326
|
+
input_audio: {
|
|
327
|
+
data: string;
|
|
328
|
+
format: string;
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
export interface ContentFilePart extends ContentBase {
|
|
332
|
+
type: 'file_url';
|
|
333
|
+
file_url: {
|
|
334
|
+
url: string;
|
|
335
|
+
name?: string;
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
export type Content = ContentTextPart | ContentImagePart | ContentAudioPart | ContentFilePart;
|
|
339
|
+
export interface ChatCompletionRequest {
|
|
340
|
+
/** A list of messages combined into a single displayable message. Supports various content types, including text, images and files. */
|
|
341
|
+
messages: {
|
|
342
|
+
content: string | Content[];
|
|
343
|
+
role: string;
|
|
344
|
+
}[];
|
|
345
|
+
}
|
|
346
|
+
export interface ChatCompletionProps extends DataFormat, ChatCompletionRequest {
|
|
347
|
+
/**
|
|
348
|
+
* An object mapping file extensions to their respective viewer components.
|
|
349
|
+
* Each key represents a file type (e.g., 'pdf', 'jpg'), and the corresponding value is a React component
|
|
350
|
+
* that takes a `url` prop and renders the appropriate viewer for that file type. This prop is used to decide
|
|
351
|
+
* which viewer component should be used to open and display the file within the modal.
|
|
352
|
+
*/
|
|
353
|
+
supportedViewers?: {
|
|
354
|
+
[key: string]: React.ComponentType<{
|
|
355
|
+
url: string;
|
|
356
|
+
}>;
|
|
357
|
+
};
|
|
358
|
+
/** Setting this to true will display long file names in full. If set to false, long names will be shortened. */
|
|
359
|
+
showFullName?: boolean;
|
|
360
|
+
}
|
|
361
|
+
export {};
|
|
297
362
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/components/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/components/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAGpE,MAAM,MAAM,WAAW,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,CAAA;AAEhD,uEAAuE;AACvE,MAAM,WAAW,MAAM;IACrB,sBAAsB;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,sCAAsC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,EAAE,MAAM,CAAA;IACtB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,WAAW,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM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AI,EAAE,WAAW,CAAA;IACjB,SAAS,EAAE;QACT,GAAG,EAAE,MAAM,CAAA;QACX,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;CACF;AAED,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD,IAAI,EAAE,aAAa,CAAA;IACnB,WAAW,EAAE;QACX,IAAI,EAAE,MAAM,CAAA;QACZ,MAAM,EAAE,MAAM,CAAA;KACf,CAAA;CACF;AAED,MAAM,WAAW,eAAgB,SAAQ,WAAW;IAClD,IAAI,EAAE,UAAU,CAAA;IAChB,QAAQ,EAAE;QACR,GAAG,EAAE,MAAM,CAAA;QACX,IAAI,CAAC,EAAE,MAAM,CAAA;KACd,CAAA;CACF;AAED,MAAM,MAAM,OAAO,GACf,eAAe,GACf,gBAAgB,GAChB,gBAAgB,GAChB,eAAe,CAAA;AAEnB,MAAM,WAAW,qBAAqB;IACpC,uIAAuI;IACvI,QAAQ,EAAE;QAAE,OAAO,EAAE,MAAM,GAAG,OAAO,EAAE,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAC1D;AAED,MAAM,WAAW,mBAAoB,SAAQ,UAAU,EAAE,qBAAqB;IAC5E;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,aAAa,CAAC;YAAE,GAAG,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,CAAA;IAC1E,gHAAgH;IAChH,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB"}
|
|
@@ -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,{default:()=>b});const n=require("react/jsx-runtime"),r=(require("@finos/perspective-viewer/dist/esm/perspective-viewer.inline.js"),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("@finos/perspective/dist/esm/perspective.inline.js"));var o=e.n(r);const i=require("@mui/material/styles"),a=require("@mui/material/Typography");var s=e.n(a);const u=require("@mui/system/Stack");var c=e.n(u);const p=require("react");var l=function(){return l=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},l.apply(this,arguments)};function d(e){return e?e.reduce((function(e,t){var n=t.dataKey,r=t.label;return e[n]=r||n,e}),{}):{}}const b=function(e){if(0===e.data.length)return(0,n.jsx)(s(),{variant:"body2",children:"No data available."});var t=(0,p.useRef)(null),r=(0,i.useTheme)(),a=(0,p.useState)(!1),u=a[0],b=a[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,{default:()=>b});const n=require("react/jsx-runtime"),r=(require("@finos/perspective-viewer/dist/esm/perspective-viewer.inline.js"),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("@finos/perspective/dist/esm/perspective.inline.js"));var o=e.n(r);const i=require("@mui/material/styles"),a=require("@mui/material/Typography");var s=e.n(a);const u=require("@mui/system/Stack");var c=e.n(u);const p=require("react");var l=function(){return l=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},l.apply(this,arguments)};function d(e){return e?e.reduce((function(e,t){var n=t.dataKey,r=t.label;return e[n]=r||n,e}),{}):{}}const b=function(e){if(0===e.data.length)return(0,n.jsx)(s(),{variant:"body2",children:"No data available."});var t=(0,p.useRef)(null),r=(0,i.useTheme)(),a=(0,p.useState)(!1),u=a[0],b=a[1],m=r.palette.mode,f="dark"===m?"Pro Dark":"Pro Light",g=d(e.headers),v="\n /* General Button Styles */\n button, .button:hover, #editor-container, .editable, #settings_button {\n border-radius: 16px !important;\n color: ".concat(r.palette.text.primary," !important;\n /* TODO: add background color after updating the theme */\n }\n \n #settings_button {\n border: 1px solid ").concat(r.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(r.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(r.palette.primary.contrastText," !important;\n background-color: ").concat(r.palette.primary.main," !important;\n }\n ");var h,y,_,x,j,S,w,k,O,q=e.config&&(y=(h=e.config).groupBy,_=h.splitBy,x=h.aggregates,j=h.sort,S=h.filter,w=h.columns,k=null==j?void 0:j.map((function(e){return[g[e[0]]||e[0],e[1]]})),O=x&&Object.fromEntries(Object.entries(x).map((function(e){var t=e[0],n=e[1];return[g[t]||t,n]}))),{group_by:null==y?void 0:y.map((function(e){return g[e]||e})),split_by:null==_?void 0:_.map((function(e){return g[e]||e})),aggregates:O,sort:k,filter:S&&function(e){return e.map((function(e){return[g[e[0]]||e[0],e[1],e[e.length-1]]}))}(S),columns:null==w?void 0:w.map((function(e){return g[e]||e}))});return(0,p.useEffect)((function(){o().worker().then((function(t){return t.table(function(e,t){var n=d(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(n){t.current&&t.current.load(n).then((function(){t.current.restore(l(l({},q),{theme:f,title:e.title,settings:!1})).then((function(){if(t.current.shadowRoot){var e=new CSSStyleSheet;e.replaceSync(v),t.current.shadowRoot.adoptedStyleSheets.push(e)}}))})).catch((function(){b(!0)}))}))}),[e.data,f]),u?(0,n.jsx)(s(),{variant:"body2",children:"Failed to create table from data."}):(0,n.jsxs)(c(),{direction:"column",className:"rustic-perspective-viz",children:[e.title&&(0,n.jsx)(s(),{variant:"h6",children:e.title}),e.description&&(0,n.jsx)(s(),{variant:"body1",children:e.description}),(0,n.jsx)("perspective-viewer",{ref:t,style:{fontFamily:r.typography.fontFamily}})]})};return t})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"perspectiveViz.d.ts","sourceRoot":"","sources":["../../../../src/components/visualization/perspectiveViz/perspectiveViz.tsx"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAA;AAC7B,OAAO,iEAAiE,CAAA;AACxE,OAAO,oCAAoC,CAAA;AAC3C,OAAO,gCAAgC,CAAA;AACvC,OAAO,4CAA4C,CAAA;AACnD,OAAO,iDAAiD,CAAA;AAcxD,OAAO,KAAK,EAEV,SAAS,EAET,WAAW,EAEZ,MAAM,aAAa,CAAA;AAiBpB,wBAAgB,kBAAkB,CAChC,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,EACpD,OAAO,CAAC,EAAE,WAAW,EAAE,qCAWxB;AAED;;;;;;;GAOG;AACH,iBAAS,cAAc,CAAC,KAAK,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"perspectiveViz.d.ts","sourceRoot":"","sources":["../../../../src/components/visualization/perspectiveViz/perspectiveViz.tsx"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAA;AAC7B,OAAO,iEAAiE,CAAA;AACxE,OAAO,oCAAoC,CAAA;AAC3C,OAAO,gCAAgC,CAAA;AACvC,OAAO,4CAA4C,CAAA;AACnD,OAAO,iDAAiD,CAAA;AAcxD,OAAO,KAAK,EAEV,SAAS,EAET,WAAW,EAEZ,MAAM,aAAa,CAAA;AAiBpB,wBAAgB,kBAAkB,CAChC,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,EACpD,OAAO,CAAC,EAAE,WAAW,EAAE,qCAWxB;AAED;;;;;;;GAOG;AACH,iBAAS,cAAc,CAAC,KAAK,EAAE,SAAS,2CAiMvC;AAED,eAAe,cAAc,CAAA"}
|