@brighthr/component-avatar
Advanced tools
Comparing version 0.0.18 to 0.0.19
@@ -1,2 +0,2 @@ | ||
import * as React from 'react'; | ||
import React from 'react'; | ||
declare type AvatarSize = 'xxs' | 'xs' | 'sm' | 'base' | 'lg' | 'xl' | 'xxl'; | ||
@@ -3,0 +3,0 @@ declare type Presence = 'in' | 'out' | 'absent'; |
@@ -1,2 +0,2 @@ | ||
import*as e from"react";import t from"classnames";import l from"@brighthr/component-icon";const s=e=>t("bg-primary-400 text-white rounded-full flex justify-center items-center",{"w-5 h-5 text-xs":"xs"===e||"xxs"===e,"w-9 h-9 text-xs":"sm"===e,"w-12 h-12 text-base":"base"===e,"w-16 h-16 text-base":"lg"===e,"w-20 h-20 text-2xl":"xl"===e,"w-32 h-32 text-3xl":"xxl"===e}),a=(e,l)=>t("absolute bottom-0 right-0 inline-block rounded-full",{"w-1.5 h-1.5":"xs"===l||"xxs"===l,"w-2 h-2":"sm"===l,"w-3 h-3":"base"===l,"w-4 h-4":"lg"===l,"w-5 h-5":"xl"===l,"w-8 h-8":"xxl"===l,"bg-success-600 rounded-full":"in"===e,"bg-neutral-400 rounded-full":"out"===e,"bg-error-500 rounded-full":"absent"===e}),r=({name:a,size:r="base"})=>e.createElement("div",{className:t(s(r))},a?a.split(" ").map(e=>e.match(/[A-Za-z]/)).slice(0,3).join("").toUpperCase():e.createElement(l,{iconName:"user",size:r,className:t("fill-white flex justify-center items-center")})),n=({name:l,imageHref:n,size:i,presence:m})=>e.createElement("div",{className:t("relative inline-block")},n?e.createElement("img",{src:n,title:`${l}'s profile`,className:t("max-w-none inline object-cover rounded-full",s(i)),alt:`${l}'s profile`}):e.createElement(r,{name:l,size:i}),m&&e.createElement("span",{className:t(a(m,i))}," "));export{n as default}; | ||
import e,{useState as t,useEffect as l}from"react";import r from"classnames";import s from"@brighthr/component-icon";const a=e=>r("bg-primary-400 text-white rounded-full flex justify-center items-center",{"w-5 h-5 text-xs":"xs"===e||"xxs"===e,"w-9 h-9 text-xs":"sm"===e,"w-12 h-12 text-base":"base"===e,"w-16 h-16 text-base":"lg"===e,"w-20 h-20 text-2xl":"xl"===e,"w-32 h-32 text-3xl":"xxl"===e}),n=(e,t)=>r("absolute bottom-0 right-0 inline-block rounded-full",{"w-1.5 h-1.5":"xs"===t||"xxs"===t,"w-2 h-2":"sm"===t,"w-3 h-3":"base"===t,"w-4 h-4":"lg"===t,"w-5 h-5":"xl"===t,"w-8 h-8":"xxl"===t,"bg-success-600 rounded-full":"in"===e,"bg-neutral-400 rounded-full":"out"===e,"bg-error-500 rounded-full":"absent"===e}),o=({name:t,size:l="base"})=>e.createElement("div",{className:r(a(l))},t?t.split(" ").map(e=>e.match(/[A-Za-z]/)).slice(0,3).join("").toUpperCase():e.createElement(s,{iconName:"user",size:l,className:r("fill-white flex justify-center items-center")})),i=({name:s,imageHref:i,size:m,presence:c})=>{const x=function(e){const[r,s]=t({loaded:!1,error:!1,image:null});return l(()=>{const t=new Image;t.onload=()=>{s({loaded:!0,error:!1,image:t})},t.onerror=()=>{s({loaded:!1,error:!0,image:null})},t.src=e},[e]),r}(i);return e.createElement("div",{className:r("relative inline-block")},x.loaded?e.createElement("img",{src:i,title:`${s}'s profile`,className:r("max-w-none inline object-cover rounded-full",a(m)),alt:`${s}'s profile`}):e.createElement(o,{name:s,size:m}),c&&e.createElement("span",{className:r(n(c,m))}," "))};export{i as default}; | ||
//# sourceMappingURL=index.modern.js.map |
@@ -1,2 +0,2 @@ | ||
import*as e from"react";import t from"classnames";import r from"@brighthr/component-icon";var n=function(e){return t("bg-primary-400 text-white rounded-full flex justify-center items-center",{"w-5 h-5 text-xs":"xs"===e||"xxs"===e,"w-9 h-9 text-xs":"sm"===e,"w-12 h-12 text-base":"base"===e,"w-16 h-16 text-base":"lg"===e,"w-20 h-20 text-2xl":"xl"===e,"w-32 h-32 text-3xl":"xxl"===e})},l=function(e,r){return t("absolute bottom-0 right-0 inline-block rounded-full",{"w-1.5 h-1.5":"xs"===r||"xxs"===r,"w-2 h-2":"sm"===r,"w-3 h-3":"base"===r,"w-4 h-4":"lg"===r,"w-5 h-5":"xl"===r,"w-8 h-8":"xxl"===r,"bg-success-600 rounded-full":"in"===e,"bg-neutral-400 rounded-full":"out"===e,"bg-error-500 rounded-full":"absent"===e})},s=function(l){var s=l.name,a=l.size,i=void 0===a?"base":a;return e.createElement("div",{className:t(n(i))},s?s.split(" ").map(function(e){return e.match(/[A-Za-z]/)}).slice(0,3).join("").toUpperCase():e.createElement(r,{iconName:"user",size:i,className:t("fill-white flex justify-center items-center")}))},a=function(r){var a=r.name,i=r.imageHref,o=r.size,c=r.presence;return e.createElement("div",{className:t("relative inline-block")},i?e.createElement("img",{src:i,title:a+"'s profile",className:t("max-w-none inline object-cover rounded-full",n(o)),alt:a+"'s profile"}):e.createElement(s,{name:a,size:o}),c&&e.createElement("span",{className:t(l(c,o))}," "))};export{a as default}; | ||
import e,{useState as t,useEffect as r}from"react";import n from"classnames";import l from"@brighthr/component-icon";var a=function(e){return n("bg-primary-400 text-white rounded-full flex justify-center items-center",{"w-5 h-5 text-xs":"xs"===e||"xxs"===e,"w-9 h-9 text-xs":"sm"===e,"w-12 h-12 text-base":"base"===e,"w-16 h-16 text-base":"lg"===e,"w-20 h-20 text-2xl":"xl"===e,"w-32 h-32 text-3xl":"xxl"===e})},o=function(e,t){return n("absolute bottom-0 right-0 inline-block rounded-full",{"w-1.5 h-1.5":"xs"===t||"xxs"===t,"w-2 h-2":"sm"===t,"w-3 h-3":"base"===t,"w-4 h-4":"lg"===t,"w-5 h-5":"xl"===t,"w-8 h-8":"xxl"===t,"bg-success-600 rounded-full":"in"===e,"bg-neutral-400 rounded-full":"out"===e,"bg-error-500 rounded-full":"absent"===e})},s=function(t){var r=t.name,o=t.size,s=void 0===o?"base":o;return e.createElement("div",{className:n(a(s))},r?r.split(" ").map(function(e){return e.match(/[A-Za-z]/)}).slice(0,3).join("").toUpperCase():e.createElement(l,{iconName:"user",size:s,className:n("fill-white flex justify-center items-center")}))},i=function(l){var i,c,m,u,x=l.name,f=l.imageHref,d=l.size,h=l.presence,b=(i=f,m=(c=t({loaded:!1,error:!1,image:null}))[0],u=c[1],r(function(){var e=new Image;e.onload=function(){u({loaded:!0,error:!1,image:e})},e.onerror=function(){u({loaded:!1,error:!0,image:null})},e.src=i},[i]),m);return e.createElement("div",{className:n("relative inline-block")},b.loaded?e.createElement("img",{src:f,title:x+"'s profile",className:n("max-w-none inline object-cover rounded-full",a(d)),alt:x+"'s profile"}):e.createElement(s,{name:x,size:d}),h&&e.createElement("span",{className:n(o(h,d))}," "))};export{i as default}; | ||
//# sourceMappingURL=index.module.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("classnames"),require("@brighthr/component-icon")):"function"==typeof define&&define.amd?define(["react","classnames","@brighthr/component-icon"],t):(e||self).componentAvatar=t(e.react,e.classnames,e.Icon)}(this,function(e,t,n){function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function l(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t}var a=/*#__PURE__*/l(e),i=/*#__PURE__*/r(t),s=/*#__PURE__*/r(n),u=function(e){return i.default("bg-primary-400 text-white rounded-full flex justify-center items-center",{"w-5 h-5 text-xs":"xs"===e||"xxs"===e,"w-9 h-9 text-xs":"sm"===e,"w-12 h-12 text-base":"base"===e,"w-16 h-16 text-base":"lg"===e,"w-20 h-20 text-2xl":"xl"===e,"w-32 h-32 text-3xl":"xxl"===e})},o=function(e,t){return i.default("absolute bottom-0 right-0 inline-block rounded-full",{"w-1.5 h-1.5":"xs"===t||"xxs"===t,"w-2 h-2":"sm"===t,"w-3 h-3":"base"===t,"w-4 h-4":"lg"===t,"w-5 h-5":"xl"===t,"w-8 h-8":"xxl"===t,"bg-success-600 rounded-full":"in"===e,"bg-neutral-400 rounded-full":"out"===e,"bg-error-500 rounded-full":"absent"===e})},c=function(e){var t=e.name,n=e.size,r=void 0===n?"base":n;return a.createElement("div",{className:i.default(u(r))},t?t.split(" ").map(function(e){return e.match(/[A-Za-z]/)}).slice(0,3).join("").toUpperCase():a.createElement(s.default,{iconName:"user",size:r,className:i.default("fill-white flex justify-center items-center")}))};return function(e){var t=e.name,n=e.imageHref,r=e.size,l=e.presence;return a.createElement("div",{className:i.default("relative inline-block")},n?a.createElement("img",{src:n,title:t+"'s profile",className:i.default("max-w-none inline object-cover rounded-full",u(r)),alt:t+"'s profile"}):a.createElement(c,{name:t,size:r}),l&&a.createElement("span",{className:i.default(o(l,r))}," "))}}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("classnames"),require("@brighthr/component-icon")):"function"==typeof define&&define.amd?define(["react","classnames","@brighthr/component-icon"],t):(e||self).componentAvatar=t(e.react,e.classnames,e.Icon)}(this,function(e,t,n){function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=/*#__PURE__*/l(e),r=/*#__PURE__*/l(t),o=/*#__PURE__*/l(n),u=function(e){return r.default("bg-primary-400 text-white rounded-full flex justify-center items-center",{"w-5 h-5 text-xs":"xs"===e||"xxs"===e,"w-9 h-9 text-xs":"sm"===e,"w-12 h-12 text-base":"base"===e,"w-16 h-16 text-base":"lg"===e,"w-20 h-20 text-2xl":"xl"===e,"w-32 h-32 text-3xl":"xxl"===e})},i=function(e,t){return r.default("absolute bottom-0 right-0 inline-block rounded-full",{"w-1.5 h-1.5":"xs"===t||"xxs"===t,"w-2 h-2":"sm"===t,"w-3 h-3":"base"===t,"w-4 h-4":"lg"===t,"w-5 h-5":"xl"===t,"w-8 h-8":"xxl"===t,"bg-success-600 rounded-full":"in"===e,"bg-neutral-400 rounded-full":"out"===e,"bg-error-500 rounded-full":"absent"===e})},s=function(e){var t=e.name,n=e.size,l=void 0===n?"base":n;return a.default.createElement("div",{className:r.default(u(l))},t?t.split(" ").map(function(e){return e.match(/[A-Za-z]/)}).slice(0,3).join("").toUpperCase():a.default.createElement(o.default,{iconName:"user",size:l,className:r.default("fill-white flex justify-center items-center")}))};return function(t){var n,l,o,f,c=t.name,d=t.imageHref,m=t.size,x=t.presence,h=(n=d,o=(l=e.useState({loaded:!1,error:!1,image:null}))[0],f=l[1],e.useEffect(function(){var e=new Image;e.onload=function(){f({loaded:!0,error:!1,image:e})},e.onerror=function(){f({loaded:!1,error:!0,image:null})},e.src=n},[n]),o);return a.default.createElement("div",{className:r.default("relative inline-block")},h.loaded?a.default.createElement("img",{src:d,title:c+"'s profile",className:r.default("max-w-none inline object-cover rounded-full",u(m)),alt:c+"'s profile"}):a.default.createElement(s,{name:c,size:m}),x&&a.default.createElement("span",{className:r.default(i(x,m))}," "))}}); | ||
//# sourceMappingURL=index.umd.js.map |
{ | ||
"name": "@brighthr/component-avatar", | ||
"version": "0.0.18", | ||
"version": "0.0.19", | ||
"license": "MIT", | ||
@@ -40,3 +40,3 @@ "type": "module", | ||
}, | ||
"gitHead": "ad81d3c429e737a5367966752f289bb2d6ebbda8" | ||
"gitHead": "e9820abc0ae5a09ef19510a88edf49a5db73ad6f" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
47796
310