@react-spectrum/avatar 3.0.0-alpha.8 → 3.0.0-beta.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.
@@ -0,0 +1,86 @@
1
+ import "./main.css";
2
+ import {useSlotProps as $85w8l$useSlotProps, useStyleProps as $85w8l$useStyleProps, useDOMRef as $85w8l$useDOMRef, dimensionValue as $85w8l$dimensionValue, classNames as $85w8l$classNames} from "@react-spectrum/utils";
3
+ import {filterDOMProps as $85w8l$filterDOMProps} from "@react-aria/utils";
4
+ import $85w8l$react, {forwardRef as $85w8l$forwardRef} from "react";
5
+ import {useProviderProps as $85w8l$useProviderProps} from "@react-spectrum/provider";
6
+
7
+ function $parcel$interopDefault(a) {
8
+ return a && a.__esModule ? a.default : a;
9
+ }
10
+ function $parcel$export(e, n, v, s) {
11
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
12
+ }
13
+ /*
14
+ * Copyright 2021 Adobe. All rights reserved.
15
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
16
+ * you may not use this file except in compliance with the License. You may obtain a copy
17
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
18
+ *
19
+ * Unless required by applicable law or agreed to in writing, software distributed under
20
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
21
+ * OF ANY KIND, either express or implied. See the License for the specific language
22
+ * governing permissions and limitations under the License.
23
+ */ /// <reference types="css-module-types" />
24
+ /*
25
+ * Copyright 2021 Adobe. All rights reserved.
26
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
27
+ * you may not use this file except in compliance with the License. You may obtain a copy
28
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
29
+ *
30
+ * Unless required by applicable law or agreed to in writing, software distributed under
31
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
32
+ * OF ANY KIND, either express or implied. See the License for the specific language
33
+ * governing permissions and limitations under the License.
34
+ */
35
+
36
+
37
+ var $f81b9c4eea42ecfe$exports = {};
38
+
39
+ $parcel$export($f81b9c4eea42ecfe$exports, "spectrum-Avatar", () => $f81b9c4eea42ecfe$export$2e049b8d031600fb, (v) => $f81b9c4eea42ecfe$export$2e049b8d031600fb = v);
40
+ $parcel$export($f81b9c4eea42ecfe$exports, "is-disabled", () => $f81b9c4eea42ecfe$export$d35bc1e505d1ebbf, (v) => $f81b9c4eea42ecfe$export$d35bc1e505d1ebbf = v);
41
+ var $f81b9c4eea42ecfe$export$2e049b8d031600fb;
42
+ var $f81b9c4eea42ecfe$export$d35bc1e505d1ebbf;
43
+ $f81b9c4eea42ecfe$export$2e049b8d031600fb = "spectrum-Avatar_2ebb13";
44
+ $f81b9c4eea42ecfe$export$d35bc1e505d1ebbf = "is-disabled_2ebb13";
45
+
46
+
47
+
48
+ const $ab0b7b2186c39312$var$DEFAULT_SIZE = "avatar-size-100";
49
+ const $ab0b7b2186c39312$var$SIZE_RE = /^size-\d+/;
50
+ function $ab0b7b2186c39312$var$Avatar(props, ref) {
51
+ props = (0, $85w8l$useSlotProps)(props, "avatar");
52
+ const { alt: alt = "" , isDisabled: isDisabled , size: size = $ab0b7b2186c39312$var$DEFAULT_SIZE , src: src , ...otherProps } = (0, $85w8l$useProviderProps)(props);
53
+ const { styleProps: styleProps } = (0, $85w8l$useStyleProps)(otherProps);
54
+ const domRef = (0, $85w8l$useDOMRef)(ref);
55
+ const domProps = (0, $85w8l$filterDOMProps)(otherProps);
56
+ // Casting `size` as `any` since `isNaN` expects a `number`, but we want it
57
+ // to handle `string` numbers; e.g. '300' as opposed to 300
58
+ const sizeValue = typeof size !== "number" && ($ab0b7b2186c39312$var$SIZE_RE.test(size) || !isNaN(size)) ? (0, $85w8l$dimensionValue)($ab0b7b2186c39312$var$DEFAULT_SIZE) // override disallowed size values
59
+ : (0, $85w8l$dimensionValue)(size || $ab0b7b2186c39312$var$DEFAULT_SIZE);
60
+ return /*#__PURE__*/ (0, $85w8l$react).createElement("img", {
61
+ ...styleProps,
62
+ ...domProps,
63
+ alt: alt,
64
+ className: (0, $85w8l$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($f81b9c4eea42ecfe$exports))), "spectrum-Avatar", {
65
+ "is-disabled": isDisabled
66
+ }, styleProps.className),
67
+ ref: domRef,
68
+ src: src,
69
+ style: {
70
+ ...styleProps.style,
71
+ ...sizeValue && {
72
+ height: sizeValue,
73
+ width: sizeValue
74
+ }
75
+ }
76
+ });
77
+ }
78
+ /**
79
+ * An avatar is a thumbnail representation of an entity, such as a user or an organization.
80
+ */ const $ab0b7b2186c39312$export$e2255cf6045e8d47 = /*#__PURE__*/ (0, $85w8l$forwardRef)($ab0b7b2186c39312$var$Avatar);
81
+
82
+
83
+
84
+
85
+ export {$ab0b7b2186c39312$export$e2255cf6045e8d47 as Avatar};
86
+ //# sourceMappingURL=module.js.map
package/dist/main.css CHANGED
@@ -1 +1 @@
1
- .spectrum-Avatar_2ebb13{width:var(--spectrum-avatar-small-width,var(--spectrum-global-dimension-size-200));height:var(--spectrum-avatar-small-height,var(--spectrum-global-dimension-size-200));border-radius:var(--spectrum-avatar-small-border-radius,50%);-webkit-user-drag:none;-webkit-user-select:none;user-select:none;opacity:var(--spectrum-avatar-small-opacity,1);transition:box-shadow var(--spectrum-global-animation-duration-100,130ms)ease-out;border-style:none;outline:0}.spectrum-Avatar_2ebb13.is-disabled_2ebb13{opacity:var(--spectrum-avatar-small-opacity-disabled,0.3)}@media (forced-colors:active){.spectrum-Avatar_2ebb13.is-disabled_2ebb13{opacity:1;border:2px solid GrayText}}
1
+ .spectrum-Avatar_2ebb13{width:var(--spectrum-avatar-small-width,var(--spectrum-global-dimension-size-200));height:var(--spectrum-avatar-small-height,var(--spectrum-global-dimension-size-200));border-radius:var(--spectrum-avatar-small-border-radius,50%);-webkit-user-drag:none;-webkit-user-select:none;user-select:none;opacity:var(--spectrum-avatar-small-opacity,1);transition:box-shadow var(--spectrum-global-animation-duration-100,.13s)ease-out;border-style:none;outline:none}.spectrum-Avatar_2ebb13.is-disabled_2ebb13{opacity:var(--spectrum-avatar-small-opacity-disabled,.3)}@media (forced-colors:active){.spectrum-Avatar_2ebb13.is-disabled_2ebb13{opacity:1;border:2px solid GrayText}}
package/dist/main.js CHANGED
@@ -12,7 +12,28 @@ function $parcel$interopDefault(a) {
12
12
  }
