@fluentui/react-persona 9.0.0 → 9.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,73 @@
|
|
|
2
2
|
"name": "@fluentui/react-persona",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Thu, 13 Oct 2022 12:55:52 GMT",
|
|
6
|
+
"tag": "@fluentui/react-persona_v9.0.2",
|
|
7
|
+
"version": "9.0.2",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "beachball",
|
|
12
|
+
"package": "@fluentui/react-persona",
|
|
13
|
+
"comment": "Bump @fluentui/react-avatar to v9.2.2",
|
|
14
|
+
"commit": "e563f3daaea9b7cc62f50bc15edd44edf5045107"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"date": "Thu, 13 Oct 2022 11:02:55 GMT",
|
|
21
|
+
"tag": "@fluentui/react-persona_v9.0.1",
|
|
22
|
+
"version": "9.0.1",
|
|
23
|
+
"comments": {
|
|
24
|
+
"patch": [
|
|
25
|
+
{
|
|
26
|
+
"author": "olfedias@microsoft.com",
|
|
27
|
+
"package": "@fluentui/react-persona",
|
|
28
|
+
"commit": "1a527d440e0497ef8046b3ce240492241e7a04ac",
|
|
29
|
+
"comment": "chore: Update Griffel to latest version"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"author": "esteban.230@hotmail.com",
|
|
33
|
+
"package": "@fluentui/react-persona",
|
|
34
|
+
"commit": "0b45dbb1df893c61086b5de4f312f7258d3d8fd7",
|
|
35
|
+
"comment": "chore: Add unit and conformance tests."
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"author": "esteban.230@hotmail.com",
|
|
39
|
+
"package": "@fluentui/react-persona",
|
|
40
|
+
"commit": "67a8c98b8d53cd2fa14d668cf639b867b68ad18a",
|
|
41
|
+
"comment": "chore: Adding bundle-size command for bundle-size fixtures."
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"author": "beachball",
|
|
45
|
+
"package": "@fluentui/react-persona",
|
|
46
|
+
"comment": "Bump @fluentui/react-avatar to v9.2.1",
|
|
47
|
+
"commit": "cd05c21e62ff37812d614330eb70f97fd978c97a"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"author": "beachball",
|
|
51
|
+
"package": "@fluentui/react-persona",
|
|
52
|
+
"comment": "Bump @fluentui/react-badge to v9.0.8",
|
|
53
|
+
"commit": "cd05c21e62ff37812d614330eb70f97fd978c97a"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"author": "beachball",
|
|
57
|
+
"package": "@fluentui/react-persona",
|
|
58
|
+
"comment": "Bump @fluentui/react-utilities to v9.1.1",
|
|
59
|
+
"commit": "cd05c21e62ff37812d614330eb70f97fd978c97a"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"author": "beachball",
|
|
63
|
+
"package": "@fluentui/react-persona",
|
|
64
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.15",
|
|
65
|
+
"commit": "cd05c21e62ff37812d614330eb70f97fd978c97a"
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"date": "Mon, 03 Oct 2022 22:24:38 GMT",
|
|
6
72
|
"tag": "@fluentui/react-persona_v9.0.0",
|
|
7
73
|
"version": "9.0.0",
|
|
8
74
|
"comments": {
|
|
@@ -25,13 +91,13 @@
|
|
|
25
91
|
"author": "beachball",
|
|
26
92
|
"package": "@fluentui/react-persona",
|
|
27
93
|
"comment": "Bump @fluentui/react-avatar to v9.2.0",
|
|
28
|
-
"commit": "
|
|
94
|
+
"commit": "67a8c98b8d53cd2fa14d668cf639b867b68ad18a"
|
|
29
95
|
},
|
|
30
96
|
{
|
|
31
97
|
"author": "beachball",
|
|
32
98
|
"package": "@fluentui/react-persona",
|
|
33
99
|
"comment": "Bump @fluentui/react-badge to v9.0.7",
|
|
34
|
-
"commit": "
|
|
100
|
+
"commit": "67a8c98b8d53cd2fa14d668cf639b867b68ad18a"
|
|
35
101
|
}
|
|
36
102
|
]
|
|
37
103
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,19 +1,43 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-persona
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Thu, 13 Oct 2022 12:55:52 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.0.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-persona_v9.0.2)
|
|
8
|
+
|
|
9
|
+
Thu, 13 Oct 2022 12:55:52 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-persona_v9.0.1..@fluentui/react-persona_v9.0.2)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- Bump @fluentui/react-avatar to v9.2.2 ([PR #25112](https://github.com/microsoft/fluentui/pull/25112) by beachball)
|
|
15
|
+
|
|
16
|
+
## [9.0.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-persona_v9.0.1)
|
|
17
|
+
|
|
18
|
+
Thu, 13 Oct 2022 11:02:55 GMT
|
|
19
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-persona_v9.0.0..@fluentui/react-persona_v9.0.1)
|
|
20
|
+
|
|
21
|
+
### Patches
|
|
22
|
+
|
|
23
|
+
- chore: Update Griffel to latest version ([PR #25075](https://github.com/microsoft/fluentui/pull/25075) by olfedias@microsoft.com)
|
|
24
|
+
- chore: Add unit and conformance tests. ([PR #25007](https://github.com/microsoft/fluentui/pull/25007) by esteban.230@hotmail.com)
|
|
25
|
+
- chore: Adding bundle-size command for bundle-size fixtures. ([PR #25055](https://github.com/microsoft/fluentui/pull/25055) by esteban.230@hotmail.com)
|
|
26
|
+
- Bump @fluentui/react-avatar to v9.2.1 ([PR #25181](https://github.com/microsoft/fluentui/pull/25181) by beachball)
|
|
27
|
+
- Bump @fluentui/react-badge to v9.0.8 ([PR #25181](https://github.com/microsoft/fluentui/pull/25181) by beachball)
|
|
28
|
+
- Bump @fluentui/react-utilities to v9.1.1 ([PR #25181](https://github.com/microsoft/fluentui/pull/25181) by beachball)
|
|
29
|
+
- Bump @fluentui/react-conformance-griffel to v9.0.0-beta.15 ([PR #25181](https://github.com/microsoft/fluentui/pull/25181) by beachball)
|
|
30
|
+
|
|
7
31
|
## [9.0.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-persona_v9.0.0)
|
|
8
32
|
|
|
9
|
-
Mon, 03 Oct 2022 22:
|
|
33
|
+
Mon, 03 Oct 2022 22:24:38 GMT
|
|
10
34
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-persona_v9.0.0-alpha.0..@fluentui/react-persona_v9.0.0)
|
|
11
35
|
|
|
12
36
|
### Minor changes
|
|
13
37
|
|
|
14
38
|
- feat: Publishing package. ([PR #25008](https://github.com/microsoft/fluentui/pull/25008) by esteban.230@hotmail.com)
|
|
15
|
-
- Bump @fluentui/react-avatar to v9.2.0 ([PR #
|
|
16
|
-
- Bump @fluentui/react-badge to v9.0.7 ([PR #
|
|
39
|
+
- Bump @fluentui/react-avatar to v9.2.0 ([PR #25055](https://github.com/microsoft/fluentui/pull/25055) by beachball)
|
|
40
|
+
- Bump @fluentui/react-badge to v9.0.7 ([PR #25055](https://github.com/microsoft/fluentui/pull/25055) by beachball)
|
|
17
41
|
|
|
18
42
|
### Patches
|
|
19
43
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/Persona/usePersona.ts"],"names":[],"mappings":"AACA,SAAS,MAAT,
|
|
1
|
+
{"version":3,"sources":["components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,aA3BK;IA4BL,YA5BK;IA6BL;EA7BK,CAAP;AA+BD,CA9FM","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 { AvatarProps } from '@fluentui/react-avatar';\nimport type { PersonaProps, PersonaState } from './Persona.types';\nimport type { PresenceBadgeProps } from '@fluentui/react-badge';\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 { presenceOnly = false, textPosition = 'after', name } = 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 let fixed = false;\n if (!presenceOnly && props.avatar) {\n fixed = !!(props.avatar as AvatarProps).size;\n } else if (props.presence && props.presence) {\n fixed = !!(props.presence as PresenceBadgeProps).size;\n }\n\n let avatarSize: AvatarProps['size'] = undefined;\n let presenceSize: PresenceBadgeProps['size'] = undefined;\n if (presenceOnly && !fixed) {\n if (numTextLines === 1) {\n presenceSize = 'small';\n } else if (numTextLines === 2) {\n presenceSize = 'large';\n } else {\n presenceSize = 'extra-large';\n }\n } else if (!fixed) {\n if (numTextLines === 1) {\n avatarSize = 16;\n } else if (numTextLines === 2) {\n avatarSize = 32;\n } else if (numTextLines === 3) {\n avatarSize = 56;\n } else {\n avatarSize = 72;\n }\n }\n\n const avatar: PersonaState['avatar'] = !presenceOnly\n ? resolveShorthand(props.avatar, {\n required: true,\n defaultProps: {\n name,\n badge: props.presence,\n size: avatarSize,\n },\n })\n : undefined;\n\n const presence: PersonaState['presence'] = presenceOnly\n ? resolveShorthand(props.presence, {\n defaultProps: {\n size: presenceSize,\n },\n })\n : undefined;\n\n return {\n fixed,\n numTextLines,\n presenceOnly,\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,\n presence,\n primaryText,\n secondaryText,\n tertiaryText,\n quaternaryText,\n };\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/Persona/usePersona.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,cAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;
|
|
1
|
+
{"version":3,"sources":["components/Persona/usePersona.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,cAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;AAKA;;;;;;;;AAQG;;;AACI,MAAM,mBAAmB,GAAG,CAAC,KAAD,EAAsB,GAAtB,KAAmE;EACpG,MAAM;IAAE,YAAY,GAAG,KAAjB;IAAwB,YAAY,GAAG,OAAvC;IAAgD;EAAhD,IAAyD,KAA/D;EAEA,MAAM,WAAW,GAAG,iBAAA,CAAA,gBAAA,CAAiB,KAAK,CAAC,WAAvB,EAAoC;IACtD,QAAQ,EAAE,IAD4C;IAEtD,YAAY,EAAE;MACZ,QAAQ,EAAE;IADE;EAFwC,C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IACD;EACF;;EAED,MAAM,MAAM,GAA2B,CAAC,YAAD,GACnC,iBAAA,CAAA,gBAAA,CAAiB,KAAK,CAAC,MAAvB,EAA+B;IAC7B,QAAQ,EAAE,IADmB;IAE7B,YAAY,EAAE;MACZ,IADY;MAEZ,KAAK,EAAE,KAAK,CAAC,QAFD;MAGZ,IAAI,EAAE;IAHM;EAFe,CAA/B,CADmC,GASnC,SATJ;EAWA,MAAM,QAAQ,GAA6B,YAAY,GACnD,iBAAA,CAAA,gBAAA,CAAiB,KAAK,CAAC,QAAvB,EAAiC;IAC/B,YAAY,EAAE;MACZ,IAAI,EAAE;IADM;EADiB,CAAjC,CADmD,GAMnD,SANJ;EAQA,OAAO;IACL,KADK;IAEL,YAFK;IAGL,YAHK;IAIL,YAJK;IAML,UAAU,EAAE;MACV,IAAI,EAAE,KADI;MAEV,MAAM,EAAE,cAAA,CAAA,MAFE;MAGV,QAAQ,EAAE,aAAA,CAAA,aAHA;MAIV,WAAW,EAAE,MAJH;MAKV,aAAa,EAAE,MALL;MAMV,YAAY,EAAE,MANJ;MAOV,cAAc,EAAE;IAPN,CANP;IAgBL,IAAI,EAAE,iBAAA,CAAA,qBAAA,CACJ,KADI,EAEJ,EACE,GAAG,KADL;MAEE;IAFF,CAFI;IAMJ;IAAwB,CAAC,MAAD,CANpB,CAhBD;IAwBL,MAxBK;IAyBL,QAzBK;IA0BL,WA1BK;IA2BL,aA3BK;IA4BL,YA5BK;IA6BL;EA7BK,CAAP;AA+BD,CA9FM;;AAAM,OAAA,CAAA,mBAAA,GAAmB,mBAAnB","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 { AvatarProps } from '@fluentui/react-avatar';\nimport type { PersonaProps, PersonaState } from './Persona.types';\nimport type { PresenceBadgeProps } from '@fluentui/react-badge';\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 { presenceOnly = false, textPosition = 'after', name } = 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 let fixed = false;\n if (!presenceOnly && props.avatar) {\n fixed = !!(props.avatar as AvatarProps).size;\n } else if (props.presence && props.presence) {\n fixed = !!(props.presence as PresenceBadgeProps).size;\n }\n\n let avatarSize: AvatarProps['size'] = undefined;\n let presenceSize: PresenceBadgeProps['size'] = undefined;\n if (presenceOnly && !fixed) {\n if (numTextLines === 1) {\n presenceSize = 'small';\n } else if (numTextLines === 2) {\n presenceSize = 'large';\n } else {\n presenceSize = 'extra-large';\n }\n } else if (!fixed) {\n if (numTextLines === 1) {\n avatarSize = 16;\n } else if (numTextLines === 2) {\n avatarSize = 32;\n } else if (numTextLines === 3) {\n avatarSize = 56;\n } else {\n avatarSize = 72;\n }\n }\n\n const avatar: PersonaState['avatar'] = !presenceOnly\n ? resolveShorthand(props.avatar, {\n required: true,\n defaultProps: {\n name,\n badge: props.presence,\n size: avatarSize,\n },\n })\n : undefined;\n\n const presence: PersonaState['presence'] = presenceOnly\n ? resolveShorthand(props.presence, {\n defaultProps: {\n size: presenceSize,\n },\n })\n : undefined;\n\n return {\n fixed,\n numTextLines,\n presenceOnly,\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,\n presence,\n primaryText,\n secondaryText,\n tertiaryText,\n quaternaryText,\n };\n};\n"],"sourceRoot":"../src/"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-persona",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.2",
|
|
4
4
|
"description": "React components for building web experiences",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"scripts": {
|
|
15
15
|
"build": "just-scripts build",
|
|
16
|
+
"bundle-size": "bundle-size measure",
|
|
16
17
|
"clean": "just-scripts clean",
|
|
17
18
|
"code-style": "just-scripts code-style",
|
|
18
19
|
"just": "just-scripts",
|
|
@@ -27,15 +28,15 @@
|
|
|
27
28
|
"devDependencies": {
|
|
28
29
|
"@fluentui/eslint-plugin": "*",
|
|
29
30
|
"@fluentui/react-conformance": "*",
|
|
30
|
-
"@fluentui/react-conformance-griffel": "9.0.0-beta.
|
|
31
|
+
"@fluentui/react-conformance-griffel": "9.0.0-beta.15",
|
|
31
32
|
"@fluentui/scripts": "^1.0.0"
|
|
32
33
|
},
|
|
33
34
|
"dependencies": {
|
|
34
|
-
"@fluentui/react-avatar": "^9.2.
|
|
35
|
-
"@fluentui/react-badge": "^9.0.
|
|
35
|
+
"@fluentui/react-avatar": "^9.2.2",
|
|
36
|
+
"@fluentui/react-badge": "^9.0.8",
|
|
36
37
|
"@fluentui/react-theme": "^9.1.0",
|
|
37
|
-
"@fluentui/react-utilities": "^9.1.
|
|
38
|
-
"@griffel/react": "^1.
|
|
38
|
+
"@fluentui/react-utilities": "^9.1.1",
|
|
39
|
+
"@griffel/react": "^1.4.0",
|
|
39
40
|
"tslib": "^2.1.0"
|
|
40
41
|
},
|
|
41
42
|
"peerDependencies": {
|