@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/module.js CHANGED
@@ -1764,6 +1764,7 @@ const $39ebe5a116c39d6c$var$StyledButton = (0, $9ade691eb9e41cfb$export$3817b7a5
1764
1764
  outline: "none",
1765
1765
  border: "none",
1766
1766
  padding: 0,
1767
+ flexShrink: 0,
1767
1768
  defaultVariants: {
1768
1769
  size: "md",
1769
1770
  shape: "circle"
@@ -3262,6 +3263,7 @@ const $bc830feefb2f8a48$export$f7513421c53ce141 = (0, $9ade691eb9e41cfb$export$3
3262
3263
  alignItems: "center",
3263
3264
  justifyContent: "center",
3264
3265
  overflow: "hidden",
3266
+ flexShrink: 0,
3265
3267
  img: {
3266
3268
  width: "100%",
3267
3269
  objectFit: "cover",
@@ -3338,33 +3340,32 @@ function $0cd1b33af66db866$export$d41d9ab3de2def3d(text) {
3338
3340
 
3339
3341
 
3340
3342
  const $2b3b1dc9b2ed8672$export$e2255cf6045e8d47 = /*#__PURE__*/ $kF5Av$forwardRef(({ src: src , alt: alt , name: name , color: color , variant: variant = "light" , fallback: fallback , children: children , ...props }, ref)=>{
3341
- const [showFallback, setShowFallback] = $kF5Av$useState(false);
3343
+ const [imageError, setImageError] = $kF5Av$useState(false);
3342
3344
  const defaultColor = $kF5Av$useMemo(()=>{
3343
3345
  const hash = (0, $0cd1b33af66db866$export$d41d9ab3de2def3d)(name || "");
3344
3346
  return (0, $22d93d8ad1e2d08d$export$36308cce1deef340)[hash % (0, $22d93d8ad1e2d08d$export$36308cce1deef340).length];
3345
3347
  }, [
3346
3348
  name
3347
3349
  ]);
3348
- const showImage = src && !showFallback && !children;
3349
- const _showFallback = fallback && showFallback && !children;
3350
- return /*#__PURE__*/ (0, $kF5Av$jsxs)((0, $bc830feefb2f8a48$export$f7513421c53ce141), {
3350
+ const renderContent = ()=>{
3351
+ if (src && !imageError) return /*#__PURE__*/ (0, $kF5Av$jsx)("img", {
3352
+ onLoad: ()=>setImageError(false),
3353
+ onError: ()=>setImageError(true),
3354
+ src: src,
3355
+ alt: alt
3356
+ });
3357
+ if (imageError && !children) return fallback;
3358
+ if (!src && !children && name) return /*#__PURE__*/ (0, $kF5Av$jsx)("span", {
3359
+ children: name.charAt(0)
3360
+ });
3361
+ return children;
3362
+ };
3363
+ return /*#__PURE__*/ (0, $kF5Av$jsx)((0, $bc830feefb2f8a48$export$f7513421c53ce141), {
3351
3364
  color: color ?? defaultColor,
3352
3365
  variant: variant,
3353
3366
  ref: ref,
3354
3367
  ...props,
3355
- children: [
3356
- showImage && /*#__PURE__*/ (0, $kF5Av$jsx)("img", {
3357
- onLoad: ()=>setShowFallback(false),
3358
- onError: ()=>setShowFallback(true),
3359
- src: src,
3360
- alt: alt
3361
- }),
3362
- (showFallback || name) && !fallback && /*#__PURE__*/ (0, $kF5Av$jsx)("span", {
3363
- children: name?.charAt(0)
3364
- }),
3365
- _showFallback && fallback,
3366
- children
3367
- ]
3368
+ children: renderContent()
3368
3369
  });
3369
3370
  });
3370
3371
  $2b3b1dc9b2ed8672$export$e2255cf6045e8d47.displayName = "Avatar";