@fluentui/react-persona 0.0.0-nightly-20221007-1237.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. package/CHANGELOG.json +127 -0
  2. package/CHANGELOG.md +53 -0
  3. package/LICENSE +15 -0
  4. package/MIGRATION.md +42 -0
  5. package/README.md +29 -0
  6. package/Spec.md +213 -0
  7. package/dist/index.d.ts +114 -0
  8. package/lib/Persona.js +2 -0
  9. package/lib/Persona.js.map +1 -0
  10. package/lib/components/Persona/Persona.js +16 -0
  11. package/lib/components/Persona/Persona.js.map +1 -0
  12. package/lib/components/Persona/Persona.types.js +2 -0
  13. package/lib/components/Persona/Persona.types.js.map +1 -0
  14. package/lib/components/Persona/index.js +6 -0
  15. package/lib/components/Persona/index.js.map +1 -0
  16. package/lib/components/Persona/renderPersona.js +26 -0
  17. package/lib/components/Persona/renderPersona.js.map +1 -0
  18. package/lib/components/Persona/usePersona.js +101 -0
  19. package/lib/components/Persona/usePersona.js.map +1 -0
  20. package/lib/components/Persona/usePersonaStyles.js +208 -0
  21. package/lib/components/Persona/usePersonaStyles.js.map +1 -0
  22. package/lib/index.js +2 -0
  23. package/lib/index.js.map +1 -0
  24. package/lib-commonjs/Persona.js +10 -0
  25. package/lib-commonjs/Persona.js.map +1 -0
  26. package/lib-commonjs/components/Persona/Persona.js +27 -0
  27. package/lib-commonjs/components/Persona/Persona.js.map +1 -0
  28. package/lib-commonjs/components/Persona/Persona.types.js +6 -0
  29. package/lib-commonjs/components/Persona/Persona.types.js.map +1 -0
  30. package/lib-commonjs/components/Persona/index.js +18 -0
  31. package/lib-commonjs/components/Persona/index.js.map +1 -0
  32. package/lib-commonjs/components/Persona/renderPersona.js +37 -0
  33. package/lib-commonjs/components/Persona/renderPersona.js.map +1 -0
  34. package/lib-commonjs/components/Persona/usePersona.js +113 -0
  35. package/lib-commonjs/components/Persona/usePersona.js.map +1 -0
  36. package/lib-commonjs/components/Persona/usePersonaStyles.js +219 -0
  37. package/lib-commonjs/components/Persona/usePersonaStyles.js.map +1 -0
  38. package/lib-commonjs/index.js +40 -0
  39. package/lib-commonjs/index.js.map +1 -0
  40. package/package.json +49 -0
