@atlaskit/menu 1.2.5 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/cjs/internal/components/menu-item-primitive.js +10 -8
  3. package/dist/cjs/internal/components/skeleton-shimmer.js +80 -0
  4. package/dist/cjs/menu-item/heading-item.js +1 -1
  5. package/dist/cjs/menu-item/skeleton-heading-item.js +19 -9
  6. package/dist/cjs/menu-item/skeleton-item.js +17 -7
  7. package/dist/cjs/menu-section/menu-group.js +5 -2
  8. package/dist/cjs/menu-section/popup-menu-group.js +6 -4
  9. package/dist/cjs/version.json +1 -1
  10. package/dist/es2019/internal/components/menu-item-primitive.js +9 -8
  11. package/dist/es2019/internal/components/skeleton-shimmer.js +69 -0
  12. package/dist/es2019/menu-item/heading-item.js +2 -2
  13. package/dist/es2019/menu-item/skeleton-heading-item.js +8 -1
  14. package/dist/es2019/menu-item/skeleton-item.js +9 -2
  15. package/dist/es2019/menu-section/menu-group.js +4 -1
  16. package/dist/es2019/menu-section/popup-menu-group.js +2 -1
  17. package/dist/es2019/version.json +1 -1
  18. package/dist/esm/internal/components/menu-item-primitive.js +10 -8
  19. package/dist/esm/internal/components/skeleton-shimmer.js +70 -0
  20. package/dist/esm/menu-item/heading-item.js +2 -2
  21. package/dist/esm/menu-item/skeleton-heading-item.js +18 -9
  22. package/dist/esm/menu-item/skeleton-item.js +16 -7
  23. package/dist/esm/menu-section/menu-group.js +5 -2
  24. package/dist/esm/menu-section/popup-menu-group.js +6 -4
  25. package/dist/esm/version.json +1 -1
  26. package/dist/types/internal/components/skeleton-shimmer.d.ts +23 -0
  27. package/dist/types/menu-item/skeleton-heading-item.d.ts +1 -1
  28. package/dist/types/menu-item/skeleton-item.d.ts +1 -1
  29. package/dist/types/menu-section/menu-group.d.ts +1 -1
  30. package/dist/types/types.d.ts +30 -2
  31. package/package.json +6 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @atlaskit/menu
2
2
 
3
+ ## 1.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`59e2178901f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/59e2178901f) - The `isShimmering` prop for skeleton items has been fixed, resolving a regression in version 1.2.0.
8
+ - [`62edf20ab1e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/62edf20ab1e) - Migrates all usage of brand tokens to either selected or information tokens. This change is purely for semantic reasons, there are no visual or behavioural changes.
9
+ - Updated dependencies
10
+
11
+ ## 1.3.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [`77c46ec96a7`](https://bitbucket.org/atlassian/atlassian-frontend/commits/77c46ec96a7) - Adds a prop for `role` to the MenuGroup component that acts as you'd expect the HTML attribute to act. You are now able to override the accessibility role for the element.
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies
20
+
21
+ ## 1.2.6
22
+
23
+ ### Patch Changes
24
+
25
+ - [`58884c2f6c1`](https://bitbucket.org/atlassian/atlassian-frontend/commits/58884c2f6c1) - Internal code change turning on a new linting rule.
26
+ - [`27467f65f68`](https://bitbucket.org/atlassian/atlassian-frontend/commits/27467f65f68) - [ux] Update headingStyle to color that passes WCAG AA color contrast
27
+ - [`2066efabc65`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2066efabc65) - A fix for the `StatelessCSSFn` type so that it now correctly accetps a void argument.
28
+ - [`96cfc6c1c7f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/96cfc6c1c7f) - Deprecates the `cssFn` and `overrides` APIs in '@atlaskit/menu'. These APIs are not performant and allow unbounded customisation of the Menu components. These APIs will be removed in a future release.
29
+ - Updated dependencies
30
+
3
31
  ## 1.2.5
4
32
 
5
33
  ### Patch Changes
@@ -21,7 +21,9 @@ var _typography = require("@atlaskit/theme/typography");
21
21
 
22
22
  /** @jsx jsx */
23
23
  var defaultRender = function defaultRender(Component, props) {
24
- return (0, _core.jsx)(Component, props);
24
+ return (// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
25
+ (0, _core.jsx)(Component, props)
26
+ );
25
27
  };
26
28
 
27
29
  var gridSize = (0, _constants.gridSize)();
@@ -115,19 +117,19 @@ var disabledStyles = (0, _core.css)({
115
117
  }
116
118
  });
117
119
  var selectedStyles = (0, _core.css)({
118
- backgroundColor: "var(--ds-background-brand, ".concat(_colors.N20, ")"),
120
+ backgroundColor: "var(--ds-background-selected, ".concat(_colors.N20, ")"),
119
121
  // Fallback set as babel plugin inserts one otherwise
120
- color: "var(--ds-text-brand, currentColor)",
122
+ color: "var(--ds-text-selected, currentColor)",
121
123
  ':visited': {
122
- color: "var(--ds-text-brand, currentColor)"
124
+ color: "var(--ds-text-selected, currentColor)"
123
125
  },
124
126
  ':hover': {
125
- backgroundColor: "var(--ds-background-brand-hovered, ".concat(_colors.N20, ")"),
126
- color: "var(--ds-text-brand, currentColor)"
127
+ backgroundColor: "var(--ds-background-selected-hovered, ".concat(_colors.N20, ")"),
128
+ color: "var(--ds-text-selected, currentColor)"
127
129
  },
128
130
  ':active': {
129
- backgroundColor: "var(--ds-background-brand-pressed, ".concat(_colors.N30, ")"),
130
- color: "var(--ds-text-brand, currentColor)"
131
+ backgroundColor: "var(--ds-background-selected-pressed, ".concat(_colors.N30, ")"),
132
+ color: "var(--ds-text-selected, currentColor)"
131
133
  }
132
134
  });
