@brainfish-ai/components 0.17.1 → 0.17.2
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/ui/textarea.d.ts +4 -1
- package/dist/esm/chunks/{ChatSearch.B4QTqo-0.js → ChatSearch.D_vAxj0b.js} +2 -2
- package/dist/esm/chunks/{ChatSearch.B4QTqo-0.js.map → ChatSearch.D_vAxj0b.js.map} +1 -1
- package/dist/esm/chunks/{FormattedMessage.BcAkzCZt.js → FormattedMessage.C2OwhDXi.js} +24 -3
- package/dist/esm/chunks/FormattedMessage.C2OwhDXi.js.map +1 -0
- package/dist/esm/components/chat-search.js +1 -1
- package/dist/esm/components/convos.js +1 -1
- package/dist/esm/components/markdown.js +1 -1
- package/dist/esm/components/ui/textarea.js +26 -12
- package/dist/esm/components/ui/textarea.js.map +1 -1
- package/dist/esm/index.css +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/index.d.ts +5 -1
- package/dist/stats.html +1 -1
- package/dist/textarea.d.ts +5 -1
- package/package.json +2 -1
- package/dist/esm/chunks/FormattedMessage.BcAkzCZt.js.map +0 -1
|
@@ -39424,7 +39424,7 @@ const ZoomableImage = ({ src, alt }) => {
|
|
|
39424
39424
|
if (!src || imageError) {
|
|
39425
39425
|
return null;
|
|
39426
39426
|
}
|
|
39427
|
-
return /* @__PURE__ */ React.createElement("figure", { className: "relative
|
|
39427
|
+
return /* @__PURE__ */ React.createElement("figure", { className: "relative block my-4 px-4 w-full sm:w-auto" }, /* @__PURE__ */ React.createElement("div", { className: "flex items-center justify-center min-h-[100px]" }, /* @__PURE__ */ React.createElement(
|
|
39428
39428
|
"button",
|
|
39429
39429
|
{
|
|
39430
39430
|
type: "button",
|
|
@@ -39486,6 +39486,27 @@ const ZoomableImage = ({ src, alt }) => {
|
|
|
39486
39486
|
))));
|
|
39487
39487
|
};
|
|
39488
39488
|
|
|
39489
|
+
const SmartImageInner = ({ src, alt }) => {
|
|
39490
|
+
const [isSmallImage, setIsSmallImage] = useState(null);
|
|
39491
|
+
const handleLoad = (e) => {
|
|
39492
|
+
const img = e.currentTarget;
|
|
39493
|
+
setIsSmallImage(img.naturalWidth < 100);
|
|
39494
|
+
};
|
|
39495
|
+
const handleError = () => {
|
|
39496
|
+
setIsSmallImage(false);
|
|
39497
|
+
};
|
|
39498
|
+
if (isSmallImage === null) {
|
|
39499
|
+
return /* @__PURE__ */ React__default.createElement("img", { src, alt: "", onLoad: handleLoad, onError: handleError, className: "hidden", "aria-hidden": "true" });
|
|
39500
|
+
}
|
|
39501
|
+
if (isSmallImage) {
|
|
39502
|
+
return /* @__PURE__ */ React__default.createElement("img", { src, alt, className: "w-auto h-auto inline-block px-1" });
|
|
39503
|
+
}
|
|
39504
|
+
return /* @__PURE__ */ React__default.createElement(ZoomableImage, { src, alt });
|
|
39505
|
+
};
|
|
39506
|
+
const SmartImage = ({ src, alt }) => {
|
|
39507
|
+
return /* @__PURE__ */ React__default.createElement(SmartImageInner, { key: src, src, alt });
|
|
39508
|
+
};
|
|
39509
|
+
|
|
39489
39510
|
const stripNewLines = (content) => content.replace(/^\n+|(\n+|\\)+$/g, "");
|
|
39490
39511
|
|
|
39491
39512
|
async function getContentType(attachmentId, contentTypeEndpoint, signal) {
|
|
@@ -39696,7 +39717,7 @@ const FormattedMessage = memo(({ message, isStreaming, redirectRules = [], conte
|
|
|
39696
39717
|
if (React__default.isValidElement(embedComponent)) {
|
|
39697
39718
|
return embedComponent;
|
|
39698
39719
|
}
|
|
39699
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
39720
|
+
return /* @__PURE__ */ React__default.createElement(SmartImage, { src, alt: parsedAlt });
|
|
39700
39721
|
},
|
|
39701
39722
|
li: ({ children, ...props }) => {
|
|
39702
39723
|
return /* @__PURE__ */ React__default.createElement("li", { ...props }, children);
|
|
@@ -39736,4 +39757,4 @@ const FormattedMessage = memo(({ message, isStreaming, redirectRules = [], conte
|
|
|
39736
39757
|
FormattedMessage.displayName = "FormattedMessage";
|
|
39737
39758
|
|
|
39738
39759
|
export { CodeBlock as C, FormattedMessage as F, MemoizedReactMarkdown as M, ZoomableImage as Z, MermaidDiagram as a, addUtmParameters as b, addPopupWidgetUtm as c };
|
|
39739
|
-
//# sourceMappingURL=FormattedMessage.
|
|
39760
|
+
//# sourceMappingURL=FormattedMessage.C2OwhDXi.js.map
|