@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.d.ts
ADDED
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
import * as lit_html from 'lit-html';
|
|
2
|
+
import { LitElement } from 'lit';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Profile Picture Component - Type Definitions
|
|
7
|
+
* Apple-inspired design system with modern 2025 aesthetics
|
|
8
|
+
*/
|
|
9
|
+
type Size = "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl";
|
|
10
|
+
type Variant = "circle" | "rounded" | "squircle" | "square";
|
|
11
|
+
type Position = "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
12
|
+
type LoadingStrategy = "lazy" | "eager";
|
|
13
|
+
type PlaceholderType = "shimmer" | "pulse" | "blur" | "skeleton" | "none";
|
|
14
|
+
type PresenceStatus = "online" | "away" | "busy" | "offline" | "dnd";
|
|
15
|
+
interface PresenceConfig {
|
|
16
|
+
/** Current status */
|
|
17
|
+
status: PresenceStatus;
|
|
18
|
+
/** Show animated ring */
|
|
19
|
+
animate?: boolean;
|
|
20
|
+
/** Ring thickness (1-3) */
|
|
21
|
+
thickness?: 1 | 2 | 3;
|
|
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
|
+
interface BadgeConfig {
|
|
36
|
+
/** Badge content (text, number, or empty for dot) */
|
|
37
|
+
content?: string | number;
|
|
38
|
+
/** Position of the badge */
|
|
39
|
+
position?: Position;
|
|
40
|
+
/** Text/icon color */
|
|
41
|
+
color?: string;
|
|
42
|
+
/** Background color */
|
|
43
|
+
bgColor?: string;
|
|
44
|
+
/** Enable pulse animation */
|
|
45
|
+
pulse?: boolean;
|
|
46
|
+
/** Enable glow effect */
|
|
47
|
+
glow?: boolean;
|
|
48
|
+
/** Max value to display (shows 99+ if exceeded) */
|
|
49
|
+
max?: number;
|
|
50
|
+
}
|
|
51
|
+
interface GlowConfig {
|
|
52
|
+
/** Glow color (defaults to border or bg color) */
|
|
53
|
+
color?: string;
|
|
54
|
+
/** Intensity (0-1) */
|
|
55
|
+
intensity?: number;
|
|
56
|
+
/** Animate the glow */
|
|
57
|
+
animate?: boolean;
|
|
58
|
+
}
|
|
59
|
+
interface RingConfig {
|
|
60
|
+
/** Show ring */
|
|
61
|
+
show: boolean;
|
|
62
|
+
/** Ring color or gradient */
|
|
63
|
+
color?: string;
|
|
64
|
+
/** Gradient colors for multi-color ring */
|
|
65
|
+
gradient?: string[];
|
|
66
|
+
/** Ring width */
|
|
67
|
+
width?: number;
|
|
68
|
+
/** Gap between ring and avatar */
|
|
69
|
+
gap?: number;
|
|
70
|
+
/** Animate (rotate for gradient) */
|
|
71
|
+
animate?: boolean;
|
|
72
|
+
}
|
|
73
|
+
interface InteractionConfig {
|
|
74
|
+
/** Enable hover effects */
|
|
75
|
+
hoverable?: boolean;
|
|
76
|
+
/** Enable press/click effects */
|
|
77
|
+
pressable?: boolean;
|
|
78
|
+
/** Show focus ring on focus */
|
|
79
|
+
focusable?: boolean;
|
|
80
|
+
/** Cursor style */
|
|
81
|
+
cursor?: "pointer" | "default" | "zoom-in";
|
|
82
|
+
}
|
|
83
|
+
type ShadowPreset = "none" | "sm" | "md" | "lg" | "glow";
|
|
84
|
+
/** Direction for stacking avatars */
|
|
85
|
+
type StackDirection = "ltr" | "rtl";
|
|
86
|
+
/** Tooltip position relative to avatar */
|
|
87
|
+
type TooltipPosition = "top" | "bottom" | "left" | "right";
|
|
88
|
+
/** Tooltip configuration */
|
|
89
|
+
interface TooltipConfig {
|
|
90
|
+
/** Enable/disable tooltip (default: true) */
|
|
91
|
+
enabled?: boolean;
|
|
92
|
+
/** Position of tooltip relative to avatar */
|
|
93
|
+
position?: TooltipPosition;
|
|
94
|
+
/** Delay before showing tooltip in ms (default: 300) */
|
|
95
|
+
delay?: number;
|
|
96
|
+
}
|
|
97
|
+
/** User data extracted from profile-picture elements */
|
|
98
|
+
interface GroupUserData {
|
|
99
|
+
/** User ID from data-user-id attribute */
|
|
100
|
+
id?: string;
|
|
101
|
+
/** User name from alt attribute */
|
|
102
|
+
name: string;
|
|
103
|
+
/** Image source URL */
|
|
104
|
+
src?: string;
|
|
105
|
+
/** Presence status from data-status attribute */
|
|
106
|
+
status?: PresenceStatus;
|
|
107
|
+
/** Reference to the profile-picture element */
|
|
108
|
+
element: HTMLElement;
|
|
109
|
+
/** Index in the group */
|
|
110
|
+
index: number;
|
|
111
|
+
/** Visual variant (circle, rounded, squircle, square) */
|
|
112
|
+
variant?: Variant;
|
|
113
|
+
/** Shadow preset */
|
|
114
|
+
shadow?: ShadowPreset;
|
|
115
|
+
/** Show border */
|
|
116
|
+
border?: boolean;
|
|
117
|
+
/** Border width (1-4) */
|
|
118
|
+
borderWidth?: 1 | 2 | 3 | 4;
|
|
119
|
+
/** Border color */
|
|
120
|
+
borderColor?: string;
|
|
121
|
+
/** Background color */
|
|
122
|
+
bgColor?: string;
|
|
123
|
+
/** Background gradient */
|
|
124
|
+
bgGradient?: string;
|
|
125
|
+
}
|
|
126
|
+
/** Dropdown configuration for overflow users */
|
|
127
|
+
interface DropdownConfig {
|
|
128
|
+
/** Max height of dropdown in px (default: 280) */
|
|
129
|
+
maxHeight?: number;
|
|
130
|
+
/** Show presence indicator dots (default: true) */
|
|
131
|
+
showPresence?: boolean;
|
|
132
|
+
/** Dropdown position (default: 'bottom') */
|
|
133
|
+
position?: "bottom" | "top";
|
|
134
|
+
}
|
|
135
|
+
/** Profile Picture Group Props */
|
|
136
|
+
interface ProfilePictureGroupProps$1 {
|
|
137
|
+
/** Maximum visible avatars before showing counter (default: 4) */
|
|
138
|
+
max?: number;
|
|
139
|
+
/** Stack direction - ltr shows first on left (default: 'ltr') */
|
|
140
|
+
direction?: StackDirection;
|
|
141
|
+
/** Overlap amount as percentage 0-1 (default: 0.3) */
|
|
142
|
+
overlap?: number;
|
|
143
|
+
/** Avatar size - inherited by children (default: 'md') */
|
|
144
|
+
size?: Size | number;
|
|
145
|
+
/** Spacing between avatars in px (overrides overlap calculation) */
|
|
146
|
+
spacing?: number;
|
|
147
|
+
/** Tooltip configuration */
|
|
148
|
+
tooltip?: TooltipConfig;
|
|
149
|
+
/** Dropdown configuration for overflow users */
|
|
150
|
+
dropdown?: DropdownConfig;
|
|
151
|
+
/** Show add button (default: false) */
|
|
152
|
+
showAddButton?: boolean;
|
|
153
|
+
/** Add button label for accessibility */
|
|
154
|
+
addButtonLabel?: string;
|
|
155
|
+
/** Enable hover lift animation (default: true) */
|
|
156
|
+
animated?: boolean;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
declare class ProfilePicture$1 extends LitElement {
|
|
160
|
+
private static stylesInjected;
|
|
161
|
+
protected createRenderRoot(): this;
|
|
162
|
+
private static injectStylesOnce;
|
|
163
|
+
src: string;
|
|
164
|
+
alt: string;
|
|
165
|
+
size: Size | string;
|
|
166
|
+
variant: Variant;
|
|
167
|
+
shadow: ShadowPreset;
|
|
168
|
+
border: boolean;
|
|
169
|
+
borderWidth: 1 | 2 | 3 | 4;
|
|
170
|
+
borderColor: string;
|
|
171
|
+
bgColor?: string;
|
|
172
|
+
bgGradient?: string;
|
|
173
|
+
ring?: RingConfig;
|
|
174
|
+
presence?: PresenceConfig;
|
|
175
|
+
glow?: GlowConfig;
|
|
176
|
+
ribbon?: RibbonConfig;
|
|
177
|
+
badge?: BadgeConfig;
|
|
178
|
+
loading: LoadingStrategy;
|
|
179
|
+
placeholder: PlaceholderType;
|
|
180
|
+
placeholderColor: string;
|
|
181
|
+
fallback?: string;
|
|
182
|
+
interactive?: InteractionConfig;
|
|
183
|
+
private isLoaded;
|
|
184
|
+
private hasError;
|
|
185
|
+
private previousSrc;
|
|
186
|
+
private get pixelSize();
|
|
187
|
+
protected willUpdate(changedProperties: Map<string, unknown>): void;
|
|
188
|
+
private handleLoad;
|
|
189
|
+
private handleError;
|
|
190
|
+
private getContainerStyles;
|
|
191
|
+
private renderPlaceholder;
|
|
192
|
+
private renderFallback;
|
|
193
|
+
private renderImage;
|
|
194
|
+
private renderRing;
|
|
195
|
+
private renderPresence;
|
|
196
|
+
private renderBadge;
|
|
197
|
+
private renderRibbon;
|
|
198
|
+
render(): lit_html.TemplateResult<1>;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
declare global {
|
|
202
|
+
interface HTMLElementTagNameMap {
|
|
203
|
+
"profile-picture": ProfilePicture$1;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
declare class ProfilePictureGroup$1 extends LitElement {
|
|
208
|
+
protected createRenderRoot(): this;
|
|
209
|
+
max: 4;
|
|
210
|
+
direction: StackDirection;
|
|
211
|
+
overlap: 0.3;
|
|
212
|
+
size: Size | string;
|
|
213
|
+
spacing?: number;
|
|
214
|
+
tooltip?: TooltipConfig;
|
|
215
|
+
dropdown?: DropdownConfig;
|
|
216
|
+
showAddButton: boolean;
|
|
217
|
+
addButtonLabel: string;
|
|
218
|
+
animated: true;
|
|
219
|
+
private users;
|
|
220
|
+
private dropdownOpen;
|
|
221
|
+
private tooltipData;
|
|
222
|
+
private tooltipTimeout;
|
|
223
|
+
private slotObserver;
|
|
224
|
+
private get pixelSize();
|
|
225
|
+
private get tooltipEnabled();
|
|
226
|
+
private get tooltipPosition();
|
|
227
|
+
private get tooltipDelay();
|
|
228
|
+
private get dropdownMaxHeight();
|
|
229
|
+
private get showPresence();
|
|
230
|
+
private get dropdownPosition();
|
|
231
|
+
connectedCallback(): void;
|
|
232
|
+
disconnectedCallback(): void;
|
|
233
|
+
private setupSlotObserver;
|
|
234
|
+
private updateUsers;
|
|
235
|
+
private handleAvatarClick;
|
|
236
|
+
private handleAvatarHover;
|
|
237
|
+
private handleAvatarLeave;
|
|
238
|
+
private clearTooltipTimeout;
|
|
239
|
+
private handleCounterClick;
|
|
240
|
+
private readonly handleBackdropClick;
|
|
241
|
+
private handleDropdownItemClick;
|
|
242
|
+
private handleAddClick;
|
|
243
|
+
private handleKeyDown;
|
|
244
|
+
private renderAvatar;
|
|
245
|
+
private renderProfilePicture;
|
|
246
|
+
private renderCounter;
|
|
247
|
+
private renderAddButton;
|
|
248
|
+
private renderTooltip;
|
|
249
|
+
private renderDropdown;
|
|
250
|
+
private renderDropdownItem;
|
|
251
|
+
private formatStatus;
|
|
252
|
+
render(): lit_html.TemplateResult<1>;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
declare global {
|
|
256
|
+
interface HTMLElementTagNameMap {
|
|
257
|
+
"profile-picture-group": ProfilePictureGroup$1;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* React wrapper for ProfilePictureGroup Web Component
|
|
263
|
+
*
|
|
264
|
+
* Provides a type-safe React interface for the ProfilePictureGroup web component.
|
|
265
|
+
*
|
|
266
|
+
* @example
|
|
267
|
+
* ```tsx
|
|
268
|
+
* import { ProfilePictureGroup, ProfilePicture } from '@grasco/profile-picture';
|
|
269
|
+
*
|
|
270
|
+
* function App() {
|
|
271
|
+
* return (
|
|
272
|
+
* <ProfilePictureGroup
|
|
273
|
+
* max={4}
|
|
274
|
+
* direction="ltr"
|
|
275
|
+
* overlap={0.3}
|
|
276
|
+
* size="md"
|
|
277
|
+
* showAddButton
|
|
278
|
+
* onAvatarClick={(user) => console.log('Clicked:', user)}
|
|
279
|
+
* onAddClick={() => console.log('Add clicked')}
|
|
280
|
+
* >
|
|
281
|
+
* <ProfilePicture src="avatar1.jpg" alt="John Doe" data-user-id="1" />
|
|
282
|
+
* <ProfilePicture src="avatar2.jpg" alt="Jane Smith" data-user-id="2" />
|
|
283
|
+
* <ProfilePicture src="avatar3.jpg" alt="Bob Wilson" data-user-id="3" />
|
|
284
|
+
* </ProfilePictureGroup>
|
|
285
|
+
* );
|
|
286
|
+
* }
|
|
287
|
+
* ```
|
|
288
|
+
*/
|
|
289
|
+
|
|
290
|
+
interface ProfilePictureGroupProps {
|
|
291
|
+
/** Maximum visible avatars before showing counter (default: 4) */
|
|
292
|
+
max?: number;
|
|
293
|
+
/** Stack direction - ltr shows first on left (default: 'ltr') */
|
|
294
|
+
direction?: StackDirection;
|
|
295
|
+
/** Overlap amount as percentage 0-1 (default: 0.3) */
|
|
296
|
+
overlap?: number;
|
|
297
|
+
/** Avatar size - inherited by children (default: 'md') */
|
|
298
|
+
size?: Size | number;
|
|
299
|
+
/** Spacing between avatars in px (overrides overlap calculation) */
|
|
300
|
+
spacing?: number;
|
|
301
|
+
/** Tooltip configuration */
|
|
302
|
+
tooltip?: TooltipConfig;
|
|
303
|
+
/** Dropdown configuration for overflow users */
|
|
304
|
+
dropdown?: DropdownConfig;
|
|
305
|
+
/** Show add button (default: false) */
|
|
306
|
+
showAddButton?: boolean;
|
|
307
|
+
/** Add button label for accessibility */
|
|
308
|
+
addButtonLabel?: string;
|
|
309
|
+
/** Enable hover lift animation (default: true) */
|
|
310
|
+
animated?: boolean;
|
|
311
|
+
/** Called when an avatar is clicked */
|
|
312
|
+
onAvatarClick?: (user: GroupUserData) => void;
|
|
313
|
+
/** Called when hovering over an avatar */
|
|
314
|
+
onAvatarHover?: (user: GroupUserData) => void;
|
|
315
|
+
/** Called when the counter is clicked */
|
|
316
|
+
onCounterClick?: (hiddenUsers: GroupUserData[], open: boolean) => void;
|
|
317
|
+
/** Called when a dropdown item is clicked */
|
|
318
|
+
onDropdownItemClick?: (user: GroupUserData) => void;
|
|
319
|
+
/** Called when the add button is clicked */
|
|
320
|
+
onAddClick?: () => void;
|
|
321
|
+
className?: string;
|
|
322
|
+
style?: React.CSSProperties;
|
|
323
|
+
children?: React.ReactNode;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* ProfilePictureGroup React Component
|
|
327
|
+
*
|
|
328
|
+
* Type-safe wrapper around the profile-picture-group web component
|
|
329
|
+
*/
|
|
330
|
+
declare const ProfilePictureGroup: React.ForwardRefExoticComponent<ProfilePictureGroupProps & React.RefAttributes<HTMLElement>>;
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* React wrapper for ProfilePicture Web Component
|
|
334
|
+
*
|
|
335
|
+
* Provides a type-safe React interface for the ProfilePicture web component.
|
|
336
|
+
*
|
|
337
|
+
* @example
|
|
338
|
+
* ```tsx
|
|
339
|
+
* import { ProfilePicture } from '@grasco/profile-picture';
|
|
340
|
+
*
|
|
341
|
+
* function App() {
|
|
342
|
+
* return (
|
|
343
|
+
* <ProfilePicture
|
|
344
|
+
* src="https://example.com/avatar.png"
|
|
345
|
+
* alt="John Doe"
|
|
346
|
+
* size="lg"
|
|
347
|
+
* variant="circle"
|
|
348
|
+
* border
|
|
349
|
+
* borderColor="white"
|
|
350
|
+
* bgColor="bg-gradient-to-br from-purple-500 to-pink-500"
|
|
351
|
+
* ribbon={{ text: 'PRO', position: 'top-right', bgColor: 'bg-amber-500' }}
|
|
352
|
+
* badge={{ content: '3', position: 'bottom-right', pulse: true }}
|
|
353
|
+
* onLoad={() => console.log('loaded')}
|
|
354
|
+
* onError={() => console.error('failed')}
|
|
355
|
+
* />
|
|
356
|
+
* );
|
|
357
|
+
* }
|
|
358
|
+
* ```
|
|
359
|
+
*/
|
|
360
|
+
|
|
361
|
+
interface ProfilePictureProps {
|
|
362
|
+
src: string;
|
|
363
|
+
alt?: string;
|
|
364
|
+
size?: Size | number;
|
|
365
|
+
variant?: Variant;
|
|
366
|
+
border?: boolean;
|
|
367
|
+
borderWidth?: 1 | 2 | 3 | 4;
|
|
368
|
+
borderColor?: string;
|
|
369
|
+
bgColor?: string;
|
|
370
|
+
bgGradient?: string;
|
|
371
|
+
ribbon?: RibbonConfig;
|
|
372
|
+
badge?: BadgeConfig;
|
|
373
|
+
loading?: LoadingStrategy;
|
|
374
|
+
placeholder?: PlaceholderType;
|
|
375
|
+
placeholderColor?: string;
|
|
376
|
+
fallback?: string;
|
|
377
|
+
onLoad?: () => void;
|
|
378
|
+
onError?: () => void;
|
|
379
|
+
className?: string;
|
|
380
|
+
style?: React.CSSProperties;
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* ProfilePicture React Component
|
|
384
|
+
*
|
|
385
|
+
* Type-safe wrapper around the profile-picture web component
|
|
386
|
+
*/
|
|
387
|
+
declare const ProfilePicture: React.ForwardRefExoticComponent<ProfilePictureProps & React.RefAttributes<HTMLElement>>;
|
|
388
|
+
|
|
389
|
+
export { type BadgeConfig, type DropdownConfig, type GroupUserData, type LoadingStrategy, type PlaceholderType, type Position, ProfilePicture, ProfilePictureGroup, type ProfilePictureGroupProps$1 as ProfilePictureGroupProps, type ProfilePictureProps, type RibbonConfig, type Size, type StackDirection, type TooltipConfig, type TooltipPosition, type Variant };
|