@radix-ui/react-avatar
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -1,2 +0,2 @@ | ||
var r,e,t=require("@radix-ui/react-primitive").Primitive,a=require("@radix-ui/react-use-layout-effect").useLayoutEffect,n=require("@radix-ui/react-use-callback-ref").useCallbackRef,o=require("@radix-ui/react-context").createContext,i=(r={},e=require("react"),Object.keys(e).forEach((function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(r,t,{enumerable:!0,get:function(){return e[t]}})})),r);function u(){return(u=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(r[a]=t[a])}return r}).apply(this,arguments)}function c(r,e){if(null==r)return{};var t,a,n=function(r,e){if(null==r)return{};var t,a,n={},o=Object.keys(r);for(a=0;a<o.length;a++)t=o[a],e.indexOf(t)>=0||(n[t]=r[t]);return n}(r,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);for(a=0;a<o.length;a++)t=o[a],e.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(r,t)&&(n[t]=r[t])}return n}function l(r,e){return function(r){if(Array.isArray(r))return r}(r)||function(r,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(r)))return;var t=[],a=!0,n=!1,o=void 0;try{for(var i,u=r[Symbol.iterator]();!(a=(i=u.next()).done)&&(t.push(i.value),!e||t.length!==e);a=!0);}catch(r){n=!0,o=r}finally{try{a||null==u.return||u.return()}finally{if(n)throw o}}return t}(r,e)||function(r,e){if(!r)return;if("string"==typeof r)return f(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);"Object"===t&&r.constructor&&(t=r.constructor.name);if("Map"===t||"Set"===t)return Array.from(r);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return f(r,e)}(r,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,a=new Array(e);t<e;t++)a[t]=r[t];return a}var s=l(o("Avatar"),2),d=s[0],v=s[1],y=i.forwardRef((function(r,e){var a=r.as,n=void 0===a?"span":a,o=c(r,["as"]),f=l(i.useState("idle"),2),s=f[0],v=f[1];return i.createElement(d,{imageLoadingStatus:s,onImageLoadingStatusChange:v},i.createElement(t,u({},o,{as:n,ref:e})))}));exports.Avatar=y,y.displayName="Avatar";var m=i.forwardRef((function(r,e){var o=r.as,f=void 0===o?"img":o,s=r.src,d=r.onLoadingStatusChange,y=void 0===d?function(){}:d,m=c(r,["as","src","onLoadingStatusChange"]),g=v("AvatarImage"),p=function(r){var e=l(i.useState("idle"),2),t=e[0],a=e[1];return i.useEffect((function(){if(r){var e=!0,t=new window.Image,n=function(r){return function(){e&&a(r)}};return a("loading"),t.onload=n("loaded"),t.onerror=n("error"),t.src=r,function(){e=!1}}a("error")}),[r]),t}(s),b=n((function(r){y(r),g.onImageLoadingStatusChange(r)}));return a((function(){"idle"!==p&&b(p)}),[p,b]),"loaded"===p?i.createElement(t,u({},m,{as:f,ref:e,src:s})):null}));exports.AvatarImage=m,m.displayName="AvatarImage";var g=i.forwardRef((function(r,e){var a=r.as,n=void 0===a?"span":a,o=r.delayMs,f=c(r,["as","delayMs"]),s=v("AvatarFallback"),d=l(i.useState(void 0===o),2),y=d[0],m=d[1];return i.useEffect((function(){if(void 0!==o){var r=window.setTimeout((function(){return m(!0)}),o);return function(){return window.clearTimeout(r)}}}),[o]),y&&"loaded"!==s.imageLoadingStatus?i.createElement(t,u({},f,{as:n,ref:e})):null}));exports.AvatarFallback=g,g.displayName="AvatarFallback";var p=y;exports.Root=p;var b=m;exports.Image=b;var h=g;exports.Fallback=h; | ||
function e(e){return e&&e.__esModule?e.default:e}function r(e,r,a){Object.defineProperty(e,r,{get:a,enumerable:!0})}var a=require("@radix-ui/react-primitive").Primitive,t=require("@radix-ui/react-use-layout-effect").useLayoutEffect,n=require("@radix-ui/react-use-callback-ref").useCallbackRef,i=require("@radix-ui/react-context").createContext,o=require("react"),u=o.forwardRef,c=o.useState,s=o.createElement,l=o.useEffect,d=e(require("@babel/runtime-corejs3/core-js-stable/set-timeout")),f=e(require("@babel/runtime-corejs3/helpers/slicedToArray")),v=e(require("@babel/runtime-corejs3/helpers/objectWithoutProperties")),m=e(require("@babel/runtime-corejs3/helpers/extends")),g={},b=i("Avatar"),p=f(b,2),x=p[0],A=p[1],q=u((function(e,r){var t=e.as,n=void 0===t?"span":t,i=v(e,["as"]),o=c("idle"),u=f(o,2),l=u[0],d=u[1];return s(x,{imageLoadingStatus:l,onImageLoadingStatusChange:d},s(a,m({},i,{as:n,ref:r})))}));exports.Avatar=q,q.displayName="Avatar";var y=u((function(e,r){var i=e.as,o=void 0===i?"img":i,u=e.src,d=e.onLoadingStatusChange,g=void 0===d?function(){}:d,b=v(e,["as","src","onLoadingStatusChange"]),p=A("AvatarImage"),x=function(e){var r=c("idle"),a=f(r,2),t=a[0],n=a[1];return l((function(){if(e){var r=!0,a=new window.Image,t=function(e){return function(){r&&n(e)}};return n("loading"),a.onload=t("loaded"),a.onerror=t("error"),a.src=e,function(){r=!1}}n("error")}),[e]),t}(u),q=n((function(e){g(e),p.onImageLoadingStatusChange(e)}));return t((function(){"idle"!==x&&q(x)}),[x,q]),"loaded"===x?s(a,m({},b,{as:o,ref:r,src:u})):null}));exports.AvatarImage=y,y.displayName="AvatarImage";var I=u((function(e,r){var t=e.as,n=void 0===t?"span":t,i=e.delayMs,o=v(e,["as","delayMs"]),u=A("AvatarFallback"),g=c(void 0===i),b=f(g,2),p=b[0],x=b[1];return l((function(){if(void 0!==i){var e=d((function(){return x(!0)}),i);return function(){return window.clearTimeout(e)}}}),[i]),p&&"loaded"!==u.imageLoadingStatus?s(a,m({},o,{as:n,ref:r})):null}));exports.AvatarFallback=I,I.displayName="AvatarFallback";var h=q;exports.Root=h;var k=y;exports.Image=k;var j=I;exports.Fallback=j,r(g,"Fallback",(function(){return j})),r(g,"Image",(function(){return k})),r(g,"Root",(function(){return h})),r(g,"AvatarFallback",(function(){return I})),r(g,"AvatarImage",(function(){return y})),r(g,"Avatar",(function(){return q})); | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import{Primitive as a}from"@radix-ui/react-primitive";import{useLayoutEffect as t}from"@radix-ui/react-use-layout-effect";import{useCallbackRef as e}from"@radix-ui/react-use-callback-ref";import{createContext as r}from"@radix-ui/react-context";import*as o from"react";function n(){return(n=Object.assign||function(a){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(a[r]=e[r])}return a}).apply(this,arguments)}const s="span",[i,c]=r("Avatar");export const Avatar=o.forwardRef(((t,e)=>{const{as:r=s,...c}=t,[l,d]=o.useState("idle");return o.createElement(i,{imageLoadingStatus:l,onImageLoadingStatusChange:d},o.createElement(a,n({},c,{as:r,ref:e})))}));Avatar.displayName="Avatar";const l="img";export const AvatarImage=o.forwardRef(((r,s)=>{const{as:i=l,src:d,onLoadingStatusChange:u=(()=>{}),...m}=r,f=c("AvatarImage"),g=function(a){const[t,e]=o.useState("idle");return o.useEffect((()=>{if(!a)return void e("error");let t=!0;const r=new window.Image,o=a=>()=>{t&&e(a)};return e("loading"),r.onload=o("loaded"),r.onerror=o("error"),r.src=a,()=>{t=!1}}),[a]),t}(d),p=e((a=>{u(a),f.onImageLoadingStatusChange(a)}));return t((()=>{"idle"!==g&&p(g)}),[g,p]),"loaded"===g?o.createElement(a,n({},m,{as:i,ref:s,src:d})):null}));AvatarImage.displayName="AvatarImage";const d="span";export const AvatarFallback=o.forwardRef(((t,e)=>{const{as:r=d,delayMs:s,...i}=t,l=c("AvatarFallback"),[u,m]=o.useState(void 0===s);return o.useEffect((()=>{if(void 0!==s){const a=window.setTimeout((()=>m(!0)),s);return()=>window.clearTimeout(a)}}),[s]),u&&"loaded"!==l.imageLoadingStatus?o.createElement(a,n({},i,{as:r,ref:e})):null}));AvatarFallback.displayName="AvatarFallback";export const Root=Avatar;export const Image=AvatarImage;export const Fallback=AvatarFallback; | ||
function a(a,r,t){Object.defineProperty(a,r,{get:t,enumerable:!0})}import{Primitive as r}from"@radix-ui/react-primitive";import{useLayoutEffect as t}from"@radix-ui/react-use-layout-effect";import{useCallbackRef as e}from"@radix-ui/react-use-callback-ref";import{createContext as o}from"@radix-ui/react-context";import{forwardRef as n,useState as i,createElement as u,useEffect as c}from"react";import l from"@babel/runtime-corejs3/core-js-stable/set-timeout";import m from"@babel/runtime-corejs3/helpers/esm/slicedToArray";import s from"@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";import v from"@babel/runtime-corejs3/helpers/esm/extends";var f={},d=o("Avatar"),g=m(d,2),p=g[0],b=g[1];export var Avatar=n((function(a,t){var e=a.as,o=void 0===e?"span":e,n=s(a,["as"]),c=i("idle"),l=m(c,2),f=l[0],d=l[1];return u(p,{imageLoadingStatus:f,onImageLoadingStatusChange:d},u(r,v({},n,{as:o,ref:t})))}));Avatar.displayName="Avatar";export var AvatarImage=n((function(a,o){var n=a.as,l=void 0===n?"img":n,f=a.src,d=a.onLoadingStatusChange,g=void 0===d?function(){}:d,p=s(a,["as","src","onLoadingStatusChange"]),A=b("AvatarImage"),x=function(a){var r=i("idle"),t=m(r,2),e=t[0],o=t[1];return c((function(){if(a){var r=!0,t=new window.Image,e=function(a){return function(){r&&o(a)}};return o("loading"),t.onload=e("loaded"),t.onerror=e("error"),t.src=a,function(){r=!1}}o("error")}),[a]),e}(f),I=e((function(a){g(a),A.onImageLoadingStatusChange(a)}));return t((function(){"idle"!==x&&I(x)}),[x,I]),"loaded"===x?u(r,v({},p,{as:l,ref:o,src:f})):null}));AvatarImage.displayName="AvatarImage";export var AvatarFallback=n((function(a,t){var e=a.as,o=void 0===e?"span":e,n=a.delayMs,f=s(a,["as","delayMs"]),d=b("AvatarFallback"),g=i(void 0===n),p=m(g,2),A=p[0],x=p[1];return c((function(){if(void 0!==n){var a=l((function(){return x(!0)}),n);return function(){return window.clearTimeout(a)}}}),[n]),A&&"loaded"!==d.imageLoadingStatus?u(r,v({},f,{as:o,ref:t})):null}));AvatarFallback.displayName="AvatarFallback";export var Root=Avatar;var A=AvatarImage;export{A as Image};export var Fallback=AvatarFallback;a(f,"Fallback",(function(){return Fallback})),a(f,"Image",(function(){return A})),a(f,"Root",(function(){return Root})),a(f,"AvatarFallback",(function(){return AvatarFallback})),a(f,"AvatarImage",(function(){return AvatarImage})),a(f,"Avatar",(function(){return Avatar})); | ||
//# sourceMappingURL=index.module.js.map |
{ | ||
"name": "@radix-ui/react-avatar", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"license": "MIT", | ||
@@ -16,10 +16,12 @@ "source": "src/index.ts", | ||
"clean": "rm -rf dist", | ||
"prepublish": "yarn clean" | ||
"prepublish": "yarn clean", | ||
"version": "yarn version" | ||
}, | ||
"dependencies": { | ||
"@radix-ui/react-context": "0.0.1", | ||
"@radix-ui/react-polymorphic": "0.0.6", | ||
"@radix-ui/react-primitive": "0.0.5", | ||
"@radix-ui/react-use-callback-ref": "0.0.1", | ||
"@radix-ui/react-use-layout-effect": "0.0.1" | ||
"@babel/runtime-corejs3": "^7.13.10", | ||
"@radix-ui/react-context": "0.0.2", | ||
"@radix-ui/react-polymorphic": "0.0.7", | ||
"@radix-ui/react-primitive": "0.0.7", | ||
"@radix-ui/react-use-callback-ref": "0.0.2", | ||
"@radix-ui/react-use-layout-effect": "0.0.2" | ||
}, | ||
@@ -26,0 +28,0 @@ "peerDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27182
7
44
1
+ Added@babel/runtime-corejs3@7.26.0(transitive)
+ Added@radix-ui/react-context@0.0.2(transitive)
+ Added@radix-ui/react-polymorphic@0.0.7(transitive)
+ Added@radix-ui/react-primitive@0.0.7(transitive)
+ Added@radix-ui/react-use-callback-ref@0.0.2(transitive)
+ Added@radix-ui/react-use-layout-effect@0.0.2(transitive)
+ Addedcore-js-pure@3.39.0(transitive)
+ Addedregenerator-runtime@0.14.1(transitive)
- Removed@radix-ui/react-context@0.0.1(transitive)
- Removed@radix-ui/react-polymorphic@0.0.6(transitive)
- Removed@radix-ui/react-primitive@0.0.5(transitive)
- Removed@radix-ui/react-use-callback-ref@0.0.1(transitive)
- Removed@radix-ui/react-use-layout-effect@0.0.1(transitive)