@usecrow/ui 0.1.31 → 0.1.32

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/index.js CHANGED
@@ -1606,16 +1606,27 @@ function StreamingText({
1606
1606
  ol: ({ children }) => /* @__PURE__ */ jsx("ol", { className: "crow-list-decimal crow-pl-5 crow-my-1.5", children }),
1607
1607
  li: ({ children }) => /* @__PURE__ */ jsx("li", { className: "crow-mb-0.5 last:crow-mb-0", children }),
1608
1608
  p: ({ children }) => /* @__PURE__ */ jsx("p", { className: "crow-mb-1.5 last:crow-mb-0", children }),
1609
- a: ({ href, children }) => /* @__PURE__ */ jsx(
1610
- "a",
1611
- {
1612
- href,
1613
- className: "crow-underline hover:crow-text-blue-300",
1614
- target: "_blank",
1615
- rel: "noopener noreferrer",
1616
- children
1617
- }
1618
- ),
1609
+ a: ({ href, children }) => {
1610
+ const isInternal = href?.startsWith("/");
1611
+ return /* @__PURE__ */ jsx(
1612
+ "a",
1613
+ {
1614
+ href,
1615
+ className: "crow-underline hover:crow-text-blue-300",
1616
+ ...!isInternal && { target: "_blank", rel: "noopener noreferrer" },
1617
+ onClick: isInternal ? (e) => {
1618
+ e.preventDefault();
1619
+ const a = document.createElement("a");
1620
+ a.href = href;
1621
+ a.style.display = "none";
1622
+ document.body.appendChild(a);
1623
+ a.click();
1624
+ document.body.removeChild(a);
1625
+ } : void 0,
1626
+ children
1627
+ }
1628
+ );
1629
+ },
1619
1630
  code: ({ className, children, ...props }) => {
1620
1631
  const isInline = !className;
1621
1632
  return isInline ? /* @__PURE__ */ jsx(
@@ -1943,16 +1954,27 @@ function MessageBubble({
1943
1954
  ol: ({ children }) => /* @__PURE__ */ jsx("ol", { className: "crow-list-decimal crow-pl-5 crow-my-1.5", children }),
1944
1955
  li: ({ children }) => /* @__PURE__ */ jsx("li", { className: "crow-mb-0.5 last:crow-mb-0", children }),
1945
1956
  p: ({ children }) => /* @__PURE__ */ jsx("p", { className: "crow-mb-1.5 last:crow-mb-0", children }),
1946
- a: ({ href, children }) => /* @__PURE__ */ jsx(
1947
- "a",
1948
- {
1949
- href,
1950
- className: "crow-underline hover:crow-text-blue-300",
1951
- target: "_blank",
1952
- rel: "noopener noreferrer",
1953
- children
1954
- }
1955
- )
1957
+ a: ({ href, children }) => {
1958
+ const isInternal = href?.startsWith("/");
1959
+ return /* @__PURE__ */ jsx(
1960
+ "a",
1961
+ {
1962
+ href,
1963
+ className: "crow-underline hover:crow-text-blue-300",
1964
+ ...!isInternal && { target: "_blank", rel: "noopener noreferrer" },
1965
+ onClick: isInternal ? (e) => {
1966
+ e.preventDefault();
1967
+ const a = document.createElement("a");
1968
+ a.href = href;
1969
+ a.style.display = "none";
1970
+ document.body.appendChild(a);
1971
+ a.click();
1972
+ document.body.removeChild(a);
1973
+ } : void 0,
1974
+ children
1975
+ }
1976
+ );
1977
+ }
1956
1978
  },
1957
1979
  children: message.content
1958
1980
  }