@almadar/ui 5.23.0 → 5.24.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.
@@ -396,11 +396,30 @@ interface DocBreadcrumbProps {
396
396
  }
397
397
  declare const DocBreadcrumb: React.FC<DocBreadcrumbProps>;
398
398
 
399
+ /**
400
+ * CodeBlock Molecule Component
401
+ *
402
+ * A syntax-highlighted code block with copy-to-clipboard functionality.
403
+ * Preserves scroll position during re-renders.
404
+ *
405
+ * Event Contract:
406
+ * - Emits: UI:COPY_CODE { language, success }
407
+ */
408
+
409
+ /**
410
+ * The set of languages with a registered PrismLight grammar (above) plus the
411
+ * `.orb`/`.lolo` grammars from `@almadar/syntax`. Authoritative: an unregistered
412
+ * value renders as plain text, so this union mirrors the `registerLanguage`
413
+ * calls exactly.
414
+ */
415
+ declare const CODE_LANGUAGES: readonly ["text", "json", "javascript", "js", "typescript", "ts", "jsx", "tsx", "css", "markdown", "md", "bash", "shell", "sh", "yaml", "yml", "rust", "python", "py", "sql", "diff", "toml", "go", "graphql", "html", "xml", "orb", "lolo"];
416
+ type CodeLanguage = (typeof CODE_LANGUAGES)[number];
417
+
399
418
  interface DocCodeBlockProps {
400
419
  /** Code content to display */
401
420
  code: string;
402
421
  /** Programming language label */
403
- language?: string;
422
+ language?: CodeLanguage;
404
423
  /** Optional title/filename shown in the header bar */
405
424
  title?: string;
406
425
  /** Show line numbers in the gutter */
@@ -5089,11 +5089,15 @@ var Avatar = ({
5089
5089
  actionPayload
5090
5090
  }) => {
5091
5091
  const eventBus = useEventBus();
5092
+ const [imgFailed, setImgFailed] = React8__default.default.useState(false);
5093
+ React8__default.default.useEffect(() => {
5094
+ setImgFailed(false);
5095
+ }, [src]);
5092
5096
  const initials = providedInitials ?? (name ? generateInitials(name) : void 0);
5093
5097
  const IconComponent = typeof iconProp === "string" ? resolveIcon(iconProp) : iconProp;
5094
- const hasImage = !!src;
5095
- const hasInitials = !!initials;
5098
+ const hasImage = !!src && !imgFailed;
5096
5099
  const hasIcon = !!IconComponent;
5100
+ const hasInitials = !!initials && !(hasIcon && !providedInitials);
5097
5101
  const getInitialsBackground = () => "bg-primary text-primary-foreground";
5098
5102
  const isClickable = action || onClick;
5099
5103
  const handleClick = () => {
@@ -5123,9 +5127,8 @@ var Avatar = ({
5123
5127
  src,
5124
5128
  alt: alt || "Avatar",
5125
5129
  className: "w-full h-full object-cover",
5126
- onError: (e) => {
5127
- const target = e.target;
5128
- target.style.display = "none";
5130
+ onError: () => {
5131
+ setImgFailed(true);
5129
5132
  }
5130
5133
  }
5131
5134
  ) : hasInitials ? /* @__PURE__ */ jsxRuntime.jsx(
@@ -5062,11 +5062,15 @@ var Avatar = ({
5062
5062
  actionPayload
5063
5063
  }) => {
5064
5064
  const eventBus = useEventBus();
5065
+ const [imgFailed, setImgFailed] = React8.useState(false);
5066
+ React8.useEffect(() => {
5067
+ setImgFailed(false);
5068
+ }, [src]);
5065
5069
  const initials = providedInitials ?? (name ? generateInitials(name) : void 0);
5066
5070
  const IconComponent = typeof iconProp === "string" ? resolveIcon(iconProp) : iconProp;
5067
- const hasImage = !!src;
5068
- const hasInitials = !!initials;
5071
+ const hasImage = !!src && !imgFailed;
5069
5072
  const hasIcon = !!IconComponent;
5073
+ const hasInitials = !!initials && !(hasIcon && !providedInitials);
5070
5074
  const getInitialsBackground = () => "bg-primary text-primary-foreground";
5071
5075
  const isClickable = action || onClick;
5072
5076
  const handleClick = () => {
@@ -5096,9 +5100,8 @@ var Avatar = ({
5096
5100
  src,
5097
5101
  alt: alt || "Avatar",
5098
5102
  className: "w-full h-full object-cover",
5099
- onError: (e) => {
5100
- const target = e.target;
5101
- target.style.display = "none";
5103
+ onError: () => {
5104
+ setImgFailed(true);
5102
5105
  }
5103
5106
  }
5104
5107
  ) : hasInitials ? /* @__PURE__ */ jsx(