@fluentui/react-persona 9.1.0-beta.3 → 9.1.0-beta.5
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 +87 -1
- package/CHANGELOG.md +28 -2
- package/dist/index.d.ts +16 -8
- package/lib/Persona.js.map +1 -1
- package/lib/components/Persona/Persona.js.map +1 -1
- package/lib/components/Persona/Persona.types.js.map +1 -1
- package/lib/components/Persona/index.js.map +1 -1
- package/lib/components/Persona/renderPersona.js.map +1 -1
- package/lib/components/Persona/usePersona.js +35 -49
- package/lib/components/Persona/usePersona.js.map +1 -1
- package/lib/components/Persona/usePersonaStyles.js +104 -85
- package/lib/components/Persona/usePersonaStyles.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib-commonjs/Persona.js.map +1 -1
- package/lib-commonjs/components/Persona/Persona.js.map +1 -1
- package/lib-commonjs/components/Persona/index.js.map +1 -1
- package/lib-commonjs/components/Persona/renderPersona.js.map +1 -1
- package/lib-commonjs/components/Persona/usePersona.js +35 -49
- package/lib-commonjs/components/Persona/usePersona.js.map +1 -1
- package/lib-commonjs/components/Persona/usePersonaStyles.js +104 -85
- package/lib-commonjs/components/Persona/usePersonaStyles.js.map +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +7 -8
- package/MIGRATION.md +0 -44
- package/Spec.md +0 -213
@@ -18,25 +18,25 @@ exports.personaClassNames = {
|
|
18
18
|
tertiaryText: 'fui-Persona__tertiaryText',
|
19
19
|
quaternaryText: 'fui-Persona__quaternaryText'
|
20
20
|
};
|
21
|
+
const avatarSpacing = `--fui-Persona__avatar--spacing`;
|
21
22
|
/**
|
22
23
|
* Styles for the root slot
|
23
24
|
*/
|
24
25
|
|
25
26
|
const useStyles = /*#__PURE__*/react_1.__styles({
|
26
|
-
"
|
27
|
+
"base": {
|
27
28
|
"mc9l5x": "fwk3njj",
|
28
|
-
"t4k1zu": "f4wu0r3",
|
29
29
|
"v29qe6": "fvtn1bl"
|
30
30
|
},
|
31
31
|
"after": {
|
32
32
|
"Bxotwcr": "f1u07yai",
|
33
33
|
"B7hvi0a": "f1m2n5bn",
|
34
|
-
"
|
34
|
+
"Budl1dq": "f1c1ms5d"
|
35
35
|
},
|
36
36
|
"before": {
|
37
37
|
"Bxotwcr": "f1u07yai",
|
38
38
|
"B7hvi0a": "f1tll2w5",
|
39
|
-
"
|
39
|
+
"Budl1dq": "ffvkwdr"
|
40
40
|
},
|
41
41
|
"below": {
|
42
42
|
"B7hvi0a": "f1oiokrs"
|
@@ -44,14 +44,64 @@ const useStyles = /*#__PURE__*/react_1.__styles({
|
|
44
44
|
"coin": {
|
45
45
|
"Ijaq50": "f1hek2iy"
|
46
46
|
},
|
47
|
-
"
|
47
|
+
"start": {
|
48
48
|
"qb2dma": "f9h729m"
|
49
49
|
},
|
50
|
-
"
|
50
|
+
"center": {
|
51
51
|
"qb2dma": "f7nlbp4"
|
52
|
+
},
|
53
|
+
"afterAlignToPrimary": {
|
54
|
+
"qb2dma": "f7nlbp4",
|
55
|
+
"Ijaq50": "f1rnkkuc",
|
56
|
+
"Bw0ie65": "f1warjpf"
|
57
|
+
},
|
58
|
+
"beforeAlignToPrimary": {
|
59
|
+
"qb2dma": "f7nlbp4",
|
60
|
+
"Ijaq50": "f1rnkkuc",
|
61
|
+
"Br312pm": "fwu52yu"
|
52
62
|
}
|
53
63
|
}, {
|
54
|
-
"d": [".fwk3njj{display:inline-grid;}", ".
|
64
|
+
"d": [".fwk3njj{display:inline-grid;}", ".fvtn1bl{grid-auto-rows:max-content;}", ".f1u07yai{grid-auto-flow:column;}", ".f1m2n5bn{justify-items:start;}", ".f1c1ms5d{grid-template-columns:max-content [middle] auto;}", ".f1tll2w5{justify-items:end;}", ".ffvkwdr{grid-template-columns:auto [middle] max-content;}", ".f1oiokrs{justify-items:center;}", ".f1hek2iy{grid-row-start:span 5;}", ".f9h729m{-webkit-align-self:start;-ms-flex-item-align:start;align-self:start;}", ".f7nlbp4{-webkit-align-self:center;-ms-flex-item-align:center;align-self:center;}", ".f1rnkkuc{grid-row-start:unset;}", ".f1warjpf{grid-column-end:middle;}", ".fwu52yu{grid-column-start:middle;}"]
|
65
|
+
});
|
66
|
+
|
67
|
+
const useAvatarSpacingStyles = /*#__PURE__*/react_1.__styles({
|
68
|
+
"extra-small": {
|
69
|
+
"Bs1gm4r": "f1e48tse"
|
70
|
+
},
|
71
|
+
"small": {
|
72
|
+
"Bs1gm4r": "f18q9vkd"
|
73
|
+
},
|
74
|
+
"medium": {
|
75
|
+
"Bs1gm4r": "f18q9vkd"
|
76
|
+
},
|
77
|
+
"large": {
|
78
|
+
"Bs1gm4r": "fx34bi6"
|
79
|
+
},
|
80
|
+
"extra-large": {
|
81
|
+
"Bs1gm4r": "fx34bi6"
|
82
|
+
},
|
83
|
+
"huge": {
|
84
|
+
"Bs1gm4r": "f1o96qtm"
|
85
|
+
},
|
86
|
+
"after": {
|
87
|
+
"t21cq0": ["f103ycu4", "f1tao51"]
|
88
|
+
},
|
89
|
+
"below": {
|
90
|
+
"jrapky": "fbo7acy"
|
91
|
+
},
|
92
|
+
"before": {
|
93
|
+
"Frg6f3": ["f1tao51", "f103ycu4"]
|
94
|
+
}
|
95
|
+
}, {
|
96
|
+
"d": [".f1e48tse{--fui-Persona__avatar--spacing:var(--spacingHorizontalSNudge);}", ".f18q9vkd{--fui-Persona__avatar--spacing:var(--spacingHorizontalS);}", ".fx34bi6{--fui-Persona__avatar--spacing:var(--spacingHorizontalMNudge);}", ".f1o96qtm{--fui-Persona__avatar--spacing:var(--spacingHorizontalM);}", ".f103ycu4{margin-right:var(--fui-Persona__avatar--spacing);}", ".f1tao51{margin-left:var(--fui-Persona__avatar--spacing);}", ".fbo7acy{margin-bottom:var(--fui-Persona__avatar--spacing);}"]
|
97
|
+
});
|
98
|
+
|
99
|
+
const usePresenceSpacingStyles = /*#__PURE__*/react_1.__styles({
|
100
|
+
"small": {
|
101
|
+
"Bs1gm4r": "f1e48tse"
|
102
|
+
}
|
103
|
+
}, {
|
104
|
+
"d": [".f1e48tse{--fui-Persona__avatar--spacing:var(--spacingHorizontalSNudge);}"]
|
55
105
|
});
|
56
106
|
/**
|
57
107
|
* Apply styling to the Persona slots based on the state
|
@@ -60,22 +110,29 @@ const useStyles = /*#__PURE__*/react_1.__styles({
|
|
60
110
|
|
61
111
|
const usePersonaStyles_unstable = state => {
|
62
112
|
const {
|
63
|
-
|
113
|
+
presenceOnly,
|
114
|
+
size,
|
115
|
+
textAlignment,
|
64
116
|
textPosition
|
65
117
|
} = state;
|
66
|
-
const
|
118
|
+
const alignToPrimary = presenceOnly && textAlignment === 'start' && size !== 'extra-large' && size !== 'huge';
|
67
119
|
const {
|
68
120
|
primaryTextClassName,
|
69
121
|
optionalTextClassName
|
70
|
-
} = useTextClassNames(state);
|
71
|
-
|
122
|
+
} = useTextClassNames(state, alignToPrimary);
|
123
|
+
const styles = useStyles();
|
124
|
+
const avatarSpacingStyles = useAvatarSpacingStyles();
|
125
|
+
const presenceSpacingStyles = { ...avatarSpacingStyles,
|
126
|
+
...usePresenceSpacingStyles()
|
127
|
+
};
|
128
|
+
state.root.className = react_1.mergeClasses(exports.personaClassNames.root, styles.base, styles[textPosition], state.root.className);
|
72
129
|
|
73
130
|
if (state.avatar) {
|
74
|
-
state.avatar.className = react_1.mergeClasses(exports.personaClassNames.avatar, styles.coin,
|
131
|
+
state.avatar.className = react_1.mergeClasses(exports.personaClassNames.avatar, styles.coin, styles[textAlignment], avatarSpacingStyles[size], avatarSpacingStyles[textPosition], state.avatar.className);
|
75
132
|
}
|
76
133
|
|
77
134
|
if (state.presence) {
|
78
|
-
state.presence.className = react_1.mergeClasses(exports.personaClassNames.presence, styles.coin,
|
135
|
+
state.presence.className = react_1.mergeClasses(exports.personaClassNames.presence, styles.coin, styles[textAlignment], presenceSpacingStyles[size], presenceSpacingStyles[textPosition], textPosition === 'after' && alignToPrimary && styles.afterAlignToPrimary, textPosition === 'before' && alignToPrimary && styles.beforeAlignToPrimary, state.presence.className);
|
79
136
|
}
|
80
137
|
|
81
138
|
if (state.primaryText) {
|
@@ -109,6 +166,12 @@ const useTextStyles = /*#__PURE__*/react_1.__styles({
|
|
109
166
|
"optionalText": {
|
110
167
|
"sj55zd": "fkfq4zb"
|
111
168
|
},
|
169
|
+
"beforeAlignToPrimary": {
|
170
|
+
"Bw0ie65": "f1warjpf"
|
171
|
+
},
|
172
|
+
"afterAlignToPrimary": {
|
173
|
+
"Br312pm": "fwu52yu"
|
174
|
+
},
|
112
175
|
"body1": {
|
113
176
|
"Bahqtrf": "fk6fouc",
|
114
177
|
"Be2twd7": "fkhj508",
|
@@ -126,94 +189,50 @@ const useTextStyles = /*#__PURE__*/react_1.__styles({
|
|
126
189
|
"Be2twd7": "fod5ikn",
|
127
190
|
"Bhrd7zp": "fl43uef",
|
128
191
|
"Bg96gwp": "faaz57k"
|
129
|
-
},
|
130
|
-
"subtitle1": {
|
131
|
-
"Bahqtrf": "fk6fouc",
|
132
|
-
"Be2twd7": "f1pp30po",
|
133
|
-
"Bhrd7zp": "fl43uef",
|
134
|
-
"Bg96gwp": "f106mvju"
|
135
|
-
},
|
136
|
-
"title2": {
|
137
|
-
"Bahqtrf": "fk6fouc",
|
138
|
-
"Be2twd7": "fojgt09",
|
139
|
-
"Bhrd7zp": "fl43uef",
|
140
|
-
"Bg96gwp": "fcen8rp"
|
141
|
-
},
|
142
|
-
"title3": {
|
143
|
-
"Bahqtrf": "fk6fouc",
|
144
|
-
"Be2twd7": "f1x0m3f5",
|
145
|
-
"Bhrd7zp": "fl43uef",
|
146
|
-
"Bg96gwp": "fb86gi6"
|
147
192
|
}
|
148
193
|
}, {
|
149
|
-
"d": [".ftgm304{display:block;}", ".f19n0e5{color:var(--colorNeutralForeground1);}", ".fkfq4zb{color:var(--colorNeutralForeground2);}", ".
|
194
|
+
"d": [".ftgm304{display:block;}", ".f19n0e5{color:var(--colorNeutralForeground1);}", ".fkfq4zb{color:var(--colorNeutralForeground2);}", ".f1warjpf{grid-column-end:middle;}", ".fwu52yu{grid-column-start:middle;}", ".fk6fouc{font-family:var(--fontFamilyBase);}", ".fkhj508{font-size:var(--fontSizeBase300);}", ".figsok6{font-weight:var(--fontWeightRegular);}", ".f1i3iumi{line-height:var(--lineHeightBase300);}", ".fy9rknc{font-size:var(--fontSizeBase200);}", ".fwrc4pm{line-height:var(--lineHeightBase200);}", ".fod5ikn{font-size:var(--fontSizeBase400);}", ".fl43uef{font-weight:var(--fontWeightSemibold);}", ".faaz57k{line-height:var(--lineHeightBase400);}"]
|
150
195
|
});
|
151
196
|
|
152
|
-
const useTextClassNames = state => {
|
197
|
+
const useTextClassNames = (state, alignToPrimary) => {
|
153
198
|
const {
|
154
|
-
|
155
|
-
|
156
|
-
|
199
|
+
presenceOnly,
|
200
|
+
size,
|
201
|
+
textPosition
|
157
202
|
} = state;
|
158
203
|
const textStyles = useTextStyles();
|
159
204
|
let primaryTextSize;
|
160
|
-
let
|
161
|
-
|
162
|
-
if (
|
163
|
-
if (
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
} else if (
|
175
|
-
|
176
|
-
optionalTextSize = textStyles.caption1;
|
177
|
-
} else {
|
178
|
-
if (numTextLines > 1) {
|
179
|
-
primaryTextSize = textStyles.title3;
|
180
|
-
} else {
|
181
|
-
primaryTextSize = textStyles.title2;
|
182
|
-
}
|
183
|
-
|
184
|
-
optionalTextSize = textStyles.body1;
|
185
|
-
}
|
186
|
-
} else if (presenceOnly && state.presence) {
|
187
|
-
const {
|
188
|
-
size
|
189
|
-
} = state.presence;
|
190
|
-
|
191
|
-
if (size === 'extra-small' || size === 'tiny') {
|
192
|
-
if (numTextLines > 1) {
|
193
|
-
primaryTextSize = textStyles.body1;
|
194
|
-
} else {
|
195
|
-
primaryTextSize = textStyles.caption1;
|
196
|
-
}
|
197
|
-
|
198
|
-
optionalTextSize = textStyles.caption1;
|
199
|
-
} else {
|
200
|
-
primaryTextSize = textStyles.body1;
|
201
|
-
optionalTextSize = textStyles.caption1;
|
205
|
+
let alignToPrimaryClassName;
|
206
|
+
|
207
|
+
if (presenceOnly) {
|
208
|
+
if (size === 'extra-small') {
|
209
|
+
primaryTextSize = state.numTextLines > 1 ? textStyles.body1 : textStyles.caption1;
|
210
|
+
} else if (size === 'extra-large' || size === 'huge') {
|
211
|
+
primaryTextSize = textStyles.subtitle2;
|
212
|
+
} else {
|
213
|
+
primaryTextSize = textStyles.body1;
|
214
|
+
}
|
215
|
+
|
216
|
+
if (alignToPrimary) {
|
217
|
+
if (textPosition === 'before') {
|
218
|
+
alignToPrimaryClassName = textStyles.beforeAlignToPrimary;
|
219
|
+
} else if (textPosition === 'after') {
|
220
|
+
alignToPrimaryClassName = textStyles.afterAlignToPrimary;
|
202
221
|
}
|
203
222
|
}
|
204
223
|
} else {
|
205
|
-
if (
|
206
|
-
primaryTextSize = textStyles.
|
224
|
+
if (size === 'huge') {
|
225
|
+
primaryTextSize = textStyles.subtitle2;
|
226
|
+
} else if (size === 'extra-large') {
|
227
|
+
primaryTextSize = textStyles.subtitle2;
|
207
228
|
} else {
|
208
|
-
primaryTextSize = textStyles.
|
229
|
+
primaryTextSize = textStyles.body1;
|
209
230
|
}
|
210
|
-
|
211
|
-
optionalTextSize = textStyles.caption1;
|
212
231
|
}
|
213
232
|
|
214
233
|
return {
|
215
|
-
primaryTextClassName: react_1.mergeClasses(textStyles.base, textStyles.primaryText, primaryTextSize),
|
216
|
-
optionalTextClassName: react_1.mergeClasses(textStyles.base, textStyles.optionalText,
|
234
|
+
primaryTextClassName: react_1.mergeClasses(textStyles.base, textStyles.primaryText, primaryTextSize, alignToPrimaryClassName),
|
235
|
+
optionalTextClassName: react_1.mergeClasses(textStyles.base, textStyles.optionalText, !presenceOnly && size === 'huge' ? textStyles.body1 : textStyles.caption1, alignToPrimaryClassName)
|
217
236
|
};
|
218
237
|
};
|
219
238
|
//# s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GAAG,UAAU,CAAC,MAA7B;QACD;;QACD,gBAAgB,GAAG,UAAU,CAAC,KAA9B;MACD;IACF,CApBD,MAoBO,IAAI,YAAY,IAAI,KAAK,CAAC,QAA1B,EAAoC;MACzC,MAAM;QAAE;MAAF,IAAW,KAAK,CAAC,QAAvB;;MAEA,IAAI,IAAI,KAAK,aAAT,IAA0B,IAAI,KAAK,MAAvC,EAA+C;QAC7C,IAAI,YAAY,GAAG,CAAnB,EAAsB;UACpB,eAAe,GAAG,UAAU,CAAC,KAA7B;QACD,CAFD,MAEO;UACL,eAAe,GAAG,UAAU,CAAC,QAA7B;QACD;;QACD,gBAAgB,GAAG,UAAU,CAAC,QAA9B;MACD,CAPD,MAOO;QACL,eAAe,GAAG,UAAU,CAAC,KAA7B;QACA,gBAAgB,GAAG,UAAU,CAAC,QAA9B;MACD;IACF;EACF,CApCD,MAoCO;IACL,IAAI,YAAY,GAAG,CAAnB,EAAsB;MACpB,eAAe,GAAG,UAAU,CAAC,KAA7B;IACD,CAFD,MAEO;MACL,eAAe,GAAG,UAAU,CAAC,QAA7B;IACD;;IACD,gBAAgB,GAAG,UAAU,CAAC,QAA9B;EACD;;EAED,OAAO;IACL,oBAAoB,EAAE,OAAA,CAAA,YAAA,CAAa,UAAU,CAAC,IAAxB,EAA8B,UAAU,CAAC,WAAzC,EAAsD,eAAtD,CADjB;IAEL,qBAAqB,EAAE,OAAA,CAAA,YAAA,CAAa,UAAU,CAAC,IAAxB,EAA8B,UAAU,CAAC,YAAzC,EAAuD,gBAAvD;EAFlB,CAAP;AAID,CA5DD","sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nimport type { PersonaSlots, PersonaState } from './Persona.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const personaClassNames: SlotClassNames<PersonaSlots> = {\n root: 'fui-Persona',\n avatar: 'fui-Persona__avatar',\n presence: 'fui-Persona__presence',\n primaryText: 'fui-Persona__primaryText',\n secondaryText: 'fui-Persona__secondaryText',\n tertiaryText: 'fui-Persona__tertiaryText',\n quaternaryText: 'fui-Persona__quaternaryText',\n};\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n display: 'inline-grid',\n gridAutoColumns: 'max-content',\n gridAutoRows: 'max-content',\n },\n after: {\n gridAutoFlow: 'column',\n justifyItems: 'start',\n columnGap: '8px',\n },\n before: {\n gridAutoFlow: 'column',\n justifyItems: 'end',\n columnGap: '8px',\n },\n below: {\n justifyItems: 'center',\n },\n coin: {\n gridRowStart: 'span 5',\n },\n\n fixed: {\n alignSelf: 'start',\n },\n scaled: {\n alignSelf: 'center',\n },\n});\n\n/**\n * Apply styling to the Persona slots based on the state\n */\nexport const usePersonaStyles_unstable = (state: PersonaState): PersonaState => {\n const { fixed, textPosition } = state;\n const styles = useStyles();\n const { primaryTextClassName, optionalTextClassName } = useTextClassNames(state);\n\n state.root.className = mergeClasses(personaClassNames.root, styles.root, styles[textPosition], state.root.className);\n\n if (state.avatar) {\n state.avatar.className = mergeClasses(\n personaClassNames.avatar,\n styles.coin,\n fixed ? styles.fixed : styles.scaled,\n state.avatar.className,\n );\n }\n\n if (state.presence) {\n state.presence.className = mergeClasses(\n personaClassNames.presence,\n styles.coin,\n fixed ? styles.fixed : styles.scaled,\n state.presence.className,\n );\n }\n\n if (state.primaryText) {\n state.primaryText.className = mergeClasses(\n personaClassNames.primaryText,\n primaryTextClassName,\n state.primaryText.className,\n );\n }\n\n if (state.secondaryText) {\n state.secondaryText.className = mergeClasses(\n personaClassNames.secondaryText,\n optionalTextClassName,\n state.secondaryText.className,\n );\n }\n\n if (state.tertiaryText) {\n state.tertiaryText.className = mergeClasses(\n personaClassNames.tertiaryText,\n optionalTextClassName,\n state.tertiaryText.className,\n );\n }\n\n if (state.quaternaryText) {\n state.quaternaryText.className = mergeClasses(\n personaClassNames.quaternaryText,\n optionalTextClassName,\n state.quaternaryText.className,\n );\n }\n\n return state;\n};\n\nconst useTextStyles = makeStyles({\n base: {\n display: 'block',\n },\n primaryText: {\n color: tokens.colorNeutralForeground1,\n },\n optionalText: {\n color: tokens.colorNeutralForeground2,\n },\n\n body1: typographyStyles.body1,\n caption1: typographyStyles.caption1,\n subtitle2: typographyStyles.subtitle2,\n subtitle1: typographyStyles.subtitle1,\n title2: typographyStyles.title2,\n title3: typographyStyles.title3,\n});\n\nconst useTextClassNames = (\n state: PersonaState,\n): {\n primaryTextClassName: string;\n optionalTextClassName: string;\n} => {\n const { fixed, numTextLines, presenceOnly } = state;\n const textStyles = useTextStyles();\n let primaryTextSize;\n let optionalTextSize;\n\n if (fixed) {\n if (state.avatar && state.avatar.size) {\n const { size } = state.avatar;\n\n if (size < 40) {\n primaryTextSize = textStyles.body1;\n optionalTextSize = textStyles.caption1;\n } else if (size < 64) {\n primaryTextSize = textStyles.subtitle2;\n optionalTextSize = textStyles.body1;\n } else if (size < 96) {\n primaryTextSize = textStyles.subtitle1;\n optionalTextSize = textStyles.caption1;\n } else {\n if (numTextLines > 1) {\n primaryTextSize = textStyles.title3;\n } else {\n primaryTextSize = textStyles.title2;\n }\n optionalTextSize = textStyles.body1;\n }\n } else if (presenceOnly && state.presence) {\n const { size } = state.presence;\n\n if (size === 'extra-small' || size === 'tiny') {\n if (numTextLines > 1) {\n primaryTextSize = textStyles.body1;\n } else {\n primaryTextSize = textStyles.caption1;\n }\n optionalTextSize = textStyles.caption1;\n } else {\n primaryTextSize = textStyles.body1;\n optionalTextSize = textStyles.caption1;\n }\n }\n } else {\n if (numTextLines > 1) {\n primaryTextSize = textStyles.body1;\n } else {\n primaryTextSize = textStyles.caption1;\n }\n optionalTextSize = textStyles.caption1;\n }\n\n return {\n primaryTextClassName: mergeClasses(textStyles.base, textStyles.primaryText, primaryTextSize),\n optionalTextClassName: mergeClasses(textStyles.base, textStyles.optionalText, optionalTextSize),\n };\n};\n"],"sourceRoot":"../src/"}
|
1
|
+
{"version":3,"sources":["packages/react-components/react-persona/src/components/Persona/us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uBAJqB;EAPlB,CAAP;AAcD,CArDD","sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nimport type { PersonaSlots, PersonaState } from './Persona.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const personaClassNames: SlotClassNames<PersonaSlots> = {\n root: 'fui-Persona',\n avatar: 'fui-Persona__avatar',\n presence: 'fui-Persona__presence',\n primaryText: 'fui-Persona__primaryText',\n secondaryText: 'fui-Persona__secondaryText',\n tertiaryText: 'fui-Persona__tertiaryText',\n quaternaryText: 'fui-Persona__quaternaryText',\n};\n\nconst avatarSpacing = `--fui-Persona__avatar--spacing`;\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n base: {\n display: 'inline-grid',\n gridAutoRows: 'max-content',\n },\n\n after: {\n gridAutoFlow: 'column',\n justifyItems: 'start',\n gridTemplateColumns: 'max-content [middle] auto',\n },\n before: {\n gridAutoFlow: 'column',\n justifyItems: 'end',\n gridTemplateColumns: 'auto [middle] max-content',\n },\n below: {\n justifyItems: 'center',\n },\n coin: {\n gridRowStart: 'span 5',\n },\n\n start: {\n alignSelf: 'start',\n },\n center: {\n alignSelf: 'center',\n },\n\n afterAlignToPrimary: {\n alignSelf: 'center',\n gridRowStart: 'unset',\n gridColumnEnd: 'middle',\n },\n beforeAlignToPrimary: {\n alignSelf: 'center',\n gridRowStart: 'unset',\n gridColumnStart: 'middle',\n },\n});\n\nconst useAvatarSpacingStyles = makeStyles({\n 'extra-small': {\n [avatarSpacing]: tokens.spacingHorizontalSNudge,\n },\n small: {\n [avatarSpacing]: tokens.spacingHorizontalS,\n },\n medium: {\n [avatarSpacing]: tokens.spacingHorizontalS,\n },\n large: {\n [avatarSpacing]: tokens.spacingHorizontalMNudge,\n },\n 'extra-large': {\n [avatarSpacing]: tokens.spacingHorizontalMNudge,\n },\n huge: {\n [avatarSpacing]: tokens.spacingHorizontalM,\n },\n after: {\n marginRight: `var(${avatarSpacing})`,\n },\n below: {\n marginBottom: `var(${avatarSpacing})`,\n },\n before: {\n marginLeft: `var(${avatarSpacing})`,\n },\n});\n\nconst usePresenceSpacingStyles = makeStyles({\n small: {\n [avatarSpacing]: tokens.spacingHorizontalSNudge,\n },\n});\n\n/**\n * Apply styling to the Persona slots based on the state\n */\nexport const usePersonaStyles_unstable = (state: PersonaState): PersonaState => {\n const { presenceOnly, size, textAlignment, textPosition } = state;\n\n const alignToPrimary = presenceOnly && textAlignment === 'start' && size !== 'extra-large' && size !== 'huge';\n const { primaryTextClassName, optionalTextClassName } = useTextClassNames(state, alignToPrimary);\n\n const styles = useStyles();\n const avatarSpacingStyles = useAvatarSpacingStyles();\n const presenceSpacingStyles = { ...avatarSpacingStyles, ...usePresenceSpacingStyles() };\n\n state.root.className = mergeClasses(personaClassNames.root, styles.base, styles[textPosition], state.root.className);\n\n if (state.avatar) {\n state.avatar.className = mergeClasses(\n personaClassNames.avatar,\n styles.coin,\n styles[textAlignment],\n avatarSpacingStyles[size],\n avatarSpacingStyles[textPosition],\n state.avatar.className,\n );\n }\n\n if (state.presence) {\n state.presence.className = mergeClasses(\n personaClassNames.presence,\n styles.coin,\n styles[textAlignment],\n presenceSpacingStyles[size],\n presenceSpacingStyles[textPosition],\n textPosition === 'after' && alignToPrimary && styles.afterAlignToPrimary,\n textPosition === 'before' && alignToPrimary && styles.beforeAlignToPrimary,\n state.presence.className,\n );\n }\n\n if (state.primaryText) {\n state.primaryText.className = mergeClasses(\n personaClassNames.primaryText,\n primaryTextClassName,\n state.primaryText.className,\n );\n }\n\n if (state.secondaryText) {\n state.secondaryText.className = mergeClasses(\n personaClassNames.secondaryText,\n optionalTextClassName,\n state.secondaryText.className,\n );\n }\n\n if (state.tertiaryText) {\n state.tertiaryText.className = mergeClasses(\n personaClassNames.tertiaryText,\n optionalTextClassName,\n state.tertiaryText.className,\n );\n }\n\n if (state.quaternaryText) {\n state.quaternaryText.className = mergeClasses(\n personaClassNames.quaternaryText,\n optionalTextClassName,\n state.quaternaryText.className,\n );\n }\n\n return state;\n};\n\nconst useTextStyles = makeStyles({\n base: {\n display: 'block',\n },\n primaryText: {\n color: tokens.colorNeutralForeground1,\n },\n optionalText: {\n color: tokens.colorNeutralForeground2,\n },\n\n beforeAlignToPrimary: {\n gridColumnEnd: 'middle',\n },\n afterAlignToPrimary: {\n gridColumnStart: 'middle',\n },\n\n body1: typographyStyles.body1,\n caption1: typographyStyles.caption1,\n subtitle2: typographyStyles.subtitle2,\n});\n\nconst useTextClassNames = (\n state: PersonaState,\n alignToPrimary: boolean,\n): {\n primaryTextClassName: string;\n optionalTextClassName: string;\n} => {\n const { presenceOnly, size, textPosition } = state;\n const textStyles = useTextStyles();\n\n let primaryTextSize;\n let alignToPrimaryClassName;\n\n if (presenceOnly) {\n if (size === 'extra-small') {\n primaryTextSize = state.numTextLines > 1 ? textStyles.body1 : textStyles.caption1;\n } else if (size === 'extra-large' || size === 'huge') {\n primaryTextSize = textStyles.subtitle2;\n } else {\n primaryTextSize = textStyles.body1;\n }\n\n if (alignToPrimary) {\n if (textPosition === 'before') {\n alignToPrimaryClassName = textStyles.beforeAlignToPrimary;\n } else if (textPosition === 'after') {\n alignToPrimaryClassName = textStyles.afterAlignToPrimary;\n }\n }\n } else {\n if (size === 'huge') {\n primaryTextSize = textStyles.subtitle2;\n } else if (size === 'extra-large') {\n primaryTextSize = textStyles.subtitle2;\n } else {\n primaryTextSize = textStyles.body1;\n }\n }\n\n return {\n primaryTextClassName: mergeClasses(\n textStyles.base,\n textStyles.primaryText,\n primaryTextSize,\n alignToPrimaryClassName,\n ),\n optionalTextClassName: mergeClasses(\n textStyles.base,\n textStyles.optionalText,\n !presenceOnly && size === 'huge' ? textStyles.body1 : textStyles.caption1,\n alignToPrimaryClassName,\n ),\n };\n};\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,SAAA,gBAAA,OAAA,CAAA,WAAA,CAAA;;AACE,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,SAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,SAAA,CAAA,OAAA;EAAO;AAAP,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,mBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,SAAA,CAAA,iBAAA;EAAiB;AAAjB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,wBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,SAAA,CAAA,sBAAA;EAAsB;AAAtB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,2BAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,SAAA,CAAA,yBAAA;EAAyB;AAAzB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,qBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,SAAA,CAAA,mBAAA;EAAmB;AAAnB,CAAA","sourcesContent":["export {\n Persona,\n personaClassNames,\n renderPersona_unstable,\n usePersonaStyles_unstable,\n usePersona_unstable,\n} from './Persona';\nexport type { PersonaProps, PersonaSlots, PersonaState } from './Persona';\n"],"sourceRoot":"../src/"}
|
1
|
+
{"version":3,"sources":["packages/react-components/react-persona/src/index.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,SAAA,gBAAA,OAAA,CAAA,WAAA,CAAA;;AACE,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,SAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,SAAA,CAAA,OAAA;EAAO;AAAP,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,mBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,SAAA,CAAA,iBAAA;EAAiB;AAAjB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,wBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,SAAA,CAAA,sBAAA;EAAsB;AAAtB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,2BAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,SAAA,CAAA,yBAAA;EAAyB;AAAzB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,qBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,SAAA,CAAA,mBAAA;EAAmB;AAAnB,CAAA","sourcesContent":["export {\n Persona,\n personaClassNames,\n renderPersona_unstable,\n usePersonaStyles_unstable,\n usePersona_unstable,\n} from './Persona';\nexport type { PersonaProps, PersonaSlots, PersonaState } from './Persona';\n"],"sourceRoot":"../src/"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-persona",
|
3
|
-
"version": "9.1.0-beta.
|
3
|
+
"version": "9.1.0-beta.5",
|
4
4
|
"description": "React components for building web experiences",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -19,11 +19,10 @@
|
|
19
19
|
"just": "just-scripts",
|
20
20
|
"lint": "just-scripts lint",
|
21
21
|
"test": "jest --passWithNoTests",
|
22
|
-
"docs": "api-extractor run --config=config/api-extractor.local.json --local",
|
23
|
-
"build:local": "tsc -p ./tsconfig.lib.json --module esnext --emitDeclarationOnly && node ../../../scripts/typescript/normalize-import --output ./dist/types/packages/react-components/react-persona/src && yarn docs",
|
24
22
|
"type-check": "tsc -b tsconfig.json",
|
25
23
|
"storybook": "start-storybook",
|
26
|
-
"start": "yarn storybook"
|
24
|
+
"start": "yarn storybook",
|
25
|
+
"generate-api": "tsc -p ./tsconfig.lib.json --emitDeclarationOnly && just-scripts api-extractor"
|
27
26
|
},
|
28
27
|
"devDependencies": {
|
29
28
|
"@fluentui/eslint-plugin": "*",
|
@@ -32,10 +31,10 @@
|
|
32
31
|
"@fluentui/scripts": "^1.0.0"
|
33
32
|
},
|
34
33
|
"dependencies": {
|
35
|
-
"@fluentui/react-avatar": "^9.2.
|
36
|
-
"@fluentui/react-badge": "^9.0.
|
37
|
-
"@fluentui/react-theme": "^9.1.
|
38
|
-
"@fluentui/react-utilities": "^9.2.
|
34
|
+
"@fluentui/react-avatar": "^9.2.8",
|
35
|
+
"@fluentui/react-badge": "^9.0.14",
|
36
|
+
"@fluentui/react-theme": "^9.1.3",
|
37
|
+
"@fluentui/react-utilities": "^9.2.2",
|
39
38
|
"@griffel/react": "^1.4.2",
|
40
39
|
"tslib": "^2.1.0"
|
41
40
|
},
|
package/MIGRATION.md
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
# Badge Migration
|
2
|
-
|
3
|
-
## Migration from v8
|
4
|
-
|
5
|
-
v8 offers a component equivalent to v9's `Persona`. However, the API is slightly different. The main difference is that v9's `Persona` does not handle the functionality of the `presence` and `avatar`. Instead, the `presence` and `avatar` are separate components that can be used in conjunction with `Persona`.
|
6
|
-
|
7
|
-
Here's how the API of v8's `Persona` compares to the one from v9's `Persona` component:
|
8
|
-
|
9
|
-
- `className` => `className`
|
10
|
-
- `coinProps` => Use `avatar`'s or `presence`'s slot props
|
11
|
-
- `componentRef` => NOT SUPPORTED - use `ref` instead
|
12
|
-
- `hidePersonaDetails` => Use the `Avatar` component for this case
|
13
|
-
- ```
|
14
|
-
|
15
|
-
```
|
16
|
-
- `imageShouldFadeIn` => NOT SUPPORTED
|
17
|
-
- `isOutOfOffice` => Use the `outOfOffice` prop of the `presence` slot. E.g.: `presence={{ outOfOffice: true }}`
|
18
|
-
- `presence` => Use the `status` prop of the `presence` slot. E.g.: `presence={{ status: 'away' }}`
|
19
|
-
- `presenceTitle` => NOT SUPPORTED
|
20
|
-
- `showOverflowTooltip` => NOT SUPPORTED
|
21
|
-
- `showUnknownPersonaCoin` => NOT SUPPORTED
|
22
|
-
- `styles` => Use style customization through `className` instead
|
23
|
-
|
24
|
-
## Property Mapping
|
25
|
-
|
26
|
-
| v8 `Persona` | v9 `Persona` |
|
27
|
-
| ------------------------ | -------------------------------------- |
|
28
|
-
| `coinProps` | `avatar` or `badge` slot props |
|
29
|
-
| `coinSize` | `size` in the `badge` or `avatar` slot |
|
30
|
-
| `className` | `className` |
|
31
|
-
| `componentRef` | `ref` |
|
32
|
-
| `hidePersonaDetails` | - |
|
33
|
-
| `imageShouldFadeIn` | - |
|
34
|
-
| `isOutOfOffice` | `status` in `presence` slot props |
|
35
|
-
| `optionalText` | `quaternaryText` |
|
36
|
-
| `presence` | `presence` |
|
37
|
-
| `presenceTitle` | - |
|
38
|
-
| `primaryText` | `primaryText` |
|
39
|
-
| `secondaryText` | `secondaryText` |
|
40
|
-
| `showOverflowTooltip` | - |
|
41
|
-
| `showUnknownPersonaCoin` | - |
|
42
|
-
| `styles` | `className` |
|
43
|
-
| `tertiaryText` | `tertiaryText` |
|
44
|
-
| `text` | `name` |
|
package/Spec.md
DELETED
@@ -1,213 +0,0 @@
|
|
1
|
-
# @fluentui/react-persona Spec
|
2
|
-
|
3
|
-
Convergence epic issue: #24213
|
4
|
-
|
5
|
-
## Background
|
6
|
-
|
7
|
-
A Persona is a visual representation of a person or status that showcases an Avatar, PresenceBadge, or an Avatar with a PresenceBadge. This composite component is not a card, therefore it will not provide a visual board or a popup when the user hovers the Avatar.
|
8
|
-
|
9
|
-
Persona is used in PeoplePicker, Team's left rail and menus, chiclets, and Card.
|
10
|
-
|
11
|
-
## Prior Art
|
12
|
-
|
13
|
-
- OpenUI research: [Avatar/Persona](https://open-ui.org/components/avatar.research)
|
14
|
-
- v7/v8: [link](https://developer.microsoft.com/en-us/fluentui#/controls/web/persona)
|
15
|
-
- > Note: v8's Persona is a combination of v9's Persona and Avatar (v8's Persona has a sub-component PersonaCoin that would count as Avatar, but is not exposed.). In v9 we've taken the approach of having a single component Avatar and another component Persona.
|
16
|
-
- v0: Does not have equivalent component.
|
17
|
-
|
18
|
-
## Anatomy
|
19
|
-
|
20
|
-

|
21
|
-
|
22
|
-
### Avatar, PresenceBadge, and Avatar + PresenceBadge
|
23
|
-
|
24
|
-
v8's Persona has a sub-component `PersonaCoin`, the equivalent in v9 is an Avatar. Currently Avatar is able to display a PresenceBadge, but this behavior will be deprecated in favor of Persona having this behavior.
|
25
|
-
|
26
|
-
Persona has a slot for an `Avatar` and `PresenceBadge`, giving the user the ability to display an Avatar, a PresenceBadge, or Combine them into an Avatar with presence.
|
27
|
-
|
28
|
-
## Sample Code
|
29
|
-
|
30
|
-

|
31
|
-
|
32
|
-
Persona with Avatar:
|
33
|
-
|
34
|
-
```jsx
|
35
|
-
<Persona name="Kevin Sturgis" secondaryText="Software Engineer" />
|
36
|
-
```
|
37
|
-
|
38
|
-

|
39
|
-
|
40
|
-
Persona with PresenceBadge:
|
41
|
-
|
42
|
-
```jsx
|
43
|
-
<Persona presenceOnly name="Kevin Sturgis" presence={{ status: 'offline', outOfOffice: true }} />
|
44
|
-
```
|
45
|
-
|
46
|
-

|
47
|
-
|
48
|
-
Persona with Avatar + PresenceBadge:
|
49
|
-
|
50
|
-
```jsx
|
51
|
-
<Persona
|
52
|
-
name="Kevin Sturgis"
|
53
|
-
secondaryText="Software Engineer"
|
54
|
-
tertiaryText="Offline"
|
55
|
-
presence={{ status: 'offline', outOfOffice: true }}
|
56
|
-
/>
|
57
|
-
```
|
58
|
-
|
59
|
-
## Variants
|
60
|
-
|
61
|
-
> I will refer to the avatar and presence as content.
|
62
|
-
|
63
|
-
There are three alignment variants:
|
64
|
-
|
65
|
-
- after: Content on the left and text on the right.
|
66
|
-
- below: Content on top and text on the bottom.
|
67
|
-
- before: Content on the right and text on the left.
|
68
|
-
|
69
|
-
There are 3 content variants:
|
70
|
-
|
71
|
-
- Avatar
|
72
|
-
- PresenceBadge
|
73
|
-
- Avatar + PresenceBadge
|
74
|
-
|
75
|
-
There are 2 sizing variants:
|
76
|
-
|
77
|
-
- scaled: When there is no specified size in the props of either `avatar` or `presence`, the content is resized based on the number of text lines used.
|
78
|
-
- fixed: When there is a specified size of either `avatar` or `presence`, the text lines are styled based on the size of the content.
|
79
|
-
|
80
|
-
## API
|
81
|
-
|
82
|
-
**Slots**
|
83
|
-
|
84
|
-
- `root`: The root slot for Persona.
|
85
|
-
- `avatar`: The Avatar to display and Persona's primary slot.
|
86
|
-
- `presence`: The PresenceBadge to display.
|
87
|
-
- `primaryText`: First line of text in Persona. By default its content will be the content of the `name` prop. It is highly encouraged to only use the `name` prop and only specify the content of `primaryText` when it is not a name.
|
88
|
-
- `secondaryText`: Second line of text in Persona.
|
89
|
-
- `tertiaryText`: Third line of text in Persona.
|
90
|
-
- `quaternaryText`: Fourth line of text in Persona.
|
91
|
-
|
92
|
-
**Types**
|
93
|
-
|
94
|
-
```ts
|
95
|
-
export type PersonaSlots = {
|
96
|
-
root: NonNullable<Slot<'div'>>;
|
97
|
-
|
98
|
-
/**
|
99
|
-
* Avatar to display.
|
100
|
-
*/
|
101
|
-
avatar?: Slot<typeof Avatar>;
|
102
|
-
|
103
|
-
/**
|
104
|
-
* PresenceBadge to display.
|
105
|
-
*/
|
106
|
-
presence?: Slot<typeof PresenceBadge>;
|
107
|
-
|
108
|
-
/**
|
109
|
-
* The first line of text in the Persona, larger than the rest of the lines.
|
110
|
-
*
|
111
|
-
* This defaults to the `name` prop, and it is recomended that you only set its value if it should be different from
|
112
|
-
* from the `name` prop.
|
113
|
-
*/
|
114
|
-
primaryText?: Slot<'span'>;
|
115
|
-
|
116
|
-
/**
|
117
|
-
* The second line of text in the Persona.
|
118
|
-
*/
|
119
|
-
secondaryText?: Slot<'span'>;
|
120
|
-
|
121
|
-
/**
|
122
|
-
* The third line of text in the Persona.
|
123
|
-
*/
|
124
|
-
tertiaryText?: Slot<'span'>;
|
125
|
-
|
126
|
-
/**
|
127
|
-
* The fourth line of text in the Persona.
|
128
|
-
*/
|
129
|
-
quaternaryText?: Slot<'span'>;
|
130
|
-
};
|
131
|
-
|
132
|
-
/**
|
133
|
-
* Persona Props
|
134
|
-
*/
|
135
|
-
export type PersonaProps = Omit<ComponentProps<PersonaSlots>, 'badge'> &
|
136
|
-
Pick<AvatarProps, 'name'> & {
|
137
|
-
/**
|
138
|
-
* Whether to display only the presence.
|
139
|
-
*
|
140
|
-
* @default false
|
141
|
-
*/
|
142
|
-
presenceOnly?: boolean;
|
143
|
-
|
144
|
-
/**
|
145
|
-
* Position the text will be rendered in.
|
146
|
-
*
|
147
|
-
* @default after
|
148
|
-
*/
|
149
|
-
textPosition?: 'before' | 'after' | 'below';
|
150
|
-
};
|
151
|
-
```
|
152
|
-
|
153
|
-
## Structure
|
154
|
-
|
155
|
-
To avoid the [issue](https://github.com/microsoft/fluentui/issues/23386) v8 has, a css grid will be used instead of a flexbox that requires a general wrapper and a text container wrapper.
|
156
|
-
|
157
|
-
- _**Internal**_
|
158
|
-
|
159
|
-
```jsx
|
160
|
-
const coin = (
|
161
|
-
<>
|
162
|
-
{!presenceOnly && slots.avatar && <slots.avatar {...slotProps.avatar} />}
|
163
|
-
{presenceOnly && slots.presence && <slots.presence {...slotProps.presence} />}
|
164
|
-
</>
|
165
|
-
);
|
166
|
-
|
167
|
-
return (
|
168
|
-
<slots.root {...slotProps.root}>
|
169
|
-
{(textPosition === 'after' || textPosition === 'below') && coin}
|
170
|
-
{slots.primaryText && <slots.primaryText {...slotProps.primaryText} />}
|
171
|
-
{slots.secondaryText && <slots.secondaryText {...slotProps.secondaryText} />}
|
172
|
-
{slots.tertiaryText && <slots.tertiaryText {...slotProps.tertiaryText} />}
|
173
|
-
{slots.quaternaryText && <slots.quaternaryText {...slotProps.quaternaryText} />}
|
174
|
-
{textPosition === 'before' && coin}
|
175
|
-
</slots.root>
|
176
|
-
);
|
177
|
-
```
|
178
|
-
|
179
|
-
- _**DOM**_
|
180
|
-
|
181
|
-
```html
|
182
|
-
<div class="fui-Persona">
|
183
|
-
<div {/* Avatar, PresenceBadge, or Avatar with PresenceBadge */} />
|
184
|
-
<span class="fui-Persona__primaryText">{/* name */}</span>
|
185
|
-
<span class="fui-Persona__secondaryText">Secondary Text</span>
|
186
|
-
<span class="fui-Persona__tertiaryText">Tertiary Text</span>
|
187
|
-
<span class="fui-Persona__quaternaryText">Quaternary Text</span>
|
188
|
-
</div>
|
189
|
-
```
|
190
|
-
|
191
|
-
## Migration
|
192
|
-
|
193
|
-
See [MIGRATION.md](./MIGRATION.md) for details.
|
194
|
-
|
195
|
-
## Behaviors
|
196
|
-
|
197
|
-
_Explain how the component will behave in use, including:_
|
198
|
-
|
199
|
-
- _Component States_
|
200
|
-
- There are no states for this component, it's a visual representation.
|
201
|
-
- _Interaction_
|
202
|
-
- _Keyboard_
|
203
|
-
- Doesn't receive focus.
|
204
|
-
- _Cursor_
|
205
|
-
- Doesn't interact with cursor.
|
206
|
-
- _Touch_
|
207
|
-
- Doesn't interact with touch.
|
208
|
-
- _Screen readers_
|
209
|
-
- Contents will be read based on dom order.
|
210
|
-
|
211
|
-
## Accessibility
|
212
|
-
|
213
|
-
- There's no need for `aria-*` or/and`role`. Avatar and Badge already accessible and the text labels won't need anything as well.
|