@fluentui/react-avatar 9.0.0-rc.9 → 9.0.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/CHANGELOG.json +544 -1
- package/CHANGELOG.md +131 -2
- package/MIGRATION-AvatarGroup.md +35 -0
- package/README-AvatarGroup.md +39 -0
- package/README.md +16 -11
- package/SPEC.md +1 -135
- package/dist/index.d.ts +90 -27
- 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/renderAvatar.js.map +1 -1
- package/lib/components/Avatar/useAvatar.js +4 -7
- package/lib/components/Avatar/useAvatar.js.map +1 -1
- package/lib/components/Avatar/useAvatarStyles.js +63 -68
- package/lib/components/Avatar/useAvatarStyles.js.map +1 -1
- package/lib/components/AvatarGroup/AvatarGroup.js +2 -1
- package/lib/components/AvatarGroup/AvatarGroup.js.map +1 -1
- package/lib/components/AvatarGroup/AvatarGroup.types.js.map +1 -1
- package/lib/components/AvatarGroup/renderAvatarGroup.js +32 -4
- package/lib/components/AvatarGroup/renderAvatarGroup.js.map +1 -1
- package/lib/components/AvatarGroup/useAvatarGroup.js +67 -28
- package/lib/components/AvatarGroup/useAvatarGroup.js.map +1 -1
- package/lib/components/AvatarGroup/useAvatarGroupStyles.js +280 -15
- package/lib/components/AvatarGroup/useAvatarGroupStyles.js.map +1 -1
- 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 +2 -2
- package/lib/index.js.map +1 -1
- package/lib/utils/getInitials.js +2 -0
- package/lib/utils/getInitials.js.map +1 -1
- 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/renderAvatar.js.map +1 -1
- package/lib-commonjs/components/Avatar/useAvatar.js +4 -7
- package/lib-commonjs/components/Avatar/useAvatar.js.map +1 -1
- package/lib-commonjs/components/Avatar/useAvatarStyles.js +65 -70
- package/lib-commonjs/components/Avatar/useAvatarStyles.js.map +1 -1
- package/lib-commonjs/components/AvatarGroup/AvatarGroup.js +2 -1
- package/lib-commonjs/components/AvatarGroup/AvatarGroup.js.map +1 -1
- package/lib-commonjs/components/AvatarGroup/renderAvatarGroup.js +35 -4
- package/lib-commonjs/components/AvatarGroup/renderAvatarGroup.js.map +1 -1
- package/lib-commonjs/components/AvatarGroup/useAvatarGroup.js +70 -31
- package/lib-commonjs/components/AvatarGroup/useAvatarGroup.js.map +1 -1
- package/lib-commonjs/components/AvatarGroup/useAvatarGroupStyles.js +284 -15
- package/lib-commonjs/components/AvatarGroup/useAvatarGroupStyles.js.map +1 -1
- 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 +34 -8
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utils/getInitials.js +2 -0
- package/lib-commonjs/utils/getInitials.js.map +1 -1
- package/lib-commonjs/utils/index.js.map +1 -1
- package/package.json +16 -16
- package/lib/components/AvatarGroup/AvatarGroup.strings.js +0 -4
- package/lib/components/AvatarGroup/AvatarGroup.strings.js.map +0 -1
- package/lib-commonjs/components/AvatarGroup/AvatarGroup.strings.js +0 -10
- package/lib-commonjs/components/AvatarGroup/AvatarGroup.strings.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/AvatarGroupItem/useAvatarGroupItem.ts"],"names":[],"mappings":"AACA,SAAS,MAAT,QAAuB,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CALP;IAUL,IAAI,EAAE,gBAAgB,CAAC,KAAK,CAAC,IAAP,EAAa;MACjC,QAAQ,EAAE,IADuB;MAEjC,YAAY,EAAE;QACZ,KADY;QAEZ,SAFY;QAGZ,IAAI,EAAE,eAAe,GAAG,UAAH,GAAgB;MAHzB;IAFmB,CAAb,CAVjB;IAkBL,MAAM,EAAE,gBAAgB,CAAC,KAAK,CAAC,MAAP,EAAe;MACrC,QAAQ,EAAE,IAD2B;MAErC,YAAY,EAAE;QACZ,GADY;QAEZ,IAFY;QAGZ,KAAK,EAAE,UAHK;QAIZ,GAAG;MAJS;IAFuB,CAAf,CAlBnB;IA2BL,aAAa,EAAE,gBAAgB,CAAC,KAAK,CAAC,aAAP,EAAsB;MACnD,QAAQ,EAAE,IADyC;MAEnD,YAAY,EAAE;QACZ,QAAQ,EAAE,KAAK,CAAC;MADJ;IAFqC,CAAtB;EA3B1B,CAAP;AAkCD,CApDM","sourcesContent":["import * as React from 'react';\nimport { Avatar } from '../Avatar/Avatar';\nimport { AvatarGroupContext } from '../../contexts/AvatarGroupContext';\nimport { defaultAvatarGroupSize } from '../AvatarGroup/useAvatarGroup';\nimport { resolveShorthand } from '@fluentui/react-utilities';\nimport { useContextSelector, useHasParentContext } from '@fluentui/react-context-selector';\nimport type { AvatarGroupItemProps, AvatarGroupItemState } from './AvatarGroupItem.types';\n\n/**\n * Create the state required to render AvatarGroupItem.\n *\n * The returned state can be modified with hooks such as useAvatarGroupItemStyles_unstable,\n * before being passed to renderAvatarGroupItem_unstable.\n *\n * @param props - props from this instance of AvatarGroupItem\n * @param ref - reference to root HTMLElement of AvatarGroupItem\n */\nexport const useAvatarGroupItem_unstable = (\n props: AvatarGroupItemProps,\n ref: React.Ref<HTMLElement>,\n): AvatarGroupItemState => {\n const nonOverflowAvatarsCount = useContextSelector(AvatarGroupContext, ctx => ctx.nonOverflowAvatarsCount);\n const groupIsOverflow = useContextSelector(AvatarGroupContext, ctx => ctx.isOverflow);\n const layout = useContextSelector(AvatarGroupContext, ctx => ctx.layout);\n const groupSize = useContextSelector(AvatarGroupContext, ctx => ctx.size);\n // Since the primary slot is not an intrinsic element, getPartitionedNativeProps cannot be used here.\n const { style, className, ...avatarSlotProps } = props;\n const size = groupSize ?? defaultAvatarGroupSize;\n const hasAvatarGroupContext = useHasParentContext(AvatarGroupContext);\n\n if (process.env.NODE_ENV !== 'production' && !hasAvatarGroupContext) {\n // eslint-disable-next-line no-console\n console.warn('AvatarGroupItem must only be used inside an AvatarGroup component.');\n }\n\n return {\n nonOverflowAvatarsCount: nonOverflowAvatarsCount ?? 1,\n layout,\n size,\n isOverflowItem: groupIsOverflow,\n components: {\n root: 'div',\n avatar: Avatar,\n overflowLabel: 'span',\n },\n root: resolveShorthand(props.root, {\n required: true,\n defaultProps: {\n style,\n className,\n role: groupIsOverflow ? 'listitem' : undefined,\n },\n }),\n avatar: resolveShorthand(props.avatar, {\n required: true,\n defaultProps: {\n ref,\n size,\n color: 'colorful',\n ...avatarSlotProps,\n },\n }),\n overflowLabel: resolveShorthand(props.overflowLabel, {\n required: true,\n defaultProps: {\n children: props.name,\n },\n }),\n };\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import { useSizeStyles } from '../../Avatar';
|
|
2
|
+
import { __styles, mergeClasses, shorthands } from '@griffel/react';
|
|
3
|
+
import { tokens, typographyStyles } from '@fluentui/react-theme';
|
|
4
|
+
export const avatarGroupItemClassNames = {
|
|
5
|
+
root: 'fui-AvatarGroupItem',
|
|
6
|
+
avatar: 'fui-AvatarGroupItem__avatar',
|
|
7
|
+
overflowLabel: 'fui-AvatarGroupItem__overflowLabel'
|
|
8
|
+
};
|
|
9
|
+
const avatarGroupItemDividerWidthVar = '--fuiAvatarGroupItem__divier--width';
|
|
10
|
+
/**
|
|
11
|
+
* Styles for the root slot
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const useRootStyles = /*#__PURE__*/__styles({
|
|
15
|
+
"base": {
|
|
16
|
+
"Bt984gj": "f122n59",
|
|
17
|
+
"mc9l5x": "ftuwxu6",
|
|
18
|
+
"Bnnss6s": "fi64zpg",
|
|
19
|
+
"qhf8xq": "f10pi13n"
|
|
20
|
+
},
|
|
21
|
+
"overflowItem": {
|
|
22
|
+
"z8tnut": "f1ywm7hm",
|
|
23
|
+
"z189sj": ["f7x41pl", "fruq291"],
|
|
24
|
+
"Byoj8tv": "f14wxoun",
|
|
25
|
+
"uwmqm3": ["fruq291", "f7x41pl"]
|
|
26
|
+
},
|
|
27
|
+
"nonOverflowItem": {
|
|
28
|
+
"Bbmb7ep": ["f8fbkgy", "f1nfllo7"],
|
|
29
|
+
"Beyfa6y": ["f1nfllo7", "f8fbkgy"],
|
|
30
|
+
"B7oj6ja": ["f1djnp8u", "f1s8kh49"],
|
|
31
|
+
"Btl43ni": ["f1s8kh49", "f1djnp8u"]
|
|
32
|
+
}
|
|
33
|
+
}, {
|
|
34
|
+
"d": [".f122n59{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}", ".ftuwxu6{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}", ".fi64zpg{-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;}", ".f10pi13n{position:relative;}", ".f1ywm7hm{padding-top:var(--spacingVerticalXS);}", ".f7x41pl{padding-right:var(--spacingHorizontalXS);}", ".fruq291{padding-left:var(--spacingHorizontalXS);}", ".f14wxoun{padding-bottom:var(--spacingVerticalXS);}", ".f8fbkgy{border-bottom-right-radius:var(--borderRadiusCircular);}", ".f1nfllo7{border-bottom-left-radius:var(--borderRadiusCircular);}", ".f1djnp8u{border-top-right-radius:var(--borderRadiusCircular);}", ".f1s8kh49{border-top-left-radius:var(--borderRadiusCircular);}"]
|
|
35
|
+
});
|
|
36
|
+
/**
|
|
37
|
+
* Styles for the avatar slot
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
const useAvatarStyles = /*#__PURE__*/__styles({
|
|
42
|
+
"nonOverflowItem": {
|
|
43
|
+
"qhf8xq": "f1euv43f"
|
|
44
|
+
},
|
|
45
|
+
"pie": {
|
|
46
|
+
"Bbmb7ep": ["f1krrbdw", "f1deotkl"],
|
|
47
|
+
"Beyfa6y": ["f1deotkl", "f1krrbdw"],
|
|
48
|
+
"B7oj6ja": ["f10ostut", "f1ozlkrg"],
|
|
49
|
+
"Btl43ni": ["f1ozlkrg", "f10ostut"]
|
|
50
|
+
}
|
|
51
|
+
}, {
|
|
52
|
+
"d": [".f1euv43f{position:absolute;}", ".f1krrbdw{border-bottom-right-radius:0;}", ".f1deotkl{border-bottom-left-radius:0;}", ".f10ostut{border-top-right-radius:0;}", ".f1ozlkrg{border-top-left-radius:0;}"]
|
|
53
|
+
});
|
|
54
|
+
/**
|
|
55
|
+
* Styles for the label slot
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
const useOverflowLabelStyles = /*#__PURE__*/__styles({
|
|
60
|
+
"base": {
|
|
61
|
+
"Frg6f3": ["foyynoy", "f1vcna3q"],
|
|
62
|
+
"sj55zd": "f19n0e5",
|
|
63
|
+
"Bahqtrf": "fk6fouc",
|
|
64
|
+
"Be2twd7": "fkhj508",
|
|
65
|
+
"Bhrd7zp": "figsok6",
|
|
66
|
+
"Bg96gwp": "f1i3iumi"
|
|
67
|
+
}
|
|
68
|
+
}, {
|
|
69
|
+
"d": [".foyynoy{margin-left:var(--spacingHorizontalS);}", ".f1vcna3q{margin-right:var(--spacingHorizontalS);}", ".f19n0e5{color:var(--colorNeutralForeground1);}", ".fk6fouc{font-family:var(--fontFamilyBase);}", ".fkhj508{font-size:var(--fontSizeBase300);}", ".figsok6{font-weight:var(--fontWeightRegular);}", ".f1i3iumi{line-height:var(--lineHeightBase300);}"]
|
|
70
|
+
});
|
|
71
|
+
/**
|
|
72
|
+
* Styles for the pie layout
|
|
73
|
+
*/
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
const usePieStyles = /*#__PURE__*/__styles({
|
|
77
|
+
"base": {
|
|
78
|
+
"qhf8xq": "f1euv43f"
|
|
79
|
+
},
|
|
80
|
+
"twoSlices": {
|
|
81
|
+
"way436": "f1mfxe7f",
|
|
82
|
+
"Bqy7o86": ["f1c18q0d", "fojsu5g"],
|
|
83
|
+
"Hjso5x": "f1oifxvu",
|
|
84
|
+
"B73oaz0": ["fqdbg8w", "fzmpboy"]
|
|
85
|
+
},
|
|
86
|
+
"threeSlices": {
|
|
87
|
+
"way436": "f1mfxe7f",
|
|
88
|
+
"Bqy7o86": ["f1c18q0d", "fojsu5g"],
|
|
89
|
+
"B4jwau3": "f1ifdbou",
|
|
90
|
+
"d8ohzp": ["f137bn9p", "ffwkz12"],
|
|
91
|
+
"B395mff": "fkr8g3j",
|
|
92
|
+
"Bqzfac6": "f1l8nhah",
|
|
93
|
+
"tv7yr1": "f7qglgr",
|
|
94
|
+
"Bo30zgl": "flj7kkj"
|
|
95
|
+
},
|
|
96
|
+
"thick": {
|
|
97
|
+
"Bw9cqsg": "f1hcqiyb"
|
|
98
|
+
},
|
|
99
|
+
"thicker": {
|
|
100
|
+
"Bw9cqsg": "f3scl8u"
|
|
101
|
+
},
|
|
102
|
+
"thickest": {
|
|
103
|
+
"Bw9cqsg": "f46m186"
|
|
104
|
+
}
|
|
105
|
+
}, {
|
|
106
|
+
"d": [".f1euv43f{position:absolute;}", ".f1mfxe7f:first-child{-webkit-clip-path:inset(0 calc(25% + (var(--fuiAvatarGroupItem__divier--width) / 2)) 0 25%);clip-path:inset(0 calc(25% + (var(--fuiAvatarGroupItem__divier--width) / 2)) 0 25%);}", ".f1c18q0d:first-child{left:-25%;}", ".fojsu5g:first-child{right:-25%;}", ".f1oifxvu:nth-child(2){-webkit-clip-path:inset(0 25% 0 calc(25% + (var(--fuiAvatarGroupItem__divier--width) / 2)));clip-path:inset(0 25% 0 calc(25% + (var(--fuiAvatarGroupItem__divier--width) / 2)));}", ".fqdbg8w:nth-child(2){left:25%;}", ".fzmpboy:nth-child(2){right:25%;}", ".f1ifdbou:not(:first-child){-webkit-clip-path:inset(0 0 var(--fuiAvatarGroupItem__divier--width) var(--fuiAvatarGroupItem__divier--width));clip-path:inset(0 0 var(--fuiAvatarGroupItem__divier--width) var(--fuiAvatarGroupItem__divier--width));}", ".f137bn9p:not(:first-child){left:50%;}", ".ffwkz12:not(:first-child){right:50%;}", ".fkr8g3j:not(:first-child){-webkit-transform:scale(0.5);-moz-transform:scale(0.5);-ms-transform:scale(0.5);transform:scale(0.5);}", ".f1l8nhah:not(:first-child){transform-origin:0 0;}", ".f7qglgr:nth-child(3){-webkit-clip-path:inset(var(--fuiAvatarGroupItem__divier--width) 0 0 var(--fuiAvatarGroupItem__divier--width));clip-path:inset(var(--fuiAvatarGroupItem__divier--width) 0 0 var(--fuiAvatarGroupItem__divier--width));}", ".flj7kkj:nth-child(3){top:50%;}", ".f1hcqiyb{--fuiAvatarGroupItem__divier--width:var(--strokeWidthThick);}", ".f3scl8u{--fuiAvatarGroupItem__divier--width:var(--strokeWidthThicker);}", ".f46m186{--fuiAvatarGroupItem__divier--width:var(--strokeWidthThickest);}"]
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
const useStackStyles = /*#__PURE__*/__styles({
|
|
110
|
+
"base": {
|
|
111
|
+
"Bsft5z2": "f1iwjod4",
|
|
112
|
+
"E3zdtr": "f1mdlcz9",
|
|
113
|
+
"ap17g6": "f15zbnnk",
|
|
114
|
+
"B0n5ga8": "f1de97fc",
|
|
115
|
+
"s924m2": ["fnkdar3", "f1rue1y9"],
|
|
116
|
+
"B1q35kw": "f6bjq4p",
|
|
117
|
+
"Gp14am": ["f1rue1y9", "fnkdar3"],
|
|
118
|
+
"B3778ie": ["fprarqb", "f14vs0nd"],
|
|
119
|
+
"d9w3h3": ["f14vs0nd", "fprarqb"],
|
|
120
|
+
"Bl18szs": ["f1gtfqs9", "f18zvfd9"],
|
|
121
|
+
"B4j8arr": ["f18zvfd9", "f1gtfqs9"],
|
|
122
|
+
"Bm2nyyq": "f8rth92",
|
|
123
|
+
"Barhvk9": ["flthirb", "ftkbnf5"],
|
|
124
|
+
"Bw17bha": "f1lh990p",
|
|
125
|
+
"vfts7": ["ftkbnf5", "flthirb"],
|
|
126
|
+
"qx5q1e": "f1dpauah"
|
|
127
|
+
},
|
|
128
|
+
"overflowButton": {
|
|
129
|
+
"Bc0dv0h": "f1o149bd",
|
|
130
|
+
"Bt0nq95": ["f1xgvrhv", "f34pcxu"],
|
|
131
|
+
"Bte176d": "f9nu0bd",
|
|
132
|
+
"Buo7p3s": ["f34pcxu", "f1xgvrhv"],
|
|
133
|
+
"Bjwas2f": "f14pvji2",
|
|
134
|
+
"Bn1d65q": ["f1xeojaw", "f1hodmrf"],
|
|
135
|
+
"Bxeuatn": "fcbbwn3",
|
|
136
|
+
"n51gp8": ["f1hodmrf", "f1xeojaw"]
|
|
137
|
+
},
|
|
138
|
+
"thick": {
|
|
139
|
+
"a2br6o": "fiy03ts",
|
|
140
|
+
"Dlnsje": "f5o33kw",
|
|
141
|
+
"Eqx8gd": ["f5kz84h", "f8jassg"],
|
|
142
|
+
"bn5sak": "f1oigyhu",
|
|
143
|
+
"xrcqlc": "fozawe0",
|
|
144
|
+
"Ihftqj": ["f15gmigz", "f11o3tup"],
|
|
145
|
+
"Bcgy8vk": "f14pi962",
|
|
146
|
+
"Bhxzhr1": ["f11o3tup", "f15gmigz"]
|
|
147
|
+
},
|
|
148
|
+
"thicker": {
|
|
149
|
+
"a2br6o": "fiy03ts",
|
|
150
|
+
"Dlnsje": "f5o33kw",
|
|
151
|
+
"Eqx8gd": ["f1f2c3j3", "f1g5d141"],
|
|
152
|
+
"bn5sak": "f1vvl5ts",
|
|
153
|
+
"xrcqlc": "f1gbh4dy",
|
|
154
|
+
"Ihftqj": ["f1os6oqe", "f4y7ea8"],
|
|
155
|
+
"Bcgy8vk": "f1a3lyng",
|
|
156
|
+
"Bhxzhr1": ["f4y7ea8", "f1os6oqe"]
|
|
157
|
+
},
|
|
158
|
+
"thickest": {
|
|
159
|
+
"a2br6o": "fiy03ts",
|
|
160
|
+
"Dlnsje": "f5o33kw",
|
|
161
|
+
"Eqx8gd": ["fueot05", "f1mir6xb"],
|
|
162
|
+
"bn5sak": "f1izs6vq",
|
|
163
|
+
"xrcqlc": "f15ae8rs",
|
|
164
|
+
"Ihftqj": ["f1c7xjog", "fn35eni"],
|
|
165
|
+
"Bcgy8vk": "f9v1pvc",
|
|
166
|
+
"Bhxzhr1": ["fn35eni", "f1c7xjog"]
|
|
167
|
+
},
|
|
168
|
+
"borderThin": {
|
|
169
|
+
"a2br6o": "fe2wxzu",
|
|
170
|
+
"Dlnsje": "fcr18t3",
|
|
171
|
+
"Eqx8gd": ["fhjhgwu", "fh9v7u1"],
|
|
172
|
+
"bn5sak": "f1mqssek"
|
|
173
|
+
},
|
|
174
|
+
"borderThick": {
|
|
175
|
+
"a2br6o": "f19rfb2x",
|
|
176
|
+
"Dlnsje": "fk4cr37",
|
|
177
|
+
"Eqx8gd": ["foc71j7", "f1xoeo06"],
|
|
178
|
+
"bn5sak": "fd6iyyb"
|
|
179
|
+
},
|
|
180
|
+
"borderThicker": {
|
|
181
|
+
"a2br6o": "f1byqz6t",
|
|
182
|
+
"Dlnsje": "fdqxnrd",
|
|
183
|
+
"Eqx8gd": ["f1x8rm7i", "ftx9300"],
|
|
184
|
+
"bn5sak": "f13zu3lb"
|
|
185
|
+
},
|
|
186
|
+
"borderThickest": {
|
|
187
|
+
"a2br6o": "f1i9snzy",
|
|
188
|
+
"Dlnsje": "f19z50l7",
|
|
189
|
+
"Eqx8gd": ["f1fgc9m6", "f1d4bgoy"],
|
|
190
|
+
"bn5sak": "fkll7mr"
|
|
191
|
+
},
|
|
192
|
+
"xxs": {
|
|
193
|
+
"jhia2w": ["f1cjco14", "f13dxjc9"]
|
|
194
|
+
},
|
|
195
|
+
"xs": {
|
|
196
|
+
"jhia2w": ["f15p6bln", "f1bab3ru"]
|
|
197
|
+
},
|
|
198
|
+
"s": {
|
|
199
|
+
"jhia2w": ["f1v53ncc", "f17pu8r8"]
|
|
200
|
+
},
|
|
201
|
+
"l": {
|
|
202
|
+
"jhia2w": ["flv48ch", "fnh1ydj"]
|
|
203
|
+
}
|
|
204
|
+
}, {
|
|
205
|
+
"d": [".f1iwjod4::after{content:'';}", ".f1mdlcz9::after{position:absolute;}", ".f15zbnnk::after{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}", ".f1de97fc::after{border-top-color:var(--colorNeutralBackground2);}", ".fnkdar3::after{border-right-color:var(--colorNeutralBackground2);}", ".f1rue1y9::after{border-left-color:var(--colorNeutralBackground2);}", ".f6bjq4p::after{border-bottom-color:var(--colorNeutralBackground2);}", ".fprarqb::after{border-bottom-right-radius:var(--borderRadiusCircular);}", ".f14vs0nd::after{border-bottom-left-radius:var(--borderRadiusCircular);}", ".f1gtfqs9::after{border-top-right-radius:var(--borderRadiusCircular);}", ".f18zvfd9::after{border-top-left-radius:var(--borderRadiusCircular);}", ".f8rth92::after{border-top-style:solid;}", ".flthirb::after{border-right-style:solid;}", ".ftkbnf5::after{border-left-style:solid;}", ".f1lh990p::after{border-bottom-style:solid;}", ".fiy03ts::after{width:100%;}", ".f5o33kw::after{height:100%;}", ".f5kz84h::after{left:calc(-1 * var(--strokeWidthThick));}", ".f8jassg::after{right:calc(-1 * var(--strokeWidthThick));}", ".f1oigyhu::after{top:calc(-1 * var(--strokeWidthThick));}", ".fozawe0::after{border-top-width:var(--strokeWidthThick);}", ".f15gmigz::after{border-right-width:var(--strokeWidthThick);}", ".f11o3tup::after{border-left-width:var(--strokeWidthThick);}", ".f14pi962::after{border-bottom-width:var(--strokeWidthThick);}", ".f1f2c3j3::after{left:calc(-1 * var(--strokeWidthThicker));}", ".f1g5d141::after{right:calc(-1 * var(--strokeWidthThicker));}", ".f1vvl5ts::after{top:calc(-1 * var(--strokeWidthThicker));}", ".f1gbh4dy::after{border-top-width:var(--strokeWidthThicker);}", ".f1os6oqe::after{border-right-width:var(--strokeWidthThicker);}", ".f4y7ea8::after{border-left-width:var(--strokeWidthThicker);}", ".f1a3lyng::after{border-bottom-width:var(--strokeWidthThicker);}", ".fueot05::after{left:calc(-1 * var(--strokeWidthThickest));}", ".f1mir6xb::after{right:calc(-1 * var(--strokeWidthThickest));}", ".f1izs6vq::after{top:calc(-1 * var(--strokeWidthThickest));}", ".f15ae8rs::after{border-top-width:var(--strokeWidthThickest);}", ".f1c7xjog::after{border-right-width:var(--strokeWidthThickest);}", ".fn35eni::after{border-left-width:var(--strokeWidthThickest);}", ".f9v1pvc::after{border-bottom-width:var(--strokeWidthThickest);}", ".fe2wxzu::after{width:calc(100% + var(--strokeWidthThin) * 2);}", ".fcr18t3::after{height:calc(100% + var(--strokeWidthThin) * 2);}", ".fhjhgwu::after{left:calc(-1 * (var(--strokeWidthThick) + var(--strokeWidthThin)));}", ".fh9v7u1::after{right:calc(-1 * (var(--strokeWidthThick) + var(--strokeWidthThin)));}", ".f1mqssek::after{top:calc(-1 * (var(--strokeWidthThick) + var(--strokeWidthThin)));}", ".f19rfb2x::after{width:calc(100% + var(--strokeWidthThick) * 2);}", ".fk4cr37::after{height:calc(100% + var(--strokeWidthThick) * 2);}", ".foc71j7::after{left:calc(-1 * var(--strokeWidthThick) * 2);}", ".f1xoeo06::after{right:calc(-1 * var(--strokeWidthThick) * 2);}", ".fd6iyyb::after{top:calc(-1 * var(--strokeWidthThick) * 2);}", ".f1byqz6t::after{width:calc(100% + var(--strokeWidthThicker) * 2);}", ".fdqxnrd::after{height:calc(100% + var(--strokeWidthThicker) * 2);}", ".f1x8rm7i::after{left:calc(-1 * var(--strokeWidthThicker) * 2);}", ".ftx9300::after{right:calc(-1 * var(--strokeWidthThicker) * 2);}", ".f13zu3lb::after{top:calc(-1 * var(--strokeWidthThicker) * 2);}", ".f1i9snzy::after{width:calc(100% + var(--strokeWidthThickest) * 2);}", ".f19z50l7::after{height:calc(100% + var(--strokeWidthThickest) * 2);}", ".f1fgc9m6::after{left:calc(-1 * var(--strokeWidthThickest) * 2);}", ".f1d4bgoy::after{right:calc(-1 * var(--strokeWidthThickest) * 2);}", ".fkll7mr::after{top:calc(-1 * var(--strokeWidthThickest) * 2);}", ".f1cjco14:not(:first-child){margin-left:calc(-1 * var(--spacingHorizontalXXS));}", ".f13dxjc9:not(:first-child){margin-right:calc(-1 * var(--spacingHorizontalXXS));}", ".f15p6bln:not(:first-child){margin-left:calc(-1 * var(--spacingHorizontalXS));}", ".f1bab3ru:not(:first-child){margin-right:calc(-1 * var(--spacingHorizontalXS));}", ".f1v53ncc:not(:first-child){margin-left:calc(-1 * var(--spacingHorizontalS));}", ".f17pu8r8:not(:first-child){margin-right:calc(-1 * var(--spacingHorizontalS));}", ".flv48ch:not(:first-child){margin-left:calc(-1 * var(--spacingHorizontalL));}", ".fnh1ydj:not(:first-child){margin-right:calc(-1 * var(--spacingHorizontalL));}"],
|
|
206
|
+
"m": [["@media (forced-colors: active){.f1dpauah::after{forced-color-adjust:none;}}", {
|
|
207
|
+
"m": "(forced-colors: active)"
|
|
208
|
+
}], ["@media (forced-colors: active){.f14pvji2{border-top-color:Canvas;}}", {
|
|
209
|
+
"m": "(forced-colors: active)"
|
|
210
|
+
}], ["@media (forced-colors: active){.f1xeojaw{border-right-color:Canvas;}.f1hodmrf{border-left-color:Canvas;}}", {
|
|
211
|
+
"m": "(forced-colors: active)"
|
|
212
|
+
}], ["@media (forced-colors: active){.fcbbwn3{border-bottom-color:Canvas;}}", {
|
|
213
|
+
"m": "(forced-colors: active)"
|
|
214
|
+
}], ["@media (forced-colors: active){.f1hodmrf{border-left-color:Canvas;}.f1xeojaw{border-right-color:Canvas;}}", {
|
|
215
|
+
"m": "(forced-colors: active)"
|
|
216
|
+
}]],
|
|
217
|
+
"f": [".f1o149bd:focus::after{border-top-color:transparent;}", ".f1xgvrhv:focus::after{border-right-color:transparent;}", ".f34pcxu:focus::after{border-left-color:transparent;}", ".f9nu0bd:focus::after{border-bottom-color:transparent;}"]
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
const useSpreadStyles = /*#__PURE__*/__styles({
|
|
221
|
+
"s": {
|
|
222
|
+
"jhia2w": ["f7lhxv7", "f6ou2b0"]
|
|
223
|
+
},
|
|
224
|
+
"mNudge": {
|
|
225
|
+
"jhia2w": ["f1h0okno", "fnnqava"]
|
|
226
|
+
},
|
|
227
|
+
"m": {
|
|
228
|
+
"jhia2w": ["f1wkt588", "f1maio5g"]
|
|
229
|
+
},
|
|
230
|
+
"l": {
|
|
231
|
+
"jhia2w": ["f1l333zn", "f1r41m4c"]
|
|
232
|
+
},
|
|
233
|
+
"xl": {
|
|
234
|
+
"jhia2w": ["fahr13a", "f2n7rbo"]
|
|
235
|
+
}
|
|
236
|
+
}, {
|
|
237
|
+
"d": [".f7lhxv7:not(:first-child){margin-left:var(--spacingHorizontalS);}", ".f6ou2b0:not(:first-child){margin-right:var(--spacingHorizontalS);}", ".f1h0okno:not(:first-child){margin-left:var(--spacingHorizontalMNudge);}", ".fnnqava:not(:first-child){margin-right:var(--spacingHorizontalMNudge);}", ".f1wkt588:not(:first-child){margin-left:var(--spacingHorizontalM);}", ".f1maio5g:not(:first-child){margin-right:var(--spacingHorizontalM);}", ".f1l333zn:not(:first-child){margin-left:var(--spacingHorizontalL);}", ".f1r41m4c:not(:first-child){margin-right:var(--spacingHorizontalL);}", ".fahr13a:not(:first-child){margin-left:var(--spacingHorizontalXL);}", ".f2n7rbo:not(:first-child){margin-right:var(--spacingHorizontalXL);}"]
|
|
238
|
+
});
|
|
239
|
+
/**
|
|
240
|
+
* Apply styling to the AvatarGroupItem slots based on the state
|
|
241
|
+
*/
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
export const useAvatarGroupItemStyles_unstable = state => {
|
|
245
|
+
const {
|
|
246
|
+
nonOverflowAvatarsCount,
|
|
247
|
+
isOverflowItem,
|
|
248
|
+
layout,
|
|
249
|
+
size
|
|
250
|
+
} = state;
|
|
251
|
+
const rootStyles = useRootStyles();
|
|
252
|
+
const pieStyles = usePieStyles();
|
|
253
|
+
const sizeStyles = useSizeStyles();
|
|
254
|
+
const overflowLabelStyles = useOverflowLabelStyles();
|
|
255
|
+
const avatarStyles = useAvatarStyles();
|
|
256
|
+
const groupChildClassName = useGroupChildClassName(layout, size);
|
|
257
|
+
const rootClasses = [rootStyles.base];
|
|
258
|
+
|
|
259
|
+
if (!isOverflowItem) {
|
|
260
|
+
rootClasses.push(rootStyles.nonOverflowItem);
|
|
261
|
+
rootClasses.push(groupChildClassName);
|
|
262
|
+
rootClasses.push(sizeStyles[size]);
|
|
263
|
+
|
|
264
|
+
if (layout === 'pie') {
|
|
265
|
+
rootClasses.push(pieStyles.base);
|
|
266
|
+
|
|
267
|
+
if (size < 56) {
|
|
268
|
+
rootClasses.push(pieStyles.thick);
|
|
269
|
+
} else if (size < 72) {
|
|
270
|
+
rootClasses.push(pieStyles.thicker);
|
|
271
|
+
} else {
|
|
272
|
+
rootClasses.push(pieStyles.thickest);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
if (nonOverflowAvatarsCount === 2) {
|
|
276
|
+
rootClasses.push(pieStyles.twoSlices);
|
|
277
|
+
} else if (nonOverflowAvatarsCount === 3) {
|
|
278
|
+
rootClasses.push(pieStyles.threeSlices);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
} else {
|
|
282
|
+
rootClasses.push(rootStyles.overflowItem);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
state.root.className = mergeClasses(avatarGroupItemClassNames.root, ...rootClasses, state.root.className);
|
|
286
|
+
state.avatar.className = mergeClasses(avatarGroupItemClassNames.avatar, !isOverflowItem && avatarStyles.nonOverflowItem, !isOverflowItem && layout === 'pie' && avatarStyles.pie, state.avatar.className);
|
|
287
|
+
|
|
288
|
+
if (state.overflowLabel) {
|
|
289
|
+
state.overflowLabel.className = mergeClasses(avatarGroupItemClassNames.overflowLabel, overflowLabelStyles.base, state.overflowLabel.className);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
return state;
|
|
293
|
+
};
|
|
294
|
+
/**
|
|
295
|
+
* Hook for getting the className for the children of AvatarGroup. This hook will provide the spacing and outlines
|
|
296
|
+
* needed for each layout.
|
|
297
|
+
*/
|
|
298
|
+
|
|
299
|
+
export const useGroupChildClassName = (layout, size, isOverflowButton) => {
|
|
300
|
+
const stackStyles = useStackStyles();
|
|
301
|
+
const spreadStyles = useSpreadStyles();
|
|
302
|
+
const layoutClasses = [];
|
|
303
|
+
|
|
304
|
+
if (size) {
|
|
305
|
+
if (layout === 'stack') {
|
|
306
|
+
layoutClasses.push(stackStyles.base);
|
|
307
|
+
|
|
308
|
+
if (size < 56) {
|
|
309
|
+
layoutClasses.push(stackStyles.thick);
|
|
310
|
+
} else if (size < 72) {
|
|
311
|
+
layoutClasses.push(stackStyles.thicker);
|
|
312
|
+
} else {
|
|
313
|
+
layoutClasses.push(stackStyles.thickest);
|
|
314
|
+
} // When the child is an overflowButton, we have to calculate the overflowButton's border + width + outline width
|
|
315
|
+
// since the ::after pseudo-element doesn't take the overflowButton's border for its size.
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
if (isOverflowButton) {
|
|
319
|
+
layoutClasses.push(stackStyles.overflowButton);
|
|
320
|
+
|
|
321
|
+
if (size < 36) {
|
|
322
|
+
layoutClasses.push(stackStyles.borderThin);
|
|
323
|
+
} else if (size < 56) {
|
|
324
|
+
layoutClasses.push(stackStyles.borderThick);
|
|
325
|
+
} else if (size < 72) {
|
|
326
|
+
layoutClasses.push(stackStyles.borderThicker);
|
|
327
|
+
} else {
|
|
328
|
+
layoutClasses.push(stackStyles.borderThickest);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
if (size < 24) {
|
|
333
|
+
layoutClasses.push(stackStyles.xxs);
|
|
334
|
+
} else if (size < 48) {
|
|
335
|
+
layoutClasses.push(stackStyles.xs);
|
|
336
|
+
} else if (size < 96) {
|
|
337
|
+
layoutClasses.push(stackStyles.s);
|
|
338
|
+
} else {
|
|
339
|
+
layoutClasses.push(stackStyles.l);
|
|
340
|
+
}
|
|
341
|
+
} else if (layout === 'spread') {
|
|
342
|
+
if (size < 20) {
|
|
343
|
+
layoutClasses.push(spreadStyles.s);
|
|
344
|
+
} else if (size < 32) {
|
|
345
|
+
layoutClasses.push(spreadStyles.mNudge);
|
|
346
|
+
} else if (size < 64) {
|
|
347
|
+
layoutClasses.push(spreadStyles.l);
|
|
348
|
+
} else {
|
|
349
|
+
layoutClasses.push(spreadStyles.xl);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
return mergeClasses(...layoutClasses);
|
|
355
|
+
};
|
|
356
|
+
//# sourceMappingURL=useAvatarGroupItemStyles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/AvatarGroupItem/useAvatarGroupItemStyles.ts"],"names":[],"mappings":"AAAA,SAAS,aAAT,QAA8B,cAA9B;AACA,mBAAqB,YAArB,EAAmC,UAAnC,QAAqD,gBAArD;AACA,SAAS,MAAT,EAAiB,gBAAjB,QAAyC,uBAAzC;AAMA,OAAO,MAAM,yBAAyB,GAAyC;EAC7E,IAAI,EAAE,qBADuE;EAE7E,MAAM,EAAE,6BAFqE;EAG7E,aAAa,EAAE;AAH8D,CAAxE;AAMP,MAAM,8BAA8B,GAAG,qCAAvC;AAEA;;AAEG;;AACH,MAAM,aAAa,gBAAG;EAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAAtB;AAeA;;AAEG;;;AACH,MAAM,eAAe,gBAAG;EAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAAxB;AASA;;AAEG;;;AACH,MAAM,sBAAsB,gBAA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EAAX,EAAe;UACb,aAAa,CAAC,IAAd,CAAmB,WAAW,CAAC,UAA/B;QACD,CAFD,MAEO,IAAI,IAAI,GAAG,EAAX,EAAe;UACpB,aAAa,CAAC,IAAd,CAAmB,WAAW,CAAC,WAA/B;QACD,CAFM,MAEA,IAAI,IAAI,GAAG,EAAX,EAAe;UACpB,aAAa,CAAC,IAAd,CAAmB,WAAW,CAAC,aAA/B;QACD,CAFM,MAEA;UACL,aAAa,CAAC,IAAd,CAAmB,WAAW,CAAC,cAA/B;QACD;MACF;;MAED,IAAI,IAAI,GAAG,EAAX,EAAe;QACb,aAAa,CAAC,IAAd,CAAmB,WAAW,CAAC,GAA/B;MACD,CAFD,MAEO,IAAI,IAAI,GAAG,EAAX,EAAe;QACpB,aAAa,CAAC,IAAd,CAAmB,WAAW,CAAC,EAA/B;MACD,CAFM,MAEA,IAAI,IAAI,GAAG,EAAX,EAAe;QACpB,aAAa,CAAC,IAAd,CAAmB,WAAW,CAAC,CAA/B;MACD,CAFM,MAEA;QACL,aAAa,CAAC,IAAd,CAAmB,WAAW,CAAC,CAA/B;MACD;IACF,CApCD,MAoCO,IAAI,MAAM,KAAK,QAAf,EAAyB;MAC9B,IAAI,IAAI,GAAG,EAAX,EAAe;QACb,aAAa,CAAC,IAAd,CAAmB,YAAY,CAAC,CAAhC;MACD,CAFD,MAEO,IAAI,IAAI,GAAG,EAAX,EAAe;QACpB,aAAa,CAAC,IAAd,CAAmB,YAAY,CAAC,MAAhC;MACD,CAFM,MAEA,IAAI,IAAI,GAAG,EAAX,EAAe;QACpB,aAAa,CAAC,IAAd,CAAmB,YAAY,CAAC,CAAhC;MACD,CAFM,MAEA;QACL,aAAa,CAAC,IAAd,CAAmB,YAAY,CAAC,EAAhC;MACD;IACF;EACF;;EAED,OAAO,YAAY,CAAC,GAAG,aAAJ,CAAnB;AACD,CA5DM","sourcesContent":["import { useSizeStyles } from '../../Avatar';\nimport { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nimport type { AvatarSizes } from '../../Avatar';\nimport type { AvatarGroupProps } from '../../AvatarGroup';\nimport type { AvatarGroupItemSlots, AvatarGroupItemState } from './AvatarGroupItem.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const avatarGroupItemClassNames: SlotClassNames<AvatarGroupItemSlots> = {\n root: 'fui-AvatarGroupItem',\n avatar: 'fui-AvatarGroupItem__avatar',\n overflowLabel: 'fui-AvatarGroupItem__overflowLabel',\n};\n\nconst avatarGroupItemDividerWidthVar = '--fuiAvatarGroupItem__divier--width';\n\n/**\n * Styles for the root slot\n */\nconst useRootStyles = makeStyles({\n base: {\n alignItems: 'center',\n display: 'inline-flex',\n flexShrink: 0,\n position: 'relative',\n },\n overflowItem: {\n ...shorthands.padding(tokens.spacingVerticalXS, tokens.spacingHorizontalXS),\n },\n nonOverflowItem: {\n ...shorthands.borderRadius(tokens.borderRadiusCircular),\n },\n});\n\n/**\n * Styles for the avatar slot\n */\nconst useAvatarStyles = makeStyles({\n nonOverflowItem: {\n position: 'absolute',\n },\n pie: {\n ...shorthands.borderRadius(0),\n },\n});\n\n/**\n * Styles for the label slot\n */\nconst useOverflowLabelStyles = makeStyles({\n base: {\n marginLeft: tokens.spacingHorizontalS,\n color: tokens.colorNeutralForeground1,\n ...typographyStyles.body1,\n },\n});\n\n/**\n * Styles for the pie layout\n */\nconst usePieStyles = makeStyles({\n base: {\n position: 'absolute',\n },\n twoSlices: {\n '&:first-child': {\n clipPath: `inset(0 calc(25% + (var(${avatarGroupItemDividerWidthVar}) / 2)) 0 25%)`,\n left: '-25%',\n },\n '&:nth-child(2)': {\n clipPath: `inset(0 25% 0 calc(25% + (var(${avatarGroupItemDividerWidthVar}) / 2)))`,\n left: '25%',\n },\n },\n threeSlices: {\n '&:first-child': {\n clipPath: `inset(0 calc(25% + (var(${avatarGroupItemDividerWidthVar}) / 2)) 0 25%)`,\n left: '-25%',\n },\n '&:not(:first-child)': {\n // Since the two AvatarGroupItems on the right are scaled by 0.5, the divider width should not be halved.\n clipPath: `inset(0 0 var(${avatarGroupItemDividerWidthVar}) var(${avatarGroupItemDividerWidthVar}))`,\n left: '50%',\n transform: 'scale(0.5)',\n transformOrigin: '0 0',\n },\n '&:nth-child(3)': {\n clipPath: `inset(var(${avatarGroupItemDividerWidthVar}) 0 0 var(${avatarGroupItemDividerWidthVar}))`,\n top: '50%',\n },\n },\n thick: { [avatarGroupItemDividerWidthVar]: tokens.strokeWidthThick },\n thicker: { [avatarGroupItemDividerWidthVar]: tokens.strokeWidthThicker },\n thickest: { [avatarGroupItemDividerWidthVar]: tokens.strokeWidthThickest },\n});\n\nconst useStackStyles = makeStyles({\n base: {\n '&::after': {\n content: \"''\",\n position: 'absolute',\n display: 'inline-flex',\n // Border is used instead of outline due to a bug in webkit browsers where border-radius is ignored in outline.\n ...shorthands.borderColor(tokens.colorNeutralBackground2),\n ...shorthands.borderRadius(tokens.borderRadiusCircular),\n ...shorthands.borderStyle('solid'),\n\n '@media (forced-colors: active)': {\n forcedColorAdjust: 'none',\n },\n },\n },\n overflowButton: {\n // border-color has to be set to transparent when there's focus due to the outline overlapping the focus ring.\n '&:focus': {\n '&::after': {\n ...shorthands.borderColor('transparent'),\n },\n },\n // hide inner border when using high contrast mode and use the outer (::after) to match Avatar's outline\n '@media (forced-colors: active)': {\n ...shorthands.borderColor('Canvas'),\n },\n },\n thick: {\n '&::after': {\n width: '100%',\n height: '100%',\n left: `calc(-1 * ${tokens.strokeWidthThick})`,\n top: `calc(-1 * ${tokens.strokeWidthThick})`,\n ...shorthands.borderWidth(tokens.strokeWidthThick),\n },\n },\n thicker: {\n '&::after': {\n width: '100%',\n height: '100%',\n left: `calc(-1 * ${tokens.strokeWidthThicker})`,\n top: `calc(-1 * ${tokens.strokeWidthThicker})`,\n ...shorthands.borderWidth(tokens.strokeWidthThicker),\n },\n },\n thickest: {\n '&::after': {\n width: '100%',\n height: '100%',\n left: `calc(-1 * ${tokens.strokeWidthThickest})`,\n top: `calc(-1 * ${tokens.strokeWidthThickest})`,\n ...shorthands.borderWidth(tokens.strokeWidthThickest),\n },\n },\n borderThin: {\n '&::after': {\n width: `calc(100% + ${tokens.strokeWidthThin} * 2)`,\n height: `calc(100% + ${tokens.strokeWidthThin} * 2)`,\n left: `calc(-1 * (${tokens.strokeWidthThick} + ${tokens.strokeWidthThin}))`,\n top: `calc(-1 * (${tokens.strokeWidthThick} + ${tokens.strokeWidthThin}))`,\n },\n },\n borderThick: {\n '&::after': {\n width: `calc(100% + ${tokens.strokeWidthThick} * 2)`,\n height: `calc(100% + ${tokens.strokeWidthThick} * 2)`,\n left: `calc(-1 * ${tokens.strokeWidthThick} * 2)`,\n top: `calc(-1 * ${tokens.strokeWidthThick} * 2)`,\n },\n },\n borderThicker: {\n '&::after': {\n width: `calc(100% + ${tokens.strokeWidthThicker} * 2)`,\n height: `calc(100% + ${tokens.strokeWidthThicker} * 2)`,\n left: `calc(-1 * ${tokens.strokeWidthThicker} * 2)`,\n top: `calc(-1 * ${tokens.strokeWidthThicker} * 2)`,\n },\n },\n borderThickest: {\n '&::after': {\n width: `calc(100% + ${tokens.strokeWidthThickest} * 2)`,\n height: `calc(100% + ${tokens.strokeWidthThickest} * 2)`,\n left: `calc(-1 * ${tokens.strokeWidthThickest} * 2)`,\n top: `calc(-1 * ${tokens.strokeWidthThickest} * 2)`,\n },\n },\n xxs: { '&:not(:first-child)': { marginLeft: `calc(-1 * ${tokens.spacingHorizontalXXS})` } },\n xs: { '&:not(:first-child)': { marginLeft: `calc(-1 * ${tokens.spacingHorizontalXS})` } },\n s: { '&:not(:first-child)': { marginLeft: `calc(-1 * ${tokens.spacingHorizontalS})` } },\n l: { '&:not(:first-child)': { marginLeft: `calc(-1 * ${tokens.spacingHorizontalL})` } },\n});\n\nconst useSpreadStyles = makeStyles({\n s: { '&:not(:first-child)': { marginLeft: tokens.spacingHorizontalS } },\n mNudge: { '&:not(:first-child)': { marginLeft: tokens.spacingHorizontalMNudge } },\n m: { '&:not(:first-child)': { marginLeft: tokens.spacingHorizontalM } },\n l: { '&:not(:first-child)': { marginLeft: tokens.spacingHorizontalL } },\n xl: { '&:not(:first-child)': { marginLeft: tokens.spacingHorizontalXL } },\n});\n\n/**\n * Apply styling to the AvatarGroupItem slots based on the state\n */\nexport const useAvatarGroupItemStyles_unstable = (state: AvatarGroupItemState): AvatarGroupItemState => {\n const { nonOverflowAvatarsCount, isOverflowItem, layout, size } = state;\n\n const rootStyles = useRootStyles();\n const pieStyles = usePieStyles();\n const sizeStyles = useSizeStyles();\n const overflowLabelStyles = useOverflowLabelStyles();\n const avatarStyles = useAvatarStyles();\n\n const groupChildClassName = useGroupChildClassName(layout, size);\n\n const rootClasses = [rootStyles.base];\n\n if (!isOverflowItem) {\n rootClasses.push(rootStyles.nonOverflowItem);\n rootClasses.push(groupChildClassName);\n rootClasses.push(sizeStyles[size]);\n\n if (layout === 'pie') {\n rootClasses.push(pieStyles.base);\n\n if (size < 56) {\n rootClasses.push(pieStyles.thick);\n } else if (size < 72) {\n rootClasses.push(pieStyles.thicker);\n } else {\n rootClasses.push(pieStyles.thickest);\n }\n\n if (nonOverflowAvatarsCount === 2) {\n rootClasses.push(pieStyles.twoSlices);\n } else if (nonOverflowAvatarsCount === 3) {\n rootClasses.push(pieStyles.threeSlices);\n }\n }\n } else {\n rootClasses.push(rootStyles.overflowItem);\n }\n\n state.root.className = mergeClasses(avatarGroupItemClassNames.root, ...rootClasses, state.root.className);\n\n state.avatar.className = mergeClasses(\n avatarGroupItemClassNames.avatar,\n !isOverflowItem && avatarStyles.nonOverflowItem,\n !isOverflowItem && layout === 'pie' && avatarStyles.pie,\n state.avatar.className,\n );\n\n if (state.overflowLabel) {\n state.overflowLabel.className = mergeClasses(\n avatarGroupItemClassNames.overflowLabel,\n overflowLabelStyles.base,\n state.overflowLabel.className,\n );\n }\n\n return state;\n};\n\n/**\n * Hook for getting the className for the children of AvatarGroup. This hook will provide the spacing and outlines\n * needed for each layout.\n */\nexport const useGroupChildClassName = (\n layout: AvatarGroupProps['layout'],\n size: AvatarSizes,\n isOverflowButton?: boolean,\n): string => {\n const stackStyles = useStackStyles();\n const spreadStyles = useSpreadStyles();\n const layoutClasses = [];\n\n if (size) {\n if (layout === 'stack') {\n layoutClasses.push(stackStyles.base);\n\n if (size < 56) {\n layoutClasses.push(stackStyles.thick);\n } else if (size < 72) {\n layoutClasses.push(stackStyles.thicker);\n } else {\n layoutClasses.push(stackStyles.thickest);\n }\n\n // When the child is an overflowButton, we have to calculate the overflowButton's border + width + outline width\n // since the ::after pseudo-element doesn't take the overflowButton's border for its size.\n if (isOverflowButton) {\n layoutClasses.push(stackStyles.overflowButton);\n\n if (size < 36) {\n layoutClasses.push(stackStyles.borderThin);\n } else if (size < 56) {\n layoutClasses.push(stackStyles.borderThick);\n } else if (size < 72) {\n layoutClasses.push(stackStyles.borderThicker);\n } else {\n layoutClasses.push(stackStyles.borderThickest);\n }\n }\n\n if (size < 24) {\n layoutClasses.push(stackStyles.xxs);\n } else if (size < 48) {\n layoutClasses.push(stackStyles.xs);\n } else if (size < 96) {\n layoutClasses.push(stackStyles.s);\n } else {\n layoutClasses.push(stackStyles.l);\n }\n } else if (layout === 'spread') {\n if (size < 20) {\n layoutClasses.push(spreadStyles.s);\n } else if (size < 32) {\n layoutClasses.push(spreadStyles.mNudge);\n } else if (size < 64) {\n layoutClasses.push(spreadStyles.l);\n } else {\n layoutClasses.push(spreadStyles.xl);\n }\n }\n }\n\n return mergeClasses(...layoutClasses);\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createContext } from '@fluentui/react-context-selector';
|
|
2
|
+
/**
|
|
3
|
+
* AvatarGroupContext is provided by AvatarGroup, and is consumed by Avatar to determine default values of some props.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export const AvatarGroupContext = /*#__PURE__*/createContext({});
|
|
7
|
+
//# sourceMappingURL=AvatarGroupContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["contexts/AvatarGroupContext.ts"],"names":[],"mappings":"AAAA,SAAS,aAAT,QAA8B,kCAA9B;AAIA;;AAEG;;AACH,OAAO,MAAM,kBAAkB,gBAAqC,aAAa,CAAC,EAAD,CAA1E","sourcesContent":["import { createContext } from '@fluentui/react-context-selector';\nimport type { Context } from '@fluentui/react-context-selector';\nimport type { AvatarGroupContextValue } from './AvatarGroupContext.types';\n\n/**\n * AvatarGroupContext is provided by AvatarGroup, and is consumed by Avatar to determine default values of some props.\n */\nexport const AvatarGroupContext: Context<AvatarGroupContextValue> = createContext({});\n"],"sourceRoot":"../src/"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AvatarGroupContext.types.js","sourceRoot":"../src/","sources":["contexts/AvatarGroupContext.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { AvatarGroupProps } from '../AvatarGroup';\n\nexport type AvatarGroupContextValue = Pick<AvatarGroupProps, 'size' | 'layout'> & {\n isOverflow?: boolean;\n nonOverflowAvatarsCount?: number;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["contexts/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC","sourcesContent":["export * from './AvatarGroupContext';\n"]}
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { Avatar,
|
|
2
|
-
avatarClassName, avatarClassNames, renderAvatar_unstable, useAvatarStyles_unstable, useAvatar_unstable } from './Avatar';
|
|
1
|
+
export { Avatar, avatarClassNames, renderAvatar_unstable, useAvatarStyles_unstable, useAvatar_unstable } from './Avatar';
|
|
3
2
|
export { getInitials } from './utils/index';
|
|
4
3
|
export { AvatarGroup, avatarGroupClassNames, renderAvatarGroup_unstable, useAvatarGroupStyles_unstable, useAvatarGroup_unstable } from './AvatarGroup';
|
|
4
|
+
export { AvatarGroupItem, avatarGroupItemClassNames, renderAvatarGroupItem_unstable, useAvatarGroupItemStyles_unstable, useAvatarGroupItem_unstable } from './AvatarGroupItem';
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,SACE,MADF,EAEE
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,SACE,MADF,EAEE,gBAFF,EAGE,qBAHF,EAIE,wBAJF,EAKE,kBALF,QAMO,UANP;AAQA,SAAS,WAAT,QAA4B,eAA5B;AACA,SACE,WADF,EAEE,qBAFF,EAGE,0BAHF,EAIE,6BAJF,EAKE,uBALF,QAMO,eANP;AAQA,SACE,eADF,EAEE,yBAFF,EAGE,8BAHF,EAIE,iCAJF,EAKE,2BALF,QAMO,mBANP","sourcesContent":["export {\n Avatar,\n avatarClassNames,\n renderAvatar_unstable,\n useAvatarStyles_unstable,\n useAvatar_unstable,\n} from './Avatar';\nexport type { AvatarNamedColor, AvatarProps, AvatarSlots, AvatarState, AvatarSizes } from './Avatar';\nexport { getInitials } from './utils/index';\nexport {\n AvatarGroup,\n avatarGroupClassNames,\n renderAvatarGroup_unstable,\n useAvatarGroupStyles_unstable,\n useAvatarGroup_unstable,\n} from './AvatarGroup';\nexport type { AvatarGroupProps, AvatarGroupSlots, AvatarGroupState } from './AvatarGroup';\nexport {\n AvatarGroupItem,\n avatarGroupItemClassNames,\n renderAvatarGroupItem_unstable,\n useAvatarGroupItemStyles_unstable,\n useAvatarGroupItem_unstable,\n} from './AvatarGroupItem';\nexport type { AvatarGroupItemProps, AvatarGroupItemSlots, AvatarGroupItemState } from './AvatarGroupItem';\n"],"sourceRoot":"../src/"}
|
package/lib/utils/getInitials.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["utils/getInitials.ts"],"names":[],"mappings":"AAAA;;AAEG;;AAEH;;;AAGG;AACH,MAAM,y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,WAApB,EAAZ;IACD;EACF;;EAED,IAAI,KAAK,IAAI,QAAQ,CAAC,MAAT,GAAkB,CAA/B,EAAkC;IAChC,OAAO,QAAQ,CAAC,MAAT,CAAgB,CAAhB,IAAqB,QAAQ,CAAC,MAAT,CAAgB,CAAhB,CAA5B;EACD;;EAED,OAAO,QAAP;AACD;;AAED,SAAS,kBAAT,CAA4B,WAA5B,EAA+C;EAC7C,WAAW,GAAG,WAAW,CAAC,OAAZ,CAAoB,yBAApB,EAA+C,EAA/C,CAAd;EACA,WAAW,GAAG,WAAW,CAAC,OAAZ,CAAoB,oBAApB,EAA0C,EAA1C,CAAd;EACA,WAAW,GAAG,WAAW,CAAC,OAAZ,CAAoB,0BAApB,EAAgD,GAAhD,CAAd;EACA,WAAW,GAAG,WAAW,CAAC,IAAZ,EAAd;EAEA,OAAO,WAAP;AACD;AAED;;;;;;;;;;;AAWG;;;AACH,OAAM,SAAU,WAAV,CACJ,WADI,EAEJ,KAFI,EAGJ,OAHI,EASH;EAED,IAAI,CAAC,WAAL,EAAkB;IAChB,OAAO,EAAP;EACD;;EAED,WAAW,GAAG,kBAAkB,CAAC,WAAD,CAAhC,CANC,CAQD;;EACA,IACE,sBAAsB,CAAC,IAAvB,CAA4B,WAA5B,KACC,EAAC,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,kBAAV,KAAgC,iBAAiB,CAAC,IAAlB,CAAuB,WAAvB,CAFnC,EAGE;IACA,OAAO,EAAP;EACD;;EAED,OAAO,gBAAgB,CAAC,WAAD,EAAc,KAAd,EAAqB,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,gBAA9B,CAAvB;AACD","sourcesContent":["/**\n * Regular expressions matching characters to ignore when calculating the initials.\n */\n\n/**\n * Regular expression matching characters within various types of enclosures, including the enclosures themselves\n * so for example, (xyz) [xyz] {xyz} all would be ignored\n */\nconst UNWANTED_ENCLOSURES_REGEX: RegExp = /[\\(\\[\\{][^\\)\\]\\}]*[\\)\\]\\}]/g;\n\n/**\n * Regular expression matching special ASCII characters except space, plus some unicode special characters.\n * Applies after unwanted enclosures have been removed\n */\nconst UNWANTED_CHARS_REGEX: RegExp = /[\\0-\\u001F\\!-/:-@\\[-`\\{-\\u00BF\\u0250-\\u036F\\uD800-\\uFFFF]/g;\n\n/**\n * Regular expression matching phone numbers. Applied after chars matching UNWANTED_CHARS_REGEX have been removed\n * and number has been trimmed for whitespaces\n */\nconst PHONENUMBER_REGEX: RegExp = /^\\d+[\\d\\s]*(:?ext|x|)\\s*\\d+$/i;\n\n/** Regular expression matching one or more spaces. */\nconst MULTIPLE_WHITESPACES_REGEX: RegExp = /\\s+/g;\n\n/**\n * Regular expression matching languages for which we currently don't support initials.\n * Arabic: Arabic, Arabic Supplement, Arabic Extended-A.\n * Korean: Hangul Jamo, Hangul Compatibility Jamo, Hangul Jamo Extended-A, Hangul Syllables, Hangul Jamo Extended-B.\n * Japanese: Hiragana, Katakana.\n * CJK: CJK Unified Ideographs Extension A, CJK Unified Ideographs, CJK Compatibility Ideographs,\n * CJK Unified Ideographs Extension B\n */\n// eslint-disable-next-line @fluentui/max-len\nconst UNSUPPORTED_TEXT_REGEX: RegExp = /[\\u0600-\\u06FF\\u0750-\\u077F\\u08A0-\\u08FF\\u1100-\\u11FF\\u3130-\\u318F\\uA960-\\uA97F\\uAC00-\\uD7AF\\uD7B0-\\uD7FF\\u3040-\\u309F\\u30A0-\\u30FF\\u3400-\\u4DBF\\u4E00-\\u9FFF\\uF900-\\uFAFF]|[\\uD840-\\uD869][\\uDC00-\\uDED6]/;\n\nfunction getInitialsLatin(displayName: string, isRtl: boolean, firstInitialOnly?: boolean): string {\n let initials = '';\n\n const splits: string[] = displayName.split(' ');\n if (splits.length !== 0) {\n initials += splits[0].charAt(0).toUpperCase();\n }\n\n if (!firstInitialOnly) {\n if (splits.length === 2) {\n initials += splits[1].charAt(0).toUpperCase();\n } else if (splits.length === 3) {\n initials += splits[2].charAt(0).toUpperCase();\n }\n }\n\n if (isRtl && initials.length > 1) {\n return initials.charAt(1) + initials.charAt(0);\n }\n\n return initials;\n}\n\nfunction cleanupDisplayName(displayName: string): string {\n displayName = displayName.replace(UNWANTED_ENCLOSURES_REGEX, '');\n displayName = displayName.replace(UNWANTED_CHARS_REGEX, '');\n displayName = displayName.replace(MULTIPLE_WHITESPACES_REGEX, ' ');\n displayName = displayName.trim();\n\n return displayName;\n}\n\n/**\n * Get (up to 2 characters) initials based on display name of the persona.\n *\n * @param displayName - The full name of the person or entity\n * @param isRtl - Whether the display is in RTL\n * @param options - Extra options to control the behavior of getInitials\n *\n * @returns The 1 or 2 character initials based on the name. Or an empty string if no initials\n * could be derived from the name.\n *\n * @internal\n */\nexport function getInitials(\n displayName: string | undefined | null,\n isRtl: boolean,\n options?: {\n /** Should initials be generated from phone numbers (default false) */\n allowPhoneInitials?: boolean;\n\n /** Returns only the first initial */\n firstInitialOnly?: boolean;\n },\n): string {\n if (!displayName) {\n return '';\n }\n\n displayName = cleanupDisplayName(displayName);\n\n // For names containing CJK characters, and phone numbers, we don't display initials\n if (\n UNSUPPORTED_TEXT_REGEX.test(displayName) ||\n (!options?.allowPhoneInitials && PHONENUMBER_REGEX.test(displayName))\n ) {\n return '';\n }\n\n return getInitialsLatin(displayName, isRtl, options?.firstInitialOnly);\n}\n"],"sourceRoot":"../src/"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
const tslib_1 = /*#__PURE__*/require("tslib");
|
|
8
|
+
|
|
9
|
+
tslib_1.__exportStar(require("./components/AvatarGroupItem/index"), exports);
|
|
10
|
+
//# sourceMappingURL=AvatarGroupItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["AvatarGroupItem.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,oCAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/AvatarGroupItem/index';\n"],"sourceRoot":"../src/"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/Avatar/Avatar.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,cAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,MAAA,WAAA,gBAAA,OAAA,CAAA,aAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,mBAAA,CAAA;;AAIa,OAAA,CAAA,MAAA,gBAA2C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;
|
|
1
|
+
{"version":3,"sources":["components/Avatar/Avatar.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,cAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,MAAA,WAAA,gBAAA,OAAA,CAAA,aAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,mBAAA,CAAA;;AAIa,OAAA,CAAA,MAAA,gBAA2C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EACtF,MAAM,KAAK,GAAG,WAAA,CAAA,kBAAA,CAAmB,KAAnB,EAA0B,GAA1B,CAAd;EAEA,iBAAA,CAAA,wBAAA,CAAyB,KAAzB;EAEA,OAAO,cAAA,CAAA,qBAAA,CAAsB,KAAtB,CAAP;AACD,CANuD,CAA3C;AAQb,OAAA,CAAA,MAAA,CAAO,WAAP,GAAqB,QAArB","sourcesContent":["import * as React from 'react';\nimport { renderAvatar_unstable } from './renderAvatar';\nimport { useAvatar_unstable } from './useAvatar';\nimport { useAvatarStyles_unstable } from './useAvatarStyles';\nimport type { AvatarProps } from './Avatar.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\nexport const Avatar: ForwardRefComponent<AvatarProps> = React.forwardRef((props, ref) => {\n const state = useAvatar_unstable(props, ref);\n\n useAvatarStyles_unstable(state);\n\n return renderAvatar_unstable(state);\n});\n\nAvatar.displayName = 'Avatar';\n"],"sourceRoot":"../src/"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/Avatar/renderAvatar.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAGO,MAAM,qBAAqB,GAAI,KAAD,IAAuB;
|
|
1
|
+
{"version":3,"sources":["components/Avatar/renderAvatar.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAGO,MAAM,qBAAqB,GAAI,KAAD,IAAuB;EAC1D,MAAM;IAAE,KAAF;IAAS;EAAT,IAAuB,iBAAA,CAAA,QAAA,CAAsB,KAAtB,CAA7B;EAEA,OACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;EAAf,CAAX,EACG,KAAK,CAAC,QAAN,IAAkB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,QAAP,EAAe,EAAA,GAAK,SAAS,CAAC;EAAf,CAAf,CADrB,EAEG,KAAK,CAAC,IAAN,IAAc,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;EAAf,CAAX,CAFjB,EAGG,KAAK,CAAC,KAAN,IAAe,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,KAAP,EAAY,EAAA,GAAK,SAAS,CAAC;EAAf,CAAZ,CAHlB,EAIG,KAAK,CAAC,KAAN,IAAe,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,KAAP,EAAY,EAAA,GAAK,SAAS,CAAC;EAAf,CAAZ,CAJlB,CADF;AAQD,CAXM;;AAAM,OAAA,CAAA,qBAAA,GAAqB,qBAArB","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { AvatarSlots, AvatarState } from './Avatar.types';\n\nexport const renderAvatar_unstable = (state: AvatarState) => {\n const { slots, slotProps } = getSlots<AvatarSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n {slots.initials && <slots.initials {...slotProps.initials} />}\n {slots.icon && <slots.icon {...slotProps.icon} />}\n {slots.image && <slots.image {...slotProps.image} />}\n {slots.badge && <slots.badge {...slotProps.badge} />}\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -24,7 +24,7 @@ const useAvatar_unstable = (props, ref) => {
|
|
|
24
24
|
|
|
25
25
|
const {
|
|
26
26
|
dir
|
|
27
|
-
} = react_shared_contexts_1.
|
|
27
|
+
} = react_shared_contexts_1.useFluent_unstable();
|
|
28
28
|
const {
|
|
29
29
|
name,
|
|
30
30
|
size = 32,
|
|
@@ -58,7 +58,7 @@ const useAvatar_unstable = (props, ref) => {
|
|
|
58
58
|
children: index_1.getInitials(name, dir === 'rtl', {
|
|
59
59
|
firstInitialOnly: size <= 16
|
|
60
60
|
}),
|
|
61
|
-
'
|
|
61
|
+
id: baseId + '__initials'
|
|
62
62
|
}
|
|
63
63
|
}); // Render the icon slot *only if* there aren't any initials to display.
|
|
64
64
|
|
|
@@ -70,8 +70,7 @@ const useAvatar_unstable = (props, ref) => {
|
|
|
70
70
|
required: true,
|
|
71
71
|
defaultProps: {
|
|
72
72
|
children: React.createElement(react_icons_1.PersonRegular, null),
|
|
73
|
-
'aria-hidden': true
|
|
74
|
-
id: baseId + '__initials'
|
|
73
|
+
'aria-hidden': true
|
|
75
74
|
}
|
|
76
75
|
});
|
|
77
76
|
}
|
|
@@ -97,8 +96,6 @@ const useAvatar_unstable = (props, ref) => {
|
|
|
97
96
|
const badge = react_utilities_1.resolveShorthand(props.badge, {
|
|
98
97
|
defaultProps: {
|
|
99
98
|
size: getBadgeSize(size),
|
|
100
|
-
role: 'presentation',
|
|
101
|
-
'aria-hidden': true,
|
|
102
99
|
id: baseId + '__badge'
|
|
103
100
|
}
|
|
104
101
|
}); // Resolve aria-label and/or aria-labelledby if not provided by the user
|
|
@@ -155,7 +152,7 @@ const getBadgeSize = size => {
|
|
|
155
152
|
}
|
|
156
153
|
};
|
|
157
154
|
|
|
158
|
-
const avatarColors = ['
|
|
155
|
+
const avatarColors = ['dark-red', 'cranberry', 'red', 'pumpkin', 'peach', 'marigold', 'gold', 'brass', 'brown', 'forest', 'seafoam', 'dark-green', 'light-teal', 'teal', 'steel', 'blue', 'royal-blue', 'cornflower', 'navy', 'lavender', 'purple', 'grape', 'lilac', 'pink', 'magenta', 'plum', 'beige', 'mink', 'platinum', 'anchor'];
|
|
159
156
|
|
|
160
157
|
const getHashCode = str => {
|
|
161
158
|
let hashCode = 0;
|