@rustic-ai/ui-components 0.0.19 → 0.0.20
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/fCCalendar.d.ts +8 -2
- package/dist/components/calendar/fCCalendar.d.ts.map +1 -1
- package/dist/components/calendar/index.css +21 -0
- package/dist/components/calendar/index.d.ts +5 -0
- package/dist/components/calendar/index.d.ts.map +1 -0
- package/dist/components/calendar/index.js +1 -0
- package/dist/components/codeSnippet/index.css +14 -0
- package/dist/components/codeSnippet/index.d.ts +5 -0
- package/dist/components/codeSnippet/index.d.ts.map +1 -0
- package/dist/components/codeSnippet/index.js +1 -0
- package/dist/components/elementRenderer/index.d.ts +3 -0
- package/dist/components/elementRenderer/index.d.ts.map +1 -0
- package/dist/components/elementRenderer/index.js +1 -0
- package/dist/components/image/index.css +43 -0
- package/dist/components/image/index.d.ts +5 -0
- package/dist/components/image/index.d.ts.map +1 -0
- package/dist/components/image/index.js +1 -0
- package/dist/components/index.d.ts +4 -1
- 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/index.css +16 -0
- package/dist/components/input/emoji/index.d.ts +4 -0
- package/dist/components/input/emoji/index.d.ts.map +1 -0
- package/dist/components/input/emoji/index.js +1 -0
- package/dist/components/input/multimodal/multimodalInput/index.css +227 -0
- package/dist/components/input/multimodal/multimodalInput/index.d.ts +5 -0
- package/dist/components/input/multimodal/multimodalInput/index.d.ts.map +1 -0
- package/dist/components/input/multimodal/multimodalInput/index.js +1 -0
- package/dist/components/input/multimodal/multimodalInput/multimodalInput.d.ts +8 -1
- package/dist/components/input/multimodal/multimodalInput/multimodalInput.d.ts.map +1 -1
- package/dist/components/input/multimodal/uploader/index.css +145 -0
- package/dist/components/input/multimodal/uploader/index.d.ts +5 -0
- package/dist/components/input/multimodal/uploader/index.d.ts.map +1 -0
- package/dist/components/input/multimodal/uploader/index.js +1 -0
- package/dist/components/input/textInput/index.css +57 -0
- package/dist/components/input/textInput/index.d.ts +4 -0
- package/dist/components/input/textInput/index.d.ts.map +1 -0
- package/dist/components/input/textInput/index.js +1 -0
- package/dist/components/input/textInput/textInput.d.ts +0 -3
- package/dist/components/input/textInput/textInput.d.ts.map +1 -1
- package/dist/components/map/index.css +13 -0
- package/dist/components/map/index.d.ts +5 -0
- package/dist/components/map/index.d.ts.map +1 -0
- package/dist/components/map/index.js +1 -0
- package/dist/components/map/openLayersMap.d.ts +6 -1
- package/dist/components/map/openLayersMap.d.ts.map +1 -1
- package/dist/components/markdown/index.d.ts +6 -0
- package/dist/components/markdown/index.d.ts.map +1 -0
- package/dist/components/markdown/index.js +1 -0
- package/dist/components/markdown/markedMarkdown.d.ts +7 -1
- package/dist/components/markdown/markedMarkdown.d.ts.map +1 -1
- package/dist/components/media/audio/index.css +182 -0
- package/dist/components/media/audio/index.d.ts +5 -0
- package/dist/components/media/audio/index.d.ts.map +1 -0
- package/dist/components/media/audio/index.js +1 -0
- package/dist/components/media/video/index.css +225 -0
- package/dist/components/media/video/index.d.ts +5 -0
- package/dist/components/media/video/index.d.ts.map +1 -0
- package/dist/components/media/video/index.js +1 -0
- package/dist/components/menu/index.css +26 -0
- package/dist/components/menu/index.d.ts +4 -0
- package/dist/components/menu/index.d.ts.map +1 -0
- package/dist/components/menu/index.js +1 -0
- package/dist/components/messageCanvas/actions/action.d.ts +12 -0
- package/dist/components/messageCanvas/actions/action.d.ts.map +1 -0
- package/dist/components/messageCanvas/actions/copy/index.css +8 -0
- package/dist/components/messageCanvas/actions/copy/index.d.ts +3 -0
- package/dist/components/messageCanvas/actions/copy/index.d.ts.map +1 -0
- package/dist/components/messageCanvas/actions/copy/index.js +1 -0
- package/dist/components/messageCanvas/actions/index.css +4 -0
- package/dist/components/messageCanvas/actions/index.d.ts +4 -11
- package/dist/components/messageCanvas/actions/index.d.ts.map +1 -1
- package/dist/components/messageCanvas/actions/index.js +1 -0
- package/dist/components/messageCanvas/actions/textToSpeech/index.css +8 -0
- package/dist/components/messageCanvas/actions/textToSpeech/index.d.ts +3 -0
- package/dist/components/messageCanvas/actions/textToSpeech/index.d.ts.map +1 -0
- package/dist/components/messageCanvas/actions/textToSpeech/index.js +1 -0
- package/dist/components/messageCanvas/actions/textToSpeech/textToSpeech.d.ts.map +1 -1
- package/dist/components/messageCanvas/index.css +39 -0
- package/dist/components/messageCanvas/index.d.ts +4 -0
- package/dist/components/messageCanvas/index.d.ts.map +1 -0
- package/dist/components/messageCanvas/index.js +1 -0
- package/dist/components/messageSpace/index.css +63 -0
- package/dist/components/messageSpace/index.d.ts +4 -0
- package/dist/components/messageSpace/index.d.ts.map +1 -0
- package/dist/components/messageSpace/index.js +1 -0
- package/dist/components/messageSpace/messageSpace.d.ts.map +1 -1
- package/dist/components/multipart/index.css +134 -0
- package/dist/components/multipart/index.d.ts +5 -0
- package/dist/components/multipart/index.d.ts.map +1 -0
- package/dist/components/multipart/index.js +1 -0
- package/dist/components/participantsContainer/index.css +42 -0
- package/dist/components/participantsContainer/index.d.ts +4 -0
- package/dist/components/participantsContainer/index.d.ts.map +1 -0
- package/dist/components/participantsContainer/index.js +1 -0
- package/dist/components/pdfViewer/index.css +60 -0
- package/dist/components/pdfViewer/index.d.ts +5 -0
- package/dist/components/pdfViewer/index.d.ts.map +1 -0
- package/dist/components/pdfViewer/index.js +1 -0
- package/dist/components/pdfViewer/pdfViewer.d.ts +4 -0
- package/dist/components/pdfViewer/pdfViewer.d.ts.map +1 -1
- package/dist/components/promptBuilder/index.css +96 -0
- package/dist/components/promptBuilder/index.d.ts +5 -0
- package/dist/components/promptBuilder/index.d.ts.map +1 -0
- package/dist/components/promptBuilder/index.js +1 -0
- package/dist/components/promptBuilder/mockWebSocket.d.ts +5 -0
- package/dist/components/promptBuilder/mockWebSocket.d.ts.map +1 -0
- package/dist/components/promptBuilder/promptBuilder.d.ts +24 -0
- package/dist/components/promptBuilder/promptBuilder.d.ts.map +1 -0
- package/dist/components/question/index.css +14 -0
- package/dist/components/question/index.d.ts +5 -0
- package/dist/components/question/index.d.ts.map +1 -0
- package/dist/components/question/index.js +1 -0
- package/dist/components/question/question.d.ts +7 -1
- package/dist/components/question/question.d.ts.map +1 -1
- package/dist/components/table/index.css +43 -0
- package/dist/components/table/index.d.ts +5 -0
- package/dist/components/table/index.d.ts.map +1 -0
- package/dist/components/table/index.js +1 -0
- package/dist/components/text/index.css +5 -0
- package/dist/components/text/index.d.ts +7 -0
- package/dist/components/text/index.d.ts.map +1 -0
- package/dist/components/text/index.js +1 -0
- package/dist/components/text/text.d.ts +7 -1
- package/dist/components/text/text.d.ts.map +1 -1
- package/dist/components/timestamp/index.d.ts +3 -0
- package/dist/components/timestamp/index.d.ts.map +1 -0
- package/dist/components/types.d.ts +17 -31
- package/dist/components/types.d.ts.map +1 -1
- package/dist/components/video/index.css +34 -0
- package/dist/components/video/index.d.ts +3 -0
- package/dist/components/video/index.d.ts.map +1 -0
- package/dist/components/video/index.js +1 -0
- package/dist/components/video/youtubeVideo.d.ts +8 -1
- package/dist/components/video/youtubeVideo.d.ts.map +1 -1
- package/dist/components/visualization/chart/index.css +44 -0
- package/dist/components/visualization/chart/index.d.ts +4 -0
- package/dist/components/visualization/chart/index.d.ts.map +1 -0
- package/dist/components/visualization/chart/index.js +1 -0
- package/dist/components/visualization/chart/rechartsTimeSeries.d.ts +8 -1
- package/dist/components/visualization/chart/rechartsTimeSeries.d.ts.map +1 -1
- package/dist/components/visualization/mermaidViz/index.css +21 -0
- package/dist/components/visualization/mermaidViz/index.d.ts +5 -0
- package/dist/components/visualization/mermaidViz/index.d.ts.map +1 -0
- package/dist/components/visualization/mermaidViz/index.js +1 -0
- package/dist/components/visualization/mermaidViz/mermaidViz.d.ts +9 -2
- package/dist/components/visualization/mermaidViz/mermaidViz.d.ts.map +1 -1
- package/dist/components/visualization/mermaidViz/mermaidViz.types.d.ts +10 -0
- package/dist/components/visualization/mermaidViz/mermaidViz.types.d.ts.map +1 -0
- package/dist/components/visualization/perspectiveViz/index.css +16 -0
- package/dist/components/visualization/perspectiveViz/index.d.ts +5 -0
- package/dist/components/visualization/perspectiveViz/index.d.ts.map +1 -0
- package/dist/components/visualization/perspectiveViz/index.js +1 -0
- package/dist/components/visualization/perspectiveViz/perspectiveViz.d.ts +7 -4
- package/dist/components/visualization/perspectiveViz/perspectiveViz.d.ts.map +1 -1
- package/dist/components/visualization/vegaLiteViz/index.css +45 -0
- package/dist/components/visualization/vegaLiteViz/index.d.ts +5 -0
- package/dist/components/visualization/vegaLiteViz/index.d.ts.map +1 -0
- package/dist/components/visualization/vegaLiteViz/index.js +1 -0
- package/dist/components/visualization/vegaLiteViz/vegaLiteViz.d.ts +9 -2
- package/dist/components/visualization/vegaLiteViz/vegaLiteViz.d.ts.map +1 -1
- package/dist/components/visualization/vegaLiteViz/vegaLiteViz.types.d.ts +20 -0
- package/dist/components/visualization/vegaLiteViz/vegaLiteViz.types.d.ts.map +1 -0
- package/dist/components/weather/index.css +77 -0
- package/dist/components/weather/index.d.ts +5 -0
- package/dist/components/weather/index.d.ts.map +1 -0
- package/dist/components/weather/index.js +1 -0
- package/dist/index.css +62 -0
- package/dist/index.js +1 -2
- package/dist/rusticTheme.d.ts +29 -0
- package/dist/rusticTheme.d.ts.map +1 -1
- package/dist/rusticTheme.js +1 -0
- package/package.json +123 -22
- package/dist/index.js.LICENSE.txt +0 -1
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import './fCCalendar.css';
|
|
2
2
|
import type { CalendarData } from '../types';
|
|
3
3
|
/** The `FCCalendar` component integrates the [FullCalendar](https://fullcalendar.io/docs) library to provide a versatile and interactive calendar view for managing events. It allows users to view events across different time frames and provides features for navigation.
|
|
4
|
-
|
|
5
|
-
*
|
|
4
|
+
*
|
|
5
|
+
* FullCalendar libraries are not bundled, so please install the following packages using npm:
|
|
6
|
+
*
|
|
7
|
+
* ```typescript
|
|
8
|
+
* npm i @fullcalendar/core @fullcalendar/daygrid @fullcalendar/react
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* **Note**: On mobile screens, the calendar will default to the day view, offering users a detailed perspective of events for the selected day. Conversely, on larger screens, such as desktops or tablets, the calendar will default to the month view, offering users an overview of events scheduled throughout the month. */
|
|
6
12
|
export default function FCCalendar(props: CalendarData): import("react/jsx-runtime").JSX.Element;
|
|
7
13
|
//# sourceMappingURL=fCCalendar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fCCalendar.d.ts","sourceRoot":"","sources":["../../../src/components/calendar/fCCalendar.tsx"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAA;AASzB,OAAO,KAAK,EAAE,YAAY,EAAiB,MAAM,UAAU,CAAA;AAa3D
|
|
1
|
+
{"version":3,"file":"fCCalendar.d.ts","sourceRoot":"","sources":["../../../src/components/calendar/fCCalendar.tsx"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAA;AASzB,OAAO,KAAK,EAAE,YAAY,EAAiB,MAAM,UAAU,CAAA;AAa3D;;;;;;;;iUAQiU;AACjU,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,KAAK,EAAE,YAAY,2CAwCrD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.rustic-fc-calendar .fc-event {
|
|
2
|
+
overflow: hidden;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.rustic-fc-calendar .fc-button {
|
|
6
|
+
font-size: 12px;
|
|
7
|
+
padding: 2px 4px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.rustic-fc-calendar .fc-toolbar-title {
|
|
11
|
+
font-size: 16px;
|
|
12
|
+
padding-inline: 8px;
|
|
13
|
+
text-align: center;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@media (max-width: 900px) {
|
|
17
|
+
.rustic-fc-calendar {
|
|
18
|
+
font-size: 12px;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/calendar/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAA;AAEzB,OAAO,UAAU,MAAM,cAAc,CAAA;AAErC,cAAc,UAAU,CAAA;AACxB,eAAe,UAAU,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 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,{ParticipantRole:()=>s,ParticipantType:()=>m,default:()=>p});const r=require("react/jsx-runtime"),i=require("@fullcalendar/daygrid");var a=e.n(i);const n=require("@fullcalendar/react");var o=e.n(n);const u=require("@mui/material/Box");var d=e.n(u);const l=require("@mui/material/styles"),c=require("@mui/material/useMediaQuery");var s,m,y=e.n(c);function f(e){return{title:e.title?e.title:"",start:e.start,end:e.end,allDay:e.isAllDay}}require("react"),function(e){e.Owner="owner",e.Member="member"}(s||(s={})),function(e){e.Human="human",e.Agent="agent"}(m||(m={}));const p=function(e){var t=(0,l.useTheme)(),i=y()(t.breakpoints.up("md"));return(0,r.jsx)(d(),{className:"rustic-fc-calendar",children:(0,r.jsx)(o(),{plugins:[a()],initialView:i?"dayGridMonth":"dayGridDay",headerToolbar:{left:"prev,next",center:"title",right:"dayGridMonth,dayGridWeek,dayGridDay"},eventTimeFormat:{hour:"2-digit",minute:"2-digit"},initialDate:e.events[0].start,events:e.events.map(f),views:{dayGridMonth:{titleFormat:{year:"numeric",month:"short"}},dayGridWeek:{},dayGridDay:{titleFormat:{year:"numeric",month:"short",day:"numeric"}}}})})};return t})()));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/codeSnippet/index.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAA;AAE1B,OAAO,WAAW,MAAM,eAAe,CAAA;AAEvC,cAAc,UAAU,CAAA;AACxB,eAAe,WAAW,CAAA"}
|
|
@@ -0,0 +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,{ParticipantRole:()=>s,ParticipantType:()=>f,default:()=>g});const t=require("react/jsx-runtime"),n=require("@codemirror/language"),o=require("@codemirror/language-data"),a=require("@codemirror/state"),i=require("@codemirror/view"),u=require("@mui/material/Typography");var c=e.n(u);const l=require("@mui/system"),d=require("react");var s,f;!function(e){e.Owner="owner",e.Member="member"}(s||(s={})),function(e){e.Human="human",e.Agent="agent"}(f||(f={}));const g=function(e){var r=(0,d.useRef)(null),u=(0,d.useRef)(),s=new a.Compartment,f=[a.EditorState.readOnly.of(!0),(0,i.highlightSpecialChars)(),(0,n.syntaxHighlighting)(n.defaultHighlightStyle,{fallback:!0}),s.of([])],g=o.languages.find((function(r){return r.name.toLowerCase()===e.language.toLowerCase()}));return(0,d.useEffect)((function(){if(r.current&&!u.current){var t=r.current,n=a.EditorState.create({doc:e.code,extensions:f});u.current=new i.EditorView({state:n,parent:t}),g&&u.current&&g.load().then((function(e){var r;null===(r=u.current)||void 0===r||r.dispatch({effects:s.reconfigure(e.extension)})}))}}),[]),(0,t.jsx)(l.Box,{sx:{backgroundColor:"background.default"},className:"rustic-code-snippet",children:(0,t.jsx)("div",{"aria-label":"code snippet",ref:r,children:(0,t.jsx)(c(),{variant:"body2","aria-label":"language type",children:e.language})})})};return r})()));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/elementRenderer/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,mBAAmB,CAAA;AAE/C,eAAe,eAAe,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 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:()=>d});const r=require("react/jsx-runtime"),a=require("@mui/material/Typography");var o=e.n(a);const n=require("react");var s=e.n(n),i=function(){return i=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},i.apply(this,arguments)};const d=function(e){var t=e.supportedElements[e.message.format];return(0,r.jsx)(r.Fragment,{children:t?s().createElement(t,i(i({sender:e.sender,ws:e.ws,messageId:e.message.id,conversationId:e.message.conversationId},e.message.data),e.message.threadMessagesData&&{updatedData:e.message.threadMessagesData})):(0,r.jsxs)(o(),{variant:"body2",children:["Unsupported element format: ",e.message.format]})})};return t})()));
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
figcaption {
|
|
2
|
+
word-wrap: break-word;
|
|
3
|
+
margin-top: 16px;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
figure {
|
|
7
|
+
margin-inline: 0;
|
|
8
|
+
margin-block: 0;
|
|
9
|
+
}
|
|
10
|
+
body {
|
|
11
|
+
margin: 0;
|
|
12
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
|
13
|
+
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
|
14
|
+
sans-serif;
|
|
15
|
+
-webkit-font-smoothing: antialiased;
|
|
16
|
+
-moz-osx-font-smoothing: grayscale;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
code {
|
|
20
|
+
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
|
21
|
+
monospace;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.rustic-fit-container {
|
|
25
|
+
object-fit: contain;
|
|
26
|
+
width: 100%;
|
|
27
|
+
height: 100%;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.rustic-files {
|
|
31
|
+
display: flex;
|
|
32
|
+
gap: 8px;
|
|
33
|
+
flex-wrap: wrap;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.rustic-cursor-pointer {
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.rustic-align-self-center {
|
|
41
|
+
align-self: center;
|
|
42
|
+
}
|
|
43
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/image/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAEpB,OAAO,KAAK,MAAM,SAAS,CAAA;AAE3B,cAAc,UAAU,CAAA;AACxB,eAAe,KAAK,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 n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{ParticipantRole:()=>l,ParticipantType:()=>p,default:()=>y});const r=require("react/jsx-runtime"),n=require("@mui/material/CircularProgress");var o=e.n(n);const i=require("@mui/material/Typography");var a=e.n(i);const c=require("react");require("pluralize");var u,s=function(){return s=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},s.apply(this,arguments)};!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(u||(u={}));var l,p,f=function(){return f=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},f.apply(this,arguments)};function d(e){var t,n,i,u=(0,c.useState)(!0),l=u[0],p=u[1],d=(0,c.useState)(""),y=d[0],m=d[1];return y.length>0?(0,r.jsx)(a(),{variant:"body2",children:y}):(0,r.jsxs)("figure",{children:[l&&(0,r.jsx)(o(),{}),(0,r.jsx)("img",f({},(t=e.width,n=e.height,i={},t&&(i={width:t}),n&&(i=s(s({},i),{height:n})),t||n||(i={className:"rustic-fit-container"}),i),{src:e.src,alt:e.alt,onError:function(){m("Image failed to load"),p(!1)},onLoad:function(){p(!1)}})),e.description&&(0,r.jsx)("figcaption",{children:(0,r.jsx)(a(),{variant:"body2",children:e.description})})]})}d.defaultProps={alt:"An image is displayed"},function(e){e.Owner="owner",e.Member="member"}(l||(l={})),function(e){e.Human="human",e.Agent="agent"}(p||(p={}));const y=d;return t})()));
|
|
@@ -19,6 +19,7 @@ import MessageSpace from './messageSpace/messageSpace';
|
|
|
19
19
|
import Multipart from './multipart/multipart';
|
|
20
20
|
import ParticipantsContainer from './participantsContainer/participantsContainer';
|
|
21
21
|
import PDFViewer from './pdfViewer/pdfViewer';
|
|
22
|
+
import PromptBuilder from './promptBuilder/promptBuilder';
|
|
22
23
|
import Question from './question/question';
|
|
23
24
|
import Table from './table/table';
|
|
24
25
|
import StreamingText from './text/streamingText';
|
|
@@ -30,7 +31,9 @@ import MermaidViz from './visualization/mermaidViz/mermaidViz';
|
|
|
30
31
|
import PerspectiveViz from './visualization/perspectiveViz/perspectiveViz';
|
|
31
32
|
import VegaLiteViz from './visualization/vegaLiteViz/vegaLiteViz';
|
|
32
33
|
import Weather from './weather/weather';
|
|
33
|
-
export { Action, CodeSnippet, CopyText, ElementRenderer, FCCalendar, Image, MarkedMarkdown, MarkedStreamingMarkdown, MermaidViz, MessageCanvas, MessageSpace, MultimodalInput, Multipart, OpenLayersMap, ParticipantsContainer, PDFViewer, PerspectiveViz, PopoverMenu, Question, RechartsTimeSeries, Sound, StreamingText, Table, Text, TextInput, TextToSpeech, Timestamp, Uploader, VegaLiteViz, Video, Weather, YoutubeVideo, };
|
|
34
|
+
export { Action, CodeSnippet, CopyText, ElementRenderer, FCCalendar, Image, MarkedMarkdown, MarkedStreamingMarkdown, MermaidViz, MessageCanvas, MessageSpace, MultimodalInput, Multipart, OpenLayersMap, ParticipantsContainer, PDFViewer, PerspectiveViz, PopoverMenu, PromptBuilder, Question, RechartsTimeSeries, Sound, StreamingText, Table, Text, TextInput, TextToSpeech, Timestamp, Uploader, VegaLiteViz, Video, Weather, YoutubeVideo, };
|
|
34
35
|
export * from '../rusticTheme';
|
|
35
36
|
export * from './types';
|
|
37
|
+
export * from './visualization/mermaidViz/mermaidViz.types';
|
|
38
|
+
export * from './visualization/vegaLiteViz/vegaLiteViz.types';
|
|
36
39
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,uBAAuB,CAAA;AAC9C,OAAO,WAAW,MAAM,2BAA2B,CAAA;AACnD,OAAO,eAAe,MAAM,mCAAmC,CAAA;AAC/D,OAAO,KAAK,MAAM,eAAe,CAAA;AACjC,OAAO,eAAe,MAAM,oDAAoD,CAAA;AAChF,OAAO,QAAQ,MAAM,sCAAsC,CAAA;AAC3D,OAAO,SAAS,MAAM,6BAA6B,CAAA;AACnD,OAAO,aAAa,MAAM,qBAAqB,CAAA;AAC/C,OAAO,cAAc,MAAM,2BAA2B,CAAA;AACtD,OAAO,uBAAuB,MAAM,oCAAoC,CAAA;AACxE,OAAO,KAAK,MAAM,qBAAqB,CAAA;AACvC,OAAO,KAAK,MAAM,qBAAqB,CAAA;AACvC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAC5C,OAAO,QAAQ,MAAM,uCAAuC,CAAA;AAC5D,OAAO,MAAM,MAAM,+BAA+B,CAAA;AAClD,OAAO,YAAY,MAAM,mDAAmD,CAAA;AAC5E,OAAO,aAAa,MAAM,+BAA+B,CAAA;AACzD,OAAO,YAAY,MAAM,6BAA6B,CAAA;AACtD,OAAO,SAAS,MAAM,uBAAuB,CAAA;AAC7C,OAAO,qBAAqB,MAAM,+CAA+C,CAAA;AACjF,OAAO,SAAS,MAAM,uBAAuB,CAAA;AAC7C,OAAO,QAAQ,MAAM,qBAAqB,CAAA;AAC1C,OAAO,KAAK,MAAM,eAAe,CAAA;AACjC,OAAO,aAAa,MAAM,sBAAsB,CAAA;AAChD,OAAO,IAAI,MAAM,aAAa,CAAA;AAC9B,OAAO,SAAS,MAAM,uBAAuB,CAAA;AAC7C,OAAO,YAAY,MAAM,sBAAsB,CAAA;AAC/C,OAAO,kBAAkB,MAAM,0CAA0C,CAAA;AACzE,OAAO,UAAU,MAAM,uCAAuC,CAAA;AAC9D,OAAO,cAAc,MAAM,+CAA+C,CAAA;AAC1E,OAAO,WAAW,MAAM,yCAAyC,CAAA;AACjE,OAAO,OAAO,MAAM,mBAAmB,CAAA;AAEvC,OAAO,EACL,MAAM,EACN,WAAW,EACX,QAAQ,EACR,eAAe,EACf,UAAU,EACV,KAAK,EACL,cAAc,EACd,uBAAuB,EACvB,UAAU,EACV,aAAa,EACb,YAAY,EACZ,eAAe,EACf,SAAS,EACT,aAAa,EACb,qBAAqB,EACrB,SAAS,EACT,cAAc,EACd,WAAW,EACX,QAAQ,EACR,kBAAkB,EAClB,KAAK,EACL,aAAa,EACb,KAAK,EACL,IAAI,EACJ,SAAS,EACT,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,WAAW,EACX,KAAK,EACL,OAAO,EACP,YAAY,GACb,CAAA;AAED,cAAc,gBAAgB,CAAA;AAC9B,cAAc,SAAS,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,uBAAuB,CAAA;AAC9C,OAAO,WAAW,MAAM,2BAA2B,CAAA;AACnD,OAAO,eAAe,MAAM,mCAAmC,CAAA;AAC/D,OAAO,KAAK,MAAM,eAAe,CAAA;AACjC,OAAO,eAAe,MAAM,oDAAoD,CAAA;AAChF,OAAO,QAAQ,MAAM,sCAAsC,CAAA;AAC3D,OAAO,SAAS,MAAM,6BAA6B,CAAA;AACnD,OAAO,aAAa,MAAM,qBAAqB,CAAA;AAC/C,OAAO,cAAc,MAAM,2BAA2B,CAAA;AACtD,OAAO,uBAAuB,MAAM,oCAAoC,CAAA;AACxE,OAAO,KAAK,MAAM,qBAAqB,CAAA;AACvC,OAAO,KAAK,MAAM,qBAAqB,CAAA;AACvC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAC5C,OAAO,QAAQ,MAAM,uCAAuC,CAAA;AAC5D,OAAO,MAAM,MAAM,+BAA+B,CAAA;AAClD,OAAO,YAAY,MAAM,mDAAmD,CAAA;AAC5E,OAAO,aAAa,MAAM,+BAA+B,CAAA;AACzD,OAAO,YAAY,MAAM,6BAA6B,CAAA;AACtD,OAAO,SAAS,MAAM,uBAAuB,CAAA;AAC7C,OAAO,qBAAqB,MAAM,+CAA+C,CAAA;AACjF,OAAO,SAAS,MAAM,uBAAuB,CAAA;AAC7C,OAAO,aAAa,MAAM,+BAA+B,CAAA;AACzD,OAAO,QAAQ,MAAM,qBAAqB,CAAA;AAC1C,OAAO,KAAK,MAAM,eAAe,CAAA;AACjC,OAAO,aAAa,MAAM,sBAAsB,CAAA;AAChD,OAAO,IAAI,MAAM,aAAa,CAAA;AAC9B,OAAO,SAAS,MAAM,uBAAuB,CAAA;AAC7C,OAAO,YAAY,MAAM,sBAAsB,CAAA;AAC/C,OAAO,kBAAkB,MAAM,0CAA0C,CAAA;AACzE,OAAO,UAAU,MAAM,uCAAuC,CAAA;AAC9D,OAAO,cAAc,MAAM,+CAA+C,CAAA;AAC1E,OAAO,WAAW,MAAM,yCAAyC,CAAA;AACjE,OAAO,OAAO,MAAM,mBAAmB,CAAA;AAEvC,OAAO,EACL,MAAM,EACN,WAAW,EACX,QAAQ,EACR,eAAe,EACf,UAAU,EACV,KAAK,EACL,cAAc,EACd,uBAAuB,EACvB,UAAU,EACV,aAAa,EACb,YAAY,EACZ,eAAe,EACf,SAAS,EACT,aAAa,EACb,qBAAqB,EACrB,SAAS,EACT,cAAc,EACd,WAAW,EACX,aAAa,EACb,QAAQ,EACR,kBAAkB,EAClB,KAAK,EACL,aAAa,EACb,KAAK,EACL,IAAI,EACJ,SAAS,EACT,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,WAAW,EACX,KAAK,EACL,OAAO,EACP,YAAY,GACb,CAAA;AAED,cAAc,gBAAgB,CAAA;AAC9B,cAAc,SAAS,CAAA;AACvB,cAAc,6CAA6C,CAAA;AAC3D,cAAc,+CAA+C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseInput.d.ts","sourceRoot":"","sources":["../../../../src/components/input/baseInput/baseInput.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAA;AAexB,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,KAAK,EAAE,cAAc,EAAW,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"baseInput.d.ts","sourceRoot":"","sources":["../../../../src/components/input/baseInput/baseInput.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAA;AAexB,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,KAAK,EAAE,cAAc,EAAW,MAAM,aAAa,CAAA;AA+V1D,QAAA,MAAM,SAAS;;wCAA+B,CAAA;AAU9C,eAAe,SAAS,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
emoji-picker {
|
|
2
|
+
--border-color: transparent;
|
|
3
|
+
--outline-size: 1px;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
@media screen and (max-width: 600px) {
|
|
7
|
+
emoji-picker {
|
|
8
|
+
--num-columns: 5;
|
|
9
|
+
--category-emoji-size: 1.125rem;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
span.rustic-icon-large {
|
|
14
|
+
font-size: 32px;
|
|
15
|
+
}
|
|
16
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/input/emoji/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAEpB,OAAO,KAAK,MAAM,SAAS,CAAA;AAC3B,eAAe,KAAK,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,t,r={13:e=>{e.exports=require("emoji-picker-element")}},o={};function n(e){var t=o[e];if(void 0!==t)return t.exports;var i=o[e]={exports:{}};return r[e](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,n.t=function(r,o){if(1&o&&(r=this(r)),8&o)return r;if("object"==typeof r&&r){if(4&o&&r.__esModule)return r;if(16&o&&"function"==typeof r.then)return r}var i=Object.create(null);n.r(i);var c={};e=e||[null,t({}),t([]),t(t)];for(var a=2&o&&r;"object"==typeof a&&!~e.indexOf(a);a=t(a))Object.getOwnPropertyNames(a).forEach((e=>c[e]=()=>r[e]));return c.default=()=>r,n.d(i,c),i},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{n.r(i),n.d(i,{default:()=>f});const e=require("react/jsx-runtime");n(13);const t=require("@mui/material/IconButton");var r=n.n(t);const o=require("@mui/material/Popover");var c=n.n(o);const a=require("@mui/material/styles"),u=require("@mui/material/Tooltip");var l=n.n(u);const s=require("react");function d(t){return t.name.replaceAll("_","-"),(0,e.jsx)("span",{className:"".concat(t.className?t.className+" ":"","material-symbols-rounded"),children:t.name})}const f=function(t){var o=(0,a.useTheme)(),i=(0,s.useRef)(null),u=(0,s.useRef)(null),f=(0,s.useState)(!1),p=f[0],m=f[1],j={"--indicator-color":o.palette.divider,"--background":o.palette.background.paper,"--input-border-color":o.palette.divider,"--outline-color":o.palette.secondary.main};function v(){m(!1)}function b(e){e.detail.unicode&&t.onEmojiClick(e.detail.unicode),v()}return(0,s.useEffect)((function(){u.current||"undefined"==typeof window||Promise.resolve().then(n.t.bind(n,13,23)).then((function(e){var t=new(0,e.Picker),r="dark"===o.palette.mode?"dark":"light";t.classList.add(r),Object.keys(j).forEach((function(e){t.style.setProperty(e,j[e])})),u.current=t})).catch((function(e){console.error("Failed to load emoji picker",e)}))}),[]),(0,s.useEffect)((function(){return u.current&&u.current.addEventListener("emoji-click",b),function(){var e;null===(e=u.current)||void 0===e||e.removeEventListener("emoji-click",b)}}),[p,t.onEmojiClick]),(0,e.jsxs)("div",{children:[(0,e.jsx)(l(),{title:"Emoji",children:(0,e.jsx)(r(),{size:"small",ref:i,onClick:function(){m((function(e){return!e}))},sx:{color:t.buttonColor},children:(0,e.jsx)(d,{name:"Mood"})})}),u.current&&(0,e.jsx)(c(),{open:p,anchorEl:i.current,onClose:v,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"right"},children:(0,e.jsx)("div",{className:"rustic-emoji-picker",ref:function(e){e&&u.current&&!e.contains(u.current)&&e.appendChild(u.current)}})})]})}})(),i})()));
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
.rustic-multimodal-input .rustic-bottom-buttons {
|
|
2
|
+
display: flex;
|
|
3
|
+
justify-content: space-between;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.rustic-multimodal-input .rustic-text-field fieldset[aria-hidden='true'] {
|
|
7
|
+
border-width: 1px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.rustic-multimodal-input .rustic-base-input {
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
gap: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.rustic-multimodal-input .rustic-input-actions {
|
|
16
|
+
width: 100%;
|
|
17
|
+
position: relative;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.rustic-multimodal-input .rustic-input-actions .rustic-send-button {
|
|
21
|
+
position: absolute;
|
|
22
|
+
bottom: 0;
|
|
23
|
+
right: 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.rustic-bottom-buttons {
|
|
27
|
+
padding: 8px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
body {
|
|
31
|
+
margin: 0;
|
|
32
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
|
33
|
+
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
|
34
|
+
sans-serif;
|
|
35
|
+
-webkit-font-smoothing: antialiased;
|
|
36
|
+
-moz-osx-font-smoothing: grayscale;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
code {
|
|
40
|
+
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
|
41
|
+
monospace;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.rustic-fit-container {
|
|
45
|
+
object-fit: contain;
|
|
46
|
+
width: 100%;
|
|
47
|
+
height: 100%;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.rustic-files {
|
|
51
|
+
display: flex;
|
|
52
|
+
gap: 8px;
|
|
53
|
+
flex-wrap: wrap;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.rustic-cursor-pointer {
|
|
57
|
+
cursor: pointer;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.rustic-align-self-center {
|
|
61
|
+
align-self: center;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.rustic-base-input {
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: flex-start;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.rustic-base-input .rustic-text-field {
|
|
70
|
+
padding: 16px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.rustic-base-input .rustic-text-field fieldset[aria-hidden='true'] {
|
|
74
|
+
border-width: 1px;
|
|
75
|
+
border: none;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.rustic-error-and-input-container {
|
|
79
|
+
width: 100%;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.rustic-base-input .rustic-input-field {
|
|
83
|
+
display: flex;
|
|
84
|
+
border-radius: 16px;
|
|
85
|
+
position: relative;
|
|
86
|
+
flex-direction: column;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.rustic-base-input .rustic-input-label {
|
|
90
|
+
padding-top: 8px;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.rustic-base-input .rustic-text-field .MuiOutlinedInput-input {
|
|
94
|
+
padding: 0;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.rustic-base-input .rustic-text-field .MuiOutlinedInput-root {
|
|
98
|
+
padding: 0;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.rustic-base-input .rustic-send-button {
|
|
102
|
+
margin: 10px 8px;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
span.rustic-icon-large {
|
|
106
|
+
font-size: 32px;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
emoji-picker {
|
|
110
|
+
--border-color: transparent;
|
|
111
|
+
--outline-size: 1px;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@media screen and (max-width: 600px) {
|
|
115
|
+
emoji-picker {
|
|
116
|
+
--num-columns: 5;
|
|
117
|
+
--category-emoji-size: 1.125rem;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.rustic-file-preview .rustic-upload-progress {
|
|
122
|
+
width: 40px;
|
|
123
|
+
height: 8px;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.rustic-file-preview .rustic-flex-center {
|
|
127
|
+
display: flex;
|
|
128
|
+
align-items: center;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.rustic-uploader input {
|
|
132
|
+
display: none;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.rustic-error-message {
|
|
136
|
+
display: block;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.rustic-padding-16 {
|
|
140
|
+
padding: 16px;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.rustic-file-preview {
|
|
144
|
+
position: relative;
|
|
145
|
+
display: flex;
|
|
146
|
+
align-items: center;
|
|
147
|
+
padding: 8px 8px 8px 16px;
|
|
148
|
+
justify-content: space-between;
|
|
149
|
+
width: 220px;
|
|
150
|
+
height: 56px;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.rustic-file-preview-modal {
|
|
154
|
+
width: 90vw;
|
|
155
|
+
height: 90vh;
|
|
156
|
+
display: flex;
|
|
157
|
+
align-self: center;
|
|
158
|
+
justify-self: center;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.rustic-file-preview-modal .rustic-modal-content {
|
|
162
|
+
position: relative;
|
|
163
|
+
width: 100%;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.rustic-modal-content .rustic-close-button {
|
|
167
|
+
position: absolute;
|
|
168
|
+
top: 16px;
|
|
169
|
+
right: 16px;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.rustic-pdf-viewer {
|
|
173
|
+
width: 100%;
|
|
174
|
+
height: 100%;
|
|
175
|
+
display: flex;
|
|
176
|
+
flex-direction: column;
|
|
177
|
+
padding: 16px;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.rustic-pdf-error {
|
|
181
|
+
padding: 16px;
|
|
182
|
+
width: fit-content;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.rustic-pdf-viewer .rustic-pdf-viewer-header {
|
|
186
|
+
display: flex;
|
|
187
|
+
align-items: center;
|
|
188
|
+
margin-bottom: 8px;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.rustic-pdf-viewer .rustic-pdf-canvas {
|
|
192
|
+
flex: 1;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.rustic-pdf-viewer .rustic-pdf-page-input > div {
|
|
196
|
+
height: 24px;
|
|
197
|
+
width: 56px;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.rustic-pdf-viewer .rustic-pdf-page-input input {
|
|
201
|
+
text-align: center;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.rustic-pdf-viewer
|
|
205
|
+
.rustic-pdf-page-input
|
|
206
|
+
input[type='number']::-webkit-inner-spin-button {
|
|
207
|
+
display: none;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.rustic-pdf-viewer .rustic-page-indicator {
|
|
211
|
+
display: flex;
|
|
212
|
+
align-items: center;
|
|
213
|
+
gap: 8px;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.rustic-pdf-viewer-body {
|
|
217
|
+
flex: 1;
|
|
218
|
+
display: flex;
|
|
219
|
+
justify-content: center;
|
|
220
|
+
overflow: auto;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.rustic-pdf-viewer-body-inner {
|
|
224
|
+
overflow: auto;
|
|
225
|
+
width: fit-content;
|
|
226
|
+
}
|
|
227
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/multimodal/multimodalInput/index.ts"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAA;AAE9B,OAAO,eAAe,MAAM,mBAAmB,CAAA;AAE/C,cAAc,gBAAgB,CAAA;AAC9B,eAAe,eAAe,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports["@rustic-ai/ui-components"]=n():e["@rustic-ai/ui-components"]=n()}(global,(()=>(()=>{"use strict";var e,n,r={13:e=>{e.exports=require("emoji-picker-element")}},t={};function i(e){var n=t[e];if(void 0!==n)return n.exports;var o=t[e]={exports:{}};return r[e](o,o.exports,i),o.exports}i.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return i.d(n,{a:n}),n},n=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(r,t){if(1&t&&(r=this(r)),8&t)return r;if("object"==typeof r&&r){if(4&t&&r.__esModule)return r;if(16&t&&"function"==typeof r.then)return r}var o=Object.create(null);i.r(o);var a={};e=e||[null,n({}),n([]),n(n)];for(var c=2&t&&r;"object"==typeof c&&!~e.indexOf(c);c=n(c))Object.getOwnPropertyNames(c).forEach((e=>a[e]=()=>r[e]));return a.default=()=>r,i.d(o,a),o},i.d=(e,n)=>{for(var r in n)i.o(n,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},i.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{i.r(o),i.d(o,{ParticipantRole:()=>te,ParticipantType:()=>ie,default:()=>se});const e=require("react/jsx-runtime"),n=require("@mui/material/Box");var r=i.n(n);const t=require("react"),a=require("uuid"),c=require("@mui/material/CircularProgress");var s=i.n(c);const l=require("@mui/material/IconButton");var u=i.n(l);const d=require("@mui/material/InputAdornment");var f=i.n(d);const m=require("@mui/material/MenuItem");var p=i.n(m);const h=require("@mui/material/MenuList");var v=i.n(h);const g=require("@mui/material/Popover");var x=i.n(g);const j=require("@mui/material/TextField");var b=i.n(j);const y=require("@mui/material/Tooltip");var w=i.n(y);const S=require("@mui/material/Typography");var C=i.n(S),k=i(13);function N(n){return n.name.replaceAll("_","-"),(0,e.jsx)("span",{className:"".concat(n.className?n.className+" ":"","material-symbols-rounded"),children:n.name})}const F=require("@mui/material/styles"),P=function(n){var r=(0,F.useTheme)(),o=(0,t.useRef)(null),a=(0,t.useRef)(null),c=(0,t.useState)(!1),s=c[0],l=c[1],d={"--indicator-color":r.palette.divider,"--background":r.palette.background.paper,"--input-border-color":r.palette.divider,"--outline-color":r.palette.secondary.main};function f(){l(!1)}function m(e){e.detail.unicode&&n.onEmojiClick(e.detail.unicode),f()}return(0,t.useEffect)((function(){a.current||"undefined"==typeof window||Promise.resolve().then(i.t.bind(i,13,23)).then((function(e){var n=new(0,e.Picker),t="dark"===r.palette.mode?"dark":"light";n.classList.add(t),Object.keys(d).forEach((function(e){n.style.setProperty(e,d[e])})),a.current=n})).catch((function(e){console.error("Failed to load emoji picker",e)}))}),[]),(0,t.useEffect)((function(){return a.current&&a.current.addEventListener("emoji-click",m),function(){var e;null===(e=a.current)||void 0===e||e.removeEventListener("emoji-click",m)}}),[s,n.onEmojiClick]),(0,e.jsxs)("div",{children:[(0,e.jsx)(w(),{title:"Emoji",children:(0,e.jsx)(u(),{size:"small",ref:o,onClick:function(){l((function(e){return!e}))},sx:{color:n.buttonColor},children:(0,e.jsx)(N,{name:"Mood"})})}),a.current&&(0,e.jsx)(x(),{open:s,anchorEl:o.current,onClose:f,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"right"},children:(0,e.jsx)("div",{className:"rustic-emoji-picker",ref:function(e){e&&a.current&&!e.contains(a.current)&&e.appendChild(a.current)}})})]})};var O={"no-speech":"No speech detected. Check your microphone volume and try again.",aborted:"Speech input was aborted. Ensure no other windows are accessing your microphone and try again.","audio-capture":"Could not capture any audio. Check that your microphone is connected and try again.",network:"Failed to connect to the internet for recognition. Check your internet connection and try again.","not-allowed":"This functionality requires microphone access. Please allow microphone access and try again.","service-not-allowed":"Speech recognition service is not allowed, either because the browser doesn't support it or because of reasons of security, privacy or user preference.","bad-grammar":"There was an error in the speech recognition grammar or format. Check your speech input or grammar rules.","language-not-supported":"The language you're speaking isn't supported. Try speaking in a different language or check your device settings."};function E(e){if("unicode"in e&&"annotation"in e)return"".concat(e.unicode," ").concat(e.annotation)}var q=(0,t.forwardRef)((function(n,i){var o=(0,t.useState)(""),c=o[0],l=o[1],d=(0,t.useState)(!1),m=d[0],h=d[1],g=(0,t.useState)(!1),j=g[0],y=g[1],S=(0,t.useState)(!1),F=S[0],q=S[1],T=(0,t.useState)(""),z=T[0],R=T[1],_=(0,t.useState)([]),I=_[0],M=_[1],A=(0,t.useState)(!1),D=A[0],U=A[1],B=(0,t.useRef)(null),L=!c.trim().length&&!n.isSendEnabled,W="".concat(m?"Stop":"Start"," speech to text"),H=j?"primary.main":"primary.light",V=m?"error.main":H,$=m?"stop_circle":"speech_to_text";function G(e,n){if(void 0===n&&(n=!1),B.current){var r=B.current,t=r.selectionStart,i=r.selectionEnd;if("number"==typeof t&&"number"==typeof i){var o,a=c||"",s=a.substring(0,t),u=a.substring(i);o=n?s.replace(/:(\w+)$/,e)+u:s+e+u,l(o);var d=n?s.replace(/:(\w+)$/,e).length:t+e.length;setTimeout((function(){var e,n;null===(e=B.current)||void 0===e||e.focus(),null===(n=B.current)||void 0===n||n.setSelectionRange(d,d)}),0)}}U(!1)}var K=new k.Database,Q=F?(0,e.jsx)(s(),{size:24}):(0,e.jsx)(w(),{title:W,children:(0,e.jsx)(u(),{onClick:function(){var e=new window.webkitSpeechRecognition,n=navigator.language;e.lang=n,m?(e.stop(),q(!0),h(!1)):(e.start(),R(""),h(!0)),e.onstart=function(){h(!0)},e.onresult=function(e){var n,r=e.results[0][0].transcript;c.length>0?l(c+" "+r):l(r),null===(n=B.current)||void 0===n||n.focus(),h(!1)},e.onerror=function(e){var n=O[e.error];R(n),h(!1)},e.onend=function(){q(!1),h(!1)}},size:"small",sx:{color:V},children:(0,e.jsx)(N,{name:$})})});function Y(){var e=(new Date).toISOString(),r={id:(0,a.v4)(),timestamp:e,sender:n.sender,conversationId:n.conversationId,format:"text",data:{text:c}};n.send(r),l(""),R("")}return(0,e.jsxs)(r(),{className:"rustic-base-input",ref:i,children:[(0,e.jsxs)(r(),{className:"rustic-error-and-input-container",children:[(0,e.jsx)(r(),{className:"rustic-error-container",children:(0,e.jsx)(C(),{variant:"caption",color:"error",className:"rustic-error-message",children:z})}),(0,e.jsxs)(r(),{className:"rustic-input-field",sx:{border:"1px solid",borderColor:j?"secondary.main":"action.disabled"},children:[I.length>0&&(0,e.jsx)(x(),{open:D,anchorEl:B.current,onClose:function(){return U(!1)},disableAutoFocus:!0,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},children:(0,e.jsx)(v(),{children:I.map((function(n,r){return"unicode"in n&&(0,e.jsx)(p(),{onClick:function(){return G(n.unicode,!0)},children:E(n)},r)}))})}),(0,e.jsx)(b(),{className:"rustic-text-field",variant:"outlined",value:c,label:n.label,placeholder:n.placeholder,maxRows:n.maxRows,multiline:n.multiline,fullWidth:n.fullWidth,onKeyDown:function(e){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),!L&&Y())},onChange:function(e){R("");var r=e.target.value;l(r);var t,i=r.match(/:(\w{2,}):/g),o=r.match(/:(\w{2,})/g);if(i){var a=i[0].replace(/:/g,"");K.getEmojiByShortcode(a).then((function(e){if(e&&"unicode"in e){var n=r.replace(i[0],e.unicode);l(n)}else l(r)})).catch((function(){l(r)})),U(!1)}else o?(t=o[0].replace(":",""),K.getEmojiBySearchQuery(t).then((function(e){e.length?(M(e.slice(0,n.maximumEmojiSearchResults)),U(!0)):(M([]),U(!1))})).catch((function(){M([]),U(!1)}))):U(!1)},onFocus:function(){return y(!0)},onBlur:function(){return y(!1)},inputRef:B,color:"secondary",size:"small",InputProps:{endAdornment:(0,e.jsxs)(f(),{position:"end",children:[(0,e.jsx)(P,{onEmojiClick:G,buttonColor:H}),n.enableSpeechToText&&Q]})},InputLabelProps:{className:j?"":"rustic-input-label",sx:{backgroundColor:"background.paper"}}}),(0,e.jsx)("div",{className:"rustic-input-extras"})]})]}),(0,e.jsxs)(r(),{className:"rustic-input-actions",children:[n.children,(0,e.jsx)(w(),{title:"Send",children:(0,e.jsx)("span",{className:"rustic-send-button",children:(0,e.jsx)(u(),{"aria-label":"send message",onClick:Y,disabled:L,color:"primary",children:(0,e.jsx)(N,{name:"send"})})})})]})]})}));q.defaultProps={multiline:!0,fullWidth:!0,maxRows:6,enableSpeechToText:!1,maximumEmojiSearchResults:5};const T=q,z=require("@mui/material/LinearProgress");var R=i.n(z);const _=require("axios");var I=i.n(_);const M=require("react-dom"),A=require("@mui/material/Card");var D=i.n(A);const U=require("@mui/material/Modal");var B,L=i.n(U);require("pluralize"),function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(B||(B={}));const W=require("@mui/material/useMediaQuery");var H=i.n(W);const V=require("@mui/system/Stack");var $=i.n(V);const G=require("@mui/system/useTheme");var K=i.n(G);const Q=require("pdfjs-dist"),Y=function(n){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"}},t=(r[n.action].label.replaceAll(" ","-").toLowerCase(),r[n.action]);return(0,e.jsx)(w(),{title:t.label,children:(0,e.jsx)("span",{children:(0,e.jsx)(u(),{onClick:n.onClick,className:n.className,disabled:n.isDisabled,children:(0,e.jsx)(N,{name:t.symbol})})})})};var Z={pdf:function(n){var i,o=(0,t.useRef)(null),a=(0,t.useState)(1),c=a[0],s=a[1],l=(0,t.useState)(1),u=l[0],d=l[1],f=(0,t.useState)(1),m=f[0],p=f[1],h=(0,t.useState)(!1),v=h[0],g=h[1],x=(0,t.useState)(),j=x[0],y=x[1],w=K()(),S=H()(w.breakpoints.down("sm")),k=H()(w.breakpoints.between("sm","md"));if(i=n.url,!/\/[^/]+\.pdf$/.test(i))return(0,e.jsx)(D(),{variant:"outlined",className:"rustic-pdf-error",children:(0,e.jsx)(C(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var N=(0,t.useState)((function(){return S?.5:k?1:1.5})),F=N[0],P=N[1];return(0,t.useEffect)((function(){Q.GlobalWorkerOptions.workerSrc||(Q.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(Q.version,"/pdf.worker.mjs")),Q.getDocument({url:"".concat(n.url)}).promise.then((function(e){d(e.numPages),function(e){e.getPage(c).then((function(e){var n=e.getViewport({scale:F}),r=o.current;if(r){var t=r.getContext("2d");if(t){var i=window.devicePixelRatio||1;r.style.width="".concat(n.width,"px"),r.style.height="".concat(n.height,"px"),r.width=n.width*i,r.height=n.height*i;var a={canvasContext:t,viewport:n,transform:[i,0,0,i,0,0]};j&&j.cancel();var c=e.render(a);y(c),c.promise.then((function(){y(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){g(!0)}))}),[n.url,c,F]),v?(0,e.jsx)(D(),{variant:"outlined",className:"rustic-pdf-error",children:(0,e.jsx)(C(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,e.jsxs)(D(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,e.jsxs)(r(),{className:"rustic-pdf-viewer-header",children:[(0,e.jsx)(Y,{action:"zoomOut",onClick:function(){P((function(e){return Math.max(e-.2,.2)}))}}),(0,e.jsx)(Y,{action:"zoomIn",onClick:function(){P((function(e){return e+.2}))}})]}),(0,e.jsx)(r(),{className:"rustic-pdf-viewer-body",children:(0,e.jsx)(r(),{className:"rustic-pdf-viewer-body-inner",children:(0,e.jsx)("canvas",{ref:o})})}),(0,e.jsxs)($(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,e.jsx)(Y,{action:"previousPage",onClick:function(){c>1&&(s(c-1),p(c-1))},isDisabled:1===c}),(0,e.jsx)(C(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,e.jsx)(b(),{type:"number",value:m,onChange:function(e){var n=parseInt(e.target.value);p(n),!isNaN(n)&&n>=1&&n<=u&&s(n)},size:"small",className:"rustic-pdf-page-input"}),(0,e.jsxs)(C(),{variant:"body1",className:"rustic-page-indicator",children:["of ",u]}),(0,e.jsx)(Y,{action:"nextPage",onClick:function(){c<u&&(s(c+1),p(c+1))},isDisabled:c===u})]})]})}};function J(n){var r=(0,F.useTheme)(),i=(0,t.useState)(!1),o=i[0],a=i[1];function c(){a(!1)}var s,l,d=n.file.url&&(s=n.file.url.split("."))[s.length-1].toLowerCase(),f=d&&n.supportedViewers?n.supportedViewers[d]:null,m=!!f;return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(D(),{className:"rustic-file-preview".concat(m?" rustic-cursor-pointer":""),variant:"outlined",sx:{boxShadow:r.shadows[1]},onClick:function(){a(!0)},children:[(0,e.jsx)(C(),{variant:"subtitle2",children:(l=n.file.name,15,l.length<=15?l:l.substring(0,12)+"...")}),(0,e.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:n.children})]}),m&&(0,e.jsx)(L(),{open:o,onClose:c,className:"rustic-file-preview-modal",children:(0,e.jsxs)("div",{className:"rustic-modal-content",children:[(0,e.jsx)(w(),{title:"Close",children:(0,e.jsx)(u(),{onClick:c,className:"rustic-close-button",children:(0,e.jsx)(N,{name:"close"})})}),n.file.url&&(0,e.jsx)(f,{url:n.file.url})]})})]})}J.defaultProps={supportedViewers:Z};var X=function(){return X=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var i in n=arguments[r])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e},X.apply(this,arguments)},ee=function(e,n,r){if(r||2===arguments.length)for(var t,i=0,o=n.length;i<o;i++)!t&&i in n||(t||(t=Array.prototype.slice.call(n,0,i)),t[i]=n[i]);return e.concat(t||Array.prototype.slice.call(n))};function ne(e){for(var n=["Bytes","KB","MB","GB"],r=0;e>=1024&&r<n.length-1;)e/=1024,r++;var t=e.toFixed(1).toString().replace(/\.0$/,"");return"".concat(t," ").concat(n[r])}const re=function(n){var i=(0,t.useState)([]),o=i[0],c=i[1],s=(0,t.useState)([]),l=s[0],d=s[1],f=(0,t.useRef)({}),m=(0,a.v4)();(0,t.useEffect)((function(){c([]),d([]),f.current={}}),[n.messageId]);var p=(0,e.jsx)(r(),{className:"rustic-files rustic-padding-16",children:o.map((function(t,i){return(0,e.jsx)(J,{file:{name:t.name},children:(0,e.jsxs)(r(),{className:"rustic-flex-center",children:[t.loadingProgress<100&&(0,e.jsx)(R(),{variant:"determinate",color:"secondary",value:t.loadingProgress,className:"rustic-upload-progress"}),(0,e.jsx)(w(),{title:"Delete",children:(0,e.jsx)(u(),{color:"primary",onClick:function(){return function(e,r){var t,i;d([]);var o=e.name;if(f.current=X(X({},f.current),((t={})[o]=f.current[o]--,t)),n.onFileUpdate("remove",o),100===e.loadingProgress){var a="".concat(n.deleteFileEndpoint,"?message-id=").concat(n.messageId,"&file-id=").concat(e.id);I().delete(a).then((function(){return c((function(e){return e.filter((function(e,n){return n!==r}))}))})).catch((function(){return n.onFileUpdate("add",o),d((function(e){return ee(ee([],e,!0),["Failed to delete ".concat(o,". Please try again.")],!1)}))}))}else e.abortController.abort(),c((function(e){return e.filter((function(e,n){return n!==r}))})),f.current=X(X({},f.current),((i={})[o]=f.current[o]++,i))}(t,i)},className:"rustic-delete-button","aria-label":"cancel file upload",children:(0,e.jsx)("span",{className:"material-symbols-rounded",children:"cancel"})})})]})},i)}))}),h=(0,e.jsx)(r(),{children:l.map((function(n,r){return(0,e.jsx)(C(),{variant:"caption",color:"error",className:"rustic-error-message",children:n},r)}))});function v(e,n){return n?(0,M.createPortal)(e,n):e}return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(r(),{className:"rustic-uploader",children:[(0,e.jsx)("label",{htmlFor:m,children:(0,e.jsx)(w(),{title:"Upload",children:(0,e.jsx)(u(),{component:"span","aria-label":"Upload file",color:"primary",children:(0,e.jsx)("span",{className:"material-symbols-rounded",children:"upload_2"})})})}),(0,e.jsx)("input",{type:"file",id:m,onChange:function(e){d([]);var r=e.target.files&&Array.from(e.target.files),t=o.length+(r?r.length:0);n.maxFileCount&&t>n.maxFileCount&&d((function(e){return ee(ee([],e,!0),["You can only upload ".concat(n.maxFileCount," files.")],!1)}));var i=r&&function(e,n,r){return r?n<=r?e:e.slice(0,r-n):e}(r,t,n.maxFileCount);i&&i.forEach((function(e){!function(e){var r;n.maxFileSize&&e.size>n.maxFileSize?(r=e.name,d((function(e){return ee(ee([],e,!0),["Failed to upload ".concat(r,". You cannot upload files larger than ").concat(n.maxFileSize&&ne(n.maxFileSize),".")],!1)}))):function(e){var r=new FormData,t=new AbortController,i=function(e){var n,r,t=e.name,i=f.current[t];if(i){var o=i+1,a=t.lastIndexOf("."),c=t.substring(0,a),s=t.substring(a);t="".concat(c,"(").concat(i,")").concat(s),f.current=X(X({},f.current),((n={})[e.name]=o,n))}else f.current=X(X({},f.current),((r={})[e.name]=1,r));return t}(e),o=new File([e],i,{type:e.type});r.append("file",o);var s=(0,a.v4)(),l={name:i,loadingProgress:0,abortController:t,id:s};c((function(e){return ee(ee([],e,!0),[l],!1)})),n.onFileUpdate("add",i);var u="".concat(n.uploadFileEndpoint,"?message-id=").concat(n.messageId);I().post(u,r,{onUploadProgress:function(e){var n,r;e.total&&(n=e.loaded/e.total*100,r=l.id,c((function(e){var t=e.map((function(e){return e.id===r?X(X({},e),{loadingProgress:n}):e}));return t})))},signal:t.signal}).then((function(e){var n,r;n=e.data,r=l.id,c((function(e){var t=e.findIndex((function(e){return e.id===r}));if(-1!==t){var i=ee([],e,!0);return i[t]=X(X({},i[t]),{id:n.fileId}),i}return e}))})).catch((function(r){var t,o;n.onFileUpdate("remove",i),f.current=X(X({},f.current),((t={})[i]=f.current[e.name]--,t)),function(e,n,r){d((function(n){return ee(ee([],n,!0),["Failed to upload ".concat(e,". ").concat((null==r?void 0:r.message)||"")],!1)})),c((function(e){return e.filter((function(e){return e.id!==n}))}))}(e.name,l.id,null===(o=r.response)||void 0===o?void 0:o.data)}))}(e)}(e)})),e.target.value=""},multiple:!0,accept:n.acceptedFileTypes})]}),l.length>0&&v(h,n.errorMessagesContainer),o.length>0&&v(p,n.filePreviewsContainer)]})};var te,ie,oe=function(){return oe=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var i in n=arguments[r])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e},oe.apply(this,arguments)},ae=function(e,n,r){if(r||2===arguments.length)for(var t,i=0,o=n.length;i<o;i++)!t&&i in n||(t||(t=Array.prototype.slice.call(n,0,i)),t[i]=n[i]);return e.concat(t||Array.prototype.slice.call(n))};function ce(n){var i=(0,t.useState)([]),o=i[0],c=i[1],s=(0,t.useState)((0,a.v4)()),l=s[0],u=s[1],d=(0,t.useState)(),f=d[0],m=d[1],p=(0,t.useState)(),h=p[0],v=p[1],g=(0,t.useRef)(null),x=o.length>0;return(0,t.useEffect)((function(){g.current&&(v(g.current.querySelector(".rustic-error-container")),m(g.current.querySelector(".rustic-input-extras")))})),(0,e.jsx)(r(),{className:"rustic-multimodal-input",children:(0,e.jsx)(T,oe({},n,{send:function(e){x&&(e.id=l,e.format="multipart",e.data.files=o),n.ws.send(e),u((0,a.v4)()),c([])},isSendEnabled:x,ref:g,children:(0,e.jsx)(r(),{className:"rustic-bottom-buttons",children:(0,e.jsx)(re,{acceptedFileTypes:n.acceptedFileTypes,maxFileCount:n.maxFileCount,maxFileSize:n.maxFileSize,uploadFileEndpoint:n.uploadFileEndpoint,deleteFileEndpoint:n.deleteFileEndpoint,onFileUpdate:function(e,n){c("add"===e?function(e){return ae(ae([],e,!0),[{name:n}],!1)}:function(e){return e.filter((function(e){return e.name!==n}))})},messageId:l,filePreviewsContainer:f,errorMessagesContainer:h})})}))})}ce.defaultProps={multiline:!0,fullWidth:!0,maxRows:6,maxFileSize:2097152,maxFileCount:1},function(e){e.Owner="owner",e.Member="member"}(te||(te={})),function(e){e.Human="human",e.Agent="agent"}(ie||(ie={}));const se=ce})(),o})()));
|
|
@@ -9,7 +9,14 @@ __How does file upload work?__
|
|
|
9
9
|
2. Selected files are sent to a designated HTTP API.
|
|
10
10
|
3. The HTTP API can update the upload progress for each file and is responsible for transforming and storing the files securely.
|
|
11
11
|
4. Once uploaded, the file names are appended to the data sent over WebSocket. Files can also be deleted after being uploaded and an HTTP API is sent to delete the file from storage.
|
|
12
|
-
5. The backend server of the application utilizes the uploaded files along with the text messages for message processing.
|
|
12
|
+
5. The backend server of the application utilizes the uploaded files along with the text messages for message processing.
|
|
13
|
+
|
|
14
|
+
* **Note**: `emoji-picker-element` and `uuid` are not bundled, so please install the following packages using npm:
|
|
15
|
+
*
|
|
16
|
+
* ```typescript
|
|
17
|
+
* npm i emoji-picker-element uuid
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
13
20
|
declare function MultimodalInput(props: MultimodalInputProps): import("react/jsx-runtime").JSX.Element;
|
|
14
21
|
declare namespace MultimodalInput {
|
|
15
22
|
var defaultProps: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multimodalInput.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/multimodal/multimodalInput/multimodalInput.tsx"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAA;AAC9B,OAAO,uBAAuB,CAAA;AAO9B,OAAO,KAAK,EAAqB,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAI7E
|
|
1
|
+
{"version":3,"file":"multimodalInput.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/multimodal/multimodalInput/multimodalInput.tsx"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAA;AAC9B,OAAO,uBAAuB,CAAA;AAO9B,OAAO,KAAK,EAAqB,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAI7E;;;;;;;;;;;;;;;EAeE;AACF,iBAAwB,eAAe,CAAC,KAAK,EAAE,oBAAoB,2CAqElE;kBArEuB,eAAe;;;;;;;;;eAAf,eAAe"}
|