@parrot-co/parrot-ui 0.0.52 → 0.0.54

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/main.js CHANGED
@@ -1801,6 +1801,7 @@ const $626c660fba87c9a3$var$StyledButton = (0, $80923bc9c1ba824c$export$3817b7a5
1801
1801
  outline: "none",
1802
1802
  border: "none",
1803
1803
  padding: 0,
1804
+ flexShrink: 0,
1804
1805
  defaultVariants: {
1805
1806
  size: "md",
1806
1807
  shape: "circle"
@@ -3299,6 +3300,7 @@ const $8fff24416ec1775a$export$f7513421c53ce141 = (0, $80923bc9c1ba824c$export$3
3299
3300
  alignItems: "center",
3300
3301
  justifyContent: "center",
3301
3302
  overflow: "hidden",
3303
+ flexShrink: 0,
3302
3304
  img: {
3303
3305
  width: "100%",
3304
3306
  objectFit: "cover",
@@ -3375,33 +3377,32 @@ function $e12b0eb570e3e94c$export$d41d9ab3de2def3d(text) {
3375
3377
 
3376
3378
 
3377
3379
  const $53cff1de4d77d0c5$export$e2255cf6045e8d47 = /*#__PURE__*/ $E4F9t$react.forwardRef(({ src: src , alt: alt , name: name , color: color , variant: variant = "light" , fallback: fallback , children: children , ...props }, ref)=>{
3378
- const [showFallback, setShowFallback] = $E4F9t$react.useState(false);
3380
+ const [imageError, setImageError] = $E4F9t$react.useState(false);
3379
3381
  const defaultColor = $E4F9t$react.useMemo(()=>{
3380
3382
  const hash = (0, $e12b0eb570e3e94c$export$d41d9ab3de2def3d)(name || "");
3381
3383
  return (0, $02a166a5043d2558$export$36308cce1deef340)[hash % (0, $02a166a5043d2558$export$36308cce1deef340).length];
3382
3384
  }, [
3383
3385
  name
3384
3386
  ]);
3385
- const showImage = src && !showFallback && !children;
3386
- const _showFallback = fallback && showFallback && !children;
3387
- return /*#__PURE__*/ (0, $E4F9t$reactjsxruntime.jsxs)((0, $8fff24416ec1775a$export$f7513421c53ce141), {
3387
+ const renderContent = ()=>{
3388
+ if (src && !imageError) return /*#__PURE__*/ (0, $E4F9t$reactjsxruntime.jsx)("img", {
3389
+ onLoad: ()=>setImageError(false),
3390
+ onError: ()=>setImageError(true),
3391
+ src: src,
3392
+ alt: alt
3393
+ });
3394
+ if (imageError && !children) return fallback;
3395
+ if (!src && !children && name) return /*#__PURE__*/ (0, $E4F9t$reactjsxruntime.jsx)("span", {
3396
+ children: name.charAt(0)
3397
+ });
3398
+ return children;
3399
+ };
3400
+ return /*#__PURE__*/ (0, $E4F9t$reactjsxruntime.jsx)((0, $8fff24416ec1775a$export$f7513421c53ce141), {
3388
3401
  color: color ?? defaultColor,
3389
3402
  variant: variant,
3390
3403
  ref: ref,
3391
3404
  ...props,
3392
- children: [
3393
- showImage && /*#__PURE__*/ (0, $E4F9t$reactjsxruntime.jsx)("img", {
3394
- onLoad: ()=>setShowFallback(false),
3395
- onError: ()=>setShowFallback(true),
3396
- src: src,
3397
- alt: alt
3398
- }),
3399
- (showFallback || name) && !fallback && /*#__PURE__*/ (0, $E4F9t$reactjsxruntime.jsx)("span", {
3400
- children: name?.charAt(0)
3401
- }),
3402
- _showFallback && fallback,
3403
- children
3404
- ]
3405
+ children: renderContent()
3405
3406
  });
3406
3407
  });
3407
3408
  $53cff1de4d77d0c5$export$e2255cf6045e8d47.displayName = "Avatar";