@atlaskit/menu 1.3.0 → 1.3.3
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 +20 -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/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/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/version.json +1 -1
- package/dist/types/internal/components/skeleton-shimmer.d.ts +23 -0
- package/dist/types/internal/hooks/use-blur-on-mouse-down.d.ts +1 -1
- package/dist/types/menu-item/skeleton-heading-item.d.ts +1 -1
- package/dist/types/menu-item/skeleton-item.d.ts +1 -1
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/menu
|
|
2
2
|
|
|
3
|
+
## 1.3.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`cb2392f6d33`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cb2392f6d33) - Upgrade to TypeScript 4.2.4
|
|
8
|
+
|
|
9
|
+
## 1.3.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 1.3.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [`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.
|
|
20
|
+
- [`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.
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 1.3.0
|
|
4
24
|
|
|
5
25
|
### Minor 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
|
|
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;
|
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
|
|
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;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { MouseEventHandler } from 'react';
|
|
2
|
-
export declare const useBlurOnMouseDown: (userLandCallback?:
|
|
2
|
+
export declare const useBlurOnMouseDown: (userLandCallback?: MouseEventHandler<HTMLElement> | undefined) => MouseEventHandler<HTMLElement>;
|
|
@@ -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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/menu",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
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.3.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": "
|
|
69
|
+
"typescript": "4.2.4"
|
|
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
|
}
|