@rustic-ai/ui-components 0.0.20 → 0.0.21
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.js +1 -1
- package/dist/components/codeSnippet/index.js +1 -1
- package/dist/components/elementRenderer/elementRenderer.d.ts +2 -2
- package/dist/components/elementRenderer/elementRenderer.d.ts.map +1 -1
- package/dist/components/elementRenderer/index.js +1 -1
- package/dist/components/image/index.js +1 -1
- package/dist/components/input/multimodal/multimodalInput/index.js +1 -1
- package/dist/components/input/multimodal/uploader/index.js +1 -1
- package/dist/components/input/textInput/index.js +1 -1
- package/dist/components/map/index.js +1 -1
- package/dist/components/markdown/index.js +1 -1
- package/dist/components/media/audio/index.js +1 -1
- package/dist/components/media/video/index.js +1 -1
- package/dist/components/messageCanvas/actions/action.d.ts +3 -3
- package/dist/components/messageCanvas/actions/action.d.ts.map +1 -1
- package/dist/components/messageCanvas/actions/copy/copyText.d.ts +2 -2
- package/dist/components/messageCanvas/actions/copy/copyText.d.ts.map +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/messageCanvas/actions/textToSpeech/textToSpeech.d.ts +2 -2
- package/dist/components/messageCanvas/actions/textToSpeech/textToSpeech.d.ts.map +1 -1
- package/dist/components/messageCanvas/messageCanvas.d.ts +5 -5
- package/dist/components/messageCanvas/messageCanvas.d.ts.map +1 -1
- package/dist/components/messageSpace/index.js +1 -1
- package/dist/components/messageSpace/messageSpace.d.ts +6 -3
- package/dist/components/messageSpace/messageSpace.d.ts.map +1 -1
- package/dist/components/{promptBuilder/mockWebSocket.d.ts → mockWebSocket.d.ts} +1 -1
- package/dist/components/mockWebSocket.d.ts.map +1 -0
- package/dist/components/multipart/index.js +1 -1
- package/dist/components/multipart/multipart.d.ts +2 -2
- package/dist/components/multipart/multipart.d.ts.map +1 -1
- package/dist/components/participantsContainer/index.d.ts +2 -1
- package/dist/components/participantsContainer/index.d.ts.map +1 -1
- package/dist/components/participantsContainer/index.js +1 -1
- package/dist/components/participantsContainer/participantsContainer.d.ts +14 -1
- package/dist/components/participantsContainer/participantsContainer.d.ts.map +1 -1
- package/dist/components/pdfViewer/index.js +1 -1
- package/dist/components/promptBuilder/index.js +1 -1
- package/dist/components/promptBuilder/promptBuilder.d.ts.map +1 -1
- package/dist/components/question/index.js +1 -1
- package/dist/components/table/index.js +1 -1
- package/dist/components/text/index.js +1 -1
- package/dist/components/timestamp/index.d.ts.map +1 -1
- package/dist/components/timestamp/index.js +1 -0
- package/dist/components/types.d.ts +4 -20
- package/dist/components/types.d.ts.map +1 -1
- package/dist/components/visualization/perspectiveViz/index.js +1 -1
- package/dist/components/weather/index.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/components/promptBuilder/mockWebSocket.d.ts.map +0 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import './messageCanvas.css';
|
|
2
2
|
import React, { type ReactNode } from 'react';
|
|
3
|
-
import type {
|
|
3
|
+
import type { Message } from '../types';
|
|
4
4
|
export interface MessageContainerProps {
|
|
5
5
|
/** A function that returns a React element to display sender details, like names and/or avatars. */
|
|
6
|
-
getProfileComponent?: (message:
|
|
6
|
+
getProfileComponent?: (message: Message) => ReactNode;
|
|
7
7
|
/** A function that returns a single React element which may be composed of several actions supported for the message, such as editing, copying, and deleting, etc.
|
|
8
8
|
* In case no actions are applicable or available for a particular message, the function may return `undefined`.
|
|
9
9
|
* This approach offers flexibility in tailoring message interactions to specific application requirements.
|
|
10
10
|
* To define individual message actions, developers can extend the `Action` component's functionality.
|
|
11
11
|
* One such example is the `CopyText` component.
|
|
12
12
|
*/
|
|
13
|
-
getActionsComponent?: (message:
|
|
13
|
+
getActionsComponent?: (message: Message) => ReactNode | undefined;
|
|
14
14
|
}
|
|
15
15
|
export interface MessageCanvasProps extends MessageContainerProps {
|
|
16
|
-
/** Message information to be displayed. Please see the `MessageSpace` docs for more information about the `
|
|
17
|
-
message:
|
|
16
|
+
/** Message information to be displayed. Please see the `MessageSpace` docs for more information about the `Message` interface. */
|
|
17
|
+
message: Message;
|
|
18
18
|
/** React component to be displayed in the message canvas. */
|
|
19
19
|
children: ReactNode;
|
|
20
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageCanvas.d.ts","sourceRoot":"","sources":["../../../src/components/messageCanvas/messageCanvas.tsx"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAA;AAK5B,OAAO,KAAK,EAAE,EAAc,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAGzD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"messageCanvas.d.ts","sourceRoot":"","sources":["../../../src/components/messageCanvas/messageCanvas.tsx"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAA;AAK5B,OAAO,KAAK,EAAE,EAAc,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAGzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAEvC,MAAM,WAAW,qBAAqB;IACpC,oGAAoG;IACpG,mBAAmB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,SAAS,CAAA;IACrD;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,SAAS,GAAG,SAAS,CAAA;CAClE;AAED,MAAM,WAAW,kBAAmB,SAAQ,qBAAqB;IAC/D,kIAAkI;IAClI,OAAO,EAAE,OAAO,CAAA;IAChB,6DAA6D;IAC7D,QAAQ,EAAE,SAAS,CAAA;CACpB;AAyCD,QAAA,MAAM,aAAa,2FAAmC,CAAA;AACtD,eAAe,aAAa,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={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:()=>N});const n=require("react/jsx-runtime"),r=require("@mui/material/Chip");var o=e.n(r);const a=require("@mui/system/Box");var s=e.n(a);const i=require("react");var c=e.n(i);const u=require("@mui/material/Typography");var l=e.n(u),m=function(){return m=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},m.apply(this,arguments)};const d=function(e){var t=e.messages[0],r=e.messages.slice(1),o=e.supportedElements[t.format];return(0,n.jsx)(n.Fragment,{children:o?c().createElement(o,m(m({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]})})};function f(e){return e.name.replaceAll("_","-"),(0,n.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),children:e.name})}const g=require("@mui/material"),p=require("@mui/material/Card");var v=e.n(p);const h=require("@mui/material/Stack");var y=e.n(h);const j=require("pluralize");var b,w=e.n(j);function x(e){var t=new Date,n=new Date(e);return Math.floor((t.getTime()-n.getTime())/1e3)}!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(b||(b={}));const O=function(e){return(0,n.jsx)(l(),{variant:"caption",color:"text.secondary",className:"rustic-timestamp",children:(t=e.timestamp,x(t)<86400?function(e){var t=x(e);if(t<60)return"".concat(w()("second",t,!0)," ago");if(t<3600){var n=Math.floor(t/60);return"".concat(w()("minute",n,!0)," ago")}var r=Math.floor(t/3600);return"".concat(w()("hour",r,!0)," ago")}(t):(r=new Date(t),o=navigator.language,a={month:"short",day:"numeric"},s=new Date,c=(i=r.getFullYear()!==s.getFullYear())?" at ":", ",i&&(a.year="numeric"),r.toLocaleDateString(o,a)+c+r.toLocaleTimeString(o,{hour:"numeric",minute:"2-digit",hour12:!0})))});var t,r,o,a,s,i,c},E=(0,i.forwardRef)((function(e,t){var r=(0,g.useTheme)();return(0,n.jsxs)(y(),{id:e.message.id,className:"rustic-message-canvas",ref:t,children:[(0,n.jsxs)(y(),{direction:"row",alignItems:"center",spacing:1,children:[e.getProfileComponent&&e.getProfileComponent(e.message),(0,n.jsx)(O,{timestamp:e.message.timestamp})]}),e.getActionsComponent&&e.getActionsComponent(e.message)&&(0,n.jsx)(v(),{variant:"outlined",className:"rustic-message-actions-container",sx:{boxShadow:r.shadows[1]},children:e.getActionsComponent(e.message)}),(0,n.jsx)(v(),{variant:"outlined",className:"rustic-message-container",children:e.children})]})}));var S=function(){return S=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},S.apply(this,arguments)};function T(e,t){var n=t.format.includes("update")?t.threadId:t.id;if(n){var r=S({},e),o=(e[n]||[])[0];return t.format.includes("update")&&o&&o.sender.id!==t.sender.id&&(n=t.id),r[n]||(r[n]=[]),r[n]=r[n].concat(t),r}return e}function C(e){var t,r,a,c=(0,i.useRef)(null),u=(0,i.useRef)(null),l=(0,i.useRef)(),m=(0,i.useState)(!0),g=m[0],p=m[1],v=(0,i.useState)(!0),h=v[0],y=v[1],j=(0,i.useState)(!1),b=j[0],w=j[1],x=(0,i.useState)({}),O=x[0],S=x[1],C=Object.keys(O).length,N=(r=C,a=(0,i.useRef)(0),(0,i.useEffect)((function(){a.current=r})),a.current),P=2e3;function R(){y(!0),l.current&&clearTimeout(l.current),l.current=setTimeout((function(){y(!1)}),P)}function q(){var e=u.current,t=c.current;if(e&&t){var n=e.getBoundingClientRect().bottom,r=t.getBoundingClientRect().bottom;p(r-1<=n)}}function A(){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(){R(),e.scrollTop=e.scrollHeight}),0)}else setTimeout(A,1)}function D(e){S((function(t){return T(t,e)}))}return(0,i.useEffect)((function(){var e=u.current;if(q(),e)return e.addEventListener("scroll",q),window.addEventListener("resize",q),function(){e.removeEventListener("scroll",q),window.removeEventListener("resize",q)}}),[g]),(0,i.useEffect)((function(){A()}),[b]),(0,i.useEffect)((function(){g&&0!==N&&C>N&&(R(),A())}),[g,Object.keys(O).length]),(0,i.useEffect)((function(){var t,n={};null===(t=e.receivedMessages)||void 0===t||t.forEach((function(e){var t=T(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)(s(),{ref:u,className:"rustic-message-space",children:[Object.keys(O).map((function(t,r){var o=O[t],a=o[o.length-1];return(0,n.jsx)(E,{message:a,getActionsComponent:e.getActionsComponent,getProfileComponent:e.getProfileComponent,ref:r===C-1?c:null,children:(0,n.jsx)(d,{ws:e.ws,sender:e.sender,messages:o,supportedElements:e.supportedElements})},t)})),!g&&!h&&(0,n.jsx)(o(),{variant:"rusticSecondary",className:"rustic-scroll-down-button",size:"medium",onClick:A,label:(0,n.jsxs)(n.Fragment,{children:[e.scrollDownLabel,(0,n.jsx)(f,{name:"arrow_downward"})]})})]})}C.defaultProps={scrollDownLabel:"Scroll down"};const N=C;return t})()));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './messageSpace.css';
|
|
2
2
|
import { type MessageContainerProps } from '../messageCanvas/messageCanvas';
|
|
3
|
-
import type { ComponentMap,
|
|
3
|
+
import type { ComponentMap, Message, Sender, WebSocketClient } from '../types';
|
|
4
4
|
export interface MessageSpaceProps extends MessageContainerProps {
|
|
5
5
|
/** WebSocket connection to send and receive messages to and from a backend. This can be useful for component interactions, for example, to send filter conditions, user location, etc. */
|
|
6
6
|
ws: WebSocketClient;
|
|
@@ -8,12 +8,15 @@ export interface MessageSpaceProps extends MessageContainerProps {
|
|
|
8
8
|
sender: Sender;
|
|
9
9
|
/** A component map contains message formats as keys and their corresponding React components as values. */
|
|
10
10
|
supportedElements: ComponentMap;
|
|
11
|
-
messages
|
|
11
|
+
/** Messages received before the component was mounted. These messages are rendered along with new messages received from the websocket. */
|
|
12
|
+
receivedMessages?: Message[];
|
|
12
13
|
/** Text label for scroll down button. Default value is 'scroll down'. */
|
|
13
14
|
scrollDownLabel?: string;
|
|
14
15
|
}
|
|
15
16
|
/**
|
|
16
|
-
The `MessageSpace` component uses `MessageCanvas` and `ElementRenderer` to render a list of messages. It serves as a container for individual message items, each encapsulated within a `MessageCanvas` for consistent styling and layout.
|
|
17
|
+
The `MessageSpace` component uses `MessageCanvas` and `ElementRenderer` to render a list of messages. It serves as a container for individual message items, each encapsulated within a `MessageCanvas` for consistent styling and layout. It can receive and process messages to dynamically update the displayed content.
|
|
18
|
+
|
|
19
|
+
The `MessageSpace` component can combine update messages with the original message and render them as a single message. For this to work, the `threadId` of the update message must match the `id` of the original message, and the format of the update message should be prefixed with 'update'. For example, if the original message format is 'streamingText', the update message format should be 'updateStreamingText'.
|
|
17
20
|
|
|
18
21
|
Note: For more information about the `getActionsComponent` and `getProfileComponent` fields, refer to the [MessageCanvas' docs](http://localhost:6006/?path=/docs/rustic-ui-message-canvas-message-canvas--docs).
|
|
19
22
|
*/
|
|
@@ -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,
|
|
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;AA0CD;;;;;;EAME;AAEF,iBAAwB,YAAY,CAAC,KAAK,EAAE,iBAAiB,2CAiK5D;kBAjKuB,YAAY;;;;;eAAZ,YAAY"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Client } from 'mock-socket';
|
|
2
|
-
import type { MessageData, WebSocketClient } from '
|
|
2
|
+
import type { MessageData, WebSocketClient } from './types';
|
|
3
3
|
export declare function sendMessageToClient(socket: Client, format: string, data: MessageData): void;
|
|
4
4
|
export declare function getMockWebSocketClient(webSocketUrl: string): WebSocketClient;
|
|
5
5
|
//# sourceMappingURL=mockWebSocket.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mockWebSocket.d.ts","sourceRoot":"","sources":["../../src/components/mockWebSocket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAa,MAAM,aAAa,CAAA;AAGpD,OAAO,KAAK,EAAW,WAAW,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAKpE,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,WAAW,QAalB;AAED,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,MAAM,GAAG,eAAe,CAkC5E"}
|
|
@@ -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,{
|
|
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,{default:()=>I});const t=require("react/jsx-runtime"),n=require("@mui/material/IconButton");var i=e.n(n);const a=require("@mui/material/Tooltip");var s=e.n(a);const o=require("@mui/system/Box");var l=e.n(o);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"),x=require("@mui/material/Typography");var h,v=e.n(x);function j(e){return e.name.replaceAll("_","-"),(0,t.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),children:e.name})}require("pluralize"),function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(h||(h={}));const b=require("@mui/material/Box");var y=e.n(b);const g=require("@mui/material/TextField");var w=e.n(g);const N=require("@mui/material/useMediaQuery");var C=e.n(N);const k=require("@mui/system/Stack");var q=e.n(k);const P=require("@mui/system/useTheme");var S=e.n(P);const O=require("pdfjs-dist"),T=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"}},n=(r[e.action].label.replaceAll(" ","-").toLowerCase(),r[e.action]);return(0,t.jsx)(s(),{title:n.label,children:(0,t.jsx)("span",{children:(0,t.jsx)(i(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,t.jsx)(j,{name:n.symbol})})})})};var _={pdf:function(e){var r,n=(0,c.useRef)(null),i=(0,c.useState)(1),a=i[0],s=i[1],o=(0,c.useState)(1),l=o[0],u=o[1],m=(0,c.useState)(1),f=m[0],p=m[1],x=(0,c.useState)(!1),h=x[0],j=x[1],b=(0,c.useState)(),g=b[0],N=b[1],k=S()(),P=C()(k.breakpoints.down("sm")),_=C()(k.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)(v(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var z=(0,c.useState)((function(){return P?.5:_?1:1.5})),D=z[0],M=z[1];return(0,c.useEffect)((function(){O.GlobalWorkerOptions.workerSrc||(O.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(O.version,"/pdf.worker.mjs")),O.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=n.current;if(t){var i=t.getContext("2d");if(i){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 s={canvasContext:i,viewport:r,transform:[a,0,0,a,0,0]};g&&g.cancel();var o=e.render(s);N(o),o.promise.then((function(){N(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){j(!0)}))}),[e.url,a,D]),h?(0,t.jsx)(d(),{variant:"outlined",className:"rustic-pdf-error",children:(0,t.jsx)(v(),{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)(T,{action:"zoomOut",onClick:function(){M((function(e){return Math.max(e-.2,.2)}))}}),(0,t.jsx)(T,{action:"zoomIn",onClick:function(){M((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:n})})}),(0,t.jsxs)(q(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,t.jsx)(T,{action:"previousPage",onClick:function(){a>1&&(s(a-1),p(a-1))},isDisabled:1===a}),(0,t.jsx)(v(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,t.jsx)(w(),{type:"number",value:f,onChange:function(e){var r=parseInt(e.target.value);p(r),!isNaN(r)&&r>=1&&r<=l&&s(r)},size:"small",className:"rustic-pdf-page-input"}),(0,t.jsxs)(v(),{variant:"body1",className:"rustic-page-indicator",children:["of ",l]}),(0,t.jsx)(T,{action:"nextPage",onClick:function(){a<l&&(s(a+1),p(a+1))},isDisabled:a===l})]})]})}};function z(e){var r=(0,p.useTheme)(),n=(0,c.useState)(!1),a=n[0],o=n[1];function l(){o(!1)}var u,m,x=e.file.url&&(u=e.file.url.split("."))[u.length-1].toLowerCase(),h=x&&e.supportedViewers?e.supportedViewers[x]:null,b=!!h;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(d(),{className:"rustic-file-preview".concat(b?" rustic-cursor-pointer":""),variant:"outlined",sx:{boxShadow:r.shadows[1]},onClick:function(){o(!0)},children:[(0,t.jsx)(v(),{variant:"subtitle2",children:(m=e.file.name,15,m.length<=15?m:m.substring(0,12)+"...")}),(0,t.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:e.children})]}),b&&(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)(s(),{title:"Close",children:(0,t.jsx)(i(),{onClick:l,className:"rustic-close-button",children:(0,t.jsx)(j,{name:"close"})})}),e.file.url&&(0,t.jsx)(h,{url:e.file.url})]})})]})}z.defaultProps={supportedViewers:_};const D=require("dompurify");var M=e.n(D);const F=function(e){return(0,t.jsx)(v(),{variant:"body2",className:"rustic-text",children:M().sanitize(e.text)})},I=function(e){return(0,t.jsxs)(l(),{className:"rustic-multipart",children:[e.text&&(0,t.jsx)(F,{text:e.text}),(r=e.files.map((function(e,r){return(0,t.jsx)(z,{file:e,children:e.url&&(0,t.jsx)(s(),{title:"Download",children:(0,t.jsx)(i(),{component:"a",href:e.url,download:e.name,children:(0,t.jsx)(j,{name:"download"})})})},r)})),(0,t.jsx)(l(),{className:"rustic-files",children:r}))]});var r};return r})()));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../../index.css';
|
|
2
2
|
import './multipart.css';
|
|
3
|
-
import type {
|
|
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
|
-
export default function Multipart(props:
|
|
5
|
+
export default function Multipart(props: MultipartProps): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
//# sourceMappingURL=multipart.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multipart.d.ts","sourceRoot":"","sources":["../../../src/components/multipart/multipart.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAA;AACxB,OAAO,iBAAiB,CAAA;AAUxB,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"multipart.d.ts","sourceRoot":"","sources":["../../../src/components/multipart/multipart.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAA;AACxB,OAAO,iBAAiB,CAAA;AAUxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAE9C,mKAAmK;AACnK,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,KAAK,EAAE,cAAc,2CA8BtD"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import './participantsContainer.css';
|
|
2
|
-
import ParticipantsContainer from './participantsContainer';
|
|
2
|
+
import ParticipantsContainer, { type Participant, ParticipantRole, ParticipantType } from './participantsContainer';
|
|
3
3
|
export default ParticipantsContainer;
|
|
4
|
+
export { type Participant, ParticipantRole, ParticipantType };
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/participantsContainer/index.ts"],"names":[],"mappings":"AAAA,OAAO,6BAA6B,CAAA;AAEpC,OAAO,qBAAqB,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/participantsContainer/index.ts"],"names":[],"mappings":"AAAA,OAAO,6BAA6B,CAAA;AAEpC,OAAO,qBAAqB,EAAE,EAC5B,KAAK,WAAW,EAChB,eAAe,EACf,eAAe,EAChB,MAAM,yBAAyB,CAAA;AAEhC,eAAe,qBAAqB,CAAA;AAEpC,OAAO,EAAE,KAAK,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["@rustic-ai/ui-components"]=e():t["@rustic-ai/ui-components"]=e()}(global,(()=>(()=>{"use strict";var t={n:e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},d:(e,r)=>{for(var
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["@rustic-ai/ui-components"]=e():t["@rustic-ai/ui-components"]=e()}(global,(()=>(()=>{"use strict";var t={n:e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},d:(e,r)=>{for(var a in r)t.o(r,a)&&!t.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:r[a]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{ParticipantRole:()=>q,ParticipantType:()=>_,default:()=>S});const r=require("react/jsx-runtime"),a=require("@mui/material/Button");var i=t.n(a);const n=require("@mui/material/Dialog");var c=t.n(n);const s=require("@mui/material/DialogTitle");var o=t.n(s);const p=require("@mui/material/Divider");var l=t.n(p);const u=require("@mui/material/List");var m=t.n(u);const d=require("@mui/material/ListItem");var y=t.n(d);const f=require("@mui/material/ListSubheader");var h=t.n(f);const x=require("@mui/material/Typography");var j=t.n(x);const v=require("@mui/system"),b=require("pluralize");var g=t.n(b);const T=require("react");var N;function O(t){return t.name.replaceAll("_","-"),(0,r.jsx)("span",{className:"".concat(t.className?t.className+" ":"","material-symbols-rounded"),children:t.name})}!function(t){t[t.HOUR=0]="HOUR",t[t.MONTH_DATE=1]="MONTH_DATE"}(N||(N={}));var q,_;function A(t){var e=(0,T.useState)(!1),a=e[0],n=e[1],c=t.participants.length,s=a?t.participants:t.participants.slice(0,3),o="".concat(g()(t.participantType,c)," (").concat(c,")"),p=a?"Show Less":"Show All ".concat(c);return 0===c?(0,r.jsx)(j(),{variant:"caption",className:"rustic-participant-list-no-participants-message",children:"There are currently no participants."}):(0,r.jsx)(m(),{className:"rustic-participant-list",subheader:(0,r.jsxs)(h(),{disableSticky:!0,className:"rustic-participant-list-subheader",children:[(0,r.jsxs)(v.Box,{className:"rustic-participant-list-subheader-title",children:[t.participantTypeIcon,(0,r.jsx)(j(),{variant:"subtitle2",color:"text.secondary",children:o})]}),c>3&&(0,r.jsx)(i(),{onClick:function(){return n(!a)},color:"primary",size:"small",startIcon:(0,r.jsx)(O,{name:"keyboard_arrow_down"}),children:p})]}),children:s.map((function(t){return(0,r.jsxs)(y(),{className:"rustic-participant-list-item",children:[(0,r.jsx)(j(),{variant:"subtitle2",children:t.displayName}),(0,r.jsx)(j(),{variant:t.participantRole===q.Owner?"subtitle2":"caption",children:(e=t.participantRole,e.charAt(0).toUpperCase()+e.slice(1))})]},t.id);var e}))})}!function(t){t.Owner="owner",t.Member="member"}(q||(q={})),function(t){t.Human="human",t.Agent="agent"}(_||(_={}));const S=function(t){function e(t,e){return function(t){return function(t,e,r){if(r||2===arguments.length)for(var a,i=0,n=e.length;i<n;i++)!a&&i in e||(a||(a=Array.prototype.slice.call(e,0,i)),a[i]=e[i]);return t.concat(a||Array.prototype.slice.call(e))}([],t,!0).sort((function(t,e){return e.participantRole===q.Owner?1:-1}))}(t.filter((function(t){return t.participantType===e})))}var a=e(t.participants,_.Human),i=e(t.participants,_.Agent),n="".concat(g()("Participant",t.participants.length)," (").concat(t.participants.length,")");return(0,r.jsxs)(c(),{open:t.isParticipantListOpen,onClose:t.onClose,className:"rustic-participants-container",maxWidth:"sm",fullWidth:!0,children:[(0,r.jsx)(o(),{sx:{borderBottom:"1px solid",borderColor:"divider"},component:"h6",className:"rustic-participants-container-title",children:n}),(0,r.jsx)(A,{participantType:"Human",participantTypeIcon:(0,r.jsx)(O,{name:"account_circle"}),participants:a}),i.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l(),{className:"rustic-participants-container-divider"}),(0,r.jsx)(A,{participantType:"Agent",participantTypeIcon:(0,r.jsx)(O,{name:"smart_toy"}),participants:i})]})]})};return e})()));
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import './participantsContainer.css';
|
|
2
|
-
import { type Participant } from '../types';
|
|
3
2
|
export interface ParticipantsContainerProps {
|
|
4
3
|
participants: Participant[];
|
|
5
4
|
/** Boolean that dictates the open/closed state of the participants modal. */
|
|
@@ -7,6 +6,20 @@ export interface ParticipantsContainerProps {
|
|
|
7
6
|
/** Callback function to close the participants modal. */
|
|
8
7
|
onClose: () => void;
|
|
9
8
|
}
|
|
9
|
+
export declare enum ParticipantRole {
|
|
10
|
+
Owner = "owner",
|
|
11
|
+
Member = "member"
|
|
12
|
+
}
|
|
13
|
+
export declare enum ParticipantType {
|
|
14
|
+
Human = "human",
|
|
15
|
+
Agent = "agent"
|
|
16
|
+
}
|
|
17
|
+
export interface Participant {
|
|
18
|
+
id: string;
|
|
19
|
+
displayName: string;
|
|
20
|
+
participantRole: ParticipantRole;
|
|
21
|
+
participantType: ParticipantType;
|
|
22
|
+
}
|
|
10
23
|
/** The `ParticipantsContainer` component is responsible for displaying a list of participants within a dialog window. It organizes participants into separate lists based on their type (human or agent) and provides options to toggle between showing a subset of participants and displaying the full list. This component enhances the user experience by presenting participant information in a structured format and allowing users to view additional details as needed.
|
|
11
24
|
*
|
|
12
25
|
* Note: The component does not include the button displayed to toggle between the two views. This button is typically implemented in the parent component that uses the `ParticipantsContainer` component. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"participantsContainer.d.ts","sourceRoot":"","sources":["../../../src/components/participantsContainer/participantsContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,6BAA6B,CAAA;
|
|
1
|
+
{"version":3,"file":"participantsContainer.d.ts","sourceRoot":"","sources":["../../../src/components/participantsContainer/participantsContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,6BAA6B,CAAA;AAmBpC,MAAM,WAAW,0BAA0B;IACzC,YAAY,EAAE,WAAW,EAAE,CAAA;IAC3B,6EAA6E;IAC7E,qBAAqB,EAAE,OAAO,CAAA;IAC9B,yDAAyD;IACzD,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB;AAED,oBAAY,eAAe;IACzB,KAAK,UAAU;IACf,MAAM,WAAW;CAClB;AAED,oBAAY,eAAe;IACzB,KAAK,UAAU;IACf,KAAK,UAAU;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAA;IACV,WAAW,EAAE,MAAM,CAAA;IACnB,eAAe,EAAE,eAAe,CAAA;IAChC,eAAe,EAAE,eAAe,CAAA;CACjC;AA+FD;;8MAE8M;AAC9M,iBAAS,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,2CAyE/D;AAED,eAAe,qBAAqB,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={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,{default:()=>P});const r=require("react/jsx-runtime"),a=require("@mui/material/Box");var n=e.n(a);const o=require("@mui/material/Card");var i=e.n(o);const s=require("@mui/material/TextField");var c=e.n(s);const l=require("@mui/material/Typography");var u=e.n(l);const d=require("@mui/material/useMediaQuery");var m=e.n(d);const f=require("@mui/system/Stack");var p=e.n(f);const v=require("@mui/system/useTheme");var b=e.n(v);const h=require("pdfjs-dist"),x=require("react"),j=require("@mui/material/IconButton");var y=e.n(j);const g=require("@mui/material/Tooltip");var w=e.n(g);function N(e){return e.name.replaceAll("_","-"),(0,r.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),children:e.name})}const k=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"}},a=(t[e.action].label.replaceAll(" ","-").toLowerCase(),t[e.action]);return(0,r.jsx)(w(),{title:a.label,children:(0,r.jsx)("span",{children:(0,r.jsx)(y(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,r.jsx)(N,{name:a.symbol})})})})},P=function(e){var t,a=(0,x.useRef)(null),o=(0,x.useState)(1),s=o[0],l=o[1],d=(0,x.useState)(1),f=d[0],v=d[1],j=(0,x.useState)(1),y=j[0],g=j[1],w=(0,x.useState)(!1),N=w[0],P=w[1],S=(0,x.useState)(),C=S[0],q=S[1],O=b()(),_=m()(O.breakpoints.down("sm")),z=m()(O.breakpoints.between("sm","md"));if(t=e.url,!/\/[^/]+\.pdf$/.test(t))return(0,r.jsx)(i(),{variant:"outlined",className:"rustic-pdf-error",children:(0,r.jsx)(u(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var T=(0,x.useState)((function(){return _?.5:z?1:1.5})),D=T[0],I=T[1];return(0,x.useEffect)((function(){h.GlobalWorkerOptions.workerSrc||(h.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(h.version,"/pdf.worker.mjs")),h.getDocument({url:"".concat(e.url)}).promise.then((function(e){v(e.numPages),function(e){e.getPage(s).then((function(e){var t=e.getViewport({scale:D}),r=a.current;if(r){var n=r.getContext("2d");if(n){var o=window.devicePixelRatio||1;r.style.width="".concat(t.width,"px"),r.style.height="".concat(t.height,"px"),r.width=t.width*o,r.height=t.height*o;var i={canvasContext:n,viewport:t,transform:[o,0,0,o,0,0]};C&&C.cancel();var s=e.render(i);q(s),s.promise.then((function(){q(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){P(!0)}))}),[e.url,s,D]),N?(0,r.jsx)(i(),{variant:"outlined",className:"rustic-pdf-error",children:(0,r.jsx)(u(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,r.jsxs)(i(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,r.jsxs)(n(),{className:"rustic-pdf-viewer-header",children:[(0,r.jsx)(k,{action:"zoomOut",onClick:function(){I((function(e){return Math.max(e-.2,.2)}))}}),(0,r.jsx)(k,{action:"zoomIn",onClick:function(){I((function(e){return e+.2}))}})]}),(0,r.jsx)(n(),{className:"rustic-pdf-viewer-body",children:(0,r.jsx)(n(),{className:"rustic-pdf-viewer-body-inner",children:(0,r.jsx)("canvas",{ref:a})})}),(0,r.jsxs)(p(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,r.jsx)(k,{action:"previousPage",onClick:function(){s>1&&(l(s-1),g(s-1))},isDisabled:1===s}),(0,r.jsx)(u(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,r.jsx)(c(),{type:"number",value:y,onChange:function(e){var t=parseInt(e.target.value);g(t),!isNaN(t)&&t>=1&&t<=f&&l(t)},size:"small",className:"rustic-pdf-page-input"}),(0,r.jsxs)(u(),{variant:"body1",className:"rustic-page-indicator",children:["of ",f]}),(0,r.jsx)(k,{action:"nextPage",onClick:function(){s<f&&(l(s+1),g(s+1))},isDisabled:s===f})]})]})};return t})()));
|
|
@@ -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,{
|
|
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,{default:()=>D});const t=require("react/jsx-runtime"),n=require("@mui/material/Button");var i=e.n(n);const s=require("@mui/material/Card");var a=e.n(s);const o=require("@mui/material/CircularProgress");var l=e.n(o);const c=require("@mui/material/Dialog");var u=e.n(c);const d=require("@mui/material/DialogActions");var m=e.n(d);const p=require("@mui/material/DialogContent");var f=e.n(p);const g=require("@mui/material/DialogContentText");var x=e.n(g);const b=require("@mui/material/DialogTitle");var h=e.n(b);const v=require("@mui/material/Divider");var j=e.n(v);const y=require("@mui/material/Typography");var q=e.n(y);const S=require("@mui/system"),w=require("react");var C=e.n(w),N=function(){return N=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var i in r=arguments[t])Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i]);return e},N.apply(this,arguments)};const P=function(e){var r=e.messages[0],n=e.messages.slice(1),i=e.supportedElements[r.format];return(0,t.jsx)(t.Fragment,{children:i?C().createElement(i,N(N({sender:e.sender,ws:e.ws,messageId:r.id,conversationId:r.conversationId},r.data),n.length>0&&{updatedData:n.map((function(e){return e.data}))})):(0,t.jsxs)(q(),{variant:"body2",children:["Unsupported element format: ",r.format]})})};function O(e){return e.name.replaceAll("_","-"),(0,t.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),children:e.name})}var B=function(){return B=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var i in r=arguments[t])Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i]);return e},B.apply(this,arguments)},I=function(e,r,t){if(t||2===arguments.length)for(var n,i=0,s=r.length;i<s;i++)!n&&i in r||(n||(n=Array.prototype.slice.call(r,0,i)),n[i]=r[i]);return e.concat(n||Array.prototype.slice.call(r))};const D=function(e){var r=(0,w.useState)(!1),n=r[0],s=r[1],o=(0,w.useState)(!1),c=o[0],d=o[1],p=(0,w.useState)(!1),g=p[0],b=p[1],v=(0,w.useState)(!1),y=v[0],C=v[1],N=(0,w.useState)([]),D=N[0],A=N[1],E=(0,w.useState)(null),T=E[0],_=E[1],k=(0,S.useTheme)(),M=D[D.length-1],Q=B(B({},e.ws),{send:function(e){_(e)}});function F(e){A((function(r){return I(I([],r,!0),[e],!1)}))}function R(){if(T){var r=B(B({},T),{threadId:e.messageId});e.ws.send(r)}}if((0,w.useEffect)((function(){e.ws.onReceive&&e.ws.onReceive(F)}),[e.ws]),(0,w.useEffect)((function(){D.length>0&&(M&&M.sender.id!==e.sender.id&&d(!1),"promptBuilder"===M.format&&M.data.isLastQuestion&&s(!0))}),[D.length]),0!==D.length)return(0,t.jsxs)(a(),{variant:"outlined",className:"rustic-prompt-builder",children:[(0,t.jsxs)(u(),{open:g,onClose:function(){return b(!1)},"aria-labelledby":"quit-dialog-title","aria-describedby":"quit-dialog-description",sx:{"& .MuiPaper-root":{width:"clamp(320px,50vw,600px)",border:"1px solid ".concat(k.palette.divider)}},children:[(0,t.jsx)(h(),{id:"quit-dialog-title",className:"rustic-align-self-center",children:"Are you sure?"}),(0,t.jsx)(j(),{}),(0,t.jsx)(f(),{children:(0,t.jsx)(x(),{id:"quit-dialog-description",className:"rustic-align-self-center",children:"All progress will be lost."})}),(0,t.jsxs)(m(),{className:"rustic-prompt-builder-dialog-buttons",disableSpacing:!0,children:[(0,t.jsx)(i(),{variant:"rusticSecondary",startIcon:(0,t.jsx)(O,{name:"close"}),onClick:function(){b(!1),e.onCancel()},children:"Quit"}),(0,t.jsx)(i(),{variant:"rusticPrimary",onClick:function(){return b(!1)},children:"Continue build"})]})]}),e.getProfileComponent?e.getProfileComponent(D[0]):(0,t.jsx)(q(),{color:"text.secondary",children:"Prompt Builder"}),(0,t.jsx)(j(),{className:"rustic-prompt-builder-divider"}),(0,t.jsxs)(S.Box,{className:"rustic-prompt-builder-questions",children:[function(){if(!y&&D.length>0)return D.map((function(r){if(r.sender.id!==e.sender.id&&"promptBuilder"!==r.format)return(0,t.jsx)(P,{ws:Q,sender:e.sender,messages:[r],supportedElements:e.supportedElements},r.id)}))}(),c&&(0,t.jsx)(l(),{color:"secondary",className:"rustic-align-self-center"})]}),(0,t.jsx)(t.Fragment,{children:!y&&(0,t.jsxs)(S.Box,{className:"rustic-prompt-builder-buttons",children:[(0,t.jsxs)(S.Box,{className:"rustic-prompt-builder-buttons-left",children:[(0,t.jsx)(i(),{variant:"rusticSecondary",startIcon:(0,t.jsx)(O,{name:"close"}),onClick:function(){return b(!0)},children:"Quit"}),(0,t.jsx)(i(),{variant:"rusticSecondary",endIcon:(0,t.jsx)(O,{name:"chevron_right"}),onClick:function(){R(),_(null),d(!0)},disabled:!T,"aria-disabled":!T,children:"Next question"})]}),n&&(0,t.jsx)(S.Box,{className:"rustic-prompt-builder-buttons-right",children:(0,t.jsx)(i(),{variant:"rusticPrimary",onClick:function(){R(),C(!0),d(!0),e.onSubmit()},disabled:c,"aria-disabled":c,children:"Generate"})})]})})]})};return r})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promptBuilder.d.ts","sourceRoot":"","sources":["../../../src/components/promptBuilder/promptBuilder.tsx"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAA;AAC5B,OAAO,iBAAiB,CAAA;AAiBxB,OAAO,KAAK,EAAW,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAE3D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,KAAK,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"promptBuilder.d.ts","sourceRoot":"","sources":["../../../src/components/promptBuilder/promptBuilder.tsx"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAA;AAC5B,OAAO,iBAAiB,CAAA;AAiBxB,OAAO,KAAK,EAAW,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAE3D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,KAAK,EAAE,kBAAkB,uDAqP9D"}
|
|
@@ -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 i in r)e.o(r,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:r[i]})},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,{
|
|
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 i in r)e.o(r,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:r[i]})},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:()=>f});const r=require("react/jsx-runtime"),i=require("@mui/material"),o=require("@mui/material/Box");var n=e.n(o);const a=require("@mui/material/Chip");var s=e.n(a);const u=require("@mui/material/Stack");var c=e.n(u);const l=require("@mui/material/Typography");var d=e.n(l);const m=require("react"),p=require("uuid"),f=function(e){var t=(0,m.useState)(""),o=t[0],a=t[1],u=(0,i.useTheme)(),l=(0,i.useMediaQuery)(u.breakpoints.down("md"))?"column":"row",f=e.options.map((function(t,i){return(0,r.jsx)(s(),{onClick:function(){return function(t){a(t);var r=(new Date).toISOString(),i={id:(0,p.v4)(),timestamp:r,sender:e.sender,conversationId:e.conversationId,format:"text",data:{text:t},inReplyTo:e.messageId};e.ws.send(i)}(t)},variant:"rusticSecondary",size:"small",sx:o===t?{"&.Mui-disabled":{backgroundColor:"secondary.light",color:"text.primary"}}:{},className:"rustic-option",disabled:!!o,"aria-disabled":!!o,label:t},i)}));return(0,r.jsxs)(n(),{className:"rustic-question",children:[(e.title||e.description)&&(0,r.jsxs)(n(),{className:"rustic-question-text",children:[e.title&&(0,r.jsx)(d(),{variant:"subtitle2",className:"rustic-title",children:e.title}),e.description&&(0,r.jsx)(d(),{variant:"caption",children:e.description})]}),(0,r.jsx)(c(),{direction:l,className:"rustic-options-container",children:f})]})};return t})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,a){"object"==typeof exports&&"object"==typeof module?module.exports=a():"function"==typeof define&&define.amd?define([],a):"object"==typeof exports?exports["@rustic-ai/ui-components"]=a():e["@rustic-ai/ui-components"]=a()}(global,(()=>(()=>{"use strict";var e={n:a=>{var t=a&&a.__esModule?()=>a.default:()=>a;return e.d(t,{a:t}),t},d:(a,t)=>{for(var r in t)e.o(t,r)&&!e.o(a,r)&&Object.defineProperty(a,r,{enumerable:!0,get:t[r]})},o:(e,a)=>Object.prototype.hasOwnProperty.call(e,a),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},a={};e.r(a),e.d(a,{
|
|
1
|
+
!function(e,a){"object"==typeof exports&&"object"==typeof module?module.exports=a():"function"==typeof define&&define.amd?define([],a):"object"==typeof exports?exports["@rustic-ai/ui-components"]=a():e["@rustic-ai/ui-components"]=a()}(global,(()=>(()=>{"use strict";var e={n:a=>{var t=a&&a.__esModule?()=>a.default:()=>a;return e.d(t,{a:t}),t},d:(a,t)=>{for(var r in t)e.o(t,r)&&!e.o(a,r)&&Object.defineProperty(a,r,{enumerable:!0,get:t[r]})},o:(e,a)=>Object.prototype.hasOwnProperty.call(e,a),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},a={};e.r(a),e.d(a,{default:()=>D});const t=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 s=e.n(c);const l=require("@mui/material/TableBody");var o=e.n(l);const u=require("@mui/material/TableCell");var d=e.n(u);const m=require("@mui/material/TableContainer");var b=e.n(m);const p=require("@mui/material/TableHead");var f=e.n(p);const y=require("@mui/material/TablePagination");var g=e.n(y);const h=require("@mui/material/TableRow");var j=e.n(h);const v=require("@mui/material/TableSortLabel");var x=e.n(v);const T=require("@mui/material/Tooltip");var q=e.n(T);const O=require("@mui/material/Typography");var P=e.n(O);const S=require("react");var w,N;function k(e){return e.name.replaceAll("_","-"),(0,t.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),children:e.name})}function A(){return(0,t.jsx)(k,{name:"expand_all"})}require("pluralize"),function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(w||(w={})),function(e){e.Ascending="asc",e.Descending="desc"}(N||(N={}));const D=function(e){if(0===e.data.length)return(0,t.jsx)(P(),{variant:"body2",children:"No data available"});var a,n,c,l=e.data.length>10,u=(0,S.useState)({}),m=u[0],p=u[1],y=(0,S.useState)(l?10:-1),h=y[0],v=y[1],T=(0,S.useState)(0),O=T[0],w=T[1],k=(0,r.useTheme)(),D=Array.from(new Set(e.data.flatMap((function(e){return Object.keys(e)})))),K=e.headers||D.map((function(e){return{dataKey:e}})),_=(a=e.data,n=Object.keys(m)[0],c=m[n],n&&c?a.slice().sort((function(e,a){var t=Object.keys(m)[0],r=m[t];return e[t]<a[t]?r===N.Descending?1:-1:e[t]>a[t]?r===N.Descending?-1:1:0})):a),C=_.slice(O*h,O*h+h),M=h>0?C:_;function R(e){if(!m[e])return A}return(0,t.jsxs)(i(),{className:"rustic-table",spacing:1,children:[e.title&&(0,t.jsx)(P(),{variant:"h6",className:"rustic-table-title",children:e.title}),e.description&&(0,t.jsx)(P(),{variant:"body1",children:e.description}),(0,t.jsx)(b(),{className:"rustic-table-container",children:(0,t.jsxs)(s(),{"aria-label":e.title||"a table of data",size:"small",stickyHeader:!0,children:[K.length>0&&(0,t.jsx)(f(),{children:(0,t.jsx)(j(),{children:K.map((function(e,a){return(0,t.jsx)(d(),{sortDirection:m[e.dataKey]||!1,children:(0,t.jsx)(q(),{title:(n=e.dataKey,i=m[n],i?Object.keys(N)[Object.values(N).indexOf(i)]:"Sort"),children:(0,t.jsx)(x(),{active:!0,direction:m[e.dataKey],onClick:function(){return function(e){p((function(a){var t,r,n={};switch(a[e]){case N.Ascending:(t={})[e]=N.Descending,n=t;break;case N.Descending:n={};break;default:(r={})[e]=N.Ascending,n=r}return n}))}(e.dataKey)},className:"rustic-table-header",IconComponent:R(e.dataKey),children:e.label||(r=e.dataKey,r.charAt(0).toUpperCase()+r.slice(1))})})},"header-".concat(a));var r,n,i}))})}),(0,t.jsx)(o(),{children:M.map((function(e,a){return(0,t.jsx)(j(),{children:K.map((function(r,n){return(0,t.jsx)(d(),{children:e[r.dataKey]},"cell-".concat(a,"-").concat(n))}))},"row-".concat(a))}))})]})}),l&&(0,t.jsx)(g(),{className:"rustic-table-pagination",component:"div",count:e.data.length,rowsPerPage:h,labelRowsPerPage:"Rows:",page:O,onPageChange:function(e,a){return w(a)},onRowsPerPageChange:function(e){v(+e.target.value),w(0)},sx:{"& .MuiTablePagination-selectLabel":{color:k.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 a})()));
|
|
@@ -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,{StreamingText:()=>c,Text:()=>f,default:()=>l});const r=require("react/jsx-runtime"),a=require("@mui/material/Alert");var o=e.n(a);const n=require("@mui/material/Typography");var i=e.n(n);const u=require("dompurify");var s=e.n(u);const d=require("react"),c=function(e){var t=(0,d.useState)(s().sanitize(e.text)),a=t[0],n=t[1],u=(0,d.useState)(""),c=u[0],f=u[1];return(0,d.useEffect)((function(){if(e.updatedData&&e.updatedData.length>0){for(var t=e.text,r=0,a=e.updatedData;r<a.length;r++){var o=a[r];"string"!=typeof o.text&&(t+=" [MISSING TEXT]",f("Some of the incoming text was not correctly formatted. Some data may be missing.")),t+=o.text}n(s().sanitize(t))}}),[e.text,e.updatedData]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i(),{variant:"body2",children:a}),c&&(0,r.jsx)(o(),{severity:"error",children:c})]})},f=function(e){return(0,r.jsx)(i(),{variant:"body2",className:"rustic-text",children:s().sanitize(e.text)})},l=f;return t})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/timestamp/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/timestamp/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,aAAa,CAAA;AAEnC,eAAe,SAAS,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:()=>l});const r=require("react/jsx-runtime"),o=require("@mui/material/Typography");var n=e.n(o);require("react");const a=require("pluralize");var i,u=e.n(a);function c(e){var t=new Date,r=new Date(e);return Math.floor((t.getTime()-r.getTime())/1e3)}!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(i||(i={}));const l=function(e){return(0,r.jsx)(n(),{variant:"caption",color:"text.secondary",className:"rustic-timestamp",children:(t=e.timestamp,c(t)<86400?function(e){var t=c(e);if(t<60)return"".concat(u()("second",t,!0)," ago");if(t<3600){var r=Math.floor(t/60);return"".concat(u()("minute",r,!0)," ago")}var o=Math.floor(t/3600);return"".concat(u()("hour",o,!0)," ago")}(t):(o=new Date(t),a=navigator.language,i={month:"short",day:"numeric"},l=new Date,m=(f=o.getFullYear()!==l.getFullYear())?" at ":", ",f&&(i.year="numeric"),o.toLocaleDateString(a,i)+m+o.toLocaleTimeString(a,{hour:"numeric",minute:"2-digit",hour12:!0})))});var t,o,a,i,l,f,m};return t})()));
|
|
@@ -23,10 +23,6 @@ export interface Message {
|
|
|
23
23
|
taggedParticipants?: string[];
|
|
24
24
|
topic?: string;
|
|
25
25
|
}
|
|
26
|
-
export interface ThreadableMessage extends Message {
|
|
27
|
-
lastThreadMessage?: Message;
|
|
28
|
-
threadMessagesData?: MessageData[];
|
|
29
|
-
}
|
|
30
26
|
export interface ComponentMap {
|
|
31
27
|
[key: string]: React.ComponentType<any>;
|
|
32
28
|
}
|
|
@@ -34,21 +30,7 @@ export interface WebSocketClient {
|
|
|
34
30
|
send: (message: Message) => void;
|
|
35
31
|
close: () => void;
|
|
36
32
|
reconnect: () => void;
|
|
37
|
-
onReceive?: (handler: (
|
|
38
|
-
}
|
|
39
|
-
export declare enum ParticipantRole {
|
|
40
|
-
Owner = "owner",
|
|
41
|
-
Member = "member"
|
|
42
|
-
}
|
|
43
|
-
export declare enum ParticipantType {
|
|
44
|
-
Human = "human",
|
|
45
|
-
Agent = "agent"
|
|
46
|
-
}
|
|
47
|
-
export interface Participant {
|
|
48
|
-
id: string;
|
|
49
|
-
displayName: string;
|
|
50
|
-
participantRole: ParticipantRole;
|
|
51
|
-
participantType: ParticipantType;
|
|
33
|
+
onReceive?: (handler: (message: Message) => void) => void;
|
|
52
34
|
}
|
|
53
35
|
export interface DataFormat {
|
|
54
36
|
/** Optional title. */
|
|
@@ -170,6 +152,9 @@ export interface MultipartFormat extends DataFormat {
|
|
|
170
152
|
files: FileData[];
|
|
171
153
|
/** Text content sent along with the files. */
|
|
172
154
|
text?: string;
|
|
155
|
+
}
|
|
156
|
+
export type MultipartData = MultipartFormat & Updates<MultipartFormat>;
|
|
157
|
+
export interface MultipartProps extends MultipartData {
|
|
173
158
|
/**
|
|
174
159
|
* An object mapping file extensions to their respective viewer components.
|
|
175
160
|
* Each key represents a file type (e.g., 'pdf', 'jpg'), and the corresponding value is a React component
|
|
@@ -182,7 +167,6 @@ export interface MultipartFormat extends DataFormat {
|
|
|
182
167
|
}>;
|
|
183
168
|
};
|
|
184
169
|
}
|
|
185
|
-
export type MultipartData = MultipartFormat & Updates<MultipartFormat>;
|
|
186
170
|
export interface BaseInputProps {
|
|
187
171
|
/** Current user. */
|
|
188
172
|
sender: Sender;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/components/types.ts"],"names":[],"mappings":";AAAA,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,MA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AG,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,OAAO;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE;QACJ,GAAG,EAAE,MAAM,CAAA;QACX,IAAI,EAAE,MAAM,CAAA;QACZ,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB,CAAA;IACD,WAAW,EAAE;QACX,IAAI,EAAE,MAAM,CAAA;QACZ,WAAW,EAAE,MAAM,CAAA;KACpB,CAAA;CACF;AAED,MAAM,WAAW,aAAc,SAAQ,UAAU;IAC/C,mCAAmC;IACnC,OAAO,EAAE,OAAO,EAAE,CAAA;IAClB,wDAAwD;IACxD,QAAQ,EAAE,MAAM,CAAA;IAChB,iDAAiD;IACjD,KAAK,EAAE,QAAQ,GAAG,UAAU,CAAA;CAC7B;AAED,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;AAEhE,MAAM,WAAW,YAAa,SAAQ,WAAW;IAC/C,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAED,MAAM,WAAW,kBACf,SAAQ,IAAI,CACV,iBAAiB,EACjB,qBAAqB,GAAG,iBAAiB,GAAG,UAAU,CACvD;IACD,+kBAA+kB;IAC/kB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,oPAAoP;IACpP,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,yQAAyQ;IACzQ,QAAQ,EAAE,MAAM,IAAI,CAAA;CACrB"}
|
|
@@ -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,{
|
|
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"),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"));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 l=require("react");var p=function(){return p=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},p.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,l.useRef)(null),r=(0,i.useTheme)(),a=(0,l.useState)(!1),u=a[0],b=a[1],f=r.palette.mode,m="dark"===f?"Pro Dark":"Pro Light",v=d(e.headers),g="\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"===f?"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 span.button {\n color: ").concat(r.palette.primary.main," !important;\n }\n \n span.button:hover:before {\n background-color: ").concat(r.palette.primary.main," !important;\n }\n \n .button select:hover, .button:hover, .psp-expression-editor__button:hover, \n .sidebar_close_button_inner:hover {\n background-color: ").concat(r.palette.primary.light," !important;\n }\n \n /* Enable Scrolling */\n #plugin_selector_container.open, #status_bar, #menu-bar, #app_panel {\n overflow: scroll !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 ");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[v[e[0]]||e[0],e[1]]})),O=x&&Object.fromEntries(Object.entries(x).map((function(e){var t=e[0],n=e[1];return[v[t]||t,n]}))),{group_by:null==y?void 0:y.map((function(e){return v[e]||e})),split_by:null==_?void 0:_.map((function(e){return v[e]||e})),aggregates:O,sort:k,filter:S&&function(e){return e.map((function(e){return[v[e[0]]||e[0],e[1],e[e.length-1]]}))}(S),columns:null==w?void 0:w.map((function(e){return v[e]||e}))});return(0,l.useEffect)((function(){o().worker().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){var r=t.current;r&&r.load(n).then((function(){if(r.restore(p(p({},q),{theme:m,title:e.title,settings:!1})),r.shadowRoot){var t=new CSSStyleSheet;t.replaceSync(g),r.shadowRoot.adoptedStyleSheets.push(t)}})).catch((function(){b(!0)}))})).catch((function(){b(!0)}))}),[e.data,m]),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
|
-
!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
|
|
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 a in t)e.o(t,a)&&!e.o(r,a)&&Object.defineProperty(r,a,{enumerable:!0,get:t[a]})},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:()=>P});const t=require("react/jsx-runtime"),a=require("@mui/material/Box");var n=e.n(a);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 m=require("react");var d;require("pluralize"),function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(d||(d={}));var h=function(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 p(e){return e.name.replaceAll("_","-"),(0,t.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),children:e.name})}const x=require("@mui/material"),v=require("@mui/material/Button");var b=e.n(v);const f=require("@mui/material/Drawer");var j=e.n(f);const y=require("@mui/material/IconButton");var w=e.n(y);const g=require("@mui/material/ListItemText");var N=e.n(g);const T=require("@mui/material/Menu");var q=e.n(T);const S=require("@mui/material/MenuItem");var I=e.n(S);const M=require("@mui/material/styles"),D=require("@mui/material/Tooltip");var O=e.n(D);const C=require("@mui/system");var k=function(){return k=Object.assign||function(e){for(var r,t=1,a=arguments.length;t<a;t++)for(var n in r=arguments[t])Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);return e},k.apply(this,arguments)};function F(e){var r=(0,m.useState)(!1),a=r[0],n=r[1],i=(0,m.useRef)(null),o=(0,M.useTheme)(),c=(0,x.useMediaQuery)(o.breakpoints.down("md")),s=c?j():q(),u={borderRadius:"".concat(o.shape.borderRadius,"px"),border:"1px solid ".concat(o.palette.divider)};function d(e){return(0,t.jsxs)(t.Fragment,{children:[e.startDecorator&&(0,t.jsx)(C.Box,{sx:{color:"primary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-start-icon",children:e.startDecorator}),(0,t.jsx)(N(),{children:(0,t.jsx)(l(),{variant:"body2",children:e.label})}),e.endDecorator&&(0,t.jsx)(C.Box,{sx:{color:"secondary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-end-icon",children:e.endDecorator})]})}c&&(u=k(k({},u),{borderRadius:"".concat(o.shape.borderRadius,"px ").concat(o.shape.borderRadius,"px 0 0"),borderBottom:0}));var h=e.menuItems.map((function(e){return e.href?(0,t.jsx)(I(),{component:"a",onClick:function(){return n(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:d(e)},e.label):(0,t.jsx)(I(),{onClick:function(r){e.onClick&&e.onClick(r),n(!1)},disabled:!e.onClick,children:d(e)},e.label)}));var v,f,y=c?{}:{anchorEl:i.current};return(0,t.jsxs)(t.Fragment,{children:[(v={onClick:function(e){e.stopPropagation(),n(!0)},"aria-label":e.ariaLabel,ref:i,className:"rustic-popover-menu-button"},f=(0,t.jsx)(p,{name:"more_vert"}),e.buttonText?(0,t.jsx)(b(),k({},v,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,t.jsx)(O(),{title:e.ariaLabel,children:(0,t.jsx)(w(),k({},v,{children:e.icon?e.icon:f}))})),(0,t.jsx)(s,k({open:a,onClose:function(){return n(!1)}},y,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":k(k({},u),{backgroundImage:"none",boxShadow:o.shadows[2]})},children:h}))]})}const P=function(e){var r=(0,m.useState)(e.units),a=r[0],i=r[1];function c(r){return"metric"===e.units&&"imperial"===a?Math.round(1.8*r+32):"imperial"===e.units&&"metric"===a?Math.round(r*(5/9)-32):Math.round(r)}var u=new Date(1e3*e.weather[0].timestamp),d=h(e.weather[0].timestamp).shortName,x=u.getDate(),v=u.getFullYear().toString().slice(2),b="".concat(d," ").concat(x,"/").concat(v," TODAY"),f="HIGH: ".concat(c(e.weather[0].temp.high)," / LOW: ").concat(c(e.weather[0].temp.high)),j=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":h(e.timestamp).fullName,children:h(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:[(0,t.jsx)(F,{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"}}(a)]}),(0,t.jsxs)(s(),{direction:"row",spacing:2,children:[(0,t.jsx)(l(),{variant:"overline",children:b}),(0,t.jsx)(l(),{variant:"overline",children:f})]})]}),(0,t.jsx)(n(),{className:"rustic-daily-weather-container",children:j}),e.weatherProvider&&(0,t.jsxs)(s(),{alignItems:"center",direction:"row",spacing:1,alignSelf:"center",className:"rustic-weather-attribution",children:[(0,t.jsx)(p,{name:"cloud"}),(0,t.jsx)(l(),{variant:"body2",children:"Weather data provided by ".concat(e.weatherProvider)})]})]})};return r})()));
|