@bettercms-ai/ui 0.9.0 → 0.11.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/registry.js CHANGED
@@ -575,11 +575,16 @@ function Image({
575
575
  }
576
576
 
577
577
  // src/blocks/Button.tsx
578
- import { jsx as jsx5 } from "react/jsx-runtime";
578
+ import { buttonIconOf, buttonIconSvg, buttonVariantOf } from "@bettercms-ai/types";
579
+ import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
579
580
  function Button({
580
581
  text,
581
582
  href,
582
583
  variant = "primary",
584
+ size = "md",
585
+ fullWidth = false,
586
+ arrow = false,
587
+ icon: iconProp,
583
588
  align = "left",
584
589
  className = "",
585
590
  "data-bcms-field": field,
@@ -588,27 +593,45 @@ function Button({
588
593
  const baseStyles = "inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50";
589
594
  const variantStyles = {
590
595
  primary: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
591
- secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80"
596
+ secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
597
+ tertiary: "bg-transparent text-primary hover:bg-primary/10",
598
+ brand: "bg-accent text-accent-foreground shadow hover:bg-accent/90",
599
+ dark: "bg-foreground text-background shadow hover:bg-foreground/90",
600
+ light: "border bg-background text-foreground shadow-sm hover:bg-muted",
601
+ outline: "border border-current bg-transparent text-primary hover:bg-primary/10",
602
+ link: "h-auto bg-transparent p-0 text-primary underline underline-offset-4"
592
603
  };
604
+ const icon = buttonIconOf(iconProp);
593
605
  const alignClass = {
594
606
  left: "justify-start",
595
607
  center: "justify-center",
596
608
  right: "justify-end"
597
609
  }[align];
598
- return /* @__PURE__ */ jsx5(
610
+ const sizeStyles = {
611
+ sm: "px-3 py-1.5 text-xs",
612
+ md: "px-4 py-2",
613
+ lg: "px-6 py-3 text-base"
614
+ };
615
+ const sizeClass = size === "sm" || size === "lg" ? sizeStyles[size] : sizeStyles.md;
616
+ const fullClass = fullWidth === true ? "flex w-full justify-center" : "";
617
+ return /* @__PURE__ */ jsxs3(
599
618
  "a",
600
619
  {
601
620
  href,
602
621
  "data-bcms-field": field,
603
622
  "data-bcms-kind": kind,
604
- className: cn(baseStyles, variantStyles[variant], alignClass, "px-4 py-2", className),
605
- children: text
623
+ className: cn(baseStyles, variantStyles[buttonVariantOf(variant)], alignClass, sizeClass, fullClass, className),
624
+ children: [
625
+ icon && /* @__PURE__ */ jsx5("span", { className: "mr-2 inline-flex", dangerouslySetInnerHTML: { __html: buttonIconSvg(icon, "bcms-btn-icon") } }),
626
+ text,
627
+ arrow === true && /* @__PURE__ */ jsx5("span", { className: "ml-2 inline-flex", dangerouslySetInnerHTML: { __html: buttonIconSvg("arrow-right", "bcms-btn-arrow") } })
628
+ ]
606
629
  }
607
630
  );
608
631
  }
609
632
 
610
633
  // src/blocks/Spacer.tsx
611
- import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
634
+ import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
612
635
  function Spacer({ height = 32, className = "" }) {
613
636
  return /* @__PURE__ */ jsx6(
614
637
  "div",
@@ -616,7 +639,7 @@ function Spacer({ height = 32, className = "" }) {
616
639
  className: `w-full border border-dashed border-muted-foreground/20 rounded flex items-center justify-center ${className}`,
617
640
  style: { height: `${height}px` },
618
641
  "aria-hidden": "true",
619
- children: /* @__PURE__ */ jsxs3("span", { className: "text-xs text-muted-foreground/40 select-none", children: [
642
+ children: /* @__PURE__ */ jsxs4("span", { className: "text-xs text-muted-foreground/40 select-none", children: [
620
643
  height,
621
644
  "px"
622
645
  ] })
@@ -648,7 +671,7 @@ function Columns({
648
671
 
649
672
  // src/blocks/Video.tsx
650
673
  import { useState } from "react";
651
- import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
674
+ import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
652
675
  function getEmbedUrl(url) {
653
676
  const ytMatch = url.match(
654
677
  /(?:youtube\.com\/(?:watch\?v=|embed\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})/
@@ -691,7 +714,7 @@ function Video({
691
714
  }
692
715
  );
693
716
  }
694
- return /* @__PURE__ */ jsxs4("div", { className: cn("w-full overflow-hidden rounded-md bg-black aspect-video", className), children: [
717
+ return /* @__PURE__ */ jsxs5("div", { className: cn("w-full overflow-hidden rounded-md bg-black aspect-video", className), children: [
695
718
  !isLoaded && poster && // eslint-disable-next-line @next/next/no-img-element
696
719
  /* @__PURE__ */ jsx8(
697
720
  "img",
@@ -738,9 +761,9 @@ function Section({
738
761
  }
739
762
 
740
763
  // src/blocks/Navbar.tsx
741
- import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
764
+ import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
742
765
  function Navbar({ logo, links, cta, className = "" }) {
743
- return /* @__PURE__ */ jsxs5("nav", { className: cn("flex items-center gap-6 py-4", className), children: [
766
+ return /* @__PURE__ */ jsxs6("nav", { className: cn("flex items-center gap-6 py-4", className), children: [
744
767
  logo?.src ? /* @__PURE__ */ jsx10("a", { href: logo.href ?? "/", className: "shrink-0", children: /* @__PURE__ */ jsx10("img", { src: logo.src, alt: logo.alt, className: "h-8 w-auto" }) }) : null,
745
768
  /* @__PURE__ */ jsx10("div", { className: "flex flex-1 gap-5", children: (links ?? []).map((l, i) => /* @__PURE__ */ jsx10("a", { href: l.href, className: "text-inherit no-underline", children: l.label }, i)) }),
746
769
  cta ? /* @__PURE__ */ jsx10(
@@ -755,10 +778,10 @@ function Navbar({ logo, links, cta, className = "" }) {
755
778
  }
756
779
 
757
780
  // src/blocks/Footer.tsx
758
- import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
781
+ import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
759
782
  function Footer({ columns, copyright, className = "" }) {
760
- return /* @__PURE__ */ jsxs6("footer", { className: cn("mt-12 border-t pt-8", className), children: [
761
- /* @__PURE__ */ jsx11("div", { className: "flex flex-wrap gap-12", children: (columns ?? []).map((col, i) => /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-1.5", children: [
783
+ return /* @__PURE__ */ jsxs7("footer", { className: cn("mt-12 border-t pt-8", className), children: [
784
+ /* @__PURE__ */ jsx11("div", { className: "flex flex-wrap gap-12", children: (columns ?? []).map((col, i) => /* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-1.5", children: [
762
785
  col.heading ? /* @__PURE__ */ jsx11("h4", { className: "mb-2 font-semibold", children: col.heading }) : null,
763
786
  (col.links ?? []).map((l, j) => /* @__PURE__ */ jsx11("a", { href: l.href, className: "text-neutral-500 no-underline", children: l.label }, j))
764
787
  ] }, i)) }),
@@ -768,13 +791,13 @@ function Footer({ columns, copyright, className = "" }) {
768
791
 
769
792
  // src/blocks/Slider.tsx
770
793
  import { useState as useState2 } from "react";
771
- import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
794
+ import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
772
795
  function Slider({ slides, className = "", renderBlock }) {
773
796
  const [i, setI] = useState2(0);
774
797
  const list = slides ?? [];
775
798
  const go = (n) => setI((n + list.length) % (list.length || 1));
776
799
  const btn = "absolute top-1/2 -translate-y-1/2 flex h-9 w-9 items-center justify-center rounded-full border-0 bg-black/50 text-white cursor-pointer";
777
- return /* @__PURE__ */ jsxs7("div", { className: cn("relative w-full", className), children: [
800
+ return /* @__PURE__ */ jsxs8("div", { className: cn("relative w-full", className), children: [
778
801
  list.map((s, idx) => /* @__PURE__ */ jsx12("div", { hidden: idx !== i, className: "flex flex-col gap-4", children: (s.children ?? []).map((b) => /* @__PURE__ */ jsx12("span", { children: renderBlock ? renderBlock(b) : null }, b.id)) }, s.id)),
779
802
  /* @__PURE__ */ jsx12("button", { type: "button", "aria-label": "Previous", onClick: () => go(i - 1), className: cn(btn, "left-2"), children: "\u2039" }),
780
803
  /* @__PURE__ */ jsx12("button", { type: "button", "aria-label": "Next", onClick: () => go(i + 1), className: cn(btn, "right-2"), children: "\u203A" })
@@ -783,11 +806,11 @@ function Slider({ slides, className = "", renderBlock }) {
783
806
 
784
807
  // src/blocks/Tabs.tsx
785
808
  import { useState as useState3 } from "react";
786
- import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
809
+ import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
787
810
  function Tabs({ tabs, className = "", renderBlock }) {
788
811
  const [active, setActive] = useState3(0);
789
812
  const list = tabs ?? [];
790
- return /* @__PURE__ */ jsxs8("div", { className: cn("w-full", className), children: [
813
+ return /* @__PURE__ */ jsxs9("div", { className: cn("w-full", className), children: [
791
814
  /* @__PURE__ */ jsx13("div", { role: "tablist", className: "mb-4 flex gap-1 border-b", children: list.map((t, idx) => /* @__PURE__ */ jsx13(
792
815
  "button",
793
816
  {
@@ -808,19 +831,19 @@ function Tabs({ tabs, className = "", renderBlock }) {
808
831
  }
809
832
 
810
833
  // src/blocks/Placeholders.tsx
811
- import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
834
+ import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
812
835
  var box = "rounded border border-dashed border-neutral-300 bg-neutral-50 p-4 text-sm text-neutral-500";
813
836
  function ComponentInstance({
814
837
  componentId,
815
838
  className = ""
816
839
  }) {
817
- return /* @__PURE__ */ jsxs9("div", { className: cn(box, className), children: [
840
+ return /* @__PURE__ */ jsxs10("div", { className: cn(box, className), children: [
818
841
  "Component instance: ",
819
842
  /* @__PURE__ */ jsx14("code", { children: componentId })
820
843
  ] });
821
844
  }
822
845
  function FormPlaceholder({ formId, className = "" }) {
823
- return /* @__PURE__ */ jsxs9("div", { className: cn(box, className), children: [
846
+ return /* @__PURE__ */ jsxs10("div", { className: cn(box, className), children: [
824
847
  "Form: ",
825
848
  /* @__PURE__ */ jsx14("code", { children: formId })
826
849
  ] });
@@ -829,9 +852,9 @@ function CollectionPlaceholder({
829
852
  cardComponentId,
830
853
  className = ""
831
854
  }) {
832
- return /* @__PURE__ */ jsxs9("div", { className: cn(box, className), children: [
855
+ return /* @__PURE__ */ jsxs10("div", { className: cn(box, className), children: [
833
856
  "Collection: entries of this page",
834
- cardComponentId ? /* @__PURE__ */ jsxs9(Fragment2, { children: [
857
+ cardComponentId ? /* @__PURE__ */ jsxs10(Fragment2, { children: [
835
858
  " as ",
836
859
  /* @__PURE__ */ jsx14("code", { children: cardComponentId })
837
860
  ] }) : /* @__PURE__ */ jsx14(Fragment2, { children: " (default card)" })