@atlaskit/menu 1.2.6 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/dist/cjs/internal/components/menu-item-primitive.js +7 -7
- package/dist/cjs/internal/components/skeleton-shimmer.js +80 -0
- package/dist/cjs/menu-item/skeleton-heading-item.js +19 -9
- package/dist/cjs/menu-item/skeleton-item.js +17 -7
- package/dist/cjs/menu-section/menu-group.js +4 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/internal/components/menu-item-primitive.js +7 -7
- package/dist/es2019/internal/components/skeleton-shimmer.js +69 -0
- package/dist/es2019/menu-item/skeleton-heading-item.js +8 -1
- package/dist/es2019/menu-item/skeleton-item.js +8 -1
- package/dist/es2019/menu-section/menu-group.js +3 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/internal/components/menu-item-primitive.js +7 -7
- package/dist/esm/internal/components/skeleton-shimmer.js +70 -0
- package/dist/esm/menu-item/skeleton-heading-item.js +18 -9
- package/dist/esm/menu-item/skeleton-item.js +16 -7
- package/dist/esm/menu-section/menu-group.js +4 -2
- package/dist/esm/version.json +1 -1
- package/dist/types/internal/components/skeleton-shimmer.d.ts +23 -0
- package/dist/types/menu-item/skeleton-heading-item.d.ts +1 -1
- package/dist/types/menu-item/skeleton-item.d.ts +1 -1
- package/dist/types/menu-section/menu-group.d.ts +1 -1
- package/dist/types/types.d.ts +4 -0
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @atlaskit/menu
|
|
2
2
|
|
|
3
|
+
## 1.3.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 1.3.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`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.
|
|
14
|
+
- [`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.
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
17
|
+
## 1.3.0
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- [`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.
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
|
|
3
27
|
## 1.2.6
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
|
@@ -117,19 +117,19 @@ var disabledStyles = (0, _core.css)({
|
|
|
117
117
|
}
|
|
118
118
|
});
|
|
119
119
|
var selectedStyles = (0, _core.css)({
|
|
120
|
-
backgroundColor: "var(--ds-background-
|
|
120
|
+
backgroundColor: "var(--ds-background-selected, ".concat(_colors.N20, ")"),
|
|
121
121
|
// Fallback set as babel plugin inserts one otherwise
|
|
122
|
-
color: "var(--ds-text-
|
|
122
|
+
color: "var(--ds-text-selected, currentColor)",
|
|
123
123
|
':visited': {
|
|
124
|
-
color: "var(--ds-text-
|
|
124
|
+
color: "var(--ds-text-selected, currentColor)"
|
|
125
125
|
},
|
|
126
126
|
':hover': {
|
|
127
|
-
backgroundColor: "var(--ds-background-
|
|
128
|
-
color: "var(--ds-text-
|
|
127
|
+
backgroundColor: "var(--ds-background-selected-hovered, ".concat(_colors.N20, ")"),
|
|
128
|
+
color: "var(--ds-text-selected, currentColor)"
|
|
129
129
|
},
|
|
130
130
|
':active': {
|
|
131
|
-
backgroundColor: "var(--ds-background-
|
|
132
|
-
color: "var(--ds-text-
|
|
131
|
+
backgroundColor: "var(--ds-background-selected-pressed, ".concat(_colors.N30, ")"),
|
|
132
|
+
color: "var(--ds-text-selected, currentColor)"
|
|
133
133
|
}
|
|
134
134
|
});
|
|
135
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;
|
|
@@ -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
|
|
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)(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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)(
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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,8 @@ 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
|
|
47
49
|
|
|
48
50
|
}, rest));
|
|
49
51
|
};
|
package/dist/cjs/version.json
CHANGED
|
@@ -100,19 +100,19 @@ const disabledStyles = css({
|
|
|
100
100
|
}
|
|
101
101
|
});
|
|
102
102
|
const selectedStyles = css({
|
|
103
|
-
backgroundColor: `var(--ds-background-
|
|
103
|
+
backgroundColor: `var(--ds-background-selected, ${N20})`,
|
|
104
104
|
// Fallback set as babel plugin inserts one otherwise
|
|
105
|
-
color: "var(--ds-text-
|
|
105
|
+
color: "var(--ds-text-selected, currentColor)",
|
|
106
106
|
':visited': {
|
|
107
|
-
color: "var(--ds-text-
|
|
107
|
+
color: "var(--ds-text-selected, currentColor)"
|
|
108
108
|
},
|
|
109
109
|
':hover': {
|
|
110
|
-
backgroundColor: `var(--ds-background-
|
|
111
|
-
color: "var(--ds-text-
|
|
110
|
+
backgroundColor: `var(--ds-background-selected-hovered, ${N20})`,
|
|
111
|
+
color: "var(--ds-text-selected, currentColor)"
|
|
112
112
|
},
|
|
113
113
|
':active': {
|
|
114
|
-
backgroundColor: `var(--ds-background-
|
|
115
|
-
color: "var(--ds-text-
|
|
114
|
+
backgroundColor: `var(--ds-background-selected-pressed, ${N30})`,
|
|
115
|
+
color: "var(--ds-text-selected, currentColor)"
|
|
116
116
|
}
|
|
117
117
|
});
|
|
118
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;
|
|
@@ -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
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,8 @@ 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
|
|
35
37
|
|
|
36
38
|
}, rest));
|
|
37
39
|
|
package/dist/es2019/version.json
CHANGED
|
@@ -103,19 +103,19 @@ var disabledStyles = css({
|
|
|
103
103
|
}
|
|
104
104
|
});
|
|
105
105
|
var selectedStyles = css({
|
|
106
|
-
backgroundColor: "var(--ds-background-
|
|
106
|
+
backgroundColor: "var(--ds-background-selected, ".concat(N20, ")"),
|
|
107
107
|
// Fallback set as babel plugin inserts one otherwise
|
|
108
|
-
color: "var(--ds-text-
|
|
108
|
+
color: "var(--ds-text-selected, currentColor)",
|
|
109
109
|
':visited': {
|
|
110
|
-
color: "var(--ds-text-
|
|
110
|
+
color: "var(--ds-text-selected, currentColor)"
|
|
111
111
|
},
|
|
112
112
|
':hover': {
|
|
113
|
-
backgroundColor: "var(--ds-background-
|
|
114
|
-
color: "var(--ds-text-
|
|
113
|
+
backgroundColor: "var(--ds-background-selected-hovered, ".concat(N20, ")"),
|
|
114
|
+
color: "var(--ds-text-selected, currentColor)"
|
|
115
115
|
},
|
|
116
116
|
':active': {
|
|
117
|
-
backgroundColor: "var(--ds-background-
|
|
118
|
-
color: "var(--ds-text-
|
|
117
|
+
backgroundColor: "var(--ds-background-selected-pressed, ".concat(N30, ")"),
|
|
118
|
+
color: "var(--ds-text-selected, currentColor)"
|
|
119
119
|
}
|
|
120
120
|
});
|
|
121
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;
|
|
@@ -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
|
|
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(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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(
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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,8 @@ 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
|
|
38
40
|
|
|
39
41
|
}, rest));
|
|
40
42
|
};
|
package/dist/esm/version.json
CHANGED
|
@@ -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;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -45,6 +45,10 @@ export interface MenuGroupProps extends MenuGroupSizing {
|
|
|
45
45
|
* should generally be `Section` components.
|
|
46
46
|
*/
|
|
47
47
|
children: React.ReactNode;
|
|
48
|
+
/**
|
|
49
|
+
* Used to override the accessibility role for the element.
|
|
50
|
+
*/
|
|
51
|
+
role?: string;
|
|
48
52
|
/**
|
|
49
53
|
* A `testId` prop is provided for specified elements,
|
|
50
54
|
* which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/menu",
|
|
3
|
-
"version": "1.2
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "A collection of composable menu components that can be used anywhere.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@atlaskit/ds-lib": "^1.4.0",
|
|
39
39
|
"@atlaskit/focus-ring": "^1.0.0",
|
|
40
40
|
"@atlaskit/theme": "^12.1.0",
|
|
41
|
-
"@atlaskit/tokens": "^0.
|
|
41
|
+
"@atlaskit/tokens": "^0.9.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.
|
|
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",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"jscodeshift": "^0.13.0",
|
|
67
67
|
"react-router-dom": "^4.2.2",
|
|
68
68
|
"storybook-addon-performance": "^0.16.0",
|
|
69
|
-
"typescript": "3.9.
|
|
69
|
+
"typescript": "3.9.10"
|
|
70
70
|
},
|
|
71
71
|
"keywords": [
|
|
72
72
|
"atlaskit",
|
|
@@ -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
|
}
|