@parrot-co/parrot-ui 0.0.53 → 0.0.55
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 +21 -18
- package/dist/main.js.map +1 -1
- package/dist/module.js +21 -18
- package/dist/module.js.map +1 -1
- package/package.json +2 -2
package/dist/module.js
CHANGED
|
@@ -3337,36 +3337,38 @@ function $0cd1b33af66db866$export$d41d9ab3de2def3d(text) {
|
|
|
3337
3337
|
}
|
|
3338
3338
|
return Math.abs(hash);
|
|
3339
3339
|
}
|
|
3340
|
+
function $0cd1b33af66db866$export$d560c7e4a29451c2() {
|
|
3341
|
+
return Math.random().toString(36);
|
|
3342
|
+
}
|
|
3340
3343
|
|
|
3341
3344
|
|
|
3342
3345
|
const $2b3b1dc9b2ed8672$export$e2255cf6045e8d47 = /*#__PURE__*/ $kF5Av$forwardRef(({ src: src , alt: alt , name: name , color: color , variant: variant = "light" , fallback: fallback , children: children , ...props }, ref)=>{
|
|
3343
|
-
const [
|
|
3346
|
+
const [imageError, setImageError] = $kF5Av$useState(false);
|
|
3344
3347
|
const defaultColor = $kF5Av$useMemo(()=>{
|
|
3345
3348
|
const hash = (0, $0cd1b33af66db866$export$d41d9ab3de2def3d)(name || "");
|
|
3346
3349
|
return (0, $22d93d8ad1e2d08d$export$36308cce1deef340)[hash % (0, $22d93d8ad1e2d08d$export$36308cce1deef340).length];
|
|
3347
3350
|
}, [
|
|
3348
3351
|
name
|
|
3349
3352
|
]);
|
|
3350
|
-
const
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
+
const renderContent = ()=>{
|
|
3354
|
+
if (src && !imageError) return /*#__PURE__*/ (0, $kF5Av$jsx)("img", {
|
|
3355
|
+
onLoad: ()=>setImageError(false),
|
|
3356
|
+
onError: ()=>setImageError(true),
|
|
3357
|
+
src: src,
|
|
3358
|
+
alt: alt
|
|
3359
|
+
});
|
|
3360
|
+
if (imageError && !children) return fallback;
|
|
3361
|
+
if (!src && !children && name) return /*#__PURE__*/ (0, $kF5Av$jsx)("span", {
|
|
3362
|
+
children: name.charAt(0)
|
|
3363
|
+
});
|
|
3364
|
+
return children;
|
|
3365
|
+
};
|
|
3366
|
+
return /*#__PURE__*/ (0, $kF5Av$jsx)((0, $bc830feefb2f8a48$export$f7513421c53ce141), {
|
|
3353
3367
|
color: color ?? defaultColor,
|
|
3354
3368
|
variant: variant,
|
|
3355
3369
|
ref: ref,
|
|
3356
3370
|
...props,
|
|
3357
|
-
children:
|
|
3358
|
-
showImage && /*#__PURE__*/ (0, $kF5Av$jsx)("img", {
|
|
3359
|
-
onLoad: ()=>setShowFallback(false),
|
|
3360
|
-
onError: ()=>setShowFallback(true),
|
|
3361
|
-
src: src,
|
|
3362
|
-
alt: alt
|
|
3363
|
-
}),
|
|
3364
|
-
(showFallback || name) && !fallback && /*#__PURE__*/ (0, $kF5Av$jsx)("span", {
|
|
3365
|
-
children: name?.charAt(0)
|
|
3366
|
-
}),
|
|
3367
|
-
_showFallback && fallback,
|
|
3368
|
-
children
|
|
3369
|
-
]
|
|
3371
|
+
children: renderContent()
|
|
3370
3372
|
});
|
|
3371
3373
|
});
|
|
3372
3374
|
$2b3b1dc9b2ed8672$export$e2255cf6045e8d47.displayName = "Avatar";
|
|
@@ -3420,6 +3422,7 @@ const $3224e27f2b858ea8$export$f911245fef99627e = (0, $9ade691eb9e41cfb$export$3
|
|
|
3420
3422
|
|
|
3421
3423
|
|
|
3422
3424
|
|
|
3425
|
+
|
|
3423
3426
|
const $c0386802302e82e5$export$1a5cb5295a7d2749 = /*#__PURE__*/ $kF5Av$forwardRef(({ onFileUpload: onFileUpload , onRemoveFile: onRemoveFile , error: error , label: label , allowMultiple: allowMultiple , uploads: controlledUploads , hideFileList: hideFileList }, ref)=>{
|
|
3424
3427
|
const [_uploads, setUploads] = $kF5Av$useState([]);
|
|
3425
3428
|
const uploads = controlledUploads ?? _uploads;
|
|
@@ -3453,7 +3456,7 @@ const $c0386802302e82e5$export$1a5cb5295a7d2749 = /*#__PURE__*/ $kF5Av$forwardRe
|
|
|
3453
3456
|
function convertFileToUpload(file) {
|
|
3454
3457
|
return {
|
|
3455
3458
|
name: file.name,
|
|
3456
|
-
id:
|
|
3459
|
+
id: (0, $0cd1b33af66db866$export$d560c7e4a29451c2)(),
|
|
3457
3460
|
url: URL.createObjectURL(file),
|
|
3458
3461
|
status: "success",
|
|
3459
3462
|
file: file
|