@fluentui/react-persona 9.2.3 → 9.2.5
Sign up to get free protection for your applications and to get access to all the features.
- package/.swcrc +30 -0
- package/CHANGELOG.json +85 -1
- package/CHANGELOG.md +29 -2
- 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 +2 -16
- package/lib/components/Persona/renderPersona.js.map +1 -1
- package/lib/components/Persona/usePersona.js +1 -0
- package/lib/components/Persona/usePersona.js.map +1 -1
- package/lib/components/Persona/usePersonaStyles.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib-commonjs/Persona.js +5 -4
- package/lib-commonjs/Persona.js.map +1 -1
- package/lib-commonjs/components/Persona/Persona.js +19 -21
- package/lib-commonjs/components/Persona/Persona.js.map +1 -1
- package/lib-commonjs/components/Persona/Persona.types.js +3 -2
- package/lib-commonjs/components/Persona/Persona.types.js.map +1 -1
- package/lib-commonjs/components/Persona/index.js +9 -8
- package/lib-commonjs/components/Persona/index.js.map +1 -1
- package/lib-commonjs/components/Persona/renderPersona.js +15 -35
- package/lib-commonjs/components/Persona/renderPersona.js.map +1 -1
- package/lib-commonjs/components/Persona/usePersona.js +80 -84
- package/lib-commonjs/components/Persona/usePersona.js.map +1 -1
- package/lib-commonjs/components/Persona/usePersonaStyles.js +252 -208
- package/lib-commonjs/components/Persona/usePersonaStyles.js.map +1 -1
- package/lib-commonjs/index.js +16 -33
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +10 -9
- package/lib-amd/Persona.js +0 -6
- package/lib-amd/Persona.js.map +0 -1
- package/lib-amd/components/Persona/Persona.js +0 -18
- package/lib-amd/components/Persona/Persona.js.map +0 -1
- package/lib-amd/components/Persona/Persona.types.js +0 -5
- package/lib-amd/components/Persona/Persona.types.js.map +0 -1
- package/lib-amd/components/Persona/index.js +0 -10
- package/lib-amd/components/Persona/index.js.map +0 -1
- package/lib-amd/components/Persona/renderPersona.js +0 -24
- package/lib-amd/components/Persona/renderPersona.js.map +0 -1
- package/lib-amd/components/Persona/usePersona.js +0 -84
- package/lib-amd/components/Persona/usePersona.js.map +0 -1
- package/lib-amd/components/Persona/usePersonaStyles.js +0 -191
- package/lib-amd/components/Persona/usePersonaStyles.js.map +0 -1
- package/lib-amd/index.js +0 -11
- package/lib-amd/index.js.map +0 -1
@@ -1,92 +1,88 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "usePersona_unstable", {
|
6
|
+
enumerable: true,
|
7
|
+
get: ()=>usePersona_unstable
|
5
8
|
});
|
6
|
-
|
7
|
-
const
|
8
|
-
const
|
9
|
-
const
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
const
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
}
|
68
|
-
}) : undefined,
|
69
|
-
primaryText,
|
70
|
-
secondaryText,
|
71
|
-
tertiaryText,
|
72
|
-
quaternaryText
|
73
|
-
};
|
9
|
+
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
10
|
+
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
11
|
+
const _reactAvatar = require("@fluentui/react-avatar");
|
12
|
+
const _reactUtilities = require("@fluentui/react-utilities");
|
13
|
+
const _reactBadge = require("@fluentui/react-badge");
|
14
|
+
const usePersona_unstable = (props, ref)=>{
|
15
|
+
const { name , presenceOnly =false , size ='medium' , textAlignment ='start' , textPosition ='after' } = props;
|
16
|
+
const primaryText = (0, _reactUtilities.resolveShorthand)(props.primaryText, {
|
17
|
+
required: true,
|
18
|
+
defaultProps: {
|
19
|
+
children: name
|
20
|
+
}
|
21
|
+
});
|
22
|
+
const secondaryText = (0, _reactUtilities.resolveShorthand)(props.secondaryText);
|
23
|
+
const tertiaryText = (0, _reactUtilities.resolveShorthand)(props.tertiaryText);
|
24
|
+
const quaternaryText = (0, _reactUtilities.resolveShorthand)(props.quaternaryText);
|
25
|
+
const numTextLines = [
|
26
|
+
primaryText,
|
27
|
+
secondaryText,
|
28
|
+
tertiaryText,
|
29
|
+
quaternaryText
|
30
|
+
].filter(Boolean).length;
|
31
|
+
return {
|
32
|
+
numTextLines,
|
33
|
+
presenceOnly,
|
34
|
+
size,
|
35
|
+
textAlignment,
|
36
|
+
textPosition,
|
37
|
+
components: {
|
38
|
+
root: 'div',
|
39
|
+
avatar: _reactAvatar.Avatar,
|
40
|
+
presence: _reactBadge.PresenceBadge,
|
41
|
+
primaryText: 'span',
|
42
|
+
secondaryText: 'span',
|
43
|
+
tertiaryText: 'span',
|
44
|
+
quaternaryText: 'span'
|
45
|
+
},
|
46
|
+
root: (0, _reactUtilities.getNativeElementProps)('div', {
|
47
|
+
...props,
|
48
|
+
ref
|
49
|
+
}, /* excludedPropNames */ [
|
50
|
+
'name'
|
51
|
+
]),
|
52
|
+
avatar: !presenceOnly ? (0, _reactUtilities.resolveShorthand)(props.avatar, {
|
53
|
+
required: true,
|
54
|
+
defaultProps: {
|
55
|
+
name,
|
56
|
+
badge: props.presence,
|
57
|
+
size: avatarSizes[size]
|
58
|
+
}
|
59
|
+
}) : undefined,
|
60
|
+
presence: presenceOnly ? (0, _reactUtilities.resolveShorthand)(props.presence, {
|
61
|
+
defaultProps: {
|
62
|
+
size: presenceSizes[size]
|
63
|
+
}
|
64
|
+
}) : undefined,
|
65
|
+
primaryText,
|
66
|
+
secondaryText,
|
67
|
+
tertiaryText,
|
68
|
+
quaternaryText
|
69
|
+
};
|
74
70
|
};
|
75
|
-
exports.usePersona_unstable = usePersona_unstable;
|
76
71
|
const presenceSizes = {
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
72
|
+
'extra-small': 'tiny',
|
73
|
+
small: 'extra-small',
|
74
|
+
medium: 'small',
|
75
|
+
large: 'medium',
|
76
|
+
'extra-large': 'large',
|
77
|
+
huge: 'large'
|
83
78
|
};
|
84
79
|
const avatarSizes = {
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
};
|
80
|
+
'extra-small': 20,
|
81
|
+
small: 28,
|
82
|
+
medium: 32,
|
83
|
+
large: 36,
|
84
|
+
'extra-large': 40,
|
85
|
+
huge: 56
|
86
|
+
}; //# sourceMappingURL=usePersona.js.map
|
87
|
+
|
92
88
|
//# sourceMappingURL=usePersona.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../../lib/components/Persona/usePersona.js"],"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';\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, ref) => {\n const {\n name,\n presenceOnly = false,\n size = 'medium',\n textAlignment = 'start',\n textPosition = 'after'\n } = props;\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 const numTextLines = [primaryText, secondaryText, tertiaryText, quaternaryText].filter(Boolean).length;\n return {\n numTextLines,\n presenceOnly,\n size,\n textAlignment,\n textPosition,\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 root: getNativeElementProps('div', {\n ...props,\n ref\n }, /* excludedPropNames */['name']),\n avatar: !presenceOnly ? resolveShorthand(props.avatar, {\n required: true,\n defaultProps: {\n name,\n badge: props.presence,\n size: avatarSizes[size]\n }\n }) : undefined,\n presence: presenceOnly ? resolveShorthand(props.presence, {\n defaultProps: {\n size: presenceSizes[size]\n }\n }) : undefined,\n primaryText,\n secondaryText,\n tertiaryText,\n quaternaryText\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};\nconst avatarSizes = {\n 'extra-small': 20,\n small: 28,\n medium: 32,\n large: 36,\n 'extra-large': 40,\n huge: 56\n};\n//# sourceMappingURL=usePersona.js.map"],"names":["usePersona_unstable","props","ref","name","presenceOnly","size","textAlignment","textPosition","primaryText","resolveShorthand","required","defaultProps","children","secondaryText","tertiaryText","quaternaryText","numTextLines","filter","Boolean","length","components","root","avatar","Avatar","presence","PresenceBadge","getNativeElementProps","badge","avatarSizes","undefined","presenceSizes","small","medium","large","huge"],"mappings":";;;;+BAaaA;;aAAAA;;;6DAbU;6BACA;gCACiC;4BAC1B;AAUvB,MAAMA,sBAAsB,CAACC,OAAOC,MAAQ;IACjD,MAAM,EACJC,KAAI,EACJC,cAAe,KAAK,CAAA,EACpBC,MAAO,SAAQ,EACfC,eAAgB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