@atlaskit/avatar 21.3.2 → 21.3.4

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.
@@ -3,19 +3,19 @@
3
3
 
4
4
  import { css, jsx } from '@emotion/react';
5
5
  import { N200, N900 } from '@atlaskit/theme/colors';
6
- const getStyles = (isSecondary, shouldTruncate) => css({
6
+ const baseStyles = css({
7
7
  display: 'block',
8
8
  margin: "var(--ds-space-0, 0px)",
9
- color: `var(--ds-text, ${N900})`,
10
- ...(shouldTruncate && {
11
- overflowX: 'hidden',
12
- textOverflow: 'ellipsis',
13
- whiteSpace: 'nowrap'
14
- }),
15
- ...(isSecondary && {
16
- color: `var(--ds-text-subtlest, ${N200})`,
17
- fontSize: '0.85em'
18
- })
9
+ color: `var(--ds-text, ${N900})`
10
+ });
11
+ const truncateStyles = css({
12
+ overflowX: 'hidden',
13
+ textOverflow: 'ellipsis',
14
+ whiteSpace: 'nowrap'
15
+ });
16
+ const secondaryStyles = css({
17
+ color: `var(--ds-text-subtlest, ${N200})`,
18
+ fontSize: '0.85em'
19
19
  });
20
20
 
21
21
  /**
@@ -27,10 +27,7 @@ const Text = ({
27
27
  isSecondary,
28
28
  children,
29
29
  shouldTruncate
30
- }) =>
31
- // TODO: Refactor styles to follow css prop rules
32
- // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
33
- jsx("span", {
34
- css: getStyles(isSecondary, shouldTruncate)
30
+ }) => jsx("span", {
31
+ css: [baseStyles, isSecondary && secondaryStyles, shouldTruncate && truncateStyles]
35
32
  }, children);
36
33
  export default Text;
@@ -20,6 +20,7 @@ export const AVATAR_RADIUS = {
20
20
  };
21
21
  export const BORDER_WIDTH = 2;
22
22
  export const ACTIVE_SCALE_FACTOR = 0.9;
23
+ export const CSS_VAR_AVATAR_BGCOLOR = '--avatar-background-color';
23
24
  export const ICON_SIZES = {
24
25
  small: 12,
25
26
  medium: 14,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/avatar",
3
- "version": "21.3.2",
3
+ "version": "21.3.4",
4
4
  "sideEffects": false
5
5
  }
@@ -15,7 +15,7 @@ import { PresenceWrapper } from './Presence';
15
15
  import { StatusWrapper } from './Status';
16
16
  import { getButtonProps, getCustomElement, getLinkProps } from './utilities';
17
17
  var packageName = "@atlaskit/avatar";
18
- var packageVersion = "21.3.2";
18
+ var packageVersion = "21.3.4";
19
19
 
20
20
  // eslint-disable-next-line @repo/internal/react/consistent-types-definitions
21
21
 
@@ -1,13 +1,16 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
1
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2
5
  /** @jsx jsx */
3
6
  // eslint-disable-next-line @repo/internal/fs/filename-pattern-match
4
7
  import { useEffect, useState } from 'react';
5
8
  import { css, jsx } from '@emotion/react';
6
9
  import PersonIcon from '@atlaskit/icon/glyph/person';
7
10
  import ShipIcon from '@atlaskit/icon/glyph/ship';
8
- import { background, N90 } from '@atlaskit/theme/colors';
11
+ import { N0, N90 } from '@atlaskit/theme/colors';
9
12
  import { AVATAR_RADIUS, AVATAR_SIZES } from './constants';
10
- export var ICON_BACKGROUND = "var(--ds-icon-inverse, ".concat(background(), ")");
13
+ export var ICON_BACKGROUND = "var(--ds-icon-inverse, ".concat(N0, ")");
11
14
  export var ICON_COLOR = "var(--ds-icon-subtle, ".concat(N90, ")");
12
15
  var avatarDefaultIconStyles = css({
13
16
  display: 'block',
@@ -15,24 +18,37 @@ var avatarDefaultIconStyles = css({
15
18
  height: '100%',
16
19
  backgroundColor: ICON_COLOR
17
20
  });
21
+ var nestedAvatarStyles = Object.entries(AVATAR_SIZES).reduce(function (styles, _ref) {
22
+ var _ref2 = _slicedToArray(_ref, 2),
23
+ key = _ref2[0],
24
+ size = _ref2[1];
25
+ return _objectSpread(_objectSpread({}, styles), {}, _defineProperty({}, key, css({
26
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
27
+ '& svg': {
28
+ width: "".concat(size, "px"),
29
+ height: "".concat(size, "px")
30
+ }
31
+ })));
32
+ }, {});
18
33
  var avatarImageStyles = css({
19
34
  display: 'flex',
20
35
  width: '100%',
21
36
  height: '100%',
22
37
  flex: '1 1 100%'
23
38
  });
39
+
24
40
  /**
25
41
  * __Avatar image__
26
42
  *
27
43
  * An avatar image is an internal component used to control the rendering phases of an image.
28
44
  */
29
- var AvatarImage = function AvatarImage(_ref) {
30
- var _ref$alt = _ref.alt,
31
- alt = _ref$alt === void 0 ? '' : _ref$alt,
32
- src = _ref.src,
33
- appearance = _ref.appearance,
34
- size = _ref.size,
35
- testId = _ref.testId;
45
+ var AvatarImage = function AvatarImage(_ref3) {
46
+ var _ref3$alt = _ref3.alt,
47
+ alt = _ref3$alt === void 0 ? '' : _ref3$alt,
48
+ src = _ref3.src,
49
+ appearance = _ref3.appearance,
50
+ size = _ref3.size,
51
+ testId = _ref3.testId;
36
52
  var _useState = useState(false),
37
53
  _useState2 = _slicedToArray(_useState, 2),
38
54
  hasImageErrored = _useState2[0],
@@ -45,15 +61,7 @@ var AvatarImage = function AvatarImage(_ref) {
45
61
  }, [src]);
46
62
  if (!src || hasImageErrored) {
47
63
  return jsx("span", {
48
- css: [avatarDefaultIconStyles,
49
- // TODO: These dynamic SVG styles can't be set in 'style'. On a refactor, use a css custom property to pass down the size
50
- // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
51
- {
52
- '& svg': {
53
- width: "".concat(AVATAR_SIZES[size], "px"),
54
- height: "".concat(AVATAR_SIZES[size], "px")
55
- }
56
- }]
64
+ css: [avatarDefaultIconStyles, nestedAvatarStyles[size]]
57
65
  }, appearance === 'circle' ? jsx(PersonIcon, {
58
66
  label: alt,
59
67
  primaryColor: ICON_BACKGROUND,
@@ -7,7 +7,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
7
7
  // eslint-disable-next-line @repo/internal/fs/filename-pattern-match
8
8
  import { createElement, forwardRef, Fragment } from 'react';
9
9
  import { ClassNames, css, jsx } from '@emotion/react';
10
- import { B200, backgroundActive, backgroundHover } from '@atlaskit/theme/colors';
10
+ import { B200, B50, N30 } from '@atlaskit/theme/colors';
11
11
  import { borderRadius } from '@atlaskit/theme/constants';
12
12
  import { BORDER_WIDTH } from './constants';
13
13
  import Text from './Text';
@@ -25,7 +25,7 @@ var getStyles = function getStyles(css, _ref) {
25
25
  isInteractive = _ref.isInteractive,
26
26
  isDisabled = _ref.isDisabled;
27
27
  return (// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing, @repo/internal/react/no-css-string-literals
28
- css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n align-items: center;\n background-color: ", ";\n border-radius: ", "px;\n border: ", "px solid transparent;\n box-sizing: border-box;\n color: inherit;\n display: flex;\n font-size: inherit;\n font-style: normal;\n font-weight: normal;\n line-height: 1;\n outline: none;\n margin: ", ";\n padding: ", ";\n text-align: left;\n text-decoration: none;\n width: 100%;\n\n ", "\n\n ", "\n "])), backgroundColor, borderRadius(), BORDER_WIDTH, "var(--ds-space-0, 0px)", "var(--ds-space-050, 4px)", isInteractive && "\n :hover {\n background-color: ".concat("var(--ds-background-neutral-subtle-hovered, ".concat(backgroundHover(), ")"), ";\n cursor: pointer;\n text-decoration: none;\n }\n\n :focus {\n outline: none;\n border-color: ", "var(--ds-border-focused, ".concat(B200, ")"), ";\n }\n\n :active {\n background-color: ", "var(--ds-background-neutral-subtle-pressed, ".concat(backgroundActive(), ")"), ";\n }\n "), isDisabled && "\n cursor: not-allowed;\n opacity: ".concat("var(--ds-opacity-disabled, 0.5)", ";\n pointer-events: none;\n "))
28
+ css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n align-items: center;\n background-color: ", ";\n border-radius: ", "px;\n border: ", "px solid transparent;\n box-sizing: border-box;\n color: inherit;\n display: flex;\n font-size: inherit;\n font-style: normal;\n font-weight: normal;\n line-height: 1;\n outline: none;\n margin: ", ";\n padding: ", ";\n text-align: left;\n text-decoration: none;\n width: 100%;\n\n ", "\n\n ", "\n "])), backgroundColor, borderRadius(), BORDER_WIDTH, "var(--ds-space-0, 0px)", "var(--ds-space-050, 4px)", isInteractive && "\n :hover {\n background-color: ".concat("var(--ds-background-neutral-subtle-hovered, ".concat(N30, ")"), ";\n cursor: pointer;\n text-decoration: none;\n }\n\n :focus {\n outline: none;\n border-color: ", "var(--ds-border-focused, ".concat(B200, ")"), ";\n }\n\n :active {\n background-color: ", "var(--ds-background-neutral-subtle-pressed, ".concat(B50, ")"), ";\n }\n "), isDisabled && "\n cursor: not-allowed;\n opacity: ".concat("var(--ds-opacity-disabled, 0.5)", ";\n pointer-events: none;\n "))
29
29
  );
30
30
  };
31
31
 
@@ -2,7 +2,7 @@
2
2
  // eslint-disable-next-line @repo/internal/fs/filename-pattern-match
3
3
 
4
4
  import { css, jsx } from '@emotion/react';
5
- import { background } from '@atlaskit/theme/colors';
5
+ import { N0 } from '@atlaskit/theme/colors';
6
6
  import { BORDER_WIDTH } from './constants';
7
7
  var iconWrapperStyles = css({
8
8
  display: 'flex',
@@ -22,7 +22,7 @@ var iconWrapperStyles = css({
22
22
  */
23
23
  var IconWrapper = function IconWrapper(_ref) {
24
24
  var _ref$bgColor = _ref.bgColor,
25
- bgColor = _ref$bgColor === void 0 ? "var(--ds-surface-overlay, ".concat(background(), ")") : _ref$bgColor,
25
+ bgColor = _ref$bgColor === void 0 ? "var(--ds-surface-overlay, ".concat(N0, ")") : _ref$bgColor,
26
26
  children = _ref.children,
27
27
  label = _ref.label;
28
28
  return jsx("span", {
@@ -1,6 +1,6 @@
1
1
  // eslint-disable-next-line @repo/internal/fs/filename-pattern-match
2
2
  import React, { Fragment } from 'react';
3
- import { background, G300, N200, N40, purple, R300 } from '@atlaskit/theme/colors';
3
+ import { G300, N0, N200, N40, P300, R300 } from '@atlaskit/theme/colors';
4
4
  import { ICON_OFFSET, ICON_SIZES } from './constants';
5
5
  import IconWrapper from './IconWrapper';
6
6
 
@@ -12,11 +12,11 @@ var BusyIndicator = /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__
12
12
  cy: "4",
13
13
  r: "4"
14
14
  }), /*#__PURE__*/React.createElement("path", {
15
- fill: "var(--ds-surface-overlay, ".concat(background(), ")"),
15
+ fill: "var(--ds-surface-overlay, ".concat(N0, ")"),
16
16
  d: "M3.3,1.9l2.8,2.8c0.2,0.2,0.2,0.5,0,0.7L5.4,6.1c-0.2,0.2-0.5,0.2-0.7,0L1.9,3.3c-0.2-0.2-0.2-0.5,0-0.7l0.7-0.7C2.8,1.7,3.1,1.7,3.3,1.9z"
17
17
  }));
18
18
  var FocusIndicator = /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("path", {
19
- fill: "var(--ds-icon-discovery, ".concat(purple(), ")"),
19
+ fill: "var(--ds-icon-discovery, ".concat(P300, ")"),
20
20
  d: "M4,8 C1.790861,8 0,6.209139 0,4 C0,1.790861 1.790861,0 4,0 C6.209139,0 8,1.790861 8,4 C8,6.209139 6.209139,8 4,8 Z M4,6.66666667 C5.47275933,6.66666667 6.66666667,5.47275933 6.66666667,4 C6.66666667,2.52724067 5.47275933,1.33333333 4,1.33333333 C2.52724067,1.33333333 1.33333333,2.52724067 1.33333333,4 C1.33333333,5.47275933 2.52724067,6.66666667 4,6.66666667 Z M4,5.33333333 C3.26362033,5.33333333 2.66666667,4.73637967 2.66666667,4 C2.66666667,3.26362033 3.26362033,2.66666667 4,2.66666667 C4.73637967,2.66666667 5.33333333,3.26362033 5.33333333,4 C5.33333333,4.73637967 4.73637967,5.33333333 4,5.33333333 Z"
21
21
  }));
22
22
  var OfflineIndicator = /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("path", {
@@ -1,27 +1,45 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1
5
  /** @jsx jsx */
2
6
  // eslint-disable-next-line @repo/internal/fs/filename-pattern-match
3
7
 
4
8
  import { css, jsx } from '@emotion/react';
5
- import { AVATAR_RADIUS, AVATAR_SIZES, BORDER_WIDTH } from './constants';
6
- var getStyles = function getStyles(_ref) {
7
- var _ref$size = _ref.size,
8
- size = _ref$size === void 0 ? 'medium' : _ref$size,
9
- _ref$appearance = _ref.appearance,
10
- appearance = _ref$appearance === void 0 ? 'circle' : _ref$appearance,
11
- _ref$color = _ref.color,
12
- color = _ref$color === void 0 ? 'currentColor' : _ref$color,
13
- _ref$weight = _ref.weight,
14
- weight = _ref$weight === void 0 ? 'normal' : _ref$weight;
15
- return css({
16
- display: 'inline-block',
17
- width: "".concat(AVATAR_SIZES[size], "px"),
18
- height: "".concat(AVATAR_SIZES[size], "px"),
19
- backgroundColor: color,
20
- border: "".concat(BORDER_WIDTH, "px solid transparent"),
21
- borderRadius: "".concat(appearance === 'square' ? "".concat(AVATAR_RADIUS[size], "px") : '50%'),
22
- opacity: "".concat(weight === 'strong' ? 0.3 : 0.15)
23
- });
24
- };
9
+ import { AVATAR_RADIUS, AVATAR_SIZES, BORDER_WIDTH, CSS_VAR_AVATAR_BGCOLOR } from './constants';
10
+ var skeletonStyles = css({
11
+ display: 'inline-block',
12
+ backgroundColor: "var(".concat(CSS_VAR_AVATAR_BGCOLOR, ")"),
13
+ border: "".concat(BORDER_WIDTH, "px solid transparent")
14
+ });
15
+ var sizeStyles = Object.entries(AVATAR_SIZES).reduce(function (styles, _ref) {
16
+ var _ref2 = _slicedToArray(_ref, 2),
17
+ key = _ref2[0],
18
+ size = _ref2[1];
19
+ return _objectSpread(_objectSpread({}, styles), {}, _defineProperty({}, key, css({
20
+ width: "".concat(size, "px"),
21
+ height: "".concat(size, "px")
22
+ })));
23
+ }, {});
24
+
25
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
26
+ var radiusStyles = Object.entries(AVATAR_RADIUS).reduce(function (styles, _ref3) {
27
+ var _ref4 = _slicedToArray(_ref3, 2),
28
+ key = _ref4[0],
29
+ size = _ref4[1];
30
+ return _objectSpread(_objectSpread({}, styles), {}, _defineProperty({}, key, css({
31
+ borderRadius: "".concat(size, "px")
32
+ })));
33
+ }, {});
34
+ var defaultRadiusStyles = css({
35
+ borderRadius: '50%'
36
+ });
37
+ var strongOpacityStyles = css({
38
+ opacity: 0.3
39
+ });
40
+ var defaultOpacityStyles = css({
41
+ opacity: 0.15
42
+ });
25
43
 
26
44
  /**
27
45
  * __Skeleton__
@@ -31,20 +49,14 @@ var getStyles = function getStyles(_ref) {
31
49
  * - [Examples](https://atlassian.design/components/avatar/avatar-skeleton/examples)
32
50
  * - [Code](https://atlassian.design/components/avatar/avatar-skeleton/code)
33
51
  */
34
- var Skeleton = function Skeleton(_ref2) {
35
- var size = _ref2.size,
36
- appearance = _ref2.appearance,
37
- color = _ref2.color,
38
- weight = _ref2.weight;
52
+ var Skeleton = function Skeleton(_ref5) {
53
+ var size = _ref5.size,
54
+ appearance = _ref5.appearance,
55
+ color = _ref5.color,
56
+ weight = _ref5.weight;
39
57
  return jsx("div", {
40
- // TODO: Refactor styles to follow css prop rules
41
- // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
42
- css: getStyles({
43
- size: size,
44
- appearance: appearance,
45
- color: color,
46
- weight: weight
47
- })
58
+ css: [skeletonStyles, sizeStyles[size !== null && size !== void 0 ? size : 'medium'], appearance === 'square' ? radiusStyles[size !== null && size !== void 0 ? size : 'medium'] : defaultRadiusStyles, weight === 'strong' ? strongOpacityStyles : defaultOpacityStyles],
59
+ style: _defineProperty({}, CSS_VAR_AVATAR_BGCOLOR, color !== null && color !== void 0 ? color : 'currentColor')
48
60
  });
49
61
  };
50
62
  export default Skeleton;
@@ -1,6 +1,6 @@
1
1
  // eslint-disable-next-line @repo/internal/fs/filename-pattern-match
2
2
  import React, { Fragment } from 'react';
3
- import { background, G400, N40, N500, R400 } from '@atlaskit/theme/colors';
3
+ import { G400, N0, N40, N500, R400 } from '@atlaskit/theme/colors';
4
4
  import { ICON_OFFSET, ICON_SIZES } from './constants';
5
5
  import IconWrapper from './IconWrapper';
6
6
 
@@ -12,7 +12,7 @@ var ApprovedIndicator = /*#__PURE__*/React.createElement(Fragment, null, /*#__PU
12
12
  cy: "4",
13
13
  r: "4"
14
14
  }), /*#__PURE__*/React.createElement("path", {
15
- fill: "var(--ds-surface-overlay, ".concat(background(), ")"),
15
+ fill: "var(--ds-surface-overlay, ".concat(N0, ")"),
16
16
  d: "M2.47140452,3.52859548 C2.21105499,3.26824595 1.78894501,3.26824595 1.52859548,3.52859548 C1.26824595,3.78894501 1.26824595,4.21105499 1.52859548,4.47140452 L2.86192881,5.80473785 C3.12227834,6.06508738 3.54438833,6.06508738 3.80473785,5.80473785 L6.47140452,3.13807119 C6.73175405,2.87772166 6.73175405,2.45561167 6.47140452,2.19526215 C6.21105499,1.93491262 5.78894501,1.93491262 5.52859548,2.19526215 L3.33333333,4.39052429 L2.47140452,3.52859548 Z"
17
17
  }));
18
18
  var DeclinedIndicator = /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("circle", {
@@ -21,7 +21,7 @@ var DeclinedIndicator = /*#__PURE__*/React.createElement(Fragment, null, /*#__PU
21
21
  cy: "4",
22
22
  r: "4"
23
23
  }), /*#__PURE__*/React.createElement("path", {
24
- fill: "var(--ds-surface-overlay, ".concat(background(), ")"),
24
+ fill: "var(--ds-surface-overlay, ".concat(N0, ")"),
25
25
  d: "M4.890661,4.0088336 L5.81806461,3.07802178 C6.06167933,2.83351177 6.06048933,2.43826992 5.81540668,2.19522442 C5.57032402,1.95217891 5.17415651,1.95336612 4.93054179,2.19787613 L4.00765946,3.12415007 L3.06906871,2.18377143 C2.82523777,1.93947602 2.42906937,1.93863765 2.18420182,2.18189887 C1.93933427,2.42516008 1.93849394,2.82040282 2.18232488,3.06469822 L3.12544091,4.00961077 L2.20275024,4.93569234 C1.95913552,5.18020236 1.96032551,5.5754442 2.20540817,5.81848971 C2.45049083,6.06153521 2.84665833,6.060348 3.09027306,5.81583799 L4.00844245,4.89429431 L4.9092123,5.79678001 C5.15304324,6.04107541 5.54921164,6.04191379 5.79407919,5.79865257 C6.03894674,5.55539135 6.03978708,5.16014862 5.79595614,4.91585321 L4.890661,4.0088336 Z"
26
26
  }));
27
27
  var LockedIndicator = /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("circle", {
package/dist/esm/Text.js CHANGED
@@ -1,25 +1,22 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
1
  /** @jsx jsx */
5
2
  // eslint-disable-next-line @repo/internal/fs/filename-pattern-match
6
3
 
7
4
  import { css, jsx } from '@emotion/react';
8
5
  import { N200, N900 } from '@atlaskit/theme/colors';
9
- var getStyles = function getStyles(isSecondary, shouldTruncate) {
10
- return css(_objectSpread(_objectSpread({
11
- display: 'block',
12
- margin: "var(--ds-space-0, 0px)",
13
- color: "var(--ds-text, ".concat(N900, ")")
14
- }, shouldTruncate && {
15
- overflowX: 'hidden',
16
- textOverflow: 'ellipsis',
17
- whiteSpace: 'nowrap'
18
- }), isSecondary && {
19
- color: "var(--ds-text-subtlest, ".concat(N200, ")"),
20
- fontSize: '0.85em'
21
- }));
22
- };
6
+ var baseStyles = css({
7
+ display: 'block',
8
+ margin: "var(--ds-space-0, 0px)",
9
+ color: "var(--ds-text, ".concat(N900, ")")
10
+ });
11
+ var truncateStyles = css({
12
+ overflowX: 'hidden',
13
+ textOverflow: 'ellipsis',
14
+ whiteSpace: 'nowrap'
15
+ });
16
+ var secondaryStyles = css({
17
+ color: "var(--ds-text-subtlest, ".concat(N200, ")"),
18
+ fontSize: '0.85em'
19
+ });
23
20
 
24
21
  /**
25
22
  * __Text__
@@ -30,12 +27,8 @@ var Text = function Text(_ref) {
30
27
  var isSecondary = _ref.isSecondary,
31
28
  children = _ref.children,
32
29
  shouldTruncate = _ref.shouldTruncate;
33
- return (
34
- // TODO: Refactor styles to follow css prop rules
35
- // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
36
- jsx("span", {
37
- css: getStyles(isSecondary, shouldTruncate)
38
- }, children)
39
- );
30
+ return jsx("span", {
31
+ css: [baseStyles, isSecondary && secondaryStyles, shouldTruncate && truncateStyles]
32
+ }, children);
40
33
  };
41
34
  export default Text;
@@ -20,6 +20,7 @@ export var AVATAR_RADIUS = {
20
20
  };
21
21
  export var BORDER_WIDTH = 2;
22
22
  export var ACTIVE_SCALE_FACTOR = 0.9;
23
+ export var CSS_VAR_AVATAR_BGCOLOR = '--avatar-background-color';
23
24
  export var ICON_SIZES = {
24
25
  small: 12,
25
26
  medium: 14,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/avatar",
3
- "version": "21.3.2",
3
+ "version": "21.3.4",
4
4
  "sideEffects": false
5
5
  }
@@ -3,5 +3,6 @@ export declare const AVATAR_SIZES: AvatarSizeMap;
3
3
  export declare const AVATAR_RADIUS: AvatarSizeMap;
4
4
  export declare const BORDER_WIDTH = 2;
5
5
  export declare const ACTIVE_SCALE_FACTOR = 0.9;
6
+ export declare const CSS_VAR_AVATAR_BGCOLOR = "--avatar-background-color";
6
7
  export declare const ICON_SIZES: Record<IndicatorSizeType, number>;
7
8
  export declare const ICON_OFFSET: Record<IndicatorSizeType, number>;
@@ -3,5 +3,6 @@ export declare const AVATAR_SIZES: AvatarSizeMap;
3
3
  export declare const AVATAR_RADIUS: AvatarSizeMap;
4
4
  export declare const BORDER_WIDTH = 2;
5
5
  export declare const ACTIVE_SCALE_FACTOR = 0.9;
6
+ export declare const CSS_VAR_AVATAR_BGCOLOR = "--avatar-background-color";
6
7
  export declare const ICON_SIZES: Record<IndicatorSizeType, number>;
7
8
  export declare const ICON_OFFSET: Record<IndicatorSizeType, number>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/avatar",
3
- "version": "21.3.2",
3
+ "version": "21.3.4",
4
4
  "description": "An avatar is a visual representation of a user or entity.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -24,7 +24,7 @@
24
24
  "atlaskit:src": "src/index.ts",
25
25
  "atlassian": {
26
26
  "team": "Design System Team",
27
- "releaseModel": "scheduled",
27
+ "releaseModel": "continuous",
28
28
  "website": {
29
29
  "name": "Avatar",
30
30
  "category": "Components"
@@ -43,7 +43,7 @@
43
43
  "@atlaskit/analytics-next": "^9.1.0",
44
44
  "@atlaskit/icon": "^21.12.0",
45
45
  "@atlaskit/theme": "^12.5.0",
46
- "@atlaskit/tokens": "^1.4.0",
46
+ "@atlaskit/tokens": "^1.5.0",
47
47
  "@babel/runtime": "^7.0.0",
48
48
  "@emotion/react": "^11.7.1",
49
49
  "@emotion/serialize": "^1.1.0"
@@ -55,19 +55,17 @@
55
55
  "@atlaskit/button": "^16.7.0",
56
56
  "@atlaskit/docs": "*",
57
57
  "@atlaskit/ds-lib": "^2.2.0",
58
- "@atlaskit/field-base": "^15.2.0",
59
58
  "@atlaskit/icon": "^21.12.0",
60
59
  "@atlaskit/section-message": "^6.4.0",
61
60
  "@atlaskit/ssr": "*",
62
- "@atlaskit/toggle": "^12.6.0",
63
61
  "@atlaskit/tooltip": "^17.8.0",
64
62
  "@atlaskit/visual-regression": "*",
65
- "@atlaskit/webdriver-runner": "*",
66
63
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
67
64
  "@emotion/styled": "^11.0.0",
68
65
  "@testing-library/react": "^12.1.5",
69
66
  "@types/jscodeshift": "^0.11.0",
70
67
  "color-contrast-checker": "^1.5.0",
68
+ "jest-axe": "^4.0.0",
71
69
  "jscodeshift": "^0.13.0",
72
70
  "react-dom": "^16.8.0",
73
71
  "typescript": "~4.9.5",
@@ -0,0 +1,170 @@
1
+ ## API Report File for "@atlaskit/avatar"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ /// <reference types="react" />
8
+
9
+ import { FC } from 'react';
10
+ import { ForwardRefExoticComponent } from 'react';
11
+ import { MouseEventHandler } from 'react';
12
+ import { ReactNode } from 'react';
13
+ import { Ref } from 'react';
14
+ import { RefAttributes } from 'react';
15
+ import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
16
+
17
+ // @public (undocumented)
18
+ export const ACTIVE_SCALE_FACTOR = 0.9;
19
+
20
+ // @public (undocumented)
21
+ export type AppearanceType = 'circle' | 'square';
22
+
23
+ // @public
24
+ const Avatar: ForwardRefExoticComponent<AvatarPropTypes & RefAttributes<HTMLElement>>;
25
+ export default Avatar;
26
+
27
+ // @public (undocumented)
28
+ export const AVATAR_RADIUS: AvatarSizeMap;
29
+
30
+ // @public (undocumented)
31
+ export const AVATAR_SIZES: AvatarSizeMap;
32
+
33
+ // @public (undocumented)
34
+ export type AvatarClickEventHandler = (event: React.MouseEvent, analyticsEvent?: UIAnalyticsEvent) => void;
35
+
36
+ // @public
37
+ export const AvatarItem: ForwardRefExoticComponent<AvatarItemProps & RefAttributes<HTMLElement>>;
38
+
39
+ // @public (undocumented)
40
+ export interface AvatarItemProps {
41
+ avatar: ReactNode;
42
+ backgroundColor?: string;
43
+ children?: (props: CustomAvatarItemProps) => ReactNode;
44
+ href?: string;
45
+ isDisabled?: boolean;
46
+ isTruncationDisabled?: boolean;
47
+ label?: string;
48
+ onClick?: AvatarClickEventHandler;
49
+ primaryText?: ReactNode;
50
+ secondaryText?: ReactNode;
51
+ target?: '_blank' | '_parent' | '_self' | '_top';
52
+ testId?: string;
53
+ }
54
+
55
+ // @public (undocumented)
56
+ export interface AvatarPropTypes {
57
+ analyticsContext?: Record<string, any>;
58
+ appearance?: AppearanceType;
59
+ borderColor?: string;
60
+ children?: (props: CustomAvatarProps) => ReactNode;
61
+ href?: string;
62
+ isDisabled?: boolean;
63
+ label?: string;
64
+ name?: string;
65
+ onClick?: AvatarClickEventHandler;
66
+ presence?: ('busy' | 'focus' | 'offline' | 'online') | ReactNode;
67
+ size?: SizeType;
68
+ src?: string;
69
+ stackIndex?: number;
70
+ status?: ('approved' | 'declined' | 'locked') | ReactNode;
71
+ tabIndex?: number;
72
+ target?: '_blank' | '_parent' | '_self' | '_top';
73
+ testId?: string;
74
+ }
75
+
76
+ // @public (undocumented)
77
+ type AvatarSizeMap = Record<SizeType, number>;
78
+
79
+ // @public (undocumented)
80
+ export const BORDER_WIDTH = 2;
81
+
82
+ // @public (undocumented)
83
+ export interface CustomAvatarItemProps {
84
+ // (undocumented)
85
+ 'aria-disabled'?: 'false' | 'true' | boolean | undefined;
86
+ 'aria-label'?: string;
87
+ // (undocumented)
88
+ children: ReactNode;
89
+ // (undocumented)
90
+ className?: string;
91
+ // (undocumented)
92
+ href?: string;
93
+ // (undocumented)
94
+ onClick?: MouseEventHandler;
95
+ // (undocumented)
96
+ ref: Ref<HTMLElement>;
97
+ // (undocumented)
98
+ testId?: string;
99
+ }
100
+
101
+ // @public (undocumented)
102
+ export interface CustomAvatarProps {
103
+ 'aria-label'?: string;
104
+ // (undocumented)
105
+ children: ReactNode;
106
+ // (undocumented)
107
+ className?: string;
108
+ // (undocumented)
109
+ href?: string;
110
+ // (undocumented)
111
+ onClick?: MouseEventHandler;
112
+ // (undocumented)
113
+ ref: Ref<HTMLElement>;
114
+ // (undocumented)
115
+ tabIndex?: number;
116
+ // (undocumented)
117
+ testId?: string;
118
+ }
119
+
120
+ // @public (undocumented)
121
+ export type IndicatorSizeType = 'large' | 'medium' | 'small' | 'xlarge';
122
+
123
+ // @public
124
+ export const Presence: FC<PresenceProps>;
125
+
126
+ // @public (undocumented)
127
+ export interface PresenceProps {
128
+ borderColor?: string;
129
+ children?: ReactNode;
130
+ presence?: PresenceType;
131
+ testId?: string;
132
+ }
133
+
134
+ // @public (undocumented)
135
+ export type PresenceType = 'busy' | 'focus' | 'offline' | 'online' | ReactNode;
136
+
137
+ // @public (undocumented)
138
+ export type SizeType = 'large' | 'medium' | 'small' | 'xlarge' | 'xsmall' | 'xxlarge';
139
+
140
+ // @public
141
+ export const Skeleton: FC<SkeletonProps>;
142
+
143
+ // @public (undocumented)
144
+ export interface SkeletonProps {
145
+ // (undocumented)
146
+ appearance?: AppearanceType;
147
+ // (undocumented)
148
+ color?: string;
149
+ // (undocumented)
150
+ size?: SizeType;
151
+ // (undocumented)
152
+ weight?: 'normal' | 'strong';
153
+ }
154
+
155
+ // @public
156
+ export const Status: FC<StatusProps>;
157
+
158
+ // @public (undocumented)
159
+ export interface StatusProps {
160
+ borderColor?: string;
161
+ children?: ReactNode;
162
+ status?: StatusType;
163
+ }
164
+
165
+ // @public (undocumented)
166
+ export type StatusType = ('approved' | 'declined' | 'locked') | ReactNode;
167
+
168
+ // (No @packageDocumentation comment for this package)
169
+
170
+ ```