13
13
 
14
14
  $parcel$export(module.exports, "Avatar", () => $cc830936d47bae2b$export$e2255cf6045e8d47);
15
-
15
+ /*
16
+ * Copyright 2021 Adobe. All rights reserved.
17
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
18
+ * you may not use this file except in compliance with the License. You may obtain a copy
19
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
20
+ *
21
+ * Unless required by applicable law or agreed to in writing, software distributed under
22
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
23
+ * OF ANY KIND, either express or implied. See the License for the specific language
24
+ * governing permissions and limitations under the License.
25
+ */ /// <reference types="css-module-types" />
26
+ /*
27
+ * Copyright 2021 Adobe. All rights reserved.
28
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
29
+ * you may not use this file except in compliance with the License. You may obtain a copy
30
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
31
+ *
32
+ * Unless required by applicable law or agreed to in writing, software distributed under
33
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
34
+ * OF ANY KIND, either express or implied. See the License for the specific language
35
+ * governing permissions and limitations under the License.
36
+ */
16
37
 
17
38
 
18
39
  var $d22788318b5f79eb$exports = {};
@@ -26,24 +47,24 @@ $d22788318b5f79eb$export$d35bc1e505d1ebbf = "is-disabled_2ebb13";
26
47
 
27
48
 
28
49
 
