@rustic-ai/ui-components 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/calendar/index.css +14 -1
- package/dist/components/calendar/index.js +1 -1
- package/dist/components/codeSnippet/index.css +14 -1
- package/dist/components/codeSnippet/index.js +1 -1
- package/dist/components/dynamicForm/index.css +14 -1
- package/dist/components/dynamicForm/index.js +1 -1
- package/dist/components/image/index.css +14 -1
- package/dist/components/image/index.js +1 -1
- package/dist/components/input/multimodal/multimodalInput/index.js +1 -1
- package/dist/components/input/textInput/index.js +1 -1
- package/dist/components/map/index.css +14 -1
- package/dist/components/map/index.js +1 -1
- package/dist/components/markdown/index.css +14 -1
- package/dist/components/markdown/index.js +1 -1
- package/dist/components/markdown/markedMarkdown.d.ts.map +1 -1
- package/dist/components/media/audio/index.css +14 -1
- package/dist/components/media/audio/index.js +1 -1
- package/dist/components/media/video/index.css +14 -1
- package/dist/components/media/video/index.js +1 -1
- package/dist/components/multipart/chatCompletion/index.css +14 -1
- package/dist/components/multipart/chatCompletion/index.js +1 -1
- package/dist/components/multipart/multipart/index.css +14 -1
- package/dist/components/multipart/multipart/index.js +1 -1
- package/dist/components/question/index.css +14 -1
- package/dist/components/question/index.js +1 -1
- package/dist/components/table/index.css +14 -1
- package/dist/components/table/index.js +1 -1
- package/dist/components/visualization/mermaidViz/index.css +14 -1
- package/dist/components/visualization/mermaidViz/index.js +1 -1
- package/dist/components/visualization/perspectiveViz/index.css +14 -1
- package/dist/components/visualization/perspectiveViz/index.js +1 -1
- package/dist/components/visualization/plotlyGraph/index.css +14 -1
- package/dist/components/visualization/plotlyGraph/index.js +1 -1
- package/dist/components/visualization/vegaLiteViz/index.css +14 -1
- package/dist/components/visualization/vegaLiteViz/index.js +1 -1
- package/dist/components/weather/index.css +14 -1
- package/dist/components/weather/index.js +1 -1
- package/dist/index.css +14 -1
- package/dist/index.js +1 -1
- package/dist/rusticTheme.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,()=>(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,()=>(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>S});const r=require("react/jsx-runtime"),n=require("@mui/material/Typography");var a=e.n(n);const o=require("@mui/system/Box");var i=e.n(o);const u=require("react"),s=require("react-plotly.js");var c=e.n(s);const l=require("@mui/material/Alert");var p=e.n(l);const d=require("@mui/material/styles"),m=require("dompurify");var f=e.n(m);const y=require("marked");var v,g,x,b;!function(e){e.Running="running",e.Completed="completed",e.Error="error"}(v||(v={})),function(e){e.Append="append",e.Replace="replace"}(g||(g={})),function(e){e.Owner="owner",e.Member="member"}(x||(x={})),function(e){e.Human="human",e.Agent="agent"}(b||(b={}));const h=function(e){var t=(0,d.useTheme)(),n=(0,u.useState)(e.text),o=n[0],i=n[1],s=(0,u.useState)(""),c=s[0],l=s[1];function m(e){return"string"!=typeof e?(l("Some of the incoming text was not correctly formatted. Some data may be missing.")," [MISSING TEXT]"):e}function v(e){return(0,r.jsx)(a(),{component:"div",className:"rustic-markdown",dangerouslySetInnerHTML:{__html:(n=e,o=n.replace(/^[\u200B-\u200F\uFEFF]/,""),i=y.marked.parse(o,{async:!1,breaks:!0,gfm:!0}),f().sanitize(i))},sx:{"& table, & th, & td":{border:"1px solid ".concat(t.palette.divider)}}});var n,o,i}return(0,u.useEffect)(function(){if(e.updatedData&&e.updatedData.length>0){var t=e.text,r=e.updatedData.at(-1);if(e.updatedData.length>1&&(null==r?void 0:r.updateType)===g.Replace)t=m(r.text);else for(var n=0,a=e.updatedData;n<a.length;n++){var o=a[n],u=o.updateType||g.Append,s=m(o.text);u===g.Append?t+=s:u===g.Replace&&(t=s)}i(t)}},[e.text,e.updatedData]),(0,r.jsxs)(r.Fragment,{children:[e.title&&(0,r.jsx)(a(),{variant:"h6",children:e.title}),e.description&&v(e.description),v(o),c&&(0,r.jsx)(p(),{severity:"error",children:c})]})};var j=function(){return j=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},j.apply(this,arguments)};const S=function(e){var t=j(j({},e.plotParams),{className:"rustic-plotly"});return t.config=j(j({},t.config),{displaylogo:!1,responsive:!0,editable:!1}),(0,r.jsxs)(i(),{className:"rustic-plotly-container",children:[e.title&&(0,r.jsx)(a(),{variant:"h6",children:e.title}),e.description&&(0,r.jsx)(h,{text:e.description}),(0,r.jsx)(c(),j({},t))]})};return t})());
|
|
@@ -17,11 +17,24 @@
|
|
|
17
17
|
visibility: visible;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
.rustic-markdown p {
|
|
20
|
+
.rustic-markdown p:first-child {
|
|
21
21
|
margin-block-start: 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.rustic-markdown p:last-child {
|
|
22
25
|
margin-block-end: 0;
|
|
23
26
|
}
|
|
24
27
|
|
|
28
|
+
.rustic-markdown table {
|
|
29
|
+
border-collapse: collapse;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.rustic-markdown th,
|
|
33
|
+
.rustic-markdown td {
|
|
34
|
+
padding: 8px;
|
|
35
|
+
text-align: left;
|
|
36
|
+
}
|
|
37
|
+
|
|
25
38
|
.rustic-popover-menu ul {
|
|
26
39
|
padding: 0;
|
|
27
40
|
min-width: 100px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,()=>(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>Z});const r=require("react/jsx-runtime"),n=require("@mui/material/Typography");var a=e.n(n);const o=require("@mui/system/Box");var i=e.n(o);const c=require("@mui/system/Stack");var u=e.n(c);const s=require("@mui/system/useTheme");var l=e.n(s);const d=require("axios");var p=e.n(d);const f=require("react"),m=require("react-dom/server"),v=require("vega"),h=require("vega-embed");var y=e.n(h);const b=require("@mui/material/Alert");var g=e.n(b);const x=require("dompurify");var j=e.n(x);const w=require("marked");var O,S,q,k;!function(e){e.Running="running",e.Completed="completed",e.Error="error"}(O||(O={})),function(e){e.Append="append",e.Replace="replace"}(S||(S={})),function(e){e.Owner="owner",e.Member="member"}(q||(q={})),function(e){e.Human="human",e.Agent="agent"}(k||(k={}));const T=function(e){var t=(0,f.useState)(e.text),n=t[0],o=t[1],i=(0,f.useState)(""),c=i[0],u=i[1];function s(e){return"string"!=typeof e?(u("Some of the incoming text was not correctly formatted. Some data may be missing.")," [MISSING TEXT]"):e}function l(e){return(0,r.jsx)(a(),{component:"div",className:"rustic-markdown",dangerouslySetInnerHTML:{__html:(t=e,n=t.replace(/^[\u200B-\u200F\uFEFF]/,""),o=w.marked.parse(n,{async:!1,breaks:!0,gfm:!0}),j().sanitize(o))}});var t,n,o}return(0,f.useEffect)(function(){if(e.updatedData&&e.updatedData.length>0){var t=e.text,r=e.updatedData.at(-1);if(e.updatedData.length>1&&(null==r?void 0:r.updateType)===S.Replace)t=s(r.text);else for(var n=0,a=e.updatedData;n<a.length;n++){var i=a[n],c=i.updateType||S.Append,u=s(i.text);c===S.Append?t+=u:c===S.Replace&&(t=u)}o(t)}},[e.text,e.updatedData]),(0,r.jsxs)(r.Fragment,{children:[e.title&&(0,r.jsx)(a(),{variant:"h6",children:e.title}),e.description&&l(e.description),l(n),c&&(0,r.jsx)(g(),{severity:"error",children:c})]})},F=require("@mui/material"),I=require("@mui/material/Button");var A=e.n(I);const R=require("@mui/material/Drawer");var D=e.n(R);const N=require("@mui/material/IconButton");var P=e.n(N);const E=require("@mui/material/ListItemText");var M=e.n(E);const C=require("@mui/material/Menu");var _=e.n(C);const L=require("@mui/material/MenuItem");var z=e.n(L);const B=require("@mui/material/styles"),G=require("@mui/material/Tooltip");var H=e.n(G);const W=require("@mui/system");var J=function(){return J=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},J.apply(this,arguments)};function Q(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,r.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:J({},t),children:e.name})}var U=function(){return U=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},U.apply(this,arguments)};function V(e){var t=(0,f.useState)(!1),n=t[0],o=t[1],i=(0,f.useRef)(null),c=(0,B.useTheme)(),u=(0,F.useMediaQuery)(c.breakpoints.down("md")),s=u?D():_(),l={borderRadius:"".concat(c.shape.borderRadius,"px"),border:"1px solid ".concat(c.palette.divider)};function d(e){return(0,r.jsxs)(r.Fragment,{children:[e.startDecorator&&(0,r.jsx)(W.Box,{sx:{color:"primary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-start-icon",children:e.startDecorator}),(0,r.jsx)(M(),{children:(0,r.jsx)(a(),{variant:"body2",children:e.label})}),e.endDecorator&&(0,r.jsx)(W.Box,{sx:{color:"secondary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-end-icon",children:e.endDecorator})]})}u&&(l=U(U({},l),{borderRadius:"".concat(c.shape.borderRadius,"px ").concat(c.shape.borderRadius,"px 0 0"),borderBottom:0}));var p=e.menuItems.map(function(e){return e.href?(0,r.jsx)(z(),{component:"a",onClick:function(){return o(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:d(e)},e.label):(0,r.jsx)(z(),{onClick:function(t){e.onClick&&e.onClick(t),o(!1)},disabled:!e.onClick,children:d(e)},e.label)});var m,v,h=u?{}:{anchorEl:i.current};return(0,r.jsxs)(r.Fragment,{children:[(m={onClick:function(e){e.stopPropagation(),o(!0)},"aria-label":e.ariaLabel,ref:i,className:"rustic-popover-menu-button"},v=(0,r.jsx)(Q,{name:"more_vert"}),e.buttonText?(0,r.jsx)(A(),U({},m,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,r.jsx)(H(),{title:e.ariaLabel,children:(0,r.jsx)(P(),U({},m,{children:e.icon?e.icon:v}))})),(0,r.jsx)(s,U({open:n,onClose:function(){return o(!1)}},h,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":U(U({},l),{backgroundImage:"none",boxShadow:c.shadows[2]})},children:p}))]})}var X=function(){return X=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},X.apply(this,arguments)},K=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,o=t.length;a<o;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))},Y="source_0";const Z=function(e){var t=e.theme,n=void 0===t?{dark:"dark"}:t,o=e.refreshIntervalInMs,c=void 0===o?0:o,s=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}(e,["theme","refreshIntervalInMs"]),d=(0,f.useRef)(null),h=(0,f.useRef)(null),b=(0,f.useState)(!1),g=b[0],x=b[1],j=l()(),w="dark"===j.palette.mode,O=j.typography.fontFamily,q=function(e,t){var r={method:t.method||"GET",headers:t.headers,responseType:"text",data:t.body};return(s.getAuthHeaders?s.getAuthHeaders().then(function(e){return r.headers=X(X({},r.headers),e.headers),r}):Promise.resolve(r)).then(function(t){return p()(e,t)}).then(function(e){return e.data})};function k(){var e=v.loader();return s.getAuthHeaders&&(e.http=q),e}var F={backgroundColor:j.palette.primary.main,color:j.palette.background.paper,borderRadius:j.shape.borderRadius+"px",padding:"4px 8px",fontSize:j.typography.caption.fontSize,fontFamily:O,fontWeight:j.typography.caption.fontWeight},I={formatTooltip:function(e,t){return(0,m.renderToStaticMarkup)((0,r.jsx)("div",{role:"tooltip",className:"rustic-vega-lite-tooltip-content",style:F,children:Object.entries(e).map(function(e){var n=e[0],a=e[1];return(0,r.jsxs)("div",{children:[(0,r.jsxs)("strong",{children:[t(n),":"]})," ",t(a)]},n)})}))},disableDefaultStyle:!0,id:"rustic-vega-lite-tooltip"},A=[{label:"Save as SVG"},{label:"Save as PNG"}];function R(){var e,t;if(d.current&&s.spec){var r=X(X({config:{font:O}},s.options),{theme:w?n.dark:n.light,tooltip:I,actions:!1,loader:k()});(null===(t=null===(e=s.options)||void 0===e?void 0:e.config)||void 0===t?void 0:t.font)||(r.config.font=O);var a=X(X({},s.spec),{name:Y});delete a.title,y()(d.current,a,r).then(function(e){var t=e.embedOptions,r=e.embedOptions.downloadFileName||"visualization";["svg","png"].map(function(n,a){var o="object"==typeof t.scaleFactor?t.scaleFactor[n]:t.scaleFactor;e.view.toImageURL(n,o).then(function(e){A[a].href=e,A[a].downloadFileName="".concat(r,".").concat(n)})}),h.current=e.view,x(!1),c>0&&function(){var e=this;if(h.current&&s.spec){D.current&&(clearInterval(D.current),D.current=null);var t=s.spec.data;if(t&&"object"==typeof t&&"url"in t&&t.url){var r=setInterval(function(){return r=e,n=void 0,o=function(){var e,r,n;return function(e,t){var r,n,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=c(0),i.throw=c(1),i.return=c(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(u){return function(c){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(r=1,n&&(a=2&c[0]?n.return:c[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,c[1])).done)return a;switch(n=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,n=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==c[0]&&2!==c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],n=0}finally{r=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,u])}}}(this,function(a){switch(a.label){case 0:if(!h.current)return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,k().load(t.url)];case 2:return e=a.sent(),r=JSON.parse(e),n=v.changeset().remove(function(){return!0}).insert(r),h.current.change(Y,n).run(),[3,4];case 3:return a.sent(),x(!0),[3,4];case 4:return[2]}})},new((a=void 0)||(a=Promise))(function(e,t){function i(e){try{u(o.next(e))}catch(e){t(e)}}function c(e){try{u(o.throw(e))}catch(e){t(e)}}function u(t){var r;t.done?e(t.value):(r=t.value,r instanceof a?r:new a(function(e){e(r)})).then(i,c)}u((o=o.apply(r,n||[])).next())});var r,n,a,o},c);D.current=r}}}()}).catch(function(){x(!0)})}}(0,f.useEffect)(function(){if(d.current){var e=null;return(e=new ResizeObserver(function(e){e.some(function(e){return e.contentRect.width>0})&&requestAnimationFrame(function(){R()})})).observe(d.current),requestAnimationFrame(function(){R()}),window.addEventListener("resize",t),function(){window.removeEventListener("resize",t),null==e||e.disconnect()}}function t(){requestAnimationFrame(function(){R()})}},[s.spec,w]),(0,f.useEffect)(function(){var e=setTimeout(function(){if(s.updatedData&&s.updatedData.length>0&&h.current)try{var e=function(e){var t,r=[],n=!1;if(e){var a=e.at(-1);if((null==a?void 0:a.updateType)===S.Replace){if((null===(t=a.spec)||void 0===t?void 0:t.data)&&"values"in a.spec.data){var o=a.spec.data.values;Array.isArray(o)&&(n=!0,r=K([],o,!0))}}else e.forEach(function(e){var t;if((null===(t=e.spec)||void 0===t?void 0:t.data)&&"values"in e.spec.data){var a=e.spec.data.values;Array.isArray(a)&&(e.updateType===S.Append?r.push.apply(r,a):e.updateType===S.Replace&&(n=!0,r=K([],a,!0)))}})}return v.changeset().remove(function(){return n}).insert(r)}(s.updatedData);h.current.change(Y,e).run()}catch(e){console.error("Failed to update streaming data:",e)}},1);return function(){return clearTimeout(e)}},[s.updatedData]);var D=(0,f.useRef)(null);return(0,f.useEffect)(function(){return function(){D.current&&clearInterval(D.current)}},[]),g?(0,r.jsx)(a(),{variant:"body2",children:"Failed to load the chart."}):(0,r.jsxs)(u(),{direction:"column",className:"rustic-vega-lite-container",children:[(0,r.jsx)(i(),{justifyContent:"end",display:"flex",children:(0,r.jsx)(V,{menuItems:A,ariaLabel:"Download options"})}),s.title&&(0,r.jsx)(a(),{variant:"h6",children:s.title}),s.description&&(0,r.jsx)(T,{text:s.description}),(0,r.jsxs)(i(),{textAlign:"center",mt:1,children:["string"==typeof s.spec.title&&(0,r.jsx)(a(),{variant:"subtitle2",children:s.spec.title}),s.spec.description&&(0,r.jsx)(a(),{variant:"caption",children:s.spec.description})]}),(0,r.jsx)("div",{ref:d,className:"rustic-vega-lite"})]})};return t})());
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,()=>(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>Z});const r=require("react/jsx-runtime"),n=require("@mui/material/Typography");var a=e.n(n);const o=require("@mui/system/Box");var i=e.n(o);const c=require("@mui/system/Stack");var u=e.n(c);const s=require("@mui/system/useTheme");var l=e.n(s);const d=require("axios");var p=e.n(d);const f=require("react"),m=require("react-dom/server"),v=require("vega"),h=require("vega-embed");var y=e.n(h);const b=require("@mui/material/Alert");var x=e.n(b);const g=require("@mui/material/styles"),j=require("dompurify");var w=e.n(j);const O=require("marked");var S,q,T,k;!function(e){e.Running="running",e.Completed="completed",e.Error="error"}(S||(S={})),function(e){e.Append="append",e.Replace="replace"}(q||(q={})),function(e){e.Owner="owner",e.Member="member"}(T||(T={})),function(e){e.Human="human",e.Agent="agent"}(k||(k={}));const F=function(e){var t=(0,g.useTheme)(),n=(0,f.useState)(e.text),o=n[0],i=n[1],c=(0,f.useState)(""),u=c[0],s=c[1];function l(e){return"string"!=typeof e?(s("Some of the incoming text was not correctly formatted. Some data may be missing.")," [MISSING TEXT]"):e}function d(e){return(0,r.jsx)(a(),{component:"div",className:"rustic-markdown",dangerouslySetInnerHTML:{__html:(n=e,o=n.replace(/^[\u200B-\u200F\uFEFF]/,""),i=O.marked.parse(o,{async:!1,breaks:!0,gfm:!0}),w().sanitize(i))},sx:{"& table, & th, & td":{border:"1px solid ".concat(t.palette.divider)}}});var n,o,i}return(0,f.useEffect)(function(){if(e.updatedData&&e.updatedData.length>0){var t=e.text,r=e.updatedData.at(-1);if(e.updatedData.length>1&&(null==r?void 0:r.updateType)===q.Replace)t=l(r.text);else for(var n=0,a=e.updatedData;n<a.length;n++){var o=a[n],c=o.updateType||q.Append,u=l(o.text);c===q.Append?t+=u:c===q.Replace&&(t=u)}i(t)}},[e.text,e.updatedData]),(0,r.jsxs)(r.Fragment,{children:[e.title&&(0,r.jsx)(a(),{variant:"h6",children:e.title}),e.description&&d(e.description),d(o),u&&(0,r.jsx)(x(),{severity:"error",children:u})]})},I=require("@mui/material"),A=require("@mui/material/Button");var R=e.n(A);const D=require("@mui/material/Drawer");var N=e.n(D);const P=require("@mui/material/IconButton");var E=e.n(P);const M=require("@mui/material/ListItemText");var C=e.n(M);const _=require("@mui/material/Menu");var L=e.n(_);const z=require("@mui/material/MenuItem");var B=e.n(z);const G=require("@mui/material/Tooltip");var H=e.n(G);const W=require("@mui/system");var J=function(){return J=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},J.apply(this,arguments)};function Q(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,r.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:J({},t),children:e.name})}var U=function(){return U=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},U.apply(this,arguments)};function V(e){var t=(0,f.useState)(!1),n=t[0],o=t[1],i=(0,f.useRef)(null),c=(0,g.useTheme)(),u=(0,I.useMediaQuery)(c.breakpoints.down("md")),s=u?N():L(),l={borderRadius:"".concat(c.shape.borderRadius,"px"),border:"1px solid ".concat(c.palette.divider)};function d(e){return(0,r.jsxs)(r.Fragment,{children:[e.startDecorator&&(0,r.jsx)(W.Box,{sx:{color:"primary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-start-icon",children:e.startDecorator}),(0,r.jsx)(C(),{children:(0,r.jsx)(a(),{variant:"body2",children:e.label})}),e.endDecorator&&(0,r.jsx)(W.Box,{sx:{color:"secondary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-end-icon",children:e.endDecorator})]})}u&&(l=U(U({},l),{borderRadius:"".concat(c.shape.borderRadius,"px ").concat(c.shape.borderRadius,"px 0 0"),borderBottom:0}));var p=e.menuItems.map(function(e){return e.href?(0,r.jsx)(B(),{component:"a",onClick:function(){return o(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:d(e)},e.label):(0,r.jsx)(B(),{onClick:function(t){e.onClick&&e.onClick(t),o(!1)},disabled:!e.onClick,children:d(e)},e.label)});var m,v,h=u?{}:{anchorEl:i.current};return(0,r.jsxs)(r.Fragment,{children:[(m={onClick:function(e){e.stopPropagation(),o(!0)},"aria-label":e.ariaLabel,ref:i,className:"rustic-popover-menu-button"},v=(0,r.jsx)(Q,{name:"more_vert"}),e.buttonText?(0,r.jsx)(R(),U({},m,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,r.jsx)(H(),{title:e.ariaLabel,children:(0,r.jsx)(E(),U({},m,{children:e.icon?e.icon:v}))})),(0,r.jsx)(s,U({open:n,onClose:function(){return o(!1)}},h,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":U(U({},l),{backgroundImage:"none",boxShadow:c.shadows[2]})},children:p}))]})}var X=function(){return X=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},X.apply(this,arguments)},K=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,o=t.length;a<o;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))},Y="source_0";const Z=function(e){var t=e.theme,n=void 0===t?{dark:"dark"}:t,o=e.refreshIntervalInMs,c=void 0===o?0:o,s=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}(e,["theme","refreshIntervalInMs"]),d=(0,f.useRef)(null),h=(0,f.useRef)(null),b=(0,f.useState)(!1),x=b[0],g=b[1],j=l()(),w="dark"===j.palette.mode,O=j.typography.fontFamily,S=function(e,t){var r={method:t.method||"GET",headers:t.headers,responseType:"text",data:t.body};return(s.getAuthHeaders?s.getAuthHeaders().then(function(e){return r.headers=X(X({},r.headers),e.headers),r}):Promise.resolve(r)).then(function(t){return p()(e,t)}).then(function(e){return e.data})};function T(){var e=v.loader();return s.getAuthHeaders&&(e.http=S),e}var k={backgroundColor:j.palette.primary.main,color:j.palette.background.paper,borderRadius:j.shape.borderRadius+"px",padding:"4px 8px",fontSize:j.typography.caption.fontSize,fontFamily:O,fontWeight:j.typography.caption.fontWeight},I={formatTooltip:function(e,t){return(0,m.renderToStaticMarkup)((0,r.jsx)("div",{role:"tooltip",className:"rustic-vega-lite-tooltip-content",style:k,children:Object.entries(e).map(function(e){var n=e[0],a=e[1];return(0,r.jsxs)("div",{children:[(0,r.jsxs)("strong",{children:[t(n),":"]})," ",t(a)]},n)})}))},disableDefaultStyle:!0,id:"rustic-vega-lite-tooltip"},A=[{label:"Save as SVG"},{label:"Save as PNG"}];function R(){var e,t;if(d.current&&s.spec){var r=X(X({config:{font:O}},s.options),{theme:w?n.dark:n.light,tooltip:I,actions:!1,loader:T()});(null===(t=null===(e=s.options)||void 0===e?void 0:e.config)||void 0===t?void 0:t.font)||(r.config.font=O);var a=X(X({},s.spec),{name:Y});delete a.title,y()(d.current,a,r).then(function(e){var t=e.embedOptions,r=e.embedOptions.downloadFileName||"visualization";["svg","png"].map(function(n,a){var o="object"==typeof t.scaleFactor?t.scaleFactor[n]:t.scaleFactor;e.view.toImageURL(n,o).then(function(e){A[a].href=e,A[a].downloadFileName="".concat(r,".").concat(n)})}),h.current=e.view,g(!1),c>0&&function(){var e=this;if(h.current&&s.spec){D.current&&(clearInterval(D.current),D.current=null);var t=s.spec.data;if(t&&"object"==typeof t&&"url"in t&&t.url){var r=setInterval(function(){return r=e,n=void 0,o=function(){var e,r,n;return function(e,t){var r,n,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=c(0),i.throw=c(1),i.return=c(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(u){return function(c){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(r=1,n&&(a=2&c[0]?n.return:c[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,c[1])).done)return a;switch(n=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,n=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==c[0]&&2!==c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],n=0}finally{r=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,u])}}}(this,function(a){switch(a.label){case 0:if(!h.current)return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,T().load(t.url)];case 2:return e=a.sent(),r=JSON.parse(e),n=v.changeset().remove(function(){return!0}).insert(r),h.current.change(Y,n).run(),[3,4];case 3:return a.sent(),g(!0),[3,4];case 4:return[2]}})},new((a=void 0)||(a=Promise))(function(e,t){function i(e){try{u(o.next(e))}catch(e){t(e)}}function c(e){try{u(o.throw(e))}catch(e){t(e)}}function u(t){var r;t.done?e(t.value):(r=t.value,r instanceof a?r:new a(function(e){e(r)})).then(i,c)}u((o=o.apply(r,n||[])).next())});var r,n,a,o},c);D.current=r}}}()}).catch(function(){g(!0)})}}(0,f.useEffect)(function(){if(d.current){var e=null;return(e=new ResizeObserver(function(e){e.some(function(e){return e.contentRect.width>0})&&requestAnimationFrame(function(){R()})})).observe(d.current),requestAnimationFrame(function(){R()}),window.addEventListener("resize",t),function(){window.removeEventListener("resize",t),null==e||e.disconnect()}}function t(){requestAnimationFrame(function(){R()})}},[s.spec,w]),(0,f.useEffect)(function(){var e=setTimeout(function(){if(s.updatedData&&s.updatedData.length>0&&h.current)try{var e=function(e){var t,r=[],n=!1;if(e){var a=e.at(-1);if((null==a?void 0:a.updateType)===q.Replace){if((null===(t=a.spec)||void 0===t?void 0:t.data)&&"values"in a.spec.data){var o=a.spec.data.values;Array.isArray(o)&&(n=!0,r=K([],o,!0))}}else e.forEach(function(e){var t;if((null===(t=e.spec)||void 0===t?void 0:t.data)&&"values"in e.spec.data){var a=e.spec.data.values;Array.isArray(a)&&(e.updateType===q.Append?r.push.apply(r,a):e.updateType===q.Replace&&(n=!0,r=K([],a,!0)))}})}return v.changeset().remove(function(){return n}).insert(r)}(s.updatedData);h.current.change(Y,e).run()}catch(e){console.error("Failed to update streaming data:",e)}},1);return function(){return clearTimeout(e)}},[s.updatedData]);var D=(0,f.useRef)(null);return(0,f.useEffect)(function(){return function(){D.current&&clearInterval(D.current)}},[]),x?(0,r.jsx)(a(),{variant:"body2",children:"Failed to load the chart."}):(0,r.jsxs)(u(),{direction:"column",className:"rustic-vega-lite-container",children:[(0,r.jsx)(i(),{justifyContent:"end",display:"flex",children:(0,r.jsx)(V,{menuItems:A,ariaLabel:"Download options"})}),s.title&&(0,r.jsx)(a(),{variant:"h6",children:s.title}),s.description&&(0,r.jsx)(F,{text:s.description}),(0,r.jsxs)(i(),{textAlign:"center",mt:1,children:["string"==typeof s.spec.title&&(0,r.jsx)(a(),{variant:"subtitle2",children:s.spec.title}),s.spec.description&&(0,r.jsx)(a(),{variant:"caption",children:s.spec.description})]}),(0,r.jsx)("div",{ref:d,className:"rustic-vega-lite"})]})};return t})());
|
|
@@ -53,11 +53,24 @@ span.rustic-icon-large {
|
|
|
53
53
|
font-size: 32px;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
.rustic-markdown p {
|
|
56
|
+
.rustic-markdown p:first-child {
|
|
57
57
|
margin-block-start: 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.rustic-markdown p:last-child {
|
|
58
61
|
margin-block-end: 0;
|
|
59
62
|
}
|
|
60
63
|
|
|
64
|
+
.rustic-markdown table {
|
|
65
|
+
border-collapse: collapse;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.rustic-markdown th,
|
|
69
|
+
.rustic-markdown td {
|
|
70
|
+
padding: 8px;
|
|
71
|
+
text-align: left;
|
|
72
|
+
}
|
|
73
|
+
|
|
61
74
|
.rustic-popover-menu ul {
|
|
62
75
|
padding: 0;
|
|
63
76
|
min-width: 100px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["@rustic-ai/ui-components"]=r():e["@rustic-ai/ui-components"]=r()}(global,()=>(()=>{"use strict";var e={n:r=>{var t=r&&r.__esModule?()=>r.default:()=>r;return e.d(t,{a:t}),t},d:(r,t)=>{for(var n in t)e.o(t,n)&&!e.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:t[n]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};e.r(r),e.d(r,{MessageProcessStatus:()=>
|
|
1
|
+
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["@rustic-ai/ui-components"]=r():e["@rustic-ai/ui-components"]=r()}(global,()=>(()=>{"use strict";var e={n:r=>{var t=r&&r.__esModule?()=>r.default:()=>r;return e.d(t,{a:t}),t},d:(r,t)=>{for(var n in t)e.o(t,n)&&!e.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:t[n]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};e.r(r),e.d(r,{MessageProcessStatus:()=>w,ParticipantRole:()=>S,ParticipantType:()=>N,UpdateType:()=>T,default:()=>Y});const t=require("react/jsx-runtime"),n=require("@mui/material/Box");var a=e.n(n);const i=require("@mui/material/Card");var o=e.n(i);const c=require("@mui/material/Stack");var s=e.n(c);const u=require("@mui/material/Typography");var l=e.n(u);const d=require("react");var m;function p(e){var r=["Sun","Mon","Tues","Wed","Thurs","Fri","Sat"][new Date(1e3*e).getDay()];return{shortName:r,fullName:{Sun:"Sunday",Mon:"Monday",Tues:"Tuesday",Wed:"Wednesday",Thurs:"Thursday",Fri:"Friday",Sat:"Saturday"}[r]}}!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(m||(m={}));var h=function(){return h=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var a in r=arguments[t])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},h.apply(this,arguments)};function x(e){e.name.replaceAll("_","-");var r={};return e.color&&(r={color:e.color}),(0,t.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:h({},r),children:e.name})}const v=require("@mui/material/Alert");var f=e.n(v);const y=require("@mui/material/styles"),b=require("dompurify");var j=e.n(b);const g=require("marked");var w,T,S,N;!function(e){e.Running="running",e.Completed="completed",e.Error="error"}(w||(w={})),function(e){e.Append="append",e.Replace="replace"}(T||(T={})),function(e){e.Owner="owner",e.Member="member"}(S||(S={})),function(e){e.Human="human",e.Agent="agent"}(N||(N={}));const D=function(e){var r=(0,y.useTheme)(),n=(0,d.useState)(e.text),a=n[0],i=n[1],o=(0,d.useState)(""),c=o[0],s=o[1];function u(e){return"string"!=typeof e?(s("Some of the incoming text was not correctly formatted. Some data may be missing.")," [MISSING TEXT]"):e}function m(e){return(0,t.jsx)(l(),{component:"div",className:"rustic-markdown",dangerouslySetInnerHTML:{__html:(n=e,a=n.replace(/^[\u200B-\u200F\uFEFF]/,""),i=g.marked.parse(a,{async:!1,breaks:!0,gfm:!0}),j().sanitize(i))},sx:{"& table, & th, & td":{border:"1px solid ".concat(r.palette.divider)}}});var n,a,i}return(0,d.useEffect)(function(){if(e.updatedData&&e.updatedData.length>0){var r=e.text,t=e.updatedData.at(-1);if(e.updatedData.length>1&&(null==t?void 0:t.updateType)===T.Replace)r=u(t.text);else for(var n=0,a=e.updatedData;n<a.length;n++){var o=a[n],c=o.updateType||T.Append,s=u(o.text);c===T.Append?r+=s:c===T.Replace&&(r=s)}i(r)}},[e.text,e.updatedData]),(0,t.jsxs)(t.Fragment,{children:[e.title&&(0,t.jsx)(l(),{variant:"h6",children:e.title}),e.description&&m(e.description),m(a),c&&(0,t.jsx)(f(),{severity:"error",children:c})]})},q=require("@mui/material"),M=require("@mui/material/Button");var I=e.n(M);const O=require("@mui/material/Drawer");var F=e.n(O);const k=require("@mui/material/IconButton");var C=e.n(k);const P=require("@mui/material/ListItemText");var R=e.n(P);const _=require("@mui/material/Menu");var A=e.n(_);const H=require("@mui/material/MenuItem");var B=e.n(H);const E=require("@mui/material/Tooltip");var L=e.n(E);const W=require("@mui/system");var U=function(){return U=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var a in r=arguments[t])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},U.apply(this,arguments)};function G(e){var r=(0,d.useState)(!1),n=r[0],a=r[1],i=(0,d.useRef)(null),o=(0,y.useTheme)(),c=(0,q.useMediaQuery)(o.breakpoints.down("md")),s=c?F():A(),u={borderRadius:"".concat(o.shape.borderRadius,"px"),border:"1px solid ".concat(o.palette.divider)};function m(e){return(0,t.jsxs)(t.Fragment,{children:[e.startDecorator&&(0,t.jsx)(W.Box,{sx:{color:"primary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-start-icon",children:e.startDecorator}),(0,t.jsx)(R(),{children:(0,t.jsx)(l(),{variant:"body2",children:e.label})}),e.endDecorator&&(0,t.jsx)(W.Box,{sx:{color:"secondary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-end-icon",children:e.endDecorator})]})}c&&(u=U(U({},u),{borderRadius:"".concat(o.shape.borderRadius,"px ").concat(o.shape.borderRadius,"px 0 0"),borderBottom:0}));var p=e.menuItems.map(function(e){return e.href?(0,t.jsx)(B(),{component:"a",onClick:function(){return a(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:m(e)},e.label):(0,t.jsx)(B(),{onClick:function(r){e.onClick&&e.onClick(r),a(!1)},disabled:!e.onClick,children:m(e)},e.label)});var h,v,f=c?{}:{anchorEl:i.current};return(0,t.jsxs)(t.Fragment,{children:[(h={onClick:function(e){e.stopPropagation(),a(!0)},"aria-label":e.ariaLabel,ref:i,className:"rustic-popover-menu-button"},v=(0,t.jsx)(x,{name:"more_vert"}),e.buttonText?(0,t.jsx)(I(),U({},h,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,t.jsx)(L(),{title:e.ariaLabel,children:(0,t.jsx)(C(),U({},h,{children:e.icon?e.icon:v}))})),(0,t.jsx)(s,U({open:n,onClose:function(){return a(!1)}},f,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":U(U({},u),{backgroundImage:"none",boxShadow:o.shadows[2]})},children:p}))]})}const Y=function(e){var r=(0,d.useState)(e.units),n=r[0],i=r[1];function c(r){return"metric"===e.units&&"imperial"===n?Math.round(1.8*r+32):"imperial"===e.units&&"metric"===n?Math.round(r*(5/9)-32):Math.round(r)}var u=new Date(1e3*e.weather[0].timestamp),m=p(e.weather[0].timestamp).shortName,h=u.getDate(),v=u.getFullYear().toString().slice(2),f="".concat(m," ").concat(h,"/").concat(v," TODAY"),y="HIGH: ".concat(c(e.weather[0].temp.high)," / LOW: ").concat(c(e.weather[0].temp.high)),b=e.weather.map(function(e,r){if(0!==r)return(0,t.jsxs)(o(),{variant:"outlined",className:"rustic-daily-weather-card",children:[(0,t.jsx)(l(),{variant:"h5",component:"span",color:"text.secondary","aria-label":p(e.timestamp).fullName,children:p(e.timestamp).shortName}),(0,t.jsx)("img",{src:e.weatherIcon.icon,alt:e.weatherIcon.description}),(0,t.jsxs)(l(),{variant:"body2",color:"text.secondary",children:["High: ",c(e.temp.high),"°"]}),(0,t.jsxs)(l(),{variant:"body2",color:"text.secondary",children:["Low: ",c(e.temp.low),"°"]})]},r)});return(0,t.jsxs)(o(),{variant:"outlined",className:"rustic-weather",children:[e.title&&(0,t.jsx)(l(),{variant:"h6",children:e.title}),e.description&&(0,t.jsx)(D,{text:e.description}),(0,t.jsx)(G,{ariaLabel:"Temperature units",menuItems:[{label:"Celsius",endDecorator:"°C",onClick:function(){return i("metric")}},{label:"Fahrenheit",endDecorator:"°F",onClick:function(){return i("imperial")}}]}),(0,t.jsxs)(s(),{alignItems:"center",children:[(0,t.jsx)(l(),{variant:"h4",component:"span",children:e.location}),(0,t.jsxs)(s(),{direction:"row",alignItems:"center",spacing:1,className:"rustic-current-weather-description",children:[(0,t.jsx)("img",{src:e.weather[0].weatherIcon.icon,alt:""}),(0,t.jsx)(l(),{variant:"body2",children:e.weather[0].weatherIcon.description})]}),e.weather[0].temp.current&&(0,t.jsxs)(l(),{variant:"h1",component:"span",className:"rustic-current-temp",children:[c(e.weather[0].temp.current),"°",function(e){switch(e){case"imperial":return"F";case"metric":return"C"}}(n)]}),(0,t.jsxs)(s(),{direction:"row",spacing:2,children:[(0,t.jsx)(l(),{variant:"overline",children:f}),(0,t.jsx)(l(),{variant:"overline",children:y})]})]}),(0,t.jsx)(a(),{className:"rustic-daily-weather-container",children:b}),e.weatherProvider&&(0,t.jsxs)(s(),{alignItems:"center",direction:"row",spacing:1,alignSelf:"center",className:"rustic-weather-attribution",children:[(0,t.jsx)(x,{name:"cloud"}),(0,t.jsx)(l(),{variant:"body2",children:"Weather data provided by ".concat(e.weatherProvider)})]})]})};return r})());
|
package/dist/index.css
CHANGED
|
@@ -33,11 +33,24 @@
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
.rustic-markdown p {
|
|
36
|
+
.rustic-markdown p:first-child {
|
|
37
37
|
margin-block-start: 0;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.rustic-markdown p:last-child {
|
|
38
41
|
margin-block-end: 0;
|
|
39
42
|
}
|
|
40
43
|
|
|
44
|
+
.rustic-markdown table {
|
|
45
|
+
border-collapse: collapse;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.rustic-markdown th,
|
|
49
|
+
.rustic-markdown td {
|
|
50
|
+
padding: 8px;
|
|
51
|
+
text-align: left;
|
|
52
|
+
}
|
|
53
|
+
|
|
41
54
|
.rustic-code-snippet {
|
|
42
55
|
border-radius: 16px 16px 4px 4px;
|
|
43
56
|
max-width: calc(100vw - 100px);
|