@grasco/profile-picture 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/angular.cjs +62 -53
- package/dist/angular.cjs.map +1 -1
- package/dist/angular.d.cts +11 -2
- package/dist/angular.d.ts +11 -2
- package/dist/angular.js +62 -53
- package/dist/angular.js.map +1 -1
- package/dist/index.cjs +63 -54
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -10
- package/dist/index.d.ts +24 -10
- package/dist/index.js +63 -54
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +68 -59
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +21 -3
- package/dist/react.d.ts +21 -3
- package/dist/react.js +68 -59
- package/dist/react.js.map +1 -1
- package/dist/standalone.d.ts +14 -2
- package/dist/standalone.standalone.js +61 -52
- package/dist/standalone.standalone.js.map +1 -1
- package/dist/styles.css +2 -2
- package/dist/svelte.cjs +62 -53
- package/dist/svelte.cjs.map +1 -1
- package/dist/svelte.d.cts +10 -1
- package/dist/svelte.d.ts +10 -1
- package/dist/svelte.js +62 -53
- package/dist/svelte.js.map +1 -1
- package/dist/vue.cjs +62 -53
- package/dist/vue.cjs.map +1 -1
- package/dist/vue.d.cts +10 -1
- package/dist/vue.d.ts +10 -1
- package/dist/vue.js +62 -53
- package/dist/vue.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -11,6 +11,8 @@ type Variant = "circle" | "rounded" | "squircle" | "square";
|
|
|
11
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
|
+
type FallbackMode = "initials" | "gradient";
|
|
15
|
+
type ImageMode = "transparent" | "original";
|
|
14
16
|
type PresenceStatus = "online" | "away" | "busy" | "offline" | "dnd";
|
|
15
17
|
interface PresenceConfig {
|
|
16
18
|
/** Current status */
|
|
@@ -88,6 +90,8 @@ interface ProfilePictureProps$1 {
|
|
|
88
90
|
alt?: string;
|
|
89
91
|
/** External customer ID for CDN image loading */
|
|
90
92
|
extCustomerId?: string;
|
|
93
|
+
/** CDN image mode: 'transparent' for transparent background, 'original' for original background */
|
|
94
|
+
imageMode?: ImageMode;
|
|
91
95
|
/** Predefined size or custom pixel value */
|
|
92
96
|
size?: Size | number;
|
|
93
97
|
/** Shape variant */
|
|
@@ -102,6 +106,8 @@ interface ProfilePictureProps$1 {
|
|
|
102
106
|
borderColor?: string;
|
|
103
107
|
/** Rotation angle in degrees */
|
|
104
108
|
rotation?: number;
|
|
109
|
+
/** Zoom level for the image (default: 1.4). Values > 1 zoom in, keeping the image within the crop zone */
|
|
110
|
+
zoom?: number;
|
|
105
111
|
/** Background color (CSS color value) */
|
|
106
112
|
bgColor?: string;
|
|
107
113
|
/** Background gradient (CSS gradient value) */
|
|
@@ -122,6 +128,8 @@ interface ProfilePictureProps$1 {
|
|
|
122
128
|
placeholderColor?: string;
|
|
123
129
|
/** Custom fallback text (overrides initials from alt) */
|
|
124
130
|
fallback?: string;
|
|
131
|
+
/** Fallback display mode: 'initials' shows letters, 'gradient' shows cloudy gradient */
|
|
132
|
+
fallbackMode?: FallbackMode;
|
|
125
133
|
/** Interactive behavior configuration */
|
|
126
134
|
interactive?: InteractionConfig;
|
|
127
135
|
}
|
|
@@ -212,16 +220,12 @@ interface ProfilePictureGroupProps$1 {
|
|
|
212
220
|
* CDN sizes: 80, 120, 240, 480, 960
|
|
213
221
|
*/
|
|
214
222
|
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
223
|
/**
|
|
221
224
|
* Construct CDN URL for profile picture
|
|
222
|
-
* Format: {baseUrl}/api/profile-picture/cdn/{extId}_{size}_{
|
|
225
|
+
* Format: {baseUrl}/api/profile-picture/cdn/{extId}_{size}_{imageMode}.webp?hostname={hostname}
|
|
226
|
+
* @param imageMode - "transparent" for transparent background, "original" for original background
|
|
223
227
|
*/
|
|
224
|
-
declare function constructCdnUrl(baseUrl: string, extCustomerId: string, sizeLabel: "80" | "120" | "240" | "480" | "960",
|
|
228
|
+
declare function constructCdnUrl(baseUrl: string, extCustomerId: string, sizeLabel: "80" | "120" | "240" | "480" | "960", imageMode: "transparent" | "original", hostname: string): string;
|
|
225
229
|
|
|
226
230
|
declare class ProfilePictureGroup$1 extends LitElement {
|
|
227
231
|
protected createRenderRoot(): this;
|
|
@@ -396,6 +400,11 @@ declare function getCdnBaseUrl(): string;
|
|
|
396
400
|
/**
|
|
397
401
|
* React-specific props extending the core ProfilePictureProps
|
|
398
402
|
*/
|
|
403
|
+
interface ProfilePictureClickDetail {
|
|
404
|
+
extCustomerId?: string;
|
|
405
|
+
alt?: string;
|
|
406
|
+
src?: string;
|
|
407
|
+
}
|
|
399
408
|
interface ProfilePictureProps extends ProfilePictureProps$1 {
|
|
400
409
|
/** Called when image loads successfully */
|
|
401
410
|
onLoad?: () => void;
|
|
@@ -405,6 +414,8 @@ interface ProfilePictureProps extends ProfilePictureProps$1 {
|
|
|
405
414
|
onCdnError?: (detail: {
|
|
406
415
|
error: string;
|
|
407
416
|
}) => void;
|
|
417
|
+
/** Called when the profile picture is clicked (requires interactive.pressable) */
|
|
418
|
+
onClick?: (detail: ProfilePictureClickDetail) => void;
|
|
408
419
|
/** Additional CSS class names */
|
|
409
420
|
className?: string;
|
|
410
421
|
/** Inline styles */
|
|
@@ -416,13 +427,14 @@ interface ProfilePictureProps extends ProfilePictureProps$1 {
|
|
|
416
427
|
* Type-safe wrapper around the profile-picture web component.
|
|
417
428
|
* Uses ref as a prop (React 19+ pattern).
|
|
418
429
|
*/
|
|
419
|
-
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 & {
|
|
430
|
+
declare function ProfilePicture({ src, alt, extCustomerId, imageMode, size, variant, shadow, border, borderWidth, borderColor, rotation, zoom, bgColor, bgGradient, glow, ring, presence, badge, loading, placeholder, placeholderColor, fallback, fallbackMode, interactive, onLoad, onError, onCdnError, onClick, className, style, ref, }: ProfilePictureProps & {
|
|
420
431
|
ref?: React.Ref<HTMLElement>;
|
|
421
432
|
}): React.ReactElement<{
|
|
422
433
|
ref: React.RefObject<HTMLElement>;
|
|
423
434
|
src: string | undefined;
|
|
424
435
|
alt: string | undefined;
|
|
425
436
|
"ext-customer-id": string | undefined;
|
|
437
|
+
"image-mode": ImageMode | undefined;
|
|
426
438
|
size: number | Size | undefined;
|
|
427
439
|
variant: Variant | undefined;
|
|
428
440
|
shadow: ShadowPreset | undefined;
|
|
@@ -430,6 +442,7 @@ declare function ProfilePicture({ src, alt, extCustomerId, size, variant, shadow
|
|
|
430
442
|
"border-width": 1 | 2 | 3 | 4 | 5 | 6 | 8 | undefined;
|
|
431
443
|
"border-color": string | undefined;
|
|
432
444
|
rotation: number | undefined;
|
|
445
|
+
zoom: number | undefined;
|
|
433
446
|
"bg-color": string | undefined;
|
|
434
447
|
"bg-gradient": string | undefined;
|
|
435
448
|
glow: string | undefined;
|
|
@@ -440,12 +453,13 @@ declare function ProfilePicture({ src, alt, extCustomerId, size, variant, shadow
|
|
|
440
453
|
placeholder: PlaceholderType | undefined;
|
|
441
454
|
"placeholder-color": string | undefined;
|
|
442
455
|
fallback: string | undefined;
|
|
456
|
+
"fallback-mode": FallbackMode | undefined;
|
|
443
457
|
interactive: string | undefined;
|
|
444
458
|
class: string | undefined;
|
|
445
459
|
style: React.CSSProperties | undefined;
|
|
446
|
-
}, string | React.JSXElementConstructor<any
|
|
460
|
+
}, string | React.JSXElementConstructor<any>> | null;
|
|
447
461
|
declare namespace ProfilePicture {
|
|
448
462
|
var displayName: string;
|
|
449
463
|
}
|
|
450
464
|
|
|
451
|
-
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,
|
|
465
|
+
export { type BadgeConfig, type ProfilePictureGroupProps$1 as CoreProfilePictureGroupProps, type ProfilePictureProps$1 as CoreProfilePictureProps, type DropdownConfig, type GlowConfig, type GroupUserData, type ImageMode, 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, getCdnBaseUrl, getCdnSizeLabel, setCdnBaseUrl };
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ type Variant = "circle" | "rounded" | "squircle" | "square";
|
|
|
11
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
|
+
type FallbackMode = "initials" | "gradient";
|
|
15
|
+
type ImageMode = "transparent" | "original";
|
|
14
16
|
type PresenceStatus = "online" | "away" | "busy" | "offline" | "dnd";
|
|
15
17
|
interface PresenceConfig {
|
|
16
18
|
/** Current status */
|
|
@@ -88,6 +90,8 @@ interface ProfilePictureProps$1 {
|
|
|
88
90
|
alt?: string;
|
|
89
91
|
/** External customer ID for CDN image loading */
|
|
90
92
|
extCustomerId?: string;
|
|
93
|
+
/** CDN image mode: 'transparent' for transparent background, 'original' for original background */
|
|
94
|
+
imageMode?: ImageMode;
|
|
91
95
|
/** Predefined size or custom pixel value */
|
|
92
96
|
size?: Size | number;
|
|
93
97
|
/** Shape variant */
|
|
@@ -102,6 +106,8 @@ interface ProfilePictureProps$1 {
|
|
|
102
106
|
borderColor?: string;
|
|
103
107
|
/** Rotation angle in degrees */
|
|
104
108
|
rotation?: number;
|
|
109
|
+
/** Zoom level for the image (default: 1.4). Values > 1 zoom in, keeping the image within the crop zone */
|
|
110
|
+
zoom?: number;
|
|
105
111
|
/** Background color (CSS color value) */
|
|
106
112
|
bgColor?: string;
|
|
107
113
|
/** Background gradient (CSS gradient value) */
|
|
@@ -122,6 +128,8 @@ interface ProfilePictureProps$1 {
|
|
|
122
128
|
placeholderColor?: string;
|
|
123
129
|
/** Custom fallback text (overrides initials from alt) */
|
|
124
130
|
fallback?: string;
|
|
131
|
+
/** Fallback display mode: 'initials' shows letters, 'gradient' shows cloudy gradient */
|
|
132
|
+
fallbackMode?: FallbackMode;
|
|
125
133
|
/** Interactive behavior configuration */
|
|
126
134
|
interactive?: InteractionConfig;
|
|
127
135
|
}
|
|
@@ -212,16 +220,12 @@ interface ProfilePictureGroupProps$1 {
|
|
|
212
220
|
* CDN sizes: 80, 120, 240, 480, 960
|
|
213
221
|
*/
|
|
214
222
|
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
223
|
/**
|
|
221
224
|
* Construct CDN URL for profile picture
|
|
222
|
-
* Format: {baseUrl}/api/profile-picture/cdn/{extId}_{size}_{
|
|
225
|
+
* Format: {baseUrl}/api/profile-picture/cdn/{extId}_{size}_{imageMode}.webp?hostname={hostname}
|
|
226
|
+
* @param imageMode - "transparent" for transparent background, "original" for original background
|
|
223
227
|
*/
|
|
224
|
-
declare function constructCdnUrl(baseUrl: string, extCustomerId: string, sizeLabel: "80" | "120" | "240" | "480" | "960",
|
|
228
|
+
declare function constructCdnUrl(baseUrl: string, extCustomerId: string, sizeLabel: "80" | "120" | "240" | "480" | "960", imageMode: "transparent" | "original", hostname: string): string;
|
|
225
229
|
|
|
226
230
|
declare class ProfilePictureGroup$1 extends LitElement {
|
|
227
231
|
protected createRenderRoot(): this;
|
|
@@ -396,6 +400,11 @@ declare function getCdnBaseUrl(): string;
|
|
|
396
400
|
/**
|
|
397
401
|
* React-specific props extending the core ProfilePictureProps
|
|
398
402
|
*/
|
|
403
|
+
interface ProfilePictureClickDetail {
|
|
404
|
+
extCustomerId?: string;
|
|
405
|
+
alt?: string;
|
|
406
|
+
src?: string;
|
|
407
|
+
}
|
|
399
408
|
interface ProfilePictureProps extends ProfilePictureProps$1 {
|
|
400
409
|
/** Called when image loads successfully */
|
|
401
410
|
onLoad?: () => void;
|
|
@@ -405,6 +414,8 @@ interface ProfilePictureProps extends ProfilePictureProps$1 {
|
|
|
405
414
|
onCdnError?: (detail: {
|
|
406
415
|
error: string;
|
|
407
416
|
}) => void;
|
|
417
|
+
/** Called when the profile picture is clicked (requires interactive.pressable) */
|
|
418
|
+
onClick?: (detail: ProfilePictureClickDetail) => void;
|
|
408
419
|
/** Additional CSS class names */
|
|
409
420
|
className?: string;
|
|
410
421
|
/** Inline styles */
|
|
@@ -416,13 +427,14 @@ interface ProfilePictureProps extends ProfilePictureProps$1 {
|
|
|
416
427
|
* Type-safe wrapper around the profile-picture web component.
|
|
417
428
|
* Uses ref as a prop (React 19+ pattern).
|
|
418
429
|
*/
|
|
419
|
-
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 & {
|
|
430
|
+
declare function ProfilePicture({ src, alt, extCustomerId, imageMode, size, variant, shadow, border, borderWidth, borderColor, rotation, zoom, bgColor, bgGradient, glow, ring, presence, badge, loading, placeholder, placeholderColor, fallback, fallbackMode, interactive, onLoad, onError, onCdnError, onClick, className, style, ref, }: ProfilePictureProps & {
|
|
420
431
|
ref?: React.Ref<HTMLElement>;
|
|
421
432
|
}): React.ReactElement<{
|
|
422
433
|
ref: React.RefObject<HTMLElement>;
|
|
423
434
|
src: string | undefined;
|
|
424
435
|
alt: string | undefined;
|
|
425
436
|
"ext-customer-id": string | undefined;
|
|
437
|
+
"image-mode": ImageMode | undefined;
|
|
426
438
|
size: number | Size | undefined;
|
|
427
439
|
variant: Variant | undefined;
|
|
428
440
|
shadow: ShadowPreset | undefined;
|
|
@@ -430,6 +442,7 @@ declare function ProfilePicture({ src, alt, extCustomerId, size, variant, shadow
|
|
|
430
442
|
"border-width": 1 | 2 | 3 | 4 | 5 | 6 | 8 | undefined;
|
|
431
443
|
"border-color": string | undefined;
|
|
432
444
|
rotation: number | undefined;
|
|
445
|
+
zoom: number | undefined;
|
|
433
446
|
"bg-color": string | undefined;
|
|
434
447
|
"bg-gradient": string | undefined;
|
|
435
448
|
glow: string | undefined;
|
|
@@ -440,12 +453,13 @@ declare function ProfilePicture({ src, alt, extCustomerId, size, variant, shadow
|
|
|
440
453
|
placeholder: PlaceholderType | undefined;
|
|
441
454
|
"placeholder-color": string | undefined;
|
|
442
455
|
fallback: string | undefined;
|
|
456
|
+
"fallback-mode": FallbackMode | undefined;
|
|
443
457
|
interactive: string | undefined;
|
|
444
458
|
class: string | undefined;
|
|
445
459
|
style: React.CSSProperties | undefined;
|
|
446
|
-
}, string | React.JSXElementConstructor<any
|
|
460
|
+
}, string | React.JSXElementConstructor<any>> | null;
|
|
447
461
|
declare namespace ProfilePicture {
|
|
448
462
|
var displayName: string;
|
|
449
463
|
}
|
|
450
464
|
|
|
451
|
-
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,
|
|
465
|
+
export { type BadgeConfig, type ProfilePictureGroupProps$1 as CoreProfilePictureGroupProps, type ProfilePictureProps$1 as CoreProfilePictureProps, type DropdownConfig, type GlowConfig, type GroupUserData, type ImageMode, 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, getCdnBaseUrl, getCdnSizeLabel, setCdnBaseUrl };
|