@atlaskit/progress-indicator 9.4.4 → 9.4.6
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 +12 -0
- package/dist/cjs/components/appearances.js +0 -5
- package/dist/cjs/components/indicator.js +6 -14
- package/dist/cjs/components/progress-dots.js +26 -50
- package/dist/cjs/index.js +0 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/indicator.js +6 -6
- package/dist/es2019/components/progress-dots.js +10 -14
- package/dist/es2019/index.js +1 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/indicator.js +6 -6
- package/dist/esm/components/progress-dots.js +25 -33
- package/dist/esm/index.js +1 -0
- package/dist/esm/version.json +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/progress-indicator
|
|
2
2
|
|
|
3
|
+
## 9.4.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 9.4.5
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`18aeca8c199`](https://bitbucket.org/atlassian/atlassian-frontend/commits/18aeca8c199) - Internal change to update token references. There is no expected behaviour or visual change.
|
|
14
|
+
|
|
3
15
|
## 9.4.4
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getBgColor = void 0;
|
|
7
|
-
|
|
8
7
|
var _colors = require("@atlaskit/theme/colors");
|
|
9
|
-
|
|
10
8
|
var _components = require("@atlaskit/theme/components");
|
|
11
|
-
|
|
12
9
|
// TODO Token usages are not consistent for dots https://product-fabric.atlassian.net/browse/DSP-3180
|
|
13
10
|
var colorMap = {
|
|
14
11
|
default: (0, _components.themed)({
|
|
@@ -46,9 +43,7 @@ var selectedColorMap = {
|
|
|
46
43
|
dark: "var(--ds-icon-brand, ".concat(_colors.B100, ")")
|
|
47
44
|
})
|
|
48
45
|
};
|
|
49
|
-
|
|
50
46
|
var getBgColor = function getBgColor(appearance, isSelected) {
|
|
51
47
|
return isSelected ? selectedColorMap[appearance] : colorMap[appearance];
|
|
52
48
|
};
|
|
53
|
-
|
|
54
49
|
exports.getBgColor = getBgColor;
|
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.PresentationalIndicator = exports.ButtonIndicator = void 0;
|
|
9
|
-
|
|
10
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
9
|
var _react = require("@emotion/react");
|
|
13
|
-
|
|
14
10
|
var _focusRing = _interopRequireDefault(require("@atlaskit/focus-ring"));
|
|
15
|
-
|
|
16
11
|
var _constants = require("./constants");
|
|
17
|
-
|
|
18
12
|
/* eslint-disable @repo/internal/react/use-primitives */
|
|
19
|
-
|
|
20
13
|
/** @jsx jsx */
|
|
14
|
+
|
|
21
15
|
var commonStyles = (0, _react.css)({
|
|
22
16
|
width: "var(".concat(_constants.varDotsSize, ")"),
|
|
23
17
|
height: "var(".concat(_constants.varDotsSize, ")"),
|
|
@@ -34,33 +28,32 @@ var commonStyles = (0, _react.css)({
|
|
|
34
28
|
}
|
|
35
29
|
});
|
|
36
30
|
var buttonStyles = (0, _react.css)({
|
|
37
|
-
padding: "var(--ds-
|
|
31
|
+
padding: "var(--ds-space-0, 0px)",
|
|
38
32
|
border: 0,
|
|
39
33
|
cursor: 'pointer',
|
|
40
34
|
outline: 0
|
|
41
35
|
});
|
|
36
|
+
|
|
42
37
|
/**
|
|
43
38
|
* __Presentational indicator__
|
|
44
39
|
*
|
|
45
40
|
* A presentational indicator with no interactivity
|
|
46
41
|
*/
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
var PresentationalIndicator = function PresentationalIndicator(props
|
|
43
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
49
44
|
) {
|
|
50
45
|
return (0, _react.jsx)("div", (0, _extends2.default)({}, props, {
|
|
51
46
|
css: commonStyles,
|
|
52
47
|
role: "presentation"
|
|
53
48
|
}));
|
|
54
49
|
};
|
|
50
|
+
|
|
55
51
|
/**
|
|
56
52
|
* __Button indicator__
|
|
57
53
|
*
|
|
58
54
|
* An interactive indicator.
|
|
59
55
|
*/
|
|
60
|
-
|
|
61
|
-
|
|
62
56
|
exports.PresentationalIndicator = PresentationalIndicator;
|
|
63
|
-
|
|
64
57
|
var ButtonIndicator = function ButtonIndicator(props) {
|
|
65
58
|
return (0, _react.jsx)(_focusRing.default, null, (0, _react.jsx)("button", (0, _extends2.default)({}, props, {
|
|
66
59
|
role: "tab",
|
|
@@ -68,5 +61,4 @@ var ButtonIndicator = function ButtonIndicator(props) {
|
|
|
68
61
|
css: [commonStyles, buttonStyles]
|
|
69
62
|
})));
|
|
70
63
|
};
|
|
71
|
-
|
|
72
64
|
exports.ButtonIndicator = ButtonIndicator;
|
|
@@ -1,70 +1,52 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.default = void 0;
|
|
11
|
-
|
|
12
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
-
|
|
14
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
-
|
|
16
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
-
|
|
18
12
|
var _react2 = require("@emotion/react");
|
|
19
|
-
|
|
20
13
|
var _bindEventListener = require("bind-event-listener");
|
|
21
|
-
|
|
22
14
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
23
|
-
|
|
24
15
|
var _box = _interopRequireDefault(require("@atlaskit/ds-explorations/box"));
|
|
25
|
-
|
|
26
16
|
var _inline = _interopRequireDefault(require("@atlaskit/ds-explorations/inline"));
|
|
27
|
-
|
|
28
17
|
var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
|
|
29
|
-
|
|
30
18
|
var _components = require("@atlaskit/theme/components");
|
|
31
|
-
|
|
32
19
|
var _appearances = require("./appearances");
|
|
33
|
-
|
|
34
20
|
var _constants = require("./constants");
|
|
35
|
-
|
|
36
21
|
var _indicator = require("./indicator");
|
|
37
|
-
|
|
38
22
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
39
|
-
|
|
40
23
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
41
|
-
|
|
42
24
|
/** @jsx jsx */
|
|
25
|
+
|
|
43
26
|
var packageName = "@atlaskit/progress-indicator";
|
|
44
|
-
var packageVersion = "9.4.
|
|
27
|
+
var packageVersion = "9.4.6";
|
|
28
|
+
|
|
45
29
|
/**
|
|
46
30
|
* __ProgressDots__
|
|
47
31
|
*
|
|
48
32
|
* A progress indicator shows the user where they are along the steps of a journey.
|
|
49
33
|
*/
|
|
50
|
-
|
|
51
34
|
var ProgressDots = function ProgressDots(_ref) {
|
|
52
35
|
var _ref2;
|
|
53
|
-
|
|
54
36
|
var _ref$appearance = _ref.appearance,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
37
|
+
appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
|
|
38
|
+
_ref$ariaControls = _ref.ariaControls,
|
|
39
|
+
ariaControls = _ref$ariaControls === void 0 ? 'panel' : _ref$ariaControls,
|
|
40
|
+
_ref$ariaLabel = _ref.ariaLabel,
|
|
41
|
+
ariaLabel = _ref$ariaLabel === void 0 ? 'tab' : _ref$ariaLabel,
|
|
42
|
+
_ref$size = _ref.size,
|
|
43
|
+
size = _ref$size === void 0 ? 'default' : _ref$size,
|
|
44
|
+
_ref$spacing = _ref.spacing,
|
|
45
|
+
gutter = _ref$spacing === void 0 ? 'comfortable' : _ref$spacing,
|
|
46
|
+
selectedIndex = _ref.selectedIndex,
|
|
47
|
+
testId = _ref.testId,
|
|
48
|
+
values = _ref.values,
|
|
49
|
+
onSelect = _ref.onSelect;
|
|
68
50
|
var tablistRef = (0, _react.useRef)(null);
|
|
69
51
|
var onSelectWithAnalytics = (0, _analyticsNext.usePlatformLeafEventHandler)({
|
|
70
52
|
fn: onSelect || _noop.default,
|
|
@@ -73,43 +55,39 @@ var ProgressDots = function ProgressDots(_ref) {
|
|
|
73
55
|
packageName: packageName,
|
|
74
56
|
packageVersion: packageVersion
|
|
75
57
|
});
|
|
76
|
-
|
|
77
58
|
var _progressIndicatorGap = (0, _slicedToArray2.default)(_constants.progressIndicatorGapMap[gutter][size], 2),
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
59
|
+
inlineGapValue = _progressIndicatorGap[0],
|
|
60
|
+
rawGapValue = _progressIndicatorGap[1];
|
|
81
61
|
var handleKeyDown = (0, _react.useCallback)(function (event) {
|
|
82
|
-
var indicators = Array.from(tablistRef.current.children);
|
|
62
|
+
var indicators = Array.from(tablistRef.current.children);
|
|
83
63
|
|
|
64
|
+
// bail if the target isn't an indicator
|
|
84
65
|
if (!indicators.includes(event.target)) {
|
|
85
66
|
return;
|
|
86
|
-
}
|
|
87
|
-
|
|
67
|
+
}
|
|
88
68
|
|
|
69
|
+
// bail if not valid arrow key
|
|
89
70
|
var isLeft = event.key === 'ArrowLeft';
|
|
90
71
|
var isRight = event.key === 'ArrowRight';
|
|
91
|
-
|
|
92
72
|
if (!isLeft && !isRight) {
|
|
93
73
|
return;
|
|
94
|
-
}
|
|
95
|
-
|
|
74
|
+
}
|
|
96
75
|
|
|
76
|
+
// bail if at either end of the values
|
|
97
77
|
var isAlpha = isLeft && selectedIndex === 0;
|
|
98
78
|
var isOmega = isRight && selectedIndex === values.length - 1;
|
|
99
|
-
|
|
100
79
|
if (isAlpha || isOmega) {
|
|
101
80
|
return;
|
|
102
81
|
}
|
|
82
|
+
var index = isLeft ? selectedIndex - 1 : selectedIndex + 1;
|
|
103
83
|
|
|
104
|
-
|
|
105
|
-
|
|
84
|
+
// call the consumer's select method and focus the applicable indicator
|
|
106
85
|
if (onSelect) {
|
|
107
86
|
onSelectWithAnalytics({
|
|
108
87
|
event: event,
|
|
109
88
|
index: index
|
|
110
89
|
});
|
|
111
90
|
}
|
|
112
|
-
|
|
113
91
|
if (typeof indicators[index].focus === 'function') {
|
|
114
92
|
indicators[index].focus();
|
|
115
93
|
}
|
|
@@ -118,7 +96,6 @@ var ProgressDots = function ProgressDots(_ref) {
|
|
|
118
96
|
if (!onSelect) {
|
|
119
97
|
return _noop.default;
|
|
120
98
|
}
|
|
121
|
-
|
|
122
99
|
return (0, _bindEventListener.bind)(document, {
|
|
123
100
|
type: 'keydown',
|
|
124
101
|
listener: handleKeyDown,
|
|
@@ -172,6 +149,5 @@ var ProgressDots = function ProgressDots(_ref) {
|
|
|
172
149
|
});
|
|
173
150
|
})));
|
|
174
151
|
};
|
|
175
|
-
|
|
176
152
|
var _default = ProgressDots;
|
|
177
153
|
exports.default = _default;
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
@@ -11,5 +10,4 @@ Object.defineProperty(exports, "ProgressIndicator", {
|
|
|
11
10
|
return _progressDots.default;
|
|
12
11
|
}
|
|
13
12
|
});
|
|
14
|
-
|
|
15
13
|
var _progressDots = _interopRequireDefault(require("./components/progress-dots"));
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
2
|
/* eslint-disable @repo/internal/react/use-primitives */
|
|
4
|
-
|
|
5
3
|
/** @jsx jsx */
|
|
4
|
+
|
|
6
5
|
import { css, jsx } from '@emotion/react';
|
|
7
6
|
import FocusRing from '@atlaskit/focus-ring';
|
|
8
7
|
import { varDotsMargin, varDotsSize } from './constants';
|
|
@@ -22,28 +21,29 @@ const commonStyles = css({
|
|
|
22
21
|
}
|
|
23
22
|
});
|
|
24
23
|
const buttonStyles = css({
|
|
25
|
-
padding: "var(--ds-
|
|
24
|
+
padding: "var(--ds-space-0, 0px)",
|
|
26
25
|
border: 0,
|
|
27
26
|
cursor: 'pointer',
|
|
28
27
|
outline: 0
|
|
29
28
|
});
|
|
29
|
+
|
|
30
30
|
/**
|
|
31
31
|
* __Presentational indicator__
|
|
32
32
|
*
|
|
33
33
|
* A presentational indicator with no interactivity
|
|
34
34
|
*/
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
export const PresentationalIndicator = (props
|
|
36
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
37
37
|
) => jsx("div", _extends({}, props, {
|
|
38
38
|
css: commonStyles,
|
|
39
39
|
role: "presentation"
|
|
40
40
|
}));
|
|
41
|
+
|
|
41
42
|
/**
|
|
42
43
|
* __Button indicator__
|
|
43
44
|
*
|
|
44
45
|
* An interactive indicator.
|
|
45
46
|
*/
|
|
46
|
-
|
|
47
47
|
export const ButtonIndicator = props => {
|
|
48
48
|
return jsx(FocusRing, null, jsx("button", _extends({}, props, {
|
|
49
49
|
role: "tab",
|
|
@@ -11,13 +11,13 @@ import { getBgColor } from './appearances';
|
|
|
11
11
|
import { progressIndicatorGapMap, sizes, varDotsMargin, varDotsSize } from './constants';
|
|
12
12
|
import { ButtonIndicator, PresentationalIndicator } from './indicator';
|
|
13
13
|
const packageName = "@atlaskit/progress-indicator";
|
|
14
|
-
const packageVersion = "9.4.
|
|
14
|
+
const packageVersion = "9.4.6";
|
|
15
|
+
|
|
15
16
|
/**
|
|
16
17
|
* __ProgressDots__
|
|
17
18
|
*
|
|
18
19
|
* A progress indicator shows the user where they are along the steps of a journey.
|
|
19
20
|
*/
|
|
20
|
-
|
|
21
21
|
const ProgressDots = ({
|
|
22
22
|
appearance = 'default',
|
|
23
23
|
ariaControls = 'panel',
|
|
@@ -41,37 +41,35 @@ const ProgressDots = ({
|
|
|
41
41
|
});
|
|
42
42
|
const [inlineGapValue, rawGapValue] = progressIndicatorGapMap[gutter][size];
|
|
43
43
|
const handleKeyDown = useCallback(event => {
|
|
44
|
-
const indicators = Array.from(tablistRef.current.children);
|
|
44
|
+
const indicators = Array.from(tablistRef.current.children);
|
|
45
45
|
|
|
46
|
+
// bail if the target isn't an indicator
|
|
46
47
|
if (!indicators.includes(event.target)) {
|
|
47
48
|
return;
|
|
48
|
-
}
|
|
49
|
-
|
|
49
|
+
}
|
|
50
50
|
|
|
51
|
+
// bail if not valid arrow key
|
|
51
52
|
const isLeft = event.key === 'ArrowLeft';
|
|
52
53
|
const isRight = event.key === 'ArrowRight';
|
|
53
|
-
|
|
54
54
|
if (!isLeft && !isRight) {
|
|
55
55
|
return;
|
|
56
|
-
}
|
|
57
|
-
|
|
56
|
+
}
|
|
58
57
|
|
|
58
|
+
// bail if at either end of the values
|
|
59
59
|
const isAlpha = isLeft && selectedIndex === 0;
|
|
60
60
|
const isOmega = isRight && selectedIndex === values.length - 1;
|
|
61
|
-
|
|
62
61
|
if (isAlpha || isOmega) {
|
|
63
62
|
return;
|
|
64
63
|
}
|
|
64
|
+
const index = isLeft ? selectedIndex - 1 : selectedIndex + 1;
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
// call the consumer's select method and focus the applicable indicator
|
|
68
67
|
if (onSelect) {
|
|
69
68
|
onSelectWithAnalytics({
|
|
70
69
|
event: event,
|
|
71
70
|
index
|
|
72
71
|
});
|
|
73
72
|
}
|
|
74
|
-
|
|
75
73
|
if (typeof indicators[index].focus === 'function') {
|
|
76
74
|
indicators[index].focus();
|
|
77
75
|
}
|
|
@@ -80,7 +78,6 @@ const ProgressDots = ({
|
|
|
80
78
|
if (!onSelect) {
|
|
81
79
|
return noop;
|
|
82
80
|
}
|
|
83
|
-
|
|
84
81
|
return bind(document, {
|
|
85
82
|
type: 'keydown',
|
|
86
83
|
listener: handleKeyDown,
|
|
@@ -135,5 +132,4 @@ const ProgressDots = ({
|
|
|
135
132
|
});
|
|
136
133
|
})));
|
|
137
134
|
};
|
|
138
|
-
|
|
139
135
|
export default ProgressDots;
|
package/dist/es2019/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// NOTE: more progress indicator variants will be available in the future;
|
|
2
2
|
// having a single named export will avoid consumers having to update their
|
|
3
3
|
// imports when there's a feature release.
|
|
4
|
+
|
|
4
5
|
// eslint-disable-next-line import/prefer-default-export
|
|
5
6
|
export { default as ProgressIndicator } from './components/progress-dots';
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
2
|
/* eslint-disable @repo/internal/react/use-primitives */
|
|
4
|
-
|
|
5
3
|
/** @jsx jsx */
|
|
4
|
+
|
|
6
5
|
import { css, jsx } from '@emotion/react';
|
|
7
6
|
import FocusRing from '@atlaskit/focus-ring';
|
|
8
7
|
import { varDotsMargin, varDotsSize } from './constants';
|
|
@@ -22,30 +21,31 @@ var commonStyles = css({
|
|
|
22
21
|
}
|
|
23
22
|
});
|
|
24
23
|
var buttonStyles = css({
|
|
25
|
-
padding: "var(--ds-
|
|
24
|
+
padding: "var(--ds-space-0, 0px)",
|
|
26
25
|
border: 0,
|
|
27
26
|
cursor: 'pointer',
|
|
28
27
|
outline: 0
|
|
29
28
|
});
|
|
29
|
+
|
|
30
30
|
/**
|
|
31
31
|
* __Presentational indicator__
|
|
32
32
|
*
|
|
33
33
|
* A presentational indicator with no interactivity
|
|
34
34
|
*/
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
export var PresentationalIndicator = function PresentationalIndicator(props
|
|
36
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
37
37
|
) {
|
|
38
38
|
return jsx("div", _extends({}, props, {
|
|
39
39
|
css: commonStyles,
|
|
40
40
|
role: "presentation"
|
|
41
41
|
}));
|
|
42
42
|
};
|
|
43
|
+
|
|
43
44
|
/**
|
|
44
45
|
* __Button indicator__
|
|
45
46
|
*
|
|
46
47
|
* An interactive indicator.
|
|
47
48
|
*/
|
|
48
|
-
|
|
49
49
|
export var ButtonIndicator = function ButtonIndicator(props) {
|
|
50
50
|
return jsx(FocusRing, null, jsx("button", _extends({}, props, {
|
|
51
51
|
role: "tab",
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
-
|
|
4
3
|
/** @jsx jsx */
|
|
5
4
|
import React, { useCallback, useEffect, useRef } from 'react';
|
|
6
5
|
import { jsx } from '@emotion/react';
|
|
@@ -14,30 +13,29 @@ import { getBgColor } from './appearances';
|
|
|
14
13
|
import { progressIndicatorGapMap, sizes, varDotsMargin, varDotsSize } from './constants';
|
|
15
14
|
import { ButtonIndicator, PresentationalIndicator } from './indicator';
|
|
16
15
|
var packageName = "@atlaskit/progress-indicator";
|
|
17
|
-
var packageVersion = "9.4.
|
|
16
|
+
var packageVersion = "9.4.6";
|
|
17
|
+
|
|
18
18
|
/**
|
|
19
19
|
* __ProgressDots__
|
|
20
20
|
*
|
|
21
21
|
* A progress indicator shows the user where they are along the steps of a journey.
|
|
22
22
|
*/
|
|
23
|
-
|
|
24
23
|
var ProgressDots = function ProgressDots(_ref) {
|
|
25
24
|
var _ref2;
|
|
26
|
-
|
|
27
25
|
var _ref$appearance = _ref.appearance,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
26
|
+
appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
|
|
27
|
+
_ref$ariaControls = _ref.ariaControls,
|
|
28
|
+
ariaControls = _ref$ariaControls === void 0 ? 'panel' : _ref$ariaControls,
|
|
29
|
+
_ref$ariaLabel = _ref.ariaLabel,
|
|
30
|
+
ariaLabel = _ref$ariaLabel === void 0 ? 'tab' : _ref$ariaLabel,
|
|
31
|
+
_ref$size = _ref.size,
|
|
32
|
+
size = _ref$size === void 0 ? 'default' : _ref$size,
|
|
33
|
+
_ref$spacing = _ref.spacing,
|
|
34
|
+
gutter = _ref$spacing === void 0 ? 'comfortable' : _ref$spacing,
|
|
35
|
+
selectedIndex = _ref.selectedIndex,
|
|
36
|
+
testId = _ref.testId,
|
|
37
|
+
values = _ref.values,
|
|
38
|
+
onSelect = _ref.onSelect;
|
|
41
39
|
var tablistRef = useRef(null);
|
|
42
40
|
var onSelectWithAnalytics = usePlatformLeafEventHandler({
|
|
43
41
|
fn: onSelect || noop,
|
|
@@ -46,43 +44,39 @@ var ProgressDots = function ProgressDots(_ref) {
|
|
|
46
44
|
packageName: packageName,
|
|
47
45
|
packageVersion: packageVersion
|
|
48
46
|
});
|
|
49
|
-
|
|
50
47
|
var _progressIndicatorGap = _slicedToArray(progressIndicatorGapMap[gutter][size], 2),
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
inlineGapValue = _progressIndicatorGap[0],
|
|
49
|
+
rawGapValue = _progressIndicatorGap[1];
|
|
54
50
|
var handleKeyDown = useCallback(function (event) {
|
|
55
|
-
var indicators = Array.from(tablistRef.current.children);
|
|
51
|
+
var indicators = Array.from(tablistRef.current.children);
|
|
56
52
|
|
|
53
|
+
// bail if the target isn't an indicator
|
|
57
54
|
if (!indicators.includes(event.target)) {
|
|
58
55
|
return;
|
|
59
|
-
}
|
|
60
|
-
|
|
56
|
+
}
|
|
61
57
|
|
|
58
|
+
// bail if not valid arrow key
|
|
62
59
|
var isLeft = event.key === 'ArrowLeft';
|
|
63
60
|
var isRight = event.key === 'ArrowRight';
|
|
64
|
-
|
|
65
61
|
if (!isLeft && !isRight) {
|
|
66
62
|
return;
|
|
67
|
-
}
|
|
68
|
-
|
|
63
|
+
}
|
|
69
64
|
|
|
65
|
+
// bail if at either end of the values
|
|
70
66
|
var isAlpha = isLeft && selectedIndex === 0;
|
|
71
67
|
var isOmega = isRight && selectedIndex === values.length - 1;
|
|
72
|
-
|
|
73
68
|
if (isAlpha || isOmega) {
|
|
74
69
|
return;
|
|
75
70
|
}
|
|
71
|
+
var index = isLeft ? selectedIndex - 1 : selectedIndex + 1;
|
|
76
72
|
|
|
77
|
-
|
|
78
|
-
|
|
73
|
+
// call the consumer's select method and focus the applicable indicator
|
|
79
74
|
if (onSelect) {
|
|
80
75
|
onSelectWithAnalytics({
|
|
81
76
|
event: event,
|
|
82
77
|
index: index
|
|
83
78
|
});
|
|
84
79
|
}
|
|
85
|
-
|
|
86
80
|
if (typeof indicators[index].focus === 'function') {
|
|
87
81
|
indicators[index].focus();
|
|
88
82
|
}
|
|
@@ -91,7 +85,6 @@ var ProgressDots = function ProgressDots(_ref) {
|
|
|
91
85
|
if (!onSelect) {
|
|
92
86
|
return noop;
|
|
93
87
|
}
|
|
94
|
-
|
|
95
88
|
return bind(document, {
|
|
96
89
|
type: 'keydown',
|
|
97
90
|
listener: handleKeyDown,
|
|
@@ -145,5 +138,4 @@ var ProgressDots = function ProgressDots(_ref) {
|
|
|
145
138
|
});
|
|
146
139
|
})));
|
|
147
140
|
};
|
|
148
|
-
|
|
149
141
|
export default ProgressDots;
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// NOTE: more progress indicator variants will be available in the future;
|
|
2
2
|
// having a single named export will avoid consumers having to update their
|
|
3
3
|
// imports when there's a feature release.
|
|
4
|
+
|
|
4
5
|
// eslint-disable-next-line import/prefer-default-export
|
|
5
6
|
export { default as ProgressIndicator } from './components/progress-dots';
|
package/dist/esm/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/progress-indicator",
|
|
3
|
-
"version": "9.4.
|
|
3
|
+
"version": "9.4.6",
|
|
4
4
|
"description": "A progress indicator shows the user where they are along the steps of a journey.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@atlaskit/ds-lib": "^2.1.0",
|
|
30
30
|
"@atlaskit/focus-ring": "^1.2.0",
|
|
31
31
|
"@atlaskit/theme": "^12.2.0",
|
|
32
|
-
"@atlaskit/tokens": "^0.
|
|
32
|
+
"@atlaskit/tokens": "^1.0.0",
|
|
33
33
|
"@babel/runtime": "^7.0.0",
|
|
34
34
|
"@emotion/react": "^11.7.1",
|
|
35
35
|
"bind-event-listener": "^2.1.1"
|