133
135
  /**
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _core = require("@emotion/core");
9
+
10
+ var _colors = require("@atlaskit/theme/colors");
11
+
12
+ /** @jsx jsx */
13
+
14
+ /**
15
+ * This color is mirrored in:
16
+ * packages/design-system/theme/src/colors.tsx
17
+ *
18
+ * Please update both.
19
+ */
20
+ var skeletonColor = "var(--ds-background-neutral, ".concat(_colors.N20A, ")");
21
+ /**
22
+ * These keyframes are mirrored in:
23
+ * packages/design-system/theme/src/constants.tsx
24
+ *
25
+ * Please update both.
26
+ */
27
+
28
+ var shimmerKeyframes = (0, _core.keyframes)({
29
+ from: {
30
+ backgroundColor: "var(--ds-background-neutral, ".concat(skeletonColor, ")")
31
+ },
32
+ to: {
33
+ backgroundColor: "var(--ds-background-neutral-hovered, ".concat(_colors.N30A, ")")
34
+ }
35
+ });
36
+ /**
37
+ * These styles are mirrored in:
38
+ * packages/design-system/theme/src/constants.tsx
39
+ *
40
+ * Please update both.
41
+ */
42
+
43
+ var shimmerStyles = (0, _core.css)({
44
+ '::before, ::after': {
45
+ animationDirection: 'alternate',
46
+ animationDuration: '1.5s',
47
+ animationIterationCount: 'infinite',
48
+ animationName: "".concat(shimmerKeyframes),
49
+ animationTimingFunction: 'linear',
50
+ backgroundColor: "var(--ds-background-neutral, ".concat(skeletonColor, ")")
51
+ }
52
+ });
53
+ /**
54
+ * __Skeleton shimmer__
55
+ *
56
+ * A skeleton shimmer is the animation shown on loading skeletons for
57
+ * perceived performance and user satisfaction.
58
+ *
59
+ * This component provides a `className` through render props. This value will
60
+ * have type:
61
+ * + `string`, when `isShimmering={true}`.
62
+ * + `undefined`, when `isShimmering={false}`.
63
+ *
64
+ * @internal
65
+ */
66
+
67
+ var SkeletonShimmer = function SkeletonShimmer(_ref) {
68
+ var children = _ref.children,
69
+ _ref$isShimmering = _ref.isShimmering,
70
+ isShimmering = _ref$isShimmering === void 0 ? false : _ref$isShimmering;
71
+ return (0, _core.jsx)(_core.ClassNames, null, function (_ref2) {
72
+ var css = _ref2.css;
73
+ return children({
74
+ className: isShimmering ? css(shimmerStyles) : undefined
75
+ });
76
+ });
77
+ };
78
+
79
+ var _default = SkeletonShimmer;
80
+ exports.default = _default;
@@ -30,7 +30,7 @@ var itemHeadingContentHeight = _typography.headingSizes.h100.lineHeight;
30
30
  var itemHeadingFontSize = _typography.headingSizes.h100.size;