29
- const $cc830936d47bae2b$var$DEFAULT_SIZE = 'avatar-size-100';
50
+ const $cc830936d47bae2b$var$DEFAULT_SIZE = "avatar-size-100";
30
51
  const $cc830936d47bae2b$var$SIZE_RE = /^size-\d+/;
31
52
  function $cc830936d47bae2b$var$Avatar(props, ref) {
32
- props = $hTGwy$reactspectrumutils.useSlotProps(props, 'avatar');
33
- const { alt: alt = '' , isDisabled: isDisabled , size: size , src: src , ...otherProps } = $hTGwy$reactspectrumprovider.useProviderProps(props);
34
- const { styleProps: styleProps } = $hTGwy$reactspectrumutils.useStyleProps(otherProps);
35
- const domRef = $hTGwy$reactspectrumutils.useDOMRef(ref);
36
- const domProps = $hTGwy$reactariautils.filterDOMProps(otherProps);
53
+ props = (0, $hTGwy$reactspectrumutils.useSlotProps)(props, "avatar");
54
+ const { alt: alt = "" , isDisabled: isDisabled , size: size = $cc830936d47bae2b$var$DEFAULT_SIZE , src: src , ...otherProps } = (0, $hTGwy$reactspectrumprovider.useProviderProps)(props);
55
+ const { styleProps: styleProps } = (0, $hTGwy$reactspectrumutils.useStyleProps)(otherProps);
56
+ const domRef = (0, $hTGwy$reactspectrumutils.useDOMRef)(ref);
57
+ const domProps = (0, $hTGwy$reactariautils.filterDOMProps)(otherProps);
37
58
  // Casting `size` as `any` since `isNaN` expects a `number`, but we want it
38
59
  // to handle `string` numbers; e.g. '300' as opposed to 300
39
- const sizeValue = typeof size !== 'number' && ($cc830936d47bae2b$var$SIZE_RE.test(size) || !isNaN(size)) ? $hTGwy$reactspectrumutils.dimensionValue($cc830936d47bae2b$var$DEFAULT_SIZE) // override disallowed size values
40
- : $hTGwy$reactspectrumutils.dimensionValue(size || $cc830936d47bae2b$var$DEFAULT_SIZE);
41
- return(/*#__PURE__*/ ($parcel$interopDefault($hTGwy$react)).createElement("img", {
60
+ const sizeValue = typeof size !== "number" && ($cc830936d47bae2b$var$SIZE_RE.test(size) || !isNaN(size)) ? (0, $hTGwy$reactspectrumutils.dimensionValue)($cc830936d47bae2b$var$DEFAULT_SIZE) // override disallowed size values
61
+ : (0, $hTGwy$reactspectrumutils.dimensionValue)(size || $cc830936d47bae2b$var$DEFAULT_SIZE);
62
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($hTGwy$react))).createElement("img", {
42
63
  ...styleProps,
43
64
  ...domProps,
44
65
  alt: alt,
45
- className: $hTGwy$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($d22788318b5f79eb$exports)), 'spectrum-Avatar', {
46
- 'is-disabled': isDisabled
66
+ className: (0, $hTGwy$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($d22788318b5f79eb$exports))), "spectrum-Avatar", {
67
+ "is-disabled": isDisabled
47
68
  }, styleProps.className),
48
69
  ref: domRef,
49
70
  src: src,
@@ -54,11 +75,11 @@ function $cc830936d47bae2b$var$Avatar(props, ref) {
54
75
  width: sizeValue
55
76
  }
56
77
  }
57
- }));
78
+ });
58
79
  }
