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