@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.
Files changed (46) hide show
  1. package/.swcrc +30 -0
  2. package/CHANGELOG.json +85 -1
  3. package/CHANGELOG.md +29 -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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-persona",
3
- "version": "9.2.3",
3
+ "version": "9.2.5",
4
4
  "description": "React components for building web experiences",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -22,23 +22,23 @@
22
22
  "type-check": "tsc -b tsconfig.json",
23
23
  "storybook": "start-storybook",
24
24
  "start": "yarn storybook",
25
- "generate-api": "tsc -p ./tsconfig.lib.json --emitDeclarationOnly && just-scripts api-extractor"
25
+ "generate-api": "just-scripts generate-api"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@fluentui/eslint-plugin": "*",
29
29
  "@fluentui/react-conformance": "*",
30
- "@fluentui/react-conformance-griffel": "9.0.0-beta.19",
30
+ "@fluentui/react-conformance-griffel": "9.0.0-beta.20",
31
31
  "@fluentui/scripts-api-extractor": "*",
32
32
  "@fluentui/scripts-tasks": "*"
33
33
  },
34
34
  "dependencies": {
35
- "@fluentui/react-avatar": "^9.4.3",
36
- "@fluentui/react-badge": "^9.1.3",
37
- "@fluentui/react-shared-contexts": "^9.3.1",
38
- "@fluentui/react-theme": "^9.1.6",
39
- "@fluentui/react-utilities": "^9.7.0",
35
+ "@fluentui/react-avatar": "^9.4.5",
36
+ "@fluentui/react-badge": "^9.1.5",
37
+ "@fluentui/react-shared-contexts": "^9.3.2",
38
+ "@fluentui/react-theme": "^9.1.7",
39
+ "@fluentui/react-utilities": "^9.7.2",
40
40
  "@griffel/react": "^1.5.2",
41
- "tslib": "^2.1.0"
41
+ "@swc/helpers": "^0.4.14"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "@types/react": ">=16.8.0 <19.0.0",
@@ -55,6 +55,7 @@
55
55
  "exports": {
56
56
  ".": {
57
57
  "types": "./dist/index.d.ts",
58
+ "node": "./lib-commonjs/index.js",
58
59
  "import": "./lib/index.js",
59
60
  "require": "./lib-commonjs/index.js"
60
61
  },
@@ -1,6 +0,0 @@
1
- define(["require", "exports", "tslib", "./components/Persona/index"], function (require, exports, tslib_1, index_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- tslib_1.__exportStar(index_1, exports);
5
- });
6
- //# sourceMappingURL=Persona.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Persona.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-persona/src/Persona.ts"],"names":[],"mappings":";;;IAAA,uCAA2C","sourcesContent":["export * from './components/Persona/index';\n"]}
@@ -1,18 +0,0 @@
1
- define(["require", "exports", "react", "./renderPersona", "./usePersona", "./usePersonaStyles", "@fluentui/react-shared-contexts"], function (require, exports, React, renderPersona_1, usePersona_1, usePersonaStyles_1, react_shared_contexts_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.Persona = void 0;
5
- /**
6
- * A Persona is a visual representation of a person or status that showcases an Avatar, PresenceBadge,
7
- * or an Avatar with a PresenceBadge.
8
- */
9
- exports.Persona = React.forwardRef(function (props, ref) {
10
- var state = usePersona_1.usePersona_unstable(props, ref);
11
- usePersonaStyles_1.usePersonaStyles_unstable(state);
12
- var useCustomStyles = react_shared_contexts_1.useCustomStyleHooks_unstable().usePersonaStyles_unstable;
13
- useCustomStyles(state);
14
- return renderPersona_1.renderPersona_unstable(state);
15
- });
16
- exports.Persona.displayName = 'Persona';
17
- });
18
- //# sourceMappingURL=Persona.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Persona.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-persona/src/components/Persona/Persona.tsx"],"names":[],"mappings":";;;;IAQA;;;OAGG;IACU,QAAA,OAAO,GAAsC,KAAK,CAAC,UAAU,CAAC,UAAC,KAAK,EAAE,GAAG;QACpF,IAAM,KAAK,GAAG,gCAAmB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAE9C,4CAAyB,CAAC,KAAK,CAAC,CAAC;QAEzB,IAA2B,eAAe,GAAK,oDAA4B,EAAE,0BAAnC,CAAoC;QACtF,eAAe,CAAC,KAAK,CAAC,CAAC;QAEvB,OAAO,sCAAsB,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,eAAO,CAAC,WAAW,GAAG,SAAS,CAAC","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';\nimport { useCustomStyleHooks_unstable } from '@fluentui/react-shared-contexts';\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\n const { usePersonaStyles_unstable: useCustomStyles } = useCustomStyleHooks_unstable();\n useCustomStyles(state);\n\n return renderPersona_unstable(state);\n});\n\nPersona.displayName = 'Persona';\n"]}
@@ -1,5 +0,0 @@
1
- define(["require", "exports"], function (require, exports) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- });
5
- //# sourceMappingURL=Persona.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Persona.types.js","sourceRoot":"","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,10 +0,0 @@
1
- define(["require", "exports", "tslib", "./Persona", "./Persona.types", "./renderPersona", "./usePersona", "./usePersonaStyles"], function (require, exports, tslib_1, Persona_1, Persona_types_1, renderPersona_1, usePersona_1, usePersonaStyles_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- tslib_1.__exportStar(Persona_1, exports);
5
- tslib_1.__exportStar(Persona_types_1, exports);
6
- tslib_1.__exportStar(renderPersona_1, exports);
7
- tslib_1.__exportStar(usePersona_1, exports);
8
- tslib_1.__exportStar(usePersonaStyles_1, exports);
9
- });
10
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-persona/src/components/Persona/index.ts"],"names":[],"mappings":";;;IAAA,yCAA0B;IAC1B,+CAAgC;IAChC,+CAAgC;IAChC,4CAA6B;IAC7B,kDAAmC","sourcesContent":["export * from './Persona';\nexport * from './Persona.types';\nexport * from './renderPersona';\nexport * from './usePersona';\nexport * from './usePersonaStyles';\n"]}
@@ -1,24 +0,0 @@
1
- define(["require", "exports", "tslib", "react", "@fluentui/react-utilities"], function (require, exports, tslib_1, React, react_utilities_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.renderPersona_unstable = void 0;
5
- /**
6
- * Render the final JSX of Persona
7
- */
8
- var renderPersona_unstable = function (state) {
9
- var presenceOnly = state.presenceOnly, textPosition = state.textPosition;
10
- var _a = react_utilities_1.getSlots(state), slots = _a.slots, slotProps = _a.slotProps;
11
- var coin = presenceOnly
12
- ? slots.presence && React.createElement(slots.presence, tslib_1.__assign({}, slotProps.presence))
13
- : slots.avatar && React.createElement(slots.avatar, tslib_1.__assign({}, slotProps.avatar));
14
- return (React.createElement(slots.root, tslib_1.__assign({}, slotProps.root),
15
- (textPosition === 'after' || textPosition === 'below') && coin,
16
- slots.primaryText && React.createElement(slots.primaryText, tslib_1.__assign({}, slotProps.primaryText)),
17
- slots.secondaryText && React.createElement(slots.secondaryText, tslib_1.__assign({}, slotProps.secondaryText)),
18
- slots.tertiaryText && React.createElement(slots.tertiaryText, tslib_1.__assign({}, slotProps.tertiaryText)),
19
- slots.quaternaryText && React.createElement(slots.quaternaryText, tslib_1.__assign({}, slotProps.quaternaryText)),
20
- textPosition === 'before' && coin));
21
- };
22
- exports.renderPersona_unstable = renderPersona_unstable;
23
- });
24
- //# sourceMappingURL=renderPersona.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"renderPersona.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-persona/src/components/Persona/renderPersona.tsx"],"names":[],"mappings":";;;;IAIA;;OAEG;IACI,IAAM,sBAAsB,GAAG,UAAC,KAAmB;QAChD,IAAA,YAAY,GAAmB,KAAK,aAAxB,EAAE,YAAY,GAAK,KAAK,aAAV,CAAW;QACvC,IAAA,KAAuB,0BAAQ,CAAe,KAAK,CAAC,EAAlD,KAAK,WAAA,EAAE,SAAS,eAAkC,CAAC;QAE3D,IAAM,IAAI,GAAG,YAAY;YACvB,CAAC,CAAC,KAAK,CAAC,QAAQ,IAAI,oBAAC,KAAK,CAAC,QAAQ,uBAAK,SAAS,CAAC,QAAQ,EAAI;YAC9D,CAAC,CAAC,KAAK,CAAC,MAAM,IAAI,oBAAC,KAAK,CAAC,MAAM,uBAAK,SAAS,CAAC,MAAM,EAAI,CAAC;QAE3D,OAAO,CACL,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI;YAC3B,CAAC,YAAY,KAAK,OAAO,IAAI,YAAY,KAAK,OAAO,CAAC,IAAI,IAAI;YAC9D,KAAK,CAAC,WAAW,IAAI,oBAAC,KAAK,CAAC,WAAW,uBAAK,SAAS,CAAC,WAAW,EAAI;YACrE,KAAK,CAAC,aAAa,IAAI,oBAAC,KAAK,CAAC,aAAa,uBAAK,SAAS,CAAC,aAAa,EAAI;YAC3E,KAAK,CAAC,YAAY,IAAI,oBAAC,KAAK,CAAC,YAAY,uBAAK,SAAS,CAAC,YAAY,EAAI;YACxE,KAAK,CAAC,cAAc,IAAI,oBAAC,KAAK,CAAC,cAAc,uBAAK,SAAS,CAAC,cAAc,EAAI;YAC9E,YAAY,KAAK,QAAQ,IAAI,IAAI,CACvB,CACd,CAAC;IACJ,CAAC,CAAC;IAlBW,QAAA,sBAAsB,0BAkBjC","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"]}
@@ -1,84 +0,0 @@
1
- define(["require", "exports", "tslib", "@fluentui/react-avatar", "@fluentui/react-utilities", "@fluentui/react-badge"], function (require, exports, tslib_1, react_avatar_1, react_utilities_1, react_badge_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.usePersona_unstable = void 0;
5
- /**
6
- * Create the state required to render Persona.
7
- *
8
- * The returned state can be modified with hooks such as usePersonaStyles_unstable,
9
- * before being passed to renderPersona_unstable.
10
- *
11
- * @param props - props from this instance of Persona
12
- * @param ref - reference to root HTMLElement of Persona
13
- */
14
- var usePersona_unstable = function (props, ref) {
15
- var name = props.name, _a = props.presenceOnly, presenceOnly = _a === void 0 ? false : _a, _b = props.size, size = _b === void 0 ? 'medium' : _b, _c = props.textAlignment, textAlignment = _c === void 0 ? 'start' : _c, _d = props.textPosition, textPosition = _d === void 0 ? 'after' : _d;
16
- var primaryText = react_utilities_1.resolveShorthand(props.primaryText, {
17
- required: true,
18
- defaultProps: {
19
- children: name,
20
- },
21
- });
22
- var secondaryText = react_utilities_1.resolveShorthand(props.secondaryText);
23
- var tertiaryText = react_utilities_1.resolveShorthand(props.tertiaryText);
24
- var quaternaryText = react_utilities_1.resolveShorthand(props.quaternaryText);
25
- var numTextLines = [primaryText, secondaryText, tertiaryText, quaternaryText].filter(Boolean).length;
26
- return {
27
- numTextLines: numTextLines,
28
- presenceOnly: presenceOnly,
29
- size: size,
30
- textAlignment: textAlignment,
31
- textPosition: textPosition,
32
- components: {
33
- root: 'div',
34
- avatar: react_avatar_1.Avatar,
35
- presence: react_badge_1.PresenceBadge,
36
- primaryText: 'span',
37
- secondaryText: 'span',
38
- tertiaryText: 'span',
39
- quaternaryText: 'span',
40
- },
41
- root: react_utilities_1.getNativeElementProps('div', tslib_1.__assign(tslib_1.__assign({}, props), { ref: ref }),
42
- /* excludedPropNames */ ['name']),
43
- avatar: !presenceOnly
44
- ? react_utilities_1.resolveShorthand(props.avatar, {
45
- required: true,
46
- defaultProps: {
47
- name: name,
48
- badge: props.presence,
49
- size: avatarSizes[size],
50
- },
51
- })
52
- : undefined,
53
- presence: presenceOnly
54
- ? react_utilities_1.resolveShorthand(props.presence, {
55
- defaultProps: {
56
- size: presenceSizes[size],
57
- },
58
- })
59
- : undefined,
60
- primaryText: primaryText,
61
- secondaryText: secondaryText,
62
- tertiaryText: tertiaryText,
63
- quaternaryText: quaternaryText,
64
- };
65
- };
66
- exports.usePersona_unstable = usePersona_unstable;
67
- var presenceSizes = {
68
- 'extra-small': 'tiny',
69
- small: 'extra-small',
70
- medium: 'small',
71
- large: 'medium',
72
- 'extra-large': 'large',
73
- huge: 'large',
74
- };
75
- var avatarSizes = {
76
- 'extra-small': 20,
77
- small: 28,
78
- medium: 32,
79
- large: 36,
80
- 'extra-large': 40,
81
- huge: 56,
82
- };
83
- });
84
- //# sourceMappingURL=usePersona.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"usePersona.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-persona/src/components/Persona/usePersona.ts"],"names":[],"mappings":";;;;IAMA;;;;;;;;OAQG;IACI,IAAM,mBAAmB,GAAG,UAAC,KAAmB,EAAE,GAA2B;QAC1E,IAAA,IAAI,GAA6F,KAAK,KAAlG,EAAE,KAA2F,KAAK,aAA5E,EAApB,YAAY,mBAAG,KAAK,KAAA,EAAE,KAAqE,KAAK,KAA3D,EAAf,IAAI,mBAAG,QAAQ,KAAA,EAAE,KAAoD,KAAK,cAAlC,EAAvB,aAAa,mBAAG,OAAO,KAAA,EAAE,KAA2B,KAAK,aAAV,EAAtB,YAAY,mBAAG,OAAO,KAAA,CAAW;QAE/G,IAAM,WAAW,GAAG,kCAAgB,CAAC,KAAK,CAAC,WAAW,EAAE;YACtD,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE;gBACZ,QAAQ,EAAE,IAAI;aACf;SACF,CAAC,CAAC;QACH,IAAM,aAAa,GAAG,kCAAgB,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QAC5D,IAAM,YAAY,GAAG,kCAAgB,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAC1D,IAAM,cAAc,GAAG,kCAAgB,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QAE9D,IAAM,YAAY,GAAG,CAAC,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC;QAEvG,OAAO;YACL,YAAY,cAAA;YACZ,YAAY,cAAA;YACZ,IAAI,MAAA;YACJ,aAAa,eAAA;YACb,YAAY,cAAA;YAEZ,UAAU,EAAE;gBACV,IAAI,EAA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","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"]}
@@ -1,191 +0,0 @@
1
- define(["require", "exports", "tslib", "@griffel/react", "@fluentui/react-theme"], function (require, exports, tslib_1, react_1, react_theme_1) {
2
- "use strict";
3
- var _a, _b, _c, _d, _e, _f, _g;
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.usePersonaStyles_unstable = exports.personaClassNames = void 0;
6
- exports.personaClassNames = {
7
- root: 'fui-Persona',
8
- avatar: 'fui-Persona__avatar',
9
- presence: 'fui-Persona__presence',
10
- primaryText: 'fui-Persona__primaryText',
11
- secondaryText: 'fui-Persona__secondaryText',
12
- tertiaryText: 'fui-Persona__tertiaryText',
13
- quaternaryText: 'fui-Persona__quaternaryText',
14
- };
15
- var avatarSpacing = "--fui-Persona__avatar--spacing";
16
- var useRootClassName = react_1.makeResetStyles({
17
- display: 'inline-grid',
18
- gridAutoRows: 'max-content',
19
- gridAutoFlow: 'column',
20
- justifyItems: 'start',
21
- gridTemplateColumns: 'max-content [middle] auto',
22
- });
23
- /**
24
- * Styles for the root slot
25
- */
26
- var useStyles = react_1.makeStyles({
27
- beforeAfterCenter: {
28
- // This template is needed to make sure the Avatar is centered when it takes up more space than the text lines
29
- gridTemplateRows: '1fr [primary] max-content [secondary] max-content [tertiary] max-content [quaternary] max-content 1fr',
30
- },
31
- after: {
32
- // Intentionally empty
33
- },
34
- before: {
35
- justifyItems: 'end',
36
- gridTemplateColumns: 'auto [middle] max-content',
37
- },
38
- below: {
39
- gridAutoFlow: 'unset',
40
- justifyItems: 'center',
41
- gridTemplateColumns: 'unset',
42
- },
43
- media: {
44
- gridRowStart: 'span 5',
45
- },
46
- mediaBeforeAfterCenter: {
47
- gridRowStart: 'span 6',
48
- },
49
- start: {
50
- alignSelf: 'start',
51
- },
52
- center: {
53
- alignSelf: 'center',
54
- },
55
- afterAlignToPrimary: {
56
- alignSelf: 'center',
57
- gridRowStart: 'unset',
58
- gridColumnEnd: 'middle',
59
- },
60
- beforeAlignToPrimary: {
61
- alignSelf: 'center',
62
- gridRowStart: 'unset',
63
- gridColumnStart: 'middle',
64
- },
65
- secondLineSpacing: {
66
- marginTop: '-2px',
67
- },
68
- primary: { gridRowStart: 'primary' },
69
- secondary: { gridRowStart: 'secondary' },
70
- tertiary: { gridRowStart: 'tertiary' },
71
- quaternary: { gridRowStart: 'quaternary' },
72
- });
73
- var useAvatarSpacingStyles = react_1.makeStyles({
74
- 'extra-small': (_a = {},
75
- _a[avatarSpacing] = react_theme_1.tokens.spacingHorizontalSNudge,
76
- _a),
77
- small: (_b = {},
78
- _b[avatarSpacing] = react_theme_1.tokens.spacingHorizontalS,
79
- _b),
80
- medium: (_c = {},
81
- _c[avatarSpacing] = react_theme_1.tokens.spacingHorizontalS,
82
- _c),
83
- large: (_d = {},
84
- _d[avatarSpacing] = react_theme_1.tokens.spacingHorizontalMNudge,
85
- _d),
86
- 'extra-large': (_e = {},
87
- _e[avatarSpacing] = react_theme_1.tokens.spacingHorizontalMNudge,
88
- _e),
89
- huge: (_f = {},
90
- _f[avatarSpacing] = react_theme_1.tokens.spacingHorizontalM,
91
- _f),
92
- after: {
93
- marginRight: "var(" + avatarSpacing + ")",
94
- },
95
- below: {
96
- marginBottom: "var(" + avatarSpacing + ")",
97
- },
98
- before: {
99
- marginLeft: "var(" + avatarSpacing + ")",
100
- },
101
- });
102
- var usePresenceSpacingStyles = react_1.makeStyles({
103
- small: (_g = {},
104
- _g[avatarSpacing] = react_theme_1.tokens.spacingHorizontalSNudge,
105
- _g),
106
- });
107
- /**
108
- * Apply styling to the Persona slots based on the state
109
- */
110
- var usePersonaStyles_unstable = function (state) {
111
- var presenceOnly = state.presenceOnly, size = state.size, textAlignment = state.textAlignment, textPosition = state.textPosition;
112
- var alignToPrimary = presenceOnly && textAlignment === 'start' && size !== 'extra-large' && size !== 'huge';
113
- var alignBeforeAfterCenter = textPosition !== 'below' && textAlignment === 'center';
114
- var _a = useTextClassNames(state, alignToPrimary), primaryTextClassName = _a.primaryTextClassName, optionalTextClassName = _a.optionalTextClassName;
115
- var rootClassName = useRootClassName();
116
- var styles = useStyles();
117
- var avatarSpacingStyles = useAvatarSpacingStyles();
118
- var presenceSpacingStyles = tslib_1.__assign(tslib_1.__assign({}, avatarSpacingStyles), usePresenceSpacingStyles());
119
- state.root.className = react_1.mergeClasses(exports.personaClassNames.root, rootClassName, alignBeforeAfterCenter && styles.beforeAfterCenter, styles[textPosition], state.root.className);
120
- if (state.avatar) {
121
- state.avatar.className = react_1.mergeClasses(exports.personaClassNames.avatar, textPosition !== 'below' && styles.media, alignBeforeAfterCenter && styles.mediaBeforeAfterCenter, styles[textAlignment], avatarSpacingStyles[size], avatarSpacingStyles[textPosition], state.avatar.className);
122
- }
123
- if (state.presence) {
124
- state.presence.className = react_1.mergeClasses(exports.personaClassNames.presence, textPosition !== 'below' && styles.media, alignBeforeAfterCenter && styles.mediaBeforeAfterCenter, styles[textAlignment], presenceSpacingStyles[size], presenceSpacingStyles[textPosition], textPosition === 'after' && alignToPrimary && styles.afterAlignToPrimary, textPosition === 'before' && alignToPrimary && styles.beforeAlignToPrimary, state.presence.className);
125
- }
126
- if (state.primaryText) {
127
- state.primaryText.className = react_1.mergeClasses(exports.personaClassNames.primaryText, alignBeforeAfterCenter && styles.primary, primaryTextClassName, state.primaryText.className);
128
- }
129
- if (state.secondaryText) {
130
- state.secondaryText.className = react_1.mergeClasses(exports.personaClassNames.secondaryText, alignBeforeAfterCenter && styles.secondary, optionalTextClassName, styles.secondLineSpacing, state.secondaryText.className);
131
- }
132
- if (state.tertiaryText) {
133
- state.tertiaryText.className = react_1.mergeClasses(exports.personaClassNames.tertiaryText, alignBeforeAfterCenter && styles.tertiary, optionalTextClassName, state.tertiaryText.className);
134
- }
135
- if (state.quaternaryText) {
136
- state.quaternaryText.className = react_1.mergeClasses(exports.personaClassNames.quaternaryText, alignBeforeAfterCenter && styles.quaternary, optionalTextClassName, state.quaternaryText.className);
137
- }
138
- return state;
139
- };
140
- exports.usePersonaStyles_unstable = usePersonaStyles_unstable;
141
- var usePrimaryTextBaseClassName = react_1.makeResetStyles(tslib_1.__assign({ display: 'block', color: react_theme_1.tokens.colorNeutralForeground1 }, react_theme_1.typographyStyles.body1));
142
- var useOptionalTextBaseClassName = react_1.makeResetStyles(tslib_1.__assign({ display: 'block', color: react_theme_1.tokens.colorNeutralForeground2 }, react_theme_1.typographyStyles.caption1));
143
- var useTextStyles = react_1.makeStyles({
144
- beforeAlignToPrimary: {
145
- gridColumnEnd: 'middle',
146
- },
147
- afterAlignToPrimary: {
148
- gridColumnStart: 'middle',
149
- },
150
- body1: react_theme_1.typographyStyles.body1,
151
- caption1: react_theme_1.typographyStyles.caption1,
152
- subtitle2: react_theme_1.typographyStyles.subtitle2,
153
- });
154
- var useTextClassNames = function (state, alignToPrimary) {
155
- var presenceOnly = state.presenceOnly, size = state.size, textPosition = state.textPosition;
156
- var primaryTextBaseClassName = usePrimaryTextBaseClassName();
157
- var optionalTextBaseClassName = useOptionalTextBaseClassName();
158
- var textStyles = useTextStyles();
159
- var primaryTextSize;
160
- var alignToPrimaryClassName;
161
- if (presenceOnly) {
162
- if (size === 'extra-small') {
163
- primaryTextSize = state.numTextLines <= 1 && textStyles.caption1;
164
- }
165
- else if (size === 'extra-large' || size === 'huge') {
166
- primaryTextSize = textStyles.subtitle2;
167
- }
168
- if (alignToPrimary) {
169
- if (textPosition === 'before') {
170
- alignToPrimaryClassName = textStyles.beforeAlignToPrimary;
171
- }
172
- else if (textPosition === 'after') {
173
- alignToPrimaryClassName = textStyles.afterAlignToPrimary;
174
- }
175
- }
176
- }
177
- else {
178
- if (size === 'huge') {
179
- primaryTextSize = textStyles.subtitle2;
180
- }
181
- else if (size === 'extra-large') {
182
- primaryTextSize = textStyles.subtitle2;
183
- }
184
- }
185
- return {
186
- primaryTextClassName: react_1.mergeClasses(primaryTextBaseClassName, primaryTextSize, alignToPrimaryClassName),
187
- optionalTextClassName: react_1.mergeClasses(optionalTextBaseClassName, !presenceOnly && size === 'huge' && textStyles.body1, alignToPrimaryClassName),
188
- };
189
- };
190
- });
191
- //# sourceMappingURL=usePersonaStyles.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"usePersonaStyles.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-persona/src/components/Persona/usePersonaStyles.ts"],"names":[],"mappings":";;;;;IAKa,QAAA,iBAAiB,GAAiC;QAC7D,IAAI,EAAE,aAAa;QACnB,MAAM,EAAE,qBAAqB;QAC7B,QAAQ,EAAE,uBAAuB;QACjC,WAAW,EAAE,0BAA0B;QACvC,aAAa,EAAE,4BAA4B;QAC3C,YAAY,EAAE,2BAA2B;QACzC,cAAc,EAAE,6BAA6B;KAC9C,CAAC;IAEF,IAAM,aAAa,GAAG,gCAAgC,CAAC;IAEvD,IAAM,gBAAgB,GAAG,uBAAe,CAAC;QACvC,OAAO,EAAE,aAAa;QACtB,YAAY,EAAE,aAAa;QAC3B,YAAY,EAAE,QAAQ;QACtB,YAAY,EAAE,OAAO;QACrB,mBAAmB,EAAE,2BAA2B;KACjD,CAAC,CAAC;IAEH;;OAEG;IACH,IAAM,SAAS,GAAG,kBAAU,CAAC;QAC3B,iBAAiB,EAAE;YACjB,8GAA8G;YAC9G,gBAAgB,EACd,uGAAuG;SAC1G;QAED,KAAK,EAAE;QACL,sBAAsB;SACvB;QACD,MAAM,EAAE;YACN,YAAY,EAAE,KAAK;YACnB,mBAAmB,EAAE,2BAA2B;SACjD;QACD,KAAK,EAAE;YACL,YAAY,EAAE,OAAO;YACrB,YAAY,EAAE,QAAQ;YACtB,mBAAmB,EAAE,OAAO;SAC7B;QAED,KAAK,EAAE;YACL,YAAY,EAAE,QAAQ;SACvB;QAED,sBAAsB,EAAE;YACtB,YAAY,EAAE,QAAQ;SACvB;QAED,KAAK,EAAE;YACL,SAAS,EAAE,OAAO;SACnB;QACD,MAAM,EAAE;YACN,SAAS,EAAE,QAAQ;SACpB;QAED,mBAAmB,EAAE;YACnB,SA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I,IAAI,KAAK,aAAa,IAAI,IAAI,KAAK,MAAM,EAAE;gBACpD,eAAe,GAAG,UAAU,CAAC,SAAS,CAAC;aACxC;YAED,IAAI,cAAc,EAAE;gBAClB,IAAI,YAAY,KAAK,QAAQ,EAAE;oBAC7B,uBAAuB,GAAG,UAAU,CAAC,oBAAoB,CAAC;iBAC3D;qBAAM,IAAI,YAAY,KAAK,OAAO,EAAE;oBACnC,uBAAuB,GAAG,UAAU,CAAC,mBAAmB,CAAC;iBAC1D;aACF;SACF;aAAM;YACL,IAAI,IAAI,KAAK,MAAM,EAAE;gBACnB,eAAe,GAAG,UAAU,CAAC,SAAS,CAAC;aACxC;iBAAM,IAAI,IAAI,KAAK,aAAa,EAAE;gBACjC,eAAe,GAAG,UAAU,CAAC,SAAS,CAAC;aACxC;SACF;QAED,OAAO;YACL,oBAAoB,EAAE,oBAAY,CAAC,wBAAwB,EAAE,eAAe,EAAE,uBAAuB,CAAC;YACtG,qBAAqB,EAAE,oBAAY,CACjC,yBAAyB,EACzB,CAAC,YAAY,IAAI,IAAI,KAAK,MAAM,IAAI,UAAU,CAAC,KAAK,EACpD,uBAAuB,CACxB;SACF,CAAC;IACJ,CAAC,CAAC","sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nimport type { PersonaSlots, PersonaState } from './Persona.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const personaClassNames: SlotClassNames<PersonaSlots> = {\n root: 'fui-Persona',\n avatar: 'fui-Persona__avatar',\n presence: 'fui-Persona__presence',\n primaryText: 'fui-Persona__primaryText',\n secondaryText: 'fui-Persona__secondaryText',\n tertiaryText: 'fui-Persona__tertiaryText',\n quaternaryText: 'fui-Persona__quaternaryText',\n};\n\nconst avatarSpacing = `--fui-Persona__avatar--spacing`;\n\nconst useRootClassName = makeResetStyles({\n display: 'inline-grid',\n gridAutoRows: 'max-content',\n gridAutoFlow: 'column',\n justifyItems: 'start',\n gridTemplateColumns: 'max-content [middle] auto',\n});\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n beforeAfterCenter: {\n // This template is needed to make sure the Avatar is centered when it takes up more space than the text lines\n gridTemplateRows:\n '1fr [primary] max-content [secondary] max-content [tertiary] max-content [quaternary] max-content 1fr',\n },\n\n after: {\n // Intentionally empty\n },\n before: {\n justifyItems: 'end',\n gridTemplateColumns: 'auto [middle] max-content',\n },\n below: {\n gridAutoFlow: 'unset',\n justifyItems: 'center',\n gridTemplateColumns: 'unset',\n },\n\n media: {\n gridRowStart: 'span 5',\n },\n\n mediaBeforeAfterCenter: {\n gridRowStart: 'span 6',\n },\n\n start: {\n alignSelf: 'start',\n },\n center: {\n alignSelf: 'center',\n },\n\n afterAlignToPrimary: {\n alignSelf: 'center',\n gridRowStart: 'unset',\n gridColumnEnd: 'middle',\n },\n beforeAlignToPrimary: {\n alignSelf: 'center',\n gridRowStart: 'unset',\n gridColumnStart: 'middle',\n },\n\n secondLineSpacing: {\n marginTop: '-2px',\n },\n\n primary: { gridRowStart: 'primary' },\n secondary: { gridRowStart: 'secondary' },\n tertiary: { gridRowStart: 'tertiary' },\n quaternary: { gridRowStart: 'quaternary' },\n});\n\nconst useAvatarSpacingStyles = makeStyles({\n 'extra-small': {\n [avatarSpacing]: tokens.spacingHorizontalSNudge,\n },\n small: {\n [avatarSpacing]: tokens.spacingHorizontalS,\n },\n medium: {\n [avatarSpacing]: tokens.spacingHorizontalS,\n },\n large: {\n [avatarSpacing]: tokens.spacingHorizontalMNudge,\n },\n 'extra-large': {\n [avatarSpacing]: tokens.spacingHorizontalMNudge,\n },\n huge: {\n [avatarSpacing]: tokens.spacingHorizontalM,\n },\n after: {\n marginRight: `var(${avatarSpacing})`,\n },\n below: {\n marginBottom: `var(${avatarSpacing})`,\n },\n before: {\n marginLeft: `var(${avatarSpacing})`,\n },\n});\n\nconst usePresenceSpacingStyles = makeStyles({\n small: {\n [avatarSpacing]: tokens.spacingHorizontalSNudge,\n },\n});\n\n/**\n * Apply styling to the Persona slots based on the state\n */\nexport const usePersonaStyles_unstable = (state: PersonaState): PersonaState => {\n const { presenceOnly, size, textAlignment, textPosition } = state;\n\n const alignToPrimary = presenceOnly && textAlignment === 'start' && size !== 'extra-large' && size !== 'huge';\n const alignBeforeAfterCenter = textPosition !== 'below' && textAlignment === 'center';\n const { primaryTextClassName, optionalTextClassName } = useTextClassNames(state, alignToPrimary);\n\n const rootClassName = useRootClassName();\n const styles = useStyles();\n const avatarSpacingStyles = useAvatarSpacingStyles();\n const presenceSpacingStyles = { ...avatarSpacingStyles, ...usePresenceSpacingStyles() };\n\n state.root.className = mergeClasses(\n personaClassNames.root,\n rootClassName,\n alignBeforeAfterCenter && styles.beforeAfterCenter,\n styles[textPosition],\n state.root.className,\n );\n\n if (state.avatar) {\n state.avatar.className = mergeClasses(\n personaClassNames.avatar,\n textPosition !== 'below' && styles.media,\n alignBeforeAfterCenter && styles.mediaBeforeAfterCenter,\n styles[textAlignment],\n avatarSpacingStyles[size],\n avatarSpacingStyles[textPosition],\n state.avatar.className,\n );\n }\n\n if (state.presence) {\n state.presence.className = mergeClasses(\n personaClassNames.presence,\n textPosition !== 'below' && styles.media,\n alignBeforeAfterCenter && styles.mediaBeforeAfterCenter,\n styles[textAlignment],\n presenceSpacingStyles[size],\n presenceSpacingStyles[textPosition],\n textPosition === 'after' && alignToPrimary && styles.afterAlignToPrimary,\n textPosition === 'before' && alignToPrimary && styles.beforeAlignToPrimary,\n state.presence.className,\n );\n }\n\n if (state.primaryText) {\n state.primaryText.className = mergeClasses(\n personaClassNames.primaryText,\n alignBeforeAfterCenter && styles.primary,\n primaryTextClassName,\n state.primaryText.className,\n );\n }\n\n if (state.secondaryText) {\n state.secondaryText.className = mergeClasses(\n personaClassNames.secondaryText,\n alignBeforeAfterCenter && styles.secondary,\n optionalTextClassName,\n styles.secondLineSpacing,\n state.secondaryText.className,\n );\n }\n\n if (state.tertiaryText) {\n state.tertiaryText.className = mergeClasses(\n personaClassNames.tertiaryText,\n alignBeforeAfterCenter && styles.tertiary,\n optionalTextClassName,\n state.tertiaryText.className,\n );\n }\n\n if (state.quaternaryText) {\n state.quaternaryText.className = mergeClasses(\n personaClassNames.quaternaryText,\n alignBeforeAfterCenter && styles.quaternary,\n optionalTextClassName,\n state.quaternaryText.className,\n );\n }\n\n return state;\n};\n\nconst usePrimaryTextBaseClassName = makeResetStyles({\n display: 'block',\n color: tokens.colorNeutralForeground1,\n ...typographyStyles.body1,\n});\n\nconst useOptionalTextBaseClassName = makeResetStyles({\n display: 'block',\n color: tokens.colorNeutralForeground2,\n ...typographyStyles.caption1,\n});\n\nconst useTextStyles = makeStyles({\n beforeAlignToPrimary: {\n gridColumnEnd: 'middle',\n },\n afterAlignToPrimary: {\n gridColumnStart: 'middle',\n },\n\n body1: typographyStyles.body1,\n caption1: typographyStyles.caption1,\n subtitle2: typographyStyles.subtitle2,\n});\n\nconst useTextClassNames = (\n state: PersonaState,\n alignToPrimary: boolean,\n): {\n primaryTextClassName: string;\n optionalTextClassName: string;\n} => {\n const { presenceOnly, size, textPosition } = state;\n const primaryTextBaseClassName = usePrimaryTextBaseClassName();\n const optionalTextBaseClassName = useOptionalTextBaseClassName();\n const textStyles = useTextStyles();\n\n let primaryTextSize;\n let alignToPrimaryClassName;\n\n if (presenceOnly) {\n if (size === 'extra-small') {\n primaryTextSize = state.numTextLines <= 1 && textStyles.caption1;\n } else if (size === 'extra-large' || size === 'huge') {\n primaryTextSize = textStyles.subtitle2;\n }\n\n if (alignToPrimary) {\n if (textPosition === 'before') {\n alignToPrimaryClassName = textStyles.beforeAlignToPrimary;\n } else if (textPosition === 'after') {\n alignToPrimaryClassName = textStyles.afterAlignToPrimary;\n }\n }\n } else {\n if (size === 'huge') {\n primaryTextSize = textStyles.subtitle2;\n } else if (size === 'extra-large') {\n primaryTextSize = textStyles.subtitle2;\n }\n }\n\n return {\n primaryTextClassName: mergeClasses(primaryTextBaseClassName, primaryTextSize, alignToPrimaryClassName),\n optionalTextClassName: mergeClasses(\n optionalTextBaseClassName,\n !presenceOnly && size === 'huge' && textStyles.body1,\n alignToPrimaryClassName,\n ),\n };\n};\n"]}
package/lib-amd/index.js DELETED
@@ -1,11 +0,0 @@
1
- define(["require", "exports", "./Persona"], function (require, exports, Persona_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.usePersona_unstable = exports.usePersonaStyles_unstable = exports.renderPersona_unstable = exports.personaClassNames = exports.Persona = void 0;
5
- Object.defineProperty(exports, "Persona", { enumerable: true, get: function () { return Persona_1.Persona; } });
6
- Object.defineProperty(exports, "personaClassNames", { enumerable: true, get: function () { return Persona_1.personaClassNames; } });
7
- Object.defineProperty(exports, "renderPersona_unstable", { enumerable: true, get: function () { return Persona_1.renderPersona_unstable; } });
8
- Object.defineProperty(exports, "usePersonaStyles_unstable", { enumerable: true, get: function () { return Persona_1.usePersonaStyles_unstable; } });
9
- Object.defineProperty(exports, "usePersona_unstable", { enumerable: true, get: function () { return Persona_1.usePersona_unstable; } });
10
- });
11
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-persona/src/index.ts"],"names":[],"mappings":";;;;IACE,kGAAA,OAAO,OAAA;IACP,4GAAA,iBAAiB,OAAA;IACjB,iHAAA,sBAAsB,OAAA;IACtB,oHAAA,yBAAyB,OAAA;IACzB,8GAAA,mBAAmB,OAAA","sourcesContent":["export {\n Persona,\n personaClassNames,\n renderPersona_unstable,\n usePersonaStyles_unstable,\n usePersona_unstable,\n} from './Persona';\nexport type { PersonaProps, PersonaSlots, PersonaState } from './Persona';\n"]}