59
80
  /**
60
81
  * An avatar is a thumbnail representation of an entity, such as a user or an organization.
61
- */ const $cc830936d47bae2b$export$e2255cf6045e8d47 = /*#__PURE__*/ $hTGwy$react.forwardRef($cc830936d47bae2b$var$Avatar);
82
+ */ const $cc830936d47bae2b$export$e2255cf6045e8d47 = /*#__PURE__*/ (0, $hTGwy$react.forwardRef)($cc830936d47bae2b$var$Avatar);
62
83
 
63
84
 
64
85
 
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;AEAA,GAAiC;AACjC,GAA6B;AAD7B,yCAAiC,GAAG,CAAwB;AAC5D,yCAA6B,GAAG,CAAoB;;;;ADmBpD,KAAK,CAAC,kCAAY,GAAG,CAAiB;AACtC,KAAK,CAAC,6BAAO;SAEJ,4BAAM,CAAC,KAA0B,EAAE,GAA6B,EAAE,CAAC;IAC1E,KAAK,GAAG,sCAAY,CAAC,KAAK,EAAE,CAAQ;IACpC,KAAK,CAAC,CAAC,MACL,GAAG,GAAG,CAAE,gBACR,UAAU,SACV,IAAI,QACJ,GAAG,MACA,UAAU,CACf,CAAC,GAAG,6CAAgB,CAAC,KAAK;IAE1B,KAAK,CAAC,CAAC,aAAA,UAAU,EAAA,CAAC,GAAG,uCAAa,CAAC,UAAU;IAC7C,KAAK,CAAC,MAAM,GAAG,mCAAS,CAAC,GAAG;IAE5B,KAAK,CAAC,QAAQ,GAAG,oCAAc,CAAC,UAAU;IAE1C,EAA2E,AAA3E,yEAA2E;IAC3E,EAA2D,AAA3D,yDAA2D;IAC3D,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC,IAAI,KAAK,CAAQ,YAAK,6BAAO,CAAC,IAAI,CAAC,IAAI,MAAM,KAAK,CAAC,IAAI,KAC5E,wCAAc,CAAC,kCAAY,CAAE,CAAkC,AAAlC,EAAkC,AAAlC,gCAAkC;OAC/D,wCAAc,CAAC,IAAI,IAAI,kCAAY;IAEvC,MAAM,oEACH,CAAG;WACE,UAAU;WACV,QAAQ;QACZ,GAAG,EAAE,GAAG;QACR,SAAS,EAAE,oCAAU,CACnB,gEAAM,EACN,CAAiB,kBACjB,CAAC;YACC,CAAa,cAAE,UAAU;QAC3B,CAAC,EACD,UAAU,CAAC,SAAS;QACtB,GAAG,EAAE,MAAM;QACX,GAAG,EAAE,GAAG;QACR,KAAK,EAAE,CAAC;eACH,UAAU,CAAC,KAAK;eACf,SAAS,IAAI,CAAC;gBAAA,MAAM,EAAE,SAAS;gBAAE,KAAK,EAAE,SAAS;YAAA,CAAC;QACxD,CAAC;;AAEP,CAAC;AAED,EAEG,AAFH;;CAEG,AAFH,EAEG,CACH,KAAK,CAAC,yCAAO,iBAAG,uBAAU,CAAC,4BAAM","sources":["packages/@react-spectrum/avatar/src/index.ts","packages/@react-spectrum/avatar/src/Avatar.tsx","packages/@adobe/spectrum-css-temp/components/avatar/vars.css"],"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 './Avatar';\nexport type {SpectrumAvatarProps} from '@react-types/avatar';\n","/*\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\nfunction Avatar(props: SpectrumAvatarProps, ref: DOMRef<HTMLImageElement>) {\n props = useSlotProps(props, 'avatar');\n const {\n alt = '',\n isDisabled,\n 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\n/**\n * An avatar is a thumbnail representation of an entity, such as a user or an organization.\n */\nconst _Avatar = forwardRef(Avatar);\nexport {_Avatar as Avatar};\n","/*\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":"main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC,GACD,0CAA0C;ACX1C;;;;;;;;;;CAUC,GAED;;;;;;;ACZA,IAAA;AACA,IAAA;AADA,4CAAoC;AACpC,4CAAgC;;;;ADmBhC,MAAM,qCAAe;AACrB,MAAM,gCAAU;AAEhB,SAAS,6BAAO,KAA0B,EAAE,GAA6B,EAAE;IACzE,QAAQ,CAAA,GAAA,sCAAY,AAAD,EAAE,OAAO;IAC5B,MAAM,OACJ,MAAM,iBACN,WAAU,QACV,OAAO,0CACP,IAAG,EACH,GAAG,YACJ,GAAG,CAAA,GAAA,6CAAe,EAAE;IAErB,MAAM,cAAC,WAAU,EAAC,GAAG,CAAA,GAAA,uCAAa,AAAD,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,wCAAc,AAAD,EAAE,oCAAc,kCAAkC;OAC/D,CAAA,GAAA,wCAAa,EAAE,QAAQ,mCAAa;IAExC,qBACE,0DAAC;QACE,GAAG,UAAU;QACb,GAAG,QAAQ;QACZ,KAAK;QACL,WAAW,CAAA,GAAA,oCAAS,EAClB,CAAA,GAAA,yDAAM,OAAD,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;AAEA;;CAEC,GACD,MAAM,0DAAU,CAAA,GAAA,uBAAS,EAAE;;ADxD3B","sources":["packages/@react-spectrum/avatar/src/index.ts","packages/@react-spectrum/avatar/src/Avatar.tsx","packages/@adobe/spectrum-css-temp/components/avatar/vars.css"],"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 './Avatar';\nexport type {SpectrumAvatarProps} from '@react-types/avatar';\n","/*\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\nfunction 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\n/**\n * An avatar is a thumbnail representation of an entity, such as a user or an organization.\n */\nconst _Avatar = forwardRef(Avatar);\nexport {_Avatar as Avatar};\n","/*\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":"main.js.map"}
package/dist/module.js CHANGED
@@ -10,7 +10,28 @@ function $parcel$interopDefault(a) {
10
10
  function $parcel$export(e, n, v, s) {
11
11
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
12
12
  }
13
-
13
+ /*
14
+ * Copyright 2021 Adobe. All rights reserved.
15
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
16
+ * you may not use this file except in compliance with the License. You may obtain a copy
17
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
18
+ *
19
+ * Unless required by applicable law or agreed to in writing, software distributed under
20
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
21
+ * OF ANY KIND, either express or implied. See the License for the specific language
22
+ * governing permissions and limitations under the License.
23
+ */ /// <reference types="css-module-types" />
24
+ /*
25
+ * Copyright 2021 Adobe. All rights reserved.
26
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
27
+ * you may not use this file except in compliance with the License. You may obtain a copy
28
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
29
+ *
30
+ * Unless required by applicable law or agreed to in writing, software distributed under
31
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
32
+ * OF ANY KIND, either express or implied. See the License for the specific language
33
+ * governing permissions and limitations under the License.
34
+ */
14
35
 