31
31
  var headingStyles = (0, _core.css)({
32
32
  padding: "0 ".concat(itemSidePadding, "px"),
33
- color: "var(--ds-text-subtlest, ".concat(_colors.N200, ")"),
33
+ color: "var(--ds-text-subtle, ".concat(_colors.N300, ")"),
34
34
  fontSize: itemHeadingFontSize,
35
35
  fontWeight: 700,
36
36
  lineHeight: itemHeadingContentHeight / itemHeadingFontSize,
@@ -15,6 +15,8 @@ var _colors = require("@atlaskit/theme/colors");
15
15
 
16
16
  var _constants = require("@atlaskit/theme/constants");
17
17
 
18
+ var _skeletonShimmer = _interopRequireDefault(require("../internal/components/skeleton-shimmer"));
19
+
18
20
  /** @jsx jsx */
19
21
  var skeletonStyles = (0, _core.css)({
20
22
  padding: "0 ".concat((0, _constants.gridSize)() * 2.5, "px"),
@@ -47,18 +49,26 @@ var customWidthStyles = (0, _core.css)({
47
49
  */
48
50
 
49
51
  var SkeletonHeadingItem = function SkeletonHeadingItem(_ref) {
50
- var testId = _ref.testId,
52
+ var _ref$isShimmering = _ref.isShimmering,
53
+ isShimmering = _ref$isShimmering === void 0 ? false : _ref$isShimmering,
54
+ testId = _ref.testId,
51
55
  width = _ref.width,
52
56
  _ref$cssFn = _ref.cssFn,
53
57
  cssFn = _ref$cssFn === void 0 ? _noop.default : _ref$cssFn;
54
- return (0, _core.jsx)("div", {
55
- style: {
56
- '--width': width
57
- },
58
- css: [skeletonStyles, width ? customWidthStyles : defaultWidthStyles, // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
59
- cssFn(undefined)],
60
- "data-ds--menu--skeleton-heading-item": true,
61
- "data-testid": testId
58
+ return (0, _core.jsx)(_skeletonShimmer.default, {
59
+ isShimmering: isShimmering
60
+ }, function (_ref2) {
61
+ var className = _ref2.className;
62
+ return (0, _core.jsx)("div", {
63
+ className: className,
64
+ style: {
65
+ '--width': width
66
+ },
67
+ css: [skeletonStyles, width ? customWidthStyles : defaultWidthStyles, // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
68
+ cssFn(undefined)],
69
+ "data-ds--menu--skeleton-heading-item": true,
70
+ "data-testid": testId
71
+ });
62
72
  });
63
73
  };
64
74
 
@@ -15,6 +15,8 @@ var _colors = require("@atlaskit/theme/colors");
15
15
 
16
16
  var _constants = require("@atlaskit/theme/constants");
17
17
 
18
+ var _skeletonShimmer = _interopRequireDefault(require("../internal/components/skeleton-shimmer"));
19
+
18
20
  /** @jsx jsx */
19
21
  var gridSize = (0, _constants.gridSize)();
20
22
  var borderRadius = (0, _constants.borderRadius)();
@@ -102,17 +104,25 @@ var iconStyles = (0, _core.css)({
102
104
  var SkeletonItem = function SkeletonItem(_ref) {
103
105
  var hasAvatar = _ref.hasAvatar,
104
106
  hasIcon = _ref.hasIcon,
107
+ _ref$isShimmering = _ref.isShimmering,
108
+ isShimmering = _ref$isShimmering === void 0 ? false : _ref$isShimmering,
105
109
  testId = _ref.testId,
106
110
  width = _ref.width,
107
111
  _ref$cssFn = _ref.cssFn,
108
112
  cssFn = _ref$cssFn === void 0 ? _noop.default : _ref$cssFn;
109
- return (0, _core.jsx)("div", {
110
- style: {
111
- '--width': width
112
- },
113
- css: [skeletonStyles, (hasAvatar || hasIcon) && beforeElementStyles, hasAvatar && avatarStyles, hasIcon && iconStyles, width ? customWidthStyles : defaultWidthStyles, // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
114
- cssFn(undefined)],
115
- "data-testid": testId
113
+ return (0, _core.jsx)(_skeletonShimmer.default, {
114
+ isShimmering: isShimmering
115
+ }, function (_ref2) {
116
+ var className = _ref2.className;
117
+ return (0, _core.jsx)("div", {
118
+ className: className,
119
+ style: {
120
+ '--width': width
121
+ },
122
+ css: [skeletonStyles, (hasAvatar || hasIcon) && beforeElementStyles, hasAvatar && avatarStyles, hasIcon && iconStyles, width ? customWidthStyles : defaultWidthStyles, // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
123
+ cssFn()],
124
+ "data-testid": testId
125
+ });
116
126
  });
117
127
  };
118
128
 
@@ -13,7 +13,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
13
13
 
14
14
  var _core = require("@emotion/core");
15
15
 
16
- var _excluded = ["maxWidth", "minWidth", "minHeight", "maxHeight", "testId"];
16
+ var _excluded = ["maxWidth", "minWidth", "minHeight", "maxHeight", "testId", "role"];
17
17
  var groupStyles = (0, _core.css)({
18
18
  display: 'flex',
19
19
  flexDirection: 'column',
@@ -34,6 +34,7 @@ var MenuGroup = function MenuGroup(_ref) {
34
34
  minHeight = _ref.minHeight,
35
35
  maxHeight = _ref.maxHeight,
36
36
  testId = _ref.testId,
37
+ role = _ref.role,
37
38
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
38
39
  return (0, _core.jsx)("div", (0, _extends2.default)({
39
40
  style: {
@@ -43,7 +44,9 @@ var MenuGroup = function MenuGroup(_ref) {
43
44
  maxHeight: maxHeight
44
45
  },
45
46
  css: groupStyles,
46
- "data-testid": testId
47
+ "data-testid": testId,
48
+ role: role // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
49
+
47
50
  }, rest));
48
51
  };
49
52
 
@@ -26,10 +26,12 @@ var PopupMenuGroup = function PopupMenuGroup(_ref) {
26
26
  _ref$minWidth = _ref.minWidth,
27
27
  minWidth = _ref$minWidth === void 0 ? 320 : _ref$minWidth,
28
28
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
29
- return (0, _core.jsx)(_menuGroup.default, (0, _extends2.default)({
30
- maxWidth: maxWidth,
31
- minWidth: minWidth
32
- }, rest));
29
+ return (// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
30
+ (0, _core.jsx)(_menuGroup.default, (0, _extends2.default)({
31
+ maxWidth: maxWidth,
32
+ minWidth: minWidth
33
+ }, rest))
34
+ );
33
35
  };
34
36
 
35
37
  var _default = PopupMenuGroup;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/menu",
3
- "version": "1.2.5",
3
+ "version": "1.3.1",
4
4
  "sideEffects": false
5
5
  }
@@ -6,7 +6,8 @@ import { N20, N200, N30 } from '@atlaskit/theme/colors';
6
6
  import { fontSize as fontSizeFn, gridSize as gridSizeFn } from '@atlaskit/theme/constants';
7
7
  import { headingSizes } from '@atlaskit/theme/typography';
8
8
 
9
- const defaultRender = (Component, props) => jsx(Component, props);
9
+ const defaultRender = (Component, props) => // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
10
+ jsx(Component, props);
10
11
 
11
12
  const gridSize = gridSizeFn();
12
13
  const fontSize = fontSizeFn();
@@ -99,19 +100,19 @@ const disabledStyles = css({
99
100
  }
100
101
  });
101
102
  const selectedStyles = css({
102
- backgroundColor: `var(--ds-background-brand, ${N20})`,
103
+ backgroundColor: `var(--ds-background-selected, ${N20})`,
103
104
  // Fallback set as babel plugin inserts one otherwise
104
- color: "var(--ds-text-brand, currentColor)",
105
+ color: "var(--ds-text-selected, currentColor)",
105
106
  ':visited': {
106
- color: "var(--ds-text-brand, currentColor)"
107
+ color: "var(--ds-text-selected, currentColor)"
107
108
  },
108
109
  ':hover': {
109
- backgroundColor: `var(--ds-background-brand-hovered, ${N20})`,
110
- color: "var(--ds-text-brand, currentColor)"
110
+ backgroundColor: `var(--ds-background-selected-hovered, ${N20})`,
111
+ color: "var(--ds-text-selected, currentColor)"
111
112
  },
112
113
  ':active': {
113
- backgroundColor: `var(--ds-background-brand-pressed, ${N30})`,
114
- color: "var(--ds-text-brand, currentColor)"
114
+ backgroundColor: `var(--ds-background-selected-pressed, ${N30})`,
115
+ color: "var(--ds-text-selected, currentColor)"
115
116
  }
116
117
  });
117
118
  /**
@@ -0,0 +1,69 @@
1
+ /** @jsx jsx */
2
+ import { ClassNames, css, jsx, keyframes } from '@emotion/core';
3
+ import { N20A, N30A } from '@atlaskit/theme/colors';
4
+
5
+ /**
6
+ * This color is mirrored in:
7
+ * packages/design-system/theme/src/colors.tsx
8
+ *
9
+ * Please update both.
10
+ */
11
+ const skeletonColor = `var(--ds-background-neutral, ${N20A})`;
12
+ /**
13
+ * These keyframes are mirrored in:
14
+ * packages/design-system/theme/src/constants.tsx
15
+ *
16
+ * Please update both.
17
+ */
18
+
19
+ const shimmerKeyframes = keyframes({
20
+ from: {
21
+ backgroundColor: `var(--ds-background-neutral, ${skeletonColor})`
22
+ },
23
+ to: {
24
+ backgroundColor: `var(--ds-background-neutral-hovered, ${N30A})`
25
+ }
26
+ });
27
+ /**
28
+ * These styles are mirrored in:
29
+ * packages/design-system/theme/src/constants.tsx
30
+ *
31
+ * Please update both.
32
+ */
33
+
34
+ const shimmerStyles = css({
35
+ '::before, ::after': {
36
+ animationDirection: 'alternate',
37
+ animationDuration: '1.5s',
38
+ animationIterationCount: 'infinite',
39
+ animationName: `${shimmerKeyframes}`,
40
+ animationTimingFunction: 'linear',
41
+ backgroundColor: `var(--ds-background-neutral, ${skeletonColor})`
42
+ }
43
+ });
44
+ /**
45
+ * __Skeleton shimmer__
46
+ *
47
+ * A skeleton shimmer is the animation shown on loading skeletons for
48
+ * perceived performance and user satisfaction.
49
+ *
50
+ * This component provides a `className` through render props. This value will
51
+ * have type:
52
+ * + `string`, when `isShimmering={true}`.
53
+ * + `undefined`, when `isShimmering={false}`.
54
+ *
55
+ * @internal
56
+ */
57
+
58
+ const SkeletonShimmer = ({
59
+ children,
60
+ isShimmering = false
61
+ }) => {
62
+ return jsx(ClassNames, null, ({
63
+ css
64
+ }) => children({
65
+ className: isShimmering ? css(shimmerStyles) : undefined
66
+ }));
67
+ };
68
+
69
+ export default SkeletonShimmer;
@@ -4,7 +4,7 @@ import _extends from "@babel/runtime/helpers/extends";
4
4
  import { memo } from 'react';
5
5
  import { css, jsx } from '@emotion/core';
6
6
  import noop from '@atlaskit/ds-lib/noop';
7
- import { N200 } from '@atlaskit/theme/colors';
7
+ import { N300 } from '@atlaskit/theme/colors';
8
8
  import { gridSize as gridSizeFn } from '@atlaskit/theme/constants';
9
9
  import { headingSizes } from '@atlaskit/theme/typography';
10
10
  const gridSize = gridSizeFn();
@@ -13,7 +13,7 @@ const itemHeadingContentHeight = headingSizes.h100.lineHeight;
13
13
  const itemHeadingFontSize = headingSizes.h100.size;
14
14
  const headingStyles = css({
15
15
  padding: `0 ${itemSidePadding}px`,
16
- color: `var(--ds-text-subtlest, ${N200})`,
16
+ color: `var(--ds-text-subtle, ${N300})`,
17
17
  fontSize: itemHeadingFontSize,
18
18
  fontWeight: 700,
19
19
  lineHeight: itemHeadingContentHeight / itemHeadingFontSize,
@@ -3,6 +3,7 @@ import { css, jsx } from '@emotion/core';
3
3
  import noop from '@atlaskit/ds-lib/noop';
4
4
  import { skeleton as skeletonColorFn } from '@atlaskit/theme/colors';
5
5
  import { gridSize } from '@atlaskit/theme/constants';
6
+ import SkeletonShimmer from '../internal/components/skeleton-shimmer';
6
7
  const skeletonStyles = css({
7
8
  padding: `0 ${gridSize() * 2.5}px`,
8
9
  '::after': {
@@ -34,10 +35,16 @@ const customWidthStyles = css({
34
35
  */
35
36
 
36
37
  const SkeletonHeadingItem = ({
38
+ isShimmering = false,
37
39
  testId,
38
40
  width,
39
41
  cssFn = noop
42
+ }) => jsx(SkeletonShimmer, {
43
+ isShimmering: isShimmering
44
+ }, ({
45
+ className
40
46
  }) => jsx("div", {
47
+ className: className,
41
48
  style: {
42
49
  '--width': width
43
50
  },
@@ -45,6 +52,6 @@ const SkeletonHeadingItem = ({
45
52
  cssFn(undefined)],
46
53
  "data-ds--menu--skeleton-heading-item": true,
47
54
  "data-testid": testId
48
- });
55
+ }));
49
56
 
50
57
  export default SkeletonHeadingItem;
@@ -3,6 +3,7 @@ import { css, jsx } from '@emotion/core';
3
3
  import noop from '@atlaskit/ds-lib/noop';
4
4
  import { skeleton as skeletonColorFn } from '@atlaskit/theme/colors';
5
5
  import { borderRadius as borderRadiusFn, gridSize as gridSizeFn } from '@atlaskit/theme/constants';
6
+ import SkeletonShimmer from '../internal/components/skeleton-shimmer';
6
7
  const gridSize = gridSizeFn();
7
8
  const borderRadius = borderRadiusFn();
8
9
  const itemElemSpacing = gridSize * 1.5;
@@ -89,16 +90,22 @@ const iconStyles = css({
89
90
  const SkeletonItem = ({
90
91
  hasAvatar,
91
92
  hasIcon,
93
+ isShimmering = false,
92
94
  testId,
93
95
  width,
94
96
  cssFn = noop
97
+ }) => jsx(SkeletonShimmer, {
98
+ isShimmering: isShimmering
99
+ }, ({
100
+ className
95
101
  }) => jsx("div", {
102
+ className: className,
96
103
  style: {
97
104
  '--width': width
98
105
  },
99
106
  css: [skeletonStyles, (hasAvatar || hasIcon) && beforeElementStyles, hasAvatar && avatarStyles, hasIcon && iconStyles, width ? customWidthStyles : defaultWidthStyles, // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
100
- cssFn(undefined)],
107
+ cssFn()],
101
108
  "data-testid": testId
102
- });
109
+ }));
103
110
 
104
111
  export default SkeletonItem;
@@ -22,6 +22,7 @@ const MenuGroup = ({
22
22
  minHeight,
23
23
  maxHeight,
24
24
  testId,
25
+ role,
25
26
  ...rest
26
27
  }) => jsx("div", _extends({
27
28
  style: {
@@ -31,7 +32,9 @@ const MenuGroup = ({
31
32
  maxHeight
32
33
  },
33
34
  css: groupStyles,
34
- "data-testid": testId
35
+ "data-testid": testId,
36
+ role: role // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
37
+
35
38
  }, rest));
36
39
 
37
40
  export default MenuGroup;
@@ -11,7 +11,8 @@ const PopupMenuGroup = ({
11
11
  maxWidth = 800,
12
12
  minWidth = 320,
13
13
  ...rest
14
- }) => jsx(MenuGroup, _extends({
14
+ }) => // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
15
+ jsx(MenuGroup, _extends({
15
16
  maxWidth: maxWidth,
16
17
  minWidth: minWidth
17
18
  }, rest));
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/menu",
3
- "version": "1.2.5",
3
+ "version": "1.3.1",
4
4
  "sideEffects": false
5
5
  }
@@ -7,7 +7,9 @@ import { fontSize as fontSizeFn, gridSize as gridSizeFn } from '@atlaskit/theme/
7
7
  import { headingSizes } from '@atlaskit/theme/typography';
8
8
 
9
9
  var defaultRender = function defaultRender(Component, props) {
10
- return jsx(Component, props);
10
+ return (// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
11
+ jsx(Component, props)
12
+ );
11
13
  };
12
14
 
13
15
  var gridSize = gridSizeFn();
@@ -101,19 +103,19 @@ var disabledStyles = css({
101
103
  }
102
104
  });
103
105
  var selectedStyles = css({
104
- backgroundColor: "var(--ds-background-brand, ".concat(N20, ")"),
106
+ backgroundColor: "var(--ds-background-selected, ".concat(N20, ")"),
105
107
  // Fallback set as babel plugin inserts one otherwise
106
- color: "var(--ds-text-brand, currentColor)",
108
+ color: "var(--ds-text-selected, currentColor)",
107
109
  ':visited': {
108
- color: "var(--ds-text-brand, currentColor)"
110
+ color: "var(--ds-text-selected, currentColor)"
109
111
  },
110
112
  ':hover': {
111
- backgroundColor: "var(--ds-background-brand-hovered, ".concat(N20, ")"),
112
- color: "var(--ds-text-brand, currentColor)"
113
+ backgroundColor: "var(--ds-background-selected-hovered, ".concat(N20, ")"),
114
+ color: "var(--ds-text-selected, currentColor)"
113
115
  },
114
116
  ':active': {
115
- backgroundColor: "var(--ds-background-brand-pressed, ".concat(N30, ")"),
116
- color: "var(--ds-text-brand, currentColor)"
117
+ backgroundColor: "var(--ds-background-selected-pressed, ".concat(N30, ")"),
118
+ color: "var(--ds-text-selected, currentColor)"
117
119
  }
118
120
  });
119
121
  /**
@@ -0,0 +1,70 @@
1
+ /** @jsx jsx */
2
+ import { ClassNames, css, jsx, keyframes } from '@emotion/core';
3
+ import { N20A, N30A } from '@atlaskit/theme/colors';
4
+
5
+ /**
6
+ * This color is mirrored in:
7
+ * packages/design-system/theme/src/colors.tsx
8
+ *
9
+ * Please update both.
10
+ */
11
+ var skeletonColor = "var(--ds-background-neutral, ".concat(N20A, ")");
12
+ /**
13
+ * These keyframes are mirrored in:
14
+ * packages/design-system/theme/src/constants.tsx
15
+ *
16
+ * Please update both.
17
+ */
18
+
19
+ var shimmerKeyframes = keyframes({
20
+ from: {
21
+ backgroundColor: "var(--ds-background-neutral, ".concat(skeletonColor, ")")
22
+ },
23
+ to: {
24
+ backgroundColor: "var(--ds-background-neutral-hovered, ".concat(N30A, ")")
25
+ }
26
+ });
27
+ /**
28
+ * These styles are mirrored in:
29
+ * packages/design-system/theme/src/constants.tsx
30
+ *
31
+ * Please update both.
32
+ */
33
+
34
+ var shimmerStyles = css({
35
+ '::before, ::after': {
36
+ animationDirection: 'alternate',
37
+ animationDuration: '1.5s',
38
+ animationIterationCount: 'infinite',
39
+ animationName: "".concat(shimmerKeyframes),
40
+ animationTimingFunction: 'linear',
41
+ backgroundColor: "var(--ds-background-neutral, ".concat(skeletonColor, ")")
42
+ }
43
+ });
44
+ /**
45
+ * __Skeleton shimmer__
46
+ *
47
+ * A skeleton shimmer is the animation shown on loading skeletons for
48
+ * perceived performance and user satisfaction.
49
+ *
50
+ * This component provides a `className` through render props. This value will
51
+ * have type:
52
+ * + `string`, when `isShimmering={true}`.
53
+ * + `undefined`, when `isShimmering={false}`.
54
+ *
55
+ * @internal
56
+ */
57
+
58
+ var SkeletonShimmer = function SkeletonShimmer(_ref) {
59
+ var children = _ref.children,
60
+ _ref$isShimmering = _ref.isShimmering,
61
+ isShimmering = _ref$isShimmering === void 0 ? false : _ref$isShimmering;
62
+ return jsx(ClassNames, null, function (_ref2) {
63
+ var css = _ref2.css;
64
+ return children({
65
+ className: isShimmering ? css(shimmerStyles) : undefined
66
+ });
67
+ });
68
+ };
69
+
70
+ export default SkeletonShimmer;
@@ -6,7 +6,7 @@ var _excluded = ["children", "testId", "id", "cssFn"];
6
6
  import { memo } from 'react';
7
7
  import { css, jsx } from '@emotion/core';
8
8
  import noop from '@atlaskit/ds-lib/noop';
9
- import { N200 } from '@atlaskit/theme/colors';
9
+ import { N300 } from '@atlaskit/theme/colors';
10
10
  import { gridSize as gridSizeFn } from '@atlaskit/theme/constants';
11
11
  import { headingSizes } from '@atlaskit/theme/typography';
12
12
  var gridSize = gridSizeFn();
@@ -15,7 +15,7 @@ var itemHeadingContentHeight = headingSizes.h100.lineHeight;
15
15
  var itemHeadingFontSize = headingSizes.h100.size;
16
16
  var headingStyles = css({
17
17
  padding: "0 ".concat(itemSidePadding, "px"),
18
- color: "var(--ds-text-subtlest, ".concat(N200, ")"),
18
+ color: "var(--ds-text-subtle, ".concat(N300, ")"),
19
19
  fontSize: itemHeadingFontSize,
20
20
  fontWeight: 700,
21
21
  lineHeight: itemHeadingContentHeight / itemHeadingFontSize,
@@ -3,6 +3,7 @@ import { css, jsx } from '@emotion/core';
3
3
  import noop from '@atlaskit/ds-lib/noop';
4
4
  import { skeleton as skeletonColorFn } from '@atlaskit/theme/colors';
5
5
  import { gridSize } from '@atlaskit/theme/constants';
6
+ import SkeletonShimmer from '../internal/components/skeleton-shimmer';
6
7
  var skeletonStyles = css({
7
8
  padding: "0 ".concat(gridSize() * 2.5, "px"),
8
9
  '::after': {
@@ -34,18 +35,26 @@ var customWidthStyles = css({
34
35
  */
35
36
 
36
37
  var SkeletonHeadingItem = function SkeletonHeadingItem(_ref) {
37
- var testId = _ref.testId,
38
+ var _ref$isShimmering = _ref.isShimmering,
39
+ isShimmering = _ref$isShimmering === void 0 ? false : _ref$isShimmering,
40
+ testId = _ref.testId,
38
41
  width = _ref.width,
39
42
  _ref$cssFn = _ref.cssFn,
40
43
  cssFn = _ref$cssFn === void 0 ? noop : _ref$cssFn;
41
- return jsx("div", {
42
- style: {
43
- '--width': width
44
- },
45
- css: [skeletonStyles, width ? customWidthStyles : defaultWidthStyles, // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
46
- cssFn(undefined)],
47
- "data-ds--menu--skeleton-heading-item": true,
48
- "data-testid": testId
44
+ return jsx(SkeletonShimmer, {
45
+ isShimmering: isShimmering
46
+ }, function (_ref2) {
47
+ var className = _ref2.className;
48
+ return jsx("div", {
49
+ className: className,
50
+ style: {
51
+ '--width': width
52
+ },
53
+ css: [skeletonStyles, width ? customWidthStyles : defaultWidthStyles, // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
54
+ cssFn(undefined)],
55
+ "data-ds--menu--skeleton-heading-item": true,
56
+ "data-testid": testId
57
+ });
49
58
  });
50
59
  };
51
60
 
@@ -3,6 +3,7 @@ import { css, jsx } from '@emotion/core';
3
3
  import noop from '@atlaskit/ds-lib/noop';
4
4
  import { skeleton as skeletonColorFn } from '@atlaskit/theme/colors';
5
5
  import { borderRadius as borderRadiusFn, gridSize as gridSizeFn } from '@atlaskit/theme/constants';
6
+ import SkeletonShimmer from '../internal/components/skeleton-shimmer';
6
7
  var gridSize = gridSizeFn();
7
8
  var borderRadius = borderRadiusFn();
8
9
  var itemElemSpacing = gridSize * 1.5;
@@ -89,17 +90,25 @@ var iconStyles = css({
89
90
  var SkeletonItem = function SkeletonItem(_ref) {
90
91
  var hasAvatar = _ref.hasAvatar,
91
92
  hasIcon = _ref.hasIcon,
93
+ _ref$isShimmering = _ref.isShimmering,
94
+ isShimmering = _ref$isShimmering === void 0 ? false : _ref$isShimmering,
92
95
  testId = _ref.testId,
93
96
  width = _ref.width,
94
97
  _ref$cssFn = _ref.cssFn,
95
98
  cssFn = _ref$cssFn === void 0 ? noop : _ref$cssFn;
96
- return jsx("div", {
97
- style: {
98
- '--width': width
99
- },
100
- css: [skeletonStyles, (hasAvatar || hasIcon) && beforeElementStyles, hasAvatar && avatarStyles, hasIcon && iconStyles, width ? customWidthStyles : defaultWidthStyles, // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
101
- cssFn(undefined)],
102
- "data-testid": testId
99
+ return jsx(SkeletonShimmer, {
100
+ isShimmering: isShimmering
101
+ }, function (_ref2) {
102
+ var className = _ref2.className;
103
+ return jsx("div", {
104
+ className: className,
105
+ style: {
106
+ '--width': width
107
+ },
108
+ css: [skeletonStyles, (hasAvatar || hasIcon) && beforeElementStyles, hasAvatar && avatarStyles, hasIcon && iconStyles, width ? customWidthStyles : defaultWidthStyles, // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
109
+ cssFn()],
110
+ "data-testid": testId
111
+ });
103
112
  });
104
113
  };
105
114
 
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["maxWidth", "minWidth", "minHeight", "maxHeight", "testId"];
3
+ var _excluded = ["maxWidth", "minWidth", "minHeight", "maxHeight", "testId", "role"];
4
4
 
5
5
  /** @jsx jsx */
6
6
  import { css, jsx } from '@emotion/core';
@@ -24,6 +24,7 @@ var MenuGroup = function MenuGroup(_ref) {
24
24
  minHeight = _ref.minHeight,
25
25
  maxHeight = _ref.maxHeight,
26
26
  testId = _ref.testId,
27
+ role = _ref.role,
27
28
  rest = _objectWithoutProperties(_ref, _excluded);
28
29
 
29
30
  return jsx("div", _extends({
@@ -34,7 +35,9 @@ var MenuGroup = function MenuGroup(_ref) {
34
35
  maxHeight: maxHeight
35
36
  },
36
37
  css: groupStyles,
37
- "data-testid": testId
38
+ "data-testid": testId,
39
+ role: role // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
40
+
38
41
  }, rest));
39
42
  };
40
43
 
@@ -16,10 +16,12 @@ var PopupMenuGroup = function PopupMenuGroup(_ref) {
16
16
  minWidth = _ref$minWidth === void 0 ? 320 : _ref$minWidth,
17
17
  rest = _objectWithoutProperties(_ref, _excluded);
18
18
 
19
- return jsx(MenuGroup, _extends({
20
- maxWidth: maxWidth,
21
- minWidth: minWidth
22
- }, rest));
19
+ return (// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
20
+ jsx(MenuGroup, _extends({
21
+ maxWidth: maxWidth,
22
+ minWidth: minWidth
23
+ }, rest))
24
+ );
23
25
  };
24
26
 
25
27
  export default PopupMenuGroup;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/menu",
3
- "version": "1.2.5",
3
+ "version": "1.3.1",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,23 @@
1
+ /** @jsx jsx */
2
+ import { ReactNode } from 'react';
3
+ declare type SkeletonShimmerProps = {
4
+ children: ({ className }: {
5
+ className?: string;
6
+ }) => ReactNode;
7
+ isShimmering?: boolean;
8
+ };
9
+ /**
10
+ * __Skeleton shimmer__
11
+ *
12
+ * A skeleton shimmer is the animation shown on loading skeletons for
13
+ * perceived performance and user satisfaction.
14
+ *
15
+ * This component provides a `className` through render props. This value will
16
+ * have type:
17
+ * + `string`, when `isShimmering={true}`.
18
+ * + `undefined`, when `isShimmering={false}`.
19
+ *
20
+ * @internal
21
+ */
22
+ declare const SkeletonShimmer: ({ children, isShimmering, }: SkeletonShimmerProps) => JSX.Element;
23
+ export default SkeletonShimmer;
@@ -8,5 +8,5 @@ import type { SkeletonHeadingItemProps } from '../types';
8
8
  * - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/skeleton-heading-item)
9
9
  * - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
10
10
  */
11
- declare const SkeletonHeadingItem: ({ testId, width, cssFn, }: SkeletonHeadingItemProps) => JSX.Element;
11
+ declare const SkeletonHeadingItem: ({ isShimmering, testId, width, cssFn, }: SkeletonHeadingItemProps) => JSX.Element;
12
12
  export default SkeletonHeadingItem;
@@ -8,5 +8,5 @@ import type { SkeletonItemProps } from '../types';
8
8
  * - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/skeleton-item)
9
9
  * - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
10
10
  */
11
- declare const SkeletonItem: ({ hasAvatar, hasIcon, testId, width, cssFn, }: SkeletonItemProps) => JSX.Element;
11
+ declare const SkeletonItem: ({ hasAvatar, hasIcon, isShimmering, testId, width, cssFn, }: SkeletonItemProps) => JSX.Element;
12
12
  export default SkeletonItem;
@@ -8,5 +8,5 @@ import type { MenuGroupProps } from '../types';
8
8
  * - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/menu-group)
9
9
  * - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
10
10
  */
11
- declare const MenuGroup: ({ maxWidth, minWidth, minHeight, maxHeight, testId, ...rest }: MenuGroupProps) => JSX.Element;
11
+ declare const MenuGroup: ({ maxWidth, minWidth, minHeight, maxHeight, testId, role, ...rest }: MenuGroupProps) => JSX.Element;
12
12
  export default MenuGroup;
@@ -3,6 +3,9 @@ import { CSSObject } from '@emotion/core';
3
3
  export interface RenderFunction<TProps = {}> {
4
4
  (Component: ComponentType | string, props: TProps): React.ReactNode;
5
5
  }
6
+ /**
7
+ * @deprecated This type is deprecated and will be removed in a future release. See DSP-2676 for more information.
8
+ */
6
9
  export interface TitleOverrides {
7
10
  render?: RenderFunction<{
8
11
  className?: string;
@@ -10,6 +13,9 @@ export interface TitleOverrides {
10
13
  'data-item-title': boolean;
11
14
  }>;
12
15
  }
16
+ /**
17
+ * @deprecated This type is deprecated and will be removed in a future release. See DSP-2676 for more information.
18
+ */
13
19
  export interface Overrides {
14
20
  Title?: TitleOverrides;
15
21
  }
@@ -39,6 +45,10 @@ export interface MenuGroupProps extends MenuGroupSizing {
39
45
  * should generally be `Section` components.
40
46
  */
41
47
  children: React.ReactNode;
48
+ /**
49
+ * Used to override the accessibility role for the element.
50
+ */
51
+ role?: string;
42
52
  /**
43
53
  * A `testId` prop is provided for specified elements,
44
54
  * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
@@ -78,6 +88,9 @@ export interface SectionProps {
78
88
  * serving as a hook for automated tests.
79
89
  */
80
90
  testId?: string;
91
+ /**
92
+ * @deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
93
+ */
81
94
  overrides?: {
82
95
  HeadingItem?: {
83
96
  /**
@@ -102,6 +115,9 @@ export interface MenuItemPrimitiveProps {
102
115
  description: React.ReactNode | undefined;
103
116
  iconAfter: React.ReactNode | undefined;
104
117
  iconBefore: React.ReactNode | undefined;
118
+ /**
119
+ * @deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
120
+ */
105
121
  overrides: Overrides | undefined;
106
122
  shouldTitleWrap: boolean | undefined;
107
123
  shouldDescriptionWrap: boolean | undefined;
@@ -113,6 +129,8 @@ export interface MenuItemProps {
113
129
  /**
114
130
  * A function that can be used to override the styles of the component.
115
131
  * It receives the current styles and state and expects a styles object.
132
+ *
133
+ * @deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
116
134
  */
117
135
  cssFn?: CSSFn;
118
136
  /**
@@ -158,6 +176,8 @@ export interface MenuItemProps {
158
176
  testId?: string;
159
177
  /**
160
178
  * Custom overrides for the composed components.
179
+ *
180
+ * @deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
161
181
  */
162
182
  overrides?: Overrides;
163
183
  /**
@@ -294,6 +314,8 @@ export interface HeadingItemProps {
294
314
  /**
295
315
  * A function that can be used to override the styles.
296
316
  * It receives the current styles and returns a customised styles object.
317
+ *
318
+ * @deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
297
319
  */
298
320
  cssFn?: StatelessCSSFn;
299
321
  /**
@@ -333,6 +355,8 @@ export interface SkeletonHeadingItemProps {
333
355
  /**
334
356
  * A function that can be used to override the styles of this component.
335
357
  * It receives the current styles and returns a customized styles object.
358
+ *
359
+ * @deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
336
360
  */
337
361
  cssFn?: StatelessCSSFn;
338
362
  }
@@ -346,8 +370,12 @@ export declare type ItemState = {
346
370
  * and should return a CSSObject.
347
371
  *
348
372
  * @see @atlaskit/menu/docs/85-overriding-item-styles
373
+ * @deprecated This type is deprecated and will be removed in a future release. See DSP-2676 for more information.
349
374
  */
350
- export interface CSSFn<TState = ItemState> {
375
+ export interface CSSFn<TState = ItemState extends void ? void : ItemState> {
351
376
  (currentState: TState): CSSObject | CSSObject[];
352
377
  }
353
- export declare type StatelessCSSFn = CSSFn<undefined>;
378
+ /**
379
+ * @deprecated This type is deprecated and will be removed in a future release. See DSP-2676 for more information.
380
+ */
381
+ export declare type StatelessCSSFn = CSSFn<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/menu",
3
- "version": "1.2.5",
3
+ "version": "1.3.1",
4
4
  "description": "A collection of composable menu components that can be used anywhere.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -35,10 +35,10 @@
35
35
  ".": "./src/index.tsx"
36
36
  },
37
37
  "dependencies": {
38
- "@atlaskit/ds-lib": "^1.2.0",
39
- "@atlaskit/focus-ring": "^0.2.4",
38
+ "@atlaskit/ds-lib": "^1.4.0",
39
+ "@atlaskit/focus-ring": "^1.0.0",
40
40
  "@atlaskit/theme": "^12.1.0",
41
- "@atlaskit/tokens": "^0.6.0",
41
+ "@atlaskit/tokens": "^0.8.0",
42
42
  "@babel/runtime": "^7.0.0",
43
43
  "@emotion/core": "^10.0.9"
44
44
  },
@@ -48,7 +48,7 @@
48
48
  },
49
49
  "devDependencies": {
50
50
  "@atlaskit/avatar": "^20.5.0",
51
- "@atlaskit/button": "^16.0.0",
51
+ "@atlaskit/button": "^16.2.0",
52
52
  "@atlaskit/docs": "*",
53
53
  "@atlaskit/icon": "^21.10.0",
54
54
  "@atlaskit/icon-file-type": "^6.0.0",
@@ -89,5 +89,6 @@
89
89
  "deprecation": "no-deprecated-imports"
90
90
  }
91
91
  },
92
+ "homepage": "https://atlassian.design/components/menu/",
92
93
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
93
94
  }