@grasco/profile-picture 0.1.0
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 +385 -0
- package/dist/angular.cjs +353 -0
- package/dist/angular.cjs.map +1 -0
- package/dist/angular.d.cts +132 -0
- package/dist/angular.d.ts +132 -0
- package/dist/angular.js +353 -0
- package/dist/angular.js.map +1 -0
- package/dist/index.cjs +885 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +389 -0
- package/dist/index.d.ts +389 -0
- package/dist/index.js +885 -0
- package/dist/index.js.map +1 -0
- package/dist/standalone.d.ts +260 -0
- package/dist/standalone.standalone.js +952 -0
- package/dist/standalone.standalone.js.map +1 -0
- package/dist/styles.css +2 -0
- package/dist/svelte.cjs +353 -0
- package/dist/svelte.cjs.map +1 -0
- package/dist/svelte.d.cts +132 -0
- package/dist/svelte.d.ts +132 -0
- package/dist/svelte.js +353 -0
- package/dist/svelte.js.map +1 -0
- package/dist/vue.cjs +353 -0
- package/dist/vue.cjs.map +1 -0
- package/dist/vue.d.cts +132 -0
- package/dist/vue.d.ts +132 -0
- package/dist/vue.js +353 -0
- package/dist/vue.js.map +1 -0
- package/package.json +130 -0
- package/tailwind.safelist.js +90 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,885 @@
|
|
|
1
|
+
'use strict';var Ce=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 Ce__default=/*#__PURE__*/_interopDefault(Ce);var De=Object.defineProperty;var Ee=Object.getOwnPropertyDescriptor;var i=(r,o,e,t)=>{for(var n=t>1?void 0:t?Ee(o,e):o,a=r.length-1,p;a>=0;a--)(p=r[a])&&(n=(t?p(o,e,n):p(n))||n);return t&&n&&De(o,e,n),n};var J="grasco-profile-picture-styles",M=false;function Q(){if(M||typeof document>"u")return;if(document.getElementById(J)){M=true;return}if(document.querySelector('link[href*="profile-picture"][href$="styles.css"]')){M=true;return}let o=Re();if(!o)return;let e=document.createElement("link");e.id=J,e.rel="stylesheet",e.href=o,document.head.appendChild(e),M=true;}function Re(){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)}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)}styles.css`}return null}var R={"2xs":20,xs:24,sm:32,md:40,lg:48,xl:64,"2xl":80,"3xl":120},ee={online:"#30D158",away:"#FFD60A",busy:"#FF453A",offline:"#8E8E93",dnd:"#FF453A"},te={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)"},v={size:"md",variant:"circle",loading:"lazy",placeholder:"shimmer",borderWidth:2,borderColor:"#ffffff",placeholderColor:"#f3f4f6",shadow:"sm"};var A={circle:"9999px",rounded:"12px",squircle:"30%",square:"0px"},w={max:4,direction:"ltr",overlap:.3,size:"md",tooltipDelay:300,dropdownMaxHeight:280,animated:true};function h(...r){return r.filter(Boolean).join(" ")}function B(r){return /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(r)}function re(r){return {"top-left":"np:top-0 np:left-0","top-right":"np:top-0 np:right-0","bottom-left":"np:bottom-0 np:left-0","bottom-right":"np:bottom-0 np:right-0"}[r]}function oe(r){return {"top-left":"np:-rotate-45 np:-translate-x-1/4 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-right":"np:-rotate-45 np:translate-x-1/4 np:translate-y-1/2"}[r]}function O(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[e.length-1][0]).toUpperCase()}function Z(r){return Math.round(r*.38)}function ne(r,o){let t=Math.max(o?18:10,Math.round(r*(o?.32:.22))),n=Math.round(t*.6);return {size:t,fontSize:n}}function ie(r,o){return Math.max(8,Math.round(r*.25))+(o-1)*2}function ae(r,o){return typeof r=="string"?r:o&&r>o?`${o}+`:r.toString()}function se(r){return r.length===0?"transparent":r.length===1?r[0]:`conic-gradient(${r.map((e,t)=>{let n=t/r.length*360,a=(t+1)/r.length*360;return `${e} ${n}deg ${a}deg`}).join(", ")})`}function Ae(r){let o=0;for(let e=0;e<r.length;e++){let t=r.charCodeAt(e);o=(o<<5)-o+t,o&=o;}return Math.abs(o)}function F(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%)"],e=Ae(r)%o.length;return o[e]}function pe(r){return typeof r=="number"?r:R[r]??R[w.size]}function de(r,o,e){let t=e?o-1:o;if(r<=t)return {visible:r,hidden:0,showCounter:false};let n=t-1,a=r-n;return {visible:n,hidden:a,showCounter:true}}function P(r,o,e,t,n){let a=n??o*(1-e);return r*a}function le(r,o,e){return e==="ltr"?o-r:r+1}function ce(r,o,e,t){if(r===0)return 0;if(r===1)return o;let n=t??o*(1-e);return o+n*(r-1)}function ge(r){return r>99?"+99":`+${r}`}function ue(r){return {circle:"np:rounded-full",rounded:"np:rounded-xl",squircle:"np:rounded-[30%]",square:"np:rounded-none"}[r]}function be(r,o){return {className:{1:"np:border",2:"np:border-2",3:"np:border-[3px]",4:"np:border-4"}[r],style:{borderColor:o,borderStyle:"solid"}}}function fe(r,o){return o?{className:"",style:{background:o}}:r?r.includes("gradient")?{className:"",style:{background:r}}:{className:"",style:{backgroundColor:r}}:{className:"np:bg-gray-100"}}function he(r){return {boxShadow:te[r]}}var Te={shimmer:`
|
|
2
|
+
@keyframes pp-shimmer {
|
|
3
|
+
0% { transform: translateX(-100%); }
|
|
4
|
+
100% { transform: translateX(100%); }
|
|
5
|
+
}`,pulse:`
|
|
6
|
+
@keyframes pp-pulse {
|
|
7
|
+
0%, 100% { opacity: 1; transform: scale(1); }
|
|
8
|
+
50% { opacity: 0.7; transform: scale(0.98); }
|
|
9
|
+
}`,skeleton:`
|
|
10
|
+
@keyframes pp-skeleton {
|
|
11
|
+
0%, 100% { opacity: 1; }
|
|
12
|
+
50% { opacity: 0.5; }
|
|
13
|
+
}`,badgeBounce:`
|
|
14
|
+
@keyframes pp-badge-bounce {
|
|
15
|
+
0% { transform: scale(0) translateY(10px); opacity: 0; }
|
|
16
|
+
50% { transform: scale(1.2) translateY(-2px); }
|
|
17
|
+
100% { transform: scale(1) translateY(0); opacity: 1; }
|
|
18
|
+
}`,ringRotate:`
|
|
19
|
+
@keyframes pp-ring-rotate {
|
|
20
|
+
from { transform: rotate(0deg); }
|
|
21
|
+
to { transform: rotate(360deg); }
|
|
22
|
+
}`,presencePulse:`
|
|
23
|
+
@keyframes pp-presence-pulse {
|
|
24
|
+
0%, 100% { box-shadow: 0 0 0 0 currentColor; }
|
|
25
|
+
50% { box-shadow: 0 0 0 4px transparent; }
|
|
26
|
+
}`,glow:`
|
|
27
|
+
@keyframes pp-glow {
|
|
28
|
+
0%, 100% { box-shadow: 0 0 20px 0 var(--pp-glow-color, rgba(99, 102, 241, 0.3)); }
|
|
29
|
+
50% { box-shadow: 0 0 30px 5px var(--pp-glow-color, rgba(99, 102, 241, 0.5)); }
|
|
30
|
+
}`,fadeIn:`
|
|
31
|
+
@keyframes pp-fade-in {
|
|
32
|
+
from { opacity: 0; }
|
|
33
|
+
to { opacity: 1; }
|
|
34
|
+
}`,scaleIn:`
|
|
35
|
+
@keyframes pp-scale-in {
|
|
36
|
+
0% { transform: scale(0.8); opacity: 0; }
|
|
37
|
+
50% { transform: scale(1.05); }
|
|
38
|
+
100% { transform: scale(1); opacity: 1; }
|
|
39
|
+
}`},Ue=Object.values(Te).join(`
|
|
40
|
+
`),Le=`
|
|
41
|
+
/* Profile Picture Component Styles */
|
|
42
|
+
.pp-container {
|
|
43
|
+
--pp-transition-duration: 200ms;
|
|
44
|
+
--pp-transition-timing: cubic-bezier(0.4, 0, 0.2, 1);
|
|
45
|
+
--pp-spring-timing: cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
46
|
+
position: relative;
|
|
47
|
+
display: inline-flex;
|
|
48
|
+
align-items: center;
|
|
49
|
+
justify-content: center;
|
|
50
|
+
user-select: none;
|
|
51
|
+
-webkit-user-select: none;
|
|
52
|
+
flex-shrink: 0;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* Inner container for image clipping - allows badges/rings to overflow */
|
|
56
|
+
.pp-inner {
|
|
57
|
+
position: absolute;
|
|
58
|
+
inset: 0;
|
|
59
|
+
overflow: hidden;
|
|
60
|
+
border-radius: inherit;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* Interactive states */
|
|
64
|
+
.pp-interactive {
|
|
65
|
+
cursor: pointer;
|
|
66
|
+
transition: transform var(--pp-transition-duration) var(--pp-spring-timing),
|
|
67
|
+
box-shadow var(--pp-transition-duration) var(--pp-transition-timing);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.pp-interactive:hover {
|
|
71
|
+
transform: scale(1.05);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.pp-interactive:active {
|
|
75
|
+
transform: scale(0.95);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.pp-interactive:focus-visible {
|
|
79
|
+
outline: none;
|
|
80
|
+
box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.5);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* Image styles */
|
|
84
|
+
.pp-image {
|
|
85
|
+
position: absolute;
|
|
86
|
+
inset: 0;
|
|
87
|
+
width: 100%;
|
|
88
|
+
height: 100%;
|
|
89
|
+
object-fit: cover;
|
|
90
|
+
transition: opacity var(--pp-transition-duration) var(--pp-transition-timing);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.pp-image-loading {
|
|
94
|
+
opacity: 0;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.pp-image-loaded {
|
|
98
|
+
opacity: 1;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/* Fallback styles */
|
|
102
|
+
.pp-fallback {
|
|
103
|
+
display: flex;
|
|
104
|
+
align-items: center;
|
|
105
|
+
justify-content: center;
|
|
106
|
+
width: 100%;
|
|
107
|
+
height: 100%;
|
|
108
|
+
font-weight: 500;
|
|
109
|
+
color: rgba(255, 255, 255, 0.9);
|
|
110
|
+
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
|
111
|
+
font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
|
|
112
|
+
letter-spacing: 0.02em;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.pp-fallback-icon {
|
|
116
|
+
color: rgba(156, 163, 175, 0.8);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/* Shimmer placeholder */
|
|
120
|
+
.pp-shimmer {
|
|
121
|
+
position: absolute;
|
|
122
|
+
inset: 0;
|
|
123
|
+
overflow: hidden;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.pp-shimmer::after {
|
|
127
|
+
content: '';
|
|
128
|
+
position: absolute;
|
|
129
|
+
inset: 0;
|
|
130
|
+
background: linear-gradient(
|
|
131
|
+
90deg,
|
|
132
|
+
transparent 0%,
|
|
133
|
+
rgba(255, 255, 255, 0.4) 50%,
|
|
134
|
+
transparent 100%
|
|
135
|
+
);
|
|
136
|
+
animation: pp-shimmer 1.5s infinite;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/* Pulse placeholder */
|
|
140
|
+
.pp-pulse {
|
|
141
|
+
animation: pp-pulse 2s ease-in-out infinite;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/* Skeleton placeholder */
|
|
145
|
+
.pp-skeleton {
|
|
146
|
+
background: linear-gradient(90deg, #e5e7eb 0%, #f3f4f6 50%, #e5e7eb 100%);
|
|
147
|
+
background-size: 200% 100%;
|
|
148
|
+
animation: pp-skeleton 1.5s ease-in-out infinite;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/* Badge styles */
|
|
152
|
+
.pp-badge {
|
|
153
|
+
position: absolute;
|
|
154
|
+
display: flex;
|
|
155
|
+
align-items: center;
|
|
156
|
+
justify-content: center;
|
|
157
|
+
border-radius: 9999px;
|
|
158
|
+
font-weight: 600;
|
|
159
|
+
font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
|
|
160
|
+
line-height: 1;
|
|
161
|
+
animation: pp-badge-bounce 0.4s var(--pp-spring-timing);
|
|
162
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
|
|
163
|
+
border: 2px solid white;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.pp-badge-pulse {
|
|
167
|
+
animation: pp-badge-bounce 0.4s var(--pp-spring-timing),
|
|
168
|
+
pp-presence-pulse 2s ease-in-out infinite 0.4s;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.pp-badge-glow {
|
|
172
|
+
box-shadow: 0 0 10px 2px var(--pp-badge-glow-color, currentColor);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/* Ribbon styles */
|
|
176
|
+
.pp-ribbon-container {
|
|
177
|
+
position: absolute;
|
|
178
|
+
z-index: 10;
|
|
179
|
+
overflow: hidden;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.pp-ribbon {
|
|
183
|
+
position: absolute;
|
|
184
|
+
width: 100%;
|
|
185
|
+
text-align: center;
|
|
186
|
+
font-weight: 600;
|
|
187
|
+
font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
|
|
188
|
+
text-transform: uppercase;
|
|
189
|
+
letter-spacing: 0.05em;
|
|
190
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/* Ring effect (Instagram-style) */
|
|
194
|
+
.pp-ring {
|
|
195
|
+
position: absolute;
|
|
196
|
+
inset: -4px;
|
|
197
|
+
border-radius: inherit;
|
|
198
|
+
padding: 3px;
|
|
199
|
+
background: var(--pp-ring-color, linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888));
|
|
200
|
+
-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
|
|
201
|
+
mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
|
|
202
|
+
-webkit-mask-composite: xor;
|
|
203
|
+
mask-composite: exclude;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.pp-ring-animated {
|
|
207
|
+
animation: pp-ring-rotate 3s linear infinite;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/* Presence indicator */
|
|
211
|
+
.pp-presence {
|
|
212
|
+
position: absolute;
|
|
213
|
+
bottom: 0;
|
|
214
|
+
right: 0;
|
|
215
|
+
border-radius: 9999px;
|
|
216
|
+
border: 2px solid white;
|
|
217
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.pp-presence-animated {
|
|
221
|
+
animation: pp-presence-pulse 2s ease-in-out infinite;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/* Glow effect */
|
|
225
|
+
.pp-glow {
|
|
226
|
+
animation: pp-glow 2s ease-in-out infinite;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/* Reduced motion support */
|
|
230
|
+
@media (prefers-reduced-motion: reduce) {
|
|
231
|
+
.pp-container,
|
|
232
|
+
.pp-interactive,
|
|
233
|
+
.pp-image,
|
|
234
|
+
.pp-shimmer::after,
|
|
235
|
+
.pp-pulse,
|
|
236
|
+
.pp-skeleton,
|
|
237
|
+
.pp-badge,
|
|
238
|
+
.pp-ring-animated,
|
|
239
|
+
.pp-presence-animated,
|
|
240
|
+
.pp-glow {
|
|
241
|
+
animation: none !important;
|
|
242
|
+
transition: none !important;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
`,me=`${Ue}
|
|
246
|
+
${Le}`,xe=`
|
|
247
|
+
@keyframes np-shimmer {
|
|
248
|
+
0% { background-position: -200% 0; }
|
|
249
|
+
100% { background-position: 200% 0; }
|
|
250
|
+
}
|
|
251
|
+
.np-shimmer {
|
|
252
|
+
background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.4) 50%, transparent 100%);
|
|
253
|
+
background-size: 200% 100%;
|
|
254
|
+
animation: np-shimmer 1.5s infinite;
|
|
255
|
+
}
|
|
256
|
+
`;function ve(r,o=.3){if(B(r)){let e=Number.parseInt(r.slice(1,3),16),t=Number.parseInt(r.slice(3,5),16),n=Number.parseInt(r.slice(5,7),16);return `0 0 20px 0 rgba(${e}, ${t}, ${n}, ${o})`}return `0 0 20px 0 ${r}`}var Ie=`
|
|
257
|
+
@keyframes ppg-tooltip-in {
|
|
258
|
+
from {
|
|
259
|
+
opacity: 0;
|
|
260
|
+
transform: translateY(4px) scale(0.96);
|
|
261
|
+
}
|
|
262
|
+
to {
|
|
263
|
+
opacity: 1;
|
|
264
|
+
transform: translateY(0) scale(1);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
@keyframes ppg-dropdown-in {
|
|
269
|
+
from {
|
|
270
|
+
opacity: 0;
|
|
271
|
+
transform: translateY(-8px) scale(0.96);
|
|
272
|
+
}
|
|
273
|
+
to {
|
|
274
|
+
opacity: 1;
|
|
275
|
+
transform: translateY(0) scale(1);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
@keyframes ppg-avatar-lift {
|
|
280
|
+
from {
|
|
281
|
+
transform: translateY(0) scale(1);
|
|
282
|
+
}
|
|
283
|
+
to {
|
|
284
|
+
transform: translateY(-4px) scale(1.08);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
`,Ge=`
|
|
288
|
+
/* Profile Picture Group Container */
|
|
289
|
+
.ppg-container {
|
|
290
|
+
--ppg-transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
291
|
+
--ppg-spring: 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
292
|
+
--ppg-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
|
|
293
|
+
--ppg-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
294
|
+
--ppg-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
|
|
295
|
+
--ppg-radius: 12px;
|
|
296
|
+
--ppg-counter-bg: #f5f5f7;
|
|
297
|
+
--ppg-counter-text: #1d1d1f;
|
|
298
|
+
--ppg-add-bg: #f5f5f7;
|
|
299
|
+
--ppg-add-hover: #e8e8ed;
|
|
300
|
+
--ppg-add-icon: #86868b;
|
|
301
|
+
--ppg-border: rgba(0, 0, 0, 0.08);
|
|
302
|
+
--ppg-tooltip-bg: rgba(29, 29, 31, 0.95);
|
|
303
|
+
--ppg-tooltip-text: #ffffff;
|
|
304
|
+
--ppg-dropdown-bg: #ffffff;
|
|
305
|
+
--ppg-dropdown-hover: #f5f5f7;
|
|
306
|
+
|
|
307
|
+
position: relative;
|
|
308
|
+
display: inline-flex;
|
|
309
|
+
align-items: center;
|
|
310
|
+
isolation: isolate;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/* Avatar wrapper for positioning */
|
|
314
|
+
.ppg-avatar-wrapper {
|
|
315
|
+
position: absolute;
|
|
316
|
+
top: 0;
|
|
317
|
+
transition: transform var(--ppg-spring), z-index 0s;
|
|
318
|
+
cursor: pointer;
|
|
319
|
+
border-radius: 9999px;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.ppg-avatar-wrapper:focus-visible {
|
|
323
|
+
outline: none;
|
|
324
|
+
box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.4);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/* Hover lift animation */
|
|
328
|
+
.ppg-animated .ppg-avatar-wrapper:hover {
|
|
329
|
+
z-index: 100 !important;
|
|
330
|
+
animation: ppg-avatar-lift var(--ppg-spring) forwards;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.ppg-avatar-wrapper:hover {
|
|
334
|
+
z-index: 100 !important;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/* Nested profile-picture styling */
|
|
338
|
+
.ppg-avatar-wrapper profile-picture {
|
|
339
|
+
display: block;
|
|
340
|
+
width: 100%;
|
|
341
|
+
height: 100%;
|
|
342
|
+
border-radius: inherit;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/* Counter button */
|
|
346
|
+
.ppg-counter {
|
|
347
|
+
position: absolute;
|
|
348
|
+
top: 0;
|
|
349
|
+
display: flex;
|
|
350
|
+
align-items: center;
|
|
351
|
+
justify-content: center;
|
|
352
|
+
border-radius: 9999px;
|
|
353
|
+
background: var(--ppg-counter-bg);
|
|
354
|
+
color: var(--ppg-counter-text);
|
|
355
|
+
font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
|
|
356
|
+
font-weight: 600;
|
|
357
|
+
font-size: 13px;
|
|
358
|
+
letter-spacing: -0.01em;
|
|
359
|
+
cursor: pointer;
|
|
360
|
+
border: none;
|
|
361
|
+
box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.95), var(--ppg-shadow-sm);
|
|
362
|
+
transition: transform var(--ppg-spring), background-color var(--ppg-transition);
|
|
363
|
+
user-select: none;
|
|
364
|
+
-webkit-user-select: none;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
.ppg-counter:hover {
|
|
368
|
+
background: #e8e8ed;
|
|
369
|
+
transform: scale(1.05);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
.ppg-counter:active {
|
|
373
|
+
transform: scale(0.98);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
.ppg-counter:focus-visible {
|
|
377
|
+
outline: none;
|
|
378
|
+
box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.95), 0 0 0 4px rgba(0, 122, 255, 0.4);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
/* Add button */
|
|
382
|
+
.ppg-add-button {
|
|
383
|
+
position: absolute;
|
|
384
|
+
top: 0;
|
|
385
|
+
display: flex;
|
|
386
|
+
align-items: center;
|
|
387
|
+
justify-content: center;
|
|
388
|
+
border-radius: 9999px;
|
|
389
|
+
background: var(--ppg-add-bg);
|
|
390
|
+
border: 2px dashed var(--ppg-border);
|
|
391
|
+
cursor: pointer;
|
|
392
|
+
transition: all var(--ppg-spring);
|
|
393
|
+
box-shadow: var(--ppg-shadow-sm);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
.ppg-add-button:hover {
|
|
397
|
+
background: var(--ppg-add-hover);
|
|
398
|
+
border-color: rgba(0, 0, 0, 0.15);
|
|
399
|
+
transform: scale(1.05);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
.ppg-add-button:active {
|
|
403
|
+
transform: scale(0.98);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
.ppg-add-button:focus-visible {
|
|
407
|
+
outline: none;
|
|
408
|
+
box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.4);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
.ppg-add-icon {
|
|
412
|
+
color: var(--ppg-add-icon);
|
|
413
|
+
transition: color var(--ppg-transition);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
.ppg-add-button:hover .ppg-add-icon {
|
|
417
|
+
color: #1d1d1f;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/* Tooltip */
|
|
421
|
+
.ppg-tooltip {
|
|
422
|
+
position: fixed;
|
|
423
|
+
z-index: 9999;
|
|
424
|
+
padding: 6px 12px;
|
|
425
|
+
background: var(--ppg-tooltip-bg);
|
|
426
|
+
color: var(--ppg-tooltip-text);
|
|
427
|
+
font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
|
|
428
|
+
font-size: 13px;
|
|
429
|
+
font-weight: 500;
|
|
430
|
+
border-radius: 8px;
|
|
431
|
+
box-shadow: var(--ppg-shadow-lg);
|
|
432
|
+
pointer-events: none;
|
|
433
|
+
white-space: nowrap;
|
|
434
|
+
animation: ppg-tooltip-in 150ms ease-out;
|
|
435
|
+
backdrop-filter: blur(20px);
|
|
436
|
+
-webkit-backdrop-filter: blur(20px);
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
.ppg-tooltip::after {
|
|
440
|
+
content: '';
|
|
441
|
+
position: absolute;
|
|
442
|
+
width: 8px;
|
|
443
|
+
height: 8px;
|
|
444
|
+
background: inherit;
|
|
445
|
+
transform: rotate(45deg);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
.ppg-tooltip[data-position="top"]::after {
|
|
449
|
+
bottom: -4px;
|
|
450
|
+
left: 50%;
|
|
451
|
+
margin-left: -4px;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
.ppg-tooltip[data-position="bottom"]::after {
|
|
455
|
+
top: -4px;
|
|
456
|
+
left: 50%;
|
|
457
|
+
margin-left: -4px;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
/* Dropdown */
|
|
461
|
+
.ppg-dropdown {
|
|
462
|
+
position: absolute;
|
|
463
|
+
z-index: 1000;
|
|
464
|
+
min-width: 200px;
|
|
465
|
+
max-width: 280px;
|
|
466
|
+
background: var(--ppg-dropdown-bg);
|
|
467
|
+
border-radius: var(--ppg-radius);
|
|
468
|
+
box-shadow: var(--ppg-shadow-lg);
|
|
469
|
+
border: 1px solid var(--ppg-border);
|
|
470
|
+
overflow: hidden;
|
|
471
|
+
animation: ppg-dropdown-in 200ms ease-out;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
.ppg-dropdown[data-position="bottom"] {
|
|
475
|
+
top: calc(100% + 8px);
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
.ppg-dropdown[data-position="top"] {
|
|
479
|
+
bottom: calc(100% + 8px);
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
.ppg-dropdown-header {
|
|
483
|
+
padding: 12px 16px 8px;
|
|
484
|
+
font-size: 12px;
|
|
485
|
+
font-weight: 600;
|
|
486
|
+
color: #86868b;
|
|
487
|
+
text-transform: uppercase;
|
|
488
|
+
letter-spacing: 0.04em;
|
|
489
|
+
border-bottom: 1px solid var(--ppg-border);
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
.ppg-dropdown-list {
|
|
493
|
+
overflow-y: auto;
|
|
494
|
+
padding: 4px 0;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
.ppg-dropdown-item {
|
|
498
|
+
display: flex;
|
|
499
|
+
align-items: center;
|
|
500
|
+
gap: 12px;
|
|
501
|
+
padding: 10px 16px;
|
|
502
|
+
cursor: pointer;
|
|
503
|
+
transition: background-color var(--ppg-transition);
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
.ppg-dropdown-item:hover {
|
|
507
|
+
background: var(--ppg-dropdown-hover);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
.ppg-dropdown-item:focus-visible {
|
|
511
|
+
outline: none;
|
|
512
|
+
background: var(--ppg-dropdown-hover);
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
.ppg-dropdown-avatar {
|
|
516
|
+
flex-shrink: 0;
|
|
517
|
+
width: 32px;
|
|
518
|
+
height: 32px;
|
|
519
|
+
border-radius: 9999px;
|
|
520
|
+
object-fit: cover;
|
|
521
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
.ppg-dropdown-avatar-fallback {
|
|
525
|
+
flex-shrink: 0;
|
|
526
|
+
width: 32px;
|
|
527
|
+
height: 32px;
|
|
528
|
+
border-radius: 9999px;
|
|
529
|
+
display: flex;
|
|
530
|
+
align-items: center;
|
|
531
|
+
justify-content: center;
|
|
532
|
+
font-size: 13px;
|
|
533
|
+
font-weight: 600;
|
|
534
|
+
color: white;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
.ppg-dropdown-info {
|
|
538
|
+
flex: 1;
|
|
539
|
+
min-width: 0;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
.ppg-dropdown-name {
|
|
543
|
+
font-size: 14px;
|
|
544
|
+
font-weight: 500;
|
|
545
|
+
color: #1d1d1f;
|
|
546
|
+
white-space: nowrap;
|
|
547
|
+
overflow: hidden;
|
|
548
|
+
text-overflow: ellipsis;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
.ppg-dropdown-status {
|
|
552
|
+
display: flex;
|
|
553
|
+
align-items: center;
|
|
554
|
+
gap: 6px;
|
|
555
|
+
font-size: 12px;
|
|
556
|
+
color: #86868b;
|
|
557
|
+
margin-top: 2px;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
.ppg-dropdown-presence {
|
|
561
|
+
width: 8px;
|
|
562
|
+
height: 8px;
|
|
563
|
+
border-radius: 9999px;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
.ppg-dropdown-presence[data-status="online"] {
|
|
567
|
+
background: #30D158;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
.ppg-dropdown-presence[data-status="away"] {
|
|
571
|
+
background: #FFD60A;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
.ppg-dropdown-presence[data-status="busy"],
|
|
575
|
+
.ppg-dropdown-presence[data-status="dnd"] {
|
|
576
|
+
background: #FF453A;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
.ppg-dropdown-presence[data-status="offline"] {
|
|
580
|
+
background: #8E8E93;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
/* Backdrop for dropdown */
|
|
584
|
+
.ppg-backdrop {
|
|
585
|
+
position: fixed;
|
|
586
|
+
inset: 0;
|
|
587
|
+
z-index: 999;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
/* Reduced motion */
|
|
591
|
+
@media (prefers-reduced-motion: reduce) {
|
|
592
|
+
.ppg-container,
|
|
593
|
+
.ppg-avatar-wrapper,
|
|
594
|
+
.ppg-counter,
|
|
595
|
+
.ppg-add-button,
|
|
596
|
+
.ppg-tooltip,
|
|
597
|
+
.ppg-dropdown {
|
|
598
|
+
animation: none !important;
|
|
599
|
+
transition: none !important;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
.ppg-animated .ppg-avatar-wrapper:hover {
|
|
603
|
+
animation: none !important;
|
|
604
|
+
transform: none !important;
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
/* Dark mode support */
|
|
609
|
+
@media (prefers-color-scheme: dark) {
|
|
610
|
+
.ppg-container {
|
|
611
|
+
--ppg-counter-bg: #2c2c2e;
|
|
612
|
+
--ppg-counter-text: #ffffff;
|
|
613
|
+
--ppg-add-bg: #2c2c2e;
|
|
614
|
+
--ppg-add-hover: #3a3a3c;
|
|
615
|
+
--ppg-add-icon: #98989d;
|
|
616
|
+
--ppg-border: rgba(255, 255, 255, 0.1);
|
|
617
|
+
--ppg-dropdown-bg: #2c2c2e;
|
|
618
|
+
--ppg-dropdown-hover: #3a3a3c;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
.ppg-avatar-wrapper profile-picture {
|
|
622
|
+
box-shadow: 0 0 6px 1.5px rgb(28 28 30 / 16%), var(--ppg-shadow-sm);
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
.ppg-counter {
|
|
626
|
+
box-shadow: 0 0 0 1.5px rgba(28, 28, 30, 0.95), var(--ppg-shadow-sm);
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
.ppg-dropdown-name {
|
|
630
|
+
color: #ffffff;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
.ppg-dropdown-header {
|
|
634
|
+
color: #98989d;
|
|
635
|
+
border-color: rgba(255, 255, 255, 0.1);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
`,we=`${Ie}
|
|
639
|
+
${Ge}`;var s=class extends lit.LitElement{constructor(){super(...arguments);this.src="";this.alt="";this.size=v.size;this.variant=v.variant;this.shadow=v.shadow;this.border=false;this.borderWidth=v.borderWidth;this.borderColor=v.borderColor;this.loading=v.loading;this.placeholder=v.placeholder;this.placeholderColor=v.placeholderColor;this.isLoaded=false;this.hasError=false;this.previousSrc="";}createRenderRoot(){return s.injectStylesOnce(),this}static injectStylesOnce(){if(s.stylesInjected||typeof document>"u")return;let e=document.createElement("style");e.textContent=me,document.head.appendChild(e),s.stylesInjected=true;}get pixelSize(){let e=this.size;return typeof e=="number"?e:R[e]??R[v.size]}willUpdate(e){e.has("src")&&this.src!==this.previousSrc&&(this.isLoaded=false,this.hasError=false,this.previousSrc=this.src);}handleLoad(){this.isLoaded=true,this.dispatchEvent(new CustomEvent("load",{bubbles:true,composed:true}));}handleError(){this.hasError=true,this.isLoaded=true,this.dispatchEvent(new CustomEvent("error",{bubbles:true,composed:true}));}getContainerStyles(){let e=fe(this.bgColor,this.bgGradient),t=this.border?be(this.borderWidth,this.borderColor):null,n=he(this.shadow),a={};if(this.glow){let g=this.glow.color??this.borderColor??"#6366f1";a={"--pp-glow-color":g,boxShadow:ve(g,this.glow.intensity??.3)};}let p=this.interactive?.hoverable||this.interactive?.pressable;return {classes:h("pp-container",ue(this.variant),e.className,t?.className,p&&"pp-interactive",this.glow?.animate&&"pp-glow"),styles:{width:`${this.pixelSize}px`,height:`${this.pixelSize}px`,borderRadius:A[this.variant],...e.style,...t?.style,...n,...a,cursor:this.interactive?.cursor??(p?"pointer":"default")}}}renderPlaceholder(){if(this.isLoaded||this.placeholder==="none")return lit.nothing;let e={shimmer:"pp-shimmer",pulse:"pp-pulse",skeleton:"pp-skeleton",blur:"",none:""}[this.placeholder];return lit.html`
|
|
640
|
+
${this.placeholder==="shimmer"?lit.html`<style>${xe}</style>`:lit.nothing}
|
|
641
|
+
<div
|
|
642
|
+
class=${h("np:absolute np:inset-0",e)}
|
|
643
|
+
style=${styleMap_js.styleMap({backgroundColor:this.placeholderColor,borderRadius:"inherit"})}>
|
|
644
|
+
</div>
|
|
645
|
+
`}renderFallback(){if(this.fallback)return lit.html`
|
|
646
|
+
<span
|
|
647
|
+
class="pp-fallback"
|
|
648
|
+
style=${styleMap_js.styleMap({fontSize:`${Z(this.pixelSize)}px`})}>
|
|
649
|
+
${this.fallback}
|
|
650
|
+
</span>
|
|
651
|
+
`;if(this.alt){let t=F(this.alt);return lit.html`
|
|
652
|
+
<div
|
|
653
|
+
class="pp-fallback np:absolute np:inset-0"
|
|
654
|
+
style=${styleMap_js.styleMap({background:this.bgColor??t,fontSize:`${Z(this.pixelSize)}px`})}>
|
|
655
|
+
${O(this.alt)}
|
|
656
|
+
</div>
|
|
657
|
+
`}let e=this.pixelSize*.5;return lit.html`
|
|
658
|
+
<svg
|
|
659
|
+
class="pp-fallback-icon"
|
|
660
|
+
style="width: ${e}px; height: ${e}px;"
|
|
661
|
+
fill="currentColor"
|
|
662
|
+
viewBox="0 0 24 24">
|
|
663
|
+
<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" />
|
|
664
|
+
</svg>
|
|
665
|
+
`}renderImage(){return this.hasError||!this.src?this.renderFallback():lit.html`
|
|
666
|
+
<img
|
|
667
|
+
src=${this.src}
|
|
668
|
+
alt=${this.alt}
|
|
669
|
+
loading=${this.loading}
|
|
670
|
+
decoding="async"
|
|
671
|
+
@load=${this.handleLoad}
|
|
672
|
+
@error=${this.handleError}
|
|
673
|
+
class=${h("pp-image",this.isLoaded?"pp-image-loaded":"pp-image-loading")}
|
|
674
|
+
draggable="false" />
|
|
675
|
+
`}renderRing(){if(!this.ring?.show)return lit.nothing;let e=this.ring.width??3,t=this.ring.gap??3,n=e+t,a;return this.ring.gradient&&this.ring.gradient.length>0?a=se(this.ring.gradient):a=this.ring.color??"linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888)",lit.html`
|
|
676
|
+
<div
|
|
677
|
+
class=${h("pp-ring",this.ring.animate&&"pp-ring-animated")}
|
|
678
|
+
style=${styleMap_js.styleMap({inset:`-${n}px`,padding:`${e}px`,background:a,borderRadius:A[this.variant]})}>
|
|
679
|
+
</div>
|
|
680
|
+
`}renderPresence(){if(!this.presence)return lit.nothing;let e=this.presence.thickness??2,t=ie(this.pixelSize,e),n=ee[this.presence.status],a=Math.max(0,this.pixelSize*.02);return lit.html`
|
|
681
|
+
<div
|
|
682
|
+
class=${h("pp-presence",this.presence.animate&&"pp-presence-animated")}
|
|
683
|
+
style=${styleMap_js.styleMap({width:`${t}px`,height:`${t}px`,backgroundColor:n,bottom:`${a}px`,right:`${a}px`,color:n})}
|
|
684
|
+
title=${this.presence.status}>
|
|
685
|
+
</div>
|
|
686
|
+
`}renderBadge(){if(!this.badge)return lit.nothing;let e=this.badge.position??"bottom-right",t=this.badge.content!==void 0,{size:n,fontSize:a}=ne(this.pixelSize,t),p=this.badge.bgColor??"#22c55e",g=this.badge.color??"#ffffff",f=t&&this.badge.content!==void 0?ae(this.badge.content,this.badge.max):null,u={"top-left":{top:"-4px",left:"-4px"},"top-right":{top:"-4px",right:"-4px"},"bottom-left":{bottom:"-4px",left:"-4px"},"bottom-right":{bottom:"-4px",right:"-4px"}};return lit.html`
|
|
687
|
+
<div
|
|
688
|
+
class=${h("pp-badge",this.badge.pulse&&"pp-badge-pulse",this.badge.glow&&"pp-badge-glow")}
|
|
689
|
+
style=${styleMap_js.styleMap({width:t?"auto":`${n}px`,minWidth:`${n}px`,height:`${n}px`,padding:t?"0 6px":"0",fontSize:`${a}px`,backgroundColor:p,color:g,"--pp-badge-glow-color":p,...u[e]})}>
|
|
690
|
+
${f??lit.nothing}
|
|
691
|
+
</div>
|
|
692
|
+
`}renderRibbon(){if(!this.ribbon)return lit.nothing;let e=this.ribbon.position??"top-right",t=this.ribbon.bgColor??"#ef4444",n=this.ribbon.color??"#ffffff",a=B(t)?{backgroundColor:t}:{background:t},p={color:n},g=this.pixelSize*.9,f=this.pixelSize*.4,u=Math.max(8,this.pixelSize*.11);return lit.html`
|
|
693
|
+
<div
|
|
694
|
+
class=${h("pp-ribbon-container",re(e))}
|
|
695
|
+
style=${styleMap_js.styleMap({width:`${g}px`,height:`${f}px`})}>
|
|
696
|
+
<div
|
|
697
|
+
class=${h("pp-ribbon np:origin-center np:transform",oe(e))}
|
|
698
|
+
style=${styleMap_js.styleMap({fontSize:`${u}px`,padding:`${u*.3}px 0`,...a,...p})}>
|
|
699
|
+
${this.ribbon.icon?lit.html`<span style="margin-right: 2px">${this.ribbon.icon}</span>`:lit.nothing}
|
|
700
|
+
${this.ribbon.text}
|
|
701
|
+
</div>
|
|
702
|
+
</div>
|
|
703
|
+
`}render(){let e=this.getContainerStyles(),t=this.interactive?.focusable||this.interactive?.pressable?0:void 0;return lit.html`
|
|
704
|
+
<div
|
|
705
|
+
class=${e.classes}
|
|
706
|
+
style=${styleMap_js.styleMap(e.styles)}
|
|
707
|
+
tabindex=${t??lit.nothing}
|
|
708
|
+
role=${this.interactive?.pressable?"button":lit.nothing}
|
|
709
|
+
aria-label=${this.alt||lit.nothing}
|
|
710
|
+
data-profile-picture>
|
|
711
|
+
|
|
712
|
+
<!-- Ring Effect (behind everything) -->
|
|
713
|
+
${this.renderRing()}
|
|
714
|
+
|
|
715
|
+
<!-- Inner container for image clipping -->
|
|
716
|
+
<div
|
|
717
|
+
class="pp-inner"
|
|
718
|
+
style=${styleMap_js.styleMap({borderRadius:A[this.variant]})}>
|
|
719
|
+
<!-- Placeholder -->
|
|
720
|
+
${this.renderPlaceholder()}
|
|
721
|
+
|
|
722
|
+
<!-- Main Image or Fallback -->
|
|
723
|
+
${this.renderImage()}
|
|
724
|
+
</div>
|
|
725
|
+
|
|
726
|
+
<!-- Ribbon -->
|
|
727
|
+
${this.renderRibbon()}
|
|
728
|
+
|
|
729
|
+
<!-- Badge -->
|
|
730
|
+
${this.renderBadge()}
|
|
731
|
+
|
|
732
|
+
<!-- Presence Indicator -->
|
|
733
|
+
${this.renderPresence()}
|
|
734
|
+
</div>
|
|
735
|
+
`}};s.stylesInjected=false,i([decorators_js.property({type:String})],s.prototype,"src",2),i([decorators_js.property({type:String})],s.prototype,"alt",2),i([decorators_js.property({type:String})],s.prototype,"size",2),i([decorators_js.property({type:String})],s.prototype,"variant",2),i([decorators_js.property({type:String})],s.prototype,"shadow",2),i([decorators_js.property({type:Boolean})],s.prototype,"border",2),i([decorators_js.property({type:Number,attribute:"border-width"})],s.prototype,"borderWidth",2),i([decorators_js.property({type:String,attribute:"border-color"})],s.prototype,"borderColor",2),i([decorators_js.property({type:String,attribute:"bg-color"})],s.prototype,"bgColor",2),i([decorators_js.property({type:String,attribute:"bg-gradient"})],s.prototype,"bgGradient",2),i([decorators_js.property({type:Object,attribute:false})],s.prototype,"ring",2),i([decorators_js.property({type:Object,attribute:false})],s.prototype,"presence",2),i([decorators_js.property({type:Object,attribute:false})],s.prototype,"glow",2),i([decorators_js.property({type:Object,attribute:false})],s.prototype,"ribbon",2),i([decorators_js.property({type:Object,attribute:false})],s.prototype,"badge",2),i([decorators_js.property({type:String})],s.prototype,"loading",2),i([decorators_js.property({type:String})],s.prototype,"placeholder",2),i([decorators_js.property({type:String,attribute:"placeholder-color"})],s.prototype,"placeholderColor",2),i([decorators_js.property({type:String})],s.prototype,"fallback",2),i([decorators_js.property({type:Object,attribute:false})],s.prototype,"interactive",2),i([decorators_js.state()],s.prototype,"isLoaded",2),i([decorators_js.state()],s.prototype,"hasError",2),s=i([decorators_js.customElement("profile-picture")],s);var Se=false;function Pe(){if(Se||typeof document>"u")return;let r=document.createElement("style");r.textContent=we,document.head.appendChild(r),Se=true;}var c=class extends lit.LitElement{constructor(){super(...arguments);this.max=w.max;this.direction=w.direction;this.overlap=w.overlap;this.size=w.size;this.showAddButton=false;this.addButtonLabel="Add user";this.animated=w.animated;this.users=[];this.dropdownOpen=false;this.tooltipData=null;this.tooltipTimeout=null;this.slotObserver=null;this.handleBackdropClick=()=>{this.dropdownOpen=false;};}createRenderRoot(){return Pe(),this}get pixelSize(){return pe(this.size)}get tooltipEnabled(){return this.tooltip?.enabled!==false}get tooltipPosition(){return this.tooltip?.position??"top"}get tooltipDelay(){return this.tooltip?.delay??w.tooltipDelay}get dropdownMaxHeight(){return this.dropdown?.maxHeight??w.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();}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 e=Array.from(this.children).filter(t=>t.tagName.toLowerCase()==="profile-picture"&&t.getAttribute("slot")!=="internal");this.users=e.map((t,n)=>{let a=t.getAttribute("border-width"),p=a?Number.parseInt(a,10):void 0;return {id:t.getAttribute("data-user-id")??void 0,name:t.getAttribute("alt")??`User ${n+1}`,src:t.getAttribute("src")??void 0,status:t.getAttribute("data-status")??void 0,element:t,index:n,variant:t.getAttribute("variant")??void 0,shadow:t.getAttribute("shadow")??void 0,border:t.hasAttribute("border"),borderWidth:p,borderColor:t.getAttribute("border-color")??void 0,bgColor:t.getAttribute("bg-color")??void 0,bgGradient:t.getAttribute("bg-gradient")??void 0}});for(let t of this.users)t.element&&(t.element.style.display="none");}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 n=t.currentTarget;this.tooltipTimeout=window.setTimeout(()=>{this.tooltipData={user:e,rect:n.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.dispatchEvent(new CustomEvent("counter-click",{detail:{hiddenUsers:e,open:this.dropdownOpen},bubbles:true,composed:true}));}handleDropdownItemClick(e){this.dropdownOpen=false,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,n){let a=P(t,this.pixelSize,this.overlap,this.direction,this.spacing),p=le(t,n,this.direction),g=e.variant??"circle",f=e.shadow??"none";return lit.html`
|
|
736
|
+
<div
|
|
737
|
+
class="ppg-avatar-wrapper"
|
|
738
|
+
style=${styleMap_js.styleMap({left:`${a}px`,zIndex:String(p),width:`${this.pixelSize}px`,height:`${this.pixelSize}px`})}
|
|
739
|
+
tabindex="0"
|
|
740
|
+
role="button"
|
|
741
|
+
aria-label=${e.name}
|
|
742
|
+
@click=${()=>this.handleAvatarClick(e)}
|
|
743
|
+
@mouseenter=${u=>this.handleAvatarHover(e,u)}
|
|
744
|
+
@mouseleave=${this.handleAvatarLeave}
|
|
745
|
+
@keydown=${u=>this.handleKeyDown(u,()=>this.handleAvatarClick(e))}
|
|
746
|
+
>
|
|
747
|
+
${this.renderProfilePicture(e,g,f)}
|
|
748
|
+
</div>
|
|
749
|
+
`}renderProfilePicture(e,t,n){return lit.html`
|
|
750
|
+
<profile-picture
|
|
751
|
+
.src=${e.src??""}
|
|
752
|
+
.alt=${e.name}
|
|
753
|
+
.size=${this.pixelSize}
|
|
754
|
+
.variant=${t}
|
|
755
|
+
.shadow=${n}
|
|
756
|
+
?border=${e.border}
|
|
757
|
+
.borderWidth=${e.border?e.borderWidth??2:2}
|
|
758
|
+
.borderColor=${e.border?e.borderColor??"#ffffff":"#ffffff"}
|
|
759
|
+
.bgColor=${e.bgGradient?void 0:e.bgColor??"#ffffff"}
|
|
760
|
+
.bgGradient=${e.bgGradient??void 0}
|
|
761
|
+
data-user-id=${e.id??""}
|
|
762
|
+
data-status=${e.status??""}
|
|
763
|
+
></profile-picture>
|
|
764
|
+
`}renderCounter(e,t){return lit.html`
|
|
765
|
+
<button
|
|
766
|
+
class="ppg-counter"
|
|
767
|
+
style=${styleMap_js.styleMap({left:`${t}px`,width:`${this.pixelSize}px`,height:`${this.pixelSize}px`,zIndex:"1"})}
|
|
768
|
+
aria-label=${`${e} more users`}
|
|
769
|
+
aria-expanded=${this.dropdownOpen}
|
|
770
|
+
aria-haspopup="true"
|
|
771
|
+
@click=${()=>this.handleCounterClick(this.users.slice(-e))}
|
|
772
|
+
>
|
|
773
|
+
${ge(e)}
|
|
774
|
+
</button>
|
|
775
|
+
`}renderAddButton(e){let t=Math.round(this.pixelSize*.4);return lit.html`
|
|
776
|
+
<button
|
|
777
|
+
class="ppg-add-button"
|
|
778
|
+
style=${styleMap_js.styleMap({left:`${e}px`,width:`${this.pixelSize}px`,height:`${this.pixelSize}px`,zIndex:"1"})}
|
|
779
|
+
aria-label=${this.addButtonLabel}
|
|
780
|
+
@click=${this.handleAddClick}
|
|
781
|
+
>
|
|
782
|
+
<svg
|
|
783
|
+
class="ppg-add-icon"
|
|
784
|
+
width=${t}
|
|
785
|
+
height=${t}
|
|
786
|
+
viewBox="0 0 24 24"
|
|
787
|
+
fill="none"
|
|
788
|
+
stroke="currentColor"
|
|
789
|
+
stroke-width="2.5"
|
|
790
|
+
stroke-linecap="round"
|
|
791
|
+
stroke-linejoin="round"
|
|
792
|
+
>
|
|
793
|
+
<line x1="12" y1="5" x2="12" y2="19"></line>
|
|
794
|
+
<line x1="5" y1="12" x2="19" y2="12"></line>
|
|
795
|
+
</svg>
|
|
796
|
+
</button>
|
|
797
|
+
`}renderTooltip(){if(!this.tooltipData)return lit.nothing;let{user:e,rect:t}=this.tooltipData,n=8,a,p;return this.tooltipPosition==="bottom"?(a=t.bottom+n,p=t.left+t.width/2):(a=t.top-n,p=t.left+t.width/2),lit.html`
|
|
798
|
+
<div
|
|
799
|
+
class="ppg-tooltip"
|
|
800
|
+
style=${styleMap_js.styleMap({top:this.tooltipPosition==="top"?"auto":`${a}px`,bottom:this.tooltipPosition==="top"?`${window.innerHeight-t.top+n}px`:"auto",left:`${p}px`,transform:"translateX(-50%)"})}
|
|
801
|
+
data-position=${this.tooltipPosition}
|
|
802
|
+
role="tooltip"
|
|
803
|
+
>
|
|
804
|
+
${e.name}
|
|
805
|
+
</div>
|
|
806
|
+
`}renderDropdown(e){return this.dropdownOpen?lit.html`
|
|
807
|
+
<div
|
|
808
|
+
class="ppg-backdrop"
|
|
809
|
+
@click=${this.handleBackdropClick}
|
|
810
|
+
aria-hidden="true"
|
|
811
|
+
></div>
|
|
812
|
+
<div
|
|
813
|
+
class="ppg-dropdown"
|
|
814
|
+
data-position=${this.dropdownPosition}
|
|
815
|
+
role="menu"
|
|
816
|
+
aria-label="Hidden users"
|
|
817
|
+
>
|
|
818
|
+
<div class="ppg-dropdown-header">
|
|
819
|
+
${e.length} more
|
|
820
|
+
</div>
|
|
821
|
+
<div
|
|
822
|
+
class="ppg-dropdown-list"
|
|
823
|
+
style=${styleMap_js.styleMap({maxHeight:`${this.dropdownMaxHeight}px`})}
|
|
824
|
+
>
|
|
825
|
+
${e.map(t=>this.renderDropdownItem(t))}
|
|
826
|
+
</div>
|
|
827
|
+
</div>
|
|
828
|
+
`:lit.nothing}renderDropdownItem(e){let t=F(e.name);return lit.html`
|
|
829
|
+
<div
|
|
830
|
+
class="ppg-dropdown-item"
|
|
831
|
+
role="menuitem"
|
|
832
|
+
tabindex="0"
|
|
833
|
+
@click=${()=>this.handleDropdownItemClick(e)}
|
|
834
|
+
@keydown=${n=>this.handleKeyDown(n,()=>this.handleDropdownItemClick(e))}
|
|
835
|
+
>
|
|
836
|
+
${e.src?lit.html`<img
|
|
837
|
+
class="ppg-dropdown-avatar"
|
|
838
|
+
src=${e.src}
|
|
839
|
+
alt=${e.name}
|
|
840
|
+
/>`:lit.html`<div
|
|
841
|
+
class="ppg-dropdown-avatar-fallback"
|
|
842
|
+
style=${styleMap_js.styleMap({background:t})}
|
|
843
|
+
>
|
|
844
|
+
${O(e.name)}
|
|
845
|
+
</div>`}
|
|
846
|
+
<div class="ppg-dropdown-info">
|
|
847
|
+
<div class="ppg-dropdown-name">${e.name}</div>
|
|
848
|
+
${this.showPresence&&e.status?lit.html`
|
|
849
|
+
<div class="ppg-dropdown-status">
|
|
850
|
+
<span
|
|
851
|
+
class="ppg-dropdown-presence"
|
|
852
|
+
data-status=${e.status}
|
|
853
|
+
></span>
|
|
854
|
+
${this.formatStatus(e.status)}
|
|
855
|
+
</div>
|
|
856
|
+
`:lit.nothing}
|
|
857
|
+
</div>
|
|
858
|
+
</div>
|
|
859
|
+
`}formatStatus(e){return {online:"Online",away:"Away",busy:"Busy",offline:"Offline",dnd:"Do not disturb"}[e]??e}render(){let{visible:e,hidden:t,showCounter:n}=de(this.users.length,this.max,this.showAddButton),a=this.direction==="ltr"?this.users.slice(0,e):this.users.slice(0,e).reverse(),p=this.users.slice(e),g=e;n&&g++,this.showAddButton&&g++;let f=ce(g,this.pixelSize,this.overlap,this.spacing),u=n?P(e,this.pixelSize,this.overlap,this.direction,this.spacing):0,$=P(e+(n?1:0),this.pixelSize,this.overlap,this.direction,this.spacing);return lit.html`
|
|
860
|
+
<div
|
|
861
|
+
class=${h("ppg-container",this.animated&&"ppg-animated")}
|
|
862
|
+
style=${styleMap_js.styleMap({width:`${f}px`,height:`${this.pixelSize}px`})}
|
|
863
|
+
role="group"
|
|
864
|
+
aria-label="User avatars"
|
|
865
|
+
>
|
|
866
|
+
<!-- Hidden slot for original children -->
|
|
867
|
+
<slot style="display: none;"></slot>
|
|
868
|
+
|
|
869
|
+
<!-- Visible avatars -->
|
|
870
|
+
${a.map((z,D)=>this.renderAvatar(z,D,e))}
|
|
871
|
+
|
|
872
|
+
<!-- Counter -->
|
|
873
|
+
${n?this.renderCounter(t,u):lit.nothing}
|
|
874
|
+
|
|
875
|
+
<!-- Add button -->
|
|
876
|
+
${this.showAddButton?this.renderAddButton($):lit.nothing}
|
|
877
|
+
|
|
878
|
+
<!-- Tooltip -->
|
|
879
|
+
${this.renderTooltip()}
|
|
880
|
+
|
|
881
|
+
<!-- Dropdown -->
|
|
882
|
+
${n?this.renderDropdown(p):lit.nothing}
|
|
883
|
+
</div>
|
|
884
|
+
`}};i([decorators_js.property({type:Number})],c.prototype,"max",2),i([decorators_js.property({type:String})],c.prototype,"direction",2),i([decorators_js.property({type:Number})],c.prototype,"overlap",2),i([decorators_js.property({type:String})],c.prototype,"size",2),i([decorators_js.property({type:Number})],c.prototype,"spacing",2),i([decorators_js.property({type:Object})],c.prototype,"tooltip",2),i([decorators_js.property({type:Object})],c.prototype,"dropdown",2),i([decorators_js.property({type:Boolean,attribute:"show-add-button"})],c.prototype,"showAddButton",2),i([decorators_js.property({type:String,attribute:"add-button-label"})],c.prototype,"addButtonLabel",2),i([decorators_js.property({type:Boolean})],c.prototype,"animated",2),i([decorators_js.state()],c.prototype,"users",2),i([decorators_js.state()],c.prototype,"dropdownOpen",2),i([decorators_js.state()],c.prototype,"tooltipData",2),c=i([decorators_js.customElement("profile-picture-group")],c);var X=Ce__default.default.forwardRef(({max:r,direction:o,overlap:e,size:t,spacing:n,tooltip:a,dropdown:p,showAddButton:g,addButtonLabel:f,animated:u,onAvatarClick:$,onAvatarHover:z,onCounterClick:D,onDropdownItemClick:I,onAddClick:G,className:N,style:H,children:j},C)=>{let E=Ce.useRef(null),V=Ce.useCallback(l=>{$?.(l.detail.user);},[$]),W=Ce.useCallback(l=>{z?.(l.detail.user);},[z]),Y=Ce.useCallback(l=>{let U=l;D?.(U.detail.hiddenUsers,U.detail.open);},[D]),K=Ce.useCallback(l=>{I?.(l.detail.user);},[I]),q=Ce.useCallback(()=>{G?.();},[G]);return Ce.useEffect(()=>{let l=E.current;if(l)return l.addEventListener("avatar-click",V),l.addEventListener("avatar-hover",W),l.addEventListener("counter-click",Y),l.addEventListener("dropdown-item-click",K),l.addEventListener("add-click",q),()=>{l.removeEventListener("avatar-click",V),l.removeEventListener("avatar-hover",W),l.removeEventListener("counter-click",Y),l.removeEventListener("dropdown-item-click",K),l.removeEventListener("add-click",q);}},[V,W,Y,K,q]),Ce.useEffect(()=>{typeof C=="function"?C(E.current):C&&(C.current=E.current);},[C]),Ce__default.default.createElement("profile-picture-group",{ref:E,max:r,direction:o,overlap:e,size:t,spacing:n,tooltip:a,dropdown:p,"show-add-button":g||void 0,"add-button-label":f,animated:u,class:N,style:H},j)});X.displayName="ProfilePictureGroup";var ze=Ce__default.default.forwardRef(({src:r,alt:o,size:e,variant:t,border:n,borderWidth:a,borderColor:p,bgColor:g,bgGradient:f,ribbon:u,badge:$,loading:z,placeholder:D,placeholderColor:I,fallback:G,onLoad:N,onError:H,className:j,style:C},E)=>Ce__default.default.createElement("profile-picture",{ref:E,src:r,alt:o,size:e,variant:t,border:n,"border-width":a,"border-color":p,"bg-color":g,"bg-gradient":f,ribbon:u,badge:$,loading:z,placeholder:D,"placeholder-color":I,fallback:G,onLoad:N,onError:H,className:j,style:C}));ze.displayName="ProfilePicture";Q();exports.ProfilePicture=ze;exports.ProfilePictureGroup=X;//# sourceMappingURL=index.cjs.map
|
|
885
|
+
//# sourceMappingURL=index.cjs.map
|