@bettercms-ai/next 0.38.0 → 0.40.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
@@ -863,9 +863,29 @@ function BcmsButton({ path, value, className }) {
863
863
  );
864
864
  }
865
865
 
866
+ // src/icon.tsx
867
+ import { iconSrc } from "@bettercms-ai/types";
868
+ import { ICON_MARKUP as ICON_MARKUP2, ICON_VIEWBOX as ICON_VIEWBOX2 } from "@bettercms-ai/icons/markup";
869
+ import { jsx as jsx3 } from "react/jsx-runtime";
870
+ function BcmsIcon({ value, className }) {
871
+ const src = iconSrc(value);
872
+ if (!src) return null;
873
+ const a11y = src.label ? { role: "img", "aria-label": src.label } : { "aria-hidden": true };
874
+ if ("name" in src) {
875
+ const markup = ICON_MARKUP2[src.name];
876
+ if (!markup) return null;
877
+ return /* @__PURE__ */ jsx3("svg", { "data-bcms-icon": src.name, className, viewBox: ICON_VIEWBOX2, width: "1em", height: "1em", fill: "none", focusable: "false", ...a11y, dangerouslySetInnerHTML: { __html: markup } });
878
+ }
879
+ if (src.followsText) {
880
+ const mask = `url(${JSON.stringify(src.url)}) center / contain no-repeat`;
881
+ return /* @__PURE__ */ jsx3("span", { "data-bcms-icon-url": src.url, className, style: { display: "inline-block", width: "1em", height: "1em", backgroundColor: "currentColor", mask, WebkitMask: mask }, ...a11y });
882
+ }
883
+ return /* @__PURE__ */ jsx3("img", { src: src.url, alt: src.label ?? "", className, width: 16, height: 16, style: { width: "1em", height: "1em", objectFit: "contain" } });
884
+ }
885
+
866
886
  // src/image.tsx
867
887
  import { imageCore } from "@bettercms-ai/sdk/bindings";
868
- import { jsx as jsx3 } from "react/jsx-runtime";
888
+ import { jsx as jsx4 } from "react/jsx-runtime";
869
889
  function BcmsImage({
870
890
  src,
871
891
  path,
@@ -885,7 +905,7 @@ function BcmsImage({
885
905
  }) {
886
906
  const { src: src1x, srcset: srcSet, alt: resolvedAlt, css } = imageCore(src, { alt, width, height, format, quality, fit, sizes, focalX, focalY, baseUrl });
887
907
  const merged = { ...css, ...style };
888
- return /* @__PURE__ */ jsx3(
908
+ return /* @__PURE__ */ jsx4(
889
909
  "img",
890
910
  {
891
911
  src: src1x,
@@ -958,6 +978,7 @@ export {
958
978
  BcmsDraftMarker,
959
979
  BcmsEmbedScripts,
960
980
  BcmsField,
981
+ BcmsIcon,
961
982
  BcmsImage,
962
983
  BetterCMSError,
963
984
  DEFAULT_SNAPSHOT_FILE,