@firecms/ui 3.0.0-canary.143 → 3.0.0-canary.144

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.es.js CHANGED
@@ -366,6 +366,10 @@ const AvatarInner = ({
366
366
  outerClassName,
367
367
  ...props
368
368
  }, ref) => {
369
+ const [isImageError, setIsImageError] = useState(false);
370
+ const handleImageError = () => {
371
+ setIsImageError(true);
372
+ };
369
373
  return /* @__PURE__ */ jsx(
370
374
  "button",
371
375
  {
@@ -377,7 +381,7 @@ const AvatarInner = ({
377
381
  "p-1 hover:bg-slate-200 hover:dark:bg-slate-700 w-12 h-12 min-w-12 min-h-12",
378
382
  outerClassName
379
383
  ),
380
- children: src ? /* @__PURE__ */ jsx(
384
+ children: src && !isImageError ? /* @__PURE__ */ jsx(
381
385
  "img",
382
386
  {
383
387
  className: cls(
@@ -386,7 +390,8 @@ const AvatarInner = ({
386
390
  className
387
391
  ),
388
392
  src,
389
- alt
393
+ alt,
394
+ onError: handleImageError
390
395
  }
391
396
  ) : /* @__PURE__ */ jsx(
392
397
  "span",
@@ -509,7 +514,7 @@ const BooleanSwitchWithLabel = function BooleanSwitchWithLabel2({
509
514
  !invisible && fieldBackgroundMixin,
510
515
  !invisible && (disabled ? fieldBackgroundDisabledMixin : fieldBackgroundHoverMixin),
511
516
  disabled ? "cursor-default" : "cursor-pointer",
512
- "rounded-md max-w-full justify-between box-border relative inline-flex items-center",
517
+ "rounded-md max-w-full justify-between box-border relative inline-flex items-center",
513
518
  !invisible && focus && !disabled ? focusedClasses : "",
514
519
  error ? "text-red-500 dark:text-red-600" : focus && !disabled ? "text-primary" : !disabled ? "text-text-primary dark:text-text-primary-dark" : "text-text-secondary dark:text-text-secondary-dark",
515
520
  size === "smallest" ? "min-h-[40px]" : size === "small" ? "min-h-[48px]" : "min-h-[64px]",