@fluentui/react-persona 9.1.0-beta.3 → 9.1.0-beta.5
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 +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
package/CHANGELOG.json
CHANGED
@@ -2,7 +2,93 @@
|
|
2
2
|
"name": "@fluentui/react-persona",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
5
|
+
"date": "Mon, 05 Dec 2022 18:25:24 GMT",
|
6
|
+
"tag": "@fluentui/react-persona_v9.1.0-beta.5",
|
7
|
+
"version": "9.1.0-beta.5",
|
8
|
+
"comments": {
|
9
|
+
"prerelease": [
|
10
|
+
{
|
11
|
+
"author": "esteban.230@hotmail.com",
|
12
|
+
"package": "@fluentui/react-persona",
|
13
|
+
"commit": "df99a7d82e3ca707300a079e0050db218d6cfcce",
|
14
|
+
"comment": "chore: Updating Persona's docs to match implementation."
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"author": "tristan.watanabe@gmail.com",
|
18
|
+
"package": "@fluentui/react-persona",
|
19
|
+
"commit": "fafaced9e47597c8ae38d68518887926082986cb",
|
20
|
+
"comment": "chore: Migrate to new package structure."
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"author": "esteban.230@hotmail.com",
|
24
|
+
"package": "@fluentui/react-persona",
|
25
|
+
"commit": "7f4466d1f16a45c6268d540ccd6c088e0c79dfbb",
|
26
|
+
"comment": "fix: Make Persona's text wrap when overflowing its container."
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"author": "beachball",
|
30
|
+
"package": "@fluentui/react-persona",
|
31
|
+
"comment": "Bump @fluentui/react-avatar to v9.2.8",
|
32
|
+
"commit": "4c29542a51bf068e171690cc8e59c14489883912"
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"author": "beachball",
|
36
|
+
"package": "@fluentui/react-persona",
|
37
|
+
"comment": "Bump @fluentui/react-badge to v9.0.14",
|
38
|
+
"commit": "4c29542a51bf068e171690cc8e59c14489883912"
|
39
|
+
},
|
40
|
+
{
|
41
|
+
"author": "beachball",
|
42
|
+
"package": "@fluentui/react-persona",
|
43
|
+
"comment": "Bump @fluentui/react-theme to v9.1.3",
|
44
|
+
"commit": "4c29542a51bf068e171690cc8e59c14489883912"
|
45
|
+
}
|
46
|
+
]
|
47
|
+
}
|
48
|
+
},
|
49
|
+
{
|
50
|
+
"date": "Thu, 17 Nov 2022 23:05:42 GMT",
|
51
|
+
"tag": "@fluentui/react-persona_v9.1.0-beta.4",
|
52
|
+
"version": "9.1.0-beta.4",
|
53
|
+
"comments": {
|
54
|
+
"prerelease": [
|
55
|
+
{
|
56
|
+
"author": "esteban.230@hotmail.com",
|
57
|
+
"package": "@fluentui/react-persona",
|
58
|
+
"commit": "9066dc6a278db9df1fe3a277e66c94c201107d14",
|
59
|
+
"comment": "feat: Adding size and textAlignment props and updating styles."
|
60
|
+
},
|
61
|
+
{
|
62
|
+
"author": "beachball",
|
63
|
+
"package": "@fluentui/react-persona",
|
64
|
+
"comment": "Bump @fluentui/react-avatar to v9.2.7",
|
65
|
+
"commit": "94e156be5d3b5790d82dccf08c32672733fb9335"
|
66
|
+
},
|
67
|
+
{
|
68
|
+
"author": "beachball",
|
69
|
+
"package": "@fluentui/react-persona",
|
70
|
+
"comment": "Bump @fluentui/react-badge to v9.0.13",
|
71
|
+
"commit": "94e156be5d3b5790d82dccf08c32672733fb9335"
|
72
|
+
},
|
73
|
+
{
|
74
|
+
"author": "beachball",
|
75
|
+
"package": "@fluentui/react-persona",
|
76
|
+
"comment": "Bump @fluentui/react-utilities to v9.2.2",
|
77
|
+
"commit": "94e156be5d3b5790d82dccf08c32672733fb9335"
|
78
|
+
}
|
79
|
+
],
|
80
|
+
"none": [
|
81
|
+
{
|
82
|
+
"author": "martinhochel@microsoft.com",
|
83
|
+
"package": "@fluentui/react-persona",
|
84
|
+
"commit": "ea768501802d65d63ddc63fff3816fb6b5008ae4",
|
85
|
+
"comment": "chore: update package scaffold"
|
86
|
+
}
|
87
|
+
]
|
88
|
+
}
|
89
|
+
},
|
90
|
+
{
|
91
|
+
"date": "Fri, 11 Nov 2022 14:58:09 GMT",
|
6
92
|
"tag": "@fluentui/react-persona_v9.1.0-beta.3",
|
7
93
|
"version": "9.1.0-beta.3",
|
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 Mon, 05 Dec 2022 18:25:24 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
+
## [9.1.0-beta.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-persona_v9.1.0-beta.5)
|
8
|
+
|
9
|
+
Mon, 05 Dec 2022 18:25:24 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-persona_v9.1.0-beta.4..@fluentui/react-persona_v9.1.0-beta.5)
|
11
|
+
|
12
|
+
### Changes
|
13
|
+
|
14
|
+
- chore: Updating Persona's docs to match implementation. ([PR #25770](https://github.com/microsoft/fluentui/pull/25770) by esteban.230@hotmail.com)
|
15
|
+
- chore: Migrate to new package structure. ([PR #25737](https://github.com/microsoft/fluentui/pull/25737) by tristan.watanabe@gmail.com)
|
16
|
+
- fix: Make Persona's text wrap when overflowing its container. ([PR #25880](https://github.com/microsoft/fluentui/pull/25880) by esteban.230@hotmail.com)
|
17
|
+
- Bump @fluentui/react-avatar to v9.2.8 ([PR #25798](https://github.com/microsoft/fluentui/pull/25798) by beachball)
|
18
|
+
- Bump @fluentui/react-badge to v9.0.14 ([PR #25798](https://github.com/microsoft/fluentui/pull/25798) by beachball)
|
19
|
+
- Bump @fluentui/react-theme to v9.1.3 ([PR #25798](https://github.com/microsoft/fluentui/pull/25798) by beachball)
|
20
|
+
|
21
|
+
## [9.1.0-beta.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-persona_v9.1.0-beta.4)
|
22
|
+
|
23
|
+
Thu, 17 Nov 2022 23:05:42 GMT
|
24
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-persona_v9.1.0-beta.3..@fluentui/react-persona_v9.1.0-beta.4)
|
25
|
+
|
26
|
+
### Changes
|
27
|
+
|
28
|
+
- feat: Adding size and textAlignment props and updating styles. ([PR #25626](https://github.com/microsoft/fluentui/pull/25626) by esteban.230@hotmail.com)
|
29
|
+
- Bump @fluentui/react-avatar to v9.2.7 ([PR #25683](https://github.com/microsoft/fluentui/pull/25683) by beachball)
|
30
|
+
- Bump @fluentui/react-badge to v9.0.13 ([PR #25683](https://github.com/microsoft/fluentui/pull/25683) by beachball)
|
31
|
+
- Bump @fluentui/react-utilities to v9.2.2 ([PR #25683](https://github.com/microsoft/fluentui/pull/25683) by beachball)
|
32
|
+
|
7
33
|
## [9.1.0-beta.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-persona_v9.1.0-beta.3)
|
8
34
|
|
9
|
-
Fri, 11 Nov 2022 14:
|
35
|
+
Fri, 11 Nov 2022 14:58:09 GMT
|
10
36
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-persona_v9.1.0-beta.2..@fluentui/react-persona_v9.1.0-beta.3)
|
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 = {
|
@@ -58,8 +70,8 @@ export declare type PersonaSlots = {
|
|
58
70
|
/**
|
59
71
|
* The first line of text in the Persona, larger than the rest of the lines.
|
60
72
|
*
|
61
|
-
*
|
62
|
-
*
|
73
|
+
* `primaryText` defaults to the `name` prop. We recomend to only use `name`, use `primaryText` when the text is
|
74
|
+
* different than the `name` prop.
|
63
75
|
*/
|
64
76
|
primaryText?: Slot<'span'>;
|
65
77
|
/**
|
@@ -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 *
|
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 * `primaryText` defaults to the `name` prop. We recomend to only use `name`, use `primaryText` when the text is\n * different than 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/"}
|