@grasco/profile-picture 0.1.2 → 0.1.4
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/README.md +4 -0
- package/dist/angular.cjs +1 -370
- package/dist/angular.cjs.map +1 -1
- package/dist/angular.d.cts +188 -2
- package/dist/angular.d.ts +188 -2
- package/dist/angular.js +1 -370
- package/dist/angular.js.map +1 -1
- package/dist/index.cjs +246 -110
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +130 -43
- package/dist/index.d.ts +130 -43
- package/dist/index.js +246 -110
- package/dist/index.js.map +1 -1
- package/dist/standalone.d.ts +9 -2
- package/dist/standalone.standalone.js +280 -144
- package/dist/standalone.standalone.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/svelte.cjs +1 -370
- package/dist/svelte.cjs.map +1 -1
- package/dist/svelte.d.cts +188 -2
- package/dist/svelte.d.ts +188 -2
- package/dist/svelte.js +1 -370
- package/dist/svelte.js.map +1 -1
- package/dist/vue.cjs +1 -370
- package/dist/vue.cjs.map +1 -1
- package/dist/vue.d.cts +188 -2
- package/dist/vue.d.ts +188 -2
- package/dist/vue.js +1 -370
- package/dist/vue.js.map +1 -1
- package/package.json +9 -2
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var Ut=require('react'),lit=require('lit'),decorators_js=require('lit/decorators.js'),styleMap_js=require('lit/directives/style-map.js');var _documentCurrentScript=typeof document!=='undefined'?document.currentScript:null;function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Ut__default=/*#__PURE__*/_interopDefault(Ut);var Ft=Object.defineProperty;var Nt=Object.getOwnPropertyDescriptor;var s=(r,o,t,e)=>{for(var n=e>1?void 0:e?Nt(o,t):o,i=r.length-1,p;i>=0;i--)(p=r[i])&&(n=(e?p(o,t,n):p(n))||n);return e&&n&&Ft(o,t,n),n};var ct="grasco-profile-picture-styles",K=false;function gt(){if(K||typeof document>"u")return;if(document.getElementById(ct)){K=true;return}if(document.querySelector('link[href*="profile-picture"][href$="styles.css"]')){K=true;return}let o=Ht();if(!o)return;let t=document.createElement("link");t.id=ct,t.rel="stylesheet",t.href=o,document.head.appendChild(t),K=true;}function Ht(){if(typeof window<"u"&&window.__GRASCO_PROFILE_PICTURE_CSS__)return window.__GRASCO_PROFILE_PICTURE_CSS__;try{let o=(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href));if(o)return `${o.substring(0,o.lastIndexOf("/")+1)}dist/styles.css`}catch{}let r=document.currentScript;if(r?.src){let o=new URL(r.src);return `${o.href.substring(0,o.href.lastIndexOf("/")+1)}dist/styles.css`}return null}var N={"2xs":20,xs:24,sm:32,md:40,lg:48,xl:64,"2xl":80,"3xl":120},ut={online:"#30D158",away:"#FFD60A",busy:"#FF453A",offline:"#8E8E93",dnd:"#FF453A"},ft={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)"},R={size:"md",variant:"circle",loading:"lazy",placeholder:"shimmer",borderWidth:2,borderColor:"#ffffff",placeholderColor:"#f3f4f6",shadow:"sm"};var H={circle:"9999px",rounded:"12px",squircle:"30%",square:"0px"},z={max:4,direction:"ltr",overlap:.3,size:"md",tooltipDelay:300,dropdownMaxHeight:280,animated:true};function $(...r){return r.filter(Boolean).join(" ")}function V(r){return /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(r)}function bt(r){return {"top-left":"np:top-0 np:left-0","top-center":"np:top-0 np:left-1/2 np:-translate-x-1/2","top-right":"np:top-0 np:right-0","bottom-left":"np:bottom-0 np:left-0","bottom-center":"np:bottom-0 np:left-1/2 np:-translate-x-1/2","bottom-right":"np:bottom-0 np:right-0"}[r]}function ht(r){return {"top-left":"np:-rotate-45 np:-translate-x-1/4 np:-translate-y-1/2","top-center":"np:rotate-0 np:-translate-y-1/2","top-right":"np:rotate-45 np:translate-x-1/4 np:-translate-y-1/2","bottom-left":"np:rotate-45 np:-translate-x-1/4 np:translate-y-1/2","bottom-center":"np:rotate-0 np:translate-y-1/2","bottom-right":"np:-rotate-45 np:translate-x-1/4 np:translate-y-1/2"}[r]}function q(r){let t=r.trim().replace(/[^\w\s]/g,"").split(/\s+/).filter(Boolean);return t.length===0?"?":t.length===1?t[0].slice(0,1).toUpperCase():(t[0][0]+(t.at(-1)?.[0]??"")).toUpperCase()}function rt(r){return Math.round(r*.38)}function mt(r,o){let t;if(o){let n=Math.round(r*.31);t=Math.min(24,Math.max(14,n));}else {let n=Math.round(r*.22);t=Math.min(14,Math.max(8,n));}let e=Math.max(9,Math.round(t*.55));return {size:t,fontSize:e}}function xt(r,o){let t=Math.min(16,Math.max(8,Math.round(r*.2)));return Math.min(18,t+(o-1)*2)}function vt(r,o){return typeof r=="string"?r:o&&r>o?`${o}+`:r.toString()}function yt(r){return r.length===0?"transparent":r.length===1?r[0]:`conic-gradient(${r.map((t,e)=>{let n=e/r.length*360,i=(e+1)/r.length*360;return `${t} ${n}deg ${i}deg`}).join(", ")})`}function Pt(r){let o=0;for(let t=0;t<r.length;t++){let e=r.charCodeAt(t);o=(o<<5)-o+e,o&=o;}return Math.abs(o)}function wt(r,o,t){let n=Math.max(0,Math.min(100,r))/100*360;return `conic-gradient(from 270deg, ${o} 0deg ${n}deg, ${t} ${n}deg 360deg)`}function X(r){let o=["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%)"],t=Pt(r)%o.length;return o[t]}function Ct(r){return typeof r=="number"?r:N[r]??N[z.size]}function nt(r,o,t){let e=t?o-1:o;if(r<=e)return {visible:r,hidden:0,showCounter:false};let n=e-1,i=r-n;return {visible:n,hidden:i,showCounter:true}}function Z(r,o,t,e,n){let i=n??o*(1-t);return r*i}function St(r,o,t){return t==="ltr"?o-r:r+1}function kt(r,o,t,e){if(r===0)return 0;if(r===1)return o;let n=e??o*(1-t);return o+n*(r-1)}function $t(r){return r>99?"+99":`+${r}`}function ot(r){return r<=80?"80":r<=120?"120":r<=240?"240":r<=480?"480":"960"}function it(r){if(!(r&&V(r)))return "light";let o=r.replace("#","");o.length===3&&(o=o.split("").map(p=>p+p).join(""));let t=Number.parseInt(o.slice(0,2),16),e=Number.parseInt(o.slice(2,4),16),n=Number.parseInt(o.slice(4,6),16);return (.299*t+.587*e+.114*n)/255>.5?"light":"dark"}function at(r,o,t,e,n){let i=r.endsWith("/")?r.slice(0,-1):r,p=`${o}_${t}_${e}.webp`;return `${i}/api/profile-picture/cdn/${p}?hostname=${n}`}function Et(r){return {circle:"np:rounded-full",rounded:"np:rounded-xl",squircle:"np:rounded-[30%]",square:"np:rounded-none"}[r]}function It(r,o){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:o,borderStyle:"solid"}}}function Rt(r,o){return o?{className:"",style:{background:o}}:r?r.includes("gradient")?{className:"",style:{background:r}}:{className:"",style:{backgroundColor:r}}:{className:"",style:{backgroundColor:"#e7e7e7"}}}function zt(r){return {boxShadow:ft[r]}}var jt={shimmer:`
|
|
2
2
|
@keyframes pp-shimmer {
|
|
3
3
|
0% { transform: translateX(-100%); }
|
|
4
4
|
100% { transform: translateX(100%); }
|
|
@@ -36,8 +36,8 @@
|
|
|
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
|
+
}`},Vt=Object.values(jt).join(`
|
|
40
|
+
`),Wt=`
|
|
41
41
|
/* Profile Picture Component Styles */
|
|
42
42
|
.pp-container {
|
|
43
43
|
--pp-transition-duration: 200ms;
|
|
@@ -154,7 +154,6 @@
|
|
|
154
154
|
display: flex;
|
|
155
155
|
align-items: center;
|
|
156
156
|
justify-content: center;
|
|
157
|
-
border-radius: 9999px;
|
|
158
157
|
font-weight: 600;
|
|
159
158
|
font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
|
|
160
159
|
line-height: 1;
|
|
@@ -259,8 +258,8 @@
|
|
|
259
258
|
transition: none !important;
|
|
260
259
|
}
|
|
261
260
|
}
|
|
262
|
-
`,
|
|
263
|
-
${
|
|
261
|
+
`,At=`${Vt}
|
|
262
|
+
${Wt}`,Tt=`
|
|
264
263
|
@keyframes np-shimmer {
|
|
265
264
|
0% { background-position: -200% 0; }
|
|
266
265
|
100% { background-position: 200% 0; }
|
|
@@ -270,22 +269,22 @@ ${Mt}`,St=`
|
|
|
270
269
|
background-size: 200% 100%;
|
|
271
270
|
animation: np-shimmer 1.5s infinite;
|
|
272
271
|
}
|
|
273
|
-
`;function
|
|
272
|
+
`;function Dt(r,o=.3){if(V(r)){let t=Number.parseInt(r.slice(1,3),16),e=Number.parseInt(r.slice(3,5),16),n=Number.parseInt(r.slice(5,7),16);return `0 0 20px 0 rgba(${t}, ${e}, ${n}, ${o})`}return `0 0 20px 0 ${r}`}var Jt=`
|
|
274
273
|
@keyframes ppg-tooltip-in {
|
|
275
274
|
from {
|
|
276
275
|
opacity: 0;
|
|
277
|
-
transform: translateY(4px) scale(0.96);
|
|
276
|
+
transform: translateX(-50%) translateY(4px) scale(0.96);
|
|
278
277
|
}
|
|
279
278
|
to {
|
|
280
279
|
opacity: 1;
|
|
281
|
-
transform: translateY(0) scale(1);
|
|
280
|
+
transform: translateX(-50%) translateY(0) scale(1);
|
|
282
281
|
}
|
|
283
282
|
}
|
|
284
283
|
|
|
285
284
|
@keyframes ppg-dropdown-in {
|
|
286
285
|
from {
|
|
287
286
|
opacity: 0;
|
|
288
|
-
transform: translateY(-
|
|
287
|
+
transform: translateY(-6px) scale(0.95);
|
|
289
288
|
}
|
|
290
289
|
to {
|
|
291
290
|
opacity: 1;
|
|
@@ -301,7 +300,27 @@ ${Mt}`,St=`
|
|
|
301
300
|
transform: translateY(-4px) scale(1.08);
|
|
302
301
|
}
|
|
303
302
|
}
|
|
304
|
-
|
|
303
|
+
|
|
304
|
+
@keyframes ppg-modal-in {
|
|
305
|
+
from {
|
|
306
|
+
opacity: 0;
|
|
307
|
+
transform: translate(-50%, -50%) scale(0.9);
|
|
308
|
+
}
|
|
309
|
+
to {
|
|
310
|
+
opacity: 1;
|
|
311
|
+
transform: translate(-50%, -50%) scale(1);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
@keyframes ppg-backdrop-in {
|
|
316
|
+
from {
|
|
317
|
+
opacity: 0;
|
|
318
|
+
}
|
|
319
|
+
to {
|
|
320
|
+
opacity: 1;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
`,Yt=`
|
|
305
324
|
/* Profile Picture Group Container */
|
|
306
325
|
.ppg-container {
|
|
307
326
|
--ppg-transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
@@ -382,7 +401,7 @@ ${Mt}`,St=`
|
|
|
382
401
|
}
|
|
383
402
|
|
|
384
403
|
.ppg-counter:hover {
|
|
385
|
-
background: #
|
|
404
|
+
background: #ebebed;
|
|
386
405
|
transform: scale(1.05);
|
|
387
406
|
}
|
|
388
407
|
|
|
@@ -436,7 +455,7 @@ ${Mt}`,St=`
|
|
|
436
455
|
|
|
437
456
|
/* Tooltip */
|
|
438
457
|
.ppg-tooltip {
|
|
439
|
-
position:
|
|
458
|
+
position: absolute;
|
|
440
459
|
z-index: 9999;
|
|
441
460
|
padding: 6px 12px;
|
|
442
461
|
background: var(--ppg-tooltip-bg);
|
|
@@ -448,7 +467,8 @@ ${Mt}`,St=`
|
|
|
448
467
|
box-shadow: var(--ppg-shadow-lg);
|
|
449
468
|
pointer-events: none;
|
|
450
469
|
white-space: nowrap;
|
|
451
|
-
|
|
470
|
+
transform: translateX(-50%);
|
|
471
|
+
animation: ppg-tooltip-in 150ms ease-out forwards;
|
|
452
472
|
backdrop-filter: blur(20px);
|
|
453
473
|
-webkit-backdrop-filter: blur(20px);
|
|
454
474
|
}
|
|
@@ -477,111 +497,168 @@ ${Mt}`,St=`
|
|
|
477
497
|
/* Dropdown */
|
|
478
498
|
.ppg-dropdown {
|
|
479
499
|
position: absolute;
|
|
480
|
-
z-index:
|
|
481
|
-
|
|
482
|
-
|
|
500
|
+
z-index: 9998;
|
|
501
|
+
right: 0;
|
|
502
|
+
min-width: 220px;
|
|
503
|
+
max-width: 300px;
|
|
483
504
|
background: var(--ppg-dropdown-bg);
|
|
484
|
-
border-radius:
|
|
485
|
-
box-shadow:
|
|
486
|
-
|
|
505
|
+
border-radius: 14px;
|
|
506
|
+
box-shadow:
|
|
507
|
+
0 4px 24px rgba(0, 0, 0, 0.12),
|
|
508
|
+
0 1px 4px rgba(0, 0, 0, 0.08),
|
|
509
|
+
0 0 0 1px var(--ppg-border);
|
|
487
510
|
overflow: hidden;
|
|
488
|
-
animation: ppg-dropdown-in 200ms
|
|
511
|
+
animation: ppg-dropdown-in 200ms cubic-bezier(0.32, 0.72, 0, 1) forwards;
|
|
512
|
+
transform-origin: top right;
|
|
513
|
+
backdrop-filter: blur(20px);
|
|
514
|
+
-webkit-backdrop-filter: blur(20px);
|
|
489
515
|
}
|
|
490
516
|
|
|
491
517
|
.ppg-dropdown[data-position="bottom"] {
|
|
492
|
-
top: calc(100% +
|
|
518
|
+
top: calc(100% + 10px);
|
|
493
519
|
}
|
|
494
520
|
|
|
495
521
|
.ppg-dropdown[data-position="top"] {
|
|
496
|
-
bottom: calc(100% +
|
|
522
|
+
bottom: calc(100% + 10px);
|
|
523
|
+
transform-origin: bottom right;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
/* Modal style for mobile */
|
|
527
|
+
.ppg-dropdown[data-position="modal"] {
|
|
528
|
+
transform-origin: center center;
|
|
529
|
+
animation: ppg-modal-in 250ms cubic-bezier(0.32, 0.72, 0, 1) forwards;
|
|
530
|
+
border-radius: 20px;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
.ppg-backdrop-visible {
|
|
534
|
+
background: rgba(0, 0, 0, 0.4);
|
|
535
|
+
animation: ppg-backdrop-in 200ms ease-out forwards;
|
|
497
536
|
}
|
|
498
537
|
|
|
499
538
|
.ppg-dropdown-header {
|
|
500
|
-
padding:
|
|
501
|
-
font-
|
|
539
|
+
padding: 14px 16px 10px;
|
|
540
|
+
font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
|
|
541
|
+
font-size: 11px;
|
|
502
542
|
font-weight: 600;
|
|
503
543
|
color: #86868b;
|
|
504
544
|
text-transform: uppercase;
|
|
505
|
-
letter-spacing: 0.
|
|
506
|
-
|
|
545
|
+
letter-spacing: 0.06em;
|
|
546
|
+
background: linear-gradient(to bottom, rgba(0,0,0,0.02), transparent);
|
|
507
547
|
}
|
|
508
548
|
|
|
509
549
|
.ppg-dropdown-list {
|
|
510
550
|
overflow-y: auto;
|
|
511
|
-
padding:
|
|
551
|
+
padding: 6px;
|
|
552
|
+
scrollbar-width: thin;
|
|
553
|
+
scrollbar-color: rgba(0,0,0,0.2) transparent;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
.ppg-dropdown-list::-webkit-scrollbar {
|
|
557
|
+
width: 6px;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
.ppg-dropdown-list::-webkit-scrollbar-track {
|
|
561
|
+
background: transparent;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
.ppg-dropdown-list::-webkit-scrollbar-thumb {
|
|
565
|
+
background: rgba(0,0,0,0.15);
|
|
566
|
+
border-radius: 3px;
|
|
512
567
|
}
|
|
513
568
|
|
|
514
569
|
.ppg-dropdown-item {
|
|
515
570
|
display: flex;
|
|
516
571
|
align-items: center;
|
|
517
572
|
gap: 12px;
|
|
518
|
-
padding: 10px
|
|
573
|
+
padding: 10px 12px;
|
|
519
574
|
cursor: pointer;
|
|
520
|
-
|
|
575
|
+
border-radius: 10px;
|
|
576
|
+
transition: all 150ms ease;
|
|
577
|
+
margin: 2px 0;
|
|
521
578
|
}
|
|
522
579
|
|
|
523
580
|
.ppg-dropdown-item:hover {
|
|
524
581
|
background: var(--ppg-dropdown-hover);
|
|
582
|
+
transform: translateX(2px);
|
|
525
583
|
}
|
|
526
584
|
|
|
527
585
|
.ppg-dropdown-item:focus-visible {
|
|
528
586
|
outline: none;
|
|
529
587
|
background: var(--ppg-dropdown-hover);
|
|
588
|
+
box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.4);
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
.ppg-dropdown-item:active {
|
|
592
|
+
transform: scale(0.98);
|
|
530
593
|
}
|
|
531
594
|
|
|
532
595
|
.ppg-dropdown-avatar {
|
|
533
596
|
flex-shrink: 0;
|
|
534
|
-
width:
|
|
535
|
-
height:
|
|
597
|
+
width: 36px;
|
|
598
|
+
height: 36px;
|
|
536
599
|
border-radius: 9999px;
|
|
537
600
|
object-fit: cover;
|
|
538
|
-
|
|
601
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
602
|
+
border: 2px solid rgba(255, 255, 255, 0.8);
|
|
539
603
|
}
|
|
540
604
|
|
|
541
605
|
.ppg-dropdown-avatar-fallback {
|
|
542
606
|
flex-shrink: 0;
|
|
543
|
-
width:
|
|
544
|
-
height:
|
|
607
|
+
width: 36px;
|
|
608
|
+
height: 36px;
|
|
545
609
|
border-radius: 9999px;
|
|
546
610
|
display: flex;
|
|
547
611
|
align-items: center;
|
|
548
612
|
justify-content: center;
|
|
613
|
+
font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, sans-serif;
|
|
549
614
|
font-size: 13px;
|
|
550
615
|
font-weight: 600;
|
|
551
616
|
color: white;
|
|
617
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
618
|
+
border: 2px solid rgba(255, 255, 255, 0.3);
|
|
552
619
|
}
|
|
553
620
|
|
|
554
621
|
.ppg-dropdown-info {
|
|
555
622
|
flex: 1;
|
|
556
623
|
min-width: 0;
|
|
624
|
+
padding-right: 4px;
|
|
625
|
+
text-align: left;
|
|
557
626
|
}
|
|
558
627
|
|
|
559
628
|
.ppg-dropdown-name {
|
|
629
|
+
font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
|
|
560
630
|
font-size: 14px;
|
|
561
631
|
font-weight: 500;
|
|
562
632
|
color: #1d1d1f;
|
|
563
633
|
white-space: nowrap;
|
|
564
634
|
overflow: hidden;
|
|
565
635
|
text-overflow: ellipsis;
|
|
636
|
+
line-height: 1.3;
|
|
637
|
+
text-align: left;
|
|
566
638
|
}
|
|
567
639
|
|
|
568
640
|
.ppg-dropdown-status {
|
|
569
641
|
display: flex;
|
|
570
642
|
align-items: center;
|
|
571
|
-
gap:
|
|
643
|
+
gap: 5px;
|
|
644
|
+
font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
|
|
572
645
|
font-size: 12px;
|
|
573
646
|
color: #86868b;
|
|
574
647
|
margin-top: 2px;
|
|
648
|
+
line-height: 1.2;
|
|
575
649
|
}
|
|
576
650
|
|
|
577
651
|
.ppg-dropdown-presence {
|
|
578
|
-
width:
|
|
579
|
-
height:
|
|
652
|
+
width: 7px;
|
|
653
|
+
height: 7px;
|
|
580
654
|
border-radius: 9999px;
|
|
655
|
+
flex-shrink: 0;
|
|
656
|
+
box-shadow: 0 0 0 1.5px var(--ppg-dropdown-bg);
|
|
581
657
|
}
|
|
582
658
|
|
|
583
659
|
.ppg-dropdown-presence[data-status="online"] {
|
|
584
660
|
background: #30D158;
|
|
661
|
+
box-shadow: 0 0 0 1.5px var(--ppg-dropdown-bg), 0 0 6px rgba(48, 209, 88, 0.5);
|
|
585
662
|
}
|
|
586
663
|
|
|
587
664
|
.ppg-dropdown-presence[data-status="away"] {
|
|
@@ -601,7 +678,7 @@ ${Mt}`,St=`
|
|
|
601
678
|
.ppg-backdrop {
|
|
602
679
|
position: fixed;
|
|
603
680
|
inset: 0;
|
|
604
|
-
z-index:
|
|
681
|
+
z-index: 9997;
|
|
605
682
|
}
|
|
606
683
|
|
|
607
684
|
/* Reduced motion */
|
|
@@ -643,33 +720,69 @@ ${Mt}`,St=`
|
|
|
643
720
|
box-shadow: 0 0 0 1.5px rgba(28, 28, 30, 0.95), var(--ppg-shadow-sm);
|
|
644
721
|
}
|
|
645
722
|
|
|
723
|
+
.ppg-counter:hover {
|
|
724
|
+
background: #3a3a3c;
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
.ppg-dropdown {
|
|
728
|
+
background: rgba(44, 44, 46, 0.95);
|
|
729
|
+
box-shadow:
|
|
730
|
+
0 4px 24px rgba(0, 0, 0, 0.4),
|
|
731
|
+
0 1px 4px rgba(0, 0, 0, 0.2),
|
|
732
|
+
0 0 0 1px rgba(255, 255, 255, 0.08);
|
|
733
|
+
}
|
|
734
|
+
|
|
646
735
|
.ppg-dropdown-name {
|
|
647
736
|
color: #ffffff;
|
|
648
737
|
}
|
|
649
738
|
|
|
650
739
|
.ppg-dropdown-header {
|
|
651
740
|
color: #98989d;
|
|
741
|
+
background: linear-gradient(to bottom, rgba(255,255,255,0.03), transparent);
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
.ppg-dropdown-avatar {
|
|
745
|
+
border-color: rgba(255, 255, 255, 0.15);
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
.ppg-dropdown-avatar-fallback {
|
|
652
749
|
border-color: rgba(255, 255, 255, 0.1);
|
|
653
750
|
}
|
|
751
|
+
|
|
752
|
+
.ppg-dropdown-list {
|
|
753
|
+
scrollbar-color: rgba(255,255,255,0.35) transparent;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
.ppg-dropdown-list::-webkit-scrollbar-thumb {
|
|
757
|
+
background: rgba(255,255,255,0.35);
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
.ppg-dropdown-presence {
|
|
761
|
+
box-shadow: 0 0 0 1.5px rgba(44, 44, 46, 0.95);
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
.ppg-dropdown-presence[data-status="online"] {
|
|
765
|
+
box-shadow: 0 0 0 1.5px rgba(44, 44, 46, 0.95), 0 0 6px rgba(48, 209, 88, 0.5);
|
|
766
|
+
}
|
|
654
767
|
}
|
|
655
|
-
|
|
656
|
-
${
|
|
657
|
-
${this.placeholder==="shimmer"?lit.html`<style>${
|
|
768
|
+
`,Lt=`${Jt}
|
|
769
|
+
${Yt}`;var a=class extends lit.LitElement{constructor(){super(...arguments);this.src="";this.alt="";this.size=R.size;this.variant=R.variant;this.shadow=R.shadow;this.border=false;this.borderWidth=R.borderWidth;this.borderColor=R.borderColor;this.rotation=0;this.loading=R.loading;this.placeholder=R.placeholder;this.placeholderColor=R.placeholderColor;this.isLoaded=false;this.hasError=false;this.cdnLoadFailed=false;this.previousSrc="";this.RETRY_DELAY_MS=3e4;}static setCdnBaseUrl(t){a.cdnBaseUrl=t,a.instances.forEach(e=>{e.extCustomerId&&!e.cdnImageUrl&&(e.cdnLoadFailed=false,e.retryTimeoutId&&(clearTimeout(e.retryTimeoutId),e.retryTimeoutId=void 0),e.previousExtCustomerId||(e.previousExtCustomerId=e.extCustomerId),e.loadCdnImage());});}static getCdnBaseUrl(){return a.cdnBaseUrl}createRenderRoot(){return a.injectStylesOnce(),this}static injectStylesOnce(){if(a.stylesInjected||typeof document>"u")return;let t=document.createElement("style");t.textContent=At,document.head.appendChild(t),a.stylesInjected=true;}get pixelSize(){let t=this.size;return typeof t=="number"?t:N[t]??N[R.size]}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(t){super.updated(t),this.extCustomerId&&a.cdnBaseUrl&&!this.cdnImageUrl&&(this.cdnLoadFailed||!this.previousExtCustomerId)&&(this.previousExtCustomerId||(this.previousExtCustomerId=this.extCustomerId),this.cdnLoadFailed=false,this.loadCdnImage());}willUpdate(t){t.has("src")&&this.src!==this.previousSrc&&(this.isLoaded=false,this.hasError=false,this.previousSrc=this.src),(t.has("extCustomerId")||t.has("size")||t.has("bgColor"))&&this.extCustomerId!==this.previousExtCustomerId&&(this.previousExtCustomerId=this.extCustomerId,this.cdnImageUrl=void 0,this.cdnLoadFailed=false,this.isLoaded=false,this.hasError=false,this.retryTimeoutId&&(clearTimeout(this.retryTimeoutId),this.retryTimeoutId=void 0),this.loadCdnImage());}handleLoad(){this.isLoaded=true,this.dispatchEvent(new CustomEvent("load",{bubbles:true,composed:true}));}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 t=ot(this.pixelSize),e=it(this.bgColor),n=typeof window<"u"?window.location.hostname:"localhost";this.cdnImageUrl=at(a.cdnBaseUrl,this.extCustomerId,t,e,n);}getContainerStyles(){let t=Rt(this.bgColor,this.bgGradient),e=this.border?It(this.borderWidth,this.borderColor):null,n=zt(this.shadow),i={};if(this.glow){let d=this.glow.color??this.borderColor??"#6366f1";i={"--pp-glow-color":d,boxShadow:Dt(d,this.glow.intensity??.3)};}let p=this.interactive?.hoverable||this.interactive?.pressable;return {classes:$("pp-container",Et(this.variant),t.className,e?.className,p&&"pp-interactive",this.glow?.animate&&"pp-glow"),styles:{width:`${this.pixelSize}px`,height:`${this.pixelSize}px`,borderRadius:H[this.variant],...t.style,...e?.style,...n,...i,cursor:this.interactive?.cursor??(p?"pointer":"default"),transform:this.rotation?`rotate(${this.rotation}deg)`:void 0}}}renderPlaceholder(){if(this.isLoaded||this.placeholder==="none")return lit.nothing;let t={shimmer:"pp-shimmer",pulse:"pp-pulse",skeleton:"pp-skeleton",blur:"",none:""}[this.placeholder];return lit.html`
|
|
770
|
+
${this.placeholder==="shimmer"?lit.html`<style>${Tt}</style>`:lit.nothing}
|
|
658
771
|
<div
|
|
659
|
-
class=${
|
|
772
|
+
class=${$("np:absolute np:inset-0",t)}
|
|
660
773
|
style=${styleMap_js.styleMap({backgroundColor:this.placeholderColor,borderRadius:"inherit"})}>
|
|
661
774
|
</div>
|
|
662
775
|
`}renderFallback(){if(this.fallback)return lit.html`
|
|
663
776
|
<span
|
|
664
777
|
class="pp-fallback"
|
|
665
|
-
style=${styleMap_js.styleMap({fontSize:`${
|
|
778
|
+
style=${styleMap_js.styleMap({fontSize:`${rt(this.pixelSize)}px`})}>
|
|
666
779
|
${this.fallback}
|
|
667
780
|
</span>
|
|
668
|
-
`;if(this.alt){let e=
|
|
781
|
+
`;if(this.alt){let e=X(this.alt);return lit.html`
|
|
669
782
|
<div
|
|
670
783
|
class="pp-fallback np:absolute np:inset-0"
|
|
671
|
-
style=${styleMap_js.styleMap({background:this.bgColor??e,fontSize:`${
|
|
672
|
-
${
|
|
784
|
+
style=${styleMap_js.styleMap({background:this.bgColor??e,fontSize:`${rt(this.pixelSize)}px`})}>
|
|
785
|
+
${q(this.alt)}
|
|
673
786
|
</div>
|
|
674
787
|
`}let t=this.pixelSize*.5;return lit.html`
|
|
675
788
|
<svg
|
|
@@ -679,7 +792,7 @@ ${Ft}`;var i=class extends lit.LitElement{constructor(){super(...arguments);this
|
|
|
679
792
|
viewBox="0 0 24 24">
|
|
680
793
|
<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" />
|
|
681
794
|
</svg>
|
|
682
|
-
`}renderImage(){let t=!!(this.extCustomerId&&
|
|
795
|
+
`}renderImage(){let t=!!(this.extCustomerId&&a.cdnBaseUrl),e;return this.cdnImageUrl?e=this.cdnImageUrl:(!t||this.cdnLoadFailed)&&(e=this.src),this.hasError||!e?this.renderFallback():lit.html`
|
|
683
796
|
<img
|
|
684
797
|
src=${e}
|
|
685
798
|
alt=${this.alt}
|
|
@@ -687,33 +800,33 @@ ${Ft}`;var i=class extends lit.LitElement{constructor(){super(...arguments);this
|
|
|
687
800
|
decoding="async"
|
|
688
801
|
@load=${this.handleLoad}
|
|
689
802
|
@error=${this.handleError}
|
|
690
|
-
class=${
|
|
803
|
+
class=${$("pp-image",this.isLoaded?"pp-image-loaded":"pp-image-loading")}
|
|
691
804
|
draggable="false" />
|
|
692
|
-
`}renderRing(){if(!this.ring?.show)return lit.nothing;let t=this.ring.width??3,e=this.ring.gap??3,
|
|
805
|
+
`}renderRing(){if(!this.ring?.show)return lit.nothing;let t=this.ring.width??3,e=this.ring.gap??3,n=t+e,i,p=this.ring.progress!==void 0;if(p){let d=this.ring.progress??0,u=this.ring.color??"#30D158",f=this.ring.emptyColor??"#8E8E93";i=wt(d,u,f);}else this.ring.gradient&&this.ring.gradient.length>0?i=yt(this.ring.gradient):i=this.ring.color??"linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888)";return lit.html`
|
|
693
806
|
<div
|
|
694
|
-
class=${
|
|
695
|
-
style=${styleMap_js.styleMap({inset:`-${
|
|
807
|
+
class=${$("pp-ring",this.ring.animate&&!p&&"pp-ring-animated",p&&"pp-ring-progress")}
|
|
808
|
+
style=${styleMap_js.styleMap({inset:`-${n}px`,padding:`${t}px`,background:i,borderRadius:H[this.variant]})}>
|
|
696
809
|
</div>
|
|
697
|
-
`}renderPresence(){if(!this.presence)return lit.nothing;let t=this.presence.thickness??2,e=
|
|
810
|
+
`}renderPresence(){if(!this.presence)return lit.nothing;let t=this.presence.thickness??2,e=xt(this.pixelSize,t),n=ut[this.presence.status],i=Math.max(0,this.pixelSize*.02);return lit.html`
|
|
698
811
|
<div
|
|
699
|
-
class=${
|
|
700
|
-
style=${styleMap_js.styleMap({width:`${e}px`,height:`${e}px`,backgroundColor:
|
|
812
|
+
class=${$("pp-presence",this.presence.animate&&"pp-presence-animated")}
|
|
813
|
+
style=${styleMap_js.styleMap({width:`${e}px`,height:`${e}px`,backgroundColor:n,bottom:`${i}px`,right:`${i}px`,color:n})}
|
|
701
814
|
title=${this.presence.status}>
|
|
702
815
|
</div>
|
|
703
|
-
`}renderBadge(){if(!this.badge)return lit.nothing;let t=this.badge.position??"bottom-right",e=this.badge.content!==void 0,
|
|
816
|
+
`}renderBadge(){if(!this.badge)return lit.nothing;let t=this.badge.position??"bottom-right",e=this.badge.content!==void 0,n=this.badge.icon!==void 0,i=e||n,{size:p,fontSize:d}=mt(this.pixelSize,i),u=this.badge.bgColor??"#22c55e",f=this.badge.color??"#ffffff",h=this.badge.borderRadius??"9999px",v=e&&this.badge.content!==void 0?vt(this.badge.content,this.badge.max):null,y=n?this.badge.icon:null,T=d*.9,l=`${-Math.round(this.pixelSize*.06)}px`,m={"top-left":{top:l,left:l},"top-center":{top:l,left:"50%",transform:"translateX(-50%)"},"top-right":{top:l,right:l},"bottom-left":{bottom:l,left:l},"bottom-center":{bottom:l,left:"50%",transform:"translateX(-50%)"},"bottom-right":{bottom:l,right:l}};return lit.html`
|
|
704
817
|
<div
|
|
705
|
-
class=${
|
|
706
|
-
style=${styleMap_js.styleMap({width:
|
|
707
|
-
${
|
|
708
|
-
${
|
|
818
|
+
class=${$("pp-badge",this.badge.pulse&&"pp-badge-pulse",this.badge.glow&&"pp-badge-glow",n&&"pp-badge-with-icon")}
|
|
819
|
+
style=${styleMap_js.styleMap({width:i?"auto":`${p}px`,minWidth:`${p}px`,height:`${p}px`,padding:i?"0 6px":"0",fontSize:`${d}px`,backgroundColor:u,color:f,borderRadius:h,"--pp-badge-glow-color":u,gap:n&&e?"4px":"0",...m[t]})}>
|
|
820
|
+
${y?lit.html`<span class="pp-badge-icon" style=${styleMap_js.styleMap({fontSize:`${T}px`})}>${y}</span>`:lit.nothing}
|
|
821
|
+
${v??lit.nothing}
|
|
709
822
|
</div>
|
|
710
|
-
`}renderRibbon(){if(!this.ribbon)return lit.nothing;let t=this.ribbon.position??"top-right",e=this.ribbon.bgColor??"#ef4444",
|
|
823
|
+
`}renderRibbon(){if(!this.ribbon)return lit.nothing;let t=this.ribbon.position??"top-right",e=this.ribbon.bgColor??"#ef4444",n=this.ribbon.color??"#ffffff",i=V(e)?{backgroundColor:e}:{background:e},p={color:n},d=Math.min(75,this.pixelSize*.9),u=Math.min(32,this.pixelSize*.4),f=Math.min(13,Math.max(8,this.pixelSize*.11));return lit.html`
|
|
711
824
|
<div
|
|
712
|
-
class=${
|
|
713
|
-
style=${styleMap_js.styleMap({width:`${
|
|
825
|
+
class=${$("pp-ribbon-container",bt(t))}
|
|
826
|
+
style=${styleMap_js.styleMap({width:`${d}px`,height:`${u}px`})}>
|
|
714
827
|
<div
|
|
715
|
-
class=${
|
|
716
|
-
style=${styleMap_js.styleMap({fontSize:`${
|
|
828
|
+
class=${$("pp-ribbon np:origin-center np:transform",ht(t))}
|
|
829
|
+
style=${styleMap_js.styleMap({fontSize:`${f}px`,padding:`${f*.3}px 0`,...i,...p})}>
|
|
717
830
|
${this.ribbon.icon?lit.html`<span style="margin-right: 2px">${this.ribbon.icon}</span>`:lit.nothing}
|
|
718
831
|
${this.ribbon.text}
|
|
719
832
|
</div>
|
|
@@ -733,7 +846,7 @@ ${Ft}`;var i=class extends lit.LitElement{constructor(){super(...arguments);this
|
|
|
733
846
|
<!-- Inner container for image clipping -->
|
|
734
847
|
<div
|
|
735
848
|
class="pp-inner"
|
|
736
|
-
style=${styleMap_js.styleMap({borderRadius:
|
|
849
|
+
style=${styleMap_js.styleMap({borderRadius:H[this.variant]})}>
|
|
737
850
|
<!-- Placeholder -->
|
|
738
851
|
${this.renderPlaceholder()}
|
|
739
852
|
|
|
@@ -750,10 +863,58 @@ ${Ft}`;var i=class extends lit.LitElement{constructor(){super(...arguments);this
|
|
|
750
863
|
<!-- Presence Indicator -->
|
|
751
864
|
${this.renderPresence()}
|
|
752
865
|
</div>
|
|
753
|
-
`}};
|
|
866
|
+
`}};a.stylesInjected=false,a.cdnBaseUrl="",a.instances=new Set,s([decorators_js.property({type:String})],a.prototype,"src",2),s([decorators_js.property({type:String})],a.prototype,"alt",2),s([decorators_js.property({type:String,attribute:"ext-customer-id"})],a.prototype,"extCustomerId",2),s([decorators_js.property({type:String})],a.prototype,"size",2),s([decorators_js.property({type:String})],a.prototype,"variant",2),s([decorators_js.property({type:String})],a.prototype,"shadow",2),s([decorators_js.property({type:Boolean})],a.prototype,"border",2),s([decorators_js.property({type:Number,attribute:"border-width"})],a.prototype,"borderWidth",2),s([decorators_js.property({type:String,attribute:"border-color"})],a.prototype,"borderColor",2),s([decorators_js.property({type:Number})],a.prototype,"rotation",2),s([decorators_js.property({type:String,attribute:"bg-color"})],a.prototype,"bgColor",2),s([decorators_js.property({type:String,attribute:"bg-gradient"})],a.prototype,"bgGradient",2),s([decorators_js.property({type:Object,attribute:"ring",converter:{fromAttribute:t=>{if(t)try{return JSON.parse(t)}catch{return}},toAttribute:t=>t?JSON.stringify(t):null}})],a.prototype,"ring",2),s([decorators_js.property({type:Object,attribute:"presence",converter:{fromAttribute:t=>{if(t)try{return JSON.parse(t)}catch{return}},toAttribute:t=>t?JSON.stringify(t):null}})],a.prototype,"presence",2),s([decorators_js.property({type:Object,attribute:"glow",converter:{fromAttribute:t=>{if(t)try{return JSON.parse(t)}catch{return}},toAttribute:t=>t?JSON.stringify(t):null}})],a.prototype,"glow",2),s([decorators_js.property({type:Object,attribute:"ribbon",converter:{fromAttribute:t=>{if(t)try{return JSON.parse(t)}catch{return}},toAttribute:t=>t?JSON.stringify(t):null}})],a.prototype,"ribbon",2),s([decorators_js.property({type:Object,attribute:"badge",converter:{fromAttribute:t=>{if(t)try{return JSON.parse(t)}catch{return}},toAttribute:t=>t?JSON.stringify(t):null}})],a.prototype,"badge",2),s([decorators_js.property({type:String})],a.prototype,"loading",2),s([decorators_js.property({type:String})],a.prototype,"placeholder",2),s([decorators_js.property({type:String,attribute:"placeholder-color"})],a.prototype,"placeholderColor",2),s([decorators_js.property({type:String})],a.prototype,"fallback",2),s([decorators_js.property({type:Object,attribute:"interactive",converter:{fromAttribute:t=>{if(t)try{return JSON.parse(t)}catch{return}},toAttribute:t=>t?JSON.stringify(t):null}})],a.prototype,"interactive",2),s([decorators_js.state()],a.prototype,"isLoaded",2),s([decorators_js.state()],a.prototype,"hasError",2),s([decorators_js.state()],a.prototype,"cdnImageUrl",2),s([decorators_js.state()],a.prototype,"cdnLoadFailed",2),a=s([decorators_js.customElement("profile-picture")],a);var Mt=false;function Qt(){if(Mt||typeof document>"u")return;let r=document.createElement("style");r.textContent=Lt,document.head.appendChild(r),Mt=true;}var b=class extends lit.LitElement{constructor(){super(...arguments);this.max=z.max;this.direction=z.direction;this.overlap=z.overlap;this.size=z.size;this.showAddButton=false;this.addButtonLabel="Add user";this.animated=z.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 Qt(),this}get pixelSize(){return Ct(this.size)}get tooltipEnabled(){return this.tooltip?.enabled!==false}get tooltipPosition(){return this.tooltip?.position??"top"}get tooltipDelay(){return this.tooltip?.delay??z.tooltipDelay}get dropdownMaxHeight(){return this.dropdown?.maxHeight??z.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","data-user-id","data-status","variant","shadow","border","border-width","border-color","bg-color","bg-gradient"]});}updateUsers(){let t=Array.from(this.children).filter(e=>e.tagName.toLowerCase()==="profile-picture"&&e.getAttribute("slot")!=="internal");this.users=t.map((e,n)=>{let i=e.getAttribute("border-width"),p=i?Number.parseInt(i,10):void 0;return {id:e.getAttribute("data-user-id")??void 0,name:e.getAttribute("alt")??`User ${n+1}`,src:e.getAttribute("src")??void 0,status:e.getAttribute("data-status")??void 0,element:e,index:n,variant:e.getAttribute("variant")??void 0,shadow:e.getAttribute("shadow")??void 0,border:e.hasAttribute("border"),borderWidth:p,borderColor:e.getAttribute("border-color")??void 0,bgColor:e.getAttribute("bg-color")??void 0,bgGradient:e.getAttribute("bg-gradient")??void 0}});for(let e of this.users)e.element&&(e.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&&(lit.render(lit.nothing,this.portalContainer),this.portalContainer.remove(),this.portalContainer=null,document.body.style.overflow="");}updatePortalContent(t){if(!(this.portalContainer&&this.counterRef))return;let e=this.counterRef.getBoundingClientRect(),n=10,i=280,p=Math.min(this.dropdownMaxHeight+60,t.length*56+60),d=window.innerWidth,u=window.innerHeight;if(d<480){let S=lit.html`
|
|
867
|
+
<div
|
|
868
|
+
class="ppg-backdrop ppg-backdrop-visible"
|
|
869
|
+
style="pointer-events: auto; background: rgba(0,0,0,0.5);"
|
|
870
|
+
@click=${this.handleBackdropClick}
|
|
871
|
+
aria-hidden="true"
|
|
872
|
+
></div>
|
|
873
|
+
<div
|
|
874
|
+
class="ppg-dropdown ppg-dropdown-modal"
|
|
875
|
+
style=${styleMap_js.styleMap({position:"fixed",pointerEvents:"auto",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"calc(100vw - 32px)",maxWidth:"320px",maxHeight:"70vh"})}
|
|
876
|
+
data-position="modal"
|
|
877
|
+
role="menu"
|
|
878
|
+
aria-label="Hidden users"
|
|
879
|
+
>
|
|
880
|
+
<div class="ppg-dropdown-header">
|
|
881
|
+
${t.length} more
|
|
882
|
+
</div>
|
|
883
|
+
<div
|
|
884
|
+
class="ppg-dropdown-list"
|
|
885
|
+
style=${styleMap_js.styleMap({maxHeight:"calc(70vh - 60px)"})}
|
|
886
|
+
>
|
|
887
|
+
${t.map(L=>this.renderDropdownItem(L))}
|
|
888
|
+
</div>
|
|
889
|
+
</div>
|
|
890
|
+
`;lit.render(S,this.portalContainer);return}let h=u-e.bottom-n,v=e.top-n,y=d-e.left,T=e.right,l=this.dropdownPosition;l==="bottom"&&h<p&&v>h?l="top":l==="top"&&v<p&&h>v&&(l="bottom");let m;y>=i?m=e.left:T>=i?m=e.right-i:m=(d-i)/2,m=Math.max(8,Math.min(m,d-i-8));let M=l==="bottom"?e.bottom+n:void 0,U=l==="top"?u-e.top+n:void 0,P=lit.html`
|
|
891
|
+
<div
|
|
892
|
+
class="ppg-backdrop"
|
|
893
|
+
style="pointer-events: auto;"
|
|
894
|
+
@click=${this.handleBackdropClick}
|
|
895
|
+
aria-hidden="true"
|
|
896
|
+
></div>
|
|
897
|
+
<div
|
|
898
|
+
class="ppg-dropdown ppg-dropdown-portal"
|
|
899
|
+
style=${styleMap_js.styleMap({position:"fixed",pointerEvents:"auto",top:M!==void 0?`${M}px`:"auto",bottom:U!==void 0?`${U}px`:"auto",left:`${m}px`,width:`${i}px`})}
|
|
900
|
+
data-position=${l}
|
|
901
|
+
role="menu"
|
|
902
|
+
aria-label="Hidden users"
|
|
903
|
+
>
|
|
904
|
+
<div class="ppg-dropdown-header">
|
|
905
|
+
${t.length} more
|
|
906
|
+
</div>
|
|
907
|
+
<div
|
|
908
|
+
class="ppg-dropdown-list"
|
|
909
|
+
style=${styleMap_js.styleMap({maxHeight:`${this.dropdownMaxHeight}px`})}
|
|
910
|
+
>
|
|
911
|
+
${t.map(S=>this.renderDropdownItem(S))}
|
|
912
|
+
</div>
|
|
913
|
+
</div>
|
|
914
|
+
`;lit.render(P,this.portalContainer);}handleAvatarClick(t){this.dispatchEvent(new CustomEvent("avatar-click",{detail:{user:t},bubbles:true,composed:true}));}handleAvatarHover(t,e){if(!this.tooltipEnabled)return;this.clearTooltipTimeout();let n=e.currentTarget;this.tooltipTimeout=window.setTimeout(()=>{this.tooltipData={user:t,rect:n.getBoundingClientRect()};},this.tooltipDelay),this.dispatchEvent(new CustomEvent("avatar-hover",{detail:{user:t},bubbles:true,composed:true}));}handleAvatarLeave(){this.clearTooltipTimeout(),this.tooltipData=null;}clearTooltipTimeout(){this.tooltipTimeout&&(window.clearTimeout(this.tooltipTimeout),this.tooltipTimeout=null);}handleCounterClick(t){this.dropdownOpen=!this.dropdownOpen,this.dropdownOpen?(this.createPortal(),this.updatePortalContent(t)):this.destroyPortal(),this.dispatchEvent(new CustomEvent("counter-click",{detail:{hiddenUsers:t,open:this.dropdownOpen},bubbles:true,composed:true}));}handleDropdownItemClick(t){this.dropdownOpen=false,this.destroyPortal(),this.dispatchEvent(new CustomEvent("dropdown-item-click",{detail:{user:t},bubbles:true,composed:true}));}handleAddClick(){this.dispatchEvent(new CustomEvent("add-click",{bubbles:true,composed:true}));}handleKeyDown(t,e){(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),e());}renderAvatar(t,e,n){let i=Z(e,this.pixelSize,this.overlap,this.direction,this.spacing),p=St(e,n,this.direction),d=t.variant??"circle",u=t.shadow??"none",f=this.rotationAmount?e%2===0?-this.rotationAmount:this.rotationAmount:0;return lit.html`
|
|
754
915
|
<div
|
|
755
916
|
class="ppg-avatar-wrapper"
|
|
756
|
-
style=${styleMap_js.styleMap({left:`${
|
|
917
|
+
style=${styleMap_js.styleMap({left:`${i}px`,zIndex:String(p),width:`${this.pixelSize}px`,height:`${this.pixelSize}px`})}
|
|
757
918
|
tabindex="0"
|
|
758
919
|
role="button"
|
|
759
920
|
aria-label=${t.name}
|
|
@@ -762,16 +923,16 @@ ${Ft}`;var i=class extends lit.LitElement{constructor(){super(...arguments);this
|
|
|
762
923
|
@mouseleave=${this.handleAvatarLeave}
|
|
763
924
|
@keydown=${h=>this.handleKeyDown(h,()=>this.handleAvatarClick(t))}
|
|
764
925
|
>
|
|
765
|
-
${this.renderProfilePicture(t,
|
|
926
|
+
${this.renderProfilePicture(t,d,u,f)}
|
|
766
927
|
</div>
|
|
767
|
-
`}renderProfilePicture(t,e,
|
|
928
|
+
`}renderProfilePicture(t,e,n,i){return lit.html`
|
|
768
929
|
<profile-picture
|
|
769
930
|
.src=${t.src??""}
|
|
770
931
|
.alt=${t.name}
|
|
771
932
|
.size=${this.pixelSize}
|
|
772
933
|
.variant=${e}
|
|
773
|
-
.shadow=${
|
|
774
|
-
.rotation=${
|
|
934
|
+
.shadow=${n}
|
|
935
|
+
.rotation=${i}
|
|
775
936
|
?border=${t.border}
|
|
776
937
|
.borderWidth=${t.border?t.borderWidth??2:2}
|
|
777
938
|
.borderColor=${t.border?t.borderColor??"#ffffff":"#ffffff"}
|
|
@@ -780,16 +941,16 @@ ${Ft}`;var i=class extends lit.LitElement{constructor(){super(...arguments);this
|
|
|
780
941
|
data-user-id=${t.id??""}
|
|
781
942
|
data-status=${t.status??""}
|
|
782
943
|
></profile-picture>
|
|
783
|
-
`}renderCounter(t,e){return lit.html`
|
|
944
|
+
`}renderCounter(t,e,n){return lit.html`
|
|
784
945
|
<button
|
|
785
946
|
class="ppg-counter"
|
|
786
947
|
style=${styleMap_js.styleMap({left:`${e}px`,width:`${this.pixelSize}px`,height:`${this.pixelSize}px`,zIndex:"1"})}
|
|
787
948
|
aria-label=${`${t} more users`}
|
|
788
949
|
aria-expanded=${this.dropdownOpen}
|
|
789
950
|
aria-haspopup="true"
|
|
790
|
-
@click=${()=>this.handleCounterClick(
|
|
951
|
+
@click=${()=>this.handleCounterClick(n)}
|
|
791
952
|
>
|
|
792
|
-
${
|
|
953
|
+
${$t(t)}
|
|
793
954
|
</button>
|
|
794
955
|
`}renderAddButton(t){let e=Math.round(this.pixelSize*.4);return lit.html`
|
|
795
956
|
<button
|
|
@@ -813,44 +974,22 @@ ${Ft}`;var i=class extends lit.LitElement{constructor(){super(...arguments);this
|
|
|
813
974
|
<line x1="5" y1="12" x2="19" y2="12"></line>
|
|
814
975
|
</svg>
|
|
815
976
|
</button>
|
|
816
|
-
`}renderTooltip(){if(!this.tooltipData)return lit.nothing;let{user:t,rect:e}=this.tooltipData,
|
|
977
|
+
`}renderTooltip(){if(!this.tooltipData)return lit.nothing;let{user:t,rect:e}=this.tooltipData,n=8,i=this.getBoundingClientRect(),p=e.left-i.left+e.width/2,d=e.top-i.top,u=e.bottom-i.top,f=this.tooltipPosition==="top";return lit.html`
|
|
817
978
|
<div
|
|
818
979
|
class="ppg-tooltip"
|
|
819
|
-
style=${styleMap_js.styleMap({top:
|
|
980
|
+
style=${styleMap_js.styleMap({top:f?"auto":`${u+n}px`,bottom:f?`${i.height-d+n}px`:"auto",left:`${p}px`})}
|
|
820
981
|
data-position=${this.tooltipPosition}
|
|
821
982
|
role="tooltip"
|
|
822
983
|
>
|
|
823
984
|
${t.name}
|
|
824
985
|
</div>
|
|
825
|
-
`}
|
|
826
|
-
<div
|
|
827
|
-
class="ppg-backdrop"
|
|
828
|
-
@click=${this.handleBackdropClick}
|
|
829
|
-
aria-hidden="true"
|
|
830
|
-
></div>
|
|
831
|
-
<div
|
|
832
|
-
class="ppg-dropdown"
|
|
833
|
-
data-position=${this.dropdownPosition}
|
|
834
|
-
role="menu"
|
|
835
|
-
aria-label="Hidden users"
|
|
836
|
-
>
|
|
837
|
-
<div class="ppg-dropdown-header">
|
|
838
|
-
${t.length} more
|
|
839
|
-
</div>
|
|
840
|
-
<div
|
|
841
|
-
class="ppg-dropdown-list"
|
|
842
|
-
style=${styleMap_js.styleMap({maxHeight:`${this.dropdownMaxHeight}px`})}
|
|
843
|
-
>
|
|
844
|
-
${t.map(e=>this.renderDropdownItem(e))}
|
|
845
|
-
</div>
|
|
846
|
-
</div>
|
|
847
|
-
`:lit.nothing}renderDropdownItem(t){let e=F(t.name);return lit.html`
|
|
986
|
+
`}renderDropdownItem(t){let e=X(t.name);return lit.html`
|
|
848
987
|
<div
|
|
849
988
|
class="ppg-dropdown-item"
|
|
850
989
|
role="menuitem"
|
|
851
990
|
tabindex="0"
|
|
852
991
|
@click=${()=>this.handleDropdownItemClick(t)}
|
|
853
|
-
@keydown=${
|
|
992
|
+
@keydown=${n=>this.handleKeyDown(n,()=>this.handleDropdownItemClick(t))}
|
|
854
993
|
>
|
|
855
994
|
${t.src?lit.html`<img
|
|
856
995
|
class="ppg-dropdown-avatar"
|
|
@@ -860,7 +999,7 @@ ${Ft}`;var i=class extends lit.LitElement{constructor(){super(...arguments);this
|
|
|
860
999
|
class="ppg-dropdown-avatar-fallback"
|
|
861
1000
|
style=${styleMap_js.styleMap({background:e})}
|
|
862
1001
|
>
|
|
863
|
-
${
|
|
1002
|
+
${q(t.name)}
|
|
864
1003
|
</div>`}
|
|
865
1004
|
<div class="ppg-dropdown-info">
|
|
866
1005
|
<div class="ppg-dropdown-name">${t.name}</div>
|
|
@@ -875,9 +1014,9 @@ ${Ft}`;var i=class extends lit.LitElement{constructor(){super(...arguments);this
|
|
|
875
1014
|
`:lit.nothing}
|
|
876
1015
|
</div>
|
|
877
1016
|
</div>
|
|
878
|
-
`}formatStatus(t){return {online:"Online",away:"Away",busy:"Busy",offline:"Offline",dnd:"Do not disturb"}[t]??t}render(){let{visible:t,hidden:e,showCounter:
|
|
1017
|
+
`}formatStatus(t){return {online:"Online",away:"Away",busy:"Busy",offline:"Offline",dnd:"Do not disturb"}[t]??t}updated(t){super.updated(t);let e=this.querySelector(".ppg-counter");if(e&&(this.counterRef=e),this.dropdownOpen&&this.portalContainer){let{visible:n}=nt(this.users.length,this.max,this.showAddButton),i=this.users.slice(n);this.updatePortalContent(i);}}render(){let{visible:t,hidden:e,showCounter:n}=nt(this.users.length,this.max,this.showAddButton),i=this.direction==="ltr"?this.users.slice(0,t):this.users.slice(0,t).reverse(),p=this.users.slice(t),d=t;n&&d++,this.showAddButton&&d++;let u=kt(d,this.pixelSize,this.overlap,this.spacing),f=n?Z(t,this.pixelSize,this.overlap,this.direction,this.spacing):0,h=Z(t+(n?1:0),this.pixelSize,this.overlap,this.direction,this.spacing);return lit.html`
|
|
879
1018
|
<div
|
|
880
|
-
class=${
|
|
1019
|
+
class=${$("ppg-container",this.animated&&"ppg-animated")}
|
|
881
1020
|
style=${styleMap_js.styleMap({width:`${u}px`,height:`${this.pixelSize}px`})}
|
|
882
1021
|
role="group"
|
|
883
1022
|
aria-label="User avatars"
|
|
@@ -886,19 +1025,16 @@ ${Ft}`;var i=class extends lit.LitElement{constructor(){super(...arguments);this
|
|
|
886
1025
|
<slot style="display: none;"></slot>
|
|
887
1026
|
|
|
888
1027
|
<!-- Visible avatars -->
|
|
889
|
-
${
|
|
1028
|
+
${i.map((v,y)=>this.renderAvatar(v,y,t))}
|
|
890
1029
|
|
|
891
1030
|
<!-- Counter -->
|
|
892
|
-
${
|
|
1031
|
+
${n?this.renderCounter(e,f,p):lit.nothing}
|
|
893
1032
|
|
|
894
1033
|
<!-- Add button -->
|
|
895
1034
|
${this.showAddButton?this.renderAddButton(h):lit.nothing}
|
|
896
1035
|
|
|
897
1036
|
<!-- Tooltip -->
|
|
898
1037
|
${this.renderTooltip()}
|
|
899
|
-
|
|
900
|
-
<!-- Dropdown -->
|
|
901
|
-
${o?this.renderDropdown(p):lit.nothing}
|
|
902
1038
|
</div>
|
|
903
|
-
`}};s([decorators_js.property({type:Number})],
|
|
1039
|
+
`}};s([decorators_js.property({type:Number})],b.prototype,"max",2),s([decorators_js.property({type:String})],b.prototype,"direction",2),s([decorators_js.property({type:Number})],b.prototype,"overlap",2),s([decorators_js.property({type:String})],b.prototype,"size",2),s([decorators_js.property({type:Number})],b.prototype,"spacing",2),s([decorators_js.property({type:Object})],b.prototype,"tooltip",2),s([decorators_js.property({type:Object})],b.prototype,"dropdown",2),s([decorators_js.property({type:Boolean,attribute:"show-add-button"})],b.prototype,"showAddButton",2),s([decorators_js.property({type:String,attribute:"add-button-label"})],b.prototype,"addButtonLabel",2),s([decorators_js.property({type:Boolean})],b.prototype,"animated",2),s([decorators_js.property({type:Number,attribute:"rotation-amount"})],b.prototype,"rotationAmount",2),s([decorators_js.state()],b.prototype,"users",2),s([decorators_js.state()],b.prototype,"dropdownOpen",2),s([decorators_js.state()],b.prototype,"tooltipData",2),b=s([decorators_js.customElement("profile-picture-group")],b);var dt=Ut__default.default.forwardRef(({max:r,direction:o,overlap:t,size:e,spacing:n,tooltip:i,dropdown:p,showAddButton:d,addButtonLabel:u,animated:f,rotationAmount:h,onAvatarClick:v,onAvatarHover:y,onCounterClick:T,onDropdownItemClick:l,onAddClick:m,className:M,style:U,children:P},S)=>{let L=Ut.useRef(null),B=Ut.useCallback(g=>{v?.(g.detail.user);},[v]),O=Ut.useCallback(g=>{y?.(g.detail.user);},[y]),G=Ut.useCallback(g=>{let k=g;T?.(k.detail.hiddenUsers,k.detail.open);},[T]),F=Ut.useCallback(g=>{l?.(g.detail.user);},[l]),j=Ut.useCallback(()=>{m?.();},[m]);return Ut.useEffect(()=>{let g=L.current;if(g)return g.addEventListener("avatar-click",B),g.addEventListener("avatar-hover",O),g.addEventListener("counter-click",G),g.addEventListener("dropdown-item-click",F),g.addEventListener("add-click",j),()=>{g.removeEventListener("avatar-click",B),g.removeEventListener("avatar-hover",O),g.removeEventListener("counter-click",G),g.removeEventListener("dropdown-item-click",F),g.removeEventListener("add-click",j);}},[B,O,G,F,j]),Ut.useEffect(()=>{typeof S=="function"?S(L.current):S&&(S.current=L.current);},[S]),Ut__default.default.createElement("profile-picture-group",{ref:L,max:r,direction:o,overlap:t,size:e,spacing:n,tooltip:i?JSON.stringify(i):void 0,dropdown:p?JSON.stringify(p):void 0,"show-add-button":d||void 0,"add-button-label":u,animated:f,"rotation-amount":h,class:M,style:U},P)});dt.displayName="ProfilePictureGroup";function Gt({src:r,alt:o,extCustomerId:t,size:e,variant:n,shadow:i,border:p,borderWidth:d,borderColor:u,rotation:f,bgColor:h,bgGradient:v,glow:y,ring:T,presence:l,ribbon:m,badge:M,loading:U,placeholder:P,placeholderColor:S,fallback:L,interactive:B,onLoad:O,onError:G,onCdnError:F,className:j,style:g,ref:k}){let Y=Ut.useRef(null),_=Ut.useCallback(()=>{O?.();},[O]),tt=Ut.useCallback(()=>{G?.();},[G]),et=Ut.useCallback(D=>{F?.(D.detail);},[F]);return Ut.useEffect(()=>{let D=Y.current;if(D)return D.addEventListener("load",_),D.addEventListener("error",tt),D.addEventListener("cdn-error",et),()=>{D.removeEventListener("load",_),D.removeEventListener("error",tt),D.removeEventListener("cdn-error",et);}},[_,tt,et]),Ut.useEffect(()=>{typeof k=="function"?k(Y.current):k&&(k.current=Y.current);},[k]),Ut__default.default.createElement("profile-picture",{ref:Y,src:r,alt:o,"ext-customer-id":t,size:e,variant:n,shadow:i,border:p||void 0,"border-width":d,"border-color":u,rotation:f,"bg-color":h,"bg-gradient":v,glow:y?JSON.stringify(y):void 0,ring:T?JSON.stringify(T):void 0,presence:l?JSON.stringify(l):void 0,ribbon:m?JSON.stringify(m):void 0,badge:M?JSON.stringify(M):void 0,loading:U,placeholder:P,"placeholder-color":S,fallback:L,interactive:B?JSON.stringify(B):void 0,class:j,style:g})}Gt.displayName="ProfilePicture";gt();exports.ProfilePicture=Gt;exports.ProfilePictureGroup=dt;exports.constructCdnUrl=at;exports.detectThemeFromColor=it;exports.getCdnSizeLabel=ot;//# sourceMappingURL=index.cjs.map
|
|
904
1040
|
//# sourceMappingURL=index.cjs.map
|