@grasco/profile-picture 0.1.2 → 0.1.5
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 +193 -16
- package/dist/angular.d.ts +193 -16
- package/dist/angular.js +1 -370
- package/dist/angular.js.map +1 -1
- package/dist/index.cjs +284 -175
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +134 -58
- package/dist/index.d.ts +134 -58
- package/dist/index.js +284 -175
- package/dist/index.js.map +1 -1
- package/dist/standalone.d.ts +17 -17
- package/dist/standalone.standalone.js +260 -151
- 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 +193 -16
- package/dist/svelte.d.ts +193 -16
- 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 +193 -16
- package/dist/vue.d.ts +193 -16
- package/dist/vue.js +1 -370
- package/dist/vue.js.map +1 -1
- package/package.json +9 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import * as lit_html from 'lit-html';
|
|
2
3
|
import { LitElement } from 'lit';
|
|
3
|
-
import React from 'react';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Profile Picture Component - Type Definitions
|
|
@@ -8,7 +8,7 @@ import React from 'react';
|
|
|
8
8
|
*/
|
|
9
9
|
type Size = "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl";
|
|
10
10
|
type Variant = "circle" | "rounded" | "squircle" | "square";
|
|
11
|
-
type Position = "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
11
|
+
type Position = "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right";
|
|
12
12
|
type LoadingStrategy = "lazy" | "eager";
|
|
13
13
|
type PlaceholderType = "shimmer" | "pulse" | "blur" | "skeleton" | "none";
|
|
14
14
|
type PresenceStatus = "online" | "away" | "busy" | "offline" | "dnd";
|
|
@@ -20,18 +20,6 @@ interface PresenceConfig {
|
|
|
20
20
|
/** Ring thickness (1-3) */
|
|
21
21
|
thickness?: 1 | 2 | 3;
|
|
22
22
|
}
|
|
23
|
-
interface RibbonConfig {
|
|
24
|
-
/** Text displayed on the ribbon */
|
|
25
|
-
text: string;
|
|
26
|
-
/** Position of the ribbon */
|
|
27
|
-
position?: Position;
|
|
28
|
-
/** Text color (CSS color) */
|
|
29
|
-
color?: string;
|
|
30
|
-
/** Background color (CSS color or gradient) */
|
|
31
|
-
bgColor?: string;
|
|
32
|
-
/** Icon before text (emoji or symbol) */
|
|
33
|
-
icon?: string;
|
|
34
|
-
}
|
|
35
23
|
interface BadgeConfig {
|
|
36
24
|
/** Badge content (text, number, or empty for dot) */
|
|
37
25
|
content?: string | number;
|
|
@@ -41,6 +29,8 @@ interface BadgeConfig {
|
|
|
41
29
|
color?: string;
|
|
42
30
|
/** Background color */
|
|
43
31
|
bgColor?: string;
|
|
32
|
+
/** Border radius (CSS value, e.g., "8px", "50%", "9999px") */
|
|
33
|
+
borderRadius?: string;
|
|
44
34
|
/** Enable pulse animation */
|
|
45
35
|
pulse?: boolean;
|
|
46
36
|
/** Enable glow effect */
|
|
@@ -87,6 +77,54 @@ interface InteractionConfig {
|
|
|
87
77
|
cursor?: "pointer" | "default" | "zoom-in";
|
|
88
78
|
}
|
|
89
79
|
type ShadowPreset = "none" | "sm" | "md" | "lg" | "glow";
|
|
80
|
+
/**
|
|
81
|
+
* Base props interface shared across all framework wrappers.
|
|
82
|
+
* This ensures type consistency between React, Vue, Svelte, and Angular.
|
|
83
|
+
*/
|
|
84
|
+
interface ProfilePictureProps$1 {
|
|
85
|
+
/** Image source URL */
|
|
86
|
+
src?: string;
|
|
87
|
+
/** Alt text for accessibility and fallback initials */
|
|
88
|
+
alt?: string;
|
|
89
|
+
/** External customer ID for CDN image loading */
|
|
90
|
+
extCustomerId?: string;
|
|
91
|
+
/** Predefined size or custom pixel value */
|
|
92
|
+
size?: Size | number;
|
|
93
|
+
/** Shape variant */
|
|
94
|
+
variant?: Variant;
|
|
95
|
+
/** Shadow preset */
|
|
96
|
+
shadow?: ShadowPreset;
|
|
97
|
+
/** Enable border */
|
|
98
|
+
border?: boolean;
|
|
99
|
+
/** Border width in pixels */
|
|
100
|
+
borderWidth?: 1 | 2 | 3 | 4 | 5 | 6 | 8;
|
|
101
|
+
/** Border color (CSS color value) */
|
|
102
|
+
borderColor?: string;
|
|
103
|
+
/** Rotation angle in degrees */
|
|
104
|
+
rotation?: number;
|
|
105
|
+
/** Background color (CSS color value) */
|
|
106
|
+
bgColor?: string;
|
|
107
|
+
/** Background gradient (CSS gradient value) */
|
|
108
|
+
bgGradient?: string;
|
|
109
|
+
/** Glow effect configuration */
|
|
110
|
+
glow?: GlowConfig;
|
|
111
|
+
/** Ring effect configuration (Instagram-style) */
|
|
112
|
+
ring?: RingConfig;
|
|
113
|
+
/** Presence indicator configuration */
|
|
114
|
+
presence?: PresenceConfig;
|
|
115
|
+
/** Badge configuration */
|
|
116
|
+
badge?: BadgeConfig;
|
|
117
|
+
/** Loading strategy */
|
|
118
|
+
loading?: LoadingStrategy;
|
|
119
|
+
/** Placeholder type while loading */
|
|
120
|
+
placeholder?: PlaceholderType;
|
|
121
|
+
/** Placeholder background color */
|
|
122
|
+
placeholderColor?: string;
|
|
123
|
+
/** Custom fallback text (overrides initials from alt) */
|
|
124
|
+
fallback?: string;
|
|
125
|
+
/** Interactive behavior configuration */
|
|
126
|
+
interactive?: InteractionConfig;
|
|
127
|
+
}
|
|
90
128
|
/** Direction for stacking avatars */
|
|
91
129
|
type StackDirection = "ltr" | "rtl";
|
|
92
130
|
/** Tooltip position relative to avatar */
|
|
@@ -108,6 +146,8 @@ interface GroupUserData {
|
|
|
108
146
|
name: string;
|
|
109
147
|
/** Image source URL */
|
|
110
148
|
src?: string;
|
|
149
|
+
/** External customer ID for CDN image loading */
|
|
150
|
+
extCustomerId?: string;
|
|
111
151
|
/** Presence status from data-status attribute */
|
|
112
152
|
status?: PresenceStatus;
|
|
113
153
|
/** Reference to the profile-picture element */
|
|
@@ -162,6 +202,27 @@ interface ProfilePictureGroupProps$1 {
|
|
|
162
202
|
animated?: boolean;
|
|
163
203
|
}
|
|
164
204
|
|
|
205
|
+
/**
|
|
206
|
+
* Profile Picture Component - Utility Functions
|
|
207
|
+
* Apple-inspired design system utilities
|
|
208
|
+
*/
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Get CDN size label from pixel size (rounds up to next available size)
|
|
212
|
+
* CDN sizes: 80, 120, 240, 480, 960
|
|
213
|
+
*/
|
|
214
|
+
declare function getCdnSizeLabel(pixelSize: number): "80" | "120" | "240" | "480" | "960";
|
|
215
|
+
/**
|
|
216
|
+
* Detect theme (dark/light) from background color using luminance calculation
|
|
217
|
+
* Returns 'light' for non-hex colors or when luminance > 0.5
|
|
218
|
+
*/
|
|
219
|
+
declare function detectThemeFromColor(bgColor?: string): "dark" | "light";
|
|
220
|
+
/**
|
|
221
|
+
* Construct CDN URL for profile picture
|
|
222
|
+
* Format: {baseUrl}/api/profile-picture/cdn/{extId}_{size}_{theme}.webp?hostname={hostname}
|
|
223
|
+
*/
|
|
224
|
+
declare function constructCdnUrl(baseUrl: string, extCustomerId: string, sizeLabel: "80" | "120" | "240" | "480" | "960", theme: "dark" | "light", hostname: string): string;
|
|
225
|
+
|
|
165
226
|
declare class ProfilePicture$1 extends LitElement {
|
|
166
227
|
private static stylesInjected;
|
|
167
228
|
private static cdnBaseUrl;
|
|
@@ -192,7 +253,6 @@ declare class ProfilePicture$1 extends LitElement {
|
|
|
192
253
|
ring?: RingConfig;
|
|
193
254
|
presence?: PresenceConfig;
|
|
194
255
|
glow?: GlowConfig;
|
|
195
|
-
ribbon?: RibbonConfig;
|
|
196
256
|
badge?: BadgeConfig;
|
|
197
257
|
loading: LoadingStrategy;
|
|
198
258
|
placeholder: PlaceholderType;
|
|
@@ -225,9 +285,13 @@ declare class ProfilePicture$1 extends LitElement {
|
|
|
225
285
|
private renderFallback;
|
|
226
286
|
private renderImage;
|
|
227
287
|
private renderRing;
|
|
288
|
+
/**
|
|
289
|
+
* Calculate corner offset based on variant
|
|
290
|
+
* Returns the inset from container edge where badges/presence should be positioned
|
|
291
|
+
*/
|
|
292
|
+
private getCornerOffset;
|
|
228
293
|
private renderPresence;
|
|
229
294
|
private renderBadge;
|
|
230
|
-
private renderRibbon;
|
|
231
295
|
render(): lit_html.TemplateResult<1>;
|
|
232
296
|
}
|
|
233
297
|
|
|
@@ -237,27 +301,6 @@ declare global {
|
|
|
237
301
|
}
|
|
238
302
|
}
|
|
239
303
|
|
|
240
|
-
/**
|
|
241
|
-
* Profile Picture Component - Utility Functions
|
|
242
|
-
* Apple-inspired design system utilities
|
|
243
|
-
*/
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* Get CDN size label from pixel size (rounds up to next available size)
|
|
247
|
-
* CDN sizes: 80, 120, 240, 480, 960
|
|
248
|
-
*/
|
|
249
|
-
declare function getCdnSizeLabel(pixelSize: number): "80" | "120" | "240" | "480" | "960";
|
|
250
|
-
/**
|
|
251
|
-
* Detect theme (dark/light) from background color using luminance calculation
|
|
252
|
-
* Returns 'light' for non-hex colors or when luminance > 0.5
|
|
253
|
-
*/
|
|
254
|
-
declare function detectThemeFromColor(bgColor?: string): "dark" | "light";
|
|
255
|
-
/**
|
|
256
|
-
* Construct CDN URL for profile picture
|
|
257
|
-
* Format: {baseUrl}/api/profile-picture/cdn/{extId}_{size}_{theme}.webp?hostname={hostname}
|
|
258
|
-
*/
|
|
259
|
-
declare function constructCdnUrl(baseUrl: string, extCustomerId: string, sizeLabel: "80" | "120" | "240" | "480" | "960", theme: "dark" | "light", hostname: string): string;
|
|
260
|
-
|
|
261
304
|
declare class ProfilePictureGroup$1 extends LitElement {
|
|
262
305
|
protected createRenderRoot(): this;
|
|
263
306
|
max: 4;
|
|
@@ -276,6 +319,8 @@ declare class ProfilePictureGroup$1 extends LitElement {
|
|
|
276
319
|
private tooltipData;
|
|
277
320
|
private tooltipTimeout;
|
|
278
321
|
private slotObserver;
|
|
322
|
+
private portalContainer;
|
|
323
|
+
private counterRef;
|
|
279
324
|
private get pixelSize();
|
|
280
325
|
private get tooltipEnabled();
|
|
281
326
|
private get tooltipPosition();
|
|
@@ -287,6 +332,9 @@ declare class ProfilePictureGroup$1 extends LitElement {
|
|
|
287
332
|
disconnectedCallback(): void;
|
|
288
333
|
private setupSlotObserver;
|
|
289
334
|
private updateUsers;
|
|
335
|
+
private createPortal;
|
|
336
|
+
private destroyPortal;
|
|
337
|
+
private updatePortalContent;
|
|
290
338
|
private handleAvatarClick;
|
|
291
339
|
private handleAvatarHover;
|
|
292
340
|
private handleAvatarLeave;
|
|
@@ -301,9 +349,9 @@ declare class ProfilePictureGroup$1 extends LitElement {
|
|
|
301
349
|
private renderCounter;
|
|
302
350
|
private renderAddButton;
|
|
303
351
|
private renderTooltip;
|
|
304
|
-
private renderDropdown;
|
|
305
352
|
private renderDropdownItem;
|
|
306
353
|
private formatStatus;
|
|
354
|
+
protected updated(changedProperties: Map<PropertyKey, unknown>): void;
|
|
307
355
|
render(): lit_html.TemplateResult<1>;
|
|
308
356
|
}
|
|
309
357
|
|
|
@@ -363,6 +411,8 @@ interface ProfilePictureGroupProps {
|
|
|
363
411
|
addButtonLabel?: string;
|
|
364
412
|
/** Enable hover lift animation (default: true) */
|
|
365
413
|
animated?: boolean;
|
|
414
|
+
/** Alternating rotation amount in degrees (0 = no rotation) */
|
|
415
|
+
rotationAmount?: number;
|
|
366
416
|
/** Called when an avatar is clicked */
|
|
367
417
|
onAvatarClick?: (user: GroupUserData) => void;
|
|
368
418
|
/** Called when hovering over an avatar */
|
|
@@ -403,7 +453,6 @@ declare const ProfilePictureGroup: React.ForwardRefExoticComponent<ProfilePictur
|
|
|
403
453
|
* border
|
|
404
454
|
* borderColor="white"
|
|
405
455
|
* bgColor="bg-gradient-to-br from-purple-500 to-pink-500"
|
|
406
|
-
* ribbon={{ text: 'PRO', position: 'top-right', bgColor: 'bg-amber-500' }}
|
|
407
456
|
* badge={{ content: '3', position: 'bottom-right', pulse: true }}
|
|
408
457
|
* onLoad={() => console.log('loaded')}
|
|
409
458
|
* onError={() => console.error('failed')}
|
|
@@ -413,32 +462,59 @@ declare const ProfilePictureGroup: React.ForwardRefExoticComponent<ProfilePictur
|
|
|
413
462
|
* ```
|
|
414
463
|
*/
|
|
415
464
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
border?: boolean;
|
|
422
|
-
borderWidth?: 1 | 2 | 3 | 4;
|
|
423
|
-
borderColor?: string;
|
|
424
|
-
bgColor?: string;
|
|
425
|
-
bgGradient?: string;
|
|
426
|
-
ribbon?: RibbonConfig;
|
|
427
|
-
badge?: BadgeConfig;
|
|
428
|
-
loading?: LoadingStrategy;
|
|
429
|
-
placeholder?: PlaceholderType;
|
|
430
|
-
placeholderColor?: string;
|
|
431
|
-
fallback?: string;
|
|
465
|
+
/**
|
|
466
|
+
* React-specific props extending the core ProfilePictureProps
|
|
467
|
+
*/
|
|
468
|
+
interface ProfilePictureProps extends ProfilePictureProps$1 {
|
|
469
|
+
/** Called when image loads successfully */
|
|
432
470
|
onLoad?: () => void;
|
|
471
|
+
/** Called when image fails to load */
|
|
433
472
|
onError?: () => void;
|
|
473
|
+
/** Called when CDN image fails to load */
|
|
474
|
+
onCdnError?: (detail: {
|
|
475
|
+
error: string;
|
|
476
|
+
}) => void;
|
|
477
|
+
/** Additional CSS class names */
|
|
434
478
|
className?: string;
|
|
479
|
+
/** Inline styles */
|
|
435
480
|
style?: React.CSSProperties;
|
|
436
481
|
}
|
|
437
482
|
/**
|
|
438
483
|
* ProfilePicture React Component
|
|
439
484
|
*
|
|
440
|
-
* Type-safe wrapper around the profile-picture web component
|
|
485
|
+
* Type-safe wrapper around the profile-picture web component.
|
|
486
|
+
* Uses ref as a prop (React 19+ pattern).
|
|
441
487
|
*/
|
|
442
|
-
declare
|
|
488
|
+
declare function ProfilePicture({ src, alt, extCustomerId, size, variant, shadow, border, borderWidth, borderColor, rotation, bgColor, bgGradient, glow, ring, presence, badge, loading, placeholder, placeholderColor, fallback, interactive, onLoad, onError, onCdnError, className, style, ref, }: ProfilePictureProps & {
|
|
489
|
+
ref?: React.Ref<HTMLElement>;
|
|
490
|
+
}): React.ReactElement<{
|
|
491
|
+
ref: React.RefObject<HTMLElement>;
|
|
492
|
+
src: string | undefined;
|
|
493
|
+
alt: string | undefined;
|
|
494
|
+
"ext-customer-id": string | undefined;
|
|
495
|
+
size: number | Size | undefined;
|
|
496
|
+
variant: Variant | undefined;
|
|
497
|
+
shadow: ShadowPreset | undefined;
|
|
498
|
+
border: true | undefined;
|
|
499
|
+
"border-width": 1 | 2 | 3 | 4 | 5 | 6 | 8 | undefined;
|
|
500
|
+
"border-color": string | undefined;
|
|
501
|
+
rotation: number | undefined;
|
|
502
|
+
"bg-color": string | undefined;
|
|
503
|
+
"bg-gradient": string | undefined;
|
|
504
|
+
glow: string | undefined;
|
|
505
|
+
ring: string | undefined;
|
|
506
|
+
presence: string | undefined;
|
|
507
|
+
badge: string | undefined;
|
|
508
|
+
loading: LoadingStrategy | undefined;
|
|
509
|
+
placeholder: PlaceholderType | undefined;
|
|
510
|
+
"placeholder-color": string | undefined;
|
|
511
|
+
fallback: string | undefined;
|
|
512
|
+
interactive: string | undefined;
|
|
513
|
+
class: string | undefined;
|
|
514
|
+
style: React.CSSProperties | undefined;
|
|
515
|
+
}, string | React.JSXElementConstructor<any>>;
|
|
516
|
+
declare namespace ProfilePicture {
|
|
517
|
+
var displayName: string;
|
|
518
|
+
}
|
|
443
519
|
|
|
444
|
-
export { type BadgeConfig, type DropdownConfig, type GroupUserData, type LoadingStrategy, type PlaceholderType, type Position, ProfilePicture, ProfilePictureGroup, type ProfilePictureGroupProps
|
|
520
|
+
export { type BadgeConfig, type ProfilePictureGroupProps$1 as CoreProfilePictureGroupProps, type ProfilePictureProps$1 as CoreProfilePictureProps, type DropdownConfig, type GlowConfig, type GroupUserData, type InteractionConfig, type LoadingStrategy, type PlaceholderType, type Position, type PresenceConfig, type PresenceStatus, ProfilePicture, ProfilePictureGroup, type ProfilePictureGroupProps, type ProfilePictureProps, type RingConfig, type ShadowPreset, type Size, type StackDirection, type TooltipConfig, type TooltipPosition, type Variant, constructCdnUrl, detectThemeFromColor, getCdnSizeLabel };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import * as lit_html from 'lit-html';
|
|
2
3
|
import { LitElement } from 'lit';
|
|
3
|
-
import React from 'react';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Profile Picture Component - Type Definitions
|
|
@@ -8,7 +8,7 @@ import React from 'react';
|
|
|
8
8
|
*/
|
|
9
9
|
type Size = "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl";
|
|
10
10
|
type Variant = "circle" | "rounded" | "squircle" | "square";
|
|
11
|
-
type Position = "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
11
|
+
type Position = "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right";
|
|
12
12
|
type LoadingStrategy = "lazy" | "eager";
|
|
13
13
|
type PlaceholderType = "shimmer" | "pulse" | "blur" | "skeleton" | "none";
|
|
14
14
|
type PresenceStatus = "online" | "away" | "busy" | "offline" | "dnd";
|
|
@@ -20,18 +20,6 @@ interface PresenceConfig {
|
|
|
20
20
|
/** Ring thickness (1-3) */
|
|
21
21
|
thickness?: 1 | 2 | 3;
|
|
22
22
|
}
|
|
23
|
-
interface RibbonConfig {
|
|
24
|
-
/** Text displayed on the ribbon */
|
|
25
|
-
text: string;
|
|
26
|
-
/** Position of the ribbon */
|
|
27
|
-
position?: Position;
|
|
28
|
-
/** Text color (CSS color) */
|
|
29
|
-
color?: string;
|
|
30
|
-
/** Background color (CSS color or gradient) */
|
|
31
|
-
bgColor?: string;
|
|
32
|
-
/** Icon before text (emoji or symbol) */
|
|
33
|
-
icon?: string;
|
|
34
|
-
}
|
|
35
23
|
interface BadgeConfig {
|
|
36
24
|
/** Badge content (text, number, or empty for dot) */
|
|
37
25
|
content?: string | number;
|
|
@@ -41,6 +29,8 @@ interface BadgeConfig {
|
|
|
41
29
|
color?: string;
|
|
42
30
|
/** Background color */
|
|
43
31
|
bgColor?: string;
|
|
32
|
+
/** Border radius (CSS value, e.g., "8px", "50%", "9999px") */
|
|
33
|
+
borderRadius?: string;
|
|
44
34
|
/** Enable pulse animation */
|
|
45
35
|
pulse?: boolean;
|
|
46
36
|
/** Enable glow effect */
|
|
@@ -87,6 +77,54 @@ interface InteractionConfig {
|
|
|
87
77
|
cursor?: "pointer" | "default" | "zoom-in";
|
|
88
78
|
}
|
|
89
79
|
type ShadowPreset = "none" | "sm" | "md" | "lg" | "glow";
|
|
80
|
+
/**
|
|
81
|
+
* Base props interface shared across all framework wrappers.
|
|
82
|
+
* This ensures type consistency between React, Vue, Svelte, and Angular.
|
|
83
|
+
*/
|
|
84
|
+
interface ProfilePictureProps$1 {
|
|
85
|
+
/** Image source URL */
|
|
86
|
+
src?: string;
|
|
87
|
+
/** Alt text for accessibility and fallback initials */
|
|
88
|
+
alt?: string;
|
|
89
|
+
/** External customer ID for CDN image loading */
|
|
90
|
+
extCustomerId?: string;
|
|
91
|
+
/** Predefined size or custom pixel value */
|
|
92
|
+
size?: Size | number;
|
|
93
|
+
/** Shape variant */
|
|
94
|
+
variant?: Variant;
|
|
95
|
+
/** Shadow preset */
|
|
96
|
+
shadow?: ShadowPreset;
|
|
97
|
+
/** Enable border */
|
|
98
|
+
border?: boolean;
|
|
99
|
+
/** Border width in pixels */
|
|
100
|
+
borderWidth?: 1 | 2 | 3 | 4 | 5 | 6 | 8;
|
|
101
|
+
/** Border color (CSS color value) */
|
|
102
|
+
borderColor?: string;
|
|
103
|
+
/** Rotation angle in degrees */
|
|
104
|
+
rotation?: number;
|
|
105
|
+
/** Background color (CSS color value) */
|
|
106
|
+
bgColor?: string;
|
|
107
|
+
/** Background gradient (CSS gradient value) */
|
|
108
|
+
bgGradient?: string;
|
|
109
|
+
/** Glow effect configuration */
|
|
110
|
+
glow?: GlowConfig;
|
|
111
|
+
/** Ring effect configuration (Instagram-style) */
|
|
112
|
+
ring?: RingConfig;
|
|
113
|
+
/** Presence indicator configuration */
|
|
114
|
+
presence?: PresenceConfig;
|
|
115
|
+
/** Badge configuration */
|
|
116
|
+
badge?: BadgeConfig;
|
|
117
|
+
/** Loading strategy */
|
|
118
|
+
loading?: LoadingStrategy;
|
|
119
|
+
/** Placeholder type while loading */
|
|
120
|
+
placeholder?: PlaceholderType;
|
|
121
|
+
/** Placeholder background color */
|
|
122
|
+
placeholderColor?: string;
|
|
123
|
+
/** Custom fallback text (overrides initials from alt) */
|
|
124
|
+
fallback?: string;
|
|
125
|
+
/** Interactive behavior configuration */
|
|
126
|
+
interactive?: InteractionConfig;
|
|
127
|
+
}
|
|
90
128
|
/** Direction for stacking avatars */
|
|
91
129
|
type StackDirection = "ltr" | "rtl";
|
|
92
130
|
/** Tooltip position relative to avatar */
|
|
@@ -108,6 +146,8 @@ interface GroupUserData {
|
|
|
108
146
|
name: string;
|
|
109
147
|
/** Image source URL */
|
|
110
148
|
src?: string;
|
|
149
|
+
/** External customer ID for CDN image loading */
|
|
150
|
+
extCustomerId?: string;
|
|
111
151
|
/** Presence status from data-status attribute */
|
|
112
152
|
status?: PresenceStatus;
|
|
113
153
|
/** Reference to the profile-picture element */
|
|
@@ -162,6 +202,27 @@ interface ProfilePictureGroupProps$1 {
|
|
|
162
202
|
animated?: boolean;
|
|
163
203
|
}
|
|
164
204
|
|
|
205
|
+
/**
|
|
206
|
+
* Profile Picture Component - Utility Functions
|
|
207
|
+
* Apple-inspired design system utilities
|
|
208
|
+
*/
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Get CDN size label from pixel size (rounds up to next available size)
|
|
212
|
+
* CDN sizes: 80, 120, 240, 480, 960
|
|
213
|
+
*/
|
|
214
|
+
declare function getCdnSizeLabel(pixelSize: number): "80" | "120" | "240" | "480" | "960";
|
|
215
|
+
/**
|
|
216
|
+
* Detect theme (dark/light) from background color using luminance calculation
|
|
217
|
+
* Returns 'light' for non-hex colors or when luminance > 0.5
|
|
218
|
+
*/
|
|
219
|
+
declare function detectThemeFromColor(bgColor?: string): "dark" | "light";
|
|
220
|
+
/**
|
|
221
|
+
* Construct CDN URL for profile picture
|
|
222
|
+
* Format: {baseUrl}/api/profile-picture/cdn/{extId}_{size}_{theme}.webp?hostname={hostname}
|
|
223
|
+
*/
|
|
224
|
+
declare function constructCdnUrl(baseUrl: string, extCustomerId: string, sizeLabel: "80" | "120" | "240" | "480" | "960", theme: "dark" | "light", hostname: string): string;
|
|
225
|
+
|
|
165
226
|
declare class ProfilePicture$1 extends LitElement {
|
|
166
227
|
private static stylesInjected;
|
|
167
228
|
private static cdnBaseUrl;
|
|
@@ -192,7 +253,6 @@ declare class ProfilePicture$1 extends LitElement {
|
|
|
192
253
|
ring?: RingConfig;
|
|
193
254
|
presence?: PresenceConfig;
|
|
194
255
|
glow?: GlowConfig;
|
|
195
|
-
ribbon?: RibbonConfig;
|
|
196
256
|
badge?: BadgeConfig;
|
|
197
257
|
loading: LoadingStrategy;
|
|
198
258
|
placeholder: PlaceholderType;
|
|
@@ -225,9 +285,13 @@ declare class ProfilePicture$1 extends LitElement {
|
|
|
225
285
|
private renderFallback;
|
|
226
286
|
private renderImage;
|
|
227
287
|
private renderRing;
|
|
288
|
+
/**
|
|
289
|
+
* Calculate corner offset based on variant
|
|
290
|
+
* Returns the inset from container edge where badges/presence should be positioned
|
|
291
|
+
*/
|
|
292
|
+
private getCornerOffset;
|
|
228
293
|
private renderPresence;
|
|
229
294
|
private renderBadge;
|
|
230
|
-
private renderRibbon;
|
|
231
295
|
render(): lit_html.TemplateResult<1>;
|
|
232
296
|
}
|
|
233
297
|
|
|
@@ -237,27 +301,6 @@ declare global {
|
|
|
237
301
|
}
|
|
238
302
|
}
|
|
239
303
|
|
|
240
|
-
/**
|
|
241
|
-
* Profile Picture Component - Utility Functions
|
|
242
|
-
* Apple-inspired design system utilities
|
|
243
|
-
*/
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* Get CDN size label from pixel size (rounds up to next available size)
|
|
247
|
-
* CDN sizes: 80, 120, 240, 480, 960
|
|
248
|
-
*/
|
|
249
|
-
declare function getCdnSizeLabel(pixelSize: number): "80" | "120" | "240" | "480" | "960";
|
|
250
|
-
/**
|
|
251
|
-
* Detect theme (dark/light) from background color using luminance calculation
|
|
252
|
-
* Returns 'light' for non-hex colors or when luminance > 0.5
|
|
253
|
-
*/
|
|
254
|
-
declare function detectThemeFromColor(bgColor?: string): "dark" | "light";
|
|
255
|
-
/**
|
|
256
|
-
* Construct CDN URL for profile picture
|
|
257
|
-
* Format: {baseUrl}/api/profile-picture/cdn/{extId}_{size}_{theme}.webp?hostname={hostname}
|
|
258
|
-
*/
|
|
259
|
-
declare function constructCdnUrl(baseUrl: string, extCustomerId: string, sizeLabel: "80" | "120" | "240" | "480" | "960", theme: "dark" | "light", hostname: string): string;
|
|
260
|
-
|
|
261
304
|
declare class ProfilePictureGroup$1 extends LitElement {
|
|
262
305
|
protected createRenderRoot(): this;
|
|
263
306
|
max: 4;
|
|
@@ -276,6 +319,8 @@ declare class ProfilePictureGroup$1 extends LitElement {
|
|
|
276
319
|
private tooltipData;
|
|
277
320
|
private tooltipTimeout;
|
|
278
321
|
private slotObserver;
|
|
322
|
+
private portalContainer;
|
|
323
|
+
private counterRef;
|
|
279
324
|
private get pixelSize();
|
|
280
325
|
private get tooltipEnabled();
|
|
281
326
|
private get tooltipPosition();
|
|
@@ -287,6 +332,9 @@ declare class ProfilePictureGroup$1 extends LitElement {
|
|
|
287
332
|
disconnectedCallback(): void;
|
|
288
333
|
private setupSlotObserver;
|
|
289
334
|
private updateUsers;
|
|
335
|
+
private createPortal;
|
|
336
|
+
private destroyPortal;
|
|
337
|
+
private updatePortalContent;
|
|
290
338
|
private handleAvatarClick;
|
|
291
339
|
private handleAvatarHover;
|
|
292
340
|
private handleAvatarLeave;
|
|
@@ -301,9 +349,9 @@ declare class ProfilePictureGroup$1 extends LitElement {
|
|
|
301
349
|
private renderCounter;
|
|
302
350
|
private renderAddButton;
|
|
303
351
|
private renderTooltip;
|
|
304
|
-
private renderDropdown;
|
|
305
352
|
private renderDropdownItem;
|
|
306
353
|
private formatStatus;
|
|
354
|
+
protected updated(changedProperties: Map<PropertyKey, unknown>): void;
|
|
307
355
|
render(): lit_html.TemplateResult<1>;
|
|
308
356
|
}
|
|
309
357
|
|
|
@@ -363,6 +411,8 @@ interface ProfilePictureGroupProps {
|
|
|
363
411
|
addButtonLabel?: string;
|
|
364
412
|
/** Enable hover lift animation (default: true) */
|
|
365
413
|
animated?: boolean;
|
|
414
|
+
/** Alternating rotation amount in degrees (0 = no rotation) */
|
|
415
|
+
rotationAmount?: number;
|
|
366
416
|
/** Called when an avatar is clicked */
|
|
367
417
|
onAvatarClick?: (user: GroupUserData) => void;
|
|
368
418
|
/** Called when hovering over an avatar */
|
|
@@ -403,7 +453,6 @@ declare const ProfilePictureGroup: React.ForwardRefExoticComponent<ProfilePictur
|
|
|
403
453
|
* border
|
|
404
454
|
* borderColor="white"
|
|
405
455
|
* bgColor="bg-gradient-to-br from-purple-500 to-pink-500"
|
|
406
|
-
* ribbon={{ text: 'PRO', position: 'top-right', bgColor: 'bg-amber-500' }}
|
|
407
456
|
* badge={{ content: '3', position: 'bottom-right', pulse: true }}
|
|
408
457
|
* onLoad={() => console.log('loaded')}
|
|
409
458
|
* onError={() => console.error('failed')}
|
|
@@ -413,32 +462,59 @@ declare const ProfilePictureGroup: React.ForwardRefExoticComponent<ProfilePictur
|
|
|
413
462
|
* ```
|
|
414
463
|
*/
|
|
415
464
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
border?: boolean;
|
|
422
|
-
borderWidth?: 1 | 2 | 3 | 4;
|
|
423
|
-
borderColor?: string;
|
|
424
|
-
bgColor?: string;
|
|
425
|
-
bgGradient?: string;
|
|
426
|
-
ribbon?: RibbonConfig;
|
|
427
|
-
badge?: BadgeConfig;
|
|
428
|
-
loading?: LoadingStrategy;
|
|
429
|
-
placeholder?: PlaceholderType;
|
|
430
|
-
placeholderColor?: string;
|
|
431
|
-
fallback?: string;
|
|
465
|
+
/**
|
|
466
|
+
* React-specific props extending the core ProfilePictureProps
|
|
467
|
+
*/
|
|
468
|
+
interface ProfilePictureProps extends ProfilePictureProps$1 {
|
|
469
|
+
/** Called when image loads successfully */
|
|
432
470
|
onLoad?: () => void;
|
|
471
|
+
/** Called when image fails to load */
|
|
433
472
|
onError?: () => void;
|
|
473
|
+
/** Called when CDN image fails to load */
|
|
474
|
+
onCdnError?: (detail: {
|
|
475
|
+
error: string;
|
|
476
|
+
}) => void;
|
|
477
|
+
/** Additional CSS class names */
|
|
434
478
|
className?: string;
|
|
479
|
+
/** Inline styles */
|
|
435
480
|
style?: React.CSSProperties;
|
|
436
481
|
}
|
|
437
482
|
/**
|
|
438
483
|
* ProfilePicture React Component
|
|
439
484
|
*
|
|
440
|
-
* Type-safe wrapper around the profile-picture web component
|
|
485
|
+
* Type-safe wrapper around the profile-picture web component.
|
|
486
|
+
* Uses ref as a prop (React 19+ pattern).
|
|
441
487
|
*/
|
|
442
|
-
declare
|
|
488
|
+
declare function ProfilePicture({ src, alt, extCustomerId, size, variant, shadow, border, borderWidth, borderColor, rotation, bgColor, bgGradient, glow, ring, presence, badge, loading, placeholder, placeholderColor, fallback, interactive, onLoad, onError, onCdnError, className, style, ref, }: ProfilePictureProps & {
|
|
489
|
+
ref?: React.Ref<HTMLElement>;
|
|
490
|
+
}): React.ReactElement<{
|
|
491
|
+
ref: React.RefObject<HTMLElement>;
|
|
492
|
+
src: string | undefined;
|
|
493
|
+
alt: string | undefined;
|
|
494
|
+
"ext-customer-id": string | undefined;
|
|
495
|
+
size: number | Size | undefined;
|
|
496
|
+
variant: Variant | undefined;
|
|
497
|
+
shadow: ShadowPreset | undefined;
|
|
498
|
+
border: true | undefined;
|
|
499
|
+
"border-width": 1 | 2 | 3 | 4 | 5 | 6 | 8 | undefined;
|
|
500
|
+
"border-color": string | undefined;
|
|
501
|
+
rotation: number | undefined;
|
|
502
|
+
"bg-color": string | undefined;
|
|
503
|
+
"bg-gradient": string | undefined;
|
|
504
|
+
glow: string | undefined;
|
|
505
|
+
ring: string | undefined;
|
|
506
|
+
presence: string | undefined;
|
|
507
|
+
badge: string | undefined;
|
|
508
|
+
loading: LoadingStrategy | undefined;
|
|
509
|
+
placeholder: PlaceholderType | undefined;
|
|
510
|
+
"placeholder-color": string | undefined;
|
|
511
|
+
fallback: string | undefined;
|
|
512
|
+
interactive: string | undefined;
|
|
513
|
+
class: string | undefined;
|
|
514
|
+
style: React.CSSProperties | undefined;
|
|
515
|
+
}, string | React.JSXElementConstructor<any>>;
|
|
516
|
+
declare namespace ProfilePicture {
|
|
517
|
+
var displayName: string;
|
|
518
|
+
}
|
|
443
519
|
|
|
444
|
-
export { type BadgeConfig, type DropdownConfig, type GroupUserData, type LoadingStrategy, type PlaceholderType, type Position, ProfilePicture, ProfilePictureGroup, type ProfilePictureGroupProps
|
|
520
|
+
export { type BadgeConfig, type ProfilePictureGroupProps$1 as CoreProfilePictureGroupProps, type ProfilePictureProps$1 as CoreProfilePictureProps, type DropdownConfig, type GlowConfig, type GroupUserData, type InteractionConfig, type LoadingStrategy, type PlaceholderType, type Position, type PresenceConfig, type PresenceStatus, ProfilePicture, ProfilePictureGroup, type ProfilePictureGroupProps, type ProfilePictureProps, type RingConfig, type ShadowPreset, type Size, type StackDirection, type TooltipConfig, type TooltipPosition, type Variant, constructCdnUrl, detectThemeFromColor, getCdnSizeLabel };
|