@fluentui/react-persona 9.1.0-beta.7 → 9.1.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +87 -1
- package/CHANGELOG.md +26 -2
- package/README.md +0 -10
- package/lib/components/Persona/Persona.js +0 -1
- package/lib/components/Persona/Persona.js.map +1 -1
- package/lib/components/Persona/renderPersona.js +14 -8
- package/lib/components/Persona/renderPersona.js.map +1 -1
- package/lib/components/Persona/usePersona.js +3 -5
- package/lib/components/Persona/usePersona.js.map +1 -1
- package/lib/components/Persona/usePersonaStyles.js +83 -99
- package/lib/components/Persona/usePersonaStyles.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib-amd/Persona.js +6 -0
- package/lib-amd/Persona.js.map +1 -0
- package/lib-amd/components/Persona/Persona.js +16 -0
- package/lib-amd/components/Persona/Persona.js.map +1 -0
- package/lib-amd/components/Persona/Persona.types.js +5 -0
- package/lib-amd/components/Persona/Persona.types.js.map +1 -0
- package/lib-amd/components/Persona/index.js +10 -0
- package/lib-amd/components/Persona/index.js.map +1 -0
- package/lib-amd/components/Persona/renderPersona.js +24 -0
- package/lib-amd/components/Persona/renderPersona.js.map +1 -0
- package/lib-amd/components/Persona/usePersona.js +84 -0
- package/lib-amd/components/Persona/usePersona.js.map +1 -0
- package/lib-amd/components/Persona/usePersonaStyles.js +184 -0
- package/lib-amd/components/Persona/usePersonaStyles.js.map +1 -0
- package/lib-amd/index.js +11 -0
- package/lib-amd/index.js.map +1 -0
- package/lib-commonjs/Persona.js +0 -2
- package/lib-commonjs/Persona.js.map +1 -1
- package/lib-commonjs/components/Persona/Persona.js +0 -6
- package/lib-commonjs/components/Persona/Persona.js.map +1 -1
- package/lib-commonjs/components/Persona/Persona.types.js.map +1 -1
- package/lib-commonjs/components/Persona/index.js +0 -6
- package/lib-commonjs/components/Persona/index.js.map +1 -1
- package/lib-commonjs/components/Persona/renderPersona.js +14 -12
- package/lib-commonjs/components/Persona/renderPersona.js.map +1 -1
- package/lib-commonjs/components/Persona/usePersona.js +3 -10
- package/lib-commonjs/components/Persona/usePersona.js.map +1 -1
- package/lib-commonjs/components/Persona/usePersonaStyles.js +83 -103
- package/lib-commonjs/components/Persona/usePersonaStyles.js.map +1 -1
- package/lib-commonjs/index.js +0 -2
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +8 -10
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"mappings":";;;;;;AACA;AACA;AACA;AAGA;;;;;;;;;AASO,MAAMA,mBAAmB,GAAG,CAACC,KAAmB,EAAEC,GAA2B,KAAkB;EACpG,MAAM;IAAEC,IAAI;IAAEC,YAAY,GAAG,KAAK;IAAEC,IAAI,GAAG,QAAQ;IAAEC,aAAa,GAAG,OAAO;IAAEC,YAAY,GAAG;EAAO,CAAE,GAAGN,KAAK;EAE9G,MAAMO,WAAW,GAAGC,kCAAgB,CAACR,KAAK,CAACO,WAAW,EAAE;IACtDE,QAAQ,EAAE,IAAI;IACdC,YAAY,EAAE;MACZC,QAAQ,EAAET;;GAEb,CAAC;EACF,MAAMU,aAAa,GAAGJ,kCAAgB,CAACR,KAAK,CAACY,aAAa,CAAC;EAC3D,MAAMC,YAAY,GAAGL,kCAAgB,CAACR,KAAK,CAACa,YAAY,CAAC;EACzD,MAAMC,cAAc,GAAGN,kCAAgB,CAACR,KAAK,CAACc,cAAc,CAAC;EAE7D,MAAMC,YAAY,GAAG,CAACR,WAAW,EAAEK,aAAa,EAAEC,YAAY,EAAEC,cAAc,CAAC,CAACE,MAAM,CAACC,OAAO,CAAC,CAACC,MAAM;EAEtG,OAAO;IACLH,YAAY;IACZZ,YAAY;IACZC,IAAI;IACJC,aAAa;IACbC,YAAY;IAEZa,UAAU,EAAE;MACVC,IAAI,EAAE,KAAK;MACXC,MAAM,EAAEC,qBAAM;MACdC,QAAQ,EAAEC,2BAAa;MACvBjB,WAAW,EAAE,MAAM;MACnBK,aAAa,EAAE,MAAM;MACrBC,YAAY,EAAE,MAAM;MACpBC,cAAc,EAAE;KACjB;IAEDM,IAAI,EAAEZ,uCAAqB,CACzB,KAAK,EACL;MACE,GAAGR,KAAK;MACRC;KACD,EACD,uBAAwB,CAAC,MAAM,CAAC,CACjC;IACDoB,MAAM,EAAE,CAAClB,YAAY,GACjBK,kCAAgB,CAACR,KAAK,CAACqB,MAAM,EAAE;MAC7BZ,QAAQ,EAAE,IAAI;MACdC,YAAY,EAAE;QACZR,IAAI;QACJuB,KAAK,EAAEzB,KAAK,CAACuB,QAAQ;QACrBnB,IAAI,EAAEsB,WAAW,CAACtB,IAAI;;KAEzB,CAAC,GACFuB,SAAS;IACbJ,QAAQ,EAAEpB,YAAY,GAClBK,kCAAgB,CAACR,KAAK,CAACuB,QAAQ,EAAE;MAC/Bb,YAAY,EAAE;QACZN,IAAI,EAAEwB,aAAa,CAACxB,IAAI;;KAE3B,CAAC,GACFuB,SAAS;IACbpB,WAAW;IACXK,aAAa;IACbC,YAAY;IACZC;GACD;AACH,CAAC;AA9DYe,2BAAmB;AAgEhC,MAAMD,aAAa,GAAG;EACpB,aAAa,EAAE,MAAM;EACrBE,KAAK,EAAE,aAAa;EACpBC,MAAM,EAAE,OAAO;EACfC,KAAK,EAAE,QAAQ;EACf,aAAa,EAAE,OAAO;EACtBC,IAAI,EAAE;CACE;AAEV,MAAMP,WAAW,GAAG;EAClB,aAAa,EAAE,EAAE;EACjBI,KAAK,EAAE,EAAE;EACTC,MAAM,EAAE,EAAE;EACVC,KAAK,EAAE,EAAE;EACT,aAAa,EAAE,EAAE;EACjBC,IAAI,EAAE;CACE","names":["usePersona_unstable","props","ref","name","presenceOnly","size","textAlignment","textPosition","primaryText","react_utilities_1","required","defaultProps","children","secondaryText","tertiaryText","quaternaryText","numTextLines","filter","Boolean","length","components","root","avatar","react_avatar_1","presence","react_badge_1","badge","avatarSizes","undefined","presenceSizes","exports","small","medium","large","huge"],"sourceRoot":"../src/","sources":["packages/react-components/react-persona/src/components/Persona/usePersona.ts"],"sourcesContent":["import * as React from 'react';\nimport { Avatar } from '@fluentui/react-avatar';\nimport { getNativeElementProps, resolveShorthand } from '@fluentui/react-utilities';\nimport { PresenceBadge } from '@fluentui/react-badge';\nimport type { PersonaProps, PersonaState } from './Persona.types';\n\n/**\n * Create the state required to render Persona.\n *\n * The returned state can be modified with hooks such as usePersonaStyles_unstable,\n * before being passed to renderPersona_unstable.\n *\n * @param props - props from this instance of Persona\n * @param ref - reference to root HTMLElement of Persona\n */\nexport const usePersona_unstable = (props: PersonaProps, ref: React.Ref<HTMLElement>): PersonaState => {\n const { name, presenceOnly = false, size = 'medium', textAlignment = 'start', textPosition = 'after' } = props;\n\n const primaryText = resolveShorthand(props.primaryText, {\n required: true,\n defaultProps: {\n children: name,\n },\n });\n const secondaryText = resolveShorthand(props.secondaryText);\n const tertiaryText = resolveShorthand(props.tertiaryText);\n const quaternaryText = resolveShorthand(props.quaternaryText);\n\n const numTextLines = [primaryText, secondaryText, tertiaryText, quaternaryText].filter(Boolean).length;\n\n return {\n numTextLines,\n presenceOnly,\n size,\n textAlignment,\n textPosition,\n\n components: {\n root: 'div',\n avatar: Avatar,\n presence: PresenceBadge,\n primaryText: 'span',\n secondaryText: 'span',\n tertiaryText: 'span',\n quaternaryText: 'span',\n },\n\n root: getNativeElementProps(\n 'div',\n {\n ...props,\n ref,\n },\n /* excludedPropNames */ ['name'],\n ),\n avatar: !presenceOnly\n ? resolveShorthand(props.avatar, {\n required: true,\n defaultProps: {\n name,\n badge: props.presence,\n size: avatarSizes[size],\n },\n })\n : undefined,\n presence: presenceOnly\n ? resolveShorthand(props.presence, {\n defaultProps: {\n size: presenceSizes[size],\n },\n })\n : undefined,\n primaryText,\n secondaryText,\n tertiaryText,\n quaternaryText,\n };\n};\n\nconst presenceSizes = {\n 'extra-small': 'tiny',\n small: 'extra-small',\n medium: 'small',\n large: 'medium',\n 'extra-large': 'large',\n huge: 'large',\n} as const;\n\nconst avatarSizes = {\n 'extra-small': 20,\n small: 28,\n medium: 32,\n large: 36,\n 'extra-large': 40,\n huge: 56,\n} as const;\n"]}
|
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.usePersonaStyles_unstable = exports.personaClassNames = void 0;
|
7
|
-
|
8
7
|
const react_1 = /*#__PURE__*/require("@griffel/react");
|
9
|
-
|
10
8
|
const react_theme_1 = /*#__PURE__*/require("@fluentui/react-theme");
|
11
|
-
|
12
9
|
exports.personaClassNames = {
|
13
10
|
root: 'fui-Persona',
|
14
11
|
avatar: 'fui-Persona__avatar',
|
@@ -22,92 +19,87 @@ const avatarSpacing = `--fui-Persona__avatar--spacing`;
|
|
22
19
|
/**
|
23
20
|
* Styles for the root slot
|
24
21
|
*/
|
25
|
-
|
26
22
|
const useStyles = /*#__PURE__*/react_1.__styles({
|
27
|
-
|
28
|
-
|
29
|
-
|
23
|
+
base: {
|
24
|
+
mc9l5x: "fwk3njj",
|
25
|
+
v29qe6: "fvtn1bl"
|
30
26
|
},
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
27
|
+
after: {
|
28
|
+
Bxotwcr: "f1u07yai",
|
29
|
+
B7hvi0a: "f1m2n5bn",
|
30
|
+
Budl1dq: "f1c1ms5d"
|
35
31
|
},
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
32
|
+
before: {
|
33
|
+
Bxotwcr: "f1u07yai",
|
34
|
+
B7hvi0a: "f1tll2w5",
|
35
|
+
Budl1dq: "ffvkwdr"
|
40
36
|
},
|
41
|
-
|
42
|
-
|
37
|
+
below: {
|
38
|
+
B7hvi0a: "f1oiokrs"
|
43
39
|
},
|
44
|
-
|
45
|
-
|
40
|
+
coin: {
|
41
|
+
Ijaq50: "f1hek2iy"
|
46
42
|
},
|
47
|
-
|
48
|
-
|
43
|
+
start: {
|
44
|
+
qb2dma: "f9h729m"
|
49
45
|
},
|
50
|
-
|
51
|
-
|
46
|
+
center: {
|
47
|
+
qb2dma: "f7nlbp4"
|
52
48
|
},
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
49
|
+
afterAlignToPrimary: {
|
50
|
+
qb2dma: "f7nlbp4",
|
51
|
+
Ijaq50: "f1rnkkuc",
|
52
|
+
Bw0ie65: "f1warjpf"
|
57
53
|
},
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
54
|
+
beforeAlignToPrimary: {
|
55
|
+
qb2dma: "f7nlbp4",
|
56
|
+
Ijaq50: "f1rnkkuc",
|
57
|
+
Br312pm: "fwu52yu"
|
62
58
|
}
|
63
59
|
}, {
|
64
|
-
|
60
|
+
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
61
|
});
|
66
|
-
|
67
62
|
const useAvatarSpacingStyles = /*#__PURE__*/react_1.__styles({
|
68
63
|
"extra-small": {
|
69
|
-
|
64
|
+
Bs1gm4r: "f1e48tse"
|
70
65
|
},
|
71
|
-
|
72
|
-
|
66
|
+
small: {
|
67
|
+
Bs1gm4r: "f18q9vkd"
|
73
68
|
},
|
74
|
-
|
75
|
-
|
69
|
+
medium: {
|
70
|
+
Bs1gm4r: "f18q9vkd"
|
76
71
|
},
|
77
|
-
|
78
|
-
|
72
|
+
large: {
|
73
|
+
Bs1gm4r: "fx34bi6"
|
79
74
|
},
|
80
75
|
"extra-large": {
|
81
|
-
|
76
|
+
Bs1gm4r: "fx34bi6"
|
82
77
|
},
|
83
|
-
|
84
|
-
|
78
|
+
huge: {
|
79
|
+
Bs1gm4r: "f1o96qtm"
|
85
80
|
},
|
86
|
-
|
87
|
-
|
81
|
+
after: {
|
82
|
+
t21cq0: ["f103ycu4", "f1tao51"]
|
88
83
|
},
|
89
|
-
|
90
|
-
|
84
|
+
below: {
|
85
|
+
jrapky: "fbo7acy"
|
91
86
|
},
|
92
|
-
|
93
|
-
|
87
|
+
before: {
|
88
|
+
Frg6f3: ["f1tao51", "f103ycu4"]
|
94
89
|
}
|
95
90
|
}, {
|
96
|
-
|
91
|
+
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
92
|
});
|
98
|
-
|
99
93
|
const usePresenceSpacingStyles = /*#__PURE__*/react_1.__styles({
|
100
|
-
|
101
|
-
|
94
|
+
small: {
|
95
|
+
Bs1gm4r: "f1e48tse"
|
102
96
|
}
|
103
97
|
}, {
|
104
|
-
|
98
|
+
d: [".f1e48tse{--fui-Persona__avatar--spacing:var(--spacingHorizontalSNudge);}"]
|
105
99
|
});
|
106
100
|
/**
|
107
101
|
* Apply styling to the Persona slots based on the state
|
108
102
|
*/
|
109
|
-
|
110
|
-
|
111
103
|
const usePersonaStyles_unstable = state => {
|
112
104
|
const {
|
113
105
|
presenceOnly,
|
@@ -122,78 +114,69 @@ const usePersonaStyles_unstable = state => {
|
|
122
114
|
} = useTextClassNames(state, alignToPrimary);
|
123
115
|
const styles = useStyles();
|
124
116
|
const avatarSpacingStyles = useAvatarSpacingStyles();
|
125
|
-
const presenceSpacingStyles = {
|
117
|
+
const presenceSpacingStyles = {
|
118
|
+
...avatarSpacingStyles,
|
126
119
|
...usePresenceSpacingStyles()
|
127
120
|
};
|
128
121
|
state.root.className = react_1.mergeClasses(exports.personaClassNames.root, styles.base, styles[textPosition], state.root.className);
|
129
|
-
|
130
122
|
if (state.avatar) {
|
131
123
|
state.avatar.className = react_1.mergeClasses(exports.personaClassNames.avatar, styles.coin, styles[textAlignment], avatarSpacingStyles[size], avatarSpacingStyles[textPosition], state.avatar.className);
|
132
124
|
}
|
133
|
-
|
134
125
|
if (state.presence) {
|
135
126
|
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);
|
136
127
|
}
|
137
|
-
|
138
128
|
if (state.primaryText) {
|
139
129
|
state.primaryText.className = react_1.mergeClasses(exports.personaClassNames.primaryText, primaryTextClassName, state.primaryText.className);
|
140
130
|
}
|
141
|
-
|
142
131
|
if (state.secondaryText) {
|
143
132
|
state.secondaryText.className = react_1.mergeClasses(exports.personaClassNames.secondaryText, optionalTextClassName, state.secondaryText.className);
|
144
133
|
}
|
145
|
-
|
146
134
|
if (state.tertiaryText) {
|
147
135
|
state.tertiaryText.className = react_1.mergeClasses(exports.personaClassNames.tertiaryText, optionalTextClassName, state.tertiaryText.className);
|
148
136
|
}
|
149
|
-
|
150
137
|
if (state.quaternaryText) {
|
151
138
|
state.quaternaryText.className = react_1.mergeClasses(exports.personaClassNames.quaternaryText, optionalTextClassName, state.quaternaryText.className);
|
152
139
|
}
|
153
|
-
|
154
140
|
return state;
|
155
141
|
};
|
156
|
-
|
157
142
|
exports.usePersonaStyles_unstable = usePersonaStyles_unstable;
|
158
|
-
|
159
143
|
const useTextStyles = /*#__PURE__*/react_1.__styles({
|
160
|
-
|
161
|
-
|
162
|
-
},
|
163
|
-
|
164
|
-
|
165
|
-
},
|
166
|
-
|
167
|
-
|
168
|
-
},
|
169
|
-
|
170
|
-
|
171
|
-
},
|
172
|
-
|
173
|
-
|
174
|
-
},
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
},
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
},
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
144
|
+
base: {
|
145
|
+
mc9l5x: "ftgm304"
|
146
|
+
},
|
147
|
+
primaryText: {
|
148
|
+
sj55zd: "f19n0e5"
|
149
|
+
},
|
150
|
+
optionalText: {
|
151
|
+
sj55zd: "fkfq4zb"
|
152
|
+
},
|
153
|
+
beforeAlignToPrimary: {
|
154
|
+
Bw0ie65: "f1warjpf"
|
155
|
+
},
|
156
|
+
afterAlignToPrimary: {
|
157
|
+
Br312pm: "fwu52yu"
|
158
|
+
},
|
159
|
+
body1: {
|
160
|
+
Bahqtrf: "fk6fouc",
|
161
|
+
Be2twd7: "fkhj508",
|
162
|
+
Bhrd7zp: "figsok6",
|
163
|
+
Bg96gwp: "f1i3iumi"
|
164
|
+
},
|
165
|
+
caption1: {
|
166
|
+
Bahqtrf: "fk6fouc",
|
167
|
+
Be2twd7: "fy9rknc",
|
168
|
+
Bhrd7zp: "figsok6",
|
169
|
+
Bg96gwp: "fwrc4pm"
|
170
|
+
},
|
171
|
+
subtitle2: {
|
172
|
+
Bahqtrf: "fk6fouc",
|
173
|
+
Be2twd7: "fod5ikn",
|
174
|
+
Bhrd7zp: "fl43uef",
|
175
|
+
Bg96gwp: "faaz57k"
|
192
176
|
}
|
193
177
|
}, {
|
194
|
-
|
178
|
+
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);}"]
|
195
179
|
});
|
196
|
-
|
197
180
|
const useTextClassNames = (state, alignToPrimary) => {
|
198
181
|
const {
|
199
182
|
presenceOnly,
|
@@ -203,7 +186,6 @@ const useTextClassNames = (state, alignToPrimary) => {
|
|
203
186
|
const textStyles = useTextStyles();
|
204
187
|
let primaryTextSize;
|
205
188
|
let alignToPrimaryClassName;
|
206
|
-
|
207
189
|
if (presenceOnly) {
|
208
190
|
if (size === 'extra-small') {
|
209
191
|
primaryTextSize = state.numTextLines > 1 ? textStyles.body1 : textStyles.caption1;
|
@@ -212,7 +194,6 @@ const useTextClassNames = (state, alignToPrimary) => {
|
|
212
194
|
} else {
|
213
195
|
primaryTextSize = textStyles.body1;
|
214
196
|
}
|
215
|
-
|
216
197
|
if (alignToPrimary) {
|
217
198
|
if (textPosition === 'before') {
|
218
199
|
alignToPrimaryClassName = textStyles.beforeAlignToPrimary;
|
@@ -229,7 +210,6 @@ const useTextClassNames = (state, alignToPrimary) => {
|
|
229
210
|
primaryTextSize = textStyles.body1;
|
230
211
|
}
|
231
212
|
}
|
232
|
-
|
233
213
|
return {
|
234
214
|
primaryTextClassName: react_1.mergeClasses(textStyles.base, textStyles.primaryText, primaryTextSize, alignToPrimaryClassName),
|
235
215
|
optionalTextClassName: react_1.mergeClasses(textStyles.base, textStyles.optionalText, !presenceOnly && size === 'huge' ? textStyles.body1 : textStyles.caption1, alignToPrimaryClassName)
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-persona/src/components/Persona/usePersonaStyles.ts"],"names":[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P;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
|
+
{"version":3,"mappings":";;;;;;AAAA;AACA;AAIaA,yBAAiB,GAAiC;EAC7DC,IAAI,EAAE,aAAa;EACnBC,MAAM,EAAE,qBAAqB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AM,EAAE;MACpDiB,eAAe,GAAGD,UAAU,CAACM,SAAS;KACvC,MAAM;MACLL,eAAe,GAAGD,UAAU,CAACI,KAAK;;IAGpC,IAAIjB,cAAc,EAAE;MAClB,IAAID,YAAY,KAAK,QAAQ,EAAE;QAC7BgB,uBAAuB,GAAGF,UAAU,CAACF,oBAAoB;OAC1D,MAAM,IAAIZ,YAAY,KAAK,OAAO,EAAE;QACnCgB,uBAAuB,GAAGF,UAAU,CAACH,mBAAmB;;;GAG7D,MAAM;IACL,IAAIb,IAAI,KAAK,MAAM,EAAE;MACnBiB,eAAe,GAAGD,UAAU,CAACM,SAAS;KACvC,MAAM,IAAItB,IAAI,KAAK,aAAa,EAAE;MACjCiB,eAAe,GAAGD,UAAU,CAACM,SAAS;KACvC,MAAM;MACLL,eAAe,GAAGD,UAAU,CAACI,KAAK;;;EAItC,OAAO;IACLhB,oBAAoB,EAAEV,oBAAY,CAChCsB,UAAU,CAACL,IAAI,EACfK,UAAU,CAAC5B,WAAW,EACtB6B,eAAe,EACfC,uBAAuB,CACxB;IACDb,qBAAqB,EAAEX,oBAAY,CACjCsB,UAAU,CAACL,IAAI,EACfK,UAAU,CAACO,YAAY,EACvB,CAACxB,YAAY,IAAIC,IAAI,KAAK,MAAM,GAAGgB,UAAU,CAACI,KAAK,GAAGJ,UAAU,CAACK,QAAQ,EACzEH,uBAAuB;GAE1B;AACH,CAAC","names":["exports","root","avatar","presence","primaryText","secondaryText","tertiaryText","quaternaryText","avatarSpacing","useStyles","react_1","useAvatarSpacingStyles","usePresenceSpacingStyles","usePersonaStyles_unstable","state","presenceOnly","size","textAlignment","textPosition","alignToPrimary","primaryTextClassName","optionalTextClassName","useTextClassNames","styles","avatarSpacingStyles","presenceSpacingStyles","className","base","coin","afterAlignToPrimary","beforeAlignToPrimary","useTextStyles","textStyles","primaryTextSize","alignToPrimaryClassName","numTextLines","body1","caption1","subtitle2","optionalText"],"sourceRoot":"../src/","sources":["packages/react-components/react-persona/src/components/Persona/usePersonaStyles.ts"],"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"]}
|
package/lib-commonjs/index.js
CHANGED
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.usePersona_unstable = exports.usePersonaStyles_unstable = exports.renderPersona_unstable = exports.personaClassNames = exports.Persona = void 0;
|
7
|
-
|
8
7
|
var Persona_1 = /*#__PURE__*/require("./Persona");
|
9
|
-
|
10
8
|
Object.defineProperty(exports, "Persona", {
|
11
9
|
enumerable: true,
|
12
10
|
get: function () {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"mappings":";;;;;;AAAA;AACEA;EAAAC;EAAAC;IAAA,wBAAO;EAAA;AAAA;AACPF;EAAAC;EAAAC;IAAA,kCAAiB;EAAA;AAAA;AACjBF;EAAAC;EAAAC;IAAA,uCAAsB;EAAA;AAAA;AACtBF;EAAAC;EAAAC;IAAA,0CAAyB;EAAA;AAAA;AACzBF;EAAAC;EAAAC;IAAA,oCAAmB;EAAA;AAAA","names":["Object","enumerable","get"],"sourceRoot":"../src/","sources":["packages/react-components/react-persona/src/index.ts"],"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"]}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-persona",
|
3
|
-
"version": "9.1.
|
3
|
+
"version": "9.1.1",
|
4
4
|
"description": "React components for building web experiences",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -27,15 +27,15 @@
|
|
27
27
|
"devDependencies": {
|
28
28
|
"@fluentui/eslint-plugin": "*",
|
29
29
|
"@fluentui/react-conformance": "*",
|
30
|
-
"@fluentui/react-conformance-griffel": "9.0.0-beta.
|
31
|
-
"@fluentui/scripts": "
|
30
|
+
"@fluentui/react-conformance-griffel": "9.0.0-beta.19",
|
31
|
+
"@fluentui/scripts": "*"
|
32
32
|
},
|
33
33
|
"dependencies": {
|
34
|
-
"@fluentui/react-avatar": "^9.2.
|
35
|
-
"@fluentui/react-badge": "^9.0.
|
34
|
+
"@fluentui/react-avatar": "^9.2.12",
|
35
|
+
"@fluentui/react-badge": "^9.0.18",
|
36
36
|
"@fluentui/react-theme": "^9.1.5",
|
37
|
-
"@fluentui/react-utilities": "^9.
|
38
|
-
"@griffel/react": "^1.
|
37
|
+
"@fluentui/react-utilities": "^9.4.0",
|
38
|
+
"@griffel/react": "^1.5.2",
|
39
39
|
"tslib": "^2.1.0"
|
40
40
|
},
|
41
41
|
"peerDependencies": {
|
@@ -45,11 +45,9 @@
|
|
45
45
|
"react-dom": ">=16.8.0 <19.0.0"
|
46
46
|
},
|
47
47
|
"beachball": {
|
48
|
-
"tag": "beta",
|
49
48
|
"disallowedChangeTypes": [
|
50
49
|
"major",
|
51
|
-
"
|
52
|
-
"patch"
|
50
|
+
"prerelease"
|
53
51
|
]
|
54
52
|
},
|
55
53
|
"exports": {
|