@bettercms-ai/ui 0.15.0 → 0.16.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/renderer.js CHANGED
@@ -580,7 +580,7 @@ function Image({
580
580
  }
581
581
 
582
582
  // src/blocks/Button.tsx
583
- import { buttonIconOf, buttonIconSvg, buttonVariantOf } from "@bettercms-ai/types";
583
+ import { LINK_RELS, buttonIconOf, buttonIconSvg, buttonVariantOf, isScriptHref } from "@bettercms-ai/types";
584
584
  import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
585
585
  function Button({
586
586
  text,
@@ -591,6 +591,8 @@ function Button({
591
591
  arrow = false,
592
592
  icon: iconProp,
593
593
  newTab = false,
594
+ rel,
595
+ action,
594
596
  align = "left",
595
597
  className = "",
596
598
  style,
@@ -621,11 +623,20 @@ function Button({
621
623
  };
622
624
  const sizeClass = size === "sm" || size === "lg" ? sizeStyles[size] : sizeStyles.md;
623
625
  const fullClass = fullWidth === true ? "flex w-full justify-center" : "";
626
+ const relTokens = [...newTab === true ? ["noopener", "noreferrer"] : [], ...LINK_RELS.includes(rel) ? [rel] : []];
627
+ if (action === "code") {
628
+ return /* @__PURE__ */ jsxs3("button", { type: "button", "data-bcms-field": field, "data-bcms-kind": kind, style, className: cn(baseStyles, variantStyles[buttonVariantOf(variant)], alignClass, sizeClass, fullClass, className), children: [
629
+ icon && /* @__PURE__ */ jsx5("span", { className: "mr-2 inline-flex", dangerouslySetInnerHTML: { __html: buttonIconSvg(icon, "bcms-btn-icon") } }),
630
+ text,
631
+ arrow === true && /* @__PURE__ */ jsx5("span", { className: "ml-2 inline-flex", dangerouslySetInnerHTML: { __html: buttonIconSvg("arrow-right", "bcms-btn-arrow") } })
632
+ ] });
633
+ }
624
634
  return /* @__PURE__ */ jsxs3(
625
635
  "a",
626
636
  {
627
- href,
628
- ...newTab === true ? { target: "_blank", rel: "noopener noreferrer" } : {},
637
+ href: typeof href === "string" && isScriptHref(href) ? "#" : href,
638
+ ...newTab === true ? { target: "_blank" } : {},
639
+ ...relTokens.length ? { rel: relTokens.join(" ") } : {},
629
640
  "data-bcms-field": field,
630
641
  "data-bcms-kind": kind,
631
642
  style,