15
36
 
16
37
  var $f81b9c4eea42ecfe$exports = {};
@@ -24,24 +45,24 @@ $f81b9c4eea42ecfe$export$d35bc1e505d1ebbf = "is-disabled_2ebb13";
24
45
 
25
46
 
26
47
 
27
- const $ab0b7b2186c39312$var$DEFAULT_SIZE = 'avatar-size-100';
48
+ const $ab0b7b2186c39312$var$DEFAULT_SIZE = "avatar-size-100";
28
49
  const $ab0b7b2186c39312$var$SIZE_RE = /^size-\d+/;
29
50
  function $ab0b7b2186c39312$var$Avatar(props, ref) {
30
- props = $85w8l$useSlotProps(props, 'avatar');
31
- const { alt: alt = '' , isDisabled: isDisabled , size: size , src: src , ...otherProps } = $85w8l$useProviderProps(props);
32
- const { styleProps: styleProps } = $85w8l$useStyleProps(otherProps);
33
- const domRef = $85w8l$useDOMRef(ref);
34
- const domProps = $85w8l$filterDOMProps(otherProps);
51
+ props = (0, $85w8l$useSlotProps)(props, "avatar");
52
+ const { alt: alt = "" , isDisabled: isDisabled , size: size = $ab0b7b2186c39312$var$DEFAULT_SIZE , src: src , ...otherProps } = (0, $85w8l$useProviderProps)(props);
53
+ const { styleProps: styleProps } = (0, $85w8l$useStyleProps)(otherProps);
54
+ const domRef = (0, $85w8l$useDOMRef)(ref);
55
+ const domProps = (0, $85w8l$filterDOMProps)(otherProps);
35
56
  // Casting `size` as `any` since `isNaN` expects a `number`, but we want it
36
57
  // 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)) ? $85w8l$dimensionValue($ab0b7b2186c39312$var$DEFAULT_SIZE) // override disallowed size values
38
- : $85w8l$dimensionValue(size || $ab0b7b2186c39312$var$DEFAULT_SIZE);
39
- return(/*#__PURE__*/ $85w8l$react.createElement("img", {
58
+ const sizeValue = typeof size !== "number" && ($ab0b7b2186c39312$var$SIZE_RE.test(size) || !isNaN(size)) ? (0, $85w8l$dimensionValue)($ab0b7b2186c39312$var$DEFAULT_SIZE) // override disallowed size values
59
+ : (0, $85w8l$dimensionValue)(size || $ab0b7b2186c39312$var$DEFAULT_SIZE);
60
+ return /*#__PURE__*/ (0, $85w8l$react).createElement("img", {
40
61
  ...styleProps,
41
62
  ...domProps,
42
63
  alt: alt,
43
- className: $85w8l$classNames((/*@__PURE__*/$parcel$interopDefault($f81b9c4eea42ecfe$exports)), 'spectrum-Avatar', {
44
- 'is-disabled': isDisabled
64
+ className: (0, $85w8l$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($f81b9c4eea42ecfe$exports))), "spectrum-Avatar", {
65
+ "is-disabled": isDisabled
45
66
  }, styleProps.className),
46
67
  ref: domRef,
47
68
  src: src,
@@ -52,11 +73,11 @@ function $ab0b7b2186c39312$var$Avatar(props, ref) {
52
73
  width: sizeValue
53
74
  }
54
75
  }
55
- }));
76
+ });
56
77
  }