@@ -0,0 +1,219 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.usePersonaStyles_unstable = exports.personaClassNames = void 0;
7
+
8
+ const react_1 = /*#__PURE__*/require("@griffel/react");
9
+
10
+ const react_theme_1 = /*#__PURE__*/require("@fluentui/react-theme");
11
+
12
+ exports.personaClassNames = {
13
+ root: 'fui-Persona',
14
+ avatar: 'fui-Persona__avatar',
15
+ presence: 'fui-Persona__presence',
16
+ primaryText: 'fui-Persona__primaryText',
17
+ secondaryText: 'fui-Persona__secondaryText',
18
+ tertiaryText: 'fui-Persona__tertiaryText',
19
+ quaternaryText: 'fui-Persona__quaternaryText'
20
+ };
21
+ /**
22
+ * Styles for the root slot
23
+ */
24
+
25
+ const useStyles = /*#__PURE__*/react_1.__styles({
26
+ "root": {
27
+ "mc9l5x": "fwk3njj",
28
+ "t4k1zu": "f4wu0r3",
29
+ "v29qe6": "fvtn1bl"
30
+ },
31
+ "after": {
32
+ "Bxotwcr": "f1u07yai",
33
+ "B7hvi0a": "f1m2n5bn",
34
+ "i8kkvl": "f4px1ci"
35
+ },
36
+ "before": {
37
+ "Bxotwcr": "f1u07yai",
38
+ "B7hvi0a": "f1tll2w5",
39
+ "i8kkvl": "f4px1ci"
40
+ },
41
+ "below": {
42
+ "B7hvi0a": "f1oiokrs"
43
+ },
44
+ "coin": {
45
+ "Ijaq50": "f1hek2iy"
46
+ },
47
+ "fixed": {
48
+ "qb2dma": "f9h729m"
49
+ },
50
+ "scaled": {
51
+ "qb2dma": "f7nlbp4"
52
+ }
53
+ }, {
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;}"]
55
+ });
56
+ /**
57
+ * Apply styling to the Persona slots based on the state
58
+ */
59
+
60
+
61
+ const usePersonaStyles_unstable = state => {
62
+ const {
63
+ fixed,
64
+ textPosition
65
+ } = state;
66
+ const styles = useStyles();
67
+ const {
68
+ primaryTextClassName,
69
+ optionalTextClassName
70
+ } = useTextClassNames(state);
71
+ state.root.className = react_1.mergeClasses(exports.personaClassNames.root, styles.root, styles[textPosition], state.root.className);
72
+
73
+ if (state.avatar) {
74
+ state.avatar.className = react_1.mergeClasses(exports.personaClassNames.avatar, styles.coin, fixed ? styles.fixed : styles.scaled, state.avatar.className);
75
+ }
76
+
77
+ if (state.presence) {
78
+ state.presence.className = react_1.mergeClasses(exports.personaClassNames.presence, styles.coin, fixed ? styles.fixed : styles.scaled, state.presence.className);
79
+ }
80
+
81
+ if (state.primaryText) {
82
+ state.primaryText.className = react_1.mergeClasses(exports.personaClassNames.primaryText, primaryTextClassName, state.primaryText.className);
83
+ }
84
+
85
+ if (state.secondaryText) {
86
+ state.secondaryText.className = react_1.mergeClasses(exports.personaClassNames.secondaryText, optionalTextClassName, state.secondaryText.className);
87
+ }
88
+
89
+ if (state.tertiaryText) {
90
+ state.tertiaryText.className = react_1.mergeClasses(exports.personaClassNames.tertiaryText, optionalTextClassName, state.tertiaryText.className);
91
+ }
92
+
93
+ if (state.quaternaryText) {
94
+ state.quaternaryText.className = react_1.mergeClasses(exports.personaClassNames.quaternaryText, optionalTextClassName, state.quaternaryText.className);
95
+ }
96
+
97
+ return state;
98
+ };
99
+
100
+ exports.usePersonaStyles_unstable = usePersonaStyles_unstable;
101
+
102
+ const useTextStyles = /*#__PURE__*/react_1.__styles({
103
+ "base": {
104
+ "mc9l5x": "ftgm304"
105
+ },
106
+ "primaryText": {
107
+ "sj55zd": "f19n0e5"
108
+ },
109
+ "optionalText": {
110
+ "sj55zd": "fkfq4zb"
111
+ },
112
+ "body1": {
113
+ "Bahqtrf": "fk6fouc",
114
+ "Be2twd7": "fkhj508",
115
+ "Bhrd7zp": "figsok6",
116
+ "Bg96gwp": "f1i3iumi"
117
+ },
118
+ "caption1": {
119
+ "Bahqtrf": "fk6fouc",
120
+ "Be2twd7": "fy9rknc",
121
+ "Bhrd7zp": "figsok6",
122
+ "Bg96gwp": "fwrc4pm"
123
+ },
124
+ "subtitle2": {
125
+ "Bahqtrf": "fk6fouc",
126
+ "Be2twd7": "fod5ikn",
127
+ "Bhrd7zp": "fl43uef",
128
+ "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
+ }
148
+ }, {
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);}"]
150
+ });
151
+
152
+ const useTextClassNames = state => {
153
+ const {
154
+ fixed,
155
+ numTextLines,
156
+ presenceOnly
157
+ } = state;
158
+ const textStyles = useTextStyles();
159
+ 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;
202
+ }
203
+ }
204
+ } else {
205
+ if (numTextLines > 1) {
206
+ primaryTextSize = textStyles.body1;
207
+ } else {
208
+ primaryTextSize = textStyles.caption1;
209
+ }
210
+
211
+ optionalTextSize = textStyles.caption1;
212
+ }
213
+
214
+ return {
215
+ primaryTextClassName: react_1.mergeClasses(textStyles.base, textStyles.primaryText, primaryTextSize),
216
+ optionalTextClassName: react_1.mergeClasses(textStyles.base, textStyles.optionalText, optionalTextSize)
217
+ };
218
+ };
219
+ //# sourceMappingURL=usePersonaStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/Persona/usePersonaStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AAIa,OAAA,CAAA,iBAAA,GAAkD;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,CAAlD;AAUb;;AAEG;;AACH,MAAM,SAAS,gBAAG,OAAA,SAAA;EAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAAlB;AA+BA;;AAEG;;;AACI,MAAM,yBAAyB,GAAI,KAAD,IAAsC;EAC7E,MAAM;IAAE,KAAF;IAAS;EAAT,IAA0B,KAAhC;EACA,MAAM,MAAM,GAAG,SAAS,EAAxB;EACA,MAAM;IAAE,oBAAF;IAAwB;EAAxB,IAAkD,iBAAiB,CAAC,KAAD,CAAzE;EAEA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,OAAA,CAAA,YAAA,CAAa,OAAA,CAAA,iBAAA,CAAkB,IAA/B,EAAqC,MAAM,CAAC,IAA5C,EAAkD,MAAM,CAAC,YAAD,CAAxD,EAAwE,KAAK,C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;QACA,gBAAgB,GAAG,UAAU,CAAC,QAA9B;MACD,CAHM,MAGA;QACL,IAAI,YAAY,GAAG,CAAnB,EAAsB;UACpB,eAAe,GAAG,UAAU,CAAC,MAA7B;QACD,CAFD,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":""}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.usePersona_unstable = exports.usePersonaStyles_unstable = exports.renderPersona_unstable = exports.personaClassNames = exports.Persona = void 0;
7
+
8
+ var Persona_1 = /*#__PURE__*/require("./Persona");
9
+
10
+ Object.defineProperty(exports, "Persona", {
11
+ enumerable: true,
12
+ get: function () {
13
+ return Persona_1.Persona;
14
+ }
15
+ });
16
+ Object.defineProperty(exports, "personaClassNames", {
17
+ enumerable: true,
18
+ get: function () {
19
+ return Persona_1.personaClassNames;
20
+ }
21
+ });
22
+ Object.defineProperty(exports, "renderPersona_unstable", {
23
+ enumerable: true,
24
+ get: function () {
25
+ return Persona_1.renderPersona_unstable;
26
+ }
27
+ });
28
+ Object.defineProperty(exports, "usePersonaStyles_unstable", {
29
+ enumerable: true,
30
+ get: function () {
31
+ return Persona_1.usePersonaStyles_unstable;
32
+ }
33
+ });
34
+ Object.defineProperty(exports, "usePersona_unstable", {
35
+ enumerable: true,
36
+ get: function () {
37
+ return Persona_1.usePersona_unstable;
38
+ }
39
+ });
40
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../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":""}
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@fluentui/react-persona",
3
+ "version": "0.0.0-nightly-20221007-1237.1",
4
+ "description": "React components for building web experiences",
5
+ "main": "lib-commonjs/index.js",
6
+ "module": "lib/index.js",
7
+ "typings": "dist/index.d.ts",
8
+ "sideEffects": false,
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/microsoft/fluentui"
12
+ },
13
+ "license": "MIT",
14
+ "scripts": {
15
+ "build": "just-scripts build",
16
+ "bundle-size": "bundle-size measure",
17
+ "clean": "just-scripts clean",
18
+ "code-style": "just-scripts code-style",
19
+ "just": "just-scripts",
20
+ "lint": "just-scripts lint",
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
+ "type-check": "tsc -b tsconfig.json",
25
+ "storybook": "start-storybook",
26
+ "start": "yarn storybook"
27
+ },
28
+ "devDependencies": {
29
+ "@fluentui/eslint-plugin": "*",
30
+ "@fluentui/react-conformance": "*",
31
+ "@fluentui/react-conformance-griffel": "0.0.0-nightly-20221007-1237.1",
32
+ "@fluentui/scripts": "^1.0.0"
33
+ },
34
+ "dependencies": {
35
+ "@fluentui/react-avatar": "^0.0.0-nightly-20221007-1237.1",
36
+ "@fluentui/react-badge": "^0.0.0-nightly-20221007-1237.1",
37
+ "@fluentui/react-theme": "^0.0.0-nightly-20221007-1237.1",
38
+ "@fluentui/react-utilities": "^0.0.0-nightly-20221007-1237.1",
39
+ "@griffel/react": "^1.3.0",
40
+ "tslib": "^2.1.0"
41
+ },
42
+ "peerDependencies": {
43
+ "@types/react": ">=16.8.0 <18.0.0",
44
+ "@types/react-dom": ">=16.8.0 <18.0.0",
45
+ "react": ">=16.8.0 <18.0.0",
46
+ "react-dom": ">=16.8.0 <18.0.0"
47
+ },
48
+ "beachball": {}
49
+ }