@fluentui/react-persona 9.1.0-beta.2 → 9.1.0-beta.4
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 +28 -2
- package/dist/index.d.ts +14 -6
- 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 +106 -86
- 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 +106 -86
- package/lib-commonjs/components/Persona/usePersonaStyles.js.map +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +17 -10
package/CHANGELOG.json
CHANGED
@@ -2,7 +2,93 @@
|
|
2
2
|
"name": "@fluentui/react-persona",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
5
|
+
"date": "Thu, 17 Nov 2022 23:02:39 GMT",
|
6
|
+
"tag": "@fluentui/react-persona_v9.1.0-beta.4",
|
7
|
+
"version": "9.1.0-beta.4",
|
8
|
+
"comments": {
|
9
|
+
"prerelease": [
|
10
|
+
{
|
11
|
+
"author": "esteban.230@hotmail.com",
|
12
|
+
"package": "@fluentui/react-persona",
|
13
|
+
"commit": "9066dc6a278db9df1fe3a277e66c94c201107d14",
|
14
|
+
"comment": "feat: Adding size and textAlignment props and updating styles."
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"author": "beachball",
|
18
|
+
"package": "@fluentui/react-persona",
|
19
|
+
"comment": "Bump @fluentui/react-avatar to v9.2.7",
|
20
|
+
"commit": "94e156be5d3b5790d82dccf08c32672733fb9335"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"author": "beachball",
|
24
|
+
"package": "@fluentui/react-persona",
|
25
|
+
"comment": "Bump @fluentui/react-badge to v9.0.13",
|
26
|
+
"commit": "94e156be5d3b5790d82dccf08c32672733fb9335"
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"author": "beachball",
|
30
|
+
"package": "@fluentui/react-persona",
|
31
|
+
"comment": "Bump @fluentui/react-utilities to v9.2.2",
|
32
|
+
"commit": "94e156be5d3b5790d82dccf08c32672733fb9335"
|
33
|
+
}
|
34
|
+
],
|
35
|
+
"none": [
|
36
|
+
{
|
37
|
+
"author": "martinhochel@microsoft.com",
|
38
|
+
"package": "@fluentui/react-persona",
|
39
|
+
"commit": "ea768501802d65d63ddc63fff3816fb6b5008ae4",
|
40
|
+
"comment": "chore: update package scaffold"
|
41
|
+
}
|
42
|
+
]
|
43
|
+
}
|
44
|
+
},
|
45
|
+
{
|
46
|
+
"date": "Fri, 11 Nov 2022 14:58:09 GMT",
|
47
|
+
"tag": "@fluentui/react-persona_v9.1.0-beta.3",
|
48
|
+
"version": "9.1.0-beta.3",
|
49
|
+
"comments": {
|
50
|
+
"prerelease": [
|
51
|
+
{
|
52
|
+
"author": "martinhochel@microsoft.com",
|
53
|
+
"package": "@fluentui/react-persona",
|
54
|
+
"commit": "b3907043bd8d7b650c55e8e7c3119b14f2606c38",
|
55
|
+
"comment": "fix: create valid export maps"
|
56
|
+
},
|
57
|
+
{
|
58
|
+
"author": "beachball",
|
59
|
+
"package": "@fluentui/react-persona",
|
60
|
+
"comment": "Bump @fluentui/react-avatar to v9.2.6",
|
61
|
+
"commit": "b4c9a0ae8d7444bf746f1307ab01e2dc16310720"
|
62
|
+
},
|
63
|
+
{
|
64
|
+
"author": "beachball",
|
65
|
+
"package": "@fluentui/react-persona",
|
66
|
+
"comment": "Bump @fluentui/react-badge to v9.0.12",
|
67
|
+
"commit": "b4c9a0ae8d7444bf746f1307ab01e2dc16310720"
|
68
|
+
},
|
69
|
+
{
|
70
|
+
"author": "beachball",
|
71
|
+
"package": "@fluentui/react-persona",
|
72
|
+
"comment": "Bump @fluentui/react-theme to v9.1.2",
|
73
|
+
"commit": "b4c9a0ae8d7444bf746f1307ab01e2dc16310720"
|
74
|
+
},
|
75
|
+
{
|
76
|
+
"author": "beachball",
|
77
|
+
"package": "@fluentui/react-persona",
|
78
|
+
"comment": "Bump @fluentui/react-utilities to v9.2.1",
|
79
|
+
"commit": "b4c9a0ae8d7444bf746f1307ab01e2dc16310720"
|
80
|
+
},
|
81
|
+
{
|
82
|
+
"author": "beachball",
|
83
|
+
"package": "@fluentui/react-persona",
|
84
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.18",
|
85
|
+
"commit": "b4c9a0ae8d7444bf746f1307ab01e2dc16310720"
|
86
|
+
}
|
87
|
+
]
|
88
|
+
}
|
89
|
+
},
|
90
|
+
{
|
91
|
+
"date": "Wed, 02 Nov 2022 11:57:56 GMT",
|
6
92
|
"tag": "@fluentui/react-persona_v9.1.0-beta.2",
|
7
93
|
"version": "9.1.0-beta.2",
|
8
94
|
"comments": {
|
package/CHANGELOG.md
CHANGED
@@ -1,12 +1,38 @@
|
|
1
1
|
# Change Log - @fluentui/react-persona
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Thu, 17 Nov 2022 23:02:39 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
+
## [9.1.0-beta.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-persona_v9.1.0-beta.4)
|
8
|
+
|
9
|
+
Thu, 17 Nov 2022 23:02:39 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-persona_v9.1.0-beta.3..@fluentui/react-persona_v9.1.0-beta.4)
|
11
|
+
|
12
|
+
### Changes
|
13
|
+
|
14
|
+
- feat: Adding size and textAlignment props and updating styles. ([PR #25626](https://github.com/microsoft/fluentui/pull/25626) by esteban.230@hotmail.com)
|
15
|
+
- Bump @fluentui/react-avatar to v9.2.7 ([PR #25683](https://github.com/microsoft/fluentui/pull/25683) by beachball)
|
16
|
+
- Bump @fluentui/react-badge to v9.0.13 ([PR #25683](https://github.com/microsoft/fluentui/pull/25683) by beachball)
|
17
|
+
- Bump @fluentui/react-utilities to v9.2.2 ([PR #25683](https://github.com/microsoft/fluentui/pull/25683) by beachball)
|
18
|
+
|
19
|
+
## [9.1.0-beta.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-persona_v9.1.0-beta.3)
|
20
|
+
|
21
|
+
Fri, 11 Nov 2022 14:58:09 GMT
|
22
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-persona_v9.1.0-beta.2..@fluentui/react-persona_v9.1.0-beta.3)
|
23
|
+
|
24
|
+
### Changes
|
25
|
+
|
26
|
+
- fix: create valid export maps ([PR #25558](https://github.com/microsoft/fluentui/pull/25558) by martinhochel@microsoft.com)
|
27
|
+
- Bump @fluentui/react-avatar to v9.2.6 ([PR #25615](https://github.com/microsoft/fluentui/pull/25615) by beachball)
|
28
|
+
- Bump @fluentui/react-badge to v9.0.12 ([PR #25615](https://github.com/microsoft/fluentui/pull/25615) by beachball)
|
29
|
+
- Bump @fluentui/react-theme to v9.1.2 ([PR #25615](https://github.com/microsoft/fluentui/pull/25615) by beachball)
|
30
|
+
- Bump @fluentui/react-utilities to v9.2.1 ([PR #25615](https://github.com/microsoft/fluentui/pull/25615) by beachball)
|
31
|
+
- Bump @fluentui/react-conformance-griffel to v9.0.0-beta.18 ([PR #25615](https://github.com/microsoft/fluentui/pull/25615) by beachball)
|
32
|
+
|
7
33
|
## [9.1.0-beta.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-persona_v9.1.0-beta.2)
|
8
34
|
|
9
|
-
Wed, 02 Nov 2022 11:
|
35
|
+
Wed, 02 Nov 2022 11:57:56 GMT
|
10
36
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-persona_v9.1.0-beta.1..@fluentui/react-persona_v9.1.0-beta.2)
|
11
37
|
|
12
38
|
### Changes
|
package/dist/index.d.ts
CHANGED
@@ -33,12 +33,24 @@ export declare type PersonaProps = ComponentProps<PersonaSlots> & {
|
|
33
33
|
* @default false
|
34
34
|
*/
|
35
35
|
presenceOnly?: boolean;
|
36
|
+
/**
|
37
|
+
* The size of a Persona and its text.
|
38
|
+
*
|
39
|
+
* @default medium
|
40
|
+
*/
|
41
|
+
size?: 'extra-small' | 'small' | 'medium' | 'large' | 'extra-large' | 'huge';
|
36
42
|
/**
|
37
43
|
* The position of the text relative to the avatar/presence.
|
38
44
|
*
|
39
45
|
* @default after
|
40
46
|
*/
|
41
|
-
textPosition?: '
|
47
|
+
textPosition?: 'after' | 'before' | 'below';
|
48
|
+
/**
|
49
|
+
* The vertical alignment of the text relative to the avatar/presence.
|
50
|
+
*
|
51
|
+
* @default start
|
52
|
+
*/
|
53
|
+
textAlignment?: 'center' | 'start';
|
42
54
|
};
|
43
55
|
|
44
56
|
export declare type PersonaSlots = {
|
@@ -79,11 +91,7 @@ export declare type PersonaSlots = {
|
|
79
91
|
/**
|
80
92
|
* State used in rendering Persona
|
81
93
|
*/
|
82
|
-
export declare type PersonaState = ComponentState<PersonaSlots> & Required<Pick<PersonaProps, '
|
83
|
-
/**
|
84
|
-
* Whether the sizing type is fixed or not.
|
85
|
-
*/
|
86
|
-
fixed: boolean;
|
94
|
+
export declare type PersonaState = ComponentState<PersonaSlots> & Required<Pick<PersonaProps, 'presenceOnly' | 'size' | 'textAlignment' | 'textPosition'>> & {
|
87
95
|
/**
|
88
96
|
* The number of text lines used.
|
89
97
|
*/
|
package/lib/Persona.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Persona.js","sourceRoot":"../src/","sources":["Persona.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC","sourcesContent":["export * from './components/Persona/index';\n"]}
|
1
|
+
{"version":3,"file":"Persona.js","sourceRoot":"../src/","sources":["packages/react-components/react-persona/src/Persona.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC","sourcesContent":["export * from './components/Persona/index';\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/Persona/Persona.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,sBAAT,QAAuC,iBAAvC;AACA,SAAS,mBAAT,QAAoC,cAApC;AACA,SAAS,yBAAT,QAA0C,oBAA1C;AAIA;;;AAGG;;AACH,OAAO,MAAM,OAAO,gBAAsC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EACxF,MAAM,KAAK,GAAG,mBAAmB,CAAC,KAAD,EAAQ,GAAR,CAAjC;EAEA,yBAAyB,CAAC,KAAD,CAAzB;EACA,OAAO,sBAAsB,CAAC,KAAD,CAA7B;AACD,CALyD,CAAnD;AAOP,OAAO,CAAC,WAAR,GAAsB,SAAtB","sourcesContent":["import * as React from 'react';\nimport { renderPersona_unstable } from './renderPersona';\nimport { usePersona_unstable } from './usePersona';\nimport { usePersonaStyles_unstable } from './usePersonaStyles';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport type { PersonaProps } from './Persona.types';\n\n/**\n * A Persona is a visual representation of a person or status that showcases an Avatar, PresenceBadge,\n * or an Avatar with a PresenceBadge.\n */\nexport const Persona: ForwardRefComponent<PersonaProps> = React.forwardRef((props, ref) => {\n const state = usePersona_unstable(props, ref);\n\n usePersonaStyles_unstable(state);\n return renderPersona_unstable(state);\n});\n\nPersona.displayName = 'Persona';\n"],"sourceRoot":"../src/"}
|
1
|
+
{"version":3,"sources":["packages/react-components/react-persona/src/components/Persona/Persona.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,sBAAT,QAAuC,iBAAvC;AACA,SAAS,mBAAT,QAAoC,cAApC;AACA,SAAS,yBAAT,QAA0C,oBAA1C;AAIA;;;AAGG;;AACH,OAAO,MAAM,OAAO,gBAAsC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EACxF,MAAM,KAAK,GAAG,mBAAmB,CAAC,KAAD,EAAQ,GAAR,CAAjC;EAEA,yBAAyB,CAAC,KAAD,CAAzB;EACA,OAAO,sBAAsB,CAAC,KAAD,CAA7B;AACD,CALyD,CAAnD;AAOP,OAAO,CAAC,WAAR,GAAsB,SAAtB","sourcesContent":["import * as React from 'react';\nimport { renderPersona_unstable } from './renderPersona';\nimport { usePersona_unstable } from './usePersona';\nimport { usePersonaStyles_unstable } from './usePersonaStyles';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport type { PersonaProps } from './Persona.types';\n\n/**\n * A Persona is a visual representation of a person or status that showcases an Avatar, PresenceBadge,\n * or an Avatar with a PresenceBadge.\n */\nexport const Persona: ForwardRefComponent<PersonaProps> = React.forwardRef((props, ref) => {\n const state = usePersona_unstable(props, ref);\n\n usePersonaStyles_unstable(state);\n return renderPersona_unstable(state);\n});\n\nPersona.displayName = 'Persona';\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Persona.types.js","sourceRoot":"../src/","sources":["components/Persona/Persona.types.ts"],"names":[],"mappings":"","sourcesContent":["import { Avatar } from '@fluentui/react-avatar';\nimport { PresenceBadge } from '@fluentui/react-badge';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type PersonaSlots = {\n root: NonNullable<Slot<'div'>>;\n\n /**\n * Avatar to display.\n *\n * If a PresenceBadge and an Avatar are provided, the Avatar will display the PresenceBadge as its presence.\n */\n avatar?: Slot<typeof Avatar>;\n\n /**\n * PresenceBadge to display.\n *\n * If `presenceOnly` is true, the PresenceBadge will be displayed instead of the Avatar.\n */\n presence?: Slot<typeof PresenceBadge>;\n\n /**\n * The first line of text in the Persona, larger than the rest of the lines.\n *\n * This defaults to the `name` prop, and it is recomended that you only set its value if it should be different from\n * from the `name` prop.\n */\n primaryText?: Slot<'span'>;\n\n /**\n * The second line of text in the Persona.\n */\n secondaryText?: Slot<'span'>;\n\n /**\n * The third line of text in the Persona.\n */\n tertiaryText?: Slot<'span'>;\n\n /**\n * The fourth line of text in the Persona.\n */\n quaternaryText?: Slot<'span'>;\n};\n\n/**\n * Persona Props\n */\nexport type PersonaProps = ComponentProps<PersonaSlots> & {\n /**\n * The name of the person or entity represented by the Persona.\n *\n * When `primaryText` is not provided, this will be used as the default value for `primaryText`.\n */\n name?: string;\n\n /**\n * Whether to display only the presence.\n *\n * @default false\n */\n presenceOnly?: boolean;\n\n /**\n * The position of the text relative to the avatar/presence.\n *\n * @default after\n */\n textPosition?: '
|
1
|
+
{"version":3,"file":"Persona.types.js","sourceRoot":"../src/","sources":["packages/react-components/react-persona/src/components/Persona/Persona.types.ts"],"names":[],"mappings":"","sourcesContent":["import { Avatar } from '@fluentui/react-avatar';\nimport { PresenceBadge } from '@fluentui/react-badge';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type PersonaSlots = {\n root: NonNullable<Slot<'div'>>;\n\n /**\n * Avatar to display.\n *\n * If a PresenceBadge and an Avatar are provided, the Avatar will display the PresenceBadge as its presence.\n */\n avatar?: Slot<typeof Avatar>;\n\n /**\n * PresenceBadge to display.\n *\n * If `presenceOnly` is true, the PresenceBadge will be displayed instead of the Avatar.\n */\n presence?: Slot<typeof PresenceBadge>;\n\n /**\n * The first line of text in the Persona, larger than the rest of the lines.\n *\n * This defaults to the `name` prop, and it is recomended that you only set its value if it should be different from\n * from the `name` prop.\n */\n primaryText?: Slot<'span'>;\n\n /**\n * The second line of text in the Persona.\n */\n secondaryText?: Slot<'span'>;\n\n /**\n * The third line of text in the Persona.\n */\n tertiaryText?: Slot<'span'>;\n\n /**\n * The fourth line of text in the Persona.\n */\n quaternaryText?: Slot<'span'>;\n};\n\n/**\n * Persona Props\n */\nexport type PersonaProps = ComponentProps<PersonaSlots> & {\n /**\n * The name of the person or entity represented by the Persona.\n *\n * When `primaryText` is not provided, this will be used as the default value for `primaryText`.\n */\n name?: string;\n\n /**\n * Whether to display only the presence.\n *\n * @default false\n */\n presenceOnly?: boolean;\n\n /**\n * The size of a Persona and its text.\n *\n * @default medium\n */\n size?: 'extra-small' | 'small' | 'medium' | 'large' | 'extra-large' | 'huge';\n\n /**\n * The position of the text relative to the avatar/presence.\n *\n * @default after\n */\n textPosition?: 'after' | 'before' | 'below';\n\n /**\n * The vertical alignment of the text relative to the avatar/presence.\n *\n * @default start\n */\n textAlignment?: 'center' | 'start';\n};\n\n/**\n * State used in rendering Persona\n */\nexport type PersonaState = ComponentState<PersonaSlots> &\n Required<Pick<PersonaProps, 'presenceOnly' | 'size' | 'textAlignment' | 'textPosition'>> & {\n /**\n * The number of text lines used.\n */\n numTextLines: number;\n };\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/Persona/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC","sourcesContent":["export * from './Persona';\nexport * from './Persona.types';\nexport * from './renderPersona';\nexport * from './usePersona';\nexport * from './usePersonaStyles';\n"]}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["packages/react-components/react-persona/src/components/Persona/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC","sourcesContent":["export * from './Persona';\nexport * from './Persona.types';\nexport * from './renderPersona';\nexport * from './usePersona';\nexport * from './usePersonaStyles';\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/Persona/renderPersona.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,MAAM,sBAAsB,GAAI,KAAD,IAAwB;EAC5D,MAAM;IAAE,YAAF;IAAgB;EAAhB,IAAiC,KAAvC;EACA,MAAM;IAAE,KAAF;IAAS;EAAT,IAAuB,QAAQ,CAAe,KAAf,CAArC;EAEA,MAAM,IAAI,GAAG,YAAY,GACrB,KAAK,CAAC,QAAN,iBAAkB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,QAAP,EAAe,EAAA,GAAK,SAAS,CAAC;EAAf,CAAf,CADG,GAErB,KAAK,CAAC,MAAN,iBAAgB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,MAAP,EAAa,EAAA,GAAK,SAAS,CAAC;EAAf,CAAb,CAFpB;EAIA,oBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;EAAf,CAAX,EACG,CAAC,YAAY,KAAK,OAAjB,IAA4B,YAAY,KAAK,OAA9C,KAA0D,IAD7D,EAEG,KAAK,CAAC,WAAN,iBAAqB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,WAAP,EAAkB,EAAA,GAAK,SAAS,CAAC;EAAf,CAAlB,CAFxB,EAGG,KAAK,CAAC,aAAN,iBAAuB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,aAAP,EAAoB,EAAA,GAAK,SAAS,CAAC;EAAf,CAApB,CAH1B,EAIG,KAAK,CAAC,YAAN,iBAAsB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,YAAP,EAAmB,EAAA,GAAK,SAAS,CAAC;EAAf,CAAnB,CAJzB,EAKG,KAAK,CAAC,cAAN,iBAAwB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,cAAP,EAAqB,EAAA,GAAK,SAAS,CAAC;EAAf,CAArB,CAL3B,EAMG,YAAY,KAAK,QAAjB,IAA6B,IANhC,CADF;AAUD,CAlBM","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { PersonaState, PersonaSlots } from './Persona.types';\n\n/**\n * Render the final JSX of Persona\n */\nexport const renderPersona_unstable = (state: PersonaState) => {\n const { presenceOnly, textPosition } = state;\n const { slots, slotProps } = getSlots<PersonaSlots>(state);\n\n const coin = presenceOnly\n ? slots.presence && <slots.presence {...slotProps.presence} />\n : slots.avatar && <slots.avatar {...slotProps.avatar} />;\n\n return (\n <slots.root {...slotProps.root}>\n {(textPosition === 'after' || textPosition === 'below') && coin}\n {slots.primaryText && <slots.primaryText {...slotProps.primaryText} />}\n {slots.secondaryText && <slots.secondaryText {...slotProps.secondaryText} />}\n {slots.tertiaryText && <slots.tertiaryText {...slotProps.tertiaryText} />}\n {slots.quaternaryText && <slots.quaternaryText {...slotProps.quaternaryText} />}\n {textPosition === 'before' && coin}\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
|
1
|
+
{"version":3,"sources":["packages/react-components/react-persona/src/components/Persona/renderPersona.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,MAAM,sBAAsB,GAAI,KAAD,IAAwB;EAC5D,MAAM;IAAE,YAAF;IAAgB;EAAhB,IAAiC,KAAvC;EACA,MAAM;IAAE,KAAF;IAAS;EAAT,IAAuB,QAAQ,CAAe,KAAf,CAArC;EAEA,MAAM,IAAI,GAAG,YAAY,GACrB,KAAK,CAAC,QAAN,iBAAkB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,QAAP,EAAe,EAAA,GAAK,SAAS,CAAC;EAAf,CAAf,CADG,GAErB,KAAK,CAAC,MAAN,iBAAgB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,MAAP,EAAa,EAAA,GAAK,SAAS,CAAC;EAAf,CAAb,CAFpB;EAIA,oBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;EAAf,CAAX,EACG,CAAC,YAAY,KAAK,OAAjB,IAA4B,YAAY,KAAK,OAA9C,KAA0D,IAD7D,EAEG,KAAK,CAAC,WAAN,iBAAqB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,WAAP,EAAkB,EAAA,GAAK,SAAS,CAAC;EAAf,CAAlB,CAFxB,EAGG,KAAK,CAAC,aAAN,iBAAuB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,aAAP,EAAoB,EAAA,GAAK,SAAS,CAAC;EAAf,CAApB,CAH1B,EAIG,KAAK,CAAC,YAAN,iBAAsB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,YAAP,EAAmB,EAAA,GAAK,SAAS,CAAC;EAAf,CAAnB,CAJzB,EAKG,KAAK,CAAC,cAAN,iBAAwB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,cAAP,EAAqB,EAAA,GAAK,SAAS,CAAC;EAAf,CAArB,CAL3B,EAMG,YAAY,KAAK,QAAjB,IAA6B,IANhC,CADF;AAUD,CAlBM","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { PersonaState, PersonaSlots } from './Persona.types';\n\n/**\n * Render the final JSX of Persona\n */\nexport const renderPersona_unstable = (state: PersonaState) => {\n const { presenceOnly, textPosition } = state;\n const { slots, slotProps } = getSlots<PersonaSlots>(state);\n\n const coin = presenceOnly\n ? slots.presence && <slots.presence {...slotProps.presence} />\n : slots.avatar && <slots.avatar {...slotProps.avatar} />;\n\n return (\n <slots.root {...slotProps.root}>\n {(textPosition === 'after' || textPosition === 'below') && coin}\n {slots.primaryText && <slots.primaryText {...slotProps.primaryText} />}\n {slots.secondaryText && <slots.secondaryText {...slotProps.secondaryText} />}\n {slots.tertiaryText && <slots.tertiaryText {...slotProps.tertiaryText} />}\n {slots.quaternaryText && <slots.quaternaryText {...slotProps.quaternaryText} />}\n {textPosition === 'before' && coin}\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
|
@@ -13,9 +13,11 @@ import { PresenceBadge } from '@fluentui/react-badge';
|
|
13
13
|
|
14
14
|
export const usePersona_unstable = (props, ref) => {
|
15
15
|
const {
|
16
|
+
name,
|
16
17
|
presenceOnly = false,
|
17
|
-
|
18
|
-
|
18
|
+
size = 'medium',
|
19
|
+
textAlignment = 'start',
|
20
|
+
textPosition = 'after'
|
19
21
|
} = props;
|
20
22
|
const primaryText = resolveShorthand(props.primaryText, {
|
21
23
|
required: true,
|
@@ -27,54 +29,11 @@ export const usePersona_unstable = (props, ref) => {
|
|
27
29
|
const tertiaryText = resolveShorthand(props.tertiaryText);
|
28
30
|
const quaternaryText = resolveShorthand(props.quaternaryText);
|
29
31
|
const numTextLines = [primaryText, secondaryText, tertiaryText, quaternaryText].filter(Boolean).length;
|
30
|
-
let fixed = false;
|
31
|
-
|
32
|
-
if (!presenceOnly && props.avatar) {
|
33
|
-
fixed = !!props.avatar.size;
|
34
|
-
} else if (props.presence && props.presence) {
|
35
|
-
fixed = !!props.presence.size;
|
36
|
-
}
|
37
|
-
|
38
|
-
let avatarSize = undefined;
|
39
|
-
let presenceSize = undefined;
|
40
|
-
|
41
|
-
if (presenceOnly && !fixed) {
|
42
|
-
if (numTextLines === 1) {
|
43
|
-
presenceSize = 'small';
|
44
|
-
} else if (numTextLines === 2) {
|
45
|
-
presenceSize = 'large';
|
46
|
-
} else {
|
47
|
-
presenceSize = 'extra-large';
|
48
|
-
}
|
49
|
-
} else if (!fixed) {
|
50
|
-
if (numTextLines === 1) {
|
51
|
-
avatarSize = 16;
|
52
|
-
} else if (numTextLines === 2) {
|
53
|
-
avatarSize = 32;
|
54
|
-
} else if (numTextLines === 3) {
|
55
|
-
avatarSize = 56;
|
56
|
-
} else {
|
57
|
-
avatarSize = 72;
|
58
|
-
}
|
59
|
-
}
|
60
|
-
|
61
|
-
const avatar = !presenceOnly ? resolveShorthand(props.avatar, {
|
62
|
-
required: true,
|
63
|
-
defaultProps: {
|
64
|
-
name,
|
65
|
-
badge: props.presence,
|
66
|
-
size: avatarSize
|
67
|
-
}
|
68
|
-
}) : undefined;
|
69
|
-
const presence = presenceOnly ? resolveShorthand(props.presence, {
|
70
|
-
defaultProps: {
|
71
|
-
size: presenceSize
|
72
|
-
}
|
73
|
-
}) : undefined;
|
74
32
|
return {
|
75
|
-
fixed,
|
76
33
|
numTextLines,
|
77
34
|
presenceOnly,
|
35
|
+
size,
|
36
|
+
textAlignment,
|
78
37
|
textPosition,
|
79
38
|
components: {
|
80
39
|
root: 'div',
|
@@ -90,12 +49,39 @@ export const usePersona_unstable = (props, ref) => {
|
|
90
49
|
},
|
91
50
|
/* excludedPropNames */
|
92
51
|
['name']),
|
93
|
-
avatar,
|
94
|
-
|
52
|
+
avatar: !presenceOnly ? resolveShorthand(props.avatar, {
|
53
|
+
required: true,
|
54
|
+
defaultProps: {
|
55
|
+
name,
|
56
|
+
badge: props.presence,
|
57
|
+
size: avatarSizes[size]
|
58
|
+
}
|
59
|
+
}) : undefined,
|
60
|
+
presence: presenceOnly ? resolveShorthand(props.presence, {
|
61
|
+
defaultProps: {
|
62
|
+
size: presenceSizes[size]
|
63
|
+
}
|
64
|
+
}) : undefined,
|
95
65
|
primaryText,
|
96
66
|
secondaryText,
|
97
67
|
tertiaryText,
|
98
68
|
quaternaryText
|
99
69
|
};
|
100
70
|
};
|
71
|
+
const presenceSizes = {
|
72
|
+
'extra-small': 'tiny',
|
73
|
+
small: 'extra-small',
|
74
|
+
medium: 'small',
|
75
|
+
large: 'medium',
|
76
|
+
'extra-large': 'large',
|
77
|
+
huge: 'large'
|
78
|
+
};
|
79
|
+
const avatarSizes = {
|
80
|
+
'extra-small': 20,
|
81
|
+
small: 28,
|
82
|
+
medium: 32,
|
83
|
+
large: 36,
|
84
|
+
'extra-large': 40,
|
85
|
+
huge: 56
|
86
|
+
};
|
101
87
|
//# sourceMappingURL=usePersona.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/Persona/usePersona.ts"],"names":[],"mappings":"AACA,SAAS,MAAT,QAAuB,wBAAvB;AACA,SAAS,qBAAT,EAAgC,gBAAhC,QAAwD,2BAAxD;AACA,SAAS,aAAT,QAA8B,uBAA9B;
|
1
|
+
{"version":3,"sources":["packages/react-components/react-persona/src/components/Persona/usePersona.ts"],"names":[],"mappings":"AACA,SAAS,MAAT,QAAuB,wBAAvB;AACA,SAAS,qBAAT,EAAgC,gBAAhC,QAAwD,2BAAxD;AACA,SAAS,aAAT,QAA8B,uBAA9B;AAGA;;;;;;;;AAQG;;AACH,OAAO,MAAM,mBAAmB,GAAG,CAAC,KAAD,EAAsB,GAAtB,KAAmE;EACpG,MAAM;IAAE,IAAF;IAAQ,YAAY,GAAG,KAAvB;IAA8B,IAAI,GAAG,QAArC;IAA+C,aAAa,GAAG,OAA/D;IAAwE,YAAY,GAAG;EAAvF,IAAmG,KAAzG;EAEA,MAAM,WAAW,GAAG,gBAAgB,CAAC,KAAK,CAAC,WAAP,EAAoB;IACtD,QAAQ,EAAE,IAD4C;IAEtD,YAAY,EAAE;MACZ,QAAQ,EAAE;IADE;EAFwC,CAApB,CAApC;EAMA,MAAM,aAAa,GAAG,gBAAgB,CAAC,KAAK,CAAC,aAAP,CAAtC;EACA,MAAM,YAAY,GAAG,gBAAgB,CAAC,KAAK,CAAC,YAAP,CAArC;EACA,MAAM,cAAc,GAAG,gBAAgB,CAAC,KAAK,CAAC,cAAP,CAAvC;EAEA,MAAM,YAAY,GAAG,CAAC,WAAD,EAAc,aAAd,EAA6B,YAA7B,EAA2C,cAA3C,EAA2D,MAA3D,CAAkE,OAAlE,EAA2E,MAAhG;EAEA,OAAO;IACL,YADK;IAEL,YAFK;IAGL,IAHK;IAIL,aAJK;IAKL,YALK;IAOL,UAAU,EAAE;MACV,IAAI,EAAE,KADI;MAEV,MAAM,EAAE,MAFE;MAGV,QAAQ,EAAE,aAHA;MAIV,WAAW,EAAE,MAJH;MAKV,aAAa,EAAE,MALL;MAMV,YAAY,EAAE,MANJ;MAOV,cAAc,EAAE;IAPN,CAPP;IAiBL,IAAI,EAAE,qBAAqB,CACzB,KADyB,EAEzB,EACE,GAAG,KADL;MAEE;IAFF,CAFyB;IAMzB;IAAwB,CAAC,MAAD,CANC,CAjBtB;IAyBL,MAAM,EAAE,CAAC,YAAD,GACJ,gBAAgB,CAAC,KAAK,CAAC,MAAP,EAAe;MAC7B,QAAQ,EAAE,IADmB;MAE7B,YAAY,EAAE;QACZ,IADY;QAEZ,KAAK,EAAE,KAAK,CAAC,QAFD;QAGZ,IAAI,EAAE,WAAW,CAAC,IAAD;MAHL;IAFe,CAAf,CADZ,GASJ,SAlCC;IAmCL,QAAQ,EAAE,YAAY,GAClB,gBAAgB,CAAC,KAAK,CAAC,QAAP,EAAiB;MAC/B,YAAY,EAAE;QACZ,IAAI,EAAE,aAAa,CAAC,IAAD;MADP;IADiB,CAAjB,CADE,GAMlB,SAzCC;IA0CL,WA1CK;IA2CL,aA3CK;IA4CL,YA5CK;IA6CL;EA7CK,CAAP;AA+CD,CA9DM;AAgEP,MAAM,aAAa,GAAG;EACpB,eAAe,MADK;EAEpB,KAAK,EAAE,aAFa;EAGpB,MAAM,EAAE,OAHY;EAIpB,KAAK,EAAE,QAJa;EAKpB,eAAe,OALK;EAMpB,IAAI,EAAE;AANc,CAAtB;AASA,MAAM,WAAW,GAAG;EAClB,eAAe,EADG;EAElB,KAAK,EAAE,EAFW;EAGlB,MAAM,EAAE,EAHU;EAIlB,KAAK,EAAE,EAJW;EAKlB,eAAe,EALG;EAMlB,IAAI,EAAE;AANY,CAApB","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"],"sourceRoot":"../src/"}
|
@@ -9,25 +9,24 @@ export const personaClassNames = {
|
|
9
9
|
tertiaryText: 'fui-Persona__tertiaryText',
|
10
10
|
quaternaryText: 'fui-Persona__quaternaryText'
|
11
11
|
};
|
12
|
+
const avatarSpacing = `--fui-Persona__avatar--spacing`;
|
12
13
|
/**
|
13
14
|
* Styles for the root slot
|
14
15
|
*/
|
15
16
|
|
16
17
|
const useStyles = /*#__PURE__*/__styles({
|
17
|
-
"
|
18
|
+
"base": {
|
18
19
|
"mc9l5x": "fwk3njj",
|
19
20
|
"t4k1zu": "f4wu0r3",
|
20
21
|
"v29qe6": "fvtn1bl"
|
21
22
|
},
|
22
23
|
"after": {
|
23
24
|
"Bxotwcr": "f1u07yai",
|
24
|
-
"B7hvi0a": "f1m2n5bn"
|
25
|
-
"i8kkvl": "f4px1ci"
|
25
|
+
"B7hvi0a": "f1m2n5bn"
|
26
26
|
},
|
27
27
|
"before": {
|
28
28
|
"Bxotwcr": "f1u07yai",
|
29
|
-
"B7hvi0a": "f1tll2w5"
|
30
|
-
"i8kkvl": "f4px1ci"
|
29
|
+
"B7hvi0a": "f1tll2w5"
|
31
30
|
},
|
32
31
|
"below": {
|
33
32
|
"B7hvi0a": "f1oiokrs"
|
@@ -35,14 +34,67 @@ const useStyles = /*#__PURE__*/__styles({
|
|
35
34
|
"coin": {
|
36
35
|
"Ijaq50": "f1hek2iy"
|
37
36
|
},
|
38
|
-
"
|
37
|
+
"start": {
|
39
38
|
"qb2dma": "f9h729m"
|
40
39
|
},
|
41
|
-
"
|
40
|
+
"center": {
|
42
41
|
"qb2dma": "f7nlbp4"
|
42
|
+
},
|
43
|
+
"alignToPrimary": {
|
44
|
+
"Budl1dq": "fv2o0x6"
|
45
|
+
},
|
46
|
+
"afterAlignToPrimary": {
|
47
|
+
"qb2dma": "f7nlbp4",
|
48
|
+
"Ijaq50": "f1rnkkuc",
|
49
|
+
"Bw0ie65": "f1warjpf"
|
50
|
+
},
|
51
|
+
"beforeAlignToPrimary": {
|
52
|
+
"qb2dma": "f7nlbp4",
|
53
|
+
"Ijaq50": "f1rnkkuc",
|
54
|
+
"Br312pm": "fwu52yu"
|
55
|
+
}
|
56
|
+
}, {
|
57
|
+
"d": [".fwk3njj{display:inline-grid;}", ".f4wu0r3{grid-auto-columns:max-content;}", ".fvtn1bl{grid-auto-rows:max-content;}", ".f1u07yai{grid-auto-flow:column;}", ".f1m2n5bn{justify-items:start;}", ".f1tll2w5{justify-items:end;}", ".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;}", ".fv2o0x6{grid-template-columns:max-content [middle] max-content;}", ".f1rnkkuc{grid-row-start:unset;}", ".f1warjpf{grid-column-end:middle;}", ".fwu52yu{grid-column-start:middle;}"]
|
58
|
+
});
|
59
|
+
|
60
|
+
const useAvatarSpacingStyles = /*#__PURE__*/__styles({
|
61
|
+
"extra-small": {
|
62
|
+
"Bs1gm4r": "f1e48tse"
|
63
|
+
},
|
64
|
+
"small": {
|
65
|
+
"Bs1gm4r": "f18q9vkd"
|
66
|
+
},
|
67
|
+
"medium": {
|
68
|
+
"Bs1gm4r": "f18q9vkd"
|
69
|
+
},
|
70
|
+
"large": {
|
71
|
+
"Bs1gm4r": "fx34bi6"
|
72
|
+
},
|
73
|
+
"extra-large": {
|
74
|
+
"Bs1gm4r": "fx34bi6"
|
75
|
+
},
|
76
|
+
"huge": {
|
77
|
+
"Bs1gm4r": "f1o96qtm"
|
78
|
+
},
|
79
|
+
"after": {
|
80
|
+
"t21cq0": ["f103ycu4", "f1tao51"]
|
81
|
+
},
|
82
|
+
"below": {
|
83
|
+
"jrapky": "fbo7acy"
|
84
|
+
},
|
85
|
+
"before": {
|
86
|
+
"Frg6f3": ["f1tao51", "f103ycu4"]
|
87
|
+
}
|
88
|
+
}, {
|
89
|
+
"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);}"]
|
90
|
+
});
|
91
|
+
|
92
|
+
const usePresenceSpacingStyles = /*#__PURE__*/__styles({
|
93
|
+
"small": {
|
94
|
+
"Bs1gm4r": "f1e48tse"
|
43
95
|
}
|
44
96
|
}, {
|
45
|
-
"d": [".
|
97
|
+
"d": [".f1e48tse{--fui-Persona__avatar--spacing:var(--spacingHorizontalSNudge);}"]
|
46
98
|
});
|
47
99
|
/**
|
48
100
|
* Apply styling to the Persona slots based on the state
|
@@ -51,22 +103,28 @@ const useStyles = /*#__PURE__*/__styles({
|
|
51
103
|
|
52
104
|
export const usePersonaStyles_unstable = state => {
|
53
105
|
const {
|
54
|
-
|
106
|
+
size,
|
107
|
+
textAlignment,
|
55
108
|
textPosition
|
56
109
|
} = state;
|
57
|
-
const
|
110
|
+
const alignToPrimary = textAlignment === 'start' && size !== 'extra-large' && size !== 'huge';
|
58
111
|
const {
|
59
112
|
primaryTextClassName,
|
60
113
|
optionalTextClassName
|
61
|
-
} = useTextClassNames(state);
|
62
|
-
|
114
|
+
} = useTextClassNames(state, alignToPrimary);
|
115
|
+
const styles = useStyles();
|
116
|
+
const avatarSpacingStyles = useAvatarSpacingStyles();
|
117
|
+
const presenceSpacingStyles = { ...avatarSpacingStyles,
|
118
|
+
...usePresenceSpacingStyles()
|
119
|
+
};
|
120
|
+
state.root.className = mergeClasses(personaClassNames.root, styles.base, styles[textPosition], textPosition !== 'below' && alignToPrimary && styles.alignToPrimary, state.root.className);
|
63
121
|
|
64
122
|
if (state.avatar) {
|
65
|
-
state.avatar.className = mergeClasses(personaClassNames.avatar, styles.coin,
|
123
|
+
state.avatar.className = mergeClasses(personaClassNames.avatar, styles.coin, styles[textAlignment], avatarSpacingStyles[size], avatarSpacingStyles[textPosition], state.avatar.className);
|
66
124
|
}
|
67
125
|
|
68
126
|
if (state.presence) {
|
69
|
-
state.presence.className = mergeClasses(personaClassNames.presence, styles.coin,
|
127
|
+
state.presence.className = mergeClasses(personaClassNames.presence, styles.coin, styles[textAlignment], presenceSpacingStyles[size], presenceSpacingStyles[textPosition], textPosition === 'after' && alignToPrimary && styles.afterAlignToPrimary, textPosition === 'before' && alignToPrimary && styles.beforeAlignToPrimary, state.presence.className);
|
70
128
|
}
|
71
129
|
|
72
130
|
if (state.primaryText) {
|
@@ -98,6 +156,12 @@ const useTextStyles = /*#__PURE__*/__styles({
|
|
98
156
|
"optionalText": {
|
99
157
|
"sj55zd": "fkfq4zb"
|
100
158
|
},
|
159
|
+
"beforeAlignToPrimary": {
|
160
|
+
"Bw0ie65": "f1warjpf"
|
161
|
+
},
|
162
|
+
"afterAlignToPrimary": {
|
163
|
+
"Br312pm": "fwu52yu"
|
164
|
+
},
|
101
165
|
"body1": {
|
102
166
|
"Bahqtrf": "fk6fouc",
|
103
167
|
"Be2twd7": "fkhj508",
|
@@ -115,94 +179,50 @@ const useTextStyles = /*#__PURE__*/__styles({
|
|
115
179
|
"Be2twd7": "fod5ikn",
|
116
180
|
"Bhrd7zp": "fl43uef",
|
117
181
|
"Bg96gwp": "faaz57k"
|
118
|
-
},
|
119
|
-
"subtitle1": {
|
120
|
-
"Bahqtrf": "fk6fouc",
|
121
|
-
"Be2twd7": "f1pp30po",
|
122
|
-
"Bhrd7zp": "fl43uef",
|
123
|
-
"Bg96gwp": "f106mvju"
|
124
|
-
},
|
125
|
-
"title2": {
|
126
|
-
"Bahqtrf": "fk6fouc",
|
127
|
-
"Be2twd7": "fojgt09",
|
128
|
-
"Bhrd7zp": "fl43uef",
|
129
|
-
"Bg96gwp": "fcen8rp"
|
130
|
-
},
|
131
|
-
"title3": {
|
132
|
-
"Bahqtrf": "fk6fouc",
|
133
|
-
"Be2twd7": "f1x0m3f5",
|
134
|
-
"Bhrd7zp": "fl43uef",
|
135
|
-
"Bg96gwp": "fb86gi6"
|
136
182
|
}
|
137
183
|
}, {
|
138
|
-
"d": [".ftgm304{display:block;}", ".f19n0e5{color:var(--colorNeutralForeground1);}", ".fkfq4zb{color:var(--colorNeutralForeground2);}", ".
|
184
|
+
"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);}"]
|
139
185
|
});
|
140
186
|
|
141
|
-
const useTextClassNames = state => {
|
187
|
+
const useTextClassNames = (state, alignToPrimary) => {
|
142
188
|
const {
|
143
|
-
|
144
|
-
|
145
|
-
|
189
|
+
presenceOnly,
|
190
|
+
size,
|
191
|
+
textPosition
|
146
192
|
} = state;
|
147
193
|
const textStyles = useTextStyles();
|
148
194
|
let primaryTextSize;
|
149
|
-
let
|
150
|
-
|
151
|
-
if (
|
152
|
-
if (
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
} else if (
|
164
|
-
|
165
|
-
optionalTextSize = textStyles.caption1;
|
166
|
-
} else {
|
167
|
-
if (numTextLines > 1) {
|
168
|
-
primaryTextSize = textStyles.title3;
|
169
|
-
} else {
|
170
|
-
primaryTextSize = textStyles.title2;
|
171
|
-
}
|
172
|
-
|
173
|
-
optionalTextSize = textStyles.body1;
|
174
|
-
}
|
175
|
-
} else if (presenceOnly && state.presence) {
|
176
|
-
const {
|
177
|
-
size
|
178
|
-
} = state.presence;
|
179
|
-
|
180
|
-
if (size === 'extra-small' || size === 'tiny') {
|
181
|
-
if (numTextLines > 1) {
|
182
|
-
primaryTextSize = textStyles.body1;
|
183
|
-
} else {
|
184
|
-
primaryTextSize = textStyles.caption1;
|
185
|
-
}
|
186
|
-
|
187
|
-
optionalTextSize = textStyles.caption1;
|
188
|
-
} else {
|
189
|
-
primaryTextSize = textStyles.body1;
|
190
|
-
optionalTextSize = textStyles.caption1;
|
195
|
+
let alignToPrimaryClassName;
|
196
|
+
|
197
|
+
if (presenceOnly) {
|
198
|
+
if (size === 'extra-small') {
|
199
|
+
primaryTextSize = state.numTextLines > 1 ? textStyles.body1 : textStyles.caption1;
|
200
|
+
} else if (size === 'extra-large' || size === 'huge') {
|
201
|
+
primaryTextSize = textStyles.subtitle2;
|
202
|
+
} else {
|
203
|
+
primaryTextSize = textStyles.body1;
|
204
|
+
}
|
205
|
+
|
206
|
+
if (alignToPrimary) {
|
207
|
+
if (textPosition === 'before') {
|
208
|
+
alignToPrimaryClassName = textStyles.beforeAlignToPrimary;
|
209
|
+
} else if (textPosition === 'after') {
|
210
|
+
alignToPrimaryClassName = textStyles.afterAlignToPrimary;
|
191
211
|
}
|
192
212
|
}
|
193
213
|
} else {
|
194
|
-
if (
|
195
|
-
primaryTextSize = textStyles.
|
214
|
+
if (size === 'huge') {
|
215
|
+
primaryTextSize = textStyles.subtitle2;
|
216
|
+
} else if (size === 'extra-large') {
|
217
|
+
primaryTextSize = textStyles.subtitle2;
|
196
218
|
} else {
|
197
|
-
primaryTextSize = textStyles.
|
219
|
+
primaryTextSize = textStyles.body1;
|
198
220
|
}
|
199
|
-
|
200
|
-
optionalTextSize = textStyles.caption1;
|
201
221
|
}
|
202
222
|
|
203
223
|
return {
|
204
|
-
primaryTextClassName: mergeClasses(textStyles.base, textStyles.primaryText, primaryTextSize),
|
205
|
-
optionalTextClassName: mergeClasses(textStyles.base, textStyles.optionalText,
|
224
|
+
primaryTextClassName: mergeClasses(textStyles.base, textStyles.primaryText, primaryTextSize, alignToPrimaryClassName),
|
225
|
+
optionalTextClassName: mergeClasses(textStyles.base, textStyles.optionalText, !presenceOnly && size === 'huge' ? textStyles.body1 : textStyles.caption1, alignToPrimaryClassName)
|
206
226
|
};
|
207
227
|
};
|
208
228
|
//# sourceMappingURL=usePersonaStyles.js.map
|