@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/react.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
  }
@@ -352,6 +360,11 @@ declare function getCdnBaseUrl(): string;
352
360
  /**
353
361
  * React-specific props extending the core ProfilePictureProps
354
362
  */
363
+ interface ProfilePictureClickDetail {
364
+ extCustomerId?: string;
365
+ alt?: string;
366
+ src?: string;
367
+ }
355
368
  interface ProfilePictureProps extends ProfilePictureProps$1 {
356
369
  /** Called when image loads successfully */
357
370
  onLoad?: () => void;
@@ -361,6 +374,8 @@ interface ProfilePictureProps extends ProfilePictureProps$1 {
361
374
  onCdnError?: (detail: {
362
375
  error: string;
363
376
  }) => void;
377
+ /** Called when the profile picture is clicked (requires interactive.pressable) */
378
+ onClick?: (detail: ProfilePictureClickDetail) => void;
364
379
  /** Additional CSS class names */
365
380
  className?: string;
366
381
  /** Inline styles */
@@ -372,13 +387,14 @@ interface ProfilePictureProps extends ProfilePictureProps$1 {
372
387
  * Type-safe wrapper around the profile-picture web component.
373
388
  * Uses ref as a prop (React 19+ pattern).
374
389
  */
375
- 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 & {
390
+ 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 & {
376
391
  ref?: React.Ref<HTMLElement>;
377
392
  }): React.ReactElement<{
378
393
  ref: React.RefObject<HTMLElement>;
379
394
  src: string | undefined;
380
395
  alt: string | undefined;
381
396
  "ext-customer-id": string | undefined;
397
+ "image-mode": ImageMode | undefined;
382
398
  size: number | Size | undefined;
383
399
  variant: Variant | undefined;
384
400
  shadow: ShadowPreset | undefined;
@@ -386,6 +402,7 @@ declare function ProfilePicture({ src, alt, extCustomerId, size, variant, shadow
386
402
  "border-width": 1 | 2 | 3 | 4 | 5 | 6 | 8 | undefined;
387
403
  "border-color": string | undefined;
388
404
  rotation: number | undefined;
405
+ zoom: number | undefined;
389
406
  "bg-color": string | undefined;
390
407
  "bg-gradient": string | undefined;
391
408
  glow: string | undefined;
@@ -396,12 +413,13 @@ declare function ProfilePicture({ src, alt, extCustomerId, size, variant, shadow
396
413
  placeholder: PlaceholderType | undefined;
397
414
  "placeholder-color": string | undefined;
398
415
  fallback: string | undefined;
416
+ "fallback-mode": FallbackMode | undefined;
399
417
  interactive: string | undefined;
400
418
  class: string | undefined;
401
419
  style: React.CSSProperties | undefined;
402
- }, string | React.JSXElementConstructor<any>>;
420
+ }, string | React.JSXElementConstructor<any>> | null;
403
421
  declare namespace ProfilePicture {
404
422
  var displayName: string;
405
423
  }
406
424
 
407
- export { type BadgeConfig, type DropdownConfig, type GlowConfig, type GroupUserData, type InteractionConfig, type LoadingStrategy, type PlaceholderType, type PresenceConfig, ProfilePicture, ProfilePictureGroup, type ProfilePictureGroupProps, type ProfilePictureProps, type RingConfig, type ShadowPreset, type Size, type StackDirection, type TooltipConfig, type Variant, getCdnBaseUrl, setCdnBaseUrl };
425
+ export { type BadgeConfig, type DropdownConfig, type FallbackMode, type GlowConfig, type GroupUserData, type ImageMode, type InteractionConfig, type LoadingStrategy, type PlaceholderType, type PresenceConfig, ProfilePicture, type ProfilePictureClickDetail, ProfilePictureGroup, type ProfilePictureGroupProps, type ProfilePictureProps, type RingConfig, type ShadowPreset, type Size, type StackDirection, type TooltipConfig, type Variant, getCdnBaseUrl, setCdnBaseUrl };
package/dist/react.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
  }
@@ -352,6 +360,11 @@ declare function getCdnBaseUrl(): string;
352
360
  /**
353
361
  * React-specific props extending the core ProfilePictureProps
354
362
  */
363
+ interface ProfilePictureClickDetail {
364
+ extCustomerId?: string;
365
+ alt?: string;
366
+ src?: string;
367
+ }
355
368
  interface ProfilePictureProps extends ProfilePictureProps$1 {
356
369
  /** Called when image loads successfully */
357
370
  onLoad?: () => void;
@@ -361,6 +374,8 @@ interface ProfilePictureProps extends ProfilePictureProps$1 {
361
374
  onCdnError?: (detail: {
362
375
  error: string;
363
376
  }) => void;
377
+ /** Called when the profile picture is clicked (requires interactive.pressable) */
378
+ onClick?: (detail: ProfilePictureClickDetail) => void;
364
379
  /** Additional CSS class names */
365
380
  className?: string;
366
381
  /** Inline styles */
@@ -372,13 +387,14 @@ interface ProfilePictureProps extends ProfilePictureProps$1 {
372
387
  * Type-safe wrapper around the profile-picture web component.
373
388
  * Uses ref as a prop (React 19+ pattern).
374
389
  */
375
- 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 & {
390
+ 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 & {
376
391
  ref?: React.Ref<HTMLElement>;
377
392
  }): React.ReactElement<{
378
393
  ref: React.RefObject<HTMLElement>;
379
394
  src: string | undefined;
380
395
  alt: string | undefined;
381
396
  "ext-customer-id": string | undefined;
397
+ "image-mode": ImageMode | undefined;
382
398
  size: number | Size | undefined;
383
399
  variant: Variant | undefined;
384
400
  shadow: ShadowPreset | undefined;
@@ -386,6 +402,7 @@ declare function ProfilePicture({ src, alt, extCustomerId, size, variant, shadow
386
402
  "border-width": 1 | 2 | 3 | 4 | 5 | 6 | 8 | undefined;
387
403
  "border-color": string | undefined;
388
404
  rotation: number | undefined;
405
+ zoom: number | undefined;
389
406
  "bg-color": string | undefined;
390
407
  "bg-gradient": string | undefined;
391
408
  glow: string | undefined;
@@ -396,12 +413,13 @@ declare function ProfilePicture({ src, alt, extCustomerId, size, variant, shadow
396
413
  placeholder: PlaceholderType | undefined;
397
414
  "placeholder-color": string | undefined;
398
415
  fallback: string | undefined;
416
+ "fallback-mode": FallbackMode | undefined;
399
417
  interactive: string | undefined;
400
418
  class: string | undefined;
401
419
  style: React.CSSProperties | undefined;
402
- }, string | React.JSXElementConstructor<any>>;
420
+ }, string | React.JSXElementConstructor<any>> | null;
403
421
  declare namespace ProfilePicture {
404
422
  var displayName: string;
405
423
  }
406
424
 
407
- export { type BadgeConfig, type DropdownConfig, type GlowConfig, type GroupUserData, type InteractionConfig, type LoadingStrategy, type PlaceholderType, type PresenceConfig, ProfilePicture, ProfilePictureGroup, type ProfilePictureGroupProps, type ProfilePictureProps, type RingConfig, type ShadowPreset, type Size, type StackDirection, type TooltipConfig, type Variant, getCdnBaseUrl, setCdnBaseUrl };
425
+ export { type BadgeConfig, type DropdownConfig, type FallbackMode, type GlowConfig, type GroupUserData, type ImageMode, type InteractionConfig, type LoadingStrategy, type PlaceholderType, type PresenceConfig, ProfilePicture, type ProfilePictureClickDetail, ProfilePictureGroup, type ProfilePictureGroupProps, type ProfilePictureProps, type RingConfig, type ShadowPreset, type Size, type StackDirection, type TooltipConfig, type Variant, getCdnBaseUrl, setCdnBaseUrl };