@rustic-ai/ui-components 0.0.23 → 0.0.24
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 +1 -1
- package/dist/components/filePreview/filePreview.d.ts +1 -0
- package/dist/components/filePreview/filePreview.d.ts.map +1 -1
- package/dist/components/icon/index.css +4 -0
- package/dist/components/icon/index.d.ts +4 -0
- package/dist/components/icon/index.d.ts.map +1 -0
- package/dist/components/icon/index.js +1 -0
- package/dist/components/image/index.css +4 -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/emoji.d.ts.map +1 -1
- package/dist/components/input/emoji/index.js +1 -1
- package/dist/components/input/multimodal/multimodalInput/index.css +19 -3
- package/dist/components/input/multimodal/multimodalInput/index.js +1 -1
- package/dist/components/input/multimodal/multimodalInput/multimodalInput.d.ts.map +1 -1
- package/dist/components/input/multimodal/uploader/index.css +13 -2
- package/dist/components/input/multimodal/uploader/index.js +1 -1
- package/dist/components/input/multimodal/uploader/uploader.d.ts.map +1 -1
- package/dist/components/input/textInput/index.css +6 -1
- package/dist/components/input/textInput/index.js +1 -1
- package/dist/components/messageCanvas/actions/copy/index.js +1 -1
- package/dist/components/messageCanvas/actions/index.js +1 -1
- package/dist/components/messageCanvas/actions/textToSpeech/index.js +1 -1
- package/dist/components/multipart/index.css +13 -2
- package/dist/components/multipart/index.js +1 -1
- package/dist/components/promptBuilder/index.css +4 -0
- package/dist/components/types.d.ts +4 -0
- package/dist/components/types.d.ts.map +1 -1
- package/dist/components/video/index.css +4 -0
- package/dist/components/visualization/perspectiveViz/perspectiveViz.d.ts +1 -1
- package/dist/components/visualization/plotlyGraph/index.d.ts +4 -0
- package/dist/components/visualization/plotlyGraph/index.d.ts.map +1 -0
- package/dist/components/visualization/plotlyGraph/index.js +1 -0
- package/dist/components/visualization/plotlyGraph/plotlyGraph.d.ts +14 -0
- package/dist/components/visualization/plotlyGraph/plotlyGraph.d.ts.map +1 -0
- package/dist/components/visualization/plotlyGraph/plotlyGraph.types.d.ts +10 -0
- package/dist/components/visualization/plotlyGraph/plotlyGraph.types.d.ts.map +1 -0
- package/dist/index.css +21 -5
- package/dist/index.js +1 -1
- package/dist/rusticTheme.d.ts +14 -0
- package/dist/rusticTheme.d.ts.map +1 -1
- package/dist/rusticTheme.js +1 -1
- package/package.json +17 -5
|
@@ -5,7 +5,7 @@ import type { CalendarData } from '../types';
|
|
|
5
5
|
* FullCalendar libraries are not bundled, so please install the following packages using npm:
|
|
6
6
|
*
|
|
7
7
|
* ```typescript
|
|
8
|
-
* npm i @fullcalendar/core @fullcalendar/daygrid @fullcalendar/react
|
|
8
|
+
* npm i @fullcalendar/core @fullcalendar/daygrid @fullcalendar/react @fullcalendar/timegrid
|
|
9
9
|
* ```
|
|
10
10
|
*
|
|
11
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. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filePreview.d.ts","sourceRoot":"","sources":["../../../src/components/filePreview/filePreview.tsx"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAA;AAC1B,OAAO,iBAAiB,CAAA;AAQxB,OAAO,KAAmB,MAAM,OAAO,CAAA;AAKvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAExC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,QAAQ,CAAA;IACd,gBAAgB,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,aAAa,CAAC;YAAE,GAAG,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"filePreview.d.ts","sourceRoot":"","sources":["../../../src/components/filePreview/filePreview.tsx"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAA;AAC1B,OAAO,iBAAiB,CAAA;AAQxB,OAAO,KAAmB,MAAM,OAAO,CAAA;AAKvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAExC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,QAAQ,CAAA;IACd,gBAAgB,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,aAAa,CAAC;YAAE,GAAG,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,CAAA;IAC1E,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;AASD,iBAAwB,WAAW,CACjC,KAAK,EAAE,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,2CAwEjD;kBAzEuB,WAAW;;;;;;;;;eAAX,WAAW"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/icon/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,CAAA;AAEnB,OAAO,IAAI,MAAM,QAAQ,CAAA;AAEzB,eAAe,IAAI,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={d:(t,o)=>{for(var r in o)e.o(o,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:o[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:()=>r});const o=require("react/jsx-runtime");require("react");const r=function(e){return e.name.replaceAll("_","-"),(0,o.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),children:e.name})};return t})()));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import FCCalendar from './calendar/fCCalendar';
|
|
2
2
|
import CodeSnippet from './codeSnippet/codeSnippet';
|
|
3
3
|
import ElementRenderer from './elementRenderer/elementRenderer';
|
|
4
|
+
import Icon from './icon/icon';
|
|
4
5
|
import Image from './image/image';
|
|
5
6
|
import MultimodalInput from './input/multimodal/multimodalInput/multimodalInput';
|
|
6
7
|
import Uploader from './input/multimodal/uploader/uploader';
|
|
@@ -29,11 +30,13 @@ import YoutubeVideo from './video/youtubeVideo';
|
|
|
29
30
|
import RechartsTimeSeries from './visualization/chart/rechartsTimeSeries';
|
|
30
31
|
import MermaidViz from './visualization/mermaidViz/mermaidViz';
|
|
31
32
|
import PerspectiveViz from './visualization/perspectiveViz/perspectiveViz';
|
|
33
|
+
import PlotlyGraph from './visualization/plotlyGraph/plotlyGraph';
|
|
32
34
|
import VegaLiteViz from './visualization/vegaLiteViz/vegaLiteViz';
|
|
33
35
|
import Weather from './weather/weather';
|
|
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, };
|
|
36
|
+
export { Action, CodeSnippet, CopyText, ElementRenderer, FCCalendar, Icon, Image, MarkedMarkdown, MarkedStreamingMarkdown, MermaidViz, MessageCanvas, MessageSpace, MultimodalInput, Multipart, OpenLayersMap, ParticipantsContainer, PDFViewer, PerspectiveViz, PopoverMenu, PromptBuilder, PlotlyGraph, Question, RechartsTimeSeries, Sound, StreamingText, Table, Text, TextInput, TextToSpeech, Timestamp, Uploader, VegaLiteViz, Video, Weather, YoutubeVideo, };
|
|
35
37
|
export * from '../rusticTheme';
|
|
36
38
|
export * from './types';
|
|
37
39
|
export * from './visualization/mermaidViz/mermaidViz.types';
|
|
38
40
|
export * from './visualization/vegaLiteViz/vegaLiteViz.types';
|
|
41
|
+
export * from './visualization/plotlyGraph/plotlyGraph.types';
|
|
39
42
|
//# 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,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
|
+
{"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,IAAI,MAAM,aAAa,CAAA;AAC9B,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,WAAW,MAAM,yCAAyC,CAAA;AACjE,OAAO,OAAO,MAAM,mBAAmB,CAAA;AAEvC,OAAO,EACL,MAAM,EACN,WAAW,EACX,QAAQ,EACR,eAAe,EACf,UAAU,EACV,IAAI,EACJ,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,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;AACvB,cAAc,6CAA6C,CAAA;AAC3D,cAAc,+CAA+C,CAAA;AAC7D,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;AAqW1D,QAAA,MAAM,SAAS;;wCAA+B,CAAA;AAU9C,eAAe,SAAS,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emoji.d.ts","sourceRoot":"","sources":["../../../../src/components/input/emoji/emoji.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AACpB,OAAO,sBAAsB,CAAA;AAY7B,UAAU,UAAU;IAClB,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACrC,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,iBAAS,KAAK,CAAC,KAAK,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"emoji.d.ts","sourceRoot":"","sources":["../../../../src/components/input/emoji/emoji.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AACpB,OAAO,sBAAsB,CAAA;AAY7B,UAAU,UAAU;IAClB,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACrC,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,iBAAS,KAAK,CAAC,KAAK,EAAE,UAAU,2CAuG/B;AAED,eAAe,KAAK,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,
|
|
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,r,t={342:e=>{e.exports=require("emoji-picker-element")}},o={};function n(e){var r=o[e];if(void 0!==r)return r.exports;var i=o[e]={exports:{}};return t[e](i,i.exports,n),i.exports}n.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return n.d(r,{a:r}),r},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,n.t=function(t,o){if(1&o&&(t=this(t)),8&o)return t;if("object"==typeof t&&t){if(4&o&&t.__esModule)return t;if(16&o&&"function"==typeof t.then)return t}var i=Object.create(null);n.r(i);var c={};e=e||[null,r({}),r([]),r(r)];for(var a=2&o&&t;"object"==typeof a&&!~e.indexOf(a);a=r(a))Object.getOwnPropertyNames(a).forEach((e=>c[e]=()=>t[e]));return c.default=()=>t,n.d(i,c),i},n.d=(e,r)=>{for(var t in r)n.o(r,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};n.r(i),n.d(i,{default:()=>j});const c=require("react/jsx-runtime");n(342);const a=require("@mui/material/IconButton");var u=n.n(a);const l=require("@mui/material/Popover");var s=n.n(l);const d=require("@mui/material/styles"),f=require("@mui/material/Tooltip");var p=n.n(f);const m=require("react");function v(e){return e.name.replaceAll("_","-"),(0,c.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),children:e.name})}const j=function(e){var r=(0,d.useTheme)(),t=(0,m.useRef)(null),o=(0,m.useRef)(null),i=(0,m.useState)(!1),a=i[0],l=i[1],f={"--indicator-color":r.palette.divider,"--background":r.palette.background.paper,"--input-border-color":r.palette.divider,"--outline-color":r.palette.secondary.main};function j(){l(!1)}function y(r){r.detail.unicode&&e.onEmojiClick(r.detail.unicode),j()}return(0,m.useEffect)((function(){o.current||"undefined"==typeof window||Promise.resolve().then(n.t.bind(n,342,23)).then((function(e){var t=new(0,e.Picker),n="dark"===r.palette.mode?"dark":"light";t.classList.add(n),Object.keys(f).forEach((function(e){t.style.setProperty(e,f[e])})),o.current=t})).catch((function(e){console.error("Failed to load emoji picker",e)}))}),[]),(0,m.useEffect)((function(){return o.current&&o.current.addEventListener("emoji-click",y),function(){var e;null===(e=o.current)||void 0===e||e.removeEventListener("emoji-click",y)}}),[a,e.onEmojiClick]),(0,c.jsxs)("div",{children:[(0,c.jsx)(p(),{title:"Emoji",children:(0,c.jsx)(u(),{size:"small",ref:t,onClick:function(){l((function(e){return!e}))},sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,c.jsx)(v,{name:"Mood"})})}),o.current&&(0,c.jsx)(s(),{open:a,anchorEl:t.current,onClose:j,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"right"},children:(0,c.jsx)("div",{className:"rustic-emoji-picker",ref:function(e){e&&o.current&&!e.contains(o.current)&&e.appendChild(o.current)}})})]})};return i})()));
|
|
@@ -69,6 +69,10 @@ code {
|
|
|
69
69
|
align-self: center;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
.rustic-shift-to-right-by-8 {
|
|
73
|
+
margin-right: -8px;
|
|
74
|
+
}
|
|
75
|
+
|
|
72
76
|
.rustic-base-input {
|
|
73
77
|
display: flex;
|
|
74
78
|
align-items: flex-start;
|
|
@@ -107,13 +111,18 @@ code {
|
|
|
107
111
|
}
|
|
108
112
|
|
|
109
113
|
.rustic-base-input .rustic-send-button {
|
|
110
|
-
margin: 10px
|
|
114
|
+
margin: 10px 12px;
|
|
111
115
|
}
|
|
112
116
|
|
|
113
117
|
.rustic-base-input .rustic-input-actions {
|
|
114
118
|
display: flex;
|
|
115
119
|
}
|
|
116
120
|
|
|
121
|
+
.rustic-base-input .rustic-input-adornment {
|
|
122
|
+
align-self: start;
|
|
123
|
+
margin-top: 12px;
|
|
124
|
+
}
|
|
125
|
+
|
|
117
126
|
span.rustic-icon-large {
|
|
118
127
|
font-size: 32px;
|
|
119
128
|
}
|
|
@@ -156,12 +165,19 @@ emoji-picker {
|
|
|
156
165
|
position: relative;
|
|
157
166
|
display: flex;
|
|
158
167
|
align-items: center;
|
|
159
|
-
padding: 8px
|
|
168
|
+
padding: 8px 16px;
|
|
160
169
|
justify-content: space-between;
|
|
161
|
-
width: 220px;
|
|
162
170
|
height: 56px;
|
|
163
171
|
}
|
|
164
172
|
|
|
173
|
+
.rustic-fixed-file-preview-width {
|
|
174
|
+
width: 220px;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.rustic-flexible-file-preview-width {
|
|
178
|
+
min-width: 220px;
|
|
179
|
+
}
|
|
180
|
+
|
|
165
181
|
.rustic-file-preview-modal {
|
|
166
182
|
width: 90vw;
|
|
167
183
|
height: 90vh;
|
|
@@ -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,r,n={13:e=>{e.exports=require("emoji-picker-element")}},t={};function i(e){var r=t[e];if(void 0!==r)return r.exports;var o=t[e]={exports:{}};return n[e](o,o.exports,i),o.exports}i.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return i.d(r,{a:r}),r},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(n,t){if(1&t&&(n=this(n)),8&t)return n;if("object"==typeof n&&n){if(4&t&&n.__esModule)return n;if(16&t&&"function"==typeof n.then)return n}var o=Object.create(null);i.r(o);var a={};e=e||[null,r({}),r([]),r(r)];for(var c=2&t&&n;"object"==typeof c&&!~e.indexOf(c);c=r(c))Object.getOwnPropertyNames(c).forEach((e=>a[e]=()=>n[e]));return a.default=()=>n,i.d(o,a),o},i.d=(e,r)=>{for(var n in r)i.o(r,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},i.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),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,{default:()=>ce});const e=require("react/jsx-runtime"),r=require("@mui/material/Box");var n=i.n(r);const t=require("@mui/material/styles"),a=require("react"),c=require("uuid"),s=require("@mui/material/CircularProgress");var l=i.n(s);const u=require("@mui/material/IconButton");var d=i.n(u);const f=require("@mui/material/InputAdornment");var m=i.n(f);const p=require("@mui/material/MenuItem");var h=i.n(p);const v=require("@mui/material/MenuList");var g=i.n(v);const x=require("@mui/material/Popover");var j=i.n(x);const b=require("@mui/material/TextField");var y=i.n(b);const w=require("@mui/material/Tooltip");var S=i.n(w);const C=require("@mui/material/Typography");var k=i.n(C),N=i(13);function F(r){return r.name.replaceAll("_","-"),(0,e.jsx)("span",{className:"".concat(r.className?r.className+" ":"","material-symbols-rounded"),children:r.name})}const P=function(r){var n=(0,t.useTheme)(),o=(0,a.useRef)(null),c=(0,a.useRef)(null),s=(0,a.useState)(!1),l=s[0],u=s[1],f={"--indicator-color":n.palette.divider,"--background":n.palette.background.paper,"--input-border-color":n.palette.divider,"--outline-color":n.palette.secondary.main};function m(){u(!1)}function p(e){e.detail.unicode&&r.onEmojiClick(e.detail.unicode),m()}return(0,a.useEffect)((function(){c.current||"undefined"==typeof window||Promise.resolve().then(i.t.bind(i,13,23)).then((function(e){var r=new(0,e.Picker),t="dark"===n.palette.mode?"dark":"light";r.classList.add(t),Object.keys(f).forEach((function(e){r.style.setProperty(e,f[e])})),c.current=r})).catch((function(e){console.error("Failed to load emoji picker",e)}))}),[]),(0,a.useEffect)((function(){return c.current&&c.current.addEventListener("emoji-click",p),function(){var e;null===(e=c.current)||void 0===e||e.removeEventListener("emoji-click",p)}}),[l,r.onEmojiClick]),(0,e.jsxs)("div",{children:[(0,e.jsx)(S(),{title:"Emoji",children:(0,e.jsx)(d(),{size:"small",ref:o,onClick:function(){u((function(e){return!e}))},sx:{color:r.buttonColor},children:(0,e.jsx)(F,{name:"Mood"})})}),c.current&&(0,e.jsx)(j(),{open:l,anchorEl:o.current,onClose:m,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"right"},children:(0,e.jsx)("div",{className:"rustic-emoji-picker",ref:function(e){e&&c.current&&!e.contains(c.current)&&e.appendChild(c.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=new N.Database,T=(0,a.forwardRef)((function(r,t){var i=(0,a.useState)(""),o=i[0],s=i[1],u=(0,a.useState)(!1),f=u[0],p=u[1],v=(0,a.useState)(!1),x=v[0],b=v[1],w=(0,a.useState)(!1),C=w[0],N=w[1],T=(0,a.useState)(""),z=T[0],R=T[1],_=(0,a.useState)([]),I=_[0],M=_[1],D=(0,a.useState)(!1),A=D[0],U=D[1],B=(0,a.useRef)(null),L=!o.trim().length&&!r.isSendEnabled,W="".concat(f?"Stop":"Start"," speech to text"),H=x?"primary.main":"primary.light",V=f?"error.main":H,$=f?"stop_circle":"speech_to_text";function G(e,r){if(void 0===r&&(r=!1),B.current){var n=B.current,t=n.selectionStart,i=n.selectionEnd;if("number"==typeof t&&"number"==typeof i){var a,c=o||"",l=c.substring(0,t),u=c.substring(i);a=r?l.replace(/:(\w+)$/,e)+u:l+e+u,s(a);var d=r?l.replace(/:(\w+)$/,e).length:t+e.length;setTimeout((function(){var e,r;null===(e=B.current)||void 0===e||e.focus(),null===(r=B.current)||void 0===r||r.setSelectionRange(d,d)}),0)}}U(!1)}var K=C?(0,e.jsx)(l(),{size:24}):(0,e.jsx)(S(),{title:W,children:(0,e.jsx)(d(),{onClick:function(){var e=new window.webkitSpeechRecognition,r=navigator.language;e.lang=r,f?(e.stop(),N(!0),p(!1)):(e.start(),R(""),p(!0)),e.onstart=function(){p(!0)},e.onresult=function(e){var r,n=e.results[0][0].transcript;o.length>0?s(o+" "+n):s(n),null===(r=B.current)||void 0===r||r.focus(),p(!1)},e.onerror=function(e){var r=O[e.error];R(r),p(!1)},e.onend=function(){N(!1),p(!1)}},size:"small",sx:{color:V},children:(0,e.jsx)(F,{name:$})})});function Q(){var e=(new Date).toISOString(),n={id:(0,c.v4)(),timestamp:e,sender:r.sender,conversationId:r.conversationId,format:"text",data:{text:o}};r.send(n),s(""),R("")}return(0,e.jsxs)(n(),{className:"rustic-base-input",ref:t,children:[(0,e.jsxs)(n(),{className:"rustic-error-and-input-container",children:[(0,e.jsx)(n(),{className:"rustic-error-container",children:(0,e.jsx)(k(),{variant:"caption",color:"error",className:"rustic-error-message",children:z})}),(0,e.jsxs)(n(),{className:"rustic-input-field",sx:{border:"1px solid",borderColor:x?"secondary.main":"action.disabled"},children:[I.length>0&&(0,e.jsx)(j(),{open:A,anchorEl:B.current,onClose:function(){return U(!1)},disableAutoFocus:!0,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},children:(0,e.jsx)(g(),{children:I.map((function(r,n){return"unicode"in r&&(0,e.jsx)(h(),{onClick:function(){return G(r.unicode,!0)},children:E(r)},n)}))})}),(0,e.jsx)(y(),{className:"rustic-text-field",variant:"outlined",value:o,label:r.label,placeholder:r.placeholder,maxRows:r.maxRows,multiline:r.multiline,fullWidth:r.fullWidth,onKeyDown:function(e){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),!L&&Q())},onChange:function(e){R("");var n=e.target.value;s(n);var t,i=n.match(/:(\w{2,}):/g),o=n.match(/:(\w{2,})/g);if(i){var a=i[0].replace(/:/g,"");q.getEmojiByShortcode(a).then((function(e){if(e&&"unicode"in e){var r=n.replace(i[0],e.unicode);s(r)}else s(n)})).catch((function(){s(n)})),U(!1)}else o?(t=o[0].replace(":",""),q.getEmojiBySearchQuery(t).then((function(e){e.length?(M(e.slice(0,r.maximumEmojiSearchResults)),U(!0)):(M([]),U(!1))})).catch((function(){M([]),U(!1)}))):U(!1)},onFocus:function(){return b(!0)},onBlur:function(){return b(!1)},inputRef:B,color:"secondary",size:"small",InputProps:{endAdornment:(0,e.jsxs)(m(),{position:"end",children:[(0,e.jsx)(P,{onEmojiClick:G,buttonColor:H}),r.enableSpeechToText&&K]})},InputLabelProps:{className:x?"":"rustic-input-label",sx:{backgroundColor:"background.paper"}}}),(0,e.jsx)("div",{className:"rustic-input-extras"})]})]}),(0,e.jsxs)(n(),{className:"rustic-input-actions",children:[r.children,(0,e.jsx)(S(),{title:"Send",children:(0,e.jsx)("span",{className:"rustic-send-button",children:(0,e.jsx)(d(),{"aria-label":"send message",onClick:Q,disabled:L,color:"primary",children:(0,e.jsx)(F,{name:"send"})})})})]})]})}));T.defaultProps={multiline:!0,fullWidth:!0,maxRows:6,enableSpeechToText:!1,maximumEmojiSearchResults:5};const z=T,R=require("@mui/material/LinearProgress");var _=i.n(R);const I=require("axios");var M=i.n(I);const D=require("react-dom"),A=require("@mui/material/Card");var U=i.n(A);const B=require("@mui/material/Modal");var L,W=i.n(B);!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(L||(L={}));const H=require("@mui/material/useMediaQuery");var V=i.n(H);const $=require("@mui/system/Stack");var G=i.n($);const K=require("@mui/system/useTheme");var Q=i.n(K);const Y=require("pdfjs-dist"),Z=function(r){var n={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=(n[r.action].label.replaceAll(" ","-").toLowerCase(),n[r.action]);return(0,e.jsx)(S(),{title:t.label,children:(0,e.jsx)("span",{children:(0,e.jsx)(d(),{onClick:r.onClick,className:r.className,disabled:r.isDisabled,children:(0,e.jsx)(F,{name:t.symbol})})})})};var J={pdf:function(r){var t,i=(0,a.useRef)(null),o=(0,a.useState)(1),c=o[0],s=o[1],l=(0,a.useState)(1),u=l[0],d=l[1],f=(0,a.useState)(1),m=f[0],p=f[1],h=(0,a.useState)(!1),v=h[0],g=h[1],x=(0,a.useState)(),j=x[0],b=x[1],w=Q()(),S=V()(w.breakpoints.down("sm")),C=V()(w.breakpoints.between("sm","md"));if(t=r.url,!/\/[^/]+\.pdf$/.test(t))return(0,e.jsx)(U(),{variant:"outlined",className:"rustic-pdf-error",children:(0,e.jsx)(k(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var N=(0,a.useState)((function(){return S?.5:C?1:1.5})),F=N[0],P=N[1];return(0,a.useEffect)((function(){Y.GlobalWorkerOptions.workerSrc||(Y.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(Y.version,"/pdf.worker.mjs")),Y.getDocument({url:"".concat(r.url)}).promise.then((function(e){d(e.numPages),function(e){e.getPage(c).then((function(e){var r=e.getViewport({scale:F}),n=i.current;if(n){var t=n.getContext("2d");if(t){var o=window.devicePixelRatio||1;n.style.width="".concat(r.width,"px"),n.style.height="".concat(r.height,"px"),n.width=r.width*o,n.height=r.height*o;var a={canvasContext:t,viewport:r,transform:[o,0,0,o,0,0]};j&&j.cancel();var c=e.render(a);b(c),c.promise.then((function(){b(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){g(!0)}))}),[r.url,c,F]),v?(0,e.jsx)(U(),{variant:"outlined",className:"rustic-pdf-error",children:(0,e.jsx)(k(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,e.jsxs)(U(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,e.jsxs)(n(),{className:"rustic-pdf-viewer-header",children:[(0,e.jsx)(Z,{action:"zoomOut",onClick:function(){P((function(e){return Math.max(e-.2,.2)}))}}),(0,e.jsx)(Z,{action:"zoomIn",onClick:function(){P((function(e){return e+.2}))}})]}),(0,e.jsx)(n(),{className:"rustic-pdf-viewer-body",children:(0,e.jsx)(n(),{className:"rustic-pdf-viewer-body-inner",children:(0,e.jsx)("canvas",{ref:i})})}),(0,e.jsxs)(G(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,e.jsx)(Z,{action:"previousPage",onClick:function(){c>1&&(s(c-1),p(c-1))},isDisabled:1===c}),(0,e.jsx)(k(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,e.jsx)(y(),{type:"number",value:m,onChange:function(e){var r=parseInt(e.target.value);p(r),!isNaN(r)&&r>=1&&r<=u&&s(r)},size:"small",className:"rustic-pdf-page-input"}),(0,e.jsxs)(k(),{variant:"body1",className:"rustic-page-indicator",children:["of ",u]}),(0,e.jsx)(Z,{action:"nextPage",onClick:function(){c<u&&(s(c+1),p(c+1))},isDisabled:c===u})]})]})}};function X(r){var n=(0,t.useTheme)(),i=(0,a.useState)(!1),o=i[0],c=i[1];function s(){c(!1)}var l,u,f=r.file.url&&(l=r.file.url.split("."))[l.length-1].toLowerCase(),m=f&&r.supportedViewers?r.supportedViewers[f]:null,p=!!m;return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(U(),{className:"rustic-file-preview".concat(p?" rustic-cursor-pointer":""),variant:"outlined",sx:{boxShadow:n.shadows[1]},onClick:function(){c(!0)},children:[(0,e.jsx)(k(),{variant:"subtitle2",children:(u=r.file.name,15,u.length<=15?u:u.substring(0,12)+"...")}),(0,e.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:r.children})]}),p&&(0,e.jsx)(W(),{open:o,onClose:s,className:"rustic-file-preview-modal",children:(0,e.jsxs)("div",{className:"rustic-modal-content",children:[(0,e.jsx)(S(),{title:"Close",children:(0,e.jsx)(d(),{onClick:s,className:"rustic-close-button",children:(0,e.jsx)(F,{name:"close"})})}),r.file.url&&(0,e.jsx)(m,{url:r.file.url})]})})]})}X.defaultProps={supportedViewers:J};var ee=function(){return ee=Object.assign||function(e){for(var r,n=1,t=arguments.length;n<t;n++)for(var i in r=arguments[n])Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i]);return e},ee.apply(this,arguments)},re=function(e,r,n){if(n||2===arguments.length)for(var t,i=0,o=r.length;i<o;i++)!t&&i in r||(t||(t=Array.prototype.slice.call(r,0,i)),t[i]=r[i]);return e.concat(t||Array.prototype.slice.call(r))};function ne(e){for(var r=["Bytes","KB","MB","GB"],n=0;e>=1024&&n<r.length-1;)e/=1024,n++;var t=e.toFixed(1).toString().replace(/\.0$/,"");return"".concat(t," ").concat(r[n])}const te=function(r){var t=(0,a.useState)([]),i=t[0],o=t[1],s=(0,a.useState)([]),l=s[0],u=s[1],f=(0,a.useRef)({}),m=(0,c.v4)();(0,a.useEffect)((function(){o([]),u([]),f.current={}}),[r.messageId]);var p=(0,e.jsx)(n(),{className:"rustic-files rustic-padding-16",children:i.map((function(t,i){return(0,e.jsx)(X,{file:{name:t.name},children:(0,e.jsxs)(n(),{className:"rustic-flex-center",children:[t.loadingProgress<100&&(0,e.jsx)(_(),{variant:"determinate",color:"secondary",value:t.loadingProgress,className:"rustic-upload-progress"}),(0,e.jsx)(S(),{title:"Delete",children:(0,e.jsx)(d(),{color:"primary",onClick:function(){return function(e,n){var t,i;u([]);var a=e.name;if(f.current=ee(ee({},f.current),((t={})[a]=f.current[a]--,t)),r.onFileUpdate("remove",a),100===e.loadingProgress){var c="".concat(r.deleteFileEndpoint,"?message-id=").concat(r.messageId,"&file-id=").concat(e.id);M().delete(c).then((function(){return o((function(e){return e.filter((function(e,r){return r!==n}))}))})).catch((function(){return r.onFileUpdate("add",a),u((function(e){return re(re([],e,!0),["Failed to delete ".concat(a,". Please try again.")],!1)}))}))}else e.abortController.abort(),o((function(e){return e.filter((function(e,r){return r!==n}))})),f.current=ee(ee({},f.current),((i={})[a]=f.current[a]++,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)(n(),{children:l.map((function(r,n){return(0,e.jsx)(k(),{variant:"caption",color:"error",className:"rustic-error-message",children:r},n)}))});function v(e,r){return r?(0,D.createPortal)(e,r):e}return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(n(),{className:"rustic-uploader",children:[(0,e.jsx)("label",{htmlFor:m,children:(0,e.jsx)(S(),{title:"Upload",children:(0,e.jsx)(d(),{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){u([]);var n=e.target.files&&Array.from(e.target.files),t=i.length+(n?n.length:0);r.maxFileCount&&t>r.maxFileCount&&u((function(e){return re(re([],e,!0),["You can only upload ".concat(r.maxFileCount," files.")],!1)}));var a=n&&function(e,r,n){return n?r<=n?e:e.slice(0,n-r):e}(n,t,r.maxFileCount);a&&a.forEach((function(e){!function(e){var n;r.maxFileSize&&e.size>r.maxFileSize?(n=e.name,u((function(e){return re(re([],e,!0),["Failed to upload ".concat(n,". You cannot upload files larger than ").concat(r.maxFileSize&&ne(r.maxFileSize),".")],!1)}))):function(e){var n=new FormData,t=new AbortController,i=function(e){var r,n,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=ee(ee({},f.current),((r={})[e.name]=o,r))}else f.current=ee(ee({},f.current),((n={})[e.name]=1,n));return t}(e),a=new File([e],i,{type:e.type});n.append("file",a);var s=(0,c.v4)(),l={name:i,loadingProgress:0,abortController:t,id:s};o((function(e){return re(re([],e,!0),[l],!1)})),r.onFileUpdate("add",i);var d="".concat(r.uploadFileEndpoint,"?message-id=").concat(r.messageId);M().post(d,n,{onUploadProgress:function(e){var r,n;e.total&&(r=e.loaded/e.total*100,n=l.id,o((function(e){var t=e.map((function(e){return e.id===n?ee(ee({},e),{loadingProgress:r}):e}));return t})))},signal:t.signal}).then((function(e){var r,n;r=e.data,n=l.id,o((function(e){var t=e.findIndex((function(e){return e.id===n}));if(-1!==t){var i=re([],e,!0);return i[t]=ee(ee({},i[t]),{id:r.fileId}),i}return e}))})).catch((function(n){var t,a;r.onFileUpdate("remove",i),f.current=ee(ee({},f.current),((t={})[i]=f.current[e.name]--,t)),function(e,r,n){u((function(r){return re(re([],r,!0),["Failed to upload ".concat(e,". ").concat((null==n?void 0:n.message)||"")],!1)})),o((function(e){return e.filter((function(e){return e.id!==r}))}))}(e.name,l.id,null===(a=n.response)||void 0===a?void 0:a.data)}))}(e)}(e)})),e.target.value=""},multiple:!0,accept:r.acceptedFileTypes})]}),l.length>0&&v(h,r.errorMessagesContainer),i.length>0&&v(p,r.filePreviewsContainer)]})};var ie=function(){return ie=Object.assign||function(e){for(var r,n=1,t=arguments.length;n<t;n++)for(var i in r=arguments[n])Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i]);return e},ie.apply(this,arguments)},oe=function(e,r,n){if(n||2===arguments.length)for(var t,i=0,o=r.length;i<o;i++)!t&&i in r||(t||(t=Array.prototype.slice.call(r,0,i)),t[i]=r[i]);return e.concat(t||Array.prototype.slice.call(r))};function ae(r){var i=(0,a.useState)([]),o=i[0],s=i[1],l=(0,a.useState)((0,c.v4)()),u=l[0],d=l[1],f=(0,a.useState)(),m=f[0],p=f[1],h=(0,a.useState)(),v=h[0],g=h[1],x=(0,a.useRef)(null),j=(0,t.useTheme)(),b=o.length>0;return(0,a.useEffect)((function(){x.current&&(g(x.current.querySelector(".rustic-error-container")),p(x.current.querySelector(".rustic-input-extras")))})),(0,e.jsx)(n(),{className:"rustic-multimodal-input",sx:{border:"1px solid ".concat(j.palette.action.disabled),borderRadius:"".concat(j.shape.borderRadius,"px"),":focus-within":{borderColor:j.palette.secondary.main}},children:(0,e.jsx)(z,ie({},r,{send:function(e){b&&(e.id=u,e.format="filesWithText",e.data.files=o),r.ws.send(e),d((0,c.v4)()),s([])},isSendEnabled:b,ref:x,children:(0,e.jsx)(n(),{className:"rustic-bottom-buttons",children:(0,e.jsx)(te,{acceptedFileTypes:r.acceptedFileTypes,maxFileCount:r.maxFileCount,maxFileSize:r.maxFileSize,uploadFileEndpoint:r.uploadFileEndpoint,deleteFileEndpoint:r.deleteFileEndpoint,onFileUpdate:function(e,r){s("add"===e?function(e){return oe(oe([],e,!0),[{name:r}],!1)}:function(e){return e.filter((function(e){return e.name!==r}))})},messageId:u,filePreviewsContainer:m,errorMessagesContainer:v})})}))})}ae.defaultProps={multiline:!0,fullWidth:!0,maxRows:6,maxFileSize:2097152,maxFileCount:1};const ce=ae})(),o})()));
|
|
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,r,n={342:e=>{e.exports=require("emoji-picker-element")}},t={};function i(e){var r=t[e];if(void 0!==r)return r.exports;var o=t[e]={exports:{}};return n[e](o,o.exports,i),o.exports}i.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return i.d(r,{a:r}),r},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(n,t){if(1&t&&(n=this(n)),8&t)return n;if("object"==typeof n&&n){if(4&t&&n.__esModule)return n;if(16&t&&"function"==typeof n.then)return n}var o=Object.create(null);i.r(o);var a={};e=e||[null,r({}),r([]),r(r)];for(var c=2&t&&n;"object"==typeof c&&!~e.indexOf(c);c=r(c))Object.getOwnPropertyNames(c).forEach((e=>a[e]=()=>n[e]));return a.default=()=>n,i.d(o,a),o},i.d=(e,r)=>{for(var n in r)i.o(r,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},i.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};i.r(o),i.d(o,{default:()=>de});const a=require("react/jsx-runtime"),c=require("@mui/material/Box");var s=i.n(c);const l=require("@mui/material/styles"),u=require("react"),d=require("uuid"),m=require("@mui/material/CircularProgress");var f=i.n(m);const p=require("@mui/material/IconButton");var h=i.n(p);const v=require("@mui/material/InputAdornment");var g=i.n(v);const x=require("@mui/material/MenuItem");var b=i.n(x);const j=require("@mui/material/MenuList");var y=i.n(j);const w=require("@mui/material/Popover");var S=i.n(w);const C=require("@mui/material/TextField");var N=i.n(C);const k=require("@mui/material/Tooltip");var F=i.n(k);const P=require("@mui/material/Typography");var O=i.n(P),E=i(342);function q(e){return e.name.replaceAll("_","-"),(0,a.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),children:e.name})}const T=function(e){var r=(0,l.useTheme)(),n=(0,u.useRef)(null),t=(0,u.useRef)(null),o=(0,u.useState)(!1),c=o[0],s=o[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 m(){s(!1)}function f(r){r.detail.unicode&&e.onEmojiClick(r.detail.unicode),m()}return(0,u.useEffect)((function(){t.current||"undefined"==typeof window||Promise.resolve().then(i.t.bind(i,342,23)).then((function(e){var n=new(0,e.Picker),i="dark"===r.palette.mode?"dark":"light";n.classList.add(i),Object.keys(d).forEach((function(e){n.style.setProperty(e,d[e])})),t.current=n})).catch((function(e){console.error("Failed to load emoji picker",e)}))}),[]),(0,u.useEffect)((function(){return t.current&&t.current.addEventListener("emoji-click",f),function(){var e;null===(e=t.current)||void 0===e||e.removeEventListener("emoji-click",f)}}),[c,e.onEmojiClick]),(0,a.jsxs)("div",{children:[(0,a.jsx)(F(),{title:"Emoji",children:(0,a.jsx)(h(),{size:"small",ref:n,onClick:function(){s((function(e){return!e}))},sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,a.jsx)(q,{name:"Mood"})})}),t.current&&(0,a.jsx)(S(),{open:c,anchorEl:n.current,onClose:m,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"right"},children:(0,a.jsx)("div",{className:"rustic-emoji-picker",ref:function(e){e&&t.current&&!e.contains(t.current)&&e.appendChild(t.current)}})})]})};var z={"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 R(e){if("unicode"in e&&"annotation"in e)return"".concat(e.unicode," ").concat(e.annotation)}var _=new E.Database,I=(0,u.forwardRef)((function(e,r){var n=(0,u.useState)(""),t=n[0],i=n[1],o=(0,u.useState)(!1),c=o[0],l=o[1],m=(0,u.useState)(!1),p=m[0],v=m[1],x=(0,u.useState)(!1),j=x[0],w=x[1],C=(0,u.useState)(""),k=C[0],P=C[1],E=(0,u.useState)([]),I=E[0],M=E[1],D=(0,u.useState)(!1),A=D[0],U=D[1],B=(0,u.useRef)(null),L=!t.trim().length&&!e.isSendEnabled,W="".concat(c?"Stop":"Start"," speech to text"),H=p?"primary.main":"primary.light",V=c?"error.main":H,$=c?"stop_circle":"speech_to_text";function G(e,r){if(void 0===r&&(r=!1),B.current){var n=B.current,o=n.selectionStart,a=n.selectionEnd;if("number"==typeof o&&"number"==typeof a){var c,s=t||"",l=s.substring(0,o),u=s.substring(a);c=r?l.replace(/:(\w+)$/,e)+u:l+e+u,i(c);var d=r?l.replace(/:(\w+)$/,e).length:o+e.length;setTimeout((function(){var e,r;null===(e=B.current)||void 0===e||e.focus(),null===(r=B.current)||void 0===r||r.setSelectionRange(d,d)}),0)}}U(!1)}var K=j?(0,a.jsx)(f(),{size:24}):(0,a.jsx)(F(),{title:W,children:(0,a.jsx)(h(),{onClick:function(){var e=new window.webkitSpeechRecognition,r=navigator.language;e.lang=r,c?(e.stop(),w(!0),l(!1)):(e.start(),P(""),l(!0)),e.onstart=function(){l(!0)},e.onresult=function(e){var r,n=e.results[0][0].transcript;t.length>0?i(t+" "+n):i(n),null===(r=B.current)||void 0===r||r.focus(),l(!1)},e.onerror=function(e){var r=z[e.error];P(r),l(!1)},e.onend=function(){w(!1),l(!1)}},size:"small",sx:{color:V,"&:hover":{color:"primary.main"}},children:(0,a.jsx)(q,{name:$})})});function Q(){var r=(new Date).toISOString(),n={id:(0,d.v4)(),timestamp:r,sender:e.sender,conversationId:e.conversationId,format:"text",data:{text:t}};e.send(n),i(""),P("")}return(0,a.jsxs)(s(),{className:"rustic-base-input",ref:r,children:[(0,a.jsxs)(s(),{className:"rustic-error-and-input-container",children:[(0,a.jsx)(s(),{className:"rustic-error-container",children:(0,a.jsx)(O(),{variant:"caption",color:"error",className:"rustic-error-message",children:k})}),(0,a.jsxs)(s(),{className:"rustic-input-field",sx:{border:"1px solid",borderColor:p?"secondary.main":"action.disabled"},children:[I.length>0&&(0,a.jsx)(S(),{open:A,anchorEl:B.current,onClose:function(){return U(!1)},disableAutoFocus:!0,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},children:(0,a.jsx)(y(),{children:I.map((function(e,r){return"unicode"in e&&(0,a.jsx)(b(),{onClick:function(){return G(e.unicode,!0)},children:R(e)},r)}))})}),(0,a.jsx)(N(),{className:"rustic-text-field",variant:"outlined",value:t,label:e.label,placeholder:e.placeholder,maxRows:e.maxRows,multiline:e.multiline,fullWidth:e.fullWidth,onKeyDown:function(e){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),!L&&Q())},onChange:function(r){P("");var n=r.target.value;i(n);var t,o=n.match(/:(\w{2,}):/g),a=n.match(/:(\w{2,})/g);if(o){var c=o[0].replace(/:/g,"");_.getEmojiByShortcode(c).then((function(e){if(e&&"unicode"in e){var r=n.replace(o[0],e.unicode);i(r)}else i(n)})).catch((function(){i(n)})),U(!1)}else a?(t=a[0].replace(":",""),_.getEmojiBySearchQuery(t).then((function(r){r.length?(M(r.slice(0,e.maximumEmojiSearchResults)),U(!0)):(M([]),U(!1))})).catch((function(){M([]),U(!1)}))):U(!1)},onFocus:function(){return v(!0)},onBlur:function(){return v(!1)},inputRef:B,color:"secondary",size:"small",InputProps:{endAdornment:(0,a.jsxs)(g(),{position:"end",className:"rustic-input-adornment",children:[(0,a.jsx)(T,{onEmojiClick:G,buttonColor:H}),e.enableSpeechToText&&K]})},InputLabelProps:{className:p?"":"rustic-input-label",sx:{backgroundColor:"background.paper"}}}),(0,a.jsx)("div",{className:"rustic-input-extras"})]})]}),(0,a.jsxs)(s(),{className:"rustic-input-actions",children:[e.children,(0,a.jsx)(F(),{title:"Send",children:(0,a.jsx)("span",{className:"rustic-send-button",children:(0,a.jsx)(h(),{"aria-label":"send message",onClick:Q,disabled:L,color:"secondary",children:(0,a.jsx)(q,{name:"send"})})})})]})]})}));I.defaultProps={multiline:!0,fullWidth:!0,maxRows:6,enableSpeechToText:!1,maximumEmojiSearchResults:5};const M=I,D=require("@mui/material/LinearProgress");var A=i.n(D);const U=require("axios");var B=i.n(U);const L=require("react-dom"),W=require("@mui/material/Card");var H=i.n(W);const V=require("@mui/material/Modal");var $,G=i.n(V);!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}($||($={}));const K=require("@mui/material/useMediaQuery");var Q=i.n(K);const Y=require("@mui/system/Stack");var Z=i.n(Y);const J=require("@mui/system/useTheme");var X=i.n(J);const ee=require("pdfjs-dist"),re=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,a.jsx)(F(),{title:n.label,children:(0,a.jsx)("span",{children:(0,a.jsx)(h(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,a.jsx)(q,{name:n.symbol})})})})};var ne={pdf:function(e){var r,n=(0,u.useRef)(null),t=(0,u.useState)(1),i=t[0],o=t[1],c=(0,u.useState)(1),l=c[0],d=c[1],m=(0,u.useState)(1),f=m[0],p=m[1],h=(0,u.useState)(!1),v=h[0],g=h[1],x=(0,u.useState)(),b=x[0],j=x[1],y=X()(),w=Q()(y.breakpoints.down("sm")),S=Q()(y.breakpoints.between("sm","md"));if(r=e.url,!/\/[^/]+\.pdf$/.test(r))return(0,a.jsx)(H(),{variant:"outlined",className:"rustic-pdf-error",children:(0,a.jsx)(O(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var C=(0,u.useState)((function(){return w?.5:S?1:1.5})),k=C[0],F=C[1];return(0,u.useEffect)((function(){ee.GlobalWorkerOptions.workerSrc||(ee.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(ee.version,"/pdf.worker.mjs")),ee.getDocument({url:"".concat(e.url)}).promise.then((function(e){d(e.numPages),function(e){e.getPage(i).then((function(e){var r=e.getViewport({scale:k}),t=n.current;if(t){var i=t.getContext("2d");if(i){var o=window.devicePixelRatio||1;t.style.width="".concat(r.width,"px"),t.style.height="".concat(r.height,"px"),t.width=r.width*o,t.height=r.height*o;var a={canvasContext:i,viewport:r,transform:[o,0,0,o,0,0]};b&&b.cancel();var c=e.render(a);j(c),c.promise.then((function(){j(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){g(!0)}))}),[e.url,i,k]),v?(0,a.jsx)(H(),{variant:"outlined",className:"rustic-pdf-error",children:(0,a.jsx)(O(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,a.jsxs)(H(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,a.jsxs)(s(),{className:"rustic-pdf-viewer-header",children:[(0,a.jsx)(re,{action:"zoomOut",onClick:function(){F((function(e){return Math.max(e-.2,.2)}))}}),(0,a.jsx)(re,{action:"zoomIn",onClick:function(){F((function(e){return e+.2}))}})]}),(0,a.jsx)(s(),{className:"rustic-pdf-viewer-body",children:(0,a.jsx)(s(),{className:"rustic-pdf-viewer-body-inner",children:(0,a.jsx)("canvas",{ref:n})})}),(0,a.jsxs)(Z(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,a.jsx)(re,{action:"previousPage",onClick:function(){i>1&&(o(i-1),p(i-1))},isDisabled:1===i}),(0,a.jsx)(O(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,a.jsx)(N(),{type:"number",value:f,onChange:function(e){var r=parseInt(e.target.value);p(r),!isNaN(r)&&r>=1&&r<=l&&o(r)},size:"small",className:"rustic-pdf-page-input"}),(0,a.jsxs)(O(),{variant:"body1",className:"rustic-page-indicator",children:["of ",l]}),(0,a.jsx)(re,{action:"nextPage",onClick:function(){i<l&&(o(i+1),p(i+1))},isDisabled:i===l})]})]})}};function te(e){var r=(0,l.useTheme)(),n=(0,u.useState)(!1),t=n[0],i=n[1];function o(){i(!1)}var c,s,d=e.file.url&&(c=e.file.url.split("."))[c.length-1].toLowerCase(),m=d&&e.supportedViewers?e.supportedViewers[d]:null,f=!!m,p=e.showFullName?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width",v=f?" rustic-cursor-pointer":"",g="rustic-file-preview ".concat(p).concat(v),x=e.showFullName?e.file.name:(15,(s=e.file.name).length<=15?s:s.substring(0,12)+"...");return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(H(),{className:g,variant:"outlined",sx:{boxShadow:r.shadows[1]},onClick:function(){i(!0)},children:[(0,a.jsx)(O(),{variant:"subtitle2",children:x}),(0,a.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:e.children})]}),f&&(0,a.jsx)(G(),{open:t,onClose:o,className:"rustic-file-preview-modal",children:(0,a.jsxs)("div",{className:"rustic-modal-content",children:[(0,a.jsx)(F(),{title:"Close",children:(0,a.jsx)(h(),{onClick:o,className:"rustic-close-button",children:(0,a.jsx)(q,{name:"close"})})}),e.file.url&&(0,a.jsx)(m,{url:e.file.url})]})})]})}te.defaultProps={supportedViewers:ne};var ie=function(){return ie=Object.assign||function(e){for(var r,n=1,t=arguments.length;n<t;n++)for(var i in r=arguments[n])Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i]);return e},ie.apply(this,arguments)},oe=function(e,r,n){if(n||2===arguments.length)for(var t,i=0,o=r.length;i<o;i++)!t&&i in r||(t||(t=Array.prototype.slice.call(r,0,i)),t[i]=r[i]);return e.concat(t||Array.prototype.slice.call(r))};function ae(e){for(var r=["Bytes","KB","MB","GB"],n=0;e>=1024&&n<r.length-1;)e/=1024,n++;var t=e.toFixed(1).toString().replace(/\.0$/,"");return"".concat(t," ").concat(r[n])}const ce=function(e){var r=(0,u.useState)([]),n=r[0],t=r[1],i=(0,u.useState)([]),o=i[0],c=i[1],l=(0,u.useRef)({}),m=(0,d.v4)();(0,u.useEffect)((function(){t([]),c([]),l.current={}}),[e.messageId]);var f=(0,a.jsx)(s(),{className:"rustic-files rustic-padding-16",children:n.map((function(r,n){return(0,a.jsx)(te,{file:{name:r.name},showFullName:e.showFullName,children:(0,a.jsxs)(s(),{className:"rustic-flex-center",children:[r.loadingProgress<100&&(0,a.jsx)(A(),{variant:"determinate",color:"secondary",value:r.loadingProgress,className:"rustic-upload-progress"}),(0,a.jsx)(F(),{title:"Delete",children:(0,a.jsx)(h(),{color:"primary",onClick:function(){return function(r,n){var i,o;c([]);var a=r.name;if(l.current=ie(ie({},l.current),((i={})[a]=l.current[a]--,i)),e.onFileUpdate("remove",a),100===r.loadingProgress){var s="".concat(e.deleteFileEndpoint,"?message-id=").concat(e.messageId,"&file-id=").concat(r.id);B().delete(s).then((function(){return t((function(e){return e.filter((function(e,r){return r!==n}))}))})).catch((function(){return e.onFileUpdate("add",a),c((function(e){return oe(oe([],e,!0),["Failed to delete ".concat(a,". Please try again.")],!1)}))}))}else r.abortController.abort(),t((function(e){return e.filter((function(e,r){return r!==n}))})),l.current=ie(ie({},l.current),((o={})[a]=l.current[a]++,o))}(r,n)},className:"rustic-delete-button rustic-shift-to-right-by-8","aria-label":"cancel file upload",children:(0,a.jsx)("span",{className:"material-symbols-rounded",children:"cancel"})})})]})},n)}))}),p=(0,a.jsx)(s(),{children:o.map((function(e,r){return(0,a.jsx)(O(),{variant:"caption",color:"error",className:"rustic-error-message",children:e},r)}))});function v(e,r){return r?(0,L.createPortal)(e,r):e}return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(s(),{className:"rustic-uploader",children:[(0,a.jsx)("label",{htmlFor:m,children:(0,a.jsx)(F(),{title:"Upload",children:(0,a.jsx)(h(),{component:"span","aria-label":"Upload file",sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,a.jsx)("span",{className:"material-symbols-rounded",children:"upload_2"})})})}),(0,a.jsx)("input",{type:"file",id:m,onChange:function(r){c([]);var i=r.target.files&&Array.from(r.target.files),o=n.length+(i?i.length:0);e.maxFileCount&&o>e.maxFileCount&&c((function(r){return oe(oe([],r,!0),["You can only upload ".concat(e.maxFileCount," files.")],!1)}));var a=i&&function(e,r,n){return n?r<=n?e:e.slice(0,n-r):e}(i,o,e.maxFileCount);a&&a.forEach((function(r){!function(r){var n;e.maxFileSize&&r.size>e.maxFileSize?(n=r.name,c((function(r){return oe(oe([],r,!0),["Failed to upload ".concat(n,". You cannot upload files larger than ").concat(e.maxFileSize&&ae(e.maxFileSize),".")],!1)}))):function(r){var n=new FormData,i=new AbortController,o=function(e){var r,n,t=e.name,i=l.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),l.current=ie(ie({},l.current),((r={})[e.name]=o,r))}else l.current=ie(ie({},l.current),((n={})[e.name]=1,n));return t}(r),a=new File([r],o,{type:r.type});n.append("file",a);var s=(0,d.v4)(),u={name:o,loadingProgress:0,abortController:i,id:s};t((function(e){return oe(oe([],e,!0),[u],!1)})),e.onFileUpdate("add",o);var m="".concat(e.uploadFileEndpoint,"?message-id=").concat(e.messageId);B().post(m,n,{onUploadProgress:function(e){var r,n;e.total&&(r=e.loaded/e.total*100,n=u.id,t((function(e){var t=e.map((function(e){return e.id===n?ie(ie({},e),{loadingProgress:r}):e}));return t})))},signal:i.signal}).then((function(e){var r,n;r=e.data,n=u.id,t((function(e){var t=e.findIndex((function(e){return e.id===n}));if(-1!==t){var i=oe([],e,!0);return i[t]=ie(ie({},i[t]),{id:r.fileId}),i}return e}))})).catch((function(n){var i,a;e.onFileUpdate("remove",o),l.current=ie(ie({},l.current),((i={})[o]=l.current[r.name]--,i)),function(e,r,n){c((function(r){return oe(oe([],r,!0),["Failed to upload ".concat(e,". ").concat((null==n?void 0:n.message)||"")],!1)})),t((function(e){return e.filter((function(e){return e.id!==r}))}))}(r.name,u.id,null===(a=n.response)||void 0===a?void 0:a.data)}))}(r)}(r)})),r.target.value=""},multiple:!0,accept:e.acceptedFileTypes})]}),o.length>0&&v(p,e.errorMessagesContainer),n.length>0&&v(f,e.filePreviewsContainer)]})};var se=function(){return se=Object.assign||function(e){for(var r,n=1,t=arguments.length;n<t;n++)for(var i in r=arguments[n])Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i]);return e},se.apply(this,arguments)},le=function(e,r,n){if(n||2===arguments.length)for(var t,i=0,o=r.length;i<o;i++)!t&&i in r||(t||(t=Array.prototype.slice.call(r,0,i)),t[i]=r[i]);return e.concat(t||Array.prototype.slice.call(r))};function ue(e){var r=(0,u.useState)([]),n=r[0],t=r[1],i=(0,u.useState)((0,d.v4)()),o=i[0],c=i[1],m=(0,u.useState)(),f=m[0],p=m[1],h=(0,u.useState)(),v=h[0],g=h[1],x=(0,u.useRef)(null),b=(0,l.useTheme)(),j=n.length>0;return(0,u.useEffect)((function(){x.current&&(g(x.current.querySelector(".rustic-error-container")),p(x.current.querySelector(".rustic-input-extras")))})),(0,a.jsx)(s(),{className:"rustic-multimodal-input",sx:{border:"1px solid ".concat(b.palette.action.disabled),borderRadius:"".concat(b.shape.borderRadius,"px"),":focus-within":{borderColor:b.palette.secondary.main},background:b.palette.background.paper},children:(0,a.jsx)(M,se({},e,{send:function(r){j&&(r.id=o,r.format="filesWithText",r.data.files=n),e.ws.send(r),c((0,d.v4)()),t([])},isSendEnabled:j,ref:x,children:(0,a.jsx)(s(),{className:"rustic-bottom-buttons",children:(0,a.jsx)(ce,{acceptedFileTypes:e.acceptedFileTypes,maxFileCount:e.maxFileCount,maxFileSize:e.maxFileSize,uploadFileEndpoint:e.uploadFileEndpoint,deleteFileEndpoint:e.deleteFileEndpoint,onFileUpdate:function(e,r){t("add"===e?function(e){return le(le([],e,!0),[{name:r}],!1)}:function(e){return e.filter((function(e){return e.name!==r}))})},messageId:o,filePreviewsContainer:f,errorMessagesContainer:v,showFullName:e.showFullName})})}))})}ue.defaultProps={multiline:!0,fullWidth:!0,maxRows:6,maxFileSize:2097152,maxFileCount:1};const de=ue;return o})()));
|
|
@@ -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;AAQ9B,OAAO,KAAK,EAAqB,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAI7E;;;;;;;;;;;;;;;EAeE;AACF,iBAAwB,eAAe,CAAC,KAAK,EAAE,oBAAoB,
|
|
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;AAQ9B,OAAO,KAAK,EAAqB,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAI7E;;;;;;;;;;;;;;;EAeE;AACF,iBAAwB,eAAe,CAAC,KAAK,EAAE,oBAAoB,2CAiFlE;kBAjFuB,eAAe;;;;;;;;;eAAf,eAAe"}
|
|
@@ -24,12 +24,19 @@
|
|
|
24
24
|
position: relative;
|
|
25
25
|
display: flex;
|
|
26
26
|
align-items: center;
|
|
27
|
-
padding: 8px
|
|
27
|
+
padding: 8px 16px;
|
|
28
28
|
justify-content: space-between;
|
|
29
|
-
width: 220px;
|
|
30
29
|
height: 56px;
|
|
31
30
|
}
|
|
32
31
|
|
|
32
|
+
.rustic-fixed-file-preview-width {
|
|
33
|
+
width: 220px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.rustic-flexible-file-preview-width {
|
|
37
|
+
min-width: 220px;
|
|
38
|
+
}
|
|
39
|
+
|
|
33
40
|
.rustic-file-preview-modal {
|
|
34
41
|
width: 90vw;
|
|
35
42
|
height: 90vh;
|
|
@@ -83,6 +90,10 @@ code {
|
|
|
83
90
|
align-self: center;
|
|
84
91
|
}
|
|
85
92
|
|
|
93
|
+
.rustic-shift-to-right-by-8 {
|
|
94
|
+
margin-right: -8px;
|
|
95
|
+
}
|
|
96
|
+
|
|
86
97
|
span.rustic-icon-large {
|
|
87
98
|
font-size: 32px;
|
|
88
99
|
}
|
|
@@ -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 n=r&&r.__esModule?()=>r.default:()=>r;return e.d(n,{a:n}),n},d:(r,n)=>{for(var t in n)e.o(n,t)&&!e.o(r,t)&&Object.defineProperty(r,t,{enumerable:!0,get:n[t]})},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:()=>B});const n=require("react/jsx-runtime"),t=require("@mui/material/Box");var a=e.n(t);const i=require("@mui/material/IconButton");var o=e.n(i);const s=require("@mui/material/LinearProgress");var c=e.n(s);const l=require("@mui/material/Tooltip");var u=e.n(l);const d=require("@mui/material/Typography");var f=e.n(d);const m=require("axios");var p=e.n(m);const v=require("react"),h=require("react-dom"),x=require("uuid"),g=require("@mui/material/Card");var j=e.n(g);const b=require("@mui/material/Modal");var y=e.n(b);const w=require("@mui/material/styles");var N;function C(e){return e.name.replaceAll("_","-"),(0,n.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),children:e.name})}!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(N||(N={}));const F=require("@mui/material/TextField");var P=e.n(F);const S=require("@mui/material/useMediaQuery");var k=e.n(S);const q=require("@mui/system/Stack");var O=e.n(q);const T=require("@mui/system/useTheme");var z=e.n(T);const _=require("pdfjs-dist"),I=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"}},t=(r[e.action].label.replaceAll(" ","-").toLowerCase(),r[e.action]);return(0,n.jsx)(u(),{title:t.label,children:(0,n.jsx)("span",{children:(0,n.jsx)(o(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,n.jsx)(C,{name:t.symbol})})})})};var D={pdf:function(e){var r,t=(0,v.useRef)(null),i=(0,v.useState)(1),o=i[0],s=i[1],c=(0,v.useState)(1),l=c[0],u=c[1],d=(0,v.useState)(1),m=d[0],p=d[1],h=(0,v.useState)(!1),x=h[0],g=h[1],b=(0,v.useState)(),y=b[0],w=b[1],N=z()(),C=k()(N.breakpoints.down("sm")),F=k()(N.breakpoints.between("sm","md"));if(r=e.url,!/\/[^/]+\.pdf$/.test(r))return(0,n.jsx)(j(),{variant:"outlined",className:"rustic-pdf-error",children:(0,n.jsx)(f(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var S=(0,v.useState)((function(){return C?.5:F?1:1.5})),q=S[0],T=S[1];return(0,v.useEffect)((function(){_.GlobalWorkerOptions.workerSrc||(_.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(_.version,"/pdf.worker.mjs")),_.getDocument({url:"".concat(e.url)}).promise.then((function(e){u(e.numPages),function(e){e.getPage(o).then((function(e){var r=e.getViewport({scale:q}),n=t.current;if(n){var a=n.getContext("2d");if(a){var i=window.devicePixelRatio||1;n.style.width="".concat(r.width,"px"),n.style.height="".concat(r.height,"px"),n.width=r.width*i,n.height=r.height*i;var o={canvasContext:a,viewport:r,transform:[i,0,0,i,0,0]};y&&y.cancel();var s=e.render(o);w(s),s.promise.then((function(){w(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){g(!0)}))}),[e.url,o,q]),x?(0,n.jsx)(j(),{variant:"outlined",className:"rustic-pdf-error",children:(0,n.jsx)(f(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,n.jsxs)(j(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,n.jsxs)(a(),{className:"rustic-pdf-viewer-header",children:[(0,n.jsx)(I,{action:"zoomOut",onClick:function(){T((function(e){return Math.max(e-.2,.2)}))}}),(0,n.jsx)(I,{action:"zoomIn",onClick:function(){T((function(e){return e+.2}))}})]}),(0,n.jsx)(a(),{className:"rustic-pdf-viewer-body",children:(0,n.jsx)(a(),{className:"rustic-pdf-viewer-body-inner",children:(0,n.jsx)("canvas",{ref:t})})}),(0,n.jsxs)(O(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,n.jsx)(I,{action:"previousPage",onClick:function(){o>1&&(s(o-1),p(o-1))},isDisabled:1===o}),(0,n.jsx)(f(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,n.jsx)(P(),{type:"number",value:m,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,n.jsxs)(f(),{variant:"body1",className:"rustic-page-indicator",children:["of ",l]}),(0,n.jsx)(I,{action:"nextPage",onClick:function(){o<l&&(s(o+1),p(o+1))},isDisabled:o===l})]})]})}};function M(e){var r=(0,w.useTheme)(),t=(0,v.useState)(!1),a=t[0],i=t[1];function s(){i(!1)}var c,l,d=e.file.url&&(c=e.file.url.split("."))[c.length-1].toLowerCase(),m=d&&e.supportedViewers?e.supportedViewers[d]:null,p=!!m;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(j(),{className:"rustic-file-preview".concat(p?" rustic-cursor-pointer":""),variant:"outlined",sx:{boxShadow:r.shadows[1]},onClick:function(){i(!0)},children:[(0,n.jsx)(f(),{variant:"subtitle2",children:(l=e.file.name,15,l.length<=15?l:l.substring(0,12)+"...")}),(0,n.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:e.children})]}),p&&(0,n.jsx)(y(),{open:a,onClose:s,className:"rustic-file-preview-modal",children:(0,n.jsxs)("div",{className:"rustic-modal-content",children:[(0,n.jsx)(u(),{title:"Close",children:(0,n.jsx)(o(),{onClick:s,className:"rustic-close-button",children:(0,n.jsx)(C,{name:"close"})})}),e.file.url&&(0,n.jsx)(m,{url:e.file.url})]})})]})}M.defaultProps={supportedViewers:D};var U=function(){return U=Object.assign||function(e){for(var r,n=1,t=arguments.length;n<t;n++)for(var a in r=arguments[n])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},U.apply(this,arguments)},A=function(e,r,n){if(n||2===arguments.length)for(var t,a=0,i=r.length;a<i;a++)!t&&a in r||(t||(t=Array.prototype.slice.call(r,0,a)),t[a]=r[a]);return e.concat(t||Array.prototype.slice.call(r))};function E(e){for(var r=["Bytes","KB","MB","GB"],n=0;e>=1024&&n<r.length-1;)e/=1024,n++;var t=e.toFixed(1).toString().replace(/\.0$/,"");return"".concat(t," ").concat(r[n])}const B=function(e){var r=(0,v.useState)([]),t=r[0],i=r[1],s=(0,v.useState)([]),l=s[0],d=s[1],m=(0,v.useRef)({}),g=(0,x.v4)();(0,v.useEffect)((function(){i([]),d([]),m.current={}}),[e.messageId]);var j=(0,n.jsx)(a(),{className:"rustic-files rustic-padding-16",children:t.map((function(r,t){return(0,n.jsx)(M,{file:{name:r.name},children:(0,n.jsxs)(a(),{className:"rustic-flex-center",children:[r.loadingProgress<100&&(0,n.jsx)(c(),{variant:"determinate",color:"secondary",value:r.loadingProgress,className:"rustic-upload-progress"}),(0,n.jsx)(u(),{title:"Delete",children:(0,n.jsx)(o(),{color:"primary",onClick:function(){return function(r,n){var t,a;d([]);var o=r.name;if(m.current=U(U({},m.current),((t={})[o]=m.current[o]--,t)),e.onFileUpdate("remove",o),100===r.loadingProgress){var s="".concat(e.deleteFileEndpoint,"?message-id=").concat(e.messageId,"&file-id=").concat(r.id);p().delete(s).then((function(){return i((function(e){return e.filter((function(e,r){return r!==n}))}))})).catch((function(){return e.onFileUpdate("add",o),d((function(e){return A(A([],e,!0),["Failed to delete ".concat(o,". Please try again.")],!1)}))}))}else r.abortController.abort(),i((function(e){return e.filter((function(e,r){return r!==n}))})),m.current=U(U({},m.current),((a={})[o]=m.current[o]++,a))}(r,t)},className:"rustic-delete-button","aria-label":"cancel file upload",children:(0,n.jsx)("span",{className:"material-symbols-rounded",children:"cancel"})})})]})},t)}))}),b=(0,n.jsx)(a(),{children:l.map((function(e,r){return(0,n.jsx)(f(),{variant:"caption",color:"error",className:"rustic-error-message",children:e},r)}))});function y(e,r){return r?(0,h.createPortal)(e,r):e}return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(a(),{className:"rustic-uploader",children:[(0,n.jsx)("label",{htmlFor:g,children:(0,n.jsx)(u(),{title:"Upload",children:(0,n.jsx)(o(),{component:"span","aria-label":"Upload file",color:"primary",children:(0,n.jsx)("span",{className:"material-symbols-rounded",children:"upload_2"})})})}),(0,n.jsx)("input",{type:"file",id:g,onChange:function(r){d([]);var n=r.target.files&&Array.from(r.target.files),a=t.length+(n?n.length:0);e.maxFileCount&&a>e.maxFileCount&&d((function(r){return A(A([],r,!0),["You can only upload ".concat(e.maxFileCount," files.")],!1)}));var o=n&&function(e,r,n){return n?r<=n?e:e.slice(0,n-r):e}(n,a,e.maxFileCount);o&&o.forEach((function(r){!function(r){var n;e.maxFileSize&&r.size>e.maxFileSize?(n=r.name,d((function(r){return A(A([],r,!0),["Failed to upload ".concat(n,". You cannot upload files larger than ").concat(e.maxFileSize&&E(e.maxFileSize),".")],!1)}))):function(r){var n=new FormData,t=new AbortController,a=function(e){var r,n,t=e.name,a=m.current[t];if(a){var i=a+1,o=t.lastIndexOf("."),s=t.substring(0,o),c=t.substring(o);t="".concat(s,"(").concat(a,")").concat(c),m.current=U(U({},m.current),((r={})[e.name]=i,r))}else m.current=U(U({},m.current),((n={})[e.name]=1,n));return t}(r),o=new File([r],a,{type:r.type});n.append("file",o);var s=(0,x.v4)(),c={name:a,loadingProgress:0,abortController:t,id:s};i((function(e){return A(A([],e,!0),[c],!1)})),e.onFileUpdate("add",a);var l="".concat(e.uploadFileEndpoint,"?message-id=").concat(e.messageId);p().post(l,n,{onUploadProgress:function(e){var r,n;e.total&&(r=e.loaded/e.total*100,n=c.id,i((function(e){var t=e.map((function(e){return e.id===n?U(U({},e),{loadingProgress:r}):e}));return t})))},signal:t.signal}).then((function(e){var r,n;r=e.data,n=c.id,i((function(e){var t=e.findIndex((function(e){return e.id===n}));if(-1!==t){var a=A([],e,!0);return a[t]=U(U({},a[t]),{id:r.fileId}),a}return e}))})).catch((function(n){var t,o;e.onFileUpdate("remove",a),m.current=U(U({},m.current),((t={})[a]=m.current[r.name]--,t)),function(e,r,n){d((function(r){return A(A([],r,!0),["Failed to upload ".concat(e,". ").concat((null==n?void 0:n.message)||"")],!1)})),i((function(e){return e.filter((function(e){return e.id!==r}))}))}(r.name,c.id,null===(o=n.response)||void 0===o?void 0:o.data)}))}(r)}(r)})),r.target.value=""},multiple:!0,accept:e.acceptedFileTypes})]}),l.length>0&&y(b,e.errorMessagesContainer),t.length>0&&y(j,e.filePreviewsContainer)]})};return 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 n=r&&r.__esModule?()=>r.default:()=>r;return e.d(n,{a:n}),n},d:(r,n)=>{for(var t in n)e.o(n,t)&&!e.o(r,t)&&Object.defineProperty(r,t,{enumerable:!0,get:n[t]})},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:()=>B});const n=require("react/jsx-runtime"),t=require("@mui/material/Box");var a=e.n(t);const i=require("@mui/material/IconButton");var o=e.n(i);const s=require("@mui/material/LinearProgress");var l=e.n(s);const c=require("@mui/material/Tooltip");var u=e.n(c);const d=require("@mui/material/Typography");var m=e.n(d);const f=require("axios");var p=e.n(f);const v=require("react"),h=require("react-dom"),x=require("uuid"),g=require("@mui/material/Card");var b=e.n(g);const j=require("@mui/material/Modal");var y=e.n(j);const w=require("@mui/material/styles");var N;function F(e){return e.name.replaceAll("_","-"),(0,n.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),children:e.name})}!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(N||(N={}));const C=require("@mui/material/TextField");var P=e.n(C);const S=require("@mui/material/useMediaQuery");var k=e.n(S);const q=require("@mui/system/Stack");var O=e.n(q);const T=require("@mui/system/useTheme");var z=e.n(T);const _=require("pdfjs-dist"),I=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"}},t=(r[e.action].label.replaceAll(" ","-").toLowerCase(),r[e.action]);return(0,n.jsx)(u(),{title:t.label,children:(0,n.jsx)("span",{children:(0,n.jsx)(o(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,n.jsx)(F,{name:t.symbol})})})})};var D={pdf:function(e){var r,t=(0,v.useRef)(null),i=(0,v.useState)(1),o=i[0],s=i[1],l=(0,v.useState)(1),c=l[0],u=l[1],d=(0,v.useState)(1),f=d[0],p=d[1],h=(0,v.useState)(!1),x=h[0],g=h[1],j=(0,v.useState)(),y=j[0],w=j[1],N=z()(),F=k()(N.breakpoints.down("sm")),C=k()(N.breakpoints.between("sm","md"));if(r=e.url,!/\/[^/]+\.pdf$/.test(r))return(0,n.jsx)(b(),{variant:"outlined",className:"rustic-pdf-error",children:(0,n.jsx)(m(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var S=(0,v.useState)((function(){return F?.5:C?1:1.5})),q=S[0],T=S[1];return(0,v.useEffect)((function(){_.GlobalWorkerOptions.workerSrc||(_.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(_.version,"/pdf.worker.mjs")),_.getDocument({url:"".concat(e.url)}).promise.then((function(e){u(e.numPages),function(e){e.getPage(o).then((function(e){var r=e.getViewport({scale:q}),n=t.current;if(n){var a=n.getContext("2d");if(a){var i=window.devicePixelRatio||1;n.style.width="".concat(r.width,"px"),n.style.height="".concat(r.height,"px"),n.width=r.width*i,n.height=r.height*i;var o={canvasContext:a,viewport:r,transform:[i,0,0,i,0,0]};y&&y.cancel();var s=e.render(o);w(s),s.promise.then((function(){w(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){g(!0)}))}),[e.url,o,q]),x?(0,n.jsx)(b(),{variant:"outlined",className:"rustic-pdf-error",children:(0,n.jsx)(m(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,n.jsxs)(b(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,n.jsxs)(a(),{className:"rustic-pdf-viewer-header",children:[(0,n.jsx)(I,{action:"zoomOut",onClick:function(){T((function(e){return Math.max(e-.2,.2)}))}}),(0,n.jsx)(I,{action:"zoomIn",onClick:function(){T((function(e){return e+.2}))}})]}),(0,n.jsx)(a(),{className:"rustic-pdf-viewer-body",children:(0,n.jsx)(a(),{className:"rustic-pdf-viewer-body-inner",children:(0,n.jsx)("canvas",{ref:t})})}),(0,n.jsxs)(O(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,n.jsx)(I,{action:"previousPage",onClick:function(){o>1&&(s(o-1),p(o-1))},isDisabled:1===o}),(0,n.jsx)(m(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,n.jsx)(P(),{type:"number",value:f,onChange:function(e){var r=parseInt(e.target.value);p(r),!isNaN(r)&&r>=1&&r<=c&&s(r)},size:"small",className:"rustic-pdf-page-input"}),(0,n.jsxs)(m(),{variant:"body1",className:"rustic-page-indicator",children:["of ",c]}),(0,n.jsx)(I,{action:"nextPage",onClick:function(){o<c&&(s(o+1),p(o+1))},isDisabled:o===c})]})]})}};function M(e){var r=(0,w.useTheme)(),t=(0,v.useState)(!1),a=t[0],i=t[1];function s(){i(!1)}var l,c,d=e.file.url&&(l=e.file.url.split("."))[l.length-1].toLowerCase(),f=d&&e.supportedViewers?e.supportedViewers[d]:null,p=!!f,h=e.showFullName?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width",x=p?" rustic-cursor-pointer":"",g="rustic-file-preview ".concat(h).concat(x),j=e.showFullName?e.file.name:(15,(c=e.file.name).length<=15?c:c.substring(0,12)+"...");return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(b(),{className:g,variant:"outlined",sx:{boxShadow:r.shadows[1]},onClick:function(){i(!0)},children:[(0,n.jsx)(m(),{variant:"subtitle2",children:j}),(0,n.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:e.children})]}),p&&(0,n.jsx)(y(),{open:a,onClose:s,className:"rustic-file-preview-modal",children:(0,n.jsxs)("div",{className:"rustic-modal-content",children:[(0,n.jsx)(u(),{title:"Close",children:(0,n.jsx)(o(),{onClick:s,className:"rustic-close-button",children:(0,n.jsx)(F,{name:"close"})})}),e.file.url&&(0,n.jsx)(f,{url:e.file.url})]})})]})}M.defaultProps={supportedViewers:D};var U=function(){return U=Object.assign||function(e){for(var r,n=1,t=arguments.length;n<t;n++)for(var a in r=arguments[n])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},U.apply(this,arguments)},A=function(e,r,n){if(n||2===arguments.length)for(var t,a=0,i=r.length;a<i;a++)!t&&a in r||(t||(t=Array.prototype.slice.call(r,0,a)),t[a]=r[a]);return e.concat(t||Array.prototype.slice.call(r))};function E(e){for(var r=["Bytes","KB","MB","GB"],n=0;e>=1024&&n<r.length-1;)e/=1024,n++;var t=e.toFixed(1).toString().replace(/\.0$/,"");return"".concat(t," ").concat(r[n])}const B=function(e){var r=(0,v.useState)([]),t=r[0],i=r[1],s=(0,v.useState)([]),c=s[0],d=s[1],f=(0,v.useRef)({}),g=(0,x.v4)();(0,v.useEffect)((function(){i([]),d([]),f.current={}}),[e.messageId]);var b=(0,n.jsx)(a(),{className:"rustic-files rustic-padding-16",children:t.map((function(r,t){return(0,n.jsx)(M,{file:{name:r.name},showFullName:e.showFullName,children:(0,n.jsxs)(a(),{className:"rustic-flex-center",children:[r.loadingProgress<100&&(0,n.jsx)(l(),{variant:"determinate",color:"secondary",value:r.loadingProgress,className:"rustic-upload-progress"}),(0,n.jsx)(u(),{title:"Delete",children:(0,n.jsx)(o(),{color:"primary",onClick:function(){return function(r,n){var t,a;d([]);var o=r.name;if(f.current=U(U({},f.current),((t={})[o]=f.current[o]--,t)),e.onFileUpdate("remove",o),100===r.loadingProgress){var s="".concat(e.deleteFileEndpoint,"?message-id=").concat(e.messageId,"&file-id=").concat(r.id);p().delete(s).then((function(){return i((function(e){return e.filter((function(e,r){return r!==n}))}))})).catch((function(){return e.onFileUpdate("add",o),d((function(e){return A(A([],e,!0),["Failed to delete ".concat(o,". Please try again.")],!1)}))}))}else r.abortController.abort(),i((function(e){return e.filter((function(e,r){return r!==n}))})),f.current=U(U({},f.current),((a={})[o]=f.current[o]++,a))}(r,t)},className:"rustic-delete-button rustic-shift-to-right-by-8","aria-label":"cancel file upload",children:(0,n.jsx)("span",{className:"material-symbols-rounded",children:"cancel"})})})]})},t)}))}),j=(0,n.jsx)(a(),{children:c.map((function(e,r){return(0,n.jsx)(m(),{variant:"caption",color:"error",className:"rustic-error-message",children:e},r)}))});function y(e,r){return r?(0,h.createPortal)(e,r):e}return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(a(),{className:"rustic-uploader",children:[(0,n.jsx)("label",{htmlFor:g,children:(0,n.jsx)(u(),{title:"Upload",children:(0,n.jsx)(o(),{component:"span","aria-label":"Upload file",sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,n.jsx)("span",{className:"material-symbols-rounded",children:"upload_2"})})})}),(0,n.jsx)("input",{type:"file",id:g,onChange:function(r){d([]);var n=r.target.files&&Array.from(r.target.files),a=t.length+(n?n.length:0);e.maxFileCount&&a>e.maxFileCount&&d((function(r){return A(A([],r,!0),["You can only upload ".concat(e.maxFileCount," files.")],!1)}));var o=n&&function(e,r,n){return n?r<=n?e:e.slice(0,n-r):e}(n,a,e.maxFileCount);o&&o.forEach((function(r){!function(r){var n;e.maxFileSize&&r.size>e.maxFileSize?(n=r.name,d((function(r){return A(A([],r,!0),["Failed to upload ".concat(n,". You cannot upload files larger than ").concat(e.maxFileSize&&E(e.maxFileSize),".")],!1)}))):function(r){var n=new FormData,t=new AbortController,a=function(e){var r,n,t=e.name,a=f.current[t];if(a){var i=a+1,o=t.lastIndexOf("."),s=t.substring(0,o),l=t.substring(o);t="".concat(s,"(").concat(a,")").concat(l),f.current=U(U({},f.current),((r={})[e.name]=i,r))}else f.current=U(U({},f.current),((n={})[e.name]=1,n));return t}(r),o=new File([r],a,{type:r.type});n.append("file",o);var s=(0,x.v4)(),l={name:a,loadingProgress:0,abortController:t,id:s};i((function(e){return A(A([],e,!0),[l],!1)})),e.onFileUpdate("add",a);var c="".concat(e.uploadFileEndpoint,"?message-id=").concat(e.messageId);p().post(c,n,{onUploadProgress:function(e){var r,n;e.total&&(r=e.loaded/e.total*100,n=l.id,i((function(e){var t=e.map((function(e){return e.id===n?U(U({},e),{loadingProgress:r}):e}));return t})))},signal:t.signal}).then((function(e){var r,n;r=e.data,n=l.id,i((function(e){var t=e.findIndex((function(e){return e.id===n}));if(-1!==t){var a=A([],e,!0);return a[t]=U(U({},a[t]),{id:r.fileId}),a}return e}))})).catch((function(n){var t,o;e.onFileUpdate("remove",a),f.current=U(U({},f.current),((t={})[a]=f.current[r.name]--,t)),function(e,r,n){d((function(r){return A(A([],r,!0),["Failed to upload ".concat(e,". ").concat((null==n?void 0:n.message)||"")],!1)})),i((function(e){return e.filter((function(e){return e.id!==r}))}))}(r.name,l.id,null===(o=n.response)||void 0===o?void 0:o.data)}))}(r)}(r)})),r.target.value=""},multiple:!0,accept:e.acceptedFileTypes})]}),c.length>0&&y(j,e.errorMessagesContainer),t.length>0&&y(b,e.filePreviewsContainer)]})};return r})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploader.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/multimodal/uploader/uploader.tsx"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAA;AAcvB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAWnD,wBAAgB,aAAa,CAC3B,KAAK,EAAE,IAAI,EAAE,EACb,cAAc,EAAE,MAAM,EACtB,YAAY,CAAC,EAAE,MAAM,GACpB,IAAI,EAAE,GAAG,SAAS,CAUpB;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAYvD;AAED,iBAAS,QAAQ,CAAC,KAAK,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"uploader.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/multimodal/uploader/uploader.tsx"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAA;AAcvB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAWnD,wBAAgB,aAAa,CAC3B,KAAK,EAAE,IAAI,EAAE,EACb,cAAc,EAAE,MAAM,EACtB,YAAY,CAAC,EAAE,MAAM,GACpB,IAAI,EAAE,GAAG,SAAS,CAUpB;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAYvD;AAED,iBAAS,QAAQ,CAAC,KAAK,EAAE,aAAa,2CAkSrC;AACD,eAAe,QAAQ,CAAA"}
|
|
@@ -36,13 +36,18 @@
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
.rustic-base-input .rustic-send-button {
|
|
39
|
-
margin: 10px
|
|
39
|
+
margin: 10px 12px;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
.rustic-base-input .rustic-input-actions {
|
|
43
43
|
display: flex;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
.rustic-base-input .rustic-input-adornment {
|
|
47
|
+
align-self: start;
|
|
48
|
+
margin-top: 12px;
|
|
49
|
+
}
|
|
50
|
+
|
|
46
51
|
span.rustic-icon-large {
|
|
47
52
|
font-size: 32px;
|
|
48
53
|
}
|
|
@@ -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,r,t={
|
|
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,r,t={342:e=>{e.exports=require("emoji-picker-element")}},n={};function o(e){var r=n[e];if(void 0!==r)return r.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,o),i.exports}o.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return o.d(r,{a:r}),r},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(t,n){if(1&n&&(t=this(t)),8&n)return t;if("object"==typeof t&&t){if(4&n&&t.__esModule)return t;if(16&n&&"function"==typeof t.then)return t}var i=Object.create(null);o.r(i);var a={};e=e||[null,r({}),r([]),r(r)];for(var c=2&n&&t;"object"==typeof c&&!~e.indexOf(c);c=r(c))Object.getOwnPropertyNames(c).forEach((e=>a[e]=()=>t[e]));return a.default=()=>t,o.d(i,a),i},o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};o.r(i),o.d(i,{default:()=>L});const a=require("react/jsx-runtime"),c=require("react"),s=require("@mui/material/Box");var u=o.n(s);const l=require("@mui/material/CircularProgress");var d=o.n(l);const p=require("@mui/material/IconButton");var m=o.n(p);const f=require("@mui/material/InputAdornment");var h=o.n(f);const v=require("@mui/material/MenuItem");var g=o.n(v);const y=require("@mui/material/MenuList");var b=o.n(y);const j=require("@mui/material/Popover");var x=o.n(j);const w=require("@mui/material/TextField");var S=o.n(w);const O=require("@mui/material/Tooltip");var k=o.n(O);const E=require("@mui/material/Typography");var C=o.n(E),P=o(342);const N=require("uuid");function q(e){return e.name.replaceAll("_","-"),(0,a.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),children:e.name})}const T=require("@mui/material/styles"),_=function(e){var r=(0,T.useTheme)(),t=(0,c.useRef)(null),n=(0,c.useRef)(null),i=(0,c.useState)(!1),s=i[0],u=i[1],l={"--indicator-color":r.palette.divider,"--background":r.palette.background.paper,"--input-border-color":r.palette.divider,"--outline-color":r.palette.secondary.main};function d(){u(!1)}function p(r){r.detail.unicode&&e.onEmojiClick(r.detail.unicode),d()}return(0,c.useEffect)((function(){n.current||"undefined"==typeof window||Promise.resolve().then(o.t.bind(o,342,23)).then((function(e){var t=new(0,e.Picker),o="dark"===r.palette.mode?"dark":"light";t.classList.add(o),Object.keys(l).forEach((function(e){t.style.setProperty(e,l[e])})),n.current=t})).catch((function(e){console.error("Failed to load emoji picker",e)}))}),[]),(0,c.useEffect)((function(){return n.current&&n.current.addEventListener("emoji-click",p),function(){var e;null===(e=n.current)||void 0===e||e.removeEventListener("emoji-click",p)}}),[s,e.onEmojiClick]),(0,a.jsxs)("div",{children:[(0,a.jsx)(k(),{title:"Emoji",children:(0,a.jsx)(m(),{size:"small",ref:t,onClick:function(){u((function(e){return!e}))},sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,a.jsx)(q,{name:"Mood"})})}),n.current&&(0,a.jsx)(x(),{open:s,anchorEl:t.current,onClose:d,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"right"},children:(0,a.jsx)("div",{className:"rustic-emoji-picker",ref:function(e){e&&n.current&&!e.contains(n.current)&&e.appendChild(n.current)}})})]})};var R={"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 I(e){if("unicode"in e&&"annotation"in e)return"".concat(e.unicode," ").concat(e.annotation)}var z=new P.Database,M=(0,c.forwardRef)((function(e,r){var t=(0,c.useState)(""),n=t[0],o=t[1],i=(0,c.useState)(!1),s=i[0],l=i[1],p=(0,c.useState)(!1),f=p[0],v=p[1],y=(0,c.useState)(!1),j=y[0],w=y[1],O=(0,c.useState)(""),E=O[0],P=O[1],T=(0,c.useState)([]),M=T[0],B=T[1],F=(0,c.useState)(!1),L=F[0],A=F[1],D=(0,c.useRef)(null),W=!n.trim().length&&!e.isSendEnabled,K="".concat(s?"Stop":"Start"," speech to text"),$=f?"primary.main":"primary.light",Q=s?"error.main":$,G=s?"stop_circle":"speech_to_text";function H(e,r){if(void 0===r&&(r=!1),D.current){var t=D.current,i=t.selectionStart,a=t.selectionEnd;if("number"==typeof i&&"number"==typeof a){var c,s=n||"",u=s.substring(0,i),l=s.substring(a);c=r?u.replace(/:(\w+)$/,e)+l:u+e+l,o(c);var d=r?u.replace(/:(\w+)$/,e).length:i+e.length;setTimeout((function(){var e,r;null===(e=D.current)||void 0===e||e.focus(),null===(r=D.current)||void 0===r||r.setSelectionRange(d,d)}),0)}}A(!1)}var J=j?(0,a.jsx)(d(),{size:24}):(0,a.jsx)(k(),{title:K,children:(0,a.jsx)(m(),{onClick:function(){var e=new window.webkitSpeechRecognition,r=navigator.language;e.lang=r,s?(e.stop(),w(!0),l(!1)):(e.start(),P(""),l(!0)),e.onstart=function(){l(!0)},e.onresult=function(e){var r,t=e.results[0][0].transcript;n.length>0?o(n+" "+t):o(t),null===(r=D.current)||void 0===r||r.focus(),l(!1)},e.onerror=function(e){var r=R[e.error];P(r),l(!1)},e.onend=function(){w(!1),l(!1)}},size:"small",sx:{color:Q,"&:hover":{color:"primary.main"}},children:(0,a.jsx)(q,{name:G})})});function U(){var r=(new Date).toISOString(),t={id:(0,N.v4)(),timestamp:r,sender:e.sender,conversationId:e.conversationId,format:"text",data:{text:n}};e.send(t),o(""),P("")}return(0,a.jsxs)(u(),{className:"rustic-base-input",ref:r,children:[(0,a.jsxs)(u(),{className:"rustic-error-and-input-container",children:[(0,a.jsx)(u(),{className:"rustic-error-container",children:(0,a.jsx)(C(),{variant:"caption",color:"error",className:"rustic-error-message",children:E})}),(0,a.jsxs)(u(),{className:"rustic-input-field",sx:{border:"1px solid",borderColor:f?"secondary.main":"action.disabled"},children:[M.length>0&&(0,a.jsx)(x(),{open:L,anchorEl:D.current,onClose:function(){return A(!1)},disableAutoFocus:!0,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},children:(0,a.jsx)(b(),{children:M.map((function(e,r){return"unicode"in e&&(0,a.jsx)(g(),{onClick:function(){return H(e.unicode,!0)},children:I(e)},r)}))})}),(0,a.jsx)(S(),{className:"rustic-text-field",variant:"outlined",value:n,label:e.label,placeholder:e.placeholder,maxRows:e.maxRows,multiline:e.multiline,fullWidth:e.fullWidth,onKeyDown:function(e){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),!W&&U())},onChange:function(r){P("");var t=r.target.value;o(t);var n,i=t.match(/:(\w{2,}):/g),a=t.match(/:(\w{2,})/g);if(i){var c=i[0].replace(/:/g,"");z.getEmojiByShortcode(c).then((function(e){if(e&&"unicode"in e){var r=t.replace(i[0],e.unicode);o(r)}else o(t)})).catch((function(){o(t)})),A(!1)}else a?(n=a[0].replace(":",""),z.getEmojiBySearchQuery(n).then((function(r){r.length?(B(r.slice(0,e.maximumEmojiSearchResults)),A(!0)):(B([]),A(!1))})).catch((function(){B([]),A(!1)}))):A(!1)},onFocus:function(){return v(!0)},onBlur:function(){return v(!1)},inputRef:D,color:"secondary",size:"small",InputProps:{endAdornment:(0,a.jsxs)(h(),{position:"end",className:"rustic-input-adornment",children:[(0,a.jsx)(_,{onEmojiClick:H,buttonColor:$}),e.enableSpeechToText&&J]})},InputLabelProps:{className:f?"":"rustic-input-label",sx:{backgroundColor:"background.paper"}}}),(0,a.jsx)("div",{className:"rustic-input-extras"})]})]}),(0,a.jsxs)(u(),{className:"rustic-input-actions",children:[e.children,(0,a.jsx)(k(),{title:"Send",children:(0,a.jsx)("span",{className:"rustic-send-button",children:(0,a.jsx)(m(),{"aria-label":"send message",onClick:U,disabled:W,color:"secondary",children:(0,a.jsx)(q,{name:"send"})})})})]})]})}));M.defaultProps={multiline:!0,fullWidth:!0,maxRows:6,enableSpeechToText:!1,maximumEmojiSearchResults:5};const B=M;var F=function(){return F=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},F.apply(this,arguments)};const L=function(e){var r=e.ws,t=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]])}return t}(e,["ws"]);return(0,a.jsx)(B,F({},t,{send:function(e){r.send(e)}}))};return i})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,(()=>(()=>{"use strict";var e={
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,(()=>(()=>{"use strict";var e={445:(e,t,o)=>{o.d(t,{default:()=>c});var r=o(732),n=o(909),a=o.n(n),i=o(603),s=o.n(i);o(15);const c=function(e){return(0,r.jsx)(s(),{title:e.label,children:(0,r.jsx)(a(),{color:"inherit","aria-label":e.label,onClick:function(t){t.stopPropagation(),t.preventDefault(),e.onClick(e.message)},className:"rustic-message-actions",children:e.icon})})}},909:e=>{e.exports=require("@mui/material/IconButton")},603:e=>{e.exports=require("@mui/material/Tooltip")},15:e=>{e.exports=require("react")},732:e=>{e.exports=require("react/jsx-runtime")}},t={};function o(r){var n=t[r];if(void 0!==n)return n.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,o),a.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};o.r(r),o.d(r,{default:()=>c});var n=o(732),a=o(15);function i(e){return e.name.replaceAll("_","-"),(0,n.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),children:e.name})}var s=o(445);const c=function(e){var t=(0,a.useState)("Copy text"),o=t[0],r=t[1];return(0,n.jsx)(s.default,{message:e.message,icon:(0,n.jsx)(i,{name:"file_copy"}),onClick:function(e){e.data.text&&navigator.clipboard.writeText(e.data.text).then((function(){r("Copied"),setTimeout((function(){r("Copy text")}),2e3)})).catch((function(){r("Failed to copy")}))},label:o})};return r})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,(()=>(()=>{"use strict";var e={
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,(()=>(()=>{"use strict";var e={909:e=>{e.exports=require("@mui/material/IconButton")},603:e=>{e.exports=require("@mui/material/Tooltip")},15:e=>{e.exports=require("react")},732:e=>{e.exports=require("react/jsx-runtime")}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};r.r(o),r.d(o,{default:()=>s});var n=r(732),i=r(909),a=r.n(i),u=r(603),l=r.n(u);r(15);const s=function(e){return(0,n.jsx)(l(),{title:e.label,children:(0,n.jsx)(a(),{color:"inherit","aria-label":e.label,onClick:function(t){t.stopPropagation(),t.preventDefault(),e.onClick(e.message)},className:"rustic-message-actions",children:e.icon})})};return o})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,(()=>(()=>{"use strict";var e={
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,(()=>(()=>{"use strict";var e={445:(e,t,a)=>{a.d(t,{default:()=>l});var r=a(732),n=a(909),o=a.n(n),s=a(603),i=a.n(s);a(15);const l=function(e){return(0,r.jsx)(i(),{title:e.label,children:(0,r.jsx)(o(),{color:"inherit","aria-label":e.label,onClick:function(t){t.stopPropagation(),t.preventDefault(),e.onClick(e.message)},className:"rustic-message-actions",children:e.icon})})}},909:e=>{e.exports=require("@mui/material/IconButton")},603:e=>{e.exports=require("@mui/material/Tooltip")},15:e=>{e.exports=require("react")},732:e=>{e.exports=require("react/jsx-runtime")}},t={};function a(r){var n=t[r];if(void 0!==n)return n.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,a),o.exports}a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};a.r(r),a.d(r,{default:()=>l});var n=a(732),o=a(15);function s(e){return e.name.replaceAll("_","-"),(0,n.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),children:e.name})}var i=a(445);const l=function(e){var t=(0,o.useState)("Start reading aloud"),a=t[0],r=t[1],l=[e.message.data.title,e.message.data.description,e.message.data.alt,e.message.data.text,e.message.data.transcript].filter(Boolean).join(" "),c=new SpeechSynthesisUtterance(l);return(0,n.jsx)(i.default,{message:e.message,icon:(0,n.jsx)(s,{name:"text_to_speech"}),onClick:function(){window.speechSynthesis.speaking?(window.speechSynthesis.cancel(),r("Start reading aloud")):(c.onend=function(){r("Start reading aloud")},window.speechSynthesis.speak(c),r("Stop reading aloud"))},label:a})};return r})()));
|
|
@@ -38,16 +38,27 @@ code {
|
|
|
38
38
|
align-self: center;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
.rustic-shift-to-right-by-8 {
|
|
42
|
+
margin-right: -8px;
|
|
43
|
+
}
|
|
44
|
+
|
|
41
45
|
.rustic-file-preview {
|
|
42
46
|
position: relative;
|
|
43
47
|
display: flex;
|
|
44
48
|
align-items: center;
|
|
45
|
-
padding: 8px
|
|
49
|
+
padding: 8px 16px;
|
|
46
50
|
justify-content: space-between;
|
|
47
|
-
width: 220px;
|
|
48
51
|
height: 56px;
|
|
49
52
|
}
|
|
50
53
|
|
|
54
|
+
.rustic-fixed-file-preview-width {
|
|
55
|
+
width: 220px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.rustic-flexible-file-preview-width {
|
|
59
|
+
min-width: 220px;
|
|
60
|
+
}
|
|
61
|
+
|
|
51
62
|
.rustic-file-preview-modal {
|
|
52
63
|
width: 90vw;
|
|
53
64
|
height: 90vh;
|