@grasco/profile-picture 0.2.6 → 0.2.7
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/angular.cjs +144 -63
- package/dist/angular.cjs.map +1 -1
- package/dist/angular.d.cts +2 -0
- package/dist/angular.d.ts +2 -0
- package/dist/angular.js +144 -63
- package/dist/angular.js.map +1 -1
- package/dist/index.cjs +130 -49
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +130 -49
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +129 -48
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +2 -0
- package/dist/react.d.ts +2 -0
- package/dist/react.js +129 -48
- package/dist/react.js.map +1 -1
- package/dist/standalone.d.ts +2 -0
- package/dist/standalone.standalone.js +161 -80
- package/dist/standalone.standalone.js.map +1 -1
- package/dist/svelte.cjs +144 -63
- package/dist/svelte.cjs.map +1 -1
- package/dist/svelte.d.cts +2 -0
- package/dist/svelte.d.ts +2 -0
- package/dist/svelte.js +144 -63
- package/dist/svelte.js.map +1 -1
- package/dist/vue.cjs +144 -63
- package/dist/vue.cjs.map +1 -1
- package/dist/vue.d.cts +2 -0
- package/dist/vue.d.ts +2 -0
- package/dist/vue.js +144 -63
- package/dist/vue.js.map +1 -1
- package/package.json +1 -1
package/dist/angular.d.cts
CHANGED
|
@@ -40,6 +40,8 @@ interface BadgeConfig {
|
|
|
40
40
|
max?: number;
|
|
41
41
|
/** Icon to display before content (emoji, Unicode symbol, or text) */
|
|
42
42
|
icon?: string;
|
|
43
|
+
/** Scale multiplier for badge size (default: 1) */
|
|
44
|
+
scale?: number;
|
|
43
45
|
}
|
|
44
46
|
interface GlowConfig {
|
|
45
47
|
/** Glow color (defaults to border or bg color) */
|
package/dist/angular.d.ts
CHANGED
|
@@ -40,6 +40,8 @@ interface BadgeConfig {
|
|
|
40
40
|
max?: number;
|
|
41
41
|
/** Icon to display before content (emoji, Unicode symbol, or text) */
|
|
42
42
|
icon?: string;
|
|
43
|
+
/** Scale multiplier for badge size (default: 1) */
|
|
44
|
+
scale?: number;
|
|
43
45
|
}
|
|
44
46
|
interface GlowConfig {
|
|
45
47
|
/** Glow color (defaults to border or bg color) */
|
package/dist/angular.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {LitElement,nothing,html,render}from'lit';import {property,state}from'lit/decorators.js';import {styleMap}from'lit/directives/style-map.js';var
|
|
1
|
+
import {LitElement,nothing,html,render}from'lit';import {property,state}from'lit/decorators.js';import {styleMap}from'lit/directives/style-map.js';var $e=Object.defineProperty;var s=(r,n,e,t)=>{for(var o=void 0,i=r.length-1,d;i>=0;i--)(d=r[i])&&(o=(d(n,e,o))||o);return o&&$e(n,e,o),o};var W="grasco-profile-picture-styles",T=false,Z=false;function Q(){if(T||typeof document>"u")return;if(document.getElementById(W)){T=true;return}if(document.querySelector('link[href*="profile-picture"][href$="styles.css"]')){T=true;return}Z||(Z=true,Me());}function Me(){(typeof requestIdleCallback<"u"?requestIdleCallback:n=>setTimeout(n,1))(()=>ze());}function ze(){if(T||typeof document>"u")return;if(document.getElementById(W)){T=true;return}let r=Ee();if(!r)return;let n=document.createElement("link");n.id=W,n.rel="stylesheet",n.href=r,document.head.appendChild(n),T=true;}function Ee(){if(typeof window<"u"&&window.__GRASCO_PROFILE_PICTURE_CSS__)return window.__GRASCO_PROFILE_PICTURE_CSS__;try{let n=import.meta.url;if(n)return `${n.substring(0,n.lastIndexOf("/")+1)}styles.css`}catch{}let r=document.currentScript;if(r?.src){let n=new URL(r.src);return `${n.href.substring(0,n.href.lastIndexOf("/")+1)}dist/styles.css`}return null}var D={"2xs":20,xs:24,sm:32,md:40,lg:48,xl:64,"2xl":80,"3xl":120},_={online:"#30D158",away:"#FFD60A",busy:"#FF453A",offline:"#8E8E93",dnd:"#FF453A"},ee={none:"none",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",glow:"0 0 20px 0 rgba(99, 102, 241, 0.3)"},y={size:"md",variant:"circle",loading:"lazy",placeholder:"shimmer",borderWidth:2,borderColor:"#ffffff",placeholderColor:"#f3f4f6",shadow:"sm",zoom:1.2};var A={circle:"9999px",rounded:"12px",squircle:"30%",square:"0px"},I={max:4,direction:"ltr",overlap:.3,size:"md",tooltipDelay:300,dropdownMaxHeight:280,animated:true};function M(...r){return r.filter(Boolean).join(" ")}function re(r){return /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(r)}function G(r){let e=r.trim().replace(/[^\w\s]/g,"").split(/\s+/).filter(Boolean);return e.length===0?"?":e.length===1?e[0].slice(0,1).toUpperCase():(e[0][0]+(e.at(-1)?.[0]??"")).toUpperCase()}function V(r){return Math.round(r*.38)}function oe(r,n){let e;if(n){let o=Math.round(r*.31);e=Math.min(24,Math.max(14,o));}else {let o=Math.round(r*.22);e=Math.min(14,Math.max(8,o));}let t=Math.max(9,Math.round(e*.55));return {size:e,fontSize:t}}function ne(r,n){let e=Math.min(16,Math.max(8,Math.round(r*.2)));return Math.min(18,e+(n-1)*2)}function ie(r,n){return typeof r=="string"?r:n&&r>n?`${n}+`:r.toString()}function ae(r){return r.length===0?"transparent":r.length===1?r[0]:`conic-gradient(${r.map((e,t)=>{let o=t/r.length*360,i=(t+1)/r.length*360;return `${e} ${o}deg ${i}deg`}).join(", ")})`}function L(r){let n=0;for(let e=0;e<r.length;e++){let t=r.charCodeAt(e);n=(n<<5)-n+t,n&=n;}return Math.abs(n)}function se(r,n,e){let o=Math.max(0,Math.min(100,r))/100*360;return `conic-gradient(from 270deg, ${n} 0deg ${o}deg, ${e} ${o}deg 360deg)`}function F(r){let n=["linear-gradient(135deg, #667eea 0%, #764ba2 100%)","linear-gradient(135deg, #f093fb 0%, #f5576c 100%)","linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)","linear-gradient(135deg, #43e97b 0%, #38f9d7 100%)","linear-gradient(135deg, #fa709a 0%, #fee140 100%)","linear-gradient(135deg, #a8edea 0%, #fed6e3 100%)","linear-gradient(135deg, #d299c2 0%, #fef9d7 100%)","linear-gradient(135deg, #89f7fe 0%, #66a6ff 100%)","linear-gradient(135deg, #cd9cf2 0%, #f6f3ff 100%)","linear-gradient(135deg, #fddb92 0%, #d1fdff 100%)"],e=L(r)%n.length;return n[e]}var te=[["oklch(70% 0.18 30)","oklch(65% 0.20 350)","oklch(60% 0.22 280)"],["oklch(72% 0.16 15)","oklch(68% 0.19 45)","oklch(62% 0.15 280)"],["oklch(70% 0.15 310)","oklch(65% 0.18 280)","oklch(75% 0.12 340)"],["oklch(70% 0.14 220)","oklch(65% 0.18 200)","oklch(60% 0.20 280)"],["oklch(75% 0.16 70)","oklch(68% 0.20 40)","oklch(65% 0.14 320)"],["oklch(68% 0.18 280)","oklch(72% 0.15 310)","oklch(65% 0.20 340)"],["oklch(70% 0.15 175)","oklch(65% 0.18 200)","oklch(60% 0.20 260)"],["oklch(72% 0.14 350)","oklch(68% 0.16 310)","oklch(75% 0.10 220)"],["oklch(72% 0.18 85)","oklch(65% 0.20 55)","oklch(60% 0.16 310)"],["oklch(70% 0.14 155)","oklch(68% 0.16 130)","oklch(72% 0.12 80)"],["oklch(65% 0.20 340)","oklch(70% 0.16 310)","oklch(62% 0.18 270)"],["oklch(75% 0.18 90)","oklch(68% 0.16 60)","oklch(62% 0.14 310)"]],Te="oklch(95% 0.02 264)";function pe(r,n){let e=L(r),t=te[e%te.length],o=L(r+"orb1"),i=L(r+"orb2"),d=15+e%41,l=60+(e>>3)%21,p=35+o%31,c=65+(o>>3)%21,g=70+i%21,h=10+(i>>3)%31,E=Te,U=n<50?Math.max(n*.008,1):Math.max(n*.015,4),m=n<50?Math.max(n*.004,1.2):Math.max(n*.008,1.5),w=n<50?Math.max(n*.004,.5):Math.max(n*.008,2),$;return n<30?$=1.1:n<50?$=Math.max(m*1.2,1.3):$=m,{"--pp-cloud-bg":E,"--pp-cloud-c1":t[0],"--pp-cloud-c2":t[1],"--pp-cloud-c3":t[2],"--pp-cloud-blur":`${U}px`,"--pp-cloud-contrast":`${$}`,"--pp-cloud-shadow":`${w}px`,"--pp-cloud-p1":`${d}% ${l}%`,"--pp-cloud-p2":`${p}% ${c}%`,"--pp-cloud-p3":`${g}% ${h}%`}}function de(r){return typeof r=="number"?r:D[r]??D[I.size]}function q(r,n,e){let t=e?n-1:n;if(r<=t)return {visible:r,hidden:0,showCounter:false};let o=t-1,i=r-o;return {visible:o,hidden:i,showCounter:true}}function N(r,n,e,t,o){let i=o??n*(1-e);return r*i}function le(r,n,e){return e==="ltr"?n-r:r+1}function ce(r,n,e,t){if(r===0)return 0;if(r===1)return n;let o=t??n*(1-e);return n+o*(r-1)}function ue(r){return r>99?"+99":`+${r}`}function ge(r){return r<=80?"120":r<=120?"240":r<=240?"480":("960")}function fe(r,n,e,t,o){let i=r.endsWith("/")?r.slice(0,-1):r,d=`${n}_${e}_${t}.webp`;return `${i}/profile-picture/cdn/${d}?hostname=${o}`}function he(r){return {circle:"np:rounded-full",rounded:"np:rounded-xl",squircle:"np:rounded-[30%]",square:"np:rounded-none"}[r]}function be(r,n){return {className:{1:"np:border",2:"np:border-2",3:"np:border-[3px]",4:"np:border-4",5:"np:border-[5px]",6:"np:border-[6px]",8:"np:border-8"}[r],style:{borderColor:n,borderStyle:"solid"}}}function me(r,n){return n?{className:"",style:{background:n}}:r?r.includes("gradient")?{className:"",style:{background:r}}:{className:"",style:{backgroundColor:r}}:{className:"",style:{backgroundColor:"transparent"}}}function xe(r){return {boxShadow:ee[r]}}var De={shimmer:`
|
|
2
2
|
@keyframes pp-shimmer {
|
|
3
3
|
0% { transform: translateX(-100%); }
|
|
4
4
|
100% { transform: translateX(100%); }
|
|
@@ -36,8 +36,17 @@ import {LitElement,nothing,html,render}from'lit';import {property,state}from'lit
|
|
|
36
36
|
0% { transform: scale(0.8); opacity: 0; }
|
|
37
37
|
50% { transform: scale(1.05); }
|
|
38
38
|
100% { transform: scale(1); opacity: 1; }
|
|
39
|
-
}
|
|
40
|
-
|
|
39
|
+
}`,cloudRotate:`
|
|
40
|
+
@property --pp-cloud-angle {
|
|
41
|
+
syntax: "<angle>";
|
|
42
|
+
inherits: false;
|
|
43
|
+
initial-value: 0deg;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@keyframes pp-cloud-rotate {
|
|
47
|
+
to { --pp-cloud-angle: 360deg; }
|
|
48
|
+
}`},Ae=Object.values(De).join(`
|
|
49
|
+
`),Re=`
|
|
41
50
|
/* Profile Picture Component Styles */
|
|
42
51
|
.pp-container {
|
|
43
52
|
--pp-transition-duration: 200ms;
|
|
@@ -117,6 +126,77 @@ import {LitElement,nothing,html,render}from'lit';import {property,state}from'lit
|
|
|
117
126
|
color: rgba(156, 163, 175, 0.8);
|
|
118
127
|
}
|
|
119
128
|
|
|
129
|
+
/* Cloudy orb background (animated conic gradients with blur + contrast) */
|
|
130
|
+
.pp-cloudy-bg {
|
|
131
|
+
display: grid;
|
|
132
|
+
grid-template-areas: "stack";
|
|
133
|
+
overflow: hidden;
|
|
134
|
+
border-radius: inherit;
|
|
135
|
+
position: absolute;
|
|
136
|
+
inset: 0;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.pp-cloudy-bg::before,
|
|
140
|
+
.pp-cloudy-bg::after {
|
|
141
|
+
content: "";
|
|
142
|
+
display: block;
|
|
143
|
+
grid-area: stack;
|
|
144
|
+
width: 100%;
|
|
145
|
+
height: 100%;
|
|
146
|
+
border-radius: inherit;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.pp-cloudy-bg::before {
|
|
150
|
+
background:
|
|
151
|
+
conic-gradient(
|
|
152
|
+
from calc(var(--pp-cloud-angle) * 2) at var(--pp-cloud-p1),
|
|
153
|
+
var(--pp-cloud-c3),
|
|
154
|
+
transparent 20% 80%,
|
|
155
|
+
var(--pp-cloud-c3)
|
|
156
|
+
),
|
|
157
|
+
conic-gradient(
|
|
158
|
+
from calc(var(--pp-cloud-angle) * 2) at var(--pp-cloud-p2),
|
|
159
|
+
var(--pp-cloud-c2),
|
|
160
|
+
transparent 30% 60%,
|
|
161
|
+
var(--pp-cloud-c2)
|
|
162
|
+
),
|
|
163
|
+
conic-gradient(
|
|
164
|
+
from calc(var(--pp-cloud-angle) * -3) at var(--pp-cloud-p3),
|
|
165
|
+
var(--pp-cloud-c1),
|
|
166
|
+
transparent 40% 60%,
|
|
167
|
+
var(--pp-cloud-c1)
|
|
168
|
+
),
|
|
169
|
+
conic-gradient(
|
|
170
|
+
from calc(var(--pp-cloud-angle) * 2) at 15% 5%,
|
|
171
|
+
var(--pp-cloud-c2),
|
|
172
|
+
transparent 10% 90%,
|
|
173
|
+
var(--pp-cloud-c2)
|
|
174
|
+
),
|
|
175
|
+
conic-gradient(
|
|
176
|
+
from calc(var(--pp-cloud-angle) * 1) at 20% 80%,
|
|
177
|
+
var(--pp-cloud-c1),
|
|
178
|
+
transparent 10% 90%,
|
|
179
|
+
var(--pp-cloud-c1)
|
|
180
|
+
),
|
|
181
|
+
conic-gradient(
|
|
182
|
+
from calc(var(--pp-cloud-angle) * -2) at 85% 10%,
|
|
183
|
+
var(--pp-cloud-c3),
|
|
184
|
+
transparent 20% 80%,
|
|
185
|
+
var(--pp-cloud-c3)
|
|
186
|
+
);
|
|
187
|
+
box-shadow: inset var(--pp-cloud-bg) 0 0 var(--pp-cloud-shadow)
|
|
188
|
+
calc(var(--pp-cloud-shadow) * 0.2);
|
|
189
|
+
filter: blur(var(--pp-cloud-blur)) contrast(var(--pp-cloud-contrast));
|
|
190
|
+
animation: pp-cloud-rotate 20s linear infinite;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.pp-cloudy-bg::after {
|
|
194
|
+
backdrop-filter: blur(calc(var(--pp-cloud-blur) * 1.5));
|
|
195
|
+
mix-blend-mode: overlay;
|
|
196
|
+
background: var(--pp-cloud-bg);
|
|
197
|
+
opacity: 0.15;
|
|
198
|
+
}
|
|
199
|
+
|
|
120
200
|
/* Shimmer placeholder */
|
|
121
201
|
.pp-shimmer {
|
|
122
202
|
position: absolute;
|
|
@@ -236,13 +316,14 @@ import {LitElement,nothing,html,render}from'lit';import {property,state}from'lit
|
|
|
236
316
|
.pp-badge,
|
|
237
317
|
.pp-ring-animated,
|
|
238
318
|
.pp-presence-animated,
|
|
239
|
-
.pp-glow
|
|
319
|
+
.pp-glow,
|
|
320
|
+
.pp-cloudy-bg::before {
|
|
240
321
|
animation: none !important;
|
|
241
322
|
transition: none !important;
|
|
242
323
|
}
|
|
243
324
|
}
|
|
244
|
-
`,
|
|
245
|
-
${
|
|
325
|
+
`,ve=`${Ae}
|
|
326
|
+
${Re}`,we=`
|
|
246
327
|
@keyframes np-shimmer {
|
|
247
328
|
0% { background-position: -200% 0; }
|
|
248
329
|
100% { background-position: 200% 0; }
|
|
@@ -252,7 +333,7 @@ ${Te}`,we=`
|
|
|
252
333
|
background-size: 200% 100%;
|
|
253
334
|
animation: np-shimmer 1.5s infinite;
|
|
254
335
|
}
|
|
255
|
-
`;function
|
|
336
|
+
`;function ye(r,n=.3){if(re(r)){let e=Number.parseInt(r.slice(1,3),16),t=Number.parseInt(r.slice(3,5),16),o=Number.parseInt(r.slice(5,7),16);return `0 0 20px 0 rgba(${e}, ${t}, ${o}, ${n})`}return `0 0 20px 0 ${r}`}var Ue=`
|
|
256
337
|
@keyframes ppg-tooltip-in {
|
|
257
338
|
from {
|
|
258
339
|
opacity: 0;
|
|
@@ -303,7 +384,7 @@ ${Te}`,we=`
|
|
|
303
384
|
opacity: 1;
|
|
304
385
|
}
|
|
305
386
|
}
|
|
306
|
-
`,
|
|
387
|
+
`,Be=`
|
|
307
388
|
/* Profile Picture Group Container */
|
|
308
389
|
.ppg-container {
|
|
309
390
|
--ppg-transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
@@ -748,29 +829,29 @@ ${Te}`,we=`
|
|
|
748
829
|
box-shadow: 0 0 0 1.5px rgba(44, 44, 46, 0.95), 0 0 6px rgba(48, 209, 88, 0.5);
|
|
749
830
|
}
|
|
750
831
|
}
|
|
751
|
-
`,
|
|
752
|
-
${
|
|
832
|
+
`,Ce=`${Ue}
|
|
833
|
+
${Be}`;var a=class a extends LitElement{constructor(){super(...arguments);this.src="";this.alt="";this.size=y.size;this.variant=y.variant;this.shadow=y.shadow;this.border=false;this.borderWidth=y.borderWidth;this.borderColor=y.borderColor;this.rotation=0;this.zoom=y.zoom;this.loading=y.loading;this.placeholder=y.placeholder;this.placeholderColor=y.placeholderColor;this.imageMode="original";this.isLoaded=false;this.hasError=false;this.cdnLoadFailed=false;this.previousSrc="";this.randomSeed=Math.random().toString(36).slice(2);this.RETRY_DELAY_MS=3e4;}static{this.stylesInjected=false;}static{this.cdnBaseUrl="";}static{this.instances=new Set;}static setCdnBaseUrl(e){a.cdnBaseUrl=e,a.instances.forEach(t=>{t.extCustomerId&&!t.cdnImageUrl&&(t.cdnLoadFailed=false,t.retryTimeoutId&&(clearTimeout(t.retryTimeoutId),t.retryTimeoutId=void 0),t.previousExtCustomerId||(t.previousExtCustomerId=t.extCustomerId),t.loadCdnImage());});}static getCdnBaseUrl(){return a.cdnBaseUrl}createRenderRoot(){return a.injectStylesOnce(),this}static injectStylesOnce(){if(a.stylesInjected||typeof document>"u")return;(typeof requestIdleCallback<"u"?requestIdleCallback:t=>setTimeout(t,1))(()=>{if(a.stylesInjected)return;let t=document.createElement("style");t.textContent=ve,document.head.appendChild(t),a.stylesInjected=true;});}resolveObjectProp(e){if(e){if(typeof e=="string")try{return JSON.parse(e)}catch{return}return e}}get pixelSize(){let e=this.size;return typeof e=="number"?e:D[e]??D[y.size]}get gradientSeed(){return this.extCustomerId||this.alt||this.src||this.randomSeed}connectedCallback(){super.connectedCallback(),a.instances.add(this);}disconnectedCallback(){super.disconnectedCallback(),a.instances.delete(this),this.retryTimeoutId&&(clearTimeout(this.retryTimeoutId),this.retryTimeoutId=void 0);}firstUpdated(){this.extCustomerId&&a.cdnBaseUrl&&(this.previousExtCustomerId=this.extCustomerId,this.loadCdnImage());}updated(e){if(super.updated(e),this.extCustomerId&&a.cdnBaseUrl&&!this.cdnImageUrl&&!this.previousExtCustomerId&&(this.previousExtCustomerId=this.extCustomerId,this.cdnLoadFailed=false,this.loadCdnImage()),!this.isLoaded&&!this.hasError){let t=this.querySelector("img.pp-image");t?.complete&&t.naturalWidth>0&&(this.isLoaded=true);}}willUpdate(e){e.has("src")&&this.src!==this.previousSrc&&(this.previousSrc=this.src,this.cdnImageUrl||(this.isLoaded=false,this.hasError=false));let t=e.has("extCustomerId")&&this.extCustomerId!==this.previousExtCustomerId,o=e.has("size")||e.has("imageMode");if(t||o&&this.extCustomerId){this.previousExtCustomerId=this.extCustomerId;let i=this.cdnImageUrl;this.cdnImageUrl=void 0,this.cdnLoadFailed=false,this.retryTimeoutId&&(clearTimeout(this.retryTimeoutId),this.retryTimeoutId=void 0),this.loadCdnImage(),this.cdnImageUrl!==i&&(this.isLoaded=false,this.hasError=false);}}handleLoad(){this.isLoaded=true,this.dispatchEvent(new CustomEvent("load",{bubbles:true,composed:true}));}handleClick(e){this.resolveObjectProp(this.interactive)?.pressable&&this.dispatchEvent(new CustomEvent("profile-picture-click",{bubbles:true,composed:true,detail:{extCustomerId:this.extCustomerId,alt:this.alt,src:this.src}}));}handleKeyDown(e){this.resolveObjectProp(this.interactive)?.pressable&&(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.handleClick(e));}handleError(){if(this.cdnImageUrl&&!this.cdnLoadFailed){this.cdnLoadFailed=true,this.cdnImageUrl=void 0,this.dispatchEvent(new CustomEvent("cdn-error",{bubbles:true,composed:true,detail:{error:"Image load failed"}})),this.retryTimeoutId&&clearTimeout(this.retryTimeoutId),this.retryTimeoutId=setTimeout(()=>{this.retryTimeoutId=void 0,this.extCustomerId&&a.cdnBaseUrl&&(this.cdnLoadFailed=false,this.hasError=false,this.isLoaded=false,this.loadCdnImage());},this.RETRY_DELAY_MS);return}this.hasError=true,this.isLoaded=true,this.dispatchEvent(new CustomEvent("error",{bubbles:true,composed:true}));}loadCdnImage(){if(!(this.extCustomerId&&a.cdnBaseUrl)){this.cdnLoadFailed=true;return}let e=ge(this.pixelSize),t=typeof window<"u"?window.location.hostname:"localhost";this.cdnImageUrl=fe(a.cdnBaseUrl,this.extCustomerId,e,this.imageMode,t);}getContainerStyles(){let e=me(this.bgColor,this.bgGradient),t=this.border?be(this.borderWidth,this.borderColor):null,o=xe(this.shadow),i=this.resolveObjectProp(this.glow),d={};if(i){let c=i.color??this.borderColor??"#6366f1";d={"--pp-glow-color":c,boxShadow:ye(c,i.intensity??.3)};}let l=this.resolveObjectProp(this.interactive),p=l?.hoverable||l?.pressable;return {classes:M("pp-container",he(this.variant),t?.className,p&&"pp-interactive",i?.animate&&"pp-glow"),styles:{width:`${this.pixelSize}px`,height:`${this.pixelSize}px`,borderRadius:A[this.variant],...t?.style,...o,...d,cursor:l?.cursor??(p?"pointer":"default"),transform:this.rotation?`rotate(${this.rotation}deg)`:void 0},innerStyles:e.style??{},innerClasses:e.className}}renderPlaceholder(){if(this.isLoaded||this.placeholder==="none")return nothing;let e={shimmer:"pp-shimmer",pulse:"pp-pulse",skeleton:"pp-skeleton",blur:"",none:""}[this.placeholder];return html`
|
|
753
834
|
${this.placeholder==="shimmer"?html`<style>${we}</style>`:nothing}
|
|
754
835
|
<div
|
|
755
|
-
class=${
|
|
836
|
+
class=${M("np:absolute np:inset-0",e)}
|
|
756
837
|
style=${styleMap({backgroundColor:this.placeholderColor,borderRadius:"inherit"})}>
|
|
757
838
|
</div>
|
|
758
|
-
`}renderFallback(){let e=!!(this.bgColor||this.bgGradient);if(this.fallbackMode==="gradient"){let
|
|
839
|
+
`}renderFallback(){let e=!!(this.bgColor||this.bgGradient);if(this.fallbackMode==="gradient"){if(e)return html`<div class="pp-fallback np:absolute np:inset-0"></div>`;let o=pe(this.gradientSeed,this.pixelSize);return html`
|
|
759
840
|
<div
|
|
760
|
-
class="pp-
|
|
761
|
-
style=${styleMap(
|
|
841
|
+
class="pp-cloudy-bg"
|
|
842
|
+
style=${styleMap(o)}>
|
|
762
843
|
</div>
|
|
763
844
|
`}if(this.fallback)return html`
|
|
764
845
|
<span
|
|
765
846
|
class="pp-fallback"
|
|
766
|
-
style=${styleMap({fontSize:`${
|
|
847
|
+
style=${styleMap({fontSize:`${V(this.pixelSize)}px`})}>
|
|
767
848
|
${this.fallback}
|
|
768
849
|
</span>
|
|
769
|
-
`;if(this.alt){let
|
|
850
|
+
`;if(this.alt){let o=F(this.alt);return html`
|
|
770
851
|
<div
|
|
771
852
|
class="pp-fallback np:absolute np:inset-0"
|
|
772
|
-
style=${styleMap({background:e?"transparent":
|
|
773
|
-
${
|
|
853
|
+
style=${styleMap({background:e?"transparent":o,fontSize:`${V(this.pixelSize)}px`})}>
|
|
854
|
+
${G(this.alt)}
|
|
774
855
|
</div>
|
|
775
856
|
`}let t=this.pixelSize*.5;return html`
|
|
776
857
|
<svg
|
|
@@ -780,7 +861,7 @@ ${Ae}`;var a=class a extends LitElement{constructor(){super(...arguments);this.s
|
|
|
780
861
|
viewBox="0 0 24 24">
|
|
781
862
|
<path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z" />
|
|
782
863
|
</svg>
|
|
783
|
-
`}renderImage(){let e=!!(this.extCustomerId&&a.cdnBaseUrl),t;if(this.cdnImageUrl?t=this.cdnImageUrl:(!e||this.cdnLoadFailed)&&(t=this.src),this.hasError||!t)return this.renderFallback();let
|
|
864
|
+
`}renderImage(){let e=!!(this.extCustomerId&&a.cdnBaseUrl),t;if(this.cdnImageUrl?t=this.cdnImageUrl:(!e||this.cdnLoadFailed)&&(t=this.src),this.hasError||!t)return this.renderFallback();let o=this.zoom&&this.zoom!==1?styleMap({transform:`scale(${this.zoom})`}):nothing;return html`
|
|
784
865
|
<img
|
|
785
866
|
src=${t}
|
|
786
867
|
alt=${this.alt}
|
|
@@ -788,32 +869,32 @@ ${Ae}`;var a=class a extends LitElement{constructor(){super(...arguments);this.s
|
|
|
788
869
|
decoding="async"
|
|
789
870
|
@load=${this.handleLoad}
|
|
790
871
|
@error=${this.handleError}
|
|
791
|
-
class=${
|
|
792
|
-
style=${
|
|
872
|
+
class=${M("pp-image",this.isLoaded?"pp-image-loaded":"pp-image-loading")}
|
|
873
|
+
style=${o}
|
|
793
874
|
draggable="false" />
|
|
794
|
-
`}renderRing(){let e=this.resolveObjectProp(this.ring);if(!e?.show)return nothing;let t=e.width??3,
|
|
875
|
+
`}renderRing(){let e=this.resolveObjectProp(this.ring);if(!e?.show)return nothing;let t=e.width??3,o=e.gap??3,i=t+o,d,l=e.progress!==void 0;if(l){let p=e.progress??0,c=e.color??"#30D158",g=e.emptyColor??"#8E8E93";d=se(p,c,g);}else e.gradient&&e.gradient.length>0?d=ae(e.gradient):d=e.color??"linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888)";return html`
|
|
795
876
|
<div
|
|
796
|
-
class=${
|
|
797
|
-
style=${styleMap({inset:`-${i}px`,padding:`${t}px`,background:
|
|
877
|
+
class=${M("pp-ring",e.animate&&!l&&"pp-ring-animated",l&&"pp-ring-progress")}
|
|
878
|
+
style=${styleMap({inset:`-${i}px`,padding:`${t}px`,background:d,borderRadius:A[this.variant]})}>
|
|
798
879
|
</div>
|
|
799
|
-
`}getCornerOffset(){let e=this.pixelSize/2,
|
|
880
|
+
`}getCornerOffset(){let e=this.pixelSize/2,o={circle:1-Math.SQRT2/2,square:0,rounded:.04,squircle:.08}[this.variant];return e*o}renderPresence(){let e=this.resolveObjectProp(this.presence);if(!e)return nothing;let t=e.thickness??2,o=ne(this.pixelSize,t),i=_[e.status],l=this.getCornerOffset()-o/2;return html`
|
|
800
881
|
<div
|
|
801
|
-
class=${
|
|
802
|
-
style=${styleMap({width:`${
|
|
882
|
+
class=${M("pp-presence",e.animate&&"pp-presence-animated")}
|
|
883
|
+
style=${styleMap({width:`${o}px`,height:`${o}px`,backgroundColor:i,bottom:`${l}px`,right:`${l}px`,color:i})}
|
|
803
884
|
title=${e.status}>
|
|
804
885
|
</div>
|
|
805
|
-
`}renderBadge(){let e=this.resolveObjectProp(this.badge);if(!e)return nothing;let t=e.position??"bottom-right",
|
|
886
|
+
`}renderBadge(){let e=this.resolveObjectProp(this.badge);if(!e)return nothing;let t=e.position??"bottom-right",o=e.content!==void 0,i=e.icon!==void 0,d=o||i,l=e.scale??1,{size:p,fontSize:c}=oe(this.pixelSize,d),g=Math.round(p*l),h=Math.round(c*l),E=e.bgColor??"#22c55e",U=e.color??"#ffffff",m=e.borderRadius??"9999px",w=o&&e.content!==void 0?ie(e.content,e.max):null,$=i?e.icon:null,O=h*.9,x=`${this.getCornerOffset()-g/2}px`,ke={"top-left":{top:x,left:x},"top-center":{top:x,left:"50%",transform:"translateX(-50%)"},"top-right":{top:x,right:x},"bottom-left":{bottom:x,left:x},"bottom-center":{bottom:x,left:"50%",transform:"translateX(-50%)"},"bottom-right":{bottom:x,right:x}},Se=w?.length===1&&!i,H=d&&!Se;return html`
|
|
806
887
|
<div
|
|
807
|
-
class=${
|
|
808
|
-
style=${styleMap({width:
|
|
809
|
-
${
|
|
810
|
-
${
|
|
888
|
+
class=${M("pp-badge",e.pulse&&"pp-badge-pulse",e.glow&&"pp-badge-glow",i&&"pp-badge-with-icon")}
|
|
889
|
+
style=${styleMap({width:H?"auto":`${g}px`,minWidth:H?`${g}px`:"",height:`${g}px`,padding:H?"0 6px":"0",fontSize:`${h}px`,backgroundColor:E,color:U,borderRadius:m,"--pp-badge-glow-color":E,gap:i&&o?"4px":"0",...ke[t]})}>
|
|
890
|
+
${$?html`<span class="pp-badge-icon" style=${styleMap({fontSize:`${O}px`})}>${$}</span>`:nothing}
|
|
891
|
+
${w??nothing}
|
|
811
892
|
</div>
|
|
812
|
-
`}render(){let e=this.getContainerStyles(),t=this.resolveObjectProp(this.interactive),
|
|
893
|
+
`}render(){let e=this.getContainerStyles(),t=this.resolveObjectProp(this.interactive),o=t?.focusable||t?.pressable?0:void 0;return html`
|
|
813
894
|
<div
|
|
814
895
|
class=${e.classes}
|
|
815
896
|
style=${styleMap(e.styles)}
|
|
816
|
-
tabindex=${
|
|
897
|
+
tabindex=${o??nothing}
|
|
817
898
|
role=${t?.pressable?"button":nothing}
|
|
818
899
|
aria-label=${this.alt||nothing}
|
|
819
900
|
@click=${this.handleClick}
|
|
@@ -825,7 +906,7 @@ ${Ae}`;var a=class a extends LitElement{constructor(){super(...arguments);this.s
|
|
|
825
906
|
|
|
826
907
|
<!-- Inner container for image clipping -->
|
|
827
908
|
<div
|
|
828
|
-
class=${
|
|
909
|
+
class=${M("pp-inner",e.innerClasses)}
|
|
829
910
|
style=${styleMap({borderRadius:A[this.variant],...e.innerStyles})}>
|
|
830
911
|
<!-- Placeholder -->
|
|
831
912
|
${this.renderPlaceholder()}
|
|
@@ -840,7 +921,7 @@ ${Ae}`;var a=class a extends LitElement{constructor(){super(...arguments);this.s
|
|
|
840
921
|
<!-- Presence Indicator -->
|
|
841
922
|
${this.renderPresence()}
|
|
842
923
|
</div>
|
|
843
|
-
`}};s([property({type:String})],a.prototype,"src"),s([property({type:String})],a.prototype,"alt"),s([property({type:String,attribute:"ext-customer-id"})],a.prototype,"extCustomerId"),s([property({type:String})],a.prototype,"size"),s([property({type:String})],a.prototype,"variant"),s([property({type:String})],a.prototype,"shadow"),s([property({type:Boolean})],a.prototype,"border"),s([property({type:Number,attribute:"border-width"})],a.prototype,"borderWidth"),s([property({type:String,attribute:"border-color"})],a.prototype,"borderColor"),s([property({type:Number})],a.prototype,"rotation"),s([property({type:Number})],a.prototype,"zoom"),s([property({type:String,attribute:"bg-color"})],a.prototype,"bgColor"),s([property({type:String,attribute:"bg-gradient"})],a.prototype,"bgGradient"),s([property({type:Object,attribute:"ring",converter:{fromAttribute:e=>{if(e)try{return JSON.parse(e)}catch{return}},toAttribute:e=>e?JSON.stringify(e):null}})],a.prototype,"ring"),s([property({type:Object,attribute:"presence",converter:{fromAttribute:e=>{if(e)try{return JSON.parse(e)}catch{return}},toAttribute:e=>e?JSON.stringify(e):null}})],a.prototype,"presence"),s([property({type:Object,attribute:"glow",converter:{fromAttribute:e=>{if(e)try{return JSON.parse(e)}catch{return}},toAttribute:e=>e?JSON.stringify(e):null}})],a.prototype,"glow"),s([property({type:Object,attribute:"badge",converter:{fromAttribute:e=>{if(e)try{return JSON.parse(e)}catch{return}},toAttribute:e=>e?JSON.stringify(e):null}})],a.prototype,"badge"),s([property({type:String})],a.prototype,"loading"),s([property({type:String})],a.prototype,"placeholder"),s([property({type:String,attribute:"placeholder-color"})],a.prototype,"placeholderColor"),s([property({type:String})],a.prototype,"fallback"),s([property({type:String,attribute:"fallback-mode"})],a.prototype,"fallbackMode"),s([property({type:String,attribute:"image-mode"})],a.prototype,"imageMode"),s([property({type:Object,attribute:"interactive",converter:{fromAttribute:e=>{if(e)try{return JSON.parse(e)}catch{return}},toAttribute:e=>e?JSON.stringify(e):null}})],a.prototype,"interactive"),s([state()],a.prototype,"isLoaded"),s([state()],a.prototype,"hasError"),s([state()],a.prototype,"cdnImageUrl"),s([state()],a.prototype,"cdnLoadFailed");var R=a;customElements.get("profile-picture")||customElements.define("profile-picture",R);var K=false;function
|
|
924
|
+
`}};s([property({type:String})],a.prototype,"src"),s([property({type:String})],a.prototype,"alt"),s([property({type:String,attribute:"ext-customer-id"})],a.prototype,"extCustomerId"),s([property({type:String})],a.prototype,"size"),s([property({type:String})],a.prototype,"variant"),s([property({type:String})],a.prototype,"shadow"),s([property({type:Boolean})],a.prototype,"border"),s([property({type:Number,attribute:"border-width"})],a.prototype,"borderWidth"),s([property({type:String,attribute:"border-color"})],a.prototype,"borderColor"),s([property({type:Number})],a.prototype,"rotation"),s([property({type:Number})],a.prototype,"zoom"),s([property({type:String,attribute:"bg-color"})],a.prototype,"bgColor"),s([property({type:String,attribute:"bg-gradient"})],a.prototype,"bgGradient"),s([property({type:Object,attribute:"ring",converter:{fromAttribute:e=>{if(e)try{return JSON.parse(e)}catch{return}},toAttribute:e=>e?JSON.stringify(e):null}})],a.prototype,"ring"),s([property({type:Object,attribute:"presence",converter:{fromAttribute:e=>{if(e)try{return JSON.parse(e)}catch{return}},toAttribute:e=>e?JSON.stringify(e):null}})],a.prototype,"presence"),s([property({type:Object,attribute:"glow",converter:{fromAttribute:e=>{if(e)try{return JSON.parse(e)}catch{return}},toAttribute:e=>e?JSON.stringify(e):null}})],a.prototype,"glow"),s([property({type:Object,attribute:"badge",converter:{fromAttribute:e=>{if(e)try{return JSON.parse(e)}catch{return}},toAttribute:e=>e?JSON.stringify(e):null}})],a.prototype,"badge"),s([property({type:String})],a.prototype,"loading"),s([property({type:String})],a.prototype,"placeholder"),s([property({type:String,attribute:"placeholder-color"})],a.prototype,"placeholderColor"),s([property({type:String})],a.prototype,"fallback"),s([property({type:String,attribute:"fallback-mode"})],a.prototype,"fallbackMode"),s([property({type:String,attribute:"image-mode"})],a.prototype,"imageMode"),s([property({type:Object,attribute:"interactive",converter:{fromAttribute:e=>{if(e)try{return JSON.parse(e)}catch{return}},toAttribute:e=>e?JSON.stringify(e):null}})],a.prototype,"interactive"),s([state()],a.prototype,"isLoaded"),s([state()],a.prototype,"hasError"),s([state()],a.prototype,"cdnImageUrl"),s([state()],a.prototype,"cdnLoadFailed");var R=a;customElements.get("profile-picture")||customElements.define("profile-picture",R);var K=false;function Le(){if(K||typeof document>"u")return;(typeof requestIdleCallback<"u"?requestIdleCallback:n=>setTimeout(n,1))(()=>{if(K)return;let n=document.createElement("style");n.textContent=Ce,document.head.appendChild(n),K=true;});}var f=class extends LitElement{constructor(){super(...arguments);this.max=I.max;this.direction=I.direction;this.overlap=I.overlap;this.size=I.size;this.showAddButton=false;this.addButtonLabel="Add user";this.animated=I.animated;this.rotationAmount=0;this.users=[];this.dropdownOpen=false;this.tooltipData=null;this.tooltipTimeout=null;this.slotObserver=null;this.portalContainer=null;this.counterRef=null;this.handleBackdropClick=()=>{this.dropdownOpen=false,this.destroyPortal();};}createRenderRoot(){return Le(),this}get pixelSize(){return de(this.size)}get tooltipEnabled(){return this.tooltip?.enabled!==false}get tooltipPosition(){return this.tooltip?.position??"top"}get tooltipDelay(){return this.tooltip?.delay??I.tooltipDelay}get dropdownMaxHeight(){return this.dropdown?.maxHeight??I.dropdownMaxHeight}get showPresence(){return this.dropdown?.showPresence!==false}get dropdownPosition(){return this.dropdown?.position??"bottom"}connectedCallback(){super.connectedCallback(),this.updateUsers(),this.setupSlotObserver();}disconnectedCallback(){super.disconnectedCallback(),this.slotObserver?.disconnect(),this.clearTooltipTimeout(),this.destroyPortal();}setupSlotObserver(){this.slotObserver=new MutationObserver(()=>{this.updateUsers();}),this.slotObserver.observe(this,{childList:true,subtree:true,attributes:true,attributeFilter:["src","alt","ext-customer-id","data-user-id","data-status","variant","shadow","border","border-width","border-color","bg-color","bg-gradient","image-mode","zoom","loading","placeholder","placeholder-color","fallback","fallback-mode","glow","ring","badge","interactive"]});}updateUsers(){let e=Array.from(this.children).filter(t=>t.tagName.toLowerCase()==="profile-picture"&&t.getAttribute("slot")!=="internal");this.users=e.map((t,o)=>{let i=(p,c)=>{let g=c??p,h=t[p];return h!=null&&h!==""?String(h):t.getAttribute(g)??void 0},d=i("borderWidth","border-width"),l=d?Number.parseInt(String(d),10):void 0;return {id:i("dataUserId","data-user-id"),name:i("alt")??`User ${o+1}`,src:i("src"),extCustomerId:i("extCustomerId","ext-customer-id"),status:i("dataStatus","data-status"),element:t,index:o,variant:i("variant"),shadow:i("shadow"),border:!!(t.border??t.hasAttribute("border")),borderWidth:l,borderColor:i("borderColor","border-color"),bgColor:i("bgColor","bg-color"),bgGradient:i("bgGradient","bg-gradient"),imageMode:i("imageMode","image-mode"),zoom:(()=>{let p=i("zoom");return p?Number(p):void 0})(),loading:i("loading"),placeholder:i("placeholder"),placeholderColor:i("placeholderColor","placeholder-color"),fallback:i("fallback"),fallbackMode:i("fallbackMode","fallback-mode"),glow:(()=>{let p=t.glow;if(p&&typeof p=="object")return p;let c=t.getAttribute("glow");if(c)try{return JSON.parse(c)}catch{}})(),ring:(()=>{let p=t.ring;if(p&&typeof p=="object")return p;let c=t.getAttribute("ring");if(c)try{return JSON.parse(c)}catch{}})(),badge:(()=>{let p=t.badge;if(p&&typeof p=="object")return p;let c=t.getAttribute("badge");if(c)try{return JSON.parse(c)}catch{}})(),interactive:(()=>{let p=t.interactive;if(p&&typeof p=="object")return p;let c=t.getAttribute("interactive");if(c)try{return JSON.parse(c)}catch{}})()}});for(let t of this.users)t.element&&(t.element.style.display="none");}createPortal(){this.portalContainer||(this.portalContainer=document.createElement("div"),this.portalContainer.className="ppg-portal",this.portalContainer.style.cssText="position: fixed; z-index: 99999; pointer-events: none;",document.body.appendChild(this.portalContainer),document.body.style.overflow="hidden");}destroyPortal(){this.portalContainer&&(render(nothing,this.portalContainer),this.portalContainer.remove(),this.portalContainer=null,document.body.style.overflow="");}updatePortalContent(e){if(!(this.portalContainer&&this.counterRef))return;let t=this.counterRef.getBoundingClientRect(),o=10,i=280,d=Math.min(this.dropdownMaxHeight+60,e.length*56+60),l=window.innerWidth,p=window.innerHeight;if(l<480){let P=html`
|
|
844
925
|
<div
|
|
845
926
|
class="ppg-backdrop ppg-backdrop-visible"
|
|
846
927
|
style="pointer-events: auto; background: rgba(0,0,0,0.5);"
|
|
@@ -861,10 +942,10 @@ ${Ae}`;var a=class a extends LitElement{constructor(){super(...arguments);this.s
|
|
|
861
942
|
class="ppg-dropdown-list"
|
|
862
943
|
style=${styleMap({maxHeight:"calc(70vh - 60px)"})}
|
|
863
944
|
>
|
|
864
|
-
${e.map(
|
|
945
|
+
${e.map(x=>this.renderDropdownItem(x))}
|
|
865
946
|
</div>
|
|
866
947
|
</div>
|
|
867
|
-
`;render(
|
|
948
|
+
`;render(P,this.portalContainer);return}let g=p-t.bottom-o,h=t.top-o,E=l-t.left,U=t.right,m=this.dropdownPosition;m==="bottom"&&g<d&&h>g?m="top":m==="top"&&h<d&&g>h&&(m="bottom");let w;E>=i?w=t.left:U>=i?w=t.right-i:w=(l-i)/2,w=Math.max(8,Math.min(w,l-i-8));let $=m==="bottom"?t.bottom+o:void 0,O=m==="top"?p-t.top+o:void 0,X=html`
|
|
868
949
|
<div
|
|
869
950
|
class="ppg-backdrop"
|
|
870
951
|
style="pointer-events: auto;"
|
|
@@ -873,8 +954,8 @@ ${Ae}`;var a=class a extends LitElement{constructor(){super(...arguments);this.s
|
|
|
873
954
|
></div>
|
|
874
955
|
<div
|
|
875
956
|
class="ppg-dropdown ppg-dropdown-portal"
|
|
876
|
-
style=${styleMap({position:"fixed",pointerEvents:"auto",top
|
|
877
|
-
data-position=${
|
|
957
|
+
style=${styleMap({position:"fixed",pointerEvents:"auto",top:$!==void 0?`${$}px`:"auto",bottom:O!==void 0?`${O}px`:"auto",left:`${w}px`,width:`${i}px`})}
|
|
958
|
+
data-position=${m}
|
|
878
959
|
role="menu"
|
|
879
960
|
aria-label="Hidden users"
|
|
880
961
|
>
|
|
@@ -885,30 +966,30 @@ ${Ae}`;var a=class a extends LitElement{constructor(){super(...arguments);this.s
|
|
|
885
966
|
class="ppg-dropdown-list"
|
|
886
967
|
style=${styleMap({maxHeight:`${this.dropdownMaxHeight}px`})}
|
|
887
968
|
>
|
|
888
|
-
${e.map(
|
|
969
|
+
${e.map(P=>this.renderDropdownItem(P))}
|
|
889
970
|
</div>
|
|
890
971
|
</div>
|
|
891
|
-
`;render(
|
|
972
|
+
`;render(X,this.portalContainer);}handleAvatarClick(e){this.dispatchEvent(new CustomEvent("avatar-click",{detail:{user:e},bubbles:true,composed:true}));}handleAvatarHover(e,t){if(!this.tooltipEnabled)return;this.clearTooltipTimeout();let o=t.currentTarget;this.tooltipTimeout=window.setTimeout(()=>{this.tooltipData={user:e,rect:o.getBoundingClientRect()};},this.tooltipDelay),this.dispatchEvent(new CustomEvent("avatar-hover",{detail:{user:e},bubbles:true,composed:true}));}handleAvatarLeave(){this.clearTooltipTimeout(),this.tooltipData=null;}clearTooltipTimeout(){this.tooltipTimeout&&(window.clearTimeout(this.tooltipTimeout),this.tooltipTimeout=null);}handleCounterClick(e){this.dropdownOpen=!this.dropdownOpen,this.dropdownOpen?(this.createPortal(),this.updatePortalContent(e)):this.destroyPortal(),this.dispatchEvent(new CustomEvent("counter-click",{detail:{hiddenUsers:e,open:this.dropdownOpen},bubbles:true,composed:true}));}handleDropdownItemClick(e){this.dropdownOpen=false,this.destroyPortal(),this.dispatchEvent(new CustomEvent("dropdown-item-click",{detail:{user:e},bubbles:true,composed:true}));}handleAddClick(){this.dispatchEvent(new CustomEvent("add-click",{bubbles:true,composed:true}));}handleKeyDown(e,t){(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),t());}renderAvatar(e,t,o){let i=N(t,this.pixelSize,this.overlap,this.direction,this.spacing),d=le(t,o,this.direction),l=e.variant??"circle",p=e.shadow??"none",c=this.rotationAmount?t%2===0?-this.rotationAmount:this.rotationAmount:0;return html`
|
|
892
973
|
<div
|
|
893
974
|
class="ppg-avatar-wrapper"
|
|
894
|
-
style=${styleMap({left:`${i}px`,zIndex:String(
|
|
975
|
+
style=${styleMap({left:`${i}px`,zIndex:String(d),width:`${this.pixelSize}px`,height:`${this.pixelSize}px`})}
|
|
895
976
|
tabindex="0"
|
|
896
977
|
role="button"
|
|
897
978
|
aria-label=${e.name}
|
|
898
979
|
@click=${()=>this.handleAvatarClick(e)}
|
|
899
|
-
@mouseenter=${
|
|
980
|
+
@mouseenter=${g=>this.handleAvatarHover(e,g)}
|
|
900
981
|
@mouseleave=${this.handleAvatarLeave}
|
|
901
|
-
@keydown=${
|
|
982
|
+
@keydown=${g=>this.handleKeyDown(g,()=>this.handleAvatarClick(e))}
|
|
902
983
|
>
|
|
903
|
-
${this.renderProfilePicture(e,p,
|
|
984
|
+
${this.renderProfilePicture(e,l,p,c)}
|
|
904
985
|
</div>
|
|
905
|
-
`}renderProfilePicture(e,t,
|
|
986
|
+
`}renderProfilePicture(e,t,o,i){return html`
|
|
906
987
|
<profile-picture
|
|
907
988
|
.src=${e.src||void 0}
|
|
908
989
|
.alt=${e.name}
|
|
909
990
|
.size=${this.pixelSize}
|
|
910
991
|
.variant=${t}
|
|
911
|
-
.shadow=${
|
|
992
|
+
.shadow=${o}
|
|
912
993
|
.rotation=${i}
|
|
913
994
|
.extCustomerId=${e.extCustomerId}
|
|
914
995
|
?border=${e.border}
|
|
@@ -930,16 +1011,16 @@ ${Ae}`;var a=class a extends LitElement{constructor(){super(...arguments);this.s
|
|
|
930
1011
|
data-user-id=${e.id??""}
|
|
931
1012
|
data-status=${e.status??""}
|
|
932
1013
|
></profile-picture>
|
|
933
|
-
`}renderCounter(e,t,
|
|
1014
|
+
`}renderCounter(e,t,o){return html`
|
|
934
1015
|
<button
|
|
935
1016
|
class="ppg-counter"
|
|
936
1017
|
style=${styleMap({left:`${t}px`,width:`${this.pixelSize}px`,height:`${this.pixelSize}px`,zIndex:"1"})}
|
|
937
1018
|
aria-label=${`${e} more users`}
|
|
938
1019
|
aria-expanded=${this.dropdownOpen}
|
|
939
1020
|
aria-haspopup="true"
|
|
940
|
-
@click=${()=>this.handleCounterClick(
|
|
1021
|
+
@click=${()=>this.handleCounterClick(o)}
|
|
941
1022
|
>
|
|
942
|
-
${
|
|
1023
|
+
${ue(e)}
|
|
943
1024
|
</button>
|
|
944
1025
|
`}renderAddButton(e){let t=Math.round(this.pixelSize*.4);return html`
|
|
945
1026
|
<button
|
|
@@ -963,16 +1044,16 @@ ${Ae}`;var a=class a extends LitElement{constructor(){super(...arguments);this.s
|
|
|
963
1044
|
<line x1="5" y1="12" x2="19" y2="12"></line>
|
|
964
1045
|
</svg>
|
|
965
1046
|
</button>
|
|
966
|
-
`}renderTooltip(){if(!this.tooltipData)return nothing;let{user:e,rect:t}=this.tooltipData,
|
|
1047
|
+
`}renderTooltip(){if(!this.tooltipData)return nothing;let{user:e,rect:t}=this.tooltipData,o=8,i=this.getBoundingClientRect(),d=t.left-i.left+t.width/2,l=t.top-i.top,p=t.bottom-i.top,c=this.tooltipPosition==="top";return html`
|
|
967
1048
|
<div
|
|
968
1049
|
class="ppg-tooltip"
|
|
969
|
-
style=${styleMap({top:c?"auto":`${
|
|
1050
|
+
style=${styleMap({top:c?"auto":`${p+o}px`,bottom:c?`${i.height-l+o}px`:"auto",left:`${d}px`})}
|
|
970
1051
|
data-position=${this.tooltipPosition}
|
|
971
1052
|
role="tooltip"
|
|
972
1053
|
>
|
|
973
1054
|
${e.name}
|
|
974
1055
|
</div>
|
|
975
|
-
`}renderDropdownItem(e){let t=
|
|
1056
|
+
`}renderDropdownItem(e){let t=F(e.name),o=e.src||e.extCustomerId;return html`
|
|
976
1057
|
<div
|
|
977
1058
|
class="ppg-dropdown-item"
|
|
978
1059
|
role="menuitem"
|
|
@@ -980,7 +1061,7 @@ ${Ae}`;var a=class a extends LitElement{constructor(){super(...arguments);this.s
|
|
|
980
1061
|
@click=${()=>this.handleDropdownItemClick(e)}
|
|
981
1062
|
@keydown=${i=>this.handleKeyDown(i,()=>this.handleDropdownItemClick(e))}
|
|
982
1063
|
>
|
|
983
|
-
${
|
|
1064
|
+
${o?html`<profile-picture
|
|
984
1065
|
class="ppg-dropdown-avatar"
|
|
985
1066
|
.src=${e.src||void 0}
|
|
986
1067
|
.alt=${e.name}
|
|
@@ -992,7 +1073,7 @@ ${Ae}`;var a=class a extends LitElement{constructor(){super(...arguments);this.s
|
|
|
992
1073
|
class="ppg-dropdown-avatar-fallback"
|
|
993
1074
|
style=${styleMap({background:t})}
|
|
994
1075
|
>
|
|
995
|
-
${
|
|
1076
|
+
${G(e.name)}
|
|
996
1077
|
</div>`}
|
|
997
1078
|
<div class="ppg-dropdown-info">
|
|
998
1079
|
<div class="ppg-dropdown-name">${e.name}</div>
|
|
@@ -1007,10 +1088,10 @@ ${Ae}`;var a=class a extends LitElement{constructor(){super(...arguments);this.s
|
|
|
1007
1088
|
`:nothing}
|
|
1008
1089
|
</div>
|
|
1009
1090
|
</div>
|
|
1010
|
-
`}formatStatus(e){return {online:"Online",away:"Away",busy:"Busy",offline:"Offline",dnd:"Do not disturb"}[e]??e}updated(e){super.updated(e);let t=this.querySelector(".ppg-counter");if(t&&(this.counterRef=t),this.dropdownOpen&&this.portalContainer){let{visible:
|
|
1091
|
+
`}formatStatus(e){return {online:"Online",away:"Away",busy:"Busy",offline:"Offline",dnd:"Do not disturb"}[e]??e}updated(e){super.updated(e);let t=this.querySelector(".ppg-counter");if(t&&(this.counterRef=t),this.dropdownOpen&&this.portalContainer){let{visible:o}=q(this.users.length,this.max,this.showAddButton),i=this.users.slice(o);this.updatePortalContent(i);}}render(){let{visible:e,hidden:t,showCounter:o}=q(this.users.length,this.max,this.showAddButton),i=this.direction==="ltr"?this.users.slice(0,e):this.users.slice(0,e).reverse(),d=this.users.slice(e),l=e;o&&l++,this.showAddButton&&l++;let p=ce(l,this.pixelSize,this.overlap,this.spacing),c=o?N(e,this.pixelSize,this.overlap,this.direction,this.spacing):0,g=N(e+(o?1:0),this.pixelSize,this.overlap,this.direction,this.spacing);return html`
|
|
1011
1092
|
<div
|
|
1012
|
-
class=${
|
|
1013
|
-
style=${styleMap({width:`${
|
|
1093
|
+
class=${M("ppg-container",this.animated&&"ppg-animated")}
|
|
1094
|
+
style=${styleMap({width:`${p}px`,height:`${this.pixelSize}px`})}
|
|
1014
1095
|
role="group"
|
|
1015
1096
|
aria-label="User avatars"
|
|
1016
1097
|
>
|
|
@@ -1018,16 +1099,16 @@ ${Ae}`;var a=class a extends LitElement{constructor(){super(...arguments);this.s
|
|
|
1018
1099
|
<slot style="display: none;"></slot>
|
|
1019
1100
|
|
|
1020
1101
|
<!-- Visible avatars -->
|
|
1021
|
-
${i.map((
|
|
1102
|
+
${i.map((h,E)=>this.renderAvatar(h,E,e))}
|
|
1022
1103
|
|
|
1023
1104
|
<!-- Counter -->
|
|
1024
|
-
${
|
|
1105
|
+
${o?this.renderCounter(t,c,d):nothing}
|
|
1025
1106
|
|
|
1026
1107
|
<!-- Add button -->
|
|
1027
|
-
${this.showAddButton?this.renderAddButton(
|
|
1108
|
+
${this.showAddButton?this.renderAddButton(g):nothing}
|
|
1028
1109
|
|
|
1029
1110
|
<!-- Tooltip -->
|
|
1030
1111
|
${this.renderTooltip()}
|
|
1031
1112
|
</div>
|
|
1032
|
-
`}};s([property({type:Number})],f.prototype,"max"),s([property({type:String})],f.prototype,"direction"),s([property({type:Number})],f.prototype,"overlap"),s([property({type:String})],f.prototype,"size"),s([property({type:Number})],f.prototype,"spacing"),s([property({type:Object})],f.prototype,"tooltip"),s([property({type:Object})],f.prototype,"dropdown"),s([property({type:Boolean,attribute:"show-add-button"})],f.prototype,"showAddButton"),s([property({type:String,attribute:"add-button-label"})],f.prototype,"addButtonLabel"),s([property({type:Boolean})],f.prototype,"animated"),s([property({type:Number,attribute:"rotation-amount"})],f.prototype,"rotationAmount"),s([state()],f.prototype,"users"),s([state()],f.prototype,"dropdownOpen"),s([state()],f.prototype,"tooltipData");customElements.get("profile-picture-group")||customElements.define("profile-picture-group",f);function
|
|
1113
|
+
`}};s([property({type:Number})],f.prototype,"max"),s([property({type:String})],f.prototype,"direction"),s([property({type:Number})],f.prototype,"overlap"),s([property({type:String})],f.prototype,"size"),s([property({type:Number})],f.prototype,"spacing"),s([property({type:Object})],f.prototype,"tooltip"),s([property({type:Object})],f.prototype,"dropdown"),s([property({type:Boolean,attribute:"show-add-button"})],f.prototype,"showAddButton"),s([property({type:String,attribute:"add-button-label"})],f.prototype,"addButtonLabel"),s([property({type:Boolean})],f.prototype,"animated"),s([property({type:Number,attribute:"rotation-amount"})],f.prototype,"rotationAmount"),s([state()],f.prototype,"users"),s([state()],f.prototype,"dropdownOpen"),s([state()],f.prototype,"tooltipData");customElements.get("profile-picture-group")||customElements.define("profile-picture-group",f);function gt(r){R.setCdnBaseUrl(r);}function ft(){return R.getCdnBaseUrl()}Q();export{ft as getCdnBaseUrl,gt as setCdnBaseUrl};//# sourceMappingURL=angular.js.map
|
|
1033
1114
|
//# sourceMappingURL=angular.js.map
|