@fluentui/react-avatar 0.0.0-nightlyfc5cfdc52420220215.1 → 0.0.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/CHANGELOG.json +794 -13
- package/CHANGELOG.md +324 -133
- package/MIGRATION.md +71 -66
- package/SPEC-AvatarGroup.md +185 -0
- package/SPEC.md +160 -135
- package/dist/index.d.ts +306 -0
- package/{lib → dist}/tsdoc-metadata.json +0 -0
- package/lib/Avatar.js.map +1 -1
- package/lib/AvatarGroup.js +2 -0
- package/lib/AvatarGroup.js.map +1 -0
- package/lib/AvatarGroupItem.js +2 -0
- package/lib/AvatarGroupItem.js.map +1 -0
- package/lib/components/Avatar/Avatar.js.map +1 -1
- package/lib/components/Avatar/Avatar.types.js.map +1 -1
- package/lib/components/Avatar/index.js.map +1 -1
- package/lib/components/Avatar/renderAvatar.js.map +1 -1
- package/lib/components/Avatar/useAvatar.js +7 -10
- package/lib/components/Avatar/useAvatar.js.map +1 -1
- package/lib/components/Avatar/useAvatarStyles.js +89 -74
- package/lib/components/Avatar/useAvatarStyles.js.map +1 -1
- package/lib/components/AvatarGroup/AvatarGroup.js +16 -0
- package/lib/components/AvatarGroup/AvatarGroup.js.map +1 -0
- package/lib/components/AvatarGroup/AvatarGroup.types.js +2 -0
- package/lib/components/AvatarGroup/AvatarGroup.types.js.map +1 -0
- package/lib/components/AvatarGroup/index.js +6 -0
- package/lib/components/AvatarGroup/index.js.map +1 -0
- package/lib/components/AvatarGroup/renderAvatarGroup.js +43 -0
- package/lib/components/AvatarGroup/renderAvatarGroup.js.map +1 -0
- package/lib/components/AvatarGroup/useAvatarGroup.js +91 -0
- package/lib/components/AvatarGroup/useAvatarGroup.js.map +1 -0
- package/lib/components/AvatarGroup/useAvatarGroupStyles.js +296 -0
- package/lib/components/AvatarGroup/useAvatarGroupStyles.js.map +1 -0
- package/lib/components/AvatarGroupItem/AvatarGroupItem.js +16 -0
- package/lib/components/AvatarGroupItem/AvatarGroupItem.js.map +1 -0
- package/lib/components/AvatarGroupItem/AvatarGroupItem.types.js +2 -0
- package/lib/components/AvatarGroupItem/AvatarGroupItem.types.js.map +1 -0
- package/lib/components/AvatarGroupItem/index.js +6 -0
- package/lib/components/AvatarGroupItem/index.js.map +1 -0
- package/lib/components/AvatarGroupItem/renderAvatarGroupItem.js +17 -0
- package/lib/components/AvatarGroupItem/renderAvatarGroupItem.js.map +1 -0
- package/lib/components/AvatarGroupItem/useAvatarGroupItem.js +70 -0
- package/lib/components/AvatarGroupItem/useAvatarGroupItem.js.map +1 -0
- package/lib/components/AvatarGroupItem/useAvatarGroupItemStyles.js +356 -0
- package/lib/components/AvatarGroupItem/useAvatarGroupItemStyles.js.map +1 -0
- package/lib/contexts/AvatarGroupContext.js +7 -0
- package/lib/contexts/AvatarGroupContext.js.map +1 -0
- package/lib/contexts/AvatarGroupContext.types.js +2 -0
- package/lib/contexts/AvatarGroupContext.types.js.map +1 -0
- package/lib/contexts/index.js +2 -0
- package/lib/contexts/index.js.map +1 -0
- package/lib/index.js +4 -2
- package/lib/index.js.map +1 -1
- package/lib/utils/getInitials.js +16 -12
- package/lib/utils/getInitials.js.map +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib-commonjs/Avatar.js.map +1 -1
- package/lib-commonjs/AvatarGroup.js +10 -0
- package/lib-commonjs/AvatarGroup.js.map +1 -0
- package/lib-commonjs/AvatarGroupItem.js +10 -0
- package/lib-commonjs/AvatarGroupItem.js.map +1 -0
- package/lib-commonjs/components/Avatar/Avatar.js.map +1 -1
- package/lib-commonjs/components/Avatar/Avatar.types.js.map +1 -1
- package/lib-commonjs/components/Avatar/index.js.map +1 -1
- package/lib-commonjs/components/Avatar/renderAvatar.js.map +1 -1
- package/lib-commonjs/components/Avatar/useAvatar.js +7 -10
- package/lib-commonjs/components/Avatar/useAvatar.js.map +1 -1
- package/lib-commonjs/components/Avatar/useAvatarStyles.js +91 -76
- package/lib-commonjs/components/Avatar/useAvatarStyles.js.map +1 -1
- package/lib-commonjs/components/AvatarGroup/AvatarGroup.js +27 -0
- package/lib-commonjs/components/AvatarGroup/AvatarGroup.js.map +1 -0
- package/lib-commonjs/components/AvatarGroup/AvatarGroup.types.js +6 -0
- package/lib-commonjs/components/AvatarGroup/AvatarGroup.types.js.map +1 -0
- package/lib-commonjs/components/AvatarGroup/index.js +18 -0
- package/lib-commonjs/components/AvatarGroup/index.js.map +1 -0
- package/lib-commonjs/components/AvatarGroup/renderAvatarGroup.js +57 -0
- package/lib-commonjs/components/AvatarGroup/renderAvatarGroup.js.map +1 -0
- package/lib-commonjs/components/AvatarGroup/useAvatarGroup.js +105 -0
- package/lib-commonjs/components/AvatarGroup/useAvatarGroup.js.map +1 -0
- package/lib-commonjs/components/AvatarGroup/useAvatarGroupStyles.js +310 -0
- package/lib-commonjs/components/AvatarGroup/useAvatarGroupStyles.js.map +1 -0
- package/lib-commonjs/components/AvatarGroupItem/AvatarGroupItem.js +27 -0
- package/lib-commonjs/components/AvatarGroupItem/AvatarGroupItem.js.map +1 -0
- package/lib-commonjs/components/AvatarGroupItem/AvatarGroupItem.types.js +6 -0
- package/lib-commonjs/components/AvatarGroupItem/AvatarGroupItem.types.js.map +1 -0
- package/lib-commonjs/components/AvatarGroupItem/index.js +18 -0
- package/lib-commonjs/components/AvatarGroupItem/index.js.map +1 -0
- package/lib-commonjs/components/AvatarGroupItem/renderAvatarGroupItem.js +28 -0
- package/lib-commonjs/components/AvatarGroupItem/renderAvatarGroupItem.js.map +1 -0
- package/lib-commonjs/components/AvatarGroupItem/useAvatarGroupItem.js +84 -0
- package/lib-commonjs/components/AvatarGroupItem/useAvatarGroupItem.js.map +1 -0
- package/lib-commonjs/components/AvatarGroupItem/useAvatarGroupItemStyles.js +370 -0
- package/lib-commonjs/components/AvatarGroupItem/useAvatarGroupItemStyles.js.map +1 -0
- package/lib-commonjs/contexts/AvatarGroupContext.js +15 -0
- package/lib-commonjs/contexts/AvatarGroupContext.js.map +1 -0
- package/lib-commonjs/contexts/AvatarGroupContext.types.js +6 -0
- package/lib-commonjs/contexts/AvatarGroupContext.types.js.map +1 -0
- package/lib-commonjs/contexts/index.js +10 -0
- package/lib-commonjs/contexts/index.js.map +1 -0
- package/lib-commonjs/index.js +106 -3
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utils/getInitials.js +16 -12
- package/lib-commonjs/utils/getInitials.js.map +1 -1
- package/lib-commonjs/utils/index.js.map +1 -1
- package/package.json +26 -25
- package/dist/react-avatar.d.ts +0 -142
- package/lib/Avatar.d.ts +0 -1
- package/lib/components/Avatar/Avatar.d.ts +0 -3
- package/lib/components/Avatar/Avatar.types.d.ts +0 -107
- package/lib/components/Avatar/index.d.ts +0 -5
- package/lib/components/Avatar/renderAvatar.d.ts +0 -2
- package/lib/components/Avatar/useAvatar.d.ts +0 -3
- package/lib/components/Avatar/useAvatarStyles.d.ts +0 -3
- package/lib/index.d.ts +0 -2
- package/lib/utils/getInitials.d.ts +0 -14
- package/lib/utils/index.d.ts +0 -1
- package/lib-commonjs/Avatar.d.ts +0 -1
- package/lib-commonjs/components/Avatar/Avatar.d.ts +0 -3
- package/lib-commonjs/components/Avatar/Avatar.types.d.ts +0 -107
- package/lib-commonjs/components/Avatar/index.d.ts +0 -5
- package/lib-commonjs/components/Avatar/renderAvatar.d.ts +0 -2
- package/lib-commonjs/components/Avatar/useAvatar.d.ts +0 -3
- package/lib-commonjs/components/Avatar/useAvatarStyles.d.ts +0 -3
- package/lib-commonjs/index.d.ts +0 -2
- package/lib-commonjs/utils/getInitials.d.ts +0 -14
- package/lib-commonjs/utils/index.d.ts +0 -1
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { PresenceBadge } from '@fluentui/react-badge';
|
|
2
|
-
import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
|
|
3
|
-
export declare type AvatarSlots = {
|
|
4
|
-
root: Slot<'span'>;
|
|
5
|
-
/**
|
|
6
|
-
* The Avatar's image.
|
|
7
|
-
*
|
|
8
|
-
* Usage e.g.: `image={{ src: '...' }}`
|
|
9
|
-
*/
|
|
10
|
-
image?: Slot<'img'>;
|
|
11
|
-
/**
|
|
12
|
-
* (optional) Custom initials.
|
|
13
|
-
*
|
|
14
|
-
* It is usually not necessary to specify custom initials; by default they will be derived from the `name` prop,
|
|
15
|
-
* using the `getInitials` function.
|
|
16
|
-
*
|
|
17
|
-
* The initials are displayed when there is no image (including while the image is loading).
|
|
18
|
-
*/
|
|
19
|
-
initials?: Slot<'span'>;
|
|
20
|
-
/**
|
|
21
|
-
* Icon to be displayed when the avatar doesn't have an image or initials.
|
|
22
|
-
*
|
|
23
|
-
* @defaultvalue `PersonRegular` (the default icon's size depends on the Avatar's size)
|
|
24
|
-
*/
|
|
25
|
-
icon?: Slot<'span'>;
|
|
26
|
-
/**
|
|
27
|
-
* Badge to show the avatar's presence status.
|
|
28
|
-
*/
|
|
29
|
-
badge?: Slot<typeof PresenceBadge>;
|
|
30
|
-
};
|
|
31
|
-
declare type AvatarCommons = {
|
|
32
|
-
/**
|
|
33
|
-
* The name of the person or entity represented by this Avatar. This should always be provided if it is available.
|
|
34
|
-
*
|
|
35
|
-
* The name will be used to determine the initials displayed when there is no icon, as well as provided to
|
|
36
|
-
* accessibility tools.
|
|
37
|
-
*/
|
|
38
|
-
name?: string;
|
|
39
|
-
/**
|
|
40
|
-
* Size of the avatar in pixels.
|
|
41
|
-
*
|
|
42
|
-
* Size is restricted to a limited set of supported values recommended for most uses (see `AvatarSizeValue`) and
|
|
43
|
-
* based on design guidelines for the Avatar control.
|
|
44
|
-
*
|
|
45
|
-
* If a non-supported size is neeeded, set `size` to the next-smaller supported size, and set `width` and `height`
|
|
46
|
-
* to override the rendered size.
|
|
47
|
-
*
|
|
48
|
-
* For example, to set the avatar to 45px in size:
|
|
49
|
-
* `<Avatar size={40} style={{ width: '45px', height: '45px' }} />`
|
|
50
|
-
*
|
|
51
|
-
* @defaultvalue 32
|
|
52
|
-
*/
|
|
53
|
-
size: 20 | 24 | 28 | 32 | 36 | 40 | 48 | 56 | 64 | 72 | 96 | 120 | 128;
|
|
54
|
-
/**
|
|
55
|
-
* The avatar can have a circular or square shape.
|
|
56
|
-
* @defaultvalue circular
|
|
57
|
-
*/
|
|
58
|
-
shape: 'circular' | 'square';
|
|
59
|
-
/**
|
|
60
|
-
* Optional activity indicator
|
|
61
|
-
* * active: the avatar will be decorated according to activeAppearance
|
|
62
|
-
* * inactive: the avatar will be reduced in size and partially transparent
|
|
63
|
-
* * unset: normal display
|
|
64
|
-
*
|
|
65
|
-
* @defaultvalue unset
|
|
66
|
-
*/
|
|
67
|
-
active: 'active' | 'inactive' | 'unset';
|
|
68
|
-
/**
|
|
69
|
-
* The appearance when `active="active"`
|
|
70
|
-
*
|
|
71
|
-
* @defaultvalue ring
|
|
72
|
-
*/
|
|
73
|
-
activeAppearance: 'ring' | 'shadow' | 'ring-shadow';
|
|
74
|
-
/**
|
|
75
|
-
* The color when displaying either an icon or initials.
|
|
76
|
-
* * neutral (default): gray
|
|
77
|
-
* * brand: color from the brand palette
|
|
78
|
-
* * colorful: picks a color from a set of pre-defined colors, based on a hash of the name (or idForColor if provided)
|
|
79
|
-
* * [AvatarNamedColor]: a specific color from the theme
|
|
80
|
-
*
|
|
81
|
-
* @defaultvalue neutral
|
|
82
|
-
*/
|
|
83
|
-
color: 'neutral' | 'brand' | 'colorful' | AvatarNamedColor;
|
|
84
|
-
/**
|
|
85
|
-
* Specify a string to be used instead of the name, to determine which color to use when color="colorful".
|
|
86
|
-
* Use this when a name is not available, but there is another unique identifier that can be used instead.
|
|
87
|
-
*/
|
|
88
|
-
idForColor: string | undefined;
|
|
89
|
-
};
|
|
90
|
-
/**
|
|
91
|
-
* A specific named color for the Avatar
|
|
92
|
-
*/
|
|
93
|
-
export declare type AvatarNamedColor = 'darkRed' | 'cranberry' | 'red' | 'pumpkin' | 'peach' | 'marigold' | 'gold' | 'brass' | 'brown' | 'forest' | 'seafoam' | 'darkGreen' | 'lightTeal' | 'teal' | 'steel' | 'blue' | 'royalBlue' | 'cornflower' | 'navy' | 'lavender' | 'purple' | 'grape' | 'lilac' | 'pink' | 'magenta' | 'plum' | 'beige' | 'mink' | 'platinum' | 'anchor';
|
|
94
|
-
/**
|
|
95
|
-
* Properties for Avatar
|
|
96
|
-
*/
|
|
97
|
-
export declare type AvatarProps = Omit<ComponentProps<AvatarSlots>, 'color'> & Partial<AvatarCommons>;
|
|
98
|
-
/**
|
|
99
|
-
* State used in rendering Avatar
|
|
100
|
-
*/
|
|
101
|
-
export declare type AvatarState = ComponentState<AvatarSlots> & AvatarCommons & {
|
|
102
|
-
/**
|
|
103
|
-
* The Avatar's color, with `'colorful'` resolved to a named color
|
|
104
|
-
*/
|
|
105
|
-
color: Exclude<AvatarCommons['color'], 'colorful'>;
|
|
106
|
-
};
|
|
107
|
-
export {};
|
package/lib-commonjs/index.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Regular expressions matching characters to ignore when calculating the initials.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Get (up to 2 characters) initials based on display name of the persona.
|
|
6
|
-
*
|
|
7
|
-
* @param displayName - The full name of the person or entity
|
|
8
|
-
* @param isRtl - Whether the display is in RTL
|
|
9
|
-
* @param allowPhoneInitials - Should initials be generated from phone numbers (default false)
|
|
10
|
-
*
|
|
11
|
-
* @returns The 1 or 2 character initials based on the name. Or an empty string if no initials
|
|
12
|
-
* could be derived from the name.
|
|
13
|
-
*/
|
|
14
|
-
export declare function getInitials(displayName: string | undefined | null, isRtl: boolean, allowPhoneInitials?: boolean): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { getInitials } from './getInitials';
|