ixia-ui-react 1.0.1 → 1.1.0

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.d.mts CHANGED
@@ -733,7 +733,7 @@ interface CodeBlockValue {
733
733
  id: string;
734
734
  label: string;
735
735
  name: string;
736
- content: string;
736
+ content: string | React.ReactNode;
737
737
  icon?: React.ReactNode;
738
738
  }
739
739
  type CodeBlockTabsProps = React.ComponentProps<typeof Tabs>;
package/dist/index.mjs CHANGED
@@ -2327,6 +2327,7 @@ const COPY_STATUS_ICON = {
2327
2327
  };
2328
2328
  function CodeBlockCopy({ className, children, ref, ...props }) {
2329
2329
  const { currentValue } = useCodeBlock(), [copied, setCopied] = React.useState(false), handleClick = async () => {
2330
+ if (typeof currentValue.content !== "string") return;
2330
2331
  try {
2331
2332
  await navigator.clipboard.writeText(currentValue.content);
2332
2333
  setCopied(true);
@@ -2362,6 +2363,7 @@ const DOWNLOAD_STATUS_ICON = {
2362
2363
  };
2363
2364
  function CodeBlockDownload({ className, children, ref, ...props }) {
2364
2365
  const { currentValue } = useCodeBlock(), [downloaded, setDownloaded] = React.useState(false), handleClick = async () => {
2366
+ if (typeof currentValue.content !== "string") return;
2365
2367
  try {
2366
2368
  const blob = new Blob([currentValue.content]), url = URL.createObjectURL(blob), link = document.createElement("a");
2367
2369
  link.href = url;
@@ -2707,7 +2709,11 @@ function CodeBlockWindow({ className, children, ref, ...props }) {
2707
2709
  className: cn("relative overflow-auto rounded-lg px-md py-sm", className),
2708
2710
  ref,
2709
2711
  ...props,
2710
- children: [children, /* @__PURE__ */ jsx("div", { dangerouslySetInnerHTML: { __html: currentValue.content } })]
2712
+ children: [
2713
+ children,
2714
+ typeof currentValue.content === "string" && /* @__PURE__ */ jsx("div", { dangerouslySetInnerHTML: { __html: currentValue.content } }),
2715
+ typeof currentValue.content !== "string" && currentValue.content
2716
+ ]
2711
2717
  });
2712
2718
  }
2713
2719
  //#endregion