@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.
Files changed (125) hide show
  1. package/CHANGELOG.json +794 -13
  2. package/CHANGELOG.md +324 -133
  3. package/MIGRATION.md +71 -66
  4. package/SPEC-AvatarGroup.md +185 -0
  5. package/SPEC.md +160 -135
  6. package/dist/index.d.ts +306 -0
  7. package/{lib → dist}/tsdoc-metadata.json +0 -0
  8. package/lib/Avatar.js.map +1 -1
  9. package/lib/AvatarGroup.js +2 -0
  10. package/lib/AvatarGroup.js.map +1 -0
  11. package/lib/AvatarGroupItem.js +2 -0
  12. package/lib/AvatarGroupItem.js.map +1 -0
  13. package/lib/components/Avatar/Avatar.js.map +1 -1
  14. package/lib/components/Avatar/Avatar.types.js.map +1 -1
  15. package/lib/components/Avatar/index.js.map +1 -1
  16. package/lib/components/Avatar/renderAvatar.js.map +1 -1
  17. package/lib/components/Avatar/useAvatar.js +7 -10
  18. package/lib/components/Avatar/useAvatar.js.map +1 -1
  19. package/lib/components/Avatar/useAvatarStyles.js +89 -74
  20. package/lib/components/Avatar/useAvatarStyles.js.map +1 -1
  21. package/lib/components/AvatarGroup/AvatarGroup.js +16 -0
  22. package/lib/components/AvatarGroup/AvatarGroup.js.map +1 -0
  23. package/lib/components/AvatarGroup/AvatarGroup.types.js +2 -0
  24. package/lib/components/AvatarGroup/AvatarGroup.types.js.map +1 -0
  25. package/lib/components/AvatarGroup/index.js +6 -0
  26. package/lib/components/AvatarGroup/index.js.map +1 -0
  27. package/lib/components/AvatarGroup/renderAvatarGroup.js +43 -0
  28. package/lib/components/AvatarGroup/renderAvatarGroup.js.map +1 -0
  29. package/lib/components/AvatarGroup/useAvatarGroup.js +91 -0
  30. package/lib/components/AvatarGroup/useAvatarGroup.js.map +1 -0
  31. package/lib/components/AvatarGroup/useAvatarGroupStyles.js +296 -0
  32. package/lib/components/AvatarGroup/useAvatarGroupStyles.js.map +1 -0
  33. package/lib/components/AvatarGroupItem/AvatarGroupItem.js +16 -0
  34. package/lib/components/AvatarGroupItem/AvatarGroupItem.js.map +1 -0
  35. package/lib/components/AvatarGroupItem/AvatarGroupItem.types.js +2 -0
  36. package/lib/components/AvatarGroupItem/AvatarGroupItem.types.js.map +1 -0
  37. package/lib/components/AvatarGroupItem/index.js +6 -0
  38. package/lib/components/AvatarGroupItem/index.js.map +1 -0
  39. package/lib/components/AvatarGroupItem/renderAvatarGroupItem.js +17 -0
  40. package/lib/components/AvatarGroupItem/renderAvatarGroupItem.js.map +1 -0
  41. package/lib/components/AvatarGroupItem/useAvatarGroupItem.js +70 -0
  42. package/lib/components/AvatarGroupItem/useAvatarGroupItem.js.map +1 -0
  43. package/lib/components/AvatarGroupItem/useAvatarGroupItemStyles.js +356 -0
  44. package/lib/components/AvatarGroupItem/useAvatarGroupItemStyles.js.map +1 -0
  45. package/lib/contexts/AvatarGroupContext.js +7 -0
  46. package/lib/contexts/AvatarGroupContext.js.map +1 -0
  47. package/lib/contexts/AvatarGroupContext.types.js +2 -0
  48. package/lib/contexts/AvatarGroupContext.types.js.map +1 -0
  49. package/lib/contexts/index.js +2 -0
  50. package/lib/contexts/index.js.map +1 -0
  51. package/lib/index.js +4 -2
  52. package/lib/index.js.map +1 -1
  53. package/lib/utils/getInitials.js +16 -12
  54. package/lib/utils/getInitials.js.map +1 -1
  55. package/lib/utils/index.js.map +1 -1
  56. package/lib-commonjs/Avatar.js.map +1 -1
  57. package/lib-commonjs/AvatarGroup.js +10 -0
  58. package/lib-commonjs/AvatarGroup.js.map +1 -0
  59. package/lib-commonjs/AvatarGroupItem.js +10 -0
  60. package/lib-commonjs/AvatarGroupItem.js.map +1 -0
  61. package/lib-commonjs/components/Avatar/Avatar.js.map +1 -1
  62. package/lib-commonjs/components/Avatar/Avatar.types.js.map +1 -1
  63. package/lib-commonjs/components/Avatar/index.js.map +1 -1
  64. package/lib-commonjs/components/Avatar/renderAvatar.js.map +1 -1
  65. package/lib-commonjs/components/Avatar/useAvatar.js +7 -10
  66. package/lib-commonjs/components/Avatar/useAvatar.js.map +1 -1
  67. package/lib-commonjs/components/Avatar/useAvatarStyles.js +91 -76
  68. package/lib-commonjs/components/Avatar/useAvatarStyles.js.map +1 -1
  69. package/lib-commonjs/components/AvatarGroup/AvatarGroup.js +27 -0
  70. package/lib-commonjs/components/AvatarGroup/AvatarGroup.js.map +1 -0
  71. package/lib-commonjs/components/AvatarGroup/AvatarGroup.types.js +6 -0
  72. package/lib-commonjs/components/AvatarGroup/AvatarGroup.types.js.map +1 -0
  73. package/lib-commonjs/components/AvatarGroup/index.js +18 -0
  74. package/lib-commonjs/components/AvatarGroup/index.js.map +1 -0
  75. package/lib-commonjs/components/AvatarGroup/renderAvatarGroup.js +57 -0
  76. package/lib-commonjs/components/AvatarGroup/renderAvatarGroup.js.map +1 -0
  77. package/lib-commonjs/components/AvatarGroup/useAvatarGroup.js +105 -0
  78. package/lib-commonjs/components/AvatarGroup/useAvatarGroup.js.map +1 -0
  79. package/lib-commonjs/components/AvatarGroup/useAvatarGroupStyles.js +310 -0
  80. package/lib-commonjs/components/AvatarGroup/useAvatarGroupStyles.js.map +1 -0
  81. package/lib-commonjs/components/AvatarGroupItem/AvatarGroupItem.js +27 -0
  82. package/lib-commonjs/components/AvatarGroupItem/AvatarGroupItem.js.map +1 -0
  83. package/lib-commonjs/components/AvatarGroupItem/AvatarGroupItem.types.js +6 -0
  84. package/lib-commonjs/components/AvatarGroupItem/AvatarGroupItem.types.js.map +1 -0
  85. package/lib-commonjs/components/AvatarGroupItem/index.js +18 -0
  86. package/lib-commonjs/components/AvatarGroupItem/index.js.map +1 -0
  87. package/lib-commonjs/components/AvatarGroupItem/renderAvatarGroupItem.js +28 -0
  88. package/lib-commonjs/components/AvatarGroupItem/renderAvatarGroupItem.js.map +1 -0
  89. package/lib-commonjs/components/AvatarGroupItem/useAvatarGroupItem.js +84 -0
  90. package/lib-commonjs/components/AvatarGroupItem/useAvatarGroupItem.js.map +1 -0
  91. package/lib-commonjs/components/AvatarGroupItem/useAvatarGroupItemStyles.js +370 -0
  92. package/lib-commonjs/components/AvatarGroupItem/useAvatarGroupItemStyles.js.map +1 -0
  93. package/lib-commonjs/contexts/AvatarGroupContext.js +15 -0
  94. package/lib-commonjs/contexts/AvatarGroupContext.js.map +1 -0
  95. package/lib-commonjs/contexts/AvatarGroupContext.types.js +6 -0
  96. package/lib-commonjs/contexts/AvatarGroupContext.types.js.map +1 -0
  97. package/lib-commonjs/contexts/index.js +10 -0
  98. package/lib-commonjs/contexts/index.js.map +1 -0
  99. package/lib-commonjs/index.js +106 -3
  100. package/lib-commonjs/index.js.map +1 -1
  101. package/lib-commonjs/utils/getInitials.js +16 -12
  102. package/lib-commonjs/utils/getInitials.js.map +1 -1
  103. package/lib-commonjs/utils/index.js.map +1 -1
  104. package/package.json +26 -25
  105. package/dist/react-avatar.d.ts +0 -142
  106. package/lib/Avatar.d.ts +0 -1
  107. package/lib/components/Avatar/Avatar.d.ts +0 -3
  108. package/lib/components/Avatar/Avatar.types.d.ts +0 -107
  109. package/lib/components/Avatar/index.d.ts +0 -5
  110. package/lib/components/Avatar/renderAvatar.d.ts +0 -2
  111. package/lib/components/Avatar/useAvatar.d.ts +0 -3
  112. package/lib/components/Avatar/useAvatarStyles.d.ts +0 -3
  113. package/lib/index.d.ts +0 -2
  114. package/lib/utils/getInitials.d.ts +0 -14
  115. package/lib/utils/index.d.ts +0 -1
  116. package/lib-commonjs/Avatar.d.ts +0 -1
  117. package/lib-commonjs/components/Avatar/Avatar.d.ts +0 -3
  118. package/lib-commonjs/components/Avatar/Avatar.types.d.ts +0 -107
  119. package/lib-commonjs/components/Avatar/index.d.ts +0 -5
  120. package/lib-commonjs/components/Avatar/renderAvatar.d.ts +0 -2
  121. package/lib-commonjs/components/Avatar/useAvatar.d.ts +0 -3
  122. package/lib-commonjs/components/Avatar/useAvatarStyles.d.ts +0 -3
  123. package/lib-commonjs/index.d.ts +0 -2
  124. package/lib-commonjs/utils/getInitials.d.ts +0 -14
  125. 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 {};
@@ -1,5 +0,0 @@
1
- export * from './Avatar.types';
2
- export * from './Avatar';
3
- export * from './renderAvatar';
4
- export * from './useAvatar';
5
- export * from './useAvatarStyles';
@@ -1,2 +0,0 @@
1
- import type { AvatarState } from './Avatar.types';
2
- export declare const renderAvatar_unstable: (state: AvatarState) => JSX.Element;
@@ -1,3 +0,0 @@
1
- import * as React from 'react';
2
- import type { AvatarProps, AvatarState } from './Avatar.types';
3
- export declare const useAvatar_unstable: (props: AvatarProps, ref: React.Ref<HTMLElement>) => AvatarState;
@@ -1,3 +0,0 @@
1
- import type { AvatarState } from './Avatar.types';
2
- export declare const avatarClassName = "fui-Avatar";
3
- export declare const useAvatarStyles_unstable: (state: AvatarState) => AvatarState;
@@ -1,2 +0,0 @@
1
- export * from './Avatar';
2
- export * from './utils/index';
@@ -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';