@fluentui/react-persona 9.2.4 → 9.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. package/.swcrc +30 -0
  2. package/CHANGELOG.json +58 -1
  3. package/CHANGELOG.md +18 -2
  4. package/lib/Persona.js.map +1 -1
  5. package/lib/components/Persona/Persona.js.map +1 -1
  6. package/lib/components/Persona/Persona.types.js.map +1 -1
  7. package/lib/components/Persona/index.js.map +1 -1
  8. package/lib/components/Persona/renderPersona.js +2 -16
  9. package/lib/components/Persona/renderPersona.js.map +1 -1
  10. package/lib/components/Persona/usePersona.js +1 -0
  11. package/lib/components/Persona/usePersona.js.map +1 -1
  12. package/lib/components/Persona/usePersonaStyles.js.map +1 -1
  13. package/lib/index.js.map +1 -1
  14. package/lib-commonjs/Persona.js +5 -4
  15. package/lib-commonjs/Persona.js.map +1 -1
  16. package/lib-commonjs/components/Persona/Persona.js +19 -21
  17. package/lib-commonjs/components/Persona/Persona.js.map +1 -1
  18. package/lib-commonjs/components/Persona/Persona.types.js +3 -2
  19. package/lib-commonjs/components/Persona/Persona.types.js.map +1 -1
  20. package/lib-commonjs/components/Persona/index.js +9 -8
  21. package/lib-commonjs/components/Persona/index.js.map +1 -1
  22. package/lib-commonjs/components/Persona/renderPersona.js +15 -35
  23. package/lib-commonjs/components/Persona/renderPersona.js.map +1 -1
  24. package/lib-commonjs/components/Persona/usePersona.js +80 -84
  25. package/lib-commonjs/components/Persona/usePersona.js.map +1 -1
  26. package/lib-commonjs/components/Persona/usePersonaStyles.js +252 -208
  27. package/lib-commonjs/components/Persona/usePersonaStyles.js.map +1 -1
  28. package/lib-commonjs/index.js +16 -33
  29. package/lib-commonjs/index.js.map +1 -1
  30. package/package.json +10 -9
  31. package/lib-amd/Persona.js +0 -6
  32. package/lib-amd/Persona.js.map +0 -1
  33. package/lib-amd/components/Persona/Persona.js +0 -18
  34. package/lib-amd/components/Persona/Persona.js.map +0 -1
  35. package/lib-amd/components/Persona/Persona.types.js +0 -5
  36. package/lib-amd/components/Persona/Persona.types.js.map +0 -1
  37. package/lib-amd/components/Persona/index.js +0 -10
  38. package/lib-amd/components/Persona/index.js.map +0 -1
  39. package/lib-amd/components/Persona/renderPersona.js +0 -24
  40. package/lib-amd/components/Persona/renderPersona.js.map +0 -1
  41. package/lib-amd/components/Persona/usePersona.js +0 -84
  42. package/lib-amd/components/Persona/usePersona.js.map +0 -1
  43. package/lib-amd/components/Persona/usePersonaStyles.js +0 -191
  44. package/lib-amd/components/Persona/usePersonaStyles.js.map +0 -1
  45. package/lib-amd/index.js +0 -11
  46. package/lib-amd/index.js.map +0 -1
@@ -1,92 +1,88 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "usePersona_unstable", {
6
+ enumerable: true,
7
+ get: ()=>usePersona_unstable
5
8
  });