57
78
  /**
58
79
  * An avatar is a thumbnail representation of an entity, such as a user or an organization.
59
- */ const $ab0b7b2186c39312$export$e2255cf6045e8d47 = /*#__PURE__*/ $85w8l$forwardRef($ab0b7b2186c39312$var$Avatar);
80
+ */ const $ab0b7b2186c39312$export$e2255cf6045e8d47 = /*#__PURE__*/ (0, $85w8l$forwardRef)($ab0b7b2186c39312$var$Avatar);
60
81
 
61
82
 
62
83
 
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;AEAA,GAAiC;AACjC,GAA6B;AAD7B,yCAAiC,GAAG,CAAwB;AAC5D,yCAA6B,GAAG,CAAoB;;;;ADmBpD,KAAK,CAAC,kCAAY,GAAG,CAAiB;AACtC,KAAK,CAAC,6BAAO;SAEJ,4BAAM,CAAC,KAA0B,EAAE,GAA6B,EAAE,CAAC;IAC1E,KAAK,GAAG,mBAAY,CAAC,KAAK,EAAE,CAAQ;IACpC,KAAK,CAAC,CAAC,MACL,GAAG,GAAG,CAAE,gBACR,UAAU,SACV,IAAI,QACJ,GAAG,MACA,UAAU,CACf,CAAC,GAAG,uBAAgB,CAAC,KAAK;IAE1B,KAAK,CAAC,CAAC,aAAA,UAAU,EAAA,CAAC,GAAG,oBAAa,CAAC,UAAU;IAC7C,KAAK,CAAC,MAAM,GAAG,gBAAS,CAAC,GAAG;IAE5B,KAAK,CAAC,QAAQ,GAAG,qBAAc,CAAC,UAAU;IAE1C,EAA2E,AAA3E,yEAA2E;IAC3E,EAA2D,AAA3D,yDAA2D;IAC3D,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC,IAAI,KAAK,CAAQ,YAAK,6BAAO,CAAC,IAAI,CAAC,IAAI,MAAM,KAAK,CAAC,IAAI,KAC5E,qBAAc,CAAC,kCAAY,CAAE,CAAkC,AAAlC,EAAkC,AAAlC,gCAAkC;OAC/D,qBAAc,CAAC,IAAI,IAAI,kCAAY;IAEvC,MAAM,0CACH,CAAG;WACE,UAAU;WACV,QAAQ;QACZ,GAAG,EAAE,GAAG;QACR,SAAS,EAAE,iBAAU,CACnB,gEAAM,EACN,CAAiB,kBACjB,CAAC;YACC,CAAa,cAAE,UAAU;QAC3B,CAAC,EACD,UAAU,CAAC,SAAS;QACtB,GAAG,EAAE,MAAM;QACX,GAAG,EAAE,GAAG;QACR,KAAK,EAAE,CAAC;eACH,UAAU,CAAC,KAAK;eACf,SAAS,IAAI,CAAC;gBAAA,MAAM,EAAE,SAAS;gBAAE,KAAK,EAAE,SAAS;YAAA,CAAC;QACxD,CAAC;;AAEP,CAAC;AAED,EAEG,AAFH;;CAEG,AAFH,EAEG,CACH,KAAK,CAAC,yCAAO,iBAAG,iBAAU,CAAC,4BAAM","sources":["packages/@react-spectrum/avatar/src/index.ts","packages/@react-spectrum/avatar/src/Avatar.tsx","packages/@adobe/spectrum-css-temp/components/avatar/vars.css"],"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 './Avatar';\nexport type {SpectrumAvatarProps} from '@react-types/avatar';\n","/*\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\nfunction Avatar(props: SpectrumAvatarProps, ref: DOMRef<HTMLImageElement>) {\n props = useSlotProps(props, 'avatar');\n const {\n alt = '',\n isDisabled,\n 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\n/**\n * An avatar is a thumbnail representation of an entity, such as a user or an organization.\n */\nconst _Avatar = forwardRef(Avatar);\nexport {_Avatar as Avatar};\n","/*\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":"module.js.map"}
1
+ {"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC,GACD,0CAA0C;ACX1C;;;;;;;;;;CAUC,GAED;;;;;;;ACZA,IAAA;AACA,IAAA;AADA,4CAAoC;AACpC,4CAAgC;;;;ADmBhC,MAAM,qCAAe;AACrB,MAAM,gCAAU;AAEhB,SAAS,6BAAO,KAA0B,EAAE,GAA6B,EAAE;IACzE,QAAQ,CAAA,GAAA,mBAAY,AAAD,EAAE,OAAO;IAC5B,MAAM,OACJ,MAAM,iBACN,WAAU,QACV,OAAO,0CACP,IAAG,EACH,GAAG,YACJ,GAAG,CAAA,GAAA,uBAAe,EAAE;IAErB,MAAM,cAAC,WAAU,EAAC,GAAG,CAAA,GAAA,oBAAa,AAAD,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,qBAAc,AAAD,EAAE,oCAAc,kCAAkC;OAC/D,CAAA,GAAA,qBAAa,EAAE,QAAQ,mCAAa;IAExC,qBACE,gCAAC;QACE,GAAG,UAAU;QACb,GAAG,QAAQ;QACZ,KAAK;QACL,WAAW,CAAA,GAAA,iBAAS,EAClB,CAAA,GAAA,yDAAM,OAAD,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;AAEA;;CAEC,GACD,MAAM,0DAAU,CAAA,GAAA,iBAAS,EAAE;;ADxD3B","sources":["packages/@react-spectrum/avatar/src/index.ts","packages/@react-spectrum/avatar/src/Avatar.tsx","packages/@adobe/spectrum-css-temp/components/avatar/vars.css"],"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 './Avatar';\nexport type {SpectrumAvatarProps} from '@react-types/avatar';\n","/*\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\nfunction 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\n/**\n * An avatar is a thumbnail representation of an entity, such as a user or an organization.\n */\nconst _Avatar = forwardRef(Avatar);\nexport {_Avatar as Avatar};\n","/*\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":"module.js.map"}
package/package.json CHANGED
@@ -1,10 +1,15 @@
1
1
  {
2
2
  "name": "@react-spectrum/avatar",
3
- "version": "3.0.0-alpha.8",
3
+ "version": "3.0.0-beta.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
+ "exports": {
9
+ "types": "./dist/types.d.ts",
10
+ "import": "./dist/import.mjs",
11
+ "require": "./dist/main.js"
12
+ },
8
13
  "types": "dist/types.d.ts",
9
14
  "source": "src/index.ts",
10
15
  "files": [
@@ -31,11 +36,11 @@
31
36
  "url": "https://github.com/adobe/react-spectrum"
32
37
  },
33
38
  "dependencies": {
34
- "@babel/runtime": "^7.6.2",
35
- "@react-aria/utils": "^3.13.2",
36
- "@react-spectrum/utils": "^3.7.2",
37
- "@react-types/avatar": "3.0.0-alpha.7",
38
- "@react-types/shared": "^3.14.0"
39
+ "@react-aria/utils": "^3.15.0",
40
+ "@react-spectrum/utils": "^3.9.0",
41
+ "@react-types/avatar": "3.0.0-beta.0",
42
+ "@react-types/shared": "^3.17.0",
43
+ "@swc/helpers": "^0.4.14"
39
44
  },
40
45
  "devDependencies": {
41
46
  "@adobe/spectrum-css-temp": "3.0.0-alpha.1"
@@ -47,5 +52,5 @@
47
52
  "publishConfig": {
48
53
  "access": "public"
49
54
  },
50
- "gitHead": "cd7c0ec917122c7612f653c22f8ed558f8b66ecd"
55
+ "gitHead": "a0efee84aa178cb1a202951dfd6d8de02b292307"
51
56
  }
package/src/Avatar.tsx CHANGED
@@ -26,7 +26,7 @@ function Avatar(props: SpectrumAvatarProps, ref: DOMRef<HTMLImageElement>) {
26
26
  const {
27
27
  alt = '',
28
28
  isDisabled,
29
- size,
29
+ size = DEFAULT_SIZE,
30
30
  src,
31
31
  ...otherProps
32
32
  } = useProviderProps(props);