@fluentui/react-persona 9.1.0-beta.3 → 9.1.0-beta.4

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.json CHANGED
@@ -2,7 +2,48 @@
2
2
  "name": "@fluentui/react-persona",
3
3
  "entries": [
4
4
  {
5
- "date": "Fri, 11 Nov 2022 14:53:56 GMT",
5
+ "date": "Thu, 17 Nov 2022 23:02:39 GMT",
6
+ "tag": "@fluentui/react-persona_v9.1.0-beta.4",
7
+ "version": "9.1.0-beta.4",
8
+ "comments": {
9
+ "prerelease": [
10
+ {
11
+ "author": "esteban.230@hotmail.com",
12
+ "package": "@fluentui/react-persona",
13
+ "commit": "9066dc6a278db9df1fe3a277e66c94c201107d14",
14
+ "comment": "feat: Adding size and textAlignment props and updating styles."
15
+ },
16
+ {
17
+ "author": "beachball",
18
+ "package": "@fluentui/react-persona",
19
+ "comment": "Bump @fluentui/react-avatar to v9.2.7",
20
+ "commit": "94e156be5d3b5790d82dccf08c32672733fb9335"
21
+ },
22
+ {
23
+ "author": "beachball",
24
+ "package": "@fluentui/react-persona",
25
+ "comment": "Bump @fluentui/react-badge to v9.0.13",
26
+ "commit": "94e156be5d3b5790d82dccf08c32672733fb9335"
27
+ },
28
+ {
29
+ "author": "beachball",
30
+ "package": "@fluentui/react-persona",
31
+ "comment": "Bump @fluentui/react-utilities to v9.2.2",
32
+ "commit": "94e156be5d3b5790d82dccf08c32672733fb9335"
33
+ }
34
+ ],
35
+ "none": [
36
+ {
37
+ "author": "martinhochel@microsoft.com",
38
+ "package": "@fluentui/react-persona",
39
+ "commit": "ea768501802d65d63ddc63fff3816fb6b5008ae4",
40
+ "comment": "chore: update package scaffold"
41
+ }
42
+ ]
43
+ }
44
+ },
45
+ {
46
+ "date": "Fri, 11 Nov 2022 14:58:09 GMT",
6
47
  "tag": "@fluentui/react-persona_v9.1.0-beta.3",
7
48
  "version": "9.1.0-beta.3",
8
49
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,24 @@
1
1
  # Change Log - @fluentui/react-persona
2
2
 
3
- This log was last generated on Fri, 11 Nov 2022 14:53:56 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 17 Nov 2022 23:02:39 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.1.0-beta.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-persona_v9.1.0-beta.4)
8
+
9
+ Thu, 17 Nov 2022 23:02:39 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-persona_v9.1.0-beta.3..@fluentui/react-persona_v9.1.0-beta.4)
11
+
12
+ ### Changes
13
+
14
+ - feat: Adding size and textAlignment props and updating styles. ([PR #25626](https://github.com/microsoft/fluentui/pull/25626) by esteban.230@hotmail.com)
15
+ - Bump @fluentui/react-avatar to v9.2.7 ([PR #25683](https://github.com/microsoft/fluentui/pull/25683) by beachball)
16
+ - Bump @fluentui/react-badge to v9.0.13 ([PR #25683](https://github.com/microsoft/fluentui/pull/25683) by beachball)
17
+ - Bump @fluentui/react-utilities to v9.2.2 ([PR #25683](https://github.com/microsoft/fluentui/pull/25683) by beachball)
18
+
7
19
  ## [9.1.0-beta.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-persona_v9.1.0-beta.3)
8
20
 
9
- Fri, 11 Nov 2022 14:53:56 GMT
21
+ Fri, 11 Nov 2022 14:58:09 GMT
10
22
  [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
23
 
12
24
  ### 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?: 'before' | 'after' | 'below';
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 = {
@@ -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, 'textPosition' | 'presenceOnly'>> & {
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
  */
@@ -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 * This defaults to the `name` prop, and it is recomended that you only set its value if it should be different from\n * from 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 position of the text relative to the avatar/presence.\n *\n * @default after\n */\n textPosition?: 'before' | 'after' | 'below';\n};\n\n/**\n * State used in rendering Persona\n */\nexport type PersonaState = ComponentState<PersonaSlots> &\n Required<Pick<PersonaProps, 'textPosition' | 'presenceOnly'>> & {\n /**\n * Whether the sizing type is fixed or not.\n */\n fixed: boolean;\n /**\n * The number of text lines used.\n */\n numTextLines: number;\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 * This defaults to the `name` prop, and it is recomended that you only set its value if it should be different from\n * from 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
- textPosition = 'after',
18
- name
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
- presence,
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;AAKA;;;;;;;;AAQG;;AACH,OAAO,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,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,IAAI,KAAK,GAAG,KAAZ;;EACA,IAAI,CAAC,YAAD,IAAiB,KAAK,CAAC,MAA3B,EAAmC;IACjC,KAAK,GA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E;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,CANP;IAgBL,IAAI,EAAE,qBAAqB,CACzB,KADyB,EAEzB,EACE,GAAG,KADL;MAEE;IAFF,CAFyB;IAMzB;IAAwB,CAAC,MAAD,CANC,CAhBtB;IAwBL,MAxBK;IAyBL,QAzBK;IA0BL,WA1BK;IA2BL,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
+ {"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,gBAAg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K;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/"}
@@ -9,25 +9,24 @@ export const personaClassNames = {
9
9
  tertiaryText: 'fui-Persona__tertiaryText',
10
10
  quaternaryText: 'fui-Persona__quaternaryText'
11
11
  };
12
+ const avatarSpacing = `--fui-Persona__avatar--spacing`;
12
13
  /**
13
14
  * Styles for the root slot
14
15
  */
15
16
 
16
17
  const useStyles = /*#__PURE__*/__styles({
17
- "root": {
18
+ "base": {
18
19
  "mc9l5x": "fwk3njj",
19
20
  "t4k1zu": "f4wu0r3",
20
21
  "v29qe6": "fvtn1bl"
21
22
  },
22
23
  "after": {
23
24
  "Bxotwcr": "f1u07yai",
24
- "B7hvi0a": "f1m2n5bn",
25
- "i8kkvl": "f4px1ci"
25
+ "B7hvi0a": "f1m2n5bn"
26
26
  },
27
27
  "before": {
28
28
  "Bxotwcr": "f1u07yai",
29
- "B7hvi0a": "f1tll2w5",
30
- "i8kkvl": "f4px1ci"
29
+ "B7hvi0a": "f1tll2w5"
31
30
  },
32
31
  "below": {
33
32
  "B7hvi0a": "f1oiokrs"
@@ -35,14 +34,67 @@ const useStyles = /*#__PURE__*/__styles({
35
34
  "coin": {
36
35
  "Ijaq50": "f1hek2iy"
37
36
  },
38
- "fixed": {
37
+ "start": {
39
38
  "qb2dma": "f9h729m"
40
39
  },
41
- "scaled": {
40
+ "center": {
42
41
  "qb2dma": "f7nlbp4"
42
+ },
43
+ "alignToPrimary": {
44
+ "Budl1dq": "fv2o0x6"
45
+ },
46
+ "afterAlignToPrimary": {
47
+ "qb2dma": "f7nlbp4",
48
+ "Ijaq50": "f1rnkkuc",
49
+ "Bw0ie65": "f1warjpf"
50
+ },
51
+ "beforeAlignToPrimary": {
52
+ "qb2dma": "f7nlbp4",
53
+ "Ijaq50": "f1rnkkuc",
54
+ "Br312pm": "fwu52yu"
55
+ }
56
+ }, {
57
+ "d": [".fwk3njj{display:inline-grid;}", ".f4wu0r3{grid-auto-columns:max-content;}", ".fvtn1bl{grid-auto-rows:max-content;}", ".f1u07yai{grid-auto-flow:column;}", ".f1m2n5bn{justify-items:start;}", ".f1tll2w5{justify-items:end;}", ".f1oiokrs{justify-items:center;}", ".f1hek2iy{grid-row-start:span 5;}", ".f9h729m{-webkit-align-self:start;-ms-flex-item-align:start;align-self:start;}", ".f7nlbp4{-webkit-align-self:center;-ms-flex-item-align:center;align-self:center;}", ".fv2o0x6{grid-template-columns:max-content [middle] max-content;}", ".f1rnkkuc{grid-row-start:unset;}", ".f1warjpf{grid-column-end:middle;}", ".fwu52yu{grid-column-start:middle;}"]
58
+ });
59
+
60
+ const useAvatarSpacingStyles = /*#__PURE__*/__styles({
61
+ "extra-small": {
62
+ "Bs1gm4r": "f1e48tse"
63
+ },
64
+ "small": {
65
+ "Bs1gm4r": "f18q9vkd"
66
+ },
67
+ "medium": {
68
+ "Bs1gm4r": "f18q9vkd"
69
+ },
70
+ "large": {
71
+ "Bs1gm4r": "fx34bi6"
72
+ },
73
+ "extra-large": {
74
+ "Bs1gm4r": "fx34bi6"
75
+ },
76
+ "huge": {
77
+ "Bs1gm4r": "f1o96qtm"
78
+ },
79
+ "after": {
80
+ "t21cq0": ["f103ycu4", "f1tao51"]
81
+ },
82
+ "below": {
83
+ "jrapky": "fbo7acy"
84
+ },
85
+ "before": {
86
+ "Frg6f3": ["f1tao51", "f103ycu4"]
87
+ }
88
+ }, {
89
+ "d": [".f1e48tse{--fui-Persona__avatar--spacing:var(--spacingHorizontalSNudge);}", ".f18q9vkd{--fui-Persona__avatar--spacing:var(--spacingHorizontalS);}", ".fx34bi6{--fui-Persona__avatar--spacing:var(--spacingHorizontalMNudge);}", ".f1o96qtm{--fui-Persona__avatar--spacing:var(--spacingHorizontalM);}", ".f103ycu4{margin-right:var(--fui-Persona__avatar--spacing);}", ".f1tao51{margin-left:var(--fui-Persona__avatar--spacing);}", ".fbo7acy{margin-bottom:var(--fui-Persona__avatar--spacing);}"]
90
+ });
91
+
92
+ const usePresenceSpacingStyles = /*#__PURE__*/__styles({
93
+ "small": {
94
+ "Bs1gm4r": "f1e48tse"
43
95
  }
44
96
  }, {
45
- "d": [".fwk3njj{display:inline-grid;}", ".f4wu0r3{grid-auto-columns:max-content;}", ".fvtn1bl{grid-auto-rows:max-content;}", ".f1u07yai{grid-auto-flow:column;}", ".f1m2n5bn{justify-items:start;}", ".f4px1ci{-webkit-column-gap:8px;column-gap:8px;}", ".f1tll2w5{justify-items:end;}", ".f1oiokrs{justify-items:center;}", ".f1hek2iy{grid-row-start:span 5;}", ".f9h729m{-webkit-align-self:start;-ms-flex-item-align:start;align-self:start;}", ".f7nlbp4{-webkit-align-self:center;-ms-flex-item-align:center;align-self:center;}"]
97
+ "d": [".f1e48tse{--fui-Persona__avatar--spacing:var(--spacingHorizontalSNudge);}"]
46
98
  });
47
99
  /**
48
100
  * Apply styling to the Persona slots based on the state
@@ -51,22 +103,28 @@ const useStyles = /*#__PURE__*/__styles({
51
103
 
52
104
  export const usePersonaStyles_unstable = state => {
53
105
  const {
54
- fixed,
106
+ size,
107
+ textAlignment,
55
108
  textPosition
56
109
  } = state;
57
- const styles = useStyles();
110
+ const alignToPrimary = textAlignment === 'start' && size !== 'extra-large' && size !== 'huge';
58
111
  const {
59
112
  primaryTextClassName,
60
113
  optionalTextClassName
61
- } = useTextClassNames(state);
62
- state.root.className = mergeClasses(personaClassNames.root, styles.root, styles[textPosition], state.root.className);
114
+ } = useTextClassNames(state, alignToPrimary);
115
+ const styles = useStyles();
116
+ const avatarSpacingStyles = useAvatarSpacingStyles();
117
+ const presenceSpacingStyles = { ...avatarSpacingStyles,
118
+ ...usePresenceSpacingStyles()
119
+ };
120
+ state.root.className = mergeClasses(personaClassNames.root, styles.base, styles[textPosition], textPosition !== 'below' && alignToPrimary && styles.alignToPrimary, state.root.className);
63
121
 
64
122
  if (state.avatar) {
65
- state.avatar.className = mergeClasses(personaClassNames.avatar, styles.coin, fixed ? styles.fixed : styles.scaled, state.avatar.className);
123
+ state.avatar.className = mergeClasses(personaClassNames.avatar, styles.coin, styles[textAlignment], avatarSpacingStyles[size], avatarSpacingStyles[textPosition], state.avatar.className);
66
124
  }
67
125
 
68
126
  if (state.presence) {
69
- state.presence.className = mergeClasses(personaClassNames.presence, styles.coin, fixed ? styles.fixed : styles.scaled, state.presence.className);
127
+ state.presence.className = mergeClasses(personaClassNames.presence, styles.coin, styles[textAlignment], presenceSpacingStyles[size], presenceSpacingStyles[textPosition], textPosition === 'after' && alignToPrimary && styles.afterAlignToPrimary, textPosition === 'before' && alignToPrimary && styles.beforeAlignToPrimary, state.presence.className);
70
128
  }
71
129
 
72
130
  if (state.primaryText) {
@@ -98,6 +156,12 @@ const useTextStyles = /*#__PURE__*/__styles({
98
156
  "optionalText": {
99
157
  "sj55zd": "fkfq4zb"
100
158
  },
159
+ "beforeAlignToPrimary": {
160
+ "Bw0ie65": "f1warjpf"
161
+ },
162
+ "afterAlignToPrimary": {
163
+ "Br312pm": "fwu52yu"
164
+ },
101
165
  "body1": {
102
166
  "Bahqtrf": "fk6fouc",
103
167
  "Be2twd7": "fkhj508",
@@ -115,94 +179,50 @@ const useTextStyles = /*#__PURE__*/__styles({
115
179
  "Be2twd7": "fod5ikn",
116
180
  "Bhrd7zp": "fl43uef",
117
181
  "Bg96gwp": "faaz57k"
118
- },
119
- "subtitle1": {
120
- "Bahqtrf": "fk6fouc",
121
- "Be2twd7": "f1pp30po",
122
- "Bhrd7zp": "fl43uef",
123
- "Bg96gwp": "f106mvju"
124
- },
125
- "title2": {
126
- "Bahqtrf": "fk6fouc",
127
- "Be2twd7": "fojgt09",
128
- "Bhrd7zp": "fl43uef",
129
- "Bg96gwp": "fcen8rp"
130
- },
131
- "title3": {
132
- "Bahqtrf": "fk6fouc",
133
- "Be2twd7": "f1x0m3f5",
134
- "Bhrd7zp": "fl43uef",
135
- "Bg96gwp": "fb86gi6"
136
182
  }
137
183
  }, {
138
- "d": [".ftgm304{display:block;}", ".f19n0e5{color:var(--colorNeutralForeground1);}", ".fkfq4zb{color:var(--colorNeutralForeground2);}", ".fk6fouc{font-family:var(--fontFamilyBase);}", ".fkhj508{font-size:var(--fontSizeBase300);}", ".figsok6{font-weight:var(--fontWeightRegular);}", ".f1i3iumi{line-height:var(--lineHeightBase300);}", ".fy9rknc{font-size:var(--fontSizeBase200);}", ".fwrc4pm{line-height:var(--lineHeightBase200);}", ".fod5ikn{font-size:var(--fontSizeBase400);}", ".fl43uef{font-weight:var(--fontWeightSemibold);}", ".faaz57k{line-height:var(--lineHeightBase400);}", ".f1pp30po{font-size:var(--fontSizeBase500);}", ".f106mvju{line-height:var(--lineHeightBase500);}", ".fojgt09{font-size:var(--fontSizeHero700);}", ".fcen8rp{line-height:var(--lineHeightHero700);}", ".f1x0m3f5{font-size:var(--fontSizeBase600);}", ".fb86gi6{line-height:var(--lineHeightBase600);}"]
184
+ "d": [".ftgm304{display:block;}", ".f19n0e5{color:var(--colorNeutralForeground1);}", ".fkfq4zb{color:var(--colorNeutralForeground2);}", ".f1warjpf{grid-column-end:middle;}", ".fwu52yu{grid-column-start:middle;}", ".fk6fouc{font-family:var(--fontFamilyBase);}", ".fkhj508{font-size:var(--fontSizeBase300);}", ".figsok6{font-weight:var(--fontWeightRegular);}", ".f1i3iumi{line-height:var(--lineHeightBase300);}", ".fy9rknc{font-size:var(--fontSizeBase200);}", ".fwrc4pm{line-height:var(--lineHeightBase200);}", ".fod5ikn{font-size:var(--fontSizeBase400);}", ".fl43uef{font-weight:var(--fontWeightSemibold);}", ".faaz57k{line-height:var(--lineHeightBase400);}"]
139
185
  });
140
186
 
141
- const useTextClassNames = state => {
187
+ const useTextClassNames = (state, alignToPrimary) => {
142
188
  const {
143
- fixed,
144
- numTextLines,
145
- presenceOnly
189
+ presenceOnly,
190
+ size,
191
+ textPosition
146
192
  } = state;
147
193
  const textStyles = useTextStyles();
148
194
  let primaryTextSize;
149
- let optionalTextSize;
150
-
151
- if (fixed) {
152
- if (state.avatar && state.avatar.size) {
153
- const {
154
- size
155
- } = state.avatar;
156
-
157
- if (size < 40) {
158
- primaryTextSize = textStyles.body1;
159
- optionalTextSize = textStyles.caption1;
160
- } else if (size < 64) {
161
- primaryTextSize = textStyles.subtitle2;
162
- optionalTextSize = textStyles.body1;
163
- } else if (size < 96) {
164
- primaryTextSize = textStyles.subtitle1;
165
- optionalTextSize = textStyles.caption1;
166
- } else {
167
- if (numTextLines > 1) {
168
- primaryTextSize = textStyles.title3;
169
- } else {
170
- primaryTextSize = textStyles.title2;
171
- }
172
-
173
- optionalTextSize = textStyles.body1;
174
- }
175
- } else if (presenceOnly && state.presence) {
176
- const {
177
- size
178
- } = state.presence;
179
-
180
- if (size === 'extra-small' || size === 'tiny') {
181
- if (numTextLines > 1) {
182
- primaryTextSize = textStyles.body1;
183
- } else {
184
- primaryTextSize = textStyles.caption1;
185
- }
186
-
187
- optionalTextSize = textStyles.caption1;
188
- } else {
189
- primaryTextSize = textStyles.body1;
190
- optionalTextSize = textStyles.caption1;
195
+ let alignToPrimaryClassName;
196
+
197
+ if (presenceOnly) {
198
+ if (size === 'extra-small') {
199
+ primaryTextSize = state.numTextLines > 1 ? textStyles.body1 : textStyles.caption1;
200
+ } else if (size === 'extra-large' || size === 'huge') {
201
+ primaryTextSize = textStyles.subtitle2;
202
+ } else {
203
+ primaryTextSize = textStyles.body1;
204
+ }
205
+
206
+ if (alignToPrimary) {
207
+ if (textPosition === 'before') {
208
+ alignToPrimaryClassName = textStyles.beforeAlignToPrimary;
209
+ } else if (textPosition === 'after') {
210
+ alignToPrimaryClassName = textStyles.afterAlignToPrimary;
191
211
  }
192
212
  }
193
213
  } else {
194
- if (numTextLines > 1) {
195
- primaryTextSize = textStyles.body1;
214
+ if (size === 'huge') {
215
+ primaryTextSize = textStyles.subtitle2;
216
+ } else if (size === 'extra-large') {
217
+ primaryTextSize = textStyles.subtitle2;
196
218
  } else {
197
- primaryTextSize = textStyles.caption1;
219
+ primaryTextSize = textStyles.body1;
198
220
  }
199
-
200
- optionalTextSize = textStyles.caption1;
201
221
  }
202
222
 
203
223
  return {
204
- primaryTextClassName: mergeClasses(textStyles.base, textStyles.primaryText, primaryTextSize),
205
- optionalTextClassName: mergeClasses(textStyles.base, textStyles.optionalText, optionalTextSize)
224
+ primaryTextClassName: mergeClasses(textStyles.base, textStyles.primaryText, primaryTextSize, alignToPrimaryClassName),
225
+ optionalTextClassName: mergeClasses(textStyles.base, textStyles.optionalText, !presenceOnly && size === 'huge' ? textStyles.body1 : textStyles.caption1, alignToPrimaryClassName)
206
226
  };
207
227
  };
208
228
  //# sourceMappingURL=usePersonaStyles.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Persona/usePersonaStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,QAAyC,gBAAzC;AACA,SAAS,MAAT,EAAiB,gBAAjB,QAAyC,uBAAzC;AAIA,OAAO,MAAM,iBAAiB,GAAiC;EAC7D,IAAI,EAAE,aADuD;EAE7D,MAAM,EAAE,qBAFqD;EAG7D,QAAQ,EAAE,uBAHmD;EAI7D,WAAW,EAAE,0BAJgD;EAK7D,aAAa,EAAE,4BAL8C;EAM7D,YAAY,EAAE,2BAN+C;EAO7D,cAAc,EAAE;AAP6C,CAAxD;AAUP;;AAEG;;AACH,MAAM,SAAS,gBAAG;EAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA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B,EAAE,YAAY,CAAC,UAAU,CAAC,IAAZ,EAAkB,UAAU,CAAC,WAA7B,EAA0C,eAA1C,CAD7B;IAEL,qBAAqB,EAAE,YAAY,CAAC,UAAU,CAAC,IAAZ,EAAkB,UAAU,CAAC,YAA7B,EAA2C,gBAA3C;EAF9B,CAAP;AAID,CA5DD","sourcesContent":["import { 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\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n display: 'inline-grid',\n gridAutoColumns: 'max-content',\n gridAutoRows: 'max-content',\n },\n after: {\n gridAutoFlow: 'column',\n justifyItems: 'start',\n columnGap: '8px',\n },\n before: {\n gridAutoFlow: 'column',\n justifyItems: 'end',\n columnGap: '8px',\n },\n below: {\n justifyItems: 'center',\n },\n coin: {\n gridRowStart: 'span 5',\n },\n\n fixed: {\n alignSelf: 'start',\n },\n scaled: {\n alignSelf: 'center',\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 { fixed, textPosition } = state;\n const styles = useStyles();\n const { primaryTextClassName, optionalTextClassName } = useTextClassNames(state);\n\n state.root.className = mergeClasses(personaClassNames.root, styles.root, styles[textPosition], state.root.className);\n\n if (state.avatar) {\n state.avatar.className = mergeClasses(\n personaClassNames.avatar,\n styles.coin,\n fixed ? styles.fixed : styles.scaled,\n state.avatar.className,\n );\n }\n\n if (state.presence) {\n state.presence.className = mergeClasses(\n personaClassNames.presence,\n styles.coin,\n fixed ? styles.fixed : styles.scaled,\n state.presence.className,\n );\n }\n\n if (state.primaryText) {\n state.primaryText.className = mergeClasses(\n personaClassNames.primaryText,\n primaryTextClassName,\n state.primaryText.className,\n );\n }\n\n if (state.secondaryText) {\n state.secondaryText.className = mergeClasses(\n personaClassNames.secondaryText,\n optionalTextClassName,\n state.secondaryText.className,\n );\n }\n\n if (state.tertiaryText) {\n state.tertiaryText.className = mergeClasses(\n personaClassNames.tertiaryText,\n optionalTextClassName,\n state.tertiaryText.className,\n );\n }\n\n if (state.quaternaryText) {\n state.quaternaryText.className = mergeClasses(\n personaClassNames.quaternaryText,\n optionalTextClassName,\n state.quaternaryText.className,\n );\n }\n\n return state;\n};\n\nconst useTextStyles = makeStyles({\n base: {\n display: 'block',\n },\n primaryText: {\n color: tokens.colorNeutralForeground1,\n },\n optionalText: {\n color: tokens.colorNeutralForeground2,\n },\n\n body1: typographyStyles.body1,\n caption1: typographyStyles.caption1,\n subtitle2: typographyStyles.subtitle2,\n subtitle1: typographyStyles.subtitle1,\n title2: typographyStyles.title2,\n title3: typographyStyles.title3,\n});\n\nconst useTextClassNames = (\n state: PersonaState,\n): {\n primaryTextClassName: string;\n optionalTextClassName: string;\n} => {\n const { fixed, numTextLines, presenceOnly } = state;\n const textStyles = useTextStyles();\n let primaryTextSize;\n let optionalTextSize;\n\n if (fixed) {\n if (state.avatar && state.avatar.size) {\n const { size } = state.avatar;\n\n if (size < 40) {\n primaryTextSize = textStyles.body1;\n optionalTextSize = textStyles.caption1;\n } else if (size < 64) {\n primaryTextSize = textStyles.subtitle2;\n optionalTextSize = textStyles.body1;\n } else if (size < 96) {\n primaryTextSize = textStyles.subtitle1;\n optionalTextSize = textStyles.caption1;\n } else {\n if (numTextLines > 1) {\n primaryTextSize = textStyles.title3;\n } else {\n primaryTextSize = textStyles.title2;\n }\n optionalTextSize = textStyles.body1;\n }\n } else if (presenceOnly && state.presence) {\n const { size } = state.presence;\n\n if (size === 'extra-small' || size === 'tiny') {\n if (numTextLines > 1) {\n primaryTextSize = textStyles.body1;\n } else {\n primaryTextSize = textStyles.caption1;\n }\n optionalTextSize = textStyles.caption1;\n } else {\n primaryTextSize = textStyles.body1;\n optionalTextSize = textStyles.caption1;\n }\n }\n } else {\n if (numTextLines > 1) {\n primaryTextSize = textStyles.body1;\n } else {\n primaryTextSize = textStyles.caption1;\n }\n optionalTextSize = textStyles.caption1;\n }\n\n return {\n primaryTextClassName: mergeClasses(textStyles.base, textStyles.primaryText, primaryTextSize),\n optionalTextClassName: mergeClasses(textStyles.base, textStyles.optionalText, optionalTextSize),\n };\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-persona/src/components/Persona/usePersonaStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,QAAyC,gBAAzC;AACA,SAAS,MAAT,EAAiB,gBAAjB,QAAyC,uBAAzC;AAIA,OAAO,MAAM,iBAAiB,GAAiC;EAC7D,IAAI,EAAE,aADuD;EAE7D,MAAM,EAAE,qBAFqD;EAG7D,QAAQ,EAAE,uBAHmD;EAI7D,WAAW,EAAE,0BAJgD;EAK7D,aAAa,EAAE,4BAL8C;EAM7D,YAAY,EAAE,2BAN+C;EAO7D,cAAc,EAAE;AAP6C,CAAxD;AAUP,MAAM,aAAa,GAAG,gCAAtB;AAEA;;AAEG;;AACH,MAAM,SAAS,gBAAG;EAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAAlB;;AA4CA,MAAM,sBAAsB,gBAAG;EAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;EAAA;E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AFqB,EAGhC,eAHgC,EAIhC,uBAJgC,CAD7B;IAOL,qBAAqB,EAAE,YAAY,CACjC,UAAU,CAAC,IADsB,EAEjC,UAAU,CAAC,YAFsB,EAGjC,CAAC,YAAD,IAAiB,IAAI,KAAK,MAA1B,GAAmC,UAAU,CAAC,KAA9C,GAAsD,UAAU,CAAC,QAHhC,EAIjC,uBAJiC;EAP9B,CAAP;AAcD,CArDD","sourcesContent":["import { 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\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n base: {\n display: 'inline-grid',\n gridAutoColumns: 'max-content',\n gridAutoRows: 'max-content',\n },\n after: {\n gridAutoFlow: 'column',\n justifyItems: 'start',\n },\n before: {\n gridAutoFlow: 'column',\n justifyItems: 'end',\n },\n below: {\n justifyItems: 'center',\n },\n coin: {\n gridRowStart: 'span 5',\n },\n\n start: {\n alignSelf: 'start',\n },\n center: {\n alignSelf: 'center',\n },\n\n // These alignToPrimary styles are needed due to presence being too small to center with the primary text.\n alignToPrimary: {\n gridTemplateColumns: `max-content [middle] max-content`,\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\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 { size, textAlignment, textPosition } = state;\n const alignToPrimary = textAlignment === 'start' && size !== 'extra-large' && size !== 'huge';\n const { primaryTextClassName, optionalTextClassName } = useTextClassNames(state, alignToPrimary);\n\n const styles = useStyles();\n const avatarSpacingStyles = useAvatarSpacingStyles();\n const presenceSpacingStyles = { ...avatarSpacingStyles, ...usePresenceSpacingStyles() };\n\n state.root.className = mergeClasses(\n personaClassNames.root,\n styles.base,\n styles[textPosition],\n textPosition !== 'below' && alignToPrimary && styles.alignToPrimary,\n state.root.className,\n );\n\n if (state.avatar) {\n state.avatar.className = mergeClasses(\n personaClassNames.avatar,\n styles.coin,\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 styles.coin,\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 primaryTextClassName,\n state.primaryText.className,\n );\n }\n\n if (state.secondaryText) {\n state.secondaryText.className = mergeClasses(\n personaClassNames.secondaryText,\n optionalTextClassName,\n state.secondaryText.className,\n );\n }\n\n if (state.tertiaryText) {\n state.tertiaryText.className = mergeClasses(\n personaClassNames.tertiaryText,\n optionalTextClassName,\n state.tertiaryText.className,\n );\n }\n\n if (state.quaternaryText) {\n state.quaternaryText.className = mergeClasses(\n personaClassNames.quaternaryText,\n optionalTextClassName,\n state.quaternaryText.className,\n );\n }\n\n return state;\n};\n\nconst useTextStyles = makeStyles({\n base: {\n display: 'block',\n },\n primaryText: {\n color: tokens.colorNeutralForeground1,\n },\n optionalText: {\n color: tokens.colorNeutralForeground2,\n },\n\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 textStyles = useTextStyles();\n\n let primaryTextSize;\n let alignToPrimaryClassName;\n\n if (presenceOnly) {\n if (size === 'extra-small') {\n primaryTextSize = state.numTextLines > 1 ? textStyles.body1 : textStyles.caption1;\n } else if (size === 'extra-large' || size === 'huge') {\n primaryTextSize = textStyles.subtitle2;\n } else {\n primaryTextSize = textStyles.body1;\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 } else {\n primaryTextSize = textStyles.body1;\n }\n }\n\n return {\n primaryTextClassName: mergeClasses(\n textStyles.base,\n textStyles.primaryText,\n primaryTextSize,\n alignToPrimaryClassName,\n ),\n optionalTextClassName: mergeClasses(\n textStyles.base,\n textStyles.optionalText,\n !presenceOnly && size === 'huge' ? textStyles.body1 : textStyles.caption1,\n alignToPrimaryClassName,\n ),\n };\n};\n"],"sourceRoot":"../src/"}
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,SACE,OADF,EAEE,iBAFF,EAGE,sBAHF,EAIE,yBAJF,EAKE,mBALF,QAMO,WANP","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"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-persona/src/index.ts"],"names":[],"mappings":"AAAA,SACE,OADF,EAEE,iBAFF,EAGE,sBAHF,EAIE,yBAJF,EAKE,mBALF,QAMO,WANP","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"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["Persona.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,4BAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/Persona/index';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-persona/src/Persona.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,4BAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/Persona/index';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Persona/Persona.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,iBAAA,CAAA;;AACA,MAAA,YAAA,gBAAA,OAAA,CAAA,cAAA,CAAA;;AACA,MAAA,kBAAA,gBAAA,OAAA,CAAA,oBAAA,CAAA;AAIA;;;AAGG;;;AACU,OAAA,CAAA,OAAA,gBAA6C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EACxF,MAAM,KAAK,GAAG,YAAA,CAAA,mBAAA,CAAoB,KAApB,EAA2B,GAA3B,CAAd;EAEA,kBAAA,CAAA,yBAAA,CAA0B,KAA1B;EACA,OAAO,eAAA,CAAA,sBAAA,CAAuB,KAAvB,CAAP;AACD,CALyD,CAA7C;AAOb,OAAA,CAAA,OAAA,CAAQ,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,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,iBAAA,CAAA;;AACA,MAAA,YAAA,gBAAA,OAAA,CAAA,cAAA,CAAA;;AACA,MAAA,kBAAA,gBAAA,OAAA,CAAA,oBAAA,CAAA;AAIA;;;AAGG;;;AACU,OAAA,CAAA,OAAA,gBAA6C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EACxF,MAAM,KAAK,GAAG,YAAA,CAAA,mBAAA,CAAoB,KAApB,EAA2B,GAA3B,CAAd;EAEA,kBAAA,CAAA,yBAAA,CAA0B,KAA1B;EACA,OAAO,eAAA,CAAA,sBAAA,CAAuB,KAAvB,CAAP;AACD,CALyD,CAA7C;AAOb,OAAA,CAAA,OAAA,CAAQ,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,"sources":["components/Persona/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,WAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,cAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,oBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './Persona';\nexport * from './Persona.types';\nexport * from './renderPersona';\nexport * from './usePersona';\nexport * from './usePersonaStyles';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-persona/src/components/Persona/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,WAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,cAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,oBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './Persona';\nexport * from './Persona.types';\nexport * from './renderPersona';\nexport * from './usePersona';\nexport * from './usePersonaStyles';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Persona/renderPersona.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,sBAAsB,GAAI,KAAD,IAAwB;EAC5D,MAAM;IAAE,YAAF;IAAgB;EAAhB,IAAiC,KAAvC;EACA,MAAM;IAAE,KAAF;IAAS;EAAT,IAAuB,iBAAA,CAAA,QAAA,CAAuB,KAAvB,CAA7B;EAEA,MAAM,IAAI,GAAG,YAAY,GACrB,KAAK,CAAC,QAAN,IAAkB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,QAAP,EAAe,EAAA,GAAK,SAAS,CAAC;EAAf,CAAf,CADG,GAErB,KAAK,CAAC,MAAN,IAAgB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,MAAP,EAAa,EAAA,GAAK,SAAS,CAAC;EAAf,CAAb,CAFpB;EAIA,OACE,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,IAAqB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,WAAP,EAAkB,EAAA,GAAK,SAAS,CAAC;EAAf,CAAlB,CAFxB,EAGG,KAAK,CAAC,aAAN,IAAuB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,aAAP,EAAoB,EAAA,GAAK,SAAS,CAAC;EAAf,CAApB,CAH1B,EAIG,KAAK,CAAC,YAAN,IAAsB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,YAAP,EAAmB,EAAA,GAAK,SAAS,CAAC;EAAf,CAAnB,CAJzB,EAKG,KAAK,CAAC,cAAN,IAAwB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,cAAP,EAAqB,EAAA,GAAK,SAAS,CAAC;EAAf,CAArB,CAL3B,EAMG,YAAY,KAAK,QAAjB,IAA6B,IANhC,CADF;AAUD,CAlBM;;AAAM,OAAA,CAAA,sBAAA,GAAsB,sBAAtB","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,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,sBAAsB,GAAI,KAAD,IAAwB;EAC5D,MAAM;IAAE,YAAF;IAAgB;EAAhB,IAAiC,KAAvC;EACA,MAAM;IAAE,KAAF;IAAS;EAAT,IAAuB,iBAAA,CAAA,QAAA,CAAuB,KAAvB,CAA7B;EAEA,MAAM,IAAI,GAAG,YAAY,GACrB,KAAK,CAAC,QAAN,IAAkB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,QAAP,EAAe,EAAA,GAAK,SAAS,CAAC;EAAf,CAAf,CADG,GAErB,KAAK,CAAC,MAAN,IAAgB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,MAAP,EAAa,EAAA,GAAK,SAAS,CAAC;EAAf,CAAb,CAFpB;EAIA,OACE,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,IAAqB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,WAAP,EAAkB,EAAA,GAAK,SAAS,CAAC;EAAf,CAAlB,CAFxB,EAGG,KAAK,CAAC,aAAN,IAAuB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,aAAP,EAAoB,EAAA,GAAK,SAAS,CAAC;EAAf,CAApB,CAH1B,EAIG,KAAK,CAAC,YAAN,IAAsB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,YAAP,EAAmB,EAAA,GAAK,SAAS,CAAC;EAAf,CAAnB,CAJzB,EAKG,KAAK,CAAC,cAAN,IAAwB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,cAAP,EAAqB,EAAA,GAAK,SAAS,CAAC;EAAf,CAArB,CAL3B,EAMG,YAAY,KAAK,QAAjB,IAA6B,IANhC,CADF;AAUD,CAlBM;;AAAM,OAAA,CAAA,sBAAA,GAAsB,sBAAtB","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/"}
@@ -23,9 +23,11 @@ const react_badge_1 = /*#__PURE__*/require("@fluentui/react-badge");
23
23
 
24
24
  const usePersona_unstable = (props, ref) => {
25
25
  const {
26
+ name,
26
27
  presenceOnly = false,
27
- textPosition = 'after',
28
- name
28
+ size = 'medium',
29
+ textAlignment = 'start',
30
+ textPosition = 'after'
29
31
  } = props;
30
32
  const primaryText = react_utilities_1.resolveShorthand(props.primaryText, {
31
33
  required: true,
@@ -37,54 +39,11 @@ const usePersona_unstable = (props, ref) => {
37
39
  const tertiaryText = react_utilities_1.resolveShorthand(props.tertiaryText);
38
40
  const quaternaryText = react_utilities_1.resolveShorthand(props.quaternaryText);
39
41
  const numTextLines = [primaryText, secondaryText, tertiaryText, quaternaryText].filter(Boolean).length;
40
- let fixed = false;
41
-
42
- if (!presenceOnly && props.avatar) {
43
- fixed = !!props.avatar.size;
44
- } else if (props.presence && props.presence) {
45
- fixed = !!props.presence.size;
46
- }
47
-
48
- let avatarSize = undefined;
49
- let presenceSize = undefined;
50
-
51
- if (presenceOnly && !fixed) {
52
- if (numTextLines === 1) {
53
- presenceSize = 'small';
54
- } else if (numTextLines === 2) {
55
- presenceSize = 'large';
56
- } else {
57
- presenceSize = 'extra-large';
58
- }
59
- } else if (!fixed) {
60
- if (numTextLines === 1) {
61
- avatarSize = 16;
62
- } else if (numTextLines === 2) {
63
- avatarSize = 32;
64
- } else if (numTextLines === 3) {
65
- avatarSize = 56;
66
- } else {
67
- avatarSize = 72;
68
- }
69
- }
70
-
71
- const avatar = !presenceOnly ? react_utilities_1.resolveShorthand(props.avatar, {
72
- required: true,
73
- defaultProps: {
74
- name,
75
- badge: props.presence,
76
- size: avatarSize
77
- }
78
- }) : undefined;
79
- const presence = presenceOnly ? react_utilities_1.resolveShorthand(props.presence, {
80
- defaultProps: {
81
- size: presenceSize
82
- }
83
- }) : undefined;
84
42
  return {
85
- fixed,
86
43
  numTextLines,
87
44
  presenceOnly,
45
+ size,
46
+ textAlignment,
88
47
  textPosition,
89
48
  components: {
90
49
  root: 'div',
@@ -100,8 +59,19 @@ const usePersona_unstable = (props, ref) => {
100
59
  },
101
60
  /* excludedPropNames */
102
61
  ['name']),
103
- avatar,
104
- presence,
62
+ avatar: !presenceOnly ? react_utilities_1.resolveShorthand(props.avatar, {
63
+ required: true,
64
+ defaultProps: {
65
+ name,
66
+ badge: props.presence,
67
+ size: avatarSizes[size]
68
+ }
69
+ }) : undefined,
70
+ presence: presenceOnly ? react_utilities_1.resolveShorthand(props.presence, {
71
+ defaultProps: {
72
+ size: presenceSizes[size]
73
+ }
74
+ }) : undefined,
105
75
  primaryText,
106
76
  secondaryText,
107
77
  tertiaryText,
@@ -110,4 +80,20 @@ const usePersona_unstable = (props, ref) => {
110
80
  };
111
81
 
112
82
  exports.usePersona_unstable = usePersona_unstable;
83
+ const presenceSizes = {
84
+ 'extra-small': 'tiny',
85
+ small: 'extra-small',
86
+ medium: 'small',
87
+ large: 'medium',
88
+ 'extra-large': 'large',
89
+ huge: 'large'
90
+ };
91
+ const avatarSizes = {
92
+ 'extra-small': 20,
93
+ small: 28,
94
+ medium: 32,
95
+ large: 36,
96
+ 'extra-large': 40,
97
+ huge: 56
98
+ };
113
99
  //# sourceMappingURL=usePersona.js.map
@@ -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;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,CAApC,CAApB;EAMA,MAAM,aAAa,GAAG,iBAAA,CAAA,gBAAA,CAAiB,KAAK,CAAC,aAAvB,CAAtB;EACA,MAAM,YAAY,GAAG,iBAAA,CAAA,gBAAA,CAAiB,KAAK,CAAC,YAAvB,CAArB;EACA,MAAM,cAAc,GAAG,iBAAA,CAAA,gBAAA,CAAiB,KAAK,CAAC,cAAvB,CAAvB;EAEA,MAAM,YAAY,GAAG,CAAC,WAAD,EAAc,aAAd,EAA6B,YAA7B,EAA2C,cAA3C,EAA2D,MAA3D,CAAkE,OAAlE,EAA2E,MAAhG;E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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/"}
1
+ {"version":3,"sources":["packages/react-components/react-persona/src/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;AAGA;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vB,EAA+B;MAC7B,QAAQ,EAAE,IADmB;MAE7B,YAAY,EAAE;QACZ,IADY;QAEZ,KAAK,EAAE,KAAK,CAAC,QAFD;QAGZ,IAAI,EAAE,WAAW,CAAC,IAAD;MAHL;IAFe,CAA/B,CADI,GASJ,SAlCC;IAmCL,QAAQ,EAAE,YAAY,GAClB,iBAAA,CAAA,gBAAA,CAAiB,KAAK,CAAC,QAAvB,EAAiC;MAC/B,YAAY,EAAE;QACZ,IAAI,EAAE,aAAa,CAAC,IAAD;MADP;IADiB,CAAjC,CADkB,GAMlB,SAzCC;IA0CL,WA1CK;IA2CL,aA3CK;IA4CL,YA5CK;IA6CL;EA7CK,CAAP;AA+CD,CA9DM;;AAAM,OAAA,CAAA,mBAAA,GAAmB,mBAAnB;AAgEb,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/"}
@@ -18,25 +18,24 @@ exports.personaClassNames = {
18
18
  tertiaryText: 'fui-Persona__tertiaryText',
19
19
  quaternaryText: 'fui-Persona__quaternaryText'
20
20
  };
21
+ const avatarSpacing = `--fui-Persona__avatar--spacing`;
21
22
  /**
22
23
  * Styles for the root slot
23
24
  */
24
25
 
25
26
  const useStyles = /*#__PURE__*/react_1.__styles({
26
- "root": {
27
+ "base": {
27
28
  "mc9l5x": "fwk3njj",
28
29
  "t4k1zu": "f4wu0r3",
29
30
  "v29qe6": "fvtn1bl"
30
31
  },
31
32
  "after": {
32
33
  "Bxotwcr": "f1u07yai",
33
- "B7hvi0a": "f1m2n5bn",
34
- "i8kkvl": "f4px1ci"
34
+ "B7hvi0a": "f1m2n5bn"
35
35
  },
36
36
  "before": {
37
37
  "Bxotwcr": "f1u07yai",
38
- "B7hvi0a": "f1tll2w5",
39
- "i8kkvl": "f4px1ci"
38
+ "B7hvi0a": "f1tll2w5"
40
39
  },
41
40
  "below": {
42
41
  "B7hvi0a": "f1oiokrs"
@@ -44,14 +43,67 @@ const useStyles = /*#__PURE__*/react_1.__styles({
44
43
  "coin": {
45
44
  "Ijaq50": "f1hek2iy"
46
45
  },
47
- "fixed": {
46
+ "start": {
48
47
  "qb2dma": "f9h729m"
49
48
  },
50
- "scaled": {
49
+ "center": {
51
50
  "qb2dma": "f7nlbp4"
51
+ },
52
+ "alignToPrimary": {
53
+ "Budl1dq": "fv2o0x6"
54
+ },
55
+ "afterAlignToPrimary": {
56
+ "qb2dma": "f7nlbp4",
57
+ "Ijaq50": "f1rnkkuc",
58
+ "Bw0ie65": "f1warjpf"
59
+ },
60
+ "beforeAlignToPrimary": {
61
+ "qb2dma": "f7nlbp4",
62
+ "Ijaq50": "f1rnkkuc",
63
+ "Br312pm": "fwu52yu"
64
+ }
65
+ }, {
66
+ "d": [".fwk3njj{display:inline-grid;}", ".f4wu0r3{grid-auto-columns:max-content;}", ".fvtn1bl{grid-auto-rows:max-content;}", ".f1u07yai{grid-auto-flow:column;}", ".f1m2n5bn{justify-items:start;}", ".f1tll2w5{justify-items:end;}", ".f1oiokrs{justify-items:center;}", ".f1hek2iy{grid-row-start:span 5;}", ".f9h729m{-webkit-align-self:start;-ms-flex-item-align:start;align-self:start;}", ".f7nlbp4{-webkit-align-self:center;-ms-flex-item-align:center;align-self:center;}", ".fv2o0x6{grid-template-columns:max-content [middle] max-content;}", ".f1rnkkuc{grid-row-start:unset;}", ".f1warjpf{grid-column-end:middle;}", ".fwu52yu{grid-column-start:middle;}"]
67
+ });
68
+
69
+ const useAvatarSpacingStyles = /*#__PURE__*/react_1.__styles({
70
+ "extra-small": {
71
+ "Bs1gm4r": "f1e48tse"
72
+ },
73
+ "small": {
74
+ "Bs1gm4r": "f18q9vkd"
75
+ },
76
+ "medium": {
77
+ "Bs1gm4r": "f18q9vkd"
78
+ },
79
+ "large": {
80
+ "Bs1gm4r": "fx34bi6"
81
+ },
82
+ "extra-large": {
83
+ "Bs1gm4r": "fx34bi6"
84
+ },
85
+ "huge": {
86
+ "Bs1gm4r": "f1o96qtm"
87
+ },
88
+ "after": {
89
+ "t21cq0": ["f103ycu4", "f1tao51"]
90
+ },
91
+ "below": {
92
+ "jrapky": "fbo7acy"
93
+ },
94
+ "before": {
95
+ "Frg6f3": ["f1tao51", "f103ycu4"]
96
+ }
97
+ }, {
98
+ "d": [".f1e48tse{--fui-Persona__avatar--spacing:var(--spacingHorizontalSNudge);}", ".f18q9vkd{--fui-Persona__avatar--spacing:var(--spacingHorizontalS);}", ".fx34bi6{--fui-Persona__avatar--spacing:var(--spacingHorizontalMNudge);}", ".f1o96qtm{--fui-Persona__avatar--spacing:var(--spacingHorizontalM);}", ".f103ycu4{margin-right:var(--fui-Persona__avatar--spacing);}", ".f1tao51{margin-left:var(--fui-Persona__avatar--spacing);}", ".fbo7acy{margin-bottom:var(--fui-Persona__avatar--spacing);}"]
99
+ });
100
+
101
+ const usePresenceSpacingStyles = /*#__PURE__*/react_1.__styles({
102
+ "small": {
103
+ "Bs1gm4r": "f1e48tse"
52
104
  }
53
105
  }, {
54
- "d": [".fwk3njj{display:inline-grid;}", ".f4wu0r3{grid-auto-columns:max-content;}", ".fvtn1bl{grid-auto-rows:max-content;}", ".f1u07yai{grid-auto-flow:column;}", ".f1m2n5bn{justify-items:start;}", ".f4px1ci{-webkit-column-gap:8px;column-gap:8px;}", ".f1tll2w5{justify-items:end;}", ".f1oiokrs{justify-items:center;}", ".f1hek2iy{grid-row-start:span 5;}", ".f9h729m{-webkit-align-self:start;-ms-flex-item-align:start;align-self:start;}", ".f7nlbp4{-webkit-align-self:center;-ms-flex-item-align:center;align-self:center;}"]
106
+ "d": [".f1e48tse{--fui-Persona__avatar--spacing:var(--spacingHorizontalSNudge);}"]
55
107
  });
56
108
  /**
57
109
  * Apply styling to the Persona slots based on the state
@@ -60,22 +112,28 @@ const useStyles = /*#__PURE__*/react_1.__styles({
60
112
 
61
113
  const usePersonaStyles_unstable = state => {
62
114
  const {
63
- fixed,
115
+ size,
116
+ textAlignment,
64
117
  textPosition
65
118
  } = state;
66
- const styles = useStyles();
119
+ const alignToPrimary = textAlignment === 'start' && size !== 'extra-large' && size !== 'huge';
67
120
  const {
68
121
  primaryTextClassName,
69
122
  optionalTextClassName
70
- } = useTextClassNames(state);
71
- state.root.className = react_1.mergeClasses(exports.personaClassNames.root, styles.root, styles[textPosition], state.root.className);
123
+ } = useTextClassNames(state, alignToPrimary);
124
+ const styles = useStyles();
125
+ const avatarSpacingStyles = useAvatarSpacingStyles();
126
+ const presenceSpacingStyles = { ...avatarSpacingStyles,
127
+ ...usePresenceSpacingStyles()
128
+ };
129
+ state.root.className = react_1.mergeClasses(exports.personaClassNames.root, styles.base, styles[textPosition], textPosition !== 'below' && alignToPrimary && styles.alignToPrimary, state.root.className);
72
130
 
73
131
  if (state.avatar) {
74
- state.avatar.className = react_1.mergeClasses(exports.personaClassNames.avatar, styles.coin, fixed ? styles.fixed : styles.scaled, state.avatar.className);
132
+ state.avatar.className = react_1.mergeClasses(exports.personaClassNames.avatar, styles.coin, styles[textAlignment], avatarSpacingStyles[size], avatarSpacingStyles[textPosition], state.avatar.className);
75
133
  }
76
134
 
77
135
  if (state.presence) {
78
- state.presence.className = react_1.mergeClasses(exports.personaClassNames.presence, styles.coin, fixed ? styles.fixed : styles.scaled, state.presence.className);
136
+ state.presence.className = react_1.mergeClasses(exports.personaClassNames.presence, styles.coin, styles[textAlignment], presenceSpacingStyles[size], presenceSpacingStyles[textPosition], textPosition === 'after' && alignToPrimary && styles.afterAlignToPrimary, textPosition === 'before' && alignToPrimary && styles.beforeAlignToPrimary, state.presence.className);
79
137
  }
80
138
 
81
139
  if (state.primaryText) {
@@ -109,6 +167,12 @@ const useTextStyles = /*#__PURE__*/react_1.__styles({
109
167
  "optionalText": {
110
168
  "sj55zd": "fkfq4zb"
111
169
  },
170
+ "beforeAlignToPrimary": {
171
+ "Bw0ie65": "f1warjpf"
172
+ },
173
+ "afterAlignToPrimary": {
174
+ "Br312pm": "fwu52yu"
175
+ },
112
176
  "body1": {
113
177
  "Bahqtrf": "fk6fouc",
114
178
  "Be2twd7": "fkhj508",
@@ -126,94 +190,50 @@ const useTextStyles = /*#__PURE__*/react_1.__styles({
126
190
  "Be2twd7": "fod5ikn",
127
191
  "Bhrd7zp": "fl43uef",
128
192
  "Bg96gwp": "faaz57k"
129
- },
130
- "subtitle1": {
131
- "Bahqtrf": "fk6fouc",
132
- "Be2twd7": "f1pp30po",
133
- "Bhrd7zp": "fl43uef",
134
- "Bg96gwp": "f106mvju"
135
- },
136
- "title2": {
137
- "Bahqtrf": "fk6fouc",
138
- "Be2twd7": "fojgt09",
139
- "Bhrd7zp": "fl43uef",
140
- "Bg96gwp": "fcen8rp"
141
- },
142
- "title3": {
143
- "Bahqtrf": "fk6fouc",
144
- "Be2twd7": "f1x0m3f5",
145
- "Bhrd7zp": "fl43uef",
146
- "Bg96gwp": "fb86gi6"
147
193
  }
148
194
  }, {
149
- "d": [".ftgm304{display:block;}", ".f19n0e5{color:var(--colorNeutralForeground1);}", ".fkfq4zb{color:var(--colorNeutralForeground2);}", ".fk6fouc{font-family:var(--fontFamilyBase);}", ".fkhj508{font-size:var(--fontSizeBase300);}", ".figsok6{font-weight:var(--fontWeightRegular);}", ".f1i3iumi{line-height:var(--lineHeightBase300);}", ".fy9rknc{font-size:var(--fontSizeBase200);}", ".fwrc4pm{line-height:var(--lineHeightBase200);}", ".fod5ikn{font-size:var(--fontSizeBase400);}", ".fl43uef{font-weight:var(--fontWeightSemibold);}", ".faaz57k{line-height:var(--lineHeightBase400);}", ".f1pp30po{font-size:var(--fontSizeBase500);}", ".f106mvju{line-height:var(--lineHeightBase500);}", ".fojgt09{font-size:var(--fontSizeHero700);}", ".fcen8rp{line-height:var(--lineHeightHero700);}", ".f1x0m3f5{font-size:var(--fontSizeBase600);}", ".fb86gi6{line-height:var(--lineHeightBase600);}"]
195
+ "d": [".ftgm304{display:block;}", ".f19n0e5{color:var(--colorNeutralForeground1);}", ".fkfq4zb{color:var(--colorNeutralForeground2);}", ".f1warjpf{grid-column-end:middle;}", ".fwu52yu{grid-column-start:middle;}", ".fk6fouc{font-family:var(--fontFamilyBase);}", ".fkhj508{font-size:var(--fontSizeBase300);}", ".figsok6{font-weight:var(--fontWeightRegular);}", ".f1i3iumi{line-height:var(--lineHeightBase300);}", ".fy9rknc{font-size:var(--fontSizeBase200);}", ".fwrc4pm{line-height:var(--lineHeightBase200);}", ".fod5ikn{font-size:var(--fontSizeBase400);}", ".fl43uef{font-weight:var(--fontWeightSemibold);}", ".faaz57k{line-height:var(--lineHeightBase400);}"]
150
196
  });
151
197
 
152
- const useTextClassNames = state => {
198
+ const useTextClassNames = (state, alignToPrimary) => {
153
199
  const {
154
- fixed,
155
- numTextLines,
156
- presenceOnly
200
+ presenceOnly,
201
+ size,
202
+ textPosition
157
203
  } = state;
158
204
  const textStyles = useTextStyles();
159
205
  let primaryTextSize;
160
- let optionalTextSize;
161
-
162
- if (fixed) {
163
- if (state.avatar && state.avatar.size) {
164
- const {
165
- size
166
- } = state.avatar;
167
-
168
- if (size < 40) {
169
- primaryTextSize = textStyles.body1;
170
- optionalTextSize = textStyles.caption1;
171
- } else if (size < 64) {
172
- primaryTextSize = textStyles.subtitle2;
173
- optionalTextSize = textStyles.body1;
174
- } else if (size < 96) {
175
- primaryTextSize = textStyles.subtitle1;
176
- optionalTextSize = textStyles.caption1;
177
- } else {
178
- if (numTextLines > 1) {
179
- primaryTextSize = textStyles.title3;
180
- } else {
181
- primaryTextSize = textStyles.title2;
182
- }
183
-
184
- optionalTextSize = textStyles.body1;
185
- }
186
- } else if (presenceOnly && state.presence) {
187
- const {
188
- size
189
- } = state.presence;
190
-
191
- if (size === 'extra-small' || size === 'tiny') {
192
- if (numTextLines > 1) {
193
- primaryTextSize = textStyles.body1;
194
- } else {
195
- primaryTextSize = textStyles.caption1;
196
- }
197
-
198
- optionalTextSize = textStyles.caption1;
199
- } else {
200
- primaryTextSize = textStyles.body1;
201
- optionalTextSize = textStyles.caption1;
206
+ let alignToPrimaryClassName;
207
+
208
+ if (presenceOnly) {
209
+ if (size === 'extra-small') {
210
+ primaryTextSize = state.numTextLines > 1 ? textStyles.body1 : textStyles.caption1;
211
+ } else if (size === 'extra-large' || size === 'huge') {
212
+ primaryTextSize = textStyles.subtitle2;
213
+ } else {
214
+ primaryTextSize = textStyles.body1;
215
+ }
216
+
217
+ if (alignToPrimary) {
218
+ if (textPosition === 'before') {
219
+ alignToPrimaryClassName = textStyles.beforeAlignToPrimary;
220
+ } else if (textPosition === 'after') {
221
+ alignToPrimaryClassName = textStyles.afterAlignToPrimary;
202
222
  }
203
223
  }
204
224
  } else {
205
- if (numTextLines > 1) {
206
- primaryTextSize = textStyles.body1;
225
+ if (size === 'huge') {
226
+ primaryTextSize = textStyles.subtitle2;
227
+ } else if (size === 'extra-large') {
228
+ primaryTextSize = textStyles.subtitle2;
207
229
  } else {
208
- primaryTextSize = textStyles.caption1;
230
+ primaryTextSize = textStyles.body1;
209
231
  }
210
-
211
- optionalTextSize = textStyles.caption1;
212
232
  }
213
233
 
214
234
  return {
215
- primaryTextClassName: react_1.mergeClasses(textStyles.base, textStyles.primaryText, primaryTextSize),
216
- optionalTextClassName: react_1.mergeClasses(textStyles.base, textStyles.optionalText, optionalTextSize)
235
+ primaryTextClassName: react_1.mergeClasses(textStyles.base, textStyles.primaryText, primaryTextSize, alignToPrimaryClassName),
236
+ optionalTextClassName: react_1.mergeClasses(textStyles.base, textStyles.optionalText, !presenceOnly && size === 'huge' ? textStyles.body1 : textStyles.caption1, alignToPrimaryClassName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,MAEO;UACL,eAAe,GAAG,UAAU,CAAC,MAA7B;QACD;;QACD,gBAAgB,GAAG,UAAU,CAAC,KAA9B;MACD;IACF,CApBD,MAoBO,IAAI,YAAY,IAAI,KAAK,CAAC,QAA1B,EAAoC;MACzC,MAAM;QAAE;MAAF,IAAW,KAAK,CAAC,QAAvB;;MAEA,IAAI,IAAI,KAAK,aAAT,IAA0B,IAAI,KAAK,MAAvC,EAA+C;QAC7C,IAAI,YAAY,GAAG,CAAnB,EAAsB;UACpB,eAAe,GAAG,UAAU,CAAC,KAA7B;QACD,CAFD,MAEO;UACL,eAAe,GAAG,UAAU,CAAC,QAA7B;QACD;;QACD,gBAAgB,GAAG,UAAU,CAAC,QAA9B;MACD,CAPD,MAOO;QACL,eAAe,GAAG,UAAU,CAAC,KAA7B;QACA,gBAAgB,GAAG,UAAU,CAAC,QAA9B;MACD;IACF;EACF,CApCD,MAoCO;IACL,IAAI,YAAY,GAAG,CAAnB,EAAsB;MACpB,eAAe,GAAG,UAAU,CAAC,KAA7B;IACD,CAFD,MAEO;MACL,eAAe,GAAG,UAAU,CAAC,QAA7B;IACD;;IACD,gBAAgB,GAAG,UAAU,CAAC,QAA9B;EACD;;EAED,OAAO;IACL,oBAAoB,EAAE,OAAA,CAAA,YAAA,CAAa,UAAU,CAAC,IAAxB,EAA8B,UAAU,CAAC,WAAzC,EAAsD,eAAtD,CADjB;IAEL,qBAAqB,EAAE,OAAA,CAAA,YAAA,CAAa,UAAU,CAAC,IAAxB,EAA8B,UAAU,CAAC,YAAzC,EAAuD,gBAAvD;EAFlB,CAAP;AAID,CA5DD","sourcesContent":["import { 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\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n display: 'inline-grid',\n gridAutoColumns: 'max-content',\n gridAutoRows: 'max-content',\n },\n after: {\n gridAutoFlow: 'column',\n justifyItems: 'start',\n columnGap: '8px',\n },\n before: {\n gridAutoFlow: 'column',\n justifyItems: 'end',\n columnGap: '8px',\n },\n below: {\n justifyItems: 'center',\n },\n coin: {\n gridRowStart: 'span 5',\n },\n\n fixed: {\n alignSelf: 'start',\n },\n scaled: {\n alignSelf: 'center',\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 { fixed, textPosition } = state;\n const styles = useStyles();\n const { primaryTextClassName, optionalTextClassName } = useTextClassNames(state);\n\n state.root.className = mergeClasses(personaClassNames.root, styles.root, styles[textPosition], state.root.className);\n\n if (state.avatar) {\n state.avatar.className = mergeClasses(\n personaClassNames.avatar,\n styles.coin,\n fixed ? styles.fixed : styles.scaled,\n state.avatar.className,\n );\n }\n\n if (state.presence) {\n state.presence.className = mergeClasses(\n personaClassNames.presence,\n styles.coin,\n fixed ? styles.fixed : styles.scaled,\n state.presence.className,\n );\n }\n\n if (state.primaryText) {\n state.primaryText.className = mergeClasses(\n personaClassNames.primaryText,\n primaryTextClassName,\n state.primaryText.className,\n );\n }\n\n if (state.secondaryText) {\n state.secondaryText.className = mergeClasses(\n personaClassNames.secondaryText,\n optionalTextClassName,\n state.secondaryText.className,\n );\n }\n\n if (state.tertiaryText) {\n state.tertiaryText.className = mergeClasses(\n personaClassNames.tertiaryText,\n optionalTextClassName,\n state.tertiaryText.className,\n );\n }\n\n if (state.quaternaryText) {\n state.quaternaryText.className = mergeClasses(\n personaClassNames.quaternaryText,\n optionalTextClassName,\n state.quaternaryText.className,\n );\n }\n\n return state;\n};\n\nconst useTextStyles = makeStyles({\n base: {\n display: 'block',\n },\n primaryText: {\n color: tokens.colorNeutralForeground1,\n },\n optionalText: {\n color: tokens.colorNeutralForeground2,\n },\n\n body1: typographyStyles.body1,\n caption1: typographyStyles.caption1,\n subtitle2: typographyStyles.subtitle2,\n subtitle1: typographyStyles.subtitle1,\n title2: typographyStyles.title2,\n title3: typographyStyles.title3,\n});\n\nconst useTextClassNames = (\n state: PersonaState,\n): {\n primaryTextClassName: string;\n optionalTextClassName: string;\n} => {\n const { fixed, numTextLines, presenceOnly } = state;\n const textStyles = useTextStyles();\n let primaryTextSize;\n let optionalTextSize;\n\n if (fixed) {\n if (state.avatar && state.avatar.size) {\n const { size } = state.avatar;\n\n if (size < 40) {\n primaryTextSize = textStyles.body1;\n optionalTextSize = textStyles.caption1;\n } else if (size < 64) {\n primaryTextSize = textStyles.subtitle2;\n optionalTextSize = textStyles.body1;\n } else if (size < 96) {\n primaryTextSize = textStyles.subtitle1;\n optionalTextSize = textStyles.caption1;\n } else {\n if (numTextLines > 1) {\n primaryTextSize = textStyles.title3;\n } else {\n primaryTextSize = textStyles.title2;\n }\n optionalTextSize = textStyles.body1;\n }\n } else if (presenceOnly && state.presence) {\n const { size } = state.presence;\n\n if (size === 'extra-small' || size === 'tiny') {\n if (numTextLines > 1) {\n primaryTextSize = textStyles.body1;\n } else {\n primaryTextSize = textStyles.caption1;\n }\n optionalTextSize = textStyles.caption1;\n } else {\n primaryTextSize = textStyles.body1;\n optionalTextSize = textStyles.caption1;\n }\n }\n } else {\n if (numTextLines > 1) {\n primaryTextSize = textStyles.body1;\n } else {\n primaryTextSize = textStyles.caption1;\n }\n optionalTextSize = textStyles.caption1;\n }\n\n return {\n primaryTextClassName: mergeClasses(textStyles.base, textStyles.primaryText, primaryTextSize),\n optionalTextClassName: mergeClasses(textStyles.base, textStyles.optionalText, optionalTextSize),\n };\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-pers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AAmC,UAAU,CAAC,KAA9C,GAAsD,UAAU,CAAC,QAH5C,EAIrB,uBAJqB;EAPlB,CAAP;AAcD,CArDD","sourcesContent":["import { 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\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n base: {\n display: 'inline-grid',\n gridAutoColumns: 'max-content',\n gridAutoRows: 'max-content',\n },\n after: {\n gridAutoFlow: 'column',\n justifyItems: 'start',\n },\n before: {\n gridAutoFlow: 'column',\n justifyItems: 'end',\n },\n below: {\n justifyItems: 'center',\n },\n coin: {\n gridRowStart: 'span 5',\n },\n\n start: {\n alignSelf: 'start',\n },\n center: {\n alignSelf: 'center',\n },\n\n // These alignToPrimary styles are needed due to presence being too small to center with the primary text.\n alignToPrimary: {\n gridTemplateColumns: `max-content [middle] max-content`,\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\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 { size, textAlignment, textPosition } = state;\n const alignToPrimary = textAlignment === 'start' && size !== 'extra-large' && size !== 'huge';\n const { primaryTextClassName, optionalTextClassName } = useTextClassNames(state, alignToPrimary);\n\n const styles = useStyles();\n const avatarSpacingStyles = useAvatarSpacingStyles();\n const presenceSpacingStyles = { ...avatarSpacingStyles, ...usePresenceSpacingStyles() };\n\n state.root.className = mergeClasses(\n personaClassNames.root,\n styles.base,\n styles[textPosition],\n textPosition !== 'below' && alignToPrimary && styles.alignToPrimary,\n state.root.className,\n );\n\n if (state.avatar) {\n state.avatar.className = mergeClasses(\n personaClassNames.avatar,\n styles.coin,\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 styles.coin,\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 primaryTextClassName,\n state.primaryText.className,\n );\n }\n\n if (state.secondaryText) {\n state.secondaryText.className = mergeClasses(\n personaClassNames.secondaryText,\n optionalTextClassName,\n state.secondaryText.className,\n );\n }\n\n if (state.tertiaryText) {\n state.tertiaryText.className = mergeClasses(\n personaClassNames.tertiaryText,\n optionalTextClassName,\n state.tertiaryText.className,\n );\n }\n\n if (state.quaternaryText) {\n state.quaternaryText.className = mergeClasses(\n personaClassNames.quaternaryText,\n optionalTextClassName,\n state.quaternaryText.className,\n );\n }\n\n return state;\n};\n\nconst useTextStyles = makeStyles({\n base: {\n display: 'block',\n },\n primaryText: {\n color: tokens.colorNeutralForeground1,\n },\n optionalText: {\n color: tokens.colorNeutralForeground2,\n },\n\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 textStyles = useTextStyles();\n\n let primaryTextSize;\n let alignToPrimaryClassName;\n\n if (presenceOnly) {\n if (size === 'extra-small') {\n primaryTextSize = state.numTextLines > 1 ? textStyles.body1 : textStyles.caption1;\n } else if (size === 'extra-large' || size === 'huge') {\n primaryTextSize = textStyles.subtitle2;\n } else {\n primaryTextSize = textStyles.body1;\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 } else {\n primaryTextSize = textStyles.body1;\n }\n }\n\n return {\n primaryTextClassName: mergeClasses(\n textStyles.base,\n textStyles.primaryText,\n primaryTextSize,\n alignToPrimaryClassName,\n ),\n optionalTextClassName: mergeClasses(\n textStyles.base,\n textStyles.optionalText,\n !presenceOnly && size === 'huge' ? textStyles.body1 : textStyles.caption1,\n alignToPrimaryClassName,\n ),\n };\n};\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,SAAA,gBAAA,OAAA,CAAA,WAAA,CAAA;;AACE,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,SAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,SAAA,CAAA,OAAA;EAAO;AAAP,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,mBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,SAAA,CAAA,iBAAA;EAAiB;AAAjB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,wBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,SAAA,CAAA,sBAAA;EAAsB;AAAtB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,2BAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,SAAA,CAAA,yBAAA;EAAyB;AAAzB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,qBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,SAAA,CAAA,mBAAA;EAAmB;AAAnB,CAAA","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"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-persona/src/index.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,SAAA,gBAAA,OAAA,CAAA,WAAA,CAAA;;AACE,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,SAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,SAAA,CAAA,OAAA;EAAO;AAAP,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,mBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,SAAA,CAAA,iBAAA;EAAiB;AAAjB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,wBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,SAAA,CAAA,sBAAA;EAAsB;AAAtB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,2BAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,SAAA,CAAA,yBAAA;EAAyB;AAAzB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,qBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,SAAA,CAAA,mBAAA;EAAmB;AAAnB,CAAA","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"],"sourceRoot":"../src/"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-persona",
3
- "version": "9.1.0-beta.3",
3
+ "version": "9.1.0-beta.4",
4
4
  "description": "React components for building web experiences",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -19,11 +19,10 @@
19
19
  "just": "just-scripts",
20
20
  "lint": "just-scripts lint",
21
21
  "test": "jest --passWithNoTests",
22
- "docs": "api-extractor run --config=config/api-extractor.local.json --local",
23
- "build:local": "tsc -p ./tsconfig.lib.json --module esnext --emitDeclarationOnly && node ../../../scripts/typescript/normalize-import --output ./dist/types/packages/react-components/react-persona/src && yarn docs",
24
22
  "type-check": "tsc -b tsconfig.json",
25
23
  "storybook": "start-storybook",
26
- "start": "yarn storybook"
24
+ "start": "yarn storybook",
25
+ "generate-api": "tsc -p ./tsconfig.lib.json --emitDeclarationOnly && just-scripts api-extractor"
27
26
  },
28
27
  "devDependencies": {
29
28
  "@fluentui/eslint-plugin": "*",
@@ -32,10 +31,10 @@
32
31
  "@fluentui/scripts": "^1.0.0"
33
32
  },
34
33
  "dependencies": {
35
- "@fluentui/react-avatar": "^9.2.6",
36
- "@fluentui/react-badge": "^9.0.12",
34
+ "@fluentui/react-avatar": "^9.2.7",
35
+ "@fluentui/react-badge": "^9.0.13",
37
36
  "@fluentui/react-theme": "^9.1.2",
38
- "@fluentui/react-utilities": "^9.2.1",
37
+ "@fluentui/react-utilities": "^9.2.2",
39
38
  "@griffel/react": "^1.4.2",
40
39
  "tslib": "^2.1.0"
41
40
  },