@react-spectrum/avatar 3.0.29 → 3.1.0
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/dist/import.mjs +2 -2
- package/dist/main.js +2 -2
- package/dist/main.js.map +1 -1
- package/dist/module.js +2 -2
- package/dist/module.js.map +1 -1
- package/dist/types/src/index.d.ts +2 -0
- package/package.json +12 -28
- package/src/index.ts +3 -2
- package/dist/Avatar.main.js +0 -65
- package/dist/Avatar.main.js.map +0 -1
- package/dist/Avatar.mjs +0 -60
- package/dist/Avatar.module.js +0 -60
- package/dist/Avatar.module.js.map +0 -1
- package/dist/avatar.6abf1dc5.css +0 -24
- package/dist/avatar.6abf1dc5.css.map +0 -1
- package/dist/avatar_vars_css.main.js +0 -14
- package/dist/avatar_vars_css.main.js.map +0 -1
- package/dist/avatar_vars_css.mjs +0 -16
- package/dist/avatar_vars_css.module.js +0 -16
- package/dist/avatar_vars_css.module.js.map +0 -1
- package/dist/types.d.ts +0 -10
- package/dist/types.d.ts.map +0 -1
- package/src/Avatar.tsx +0 -67
package/dist/import.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Avatar as $
|
|
1
|
+
import {Avatar as $e5742fe3704dfccc$re_export$Avatar} from "@adobe/react-spectrum/Avatar";
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* Copyright 2021 Adobe. All rights reserved.
|
|
@@ -14,5 +14,5 @@ import {Avatar as $ab0b7b2186c39312$export$e2255cf6045e8d47} from "./Avatar.mjs"
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
export {$
|
|
17
|
+
export {$e5742fe3704dfccc$re_export$Avatar as Avatar};
|
|
18
18
|
//# sourceMappingURL=module.js.map
|
package/dist/main.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var $
|
|
1
|
+
var $9J0Et$adobereactspectrumAvatar = require("@adobe/react-spectrum/Avatar");
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
function $parcel$export(e, n, v, s) {
|
|
5
5
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
$parcel$export(module.exports, "Avatar", ()
|
|
8
|
+
$parcel$export(module.exports, "Avatar", function () { return $9J0Et$adobereactspectrumAvatar.Avatar; });
|
|
9
9
|
/*
|
|
10
10
|
* Copyright 2021 Adobe. All rights reserved.
|
|
11
11
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC,GACD,0CAA0C","sources":["packages/@react-spectrum/avatar/src/index.ts"],"sourcesContent":["/*\n * Copyright 2021 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n/// <reference types=\"css-module-types\" />\nexport {Avatar} from '
|
|
1
|
+
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC,GACD,0CAA0C","sources":["packages/@react-spectrum/avatar/src/index.ts"],"sourcesContent":["/*\n * Copyright 2021 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n/// <reference types=\"css-module-types\" />\nexport {Avatar} from '@adobe/react-spectrum/Avatar';\n\nexport type {AvatarProps, SpectrumAvatarProps} from '@adobe/react-spectrum/Avatar';\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/module.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Avatar as $
|
|
1
|
+
import {Avatar as $e5742fe3704dfccc$re_export$Avatar} from "@adobe/react-spectrum/Avatar";
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* Copyright 2021 Adobe. All rights reserved.
|
|
@@ -14,5 +14,5 @@ import {Avatar as $ab0b7b2186c39312$export$e2255cf6045e8d47} from "./Avatar.modu
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
export {$
|
|
17
|
+
export {$e5742fe3704dfccc$re_export$Avatar as Avatar};
|
|
18
18
|
//# sourceMappingURL=module.js.map
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;AAAA;;;;;;;;;;CAUC,GACD,0CAA0C","sources":["packages/@react-spectrum/avatar/src/index.ts"],"sourcesContent":["/*\n * Copyright 2021 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n/// <reference types=\"css-module-types\" />\nexport {Avatar} from '
|
|
1
|
+
{"mappings":";;AAAA;;;;;;;;;;CAUC,GACD,0CAA0C","sources":["packages/@react-spectrum/avatar/src/index.ts"],"sourcesContent":["/*\n * Copyright 2021 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n/// <reference types=\"css-module-types\" />\nexport {Avatar} from '@adobe/react-spectrum/Avatar';\n\nexport type {AvatarProps, SpectrumAvatarProps} from '@adobe/react-spectrum/Avatar';\n"],"names":[],"version":3,"file":"module.js.map"}
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-spectrum/avatar",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
7
7
|
"module": "dist/module.js",
|
|
8
8
|
"exports": {
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
"./dist/types.d.ts",
|
|
12
|
-
"./
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
9
|
+
".": {
|
|
10
|
+
"source": "./src/index.ts",
|
|
11
|
+
"types": "./dist/types/src/index.d.ts",
|
|
12
|
+
"import": "./dist/import.mjs",
|
|
13
|
+
"require": "./dist/main.js"
|
|
14
|
+
},
|
|
15
|
+
"./package.json": "./package.json"
|
|
16
16
|
},
|
|
17
|
-
"types": "dist/types.d.ts",
|
|
17
|
+
"types": "dist/types/src/index.d.ts",
|
|
18
18
|
"source": "src/index.ts",
|
|
19
19
|
"files": [
|
|
20
20
|
"dist",
|
|
@@ -24,38 +24,22 @@
|
|
|
24
24
|
"*.css"
|
|
25
25
|
],
|
|
26
26
|
"targets": {
|
|
27
|
-
"
|
|
28
|
-
"includeNodeModules": [
|
|
29
|
-
"@adobe/spectrum-css-temp"
|
|
30
|
-
]
|
|
31
|
-
},
|
|
32
|
-
"module": {
|
|
33
|
-
"includeNodeModules": [
|
|
34
|
-
"@adobe/spectrum-css-temp"
|
|
35
|
-
]
|
|
36
|
-
}
|
|
27
|
+
"types": false
|
|
37
28
|
},
|
|
38
29
|
"repository": {
|
|
39
30
|
"type": "git",
|
|
40
31
|
"url": "https://github.com/adobe/react-spectrum"
|
|
41
32
|
},
|
|
42
33
|
"dependencies": {
|
|
43
|
-
"@react-
|
|
44
|
-
"@react-spectrum/utils": "^3.12.12",
|
|
45
|
-
"@react-types/avatar": "^3.0.21",
|
|
46
|
-
"@react-types/shared": "^3.33.1",
|
|
34
|
+
"@adobe/react-spectrum": "3.47.0",
|
|
47
35
|
"@swc/helpers": "^0.5.0"
|
|
48
36
|
},
|
|
49
|
-
"devDependencies": {
|
|
50
|
-
"@adobe/spectrum-css-temp": "3.0.0-alpha.1"
|
|
51
|
-
},
|
|
52
37
|
"peerDependencies": {
|
|
53
|
-
"@react-spectrum/provider": "^3.2.1",
|
|
54
38
|
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
|
|
55
39
|
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
|
|
56
40
|
},
|
|
57
41
|
"publishConfig": {
|
|
58
42
|
"access": "public"
|
|
59
43
|
},
|
|
60
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "a6999bdf494a2e9c0381a5881908328bdd22ddae"
|
|
61
45
|
}
|
package/src/index.ts
CHANGED
|
@@ -10,5 +10,6 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
/// <reference types="css-module-types" />
|
|
13
|
-
export {Avatar} from '
|
|
14
|
-
|
|
13
|
+
export {Avatar} from '@adobe/react-spectrum/Avatar';
|
|
14
|
+
|
|
15
|
+
export type {AvatarProps, SpectrumAvatarProps} from '@adobe/react-spectrum/Avatar';
|
package/dist/Avatar.main.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
require("./avatar.6abf1dc5.css");
|
|
2
|
-
var $d22788318b5f79eb$exports = require("./avatar_vars_css.main.js");
|
|
3
|
-
var $3FJGB$reactspectrumutils = require("@react-spectrum/utils");
|
|
4
|
-
var $3FJGB$reactariautils = require("@react-aria/utils");
|
|
5
|
-
var $3FJGB$react = require("react");
|
|
6
|
-
var $3FJGB$reactspectrumprovider = require("@react-spectrum/provider");
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
function $parcel$interopDefault(a) {
|
|
10
|
-
return a && a.__esModule ? a.default : a;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function $parcel$export(e, n, v, s) {
|
|
14
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
$parcel$export(module.exports, "Avatar", () => $cc830936d47bae2b$export$e2255cf6045e8d47);
|
|
18
|
-
/*
|
|
19
|
-
* Copyright 2021 Adobe. All rights reserved.
|
|
20
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
21
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
22
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
23
|
-
*
|
|
24
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
25
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
26
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
27
|
-
* governing permissions and limitations under the License.
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const $cc830936d47bae2b$var$DEFAULT_SIZE = 'avatar-size-100';
|
|
34
|
-
const $cc830936d47bae2b$var$SIZE_RE = /^size-\d+/;
|
|
35
|
-
const $cc830936d47bae2b$export$e2255cf6045e8d47 = /*#__PURE__*/ (0, $3FJGB$react.forwardRef)(function Avatar(props, ref) {
|
|
36
|
-
props = (0, $3FJGB$reactspectrumutils.useSlotProps)(props, 'avatar');
|
|
37
|
-
const { alt: alt = '', isDisabled: isDisabled, size: size = $cc830936d47bae2b$var$DEFAULT_SIZE, src: src, ...otherProps } = (0, $3FJGB$reactspectrumprovider.useProviderProps)(props);
|
|
38
|
-
const { styleProps: styleProps } = (0, $3FJGB$reactspectrumutils.useStyleProps)(otherProps);
|
|
39
|
-
const domRef = (0, $3FJGB$reactspectrumutils.useDOMRef)(ref);
|
|
40
|
-
const domProps = (0, $3FJGB$reactariautils.filterDOMProps)(otherProps);
|
|
41
|
-
// Casting `size` as `any` since `isNaN` expects a `number`, but we want it
|
|
42
|
-
// to handle `string` numbers; e.g. '300' as opposed to 300
|
|
43
|
-
const sizeValue = typeof size !== 'number' && ($cc830936d47bae2b$var$SIZE_RE.test(size) || !isNaN(size)) ? (0, $3FJGB$reactspectrumutils.dimensionValue)($cc830936d47bae2b$var$DEFAULT_SIZE) // override disallowed size values
|
|
44
|
-
: (0, $3FJGB$reactspectrumutils.dimensionValue)(size || $cc830936d47bae2b$var$DEFAULT_SIZE);
|
|
45
|
-
return /*#__PURE__*/ (0, ($parcel$interopDefault($3FJGB$react))).createElement("img", {
|
|
46
|
-
...styleProps,
|
|
47
|
-
...domProps,
|
|
48
|
-
alt: alt,
|
|
49
|
-
className: (0, $3FJGB$reactspectrumutils.classNames)((0, ($parcel$interopDefault($d22788318b5f79eb$exports))), 'spectrum-Avatar', {
|
|
50
|
-
'is-disabled': isDisabled
|
|
51
|
-
}, styleProps.className),
|
|
52
|
-
ref: domRef,
|
|
53
|
-
src: src,
|
|
54
|
-
style: {
|
|
55
|
-
...styleProps.style,
|
|
56
|
-
...sizeValue && {
|
|
57
|
-
height: sizeValue,
|
|
58
|
-
width: sizeValue
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
//# sourceMappingURL=Avatar.main.js.map
|
package/dist/Avatar.main.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAUD,MAAM,qCAAe;AACrB,MAAM,gCAAU;AAKT,MAAM,0DAAS,CAAA,GAAA,uBAAS,EAAE,SAAS,OAAO,KAA0B,EAAE,GAA6B;IACxG,QAAQ,CAAA,GAAA,sCAAW,EAAE,OAAO;IAC5B,MAAM,OACJ,MAAM,gBACN,UAAU,QACV,OAAO,yCACP,GAAG,EACH,GAAG,YACJ,GAAG,CAAA,GAAA,6CAAe,EAAE;IAErB,MAAM,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,uCAAY,EAAE;IACnC,MAAM,SAAS,CAAA,GAAA,mCAAQ,EAAE;IAEzB,MAAM,WAAW,CAAA,GAAA,oCAAa,EAAE;IAEhC,2EAA2E;IAC3E,2DAA2D;IAC3D,MAAM,YAAY,OAAO,SAAS,YAAa,CAAA,8BAAQ,IAAI,CAAC,SAAS,CAAC,MAAM,KAAW,IACnF,CAAA,GAAA,wCAAa,EAAE,oCAAc,kCAAkC;OAC/D,CAAA,GAAA,wCAAa,EAAE,QAAQ;IAE3B,qBACE,0DAAC;QACE,GAAG,UAAU;QACb,GAAG,QAAQ;QACZ,KAAK;QACL,WAAW,CAAA,GAAA,oCAAS,EAClB,CAAA,GAAA,mDAAK,GACL,mBACA;YACE,eAAe;QACjB,GACA,WAAW,SAAS;QACtB,KAAK;QACL,KAAK;QACL,OAAO;YACL,GAAG,WAAW,KAAK;YACnB,GAAI,aAAa;gBAAC,QAAQ;gBAAW,OAAO;YAAS,CAAC;QACxD;;AAEN","sources":["packages/@react-spectrum/avatar/src/Avatar.tsx"],"sourcesContent":["/*\n * Copyright 2021 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {classNames, dimensionValue, useDOMRef, useSlotProps, useStyleProps} from '@react-spectrum/utils';\nimport {DOMRef} from '@react-types/shared';\nimport {filterDOMProps} from '@react-aria/utils';\nimport React, {forwardRef} from 'react';\nimport {SpectrumAvatarProps} from '@react-types/avatar';\nimport styles from '@adobe/spectrum-css-temp/components/avatar/vars.css';\nimport {useProviderProps} from '@react-spectrum/provider';\n\nconst DEFAULT_SIZE = 'avatar-size-100';\nconst SIZE_RE = /^size-\\d+/;\n\n/**\n * An avatar is a thumbnail representation of an entity, such as a user or an organization.\n */\nexport const Avatar = forwardRef(function Avatar(props: SpectrumAvatarProps, ref: DOMRef<HTMLImageElement>) {\n props = useSlotProps(props, 'avatar');\n const {\n alt = '',\n isDisabled,\n size = DEFAULT_SIZE,\n src,\n ...otherProps\n } = useProviderProps(props);\n\n const {styleProps} = useStyleProps(otherProps);\n const domRef = useDOMRef(ref);\n\n const domProps = filterDOMProps(otherProps);\n\n // Casting `size` as `any` since `isNaN` expects a `number`, but we want it\n // to handle `string` numbers; e.g. '300' as opposed to 300\n const sizeValue = typeof size !== 'number' && (SIZE_RE.test(size) || !isNaN(size as any))\n ? dimensionValue(DEFAULT_SIZE) // override disallowed size values\n : dimensionValue(size || DEFAULT_SIZE);\n\n return (\n <img\n {...styleProps}\n {...domProps}\n alt={alt}\n className={classNames(\n styles,\n 'spectrum-Avatar',\n {\n 'is-disabled': isDisabled\n },\n styleProps.className)}\n ref={domRef}\n src={src}\n style={{\n ...styleProps.style,\n ...(sizeValue && {height: sizeValue, width: sizeValue})\n }} />\n );\n});\n"],"names":[],"version":3,"file":"Avatar.main.js.map"}
|
package/dist/Avatar.mjs
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import "./avatar.6abf1dc5.css";
|
|
2
|
-
import $73onX$avatar_vars_cssmodulejs from "./avatar_vars_css.mjs";
|
|
3
|
-
import {useSlotProps as $73onX$useSlotProps, useStyleProps as $73onX$useStyleProps, useDOMRef as $73onX$useDOMRef, dimensionValue as $73onX$dimensionValue, classNames as $73onX$classNames} from "@react-spectrum/utils";
|
|
4
|
-
import {filterDOMProps as $73onX$filterDOMProps} from "@react-aria/utils";
|
|
5
|
-
import $73onX$react, {forwardRef as $73onX$forwardRef} from "react";
|
|
6
|
-
import {useProviderProps as $73onX$useProviderProps} from "@react-spectrum/provider";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
function $parcel$interopDefault(a) {
|
|
10
|
-
return a && a.__esModule ? a.default : a;
|
|
11
|
-
}
|
|
12
|
-
/*
|
|
13
|
-
* Copyright 2021 Adobe. All rights reserved.
|
|
14
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
15
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
16
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
*
|
|
18
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
19
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
20
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
21
|
-
* governing permissions and limitations under the License.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const $ab0b7b2186c39312$var$DEFAULT_SIZE = 'avatar-size-100';
|
|
28
|
-
const $ab0b7b2186c39312$var$SIZE_RE = /^size-\d+/;
|
|
29
|
-
const $ab0b7b2186c39312$export$e2255cf6045e8d47 = /*#__PURE__*/ (0, $73onX$forwardRef)(function Avatar(props, ref) {
|
|
30
|
-
props = (0, $73onX$useSlotProps)(props, 'avatar');
|
|
31
|
-
const { alt: alt = '', isDisabled: isDisabled, size: size = $ab0b7b2186c39312$var$DEFAULT_SIZE, src: src, ...otherProps } = (0, $73onX$useProviderProps)(props);
|
|
32
|
-
const { styleProps: styleProps } = (0, $73onX$useStyleProps)(otherProps);
|
|
33
|
-
const domRef = (0, $73onX$useDOMRef)(ref);
|
|
34
|
-
const domProps = (0, $73onX$filterDOMProps)(otherProps);
|
|
35
|
-
// Casting `size` as `any` since `isNaN` expects a `number`, but we want it
|
|
36
|
-
// to handle `string` numbers; e.g. '300' as opposed to 300
|
|
37
|
-
const sizeValue = typeof size !== 'number' && ($ab0b7b2186c39312$var$SIZE_RE.test(size) || !isNaN(size)) ? (0, $73onX$dimensionValue)($ab0b7b2186c39312$var$DEFAULT_SIZE) // override disallowed size values
|
|
38
|
-
: (0, $73onX$dimensionValue)(size || $ab0b7b2186c39312$var$DEFAULT_SIZE);
|
|
39
|
-
return /*#__PURE__*/ (0, $73onX$react).createElement("img", {
|
|
40
|
-
...styleProps,
|
|
41
|
-
...domProps,
|
|
42
|
-
alt: alt,
|
|
43
|
-
className: (0, $73onX$classNames)((0, ($parcel$interopDefault($73onX$avatar_vars_cssmodulejs))), 'spectrum-Avatar', {
|
|
44
|
-
'is-disabled': isDisabled
|
|
45
|
-
}, styleProps.className),
|
|
46
|
-
ref: domRef,
|
|
47
|
-
src: src,
|
|
48
|
-
style: {
|
|
49
|
-
...styleProps.style,
|
|
50
|
-
...sizeValue && {
|
|
51
|
-
height: sizeValue,
|
|
52
|
-
width: sizeValue
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
export {$ab0b7b2186c39312$export$e2255cf6045e8d47 as Avatar};
|
|
60
|
-
//# sourceMappingURL=Avatar.module.js.map
|
package/dist/Avatar.module.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import "./avatar.6abf1dc5.css";
|
|
2
|
-
import $73onX$avatar_vars_cssmodulejs from "./avatar_vars_css.module.js";
|
|
3
|
-
import {useSlotProps as $73onX$useSlotProps, useStyleProps as $73onX$useStyleProps, useDOMRef as $73onX$useDOMRef, dimensionValue as $73onX$dimensionValue, classNames as $73onX$classNames} from "@react-spectrum/utils";
|
|
4
|
-
import {filterDOMProps as $73onX$filterDOMProps} from "@react-aria/utils";
|
|
5
|
-
import $73onX$react, {forwardRef as $73onX$forwardRef} from "react";
|
|
6
|
-
import {useProviderProps as $73onX$useProviderProps} from "@react-spectrum/provider";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
function $parcel$interopDefault(a) {
|
|
10
|
-
return a && a.__esModule ? a.default : a;
|
|
11
|
-
}
|
|
12
|
-
/*
|
|
13
|
-
* Copyright 2021 Adobe. All rights reserved.
|
|
14
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
15
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
16
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
*
|
|
18
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
19
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
20
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
21
|
-
* governing permissions and limitations under the License.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const $ab0b7b2186c39312$var$DEFAULT_SIZE = 'avatar-size-100';
|
|
28
|
-
const $ab0b7b2186c39312$var$SIZE_RE = /^size-\d+/;
|
|
29
|
-
const $ab0b7b2186c39312$export$e2255cf6045e8d47 = /*#__PURE__*/ (0, $73onX$forwardRef)(function Avatar(props, ref) {
|
|
30
|
-
props = (0, $73onX$useSlotProps)(props, 'avatar');
|
|
31
|
-
const { alt: alt = '', isDisabled: isDisabled, size: size = $ab0b7b2186c39312$var$DEFAULT_SIZE, src: src, ...otherProps } = (0, $73onX$useProviderProps)(props);
|
|
32
|
-
const { styleProps: styleProps } = (0, $73onX$useStyleProps)(otherProps);
|
|
33
|
-
const domRef = (0, $73onX$useDOMRef)(ref);
|
|
34
|
-
const domProps = (0, $73onX$filterDOMProps)(otherProps);
|
|
35
|
-
// Casting `size` as `any` since `isNaN` expects a `number`, but we want it
|
|
36
|
-
// to handle `string` numbers; e.g. '300' as opposed to 300
|
|
37
|
-
const sizeValue = typeof size !== 'number' && ($ab0b7b2186c39312$var$SIZE_RE.test(size) || !isNaN(size)) ? (0, $73onX$dimensionValue)($ab0b7b2186c39312$var$DEFAULT_SIZE) // override disallowed size values
|
|
38
|
-
: (0, $73onX$dimensionValue)(size || $ab0b7b2186c39312$var$DEFAULT_SIZE);
|
|
39
|
-
return /*#__PURE__*/ (0, $73onX$react).createElement("img", {
|
|
40
|
-
...styleProps,
|
|
41
|
-
...domProps,
|
|
42
|
-
alt: alt,
|
|
43
|
-
className: (0, $73onX$classNames)((0, ($parcel$interopDefault($73onX$avatar_vars_cssmodulejs))), 'spectrum-Avatar', {
|
|
44
|
-
'is-disabled': isDisabled
|
|
45
|
-
}, styleProps.className),
|
|
46
|
-
ref: domRef,
|
|
47
|
-
src: src,
|
|
48
|
-
style: {
|
|
49
|
-
...styleProps.style,
|
|
50
|
-
...sizeValue && {
|
|
51
|
-
height: sizeValue,
|
|
52
|
-
width: sizeValue
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
export {$ab0b7b2186c39312$export$e2255cf6045e8d47 as Avatar};
|
|
60
|
-
//# sourceMappingURL=Avatar.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAUD,MAAM,qCAAe;AACrB,MAAM,gCAAU;AAKT,MAAM,0DAAS,CAAA,GAAA,iBAAS,EAAE,SAAS,OAAO,KAA0B,EAAE,GAA6B;IACxG,QAAQ,CAAA,GAAA,mBAAW,EAAE,OAAO;IAC5B,MAAM,OACJ,MAAM,gBACN,UAAU,QACV,OAAO,yCACP,GAAG,EACH,GAAG,YACJ,GAAG,CAAA,GAAA,uBAAe,EAAE;IAErB,MAAM,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,oBAAY,EAAE;IACnC,MAAM,SAAS,CAAA,GAAA,gBAAQ,EAAE;IAEzB,MAAM,WAAW,CAAA,GAAA,qBAAa,EAAE;IAEhC,2EAA2E;IAC3E,2DAA2D;IAC3D,MAAM,YAAY,OAAO,SAAS,YAAa,CAAA,8BAAQ,IAAI,CAAC,SAAS,CAAC,MAAM,KAAW,IACnF,CAAA,GAAA,qBAAa,EAAE,oCAAc,kCAAkC;OAC/D,CAAA,GAAA,qBAAa,EAAE,QAAQ;IAE3B,qBACE,gCAAC;QACE,GAAG,UAAU;QACb,GAAG,QAAQ;QACZ,KAAK;QACL,WAAW,CAAA,GAAA,iBAAS,EAClB,CAAA,GAAA,wDAAK,GACL,mBACA;YACE,eAAe;QACjB,GACA,WAAW,SAAS;QACtB,KAAK;QACL,KAAK;QACL,OAAO;YACL,GAAG,WAAW,KAAK;YACnB,GAAI,aAAa;gBAAC,QAAQ;gBAAW,OAAO;YAAS,CAAC;QACxD;;AAEN","sources":["packages/@react-spectrum/avatar/src/Avatar.tsx"],"sourcesContent":["/*\n * Copyright 2021 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {classNames, dimensionValue, useDOMRef, useSlotProps, useStyleProps} from '@react-spectrum/utils';\nimport {DOMRef} from '@react-types/shared';\nimport {filterDOMProps} from '@react-aria/utils';\nimport React, {forwardRef} from 'react';\nimport {SpectrumAvatarProps} from '@react-types/avatar';\nimport styles from '@adobe/spectrum-css-temp/components/avatar/vars.css';\nimport {useProviderProps} from '@react-spectrum/provider';\n\nconst DEFAULT_SIZE = 'avatar-size-100';\nconst SIZE_RE = /^size-\\d+/;\n\n/**\n * An avatar is a thumbnail representation of an entity, such as a user or an organization.\n */\nexport const Avatar = forwardRef(function Avatar(props: SpectrumAvatarProps, ref: DOMRef<HTMLImageElement>) {\n props = useSlotProps(props, 'avatar');\n const {\n alt = '',\n isDisabled,\n size = DEFAULT_SIZE,\n src,\n ...otherProps\n } = useProviderProps(props);\n\n const {styleProps} = useStyleProps(otherProps);\n const domRef = useDOMRef(ref);\n\n const domProps = filterDOMProps(otherProps);\n\n // Casting `size` as `any` since `isNaN` expects a `number`, but we want it\n // to handle `string` numbers; e.g. '300' as opposed to 300\n const sizeValue = typeof size !== 'number' && (SIZE_RE.test(size) || !isNaN(size as any))\n ? dimensionValue(DEFAULT_SIZE) // override disallowed size values\n : dimensionValue(size || DEFAULT_SIZE);\n\n return (\n <img\n {...styleProps}\n {...domProps}\n alt={alt}\n className={classNames(\n styles,\n 'spectrum-Avatar',\n {\n 'is-disabled': isDisabled\n },\n styleProps.className)}\n ref={domRef}\n src={src}\n style={{\n ...styleProps.style,\n ...(sizeValue && {height: sizeValue, width: sizeValue})\n }} />\n );\n});\n"],"names":[],"version":3,"file":"Avatar.module.js.map"}
|
package/dist/avatar.6abf1dc5.css
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
.jilAbW_spectrum-Avatar {
|
|
2
|
-
width: var(--spectrum-avatar-small-width, var(--spectrum-global-dimension-size-200));
|
|
3
|
-
height: var(--spectrum-avatar-small-height, var(--spectrum-global-dimension-size-200));
|
|
4
|
-
border-radius: var(--spectrum-avatar-small-border-radius, 50%);
|
|
5
|
-
-webkit-user-drag: none;
|
|
6
|
-
-webkit-user-select: none;
|
|
7
|
-
user-select: none;
|
|
8
|
-
opacity: var(--spectrum-avatar-small-opacity, 1);
|
|
9
|
-
transition: box-shadow var(--spectrum-global-animation-duration-100, .13s) ease-out;
|
|
10
|
-
border-style: none;
|
|
11
|
-
outline: none;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.jilAbW_spectrum-Avatar.jilAbW_is-disabled {
|
|
15
|
-
opacity: var(--spectrum-avatar-small-opacity-disabled, .3);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
@media (forced-colors: active) {
|
|
19
|
-
.jilAbW_spectrum-Avatar.jilAbW_is-disabled {
|
|
20
|
-
opacity: 1;
|
|
21
|
-
border: 2px solid graytext;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
/*# sourceMappingURL=avatar.6abf1dc5.css.map */
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":"AAwBA;;;;;;;;;;;;;AA4BE;;;;AAKF;EAEI","sources":["packages/@adobe/spectrum-css-temp/components/avatar/vars.css"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"avatar.6abf1dc5.css.map"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
function $parcel$export(e, n, v, s) {
|
|
3
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
$parcel$export(module.exports, "is-disabled", () => $d22788318b5f79eb$export$d35bc1e505d1ebbf, (v) => $d22788318b5f79eb$export$d35bc1e505d1ebbf = v);
|
|
7
|
-
$parcel$export(module.exports, "spectrum-Avatar", () => $d22788318b5f79eb$export$2e049b8d031600fb, (v) => $d22788318b5f79eb$export$2e049b8d031600fb = v);
|
|
8
|
-
var $d22788318b5f79eb$export$d35bc1e505d1ebbf;
|
|
9
|
-
var $d22788318b5f79eb$export$2e049b8d031600fb;
|
|
10
|
-
$d22788318b5f79eb$export$d35bc1e505d1ebbf = `jilAbW_is-disabled`;
|
|
11
|
-
$d22788318b5f79eb$export$2e049b8d031600fb = `jilAbW_spectrum-Avatar`;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
//# sourceMappingURL=avatar_vars_css.main.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;AAAA,IAAA;AACA,IAAA;AADA,4CAAgC,CAAC,kBAAkB,CAAC;AACpD,4CAAoC,CAAC,sBAAsB,CAAC","sources":["packages/@adobe/spectrum-css-temp/components/avatar/vars.css"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"avatar_vars_css.main.js.map"}
|
package/dist/avatar_vars_css.mjs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
function $parcel$export(e, n, v, s) {
|
|
3
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
4
|
-
}
|
|
5
|
-
var $f81b9c4eea42ecfe$exports = {};
|
|
6
|
-
|
|
7
|
-
$parcel$export($f81b9c4eea42ecfe$exports, "is-disabled", () => $f81b9c4eea42ecfe$export$d35bc1e505d1ebbf, (v) => $f81b9c4eea42ecfe$export$d35bc1e505d1ebbf = v);
|
|
8
|
-
$parcel$export($f81b9c4eea42ecfe$exports, "spectrum-Avatar", () => $f81b9c4eea42ecfe$export$2e049b8d031600fb, (v) => $f81b9c4eea42ecfe$export$2e049b8d031600fb = v);
|
|
9
|
-
var $f81b9c4eea42ecfe$export$d35bc1e505d1ebbf;
|
|
10
|
-
var $f81b9c4eea42ecfe$export$2e049b8d031600fb;
|
|
11
|
-
$f81b9c4eea42ecfe$export$d35bc1e505d1ebbf = `jilAbW_is-disabled`;
|
|
12
|
-
$f81b9c4eea42ecfe$export$2e049b8d031600fb = `jilAbW_spectrum-Avatar`;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export {$f81b9c4eea42ecfe$exports as default};
|
|
16
|
-
//# sourceMappingURL=avatar_vars_css.module.js.map
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
function $parcel$export(e, n, v, s) {
|
|
3
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
4
|
-
}
|
|
5
|
-
var $f81b9c4eea42ecfe$exports = {};
|
|
6
|
-
|
|
7
|
-
$parcel$export($f81b9c4eea42ecfe$exports, "is-disabled", () => $f81b9c4eea42ecfe$export$d35bc1e505d1ebbf, (v) => $f81b9c4eea42ecfe$export$d35bc1e505d1ebbf = v);
|
|
8
|
-
$parcel$export($f81b9c4eea42ecfe$exports, "spectrum-Avatar", () => $f81b9c4eea42ecfe$export$2e049b8d031600fb, (v) => $f81b9c4eea42ecfe$export$2e049b8d031600fb = v);
|
|
9
|
-
var $f81b9c4eea42ecfe$export$d35bc1e505d1ebbf;
|
|
10
|
-
var $f81b9c4eea42ecfe$export$2e049b8d031600fb;
|
|
11
|
-
$f81b9c4eea42ecfe$export$d35bc1e505d1ebbf = `jilAbW_is-disabled`;
|
|
12
|
-
$f81b9c4eea42ecfe$export$2e049b8d031600fb = `jilAbW_spectrum-Avatar`;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export {$f81b9c4eea42ecfe$exports as default};
|
|
16
|
-
//# sourceMappingURL=avatar_vars_css.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;AAAA,IAAA;AACA,IAAA;AADA,4CAAgC,CAAC,kBAAkB,CAAC;AACpD,4CAAoC,CAAC,sBAAsB,CAAC","sources":["packages/@adobe/spectrum-css-temp/components/avatar/vars.css"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"avatar_vars_css.module.js.map"}
|
package/dist/types.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { SpectrumAvatarProps } from "@react-types/avatar";
|
|
3
|
-
import { DOMRefValue } from "@react-types/shared";
|
|
4
|
-
/**
|
|
5
|
-
* An avatar is a thumbnail representation of an entity, such as a user or an organization.
|
|
6
|
-
*/
|
|
7
|
-
export const Avatar: React.ForwardRefExoticComponent<SpectrumAvatarProps & React.RefAttributes<DOMRefValue<HTMLImageElement>>>;
|
|
8
|
-
export type { SpectrumAvatarProps } from '@react-types/avatar';
|
|
9
|
-
|
|
10
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;AAuBA;;GAEG;AACH,OAAO,MAAM,iHAwCX,CAAC;ACrDH,YAAY,EAAC,mBAAmB,EAAC,MAAM,qBAAqB,CAAC","sources":["packages/@react-spectrum/avatar/src/packages/@react-spectrum/avatar/src/Avatar.tsx","packages/@react-spectrum/avatar/src/packages/@react-spectrum/avatar/src/index.ts","packages/@react-spectrum/avatar/src/index.ts"],"sourcesContent":[null,null,"/*\n * Copyright 2021 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n/// <reference types=\"css-module-types\" />\nexport {Avatar} from './Avatar';\nexport type {SpectrumAvatarProps} from '@react-types/avatar';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/src/Avatar.tsx
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2021 Adobe. All rights reserved.
|
|
3
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
*
|
|
7
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
* governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import {classNames, dimensionValue, useDOMRef, useSlotProps, useStyleProps} from '@react-spectrum/utils';
|
|
14
|
-
import {DOMRef} from '@react-types/shared';
|
|
15
|
-
import {filterDOMProps} from '@react-aria/utils';
|
|
16
|
-
import React, {forwardRef} from 'react';
|
|
17
|
-
import {SpectrumAvatarProps} from '@react-types/avatar';
|
|
18
|
-
import styles from '@adobe/spectrum-css-temp/components/avatar/vars.css';
|
|
19
|
-
import {useProviderProps} from '@react-spectrum/provider';
|
|
20
|
-
|
|
21
|
-
const DEFAULT_SIZE = 'avatar-size-100';
|
|
22
|
-
const SIZE_RE = /^size-\d+/;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* An avatar is a thumbnail representation of an entity, such as a user or an organization.
|
|
26
|
-
*/
|
|
27
|
-
export const Avatar = forwardRef(function Avatar(props: SpectrumAvatarProps, ref: DOMRef<HTMLImageElement>) {
|
|
28
|
-
props = useSlotProps(props, 'avatar');
|
|
29
|
-
const {
|
|
30
|
-
alt = '',
|
|
31
|
-
isDisabled,
|
|
32
|
-
size = DEFAULT_SIZE,
|
|
33
|
-
src,
|
|
34
|
-
...otherProps
|
|
35
|
-
} = useProviderProps(props);
|
|
36
|
-
|
|
37
|
-
const {styleProps} = useStyleProps(otherProps);
|
|
38
|
-
const domRef = useDOMRef(ref);
|
|
39
|
-
|
|
40
|
-
const domProps = filterDOMProps(otherProps);
|
|
41
|
-
|
|
42
|
-
// Casting `size` as `any` since `isNaN` expects a `number`, but we want it
|
|
43
|
-
// to handle `string` numbers; e.g. '300' as opposed to 300
|
|
44
|
-
const sizeValue = typeof size !== 'number' && (SIZE_RE.test(size) || !isNaN(size as any))
|
|
45
|
-
? dimensionValue(DEFAULT_SIZE) // override disallowed size values
|
|
46
|
-
: dimensionValue(size || DEFAULT_SIZE);
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<img
|
|
50
|
-
{...styleProps}
|
|
51
|
-
{...domProps}
|
|
52
|
-
alt={alt}
|
|
53
|
-
className={classNames(
|
|
54
|
-
styles,
|
|
55
|
-
'spectrum-Avatar',
|
|
56
|
-
{
|
|
57
|
-
'is-disabled': isDisabled
|
|
58
|
-
},
|
|
59
|
-
styleProps.className)}
|
|
60
|
-
ref={domRef}
|
|
61
|
-
src={src}
|
|
62
|
-
style={{
|
|
63
|
-
...styleProps.style,
|
|
64
|
-
...(sizeValue && {height: sizeValue, width: sizeValue})
|
|
65
|
-
}} />
|
|
66
|
-
);
|
|
67
|
-
});
|