@fluentui/react-avatar 9.0.0-nightly.f81b28ceb3.1 → 9.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +373 -20
- package/CHANGELOG.md +79 -12
- package/dist/react-avatar.d.ts +46 -36
- package/lib/components/Avatar/Avatar.js +7 -7
- package/lib/components/Avatar/Avatar.js.map +1 -1
- package/lib/components/Avatar/Avatar.types.d.ts +27 -32
- package/lib/components/Avatar/renderAvatar.d.ts +1 -1
- package/lib/components/Avatar/renderAvatar.js +11 -7
- package/lib/components/Avatar/renderAvatar.js.map +1 -1
- package/lib/components/Avatar/useAvatar.d.ts +1 -1
- package/lib/components/Avatar/useAvatar.js +103 -86
- package/lib/components/Avatar/useAvatar.js.map +1 -1
- package/lib/components/Avatar/useAvatarStyles.d.ts +2 -1
- package/lib/components/Avatar/useAvatarStyles.js +160 -102
- package/lib/components/Avatar/useAvatarStyles.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/utils/getInitials.d.ts +6 -1
- package/lib/utils/getInitials.js +13 -8
- package/lib/utils/getInitials.js.map +1 -1
- package/lib-commonjs/Avatar.js +1 -1
- package/lib-commonjs/components/Avatar/Avatar.js +8 -8
- package/lib-commonjs/components/Avatar/Avatar.js.map +1 -1
- package/lib-commonjs/components/Avatar/Avatar.types.d.ts +27 -32
- package/lib-commonjs/components/Avatar/index.js +1 -1
- package/lib-commonjs/components/Avatar/renderAvatar.d.ts +1 -1
- package/lib-commonjs/components/Avatar/renderAvatar.js +15 -12
- package/lib-commonjs/components/Avatar/renderAvatar.js.map +1 -1
- package/lib-commonjs/components/Avatar/useAvatar.d.ts +1 -1
- package/lib-commonjs/components/Avatar/useAvatar.js +109 -93
- package/lib-commonjs/components/Avatar/useAvatar.js.map +1 -1
- package/lib-commonjs/components/Avatar/useAvatarStyles.d.ts +2 -1
- package/lib-commonjs/components/Avatar/useAvatarStyles.js +165 -107
- package/lib-commonjs/components/Avatar/useAvatarStyles.js.map +1 -1
- package/lib-commonjs/index.d.ts +1 -0
- package/lib-commonjs/index.js +3 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utils/getInitials.d.ts +6 -1
- package/lib-commonjs/utils/getInitials.js +13 -8
- package/lib-commonjs/utils/getInitials.js.map +1 -1
- package/package.json +11 -13
- package/lib/common/isConformant.d.ts +0 -4
- package/lib/common/isConformant.js +0 -12
- package/lib/common/isConformant.js.map +0 -1
- package/lib-commonjs/common/isConformant.d.ts +0 -4
- package/lib-commonjs/common/isConformant.js +0 -23
- package/lib-commonjs/common/isConformant.js.map +0 -1
|
@@ -4,6 +4,11 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* Get (up to 2 characters) initials based on display name of the persona.
|
|
6
6
|
*
|
|
7
|
-
* @
|
|
7
|
+
* @param displayName - The full name of the person or entity
|
|
8
|
+
* @param isRtl - Whether the display is in RTL
|
|
9
|
+
* @param allowPhoneInitials - Should initials be generated from phone numbers (default false)
|
|
10
|
+
*
|
|
11
|
+
* @returns The 1 or 2 character initials based on the name. Or an empty string if no initials
|
|
12
|
+
* could be derived from the name.
|
|
8
13
|
*/
|
|
9
14
|
export declare function getInitials(displayName: string | undefined | null, isRtl: boolean, allowPhoneInitials?: boolean): string;
|
|
@@ -12,22 +12,22 @@ exports.getInitials = void 0;
|
|
|
12
12
|
* so for example, (xyz) [xyz] {xyz} all would be ignored
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
const UNWANTED_ENCLOSURES_REGEX = /[\(\[\{][^\)\]\}]*[\)\]\}]/g;
|
|
16
16
|
/**
|
|
17
17
|
* Regular expression matching special ASCII characters except space, plus some unicode special characters.
|
|
18
18
|
* Applies after unwanted enclosures have been removed
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
const UNWANTED_CHARS_REGEX = /[\0-\u001F\!-/:-@\[-`\{-\u00BF\u0250-\u036F\uD800-\uFFFF]/g;
|
|
22
22
|
/**
|
|
23
23
|
* Regular expression matching phone numbers. Applied after chars matching UNWANTED_CHARS_REGEX have been removed
|
|
24
24
|
* and number has been trimmed for whitespaces
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
const PHONENUMBER_REGEX = /^\d+[\d\s]*(:?ext|x|)\s*\d+$/i;
|
|
28
28
|
/** Regular expression matching one or more spaces. */
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
const MULTIPLE_WHITESPACES_REGEX = /\s+/g;
|
|
31
31
|
/**
|
|
32
32
|
* Regular expression matching languages for which we currently don't support initials.
|
|
33
33
|
* Arabic: Arabic, Arabic Supplement, Arabic Extended-A.
|
|
@@ -38,11 +38,11 @@ var MULTIPLE_WHITESPACES_REGEX = /\s+/g;
|
|
|
38
38
|
*/
|
|
39
39
|
// eslint-disable-next-line @fluentui/max-len
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
const UNSUPPORTED_TEXT_REGEX = /[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\u1100-\u11FF\u3130-\u318F\uA960-\uA97F\uAC00-\uD7AF\uD7B0-\uD7FF\u3040-\u309F\u30A0-\u30FF\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF]|[\uD840-\uD869][\uDC00-\uDED6]/;
|
|
42
42
|
|
|
43
43
|
function getInitialsLatin(displayName, isRtl) {
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
let initials = '';
|
|
45
|
+
const splits = displayName.split(' ');
|
|
46
46
|
|
|
47
47
|
if (splits.length === 2) {
|
|
48
48
|
initials += splits[0].charAt(0).toUpperCase();
|
|
@@ -71,7 +71,12 @@ function cleanupDisplayName(displayName) {
|
|
|
71
71
|
/**
|
|
72
72
|
* Get (up to 2 characters) initials based on display name of the persona.
|
|
73
73
|
*
|
|
74
|
-
* @
|
|
74
|
+
* @param displayName - The full name of the person or entity
|
|
75
|
+
* @param isRtl - Whether the display is in RTL
|
|
76
|
+
* @param allowPhoneInitials - Should initials be generated from phone numbers (default false)
|
|
77
|
+
*
|
|
78
|
+
* @returns The 1 or 2 character initials based on the name. Or an empty string if no initials
|
|
79
|
+
* could be derived from the name.
|
|
75
80
|
*/
|
|
76
81
|
|
|
77
82
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/getInitials.ts"],"names":[],"mappings":";AAAA;;AAEG;;;;;;AAEH;;;AAGG;;AACH,
|
|
1
|
+
{"version":3,"sources":["../../src/utils/getInitials.ts"],"names":[],"mappings":";AAAA;;AAEG;;;;;;AAEH;;;AAGG;;AACH,MAAM,yBAAyB,GAAW,6BAA1C;AAEA;;;AAGG;;AACH,MAAM,oBAAoB,GAAW,4DAArC;AAEA;;;AAGG;;AACH,MAAM,iBAAiB,GAAW,+BAAlC;AAEA;;AACA,MAAM,0BAA0B,GAAW,MAA3C;AAEA;;;;;;;AAOG;AACH;;AACA,MAAM,sBAAsB,GAAW,4MAAvC;;AAEA,SAAS,gBAAT,CAA0B,WAA1B,EAA+C,KAA/C,EAA6D;AAC3D,MAAI,QAAQ,GAAG,EAAf;AAEA,QAAM,MAAM,GAAa,WAAW,CAAC,KAAZ,CAAkB,GAAlB,CAAzB;;AAEA,MAAI,MAAM,CAAC,MAAP,KAAkB,CAAtB,EAAyB;AACvB,IAAA,QAAQ,IAAI,MAAM,CAAC,CAAD,CAAN,CAAU,MAAV,CAAiB,CAAjB,EAAoB,WAApB,EAAZ;AACA,IAAA,QAAQ,IAAI,MAAM,CAAC,CAAD,CAAN,CAAU,MAAV,CAAiB,CAAjB,EAAoB,WAApB,EAAZ;AACD,GAHD,MAGO,IAAI,MAAM,CAAC,MAAP,KAAkB,CAAtB,EAAyB;AAC9B,IAAA,QAAQ,IAAI,MAAM,CAAC,CAAD,CAAN,CAAU,MAAV,CAAiB,CAAjB,EAAoB,WAApB,EAAZ;AACA,IAAA,QAAQ,IAAI,MAAM,CA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CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-avatar",
|
|
3
|
-
"version": "9.0.0-
|
|
3
|
+
"version": "9.0.0-rc.1",
|
|
4
4
|
"description": "React components for building Microsoft web experiences.",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -19,17 +19,16 @@
|
|
|
19
19
|
"just": "just-scripts",
|
|
20
20
|
"lint": "just-scripts lint",
|
|
21
21
|
"start": "yarn storybook",
|
|
22
|
-
"test": "jest",
|
|
22
|
+
"test": "jest --passWithNoTests",
|
|
23
23
|
"docs": "api-extractor run --config=config/api-extractor.local.json --local",
|
|
24
|
-
"build:local": "tsc -p . --module esnext --emitDeclarationOnly && node ../../scripts/typescript/normalize-import --output dist/react-avatar/src && yarn docs",
|
|
25
|
-
"storybook": "
|
|
24
|
+
"build:local": "tsc -p ./tsconfig.lib.json --module esnext --emitDeclarationOnly && node ../../scripts/typescript/normalize-import --output ./dist/packages/react-avatar/src && yarn docs",
|
|
25
|
+
"storybook": "node ../../scripts/storybook/runner",
|
|
26
|
+
"type-check": "tsc -b tsconfig.json"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|
|
28
|
-
"@fluentui/babel-make-styles": "9.0.0-nightly.f81b28ceb3.1",
|
|
29
29
|
"@fluentui/eslint-plugin": "*",
|
|
30
|
-
"@fluentui/jest-serializer-make-styles": "9.0.0-nightly.f81b28ceb3.1",
|
|
31
30
|
"@fluentui/react-conformance": "*",
|
|
32
|
-
"@fluentui/react-conformance-
|
|
31
|
+
"@fluentui/react-conformance-griffel": "9.0.0-beta.1",
|
|
33
32
|
"@fluentui/scripts": "^1.0.0",
|
|
34
33
|
"@types/enzyme": "3.10.3",
|
|
35
34
|
"@types/enzyme-adapter-react-16": "1.0.3",
|
|
@@ -44,11 +43,11 @@
|
|
|
44
43
|
"react-test-renderer": "^16.3.0"
|
|
45
44
|
},
|
|
46
45
|
"dependencies": {
|
|
47
|
-
"@fluentui/react-badge": "9.0.0-
|
|
48
|
-
"@fluentui/react-icons": "^
|
|
49
|
-
"@fluentui/react-
|
|
50
|
-
"@fluentui/react-
|
|
51
|
-
"@
|
|
46
|
+
"@fluentui/react-badge": "9.0.0-rc.1",
|
|
47
|
+
"@fluentui/react-icons": "^2.0.159-beta.10",
|
|
48
|
+
"@fluentui/react-theme": "9.0.0-rc.1",
|
|
49
|
+
"@fluentui/react-utilities": "9.0.0-rc.1",
|
|
50
|
+
"@griffel/react": "1.0.0",
|
|
52
51
|
"tslib": "^2.1.0"
|
|
53
52
|
},
|
|
54
53
|
"peerDependencies": {
|
|
@@ -58,7 +57,6 @@
|
|
|
58
57
|
"react-dom": ">=16.8.0 <18.0.0"
|
|
59
58
|
},
|
|
60
59
|
"beachball": {
|
|
61
|
-
"tag": "beta",
|
|
62
60
|
"disallowedChangeTypes": [
|
|
63
61
|
"major",
|
|
64
62
|
"minor",
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { isConformant as baseIsConformant } from '@fluentui/react-conformance';
|
|
2
|
-
import makeStylesTests from '@fluentui/react-conformance-make-styles';
|
|
3
|
-
export function isConformant(testInfo) {
|
|
4
|
-
var defaultOptions = {
|
|
5
|
-
asPropHandlesRef: true,
|
|
6
|
-
componentPath: module.parent.filename.replace('.test', ''),
|
|
7
|
-
disabledTests: ['has-docblock'],
|
|
8
|
-
extraTests: makeStylesTests
|
|
9
|
-
};
|
|
10
|
-
baseIsConformant(defaultOptions, testInfo);
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=isConformant.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/common/isConformant.ts"],"names":[],"mappings":"AAAA,SAAS,YAAY,IAAI,gBAAzB,QAAiD,6BAAjD;AACA,OAAO,eAAP,MAA4B,yCAA5B;AAGA,OAAM,SAAU,YAAV,CACJ,QADI,EACqF;AAEzF,MAAM,cAAc,GAAyC;AAC3D,IAAA,gBAAgB,EAAE,IADyC;AAE3D,IAAA,aAAa,EAAE,MAAO,CAAC,MAAR,CAAgB,QAAhB,CAAyB,OAAzB,CAAiC,OAAjC,EAA0C,EAA1C,CAF4C;AAG3D,IAAA,aAAa,EAAE,CAAC,cAAD,CAH4C;AAI3D,IAAA,UAAU,EAAE;AAJ+C,GAA7D;AAOA,EAAA,gBAAgB,CAAC,cAAD,EAAiB,QAAjB,CAAhB;AACD","sourceRoot":""}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.isConformant = void 0;
|
|
7
|
-
|
|
8
|
-
var react_conformance_1 = /*#__PURE__*/require("@fluentui/react-conformance");
|
|
9
|
-
|
|
10
|
-
var react_conformance_make_styles_1 = /*#__PURE__*/require("@fluentui/react-conformance-make-styles");
|
|
11
|
-
|
|
12
|
-
function isConformant(testInfo) {
|
|
13
|
-
var defaultOptions = {
|
|
14
|
-
asPropHandlesRef: true,
|
|
15
|
-
componentPath: module.parent.filename.replace('.test', ''),
|
|
16
|
-
disabledTests: ['has-docblock'],
|
|
17
|
-
extraTests: react_conformance_make_styles_1.default
|
|
18
|
-
};
|
|
19
|
-
react_conformance_1.isConformant(defaultOptions, testInfo);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
exports.isConformant = isConformant;
|
|
23
|
-
//# sourceMappingURL=isConformant.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/common/isConformant.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AACA,IAAA,+BAAA,gBAAA,OAAA,CAAA,yCAAA,CAAA;;AAGA,SAAgB,YAAhB,CACE,QADF,EAC2F;AAEzF,MAAM,cAAc,GAAyC;AAC3D,IAAA,gBAAgB,EAAE,IADyC;AAE3D,IAAA,aAAa,EAAE,MAAO,CAAC,MAAR,CAAgB,QAAhB,CAAyB,OAAzB,CAAiC,OAAjC,EAA0C,EAA1C,CAF4C;AAG3D,IAAA,aAAa,EAAE,CAAC,cAAD,CAH4C;AAI3D,IAAA,UAAU,EAAE,+BAAA,CAAA;AAJ+C,GAA7D;AAOA,EAAA,mBAAA,CAAA,YAAA,CAAiB,cAAjB,EAAiC,QAAjC;AACD;;AAXD,OAAA,CAAA,YAAA,GAAA,YAAA","sourceRoot":""}
|