6
- exports.usePersona_unstable = void 0;
7
- const react_avatar_1 = /*#__PURE__*/require("@fluentui/react-avatar");
8
- const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
9
- const react_badge_1 = /*#__PURE__*/require("@fluentui/react-badge");
10
- /**
11
- * Create the state required to render Persona.
12
- *
13
- * The returned state can be modified with hooks such as usePersonaStyles_unstable,
14
- * before being passed to renderPersona_unstable.
15
- *
16
- * @param props - props from this instance of Persona
17
- * @param ref - reference to root HTMLElement of Persona
18
- */
19
- const usePersona_unstable = (props, ref) => {
20
- const {
21
- name,
22
- presenceOnly = false,
23
- size = 'medium',
24
- textAlignment = 'start',
25
- textPosition = 'after'
26
- } = props;
27
- const primaryText = react_utilities_1.resolveShorthand(props.primaryText, {
28
- required: true,
29
- defaultProps: {
30
- children: name
31
- }
32
- });
33
- const secondaryText = react_utilities_1.resolveShorthand(props.secondaryText);
34
- const tertiaryText = react_utilities_1.resolveShorthand(props.tertiaryText);
35
- const quaternaryText = react_utilities_1.resolveShorthand(props.quaternaryText);
36
- const numTextLines = [primaryText, secondaryText, tertiaryText, quaternaryText].filter(Boolean).length;
37
- return {
38
- numTextLines,
39
- presenceOnly,
40
- size,
41
- textAlignment,
42
- textPosition,
43
- components: {
44
- root: 'div',
45
- avatar: react_avatar_1.Avatar,
46
- presence: react_badge_1.PresenceBadge,
47
- primaryText: 'span',
48
- secondaryText: 'span',
49
- tertiaryText: 'span',
50
- quaternaryText: 'span'
51
- },
52
- root: react_utilities_1.getNativeElementProps('div', {
53
- ...props,
54
- ref
55
- }, /* excludedPropNames */['name']),
56
- avatar: !presenceOnly ? react_utilities_1.resolveShorthand(props.avatar, {
57
- required: true,
58
- defaultProps: {
59
- name,
60
- badge: props.presence,
61
- size: avatarSizes[size]
62
- }
63
- }) : undefined,
64
- presence: presenceOnly ? react_utilities_1.resolveShorthand(props.presence, {
65
- defaultProps: {
66
- size: presenceSizes[size]
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
- 'extra-small': 'tiny',
78
- small: 'extra-small',
79
- medium: 'small',
80
- large: 'medium',
81
- 'extra-large': 'large',
82
- huge: 'large'
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
- 'extra-small': 20,
86
- small: 28,
87
- medium: 32,
88
- large: 36,
89
- 'extra-large': 40,
90
- huge: 56
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,"names":["react_avatar_1","require","react_utilities_1","react_badge_1","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","exports","small","medium","large","huge"],"sources":["../src/packages/react-components/react-persona/src/components/Persona/usePersona.ts"],"sourcesContent":["import * as React from 'react';\nimport { Avatar } from '@fluentui/react-avatar';\nimport { getNativeElementProps, resolveShorthand } from '@fluentui/react-utilities';\nimport { PresenceBadge } from '@fluentui/react-badge';\nimport type { PersonaProps, PersonaState } from './Persona.types';\n\n/**\n * Create the state required to render Persona.\n *\n * The returned state can be modified with hooks such as usePersonaStyles_unstable,\n * before being passed to renderPersona_unstable.\n *\n * @param props - props from this instance of Persona\n * @param ref - reference to root HTMLElement of Persona\n */\nexport const usePersona_unstable = (props: PersonaProps, ref: React.Ref<HTMLElement>): PersonaState => {\n const { name, presenceOnly = false, size = 'medium', textAlignment = 'start', textPosition = 'after' } = props;\n\n const primaryText = resolveShorthand(props.primaryText, {\n required: true,\n defaultProps: {\n children: name,\n },\n });\n const secondaryText = resolveShorthand(props.secondaryText);\n const tertiaryText = resolveShorthand(props.tertiaryText);\n const quaternaryText = resolveShorthand(props.quaternaryText);\n\n const numTextLines = [primaryText, secondaryText, tertiaryText, quaternaryText].filter(Boolean).length;\n\n return {\n numTextLines,\n presenceOnly,\n size,\n textAlignment,\n textPosition,\n\n components: {\n root: 'div',\n avatar: Avatar,\n presence: PresenceBadge,\n primaryText: 'span',\n secondaryText: 'span',\n tertiaryText: 'span',\n quaternaryText: 'span',\n },\n\n root: getNativeElementProps(\n 'div',\n {\n ...props,\n ref,\n },\n /* excludedPropNames */ ['name'],\n ),\n avatar: !presenceOnly\n ? resolveShorthand(props.avatar, {\n required: true,\n defaultProps: {\n name,\n badge: props.presence,\n size: avatarSizes[size],\n },\n })\n : undefined,\n presence: presenceOnly\n ? resolveShorthand(props.presence, {\n defaultProps: {\n size: presenceSizes[size],\n },\n })\n : undefined,\n primaryText,\n secondaryText,\n tertiaryText,\n quaternaryText,\n };\n};\n\nconst presenceSizes = {\n 'extra-small': 'tiny',\n small: 'extra-small',\n medium: 'small',\n large: 'medium',\n 'extra-large': 'large',\n huge: 'large',\n} as const;\n\nconst avatarSizes = {\n 'extra-small': 20,\n small: 28,\n medium: 32,\n large: 36,\n 'extra-large': 40,\n huge: 56,\n} as const;\n"],"mappings":";;;;;;AACA,MAAAA,cAAA,gBAAAC,OAAA;AACA,MAAAC,iBAAA,gBAAAD,OAAA;AACA,MAAAE,aAAA,gBAAAF,OAAA;AAGA;;;;;;;;;AASO,MAAMG,mBAAmB,GAAGA,CAACC,KAAmB,EAAEC,GAA2B,KAAkB;EACpG,MAAM;IAAEC,IAAI;IAAEC,YAAY,GAAG,KAAK;IAAEC,IAAI,GAAG,QAAQ;IAAEC,aAAa,GAAG,OAAO;IAAEC,YAAY,GAAG;EAAO,CAAE,GAAGN,KAAK;EAE9G,MAAMO,WAAW,GAAGV,iBAAA,CAAAW,gBAAgB,CAACR,KAAK,CAACO,WAAW,EAAE;IACtDE,QAAQ,EAAE,IAAI;IACdC,YAAY,EAAE;MACZC,QAAQ,EAAET;;GAEb,CAAC;EACF,MAAMU,aAAa,GAAGf,iBAAA,CAAAW,gBAAgB,CAACR,KAAK,CAACY,aAAa,CAAC;EAC3D,MAAMC,YAAY,GAAGhB,iBAAA,CAAAW,gBAAgB,CAACR,KAAK,CAACa,YAAY,CAAC;EACzD,MAAMC,cAAc,GAAGjB,iBAAA,CAAAW,gBAAgB,CAACR,KAAK,CAACc,cAAc,CAAC;EAE7D,MAAMC,YAAY,GAAG,CAACR,WAAW,EAAEK,aAAa,EAAEC,YAAY,EAAEC,cAAc,CAAC,CAACE,MAAM,CAACC,OAAO,CAAC,CAACC,MAAM;EAEtG,OAAO;IACLH,YAAY;IACZZ,YAAY;IACZC,IAAI;IACJC,aAAa;IACbC,YAAY;IAEZa,UAAU,EAAE;MACVC,IAAI,EAAE,KAAK;MACXC,MAAM,EAAE1B,cAAA,CAAA2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["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,QAAO,EACvBC,cAAe,QAAO,EACvB,GAAGN;IACJ,MAAMO,cAAcC,IAAAA,gCAAgB,EAACR,MAAMO,WAAW,EAAE;QACtDE,UAAU,IAAI;QACdC,cAAc;YACZC,UAAUT;QACZ;IACF;IACA,MAAMU,gBAAgBJ,IAAAA,gCAAgB,EAACR,MAAMY,aAAa;IAC1D,MAAMC,eAAeL,IAAAA,gCAAgB,EAACR,MAAMa,YAAY;IACxD,MAAMC,iBAAiBN,IAAAA,gCAAgB,EAACR,MAAMc,cAAc;IAC5D,MAAMC,eAAe;QAACR;QAAaK;QAAeC;QAAcC;KAAe,CAACE,MAAM,CAACC,SAASC,MAAM;IACtG,OAAO;QACLH;QACAZ;QACAC;QACAC;QACAC;QACAa,YAAY;YACVC,MAAM;YACNC,QAAQC,mBAAM;YACdC,UAAUC,yBAAa;YACvBjB,aAAa;YACbK,eAAe;YACfC,cAAc;YACdC,gBAAgB;QAClB;QACAM,MAAMK,IAAAA,qCAAqB,EAAC,OAAO;YACjC,GAAGzB,KAAK;YACRC;QACF,GAAG,qBAAqB,GAAE;YAAC;SAAO;QAClCoB,QAAQ,CAAClB,eAAeK,IAAAA,gCAAgB,EAACR,MAAMqB,MAAM,EAAE;YACrDZ,UAAU,IAAI;YACdC,cAAc;gBACZR;gBACAwB,OAAO1B,MAAMuB,QAAQ;gBACrBnB,MAAMuB,WAAW,CAACvB,KAAK;YACzB;QACF,KAAKwB,SAAS;Q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