@atlaskit/progress-indicator 9.0.4 → 9.1.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 +32 -0
- package/codemods/{9.0.0-import-rename.ts → 9.0.0-import-rename.tsx} +9 -9
- package/codemods/__tests__/{9.0.0-import-rename.ts → 9.0.0-import-rename.tsx} +0 -0
- package/dist/cjs/components/appearances.js +54 -0
- package/dist/cjs/components/constants.js +22 -0
- package/dist/cjs/components/indicator.js +69 -0
- package/dist/cjs/components/progress-dots.js +164 -0
- package/dist/cjs/components/types.js +5 -0
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/types.js +5 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/appearances.js +40 -0
- package/dist/es2019/components/constants.js +12 -0
- package/dist/es2019/components/indicator.js +50 -0
- package/dist/es2019/components/progress-dots.js +135 -0
- package/dist/es2019/components/types.js +1 -0
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/types.js +1 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/appearances.js +42 -0
- package/dist/esm/components/constants.js +12 -0
- package/dist/esm/components/indicator.js +52 -0
- package/dist/esm/components/progress-dots.js +140 -0
- package/dist/esm/components/types.js +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/types.js +1 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/components/appearances.d.ts +2 -0
- package/dist/types/components/constants.d.ts +12 -0
- package/dist/types/components/indicator.d.ts +14 -0
- package/dist/types/components/progress-dots.d.ts +10 -0
- package/dist/types/components/types.d.ts +3 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/types.d.ts +44 -0
- package/package.json +29 -11
- package/types/package.json +7 -0
- package/dist/cjs/components/Dots.js +0 -197
- package/dist/cjs/styled/Dots.js +0 -174
- package/dist/es2019/components/Dots.js +0 -145
- package/dist/es2019/styled/Dots.js +0 -122
- package/dist/esm/components/Dots.js +0 -178
- package/dist/esm/styled/Dots.js +0 -151
- package/dist/types/components/Dots.d.ts +0 -51
- package/dist/types/styled/Dots.d.ts +0 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# @atlaskit/progress-indicator
|
|
2
2
|
|
|
3
|
+
## 9.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`2b2290121eb`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2b2290121eb) - Raised the minimum version carat range of focus ring to latest.
|
|
8
|
+
|
|
9
|
+
## 9.1.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`7d89d624097`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7d89d624097) - Fix for focus being incorrectly retained when indicators were not interactive.
|
|
14
|
+
|
|
15
|
+
## 9.1.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- [`947ba5b11f0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/947ba5b11f0) - The component has undergone an internal refactor. The following changes need to be called out:
|
|
20
|
+
|
|
21
|
+
- `styled-components` has been removed from the package in favour of `@emotion/core`.
|
|
22
|
+
- The component now supports a `testId` prop in line with other Design System components. This can be used for automated testing.
|
|
23
|
+
- Focus ring colors have been normalised to be the same across all appearance types of the component.
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Updated dependencies
|
|
28
|
+
|
|
29
|
+
## 9.0.5
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- [`378d1cef00f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/378d1cef00f) - Bump `@atlaskit/theme` to version `^11.3.0`.
|
|
34
|
+
|
|
3
35
|
## 9.0.4
|
|
4
36
|
|
|
5
37
|
### Patch Changes
|
|
@@ -7,7 +7,7 @@ function hasImportDeclaration(
|
|
|
7
7
|
) {
|
|
8
8
|
return !!source
|
|
9
9
|
.find(j.ImportDeclaration)
|
|
10
|
-
.filter(path => path.node.source.value === importPath).length;
|
|
10
|
+
.filter((path) => path.node.source.value === importPath).length;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
function hasNameImport(
|
|
@@ -19,7 +19,7 @@ function hasNameImport(
|
|
|
19
19
|
.find(j.ImportDeclaration)
|
|
20
20
|
.find(j.ImportSpecifier)
|
|
21
21
|
.find(j.Identifier)
|
|
22
|
-
.filter(identifier => identifier!.value!.name === importName).length;
|
|
22
|
+
.filter((identifier) => identifier!.value!.name === importName).length;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
function hasVariableAlreadyDeclared(
|
|
@@ -31,7 +31,7 @@ function hasVariableAlreadyDeclared(
|
|
|
31
31
|
.find(j.VariableDeclaration)
|
|
32
32
|
.find(j.VariableDeclarator)
|
|
33
33
|
.find(j.Identifier)
|
|
34
|
-
.filter(identifier => identifier!.value!.name === variableName).length;
|
|
34
|
+
.filter((identifier) => identifier!.value!.name === variableName).length;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
export default function transformer(
|
|
@@ -46,7 +46,7 @@ export default function transformer(
|
|
|
46
46
|
source
|
|
47
47
|
.find(j.ImportDeclaration)
|
|
48
48
|
.find(j.Identifier)
|
|
49
|
-
.filter(identifier => identifier.value.name === 'ProgressDots')
|
|
49
|
+
.filter((identifier) => identifier.value.name === 'ProgressDots')
|
|
50
50
|
.replaceWith(j.identifier('ProgressIndicator'));
|
|
51
51
|
|
|
52
52
|
if (hasVariableAlreadyDeclared(j, source, 'ProgressIndicator')) {
|
|
@@ -54,7 +54,7 @@ export default function transformer(
|
|
|
54
54
|
.find(j.ImportDeclaration)
|
|
55
55
|
.find(j.ImportSpecifier)
|
|
56
56
|
.filter(
|
|
57
|
-
specifier => specifier!.node!.local!.name === 'ProgressIndicator',
|
|
57
|
+
(specifier) => specifier!.node!.local!.name === 'ProgressIndicator',
|
|
58
58
|
)
|
|
59
59
|
.find(j.Identifier)
|
|
60
60
|
.replaceWith(
|
|
@@ -67,22 +67,22 @@ export default function transformer(
|
|
|
67
67
|
source
|
|
68
68
|
.find(j.VariableDeclarator)
|
|
69
69
|
.find(j.Identifier)
|
|
70
|
-
.filter(identifier => identifier.value.name === 'ProgressDots')
|
|
70
|
+
.filter((identifier) => identifier.value.name === 'ProgressDots')
|
|
71
71
|
.replaceWith(j.identifier('AKProgressIndicator'));
|
|
72
72
|
|
|
73
73
|
source
|
|
74
74
|
.find(j.JSXIdentifier)
|
|
75
|
-
.filter(identifier => identifier.value.name === 'ProgressDots')
|
|
75
|
+
.filter((identifier) => identifier.value.name === 'ProgressDots')
|
|
76
76
|
.replaceWith(j.identifier('AKProgressIndicator'));
|
|
77
77
|
} else {
|
|
78
78
|
source
|
|
79
79
|
.find(j.VariableDeclarator)
|
|
80
80
|
.find(j.Identifier)
|
|
81
|
-
.filter(identifier => identifier.value.name === 'ProgressDots')
|
|
81
|
+
.filter((identifier) => identifier.value.name === 'ProgressDots')
|
|
82
82
|
.replaceWith(j.identifier('ProgressIndicator'));
|
|
83
83
|
source
|
|
84
84
|
.find(j.JSXIdentifier)
|
|
85
|
-
.filter(identifier => identifier.value.name === 'ProgressDots')
|
|
85
|
+
.filter((identifier) => identifier.value.name === 'ProgressDots')
|
|
86
86
|
.replaceWith(j.identifier('ProgressIndicator'));
|
|
87
87
|
}
|
|
88
88
|
}
|
|
File without changes
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getBgColor = void 0;
|
|
7
|
+
|
|
8
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
9
|
+
|
|
10
|
+
var _components = require("@atlaskit/theme/components");
|
|
11
|
+
|
|
12
|
+
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
13
|
+
var colorMap = {
|
|
14
|
+
default: (0, _components.themed)({
|
|
15
|
+
light: _colors.N50,
|
|
16
|
+
dark: _colors.DN70
|
|
17
|
+
}),
|
|
18
|
+
help: (0, _components.themed)({
|
|
19
|
+
light: _colors.P75,
|
|
20
|
+
dark: _colors.DN70
|
|
21
|
+
}),
|
|
22
|
+
inverted: (0, _components.themed)({
|
|
23
|
+
light: 'rgba(255, 255, 255, 0.4)',
|
|
24
|
+
dark: _colors.DN300A
|
|
25
|
+
}),
|
|
26
|
+
primary: (0, _components.themed)({
|
|
27
|
+
light: _colors.B75,
|
|
28
|
+
dark: _colors.DN70
|
|
29
|
+
})
|
|
30
|
+
};
|
|
31
|
+
var selectedColorMap = {
|
|
32
|
+
default: (0, _components.themed)({
|
|
33
|
+
light: _colors.N900,
|
|
34
|
+
dark: _colors.DN600
|
|
35
|
+
}),
|
|
36
|
+
help: (0, _components.themed)({
|
|
37
|
+
light: _colors.P400,
|
|
38
|
+
dark: _colors.P300
|
|
39
|
+
}),
|
|
40
|
+
inverted: (0, _components.themed)({
|
|
41
|
+
light: _colors.N0,
|
|
42
|
+
dark: _colors.DN30
|
|
43
|
+
}),
|
|
44
|
+
primary: (0, _components.themed)({
|
|
45
|
+
light: _colors.B400,
|
|
46
|
+
dark: _colors.B100
|
|
47
|
+
})
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
var getBgColor = function getBgColor(appearance, isSelected) {
|
|
51
|
+
return isSelected ? selectedColorMap[appearance] : colorMap[appearance];
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
exports.getBgColor = getBgColor;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.varDotsMargin = exports.varDotsSize = exports.spacingDivision = exports.sizes = void 0;
|
|
7
|
+
var sizes = {
|
|
8
|
+
small: 4,
|
|
9
|
+
default: 8,
|
|
10
|
+
large: 12
|
|
11
|
+
};
|
|
12
|
+
exports.sizes = sizes;
|
|
13
|
+
var spacingDivision = {
|
|
14
|
+
comfortable: 1,
|
|
15
|
+
cozy: 2,
|
|
16
|
+
compact: 4
|
|
17
|
+
};
|
|
18
|
+
exports.spacingDivision = spacingDivision;
|
|
19
|
+
var varDotsSize = '--ds-dots-size';
|
|
20
|
+
exports.varDotsSize = varDotsSize;
|
|
21
|
+
var varDotsMargin = '--ds-dots-margin';
|
|
22
|
+
exports.varDotsMargin = varDotsMargin;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.ButtonIndicator = exports.PresentationalIndicator = void 0;
|
|
9
|
+
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
|
|
12
|
+
var _core = require("@emotion/core");
|
|
13
|
+
|
|
14
|
+
var _focusRing = _interopRequireDefault(require("@atlaskit/focus-ring"));
|
|
15
|
+
|
|
16
|
+
var _constants = require("./constants");
|
|
17
|
+
|
|
18
|
+
/** @jsx jsx */
|
|
19
|
+
var commonStyles = (0, _core.css)({
|
|
20
|
+
width: "var(".concat(_constants.varDotsSize, ")"),
|
|
21
|
+
height: "var(".concat(_constants.varDotsSize, ")"),
|
|
22
|
+
position: 'relative',
|
|
23
|
+
borderRadius: '50%',
|
|
24
|
+
'&::before': {
|
|
25
|
+
display: 'block',
|
|
26
|
+
width: "calc(var(".concat(_constants.varDotsSize, ") + var(").concat(_constants.varDotsMargin, "))"),
|
|
27
|
+
height: "calc(var(".concat(_constants.varDotsSize, ") + var(").concat(_constants.varDotsMargin, "))"),
|
|
28
|
+
position: 'absolute',
|
|
29
|
+
top: "calc(-1 * var(".concat(_constants.varDotsMargin, ") / 2)"),
|
|
30
|
+
left: "calc(-1 * var(".concat(_constants.varDotsMargin, ") / 2)"),
|
|
31
|
+
content: '""'
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
var buttonStyles = (0, _core.css)({
|
|
35
|
+
padding: 0,
|
|
36
|
+
border: 0,
|
|
37
|
+
cursor: 'pointer',
|
|
38
|
+
outline: 0
|
|
39
|
+
});
|
|
40
|
+
/**
|
|
41
|
+
* __Presentational indicator__
|
|
42
|
+
*
|
|
43
|
+
* A presentational indicator with no interactivity
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
var PresentationalIndicator = function PresentationalIndicator(props) {
|
|
47
|
+
return (0, _core.jsx)("div", (0, _extends2.default)({}, props, {
|
|
48
|
+
css: commonStyles,
|
|
49
|
+
role: "presentation"
|
|
50
|
+
}));
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* __Button indicator__
|
|
54
|
+
*
|
|
55
|
+
* An interactive indicator.
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
exports.PresentationalIndicator = PresentationalIndicator;
|
|
60
|
+
|
|
61
|
+
var ButtonIndicator = function ButtonIndicator(props) {
|
|
62
|
+
return (0, _core.jsx)(_focusRing.default, null, (0, _core.jsx)("button", (0, _extends2.default)({}, props, {
|
|
63
|
+
role: "tab",
|
|
64
|
+
type: "button",
|
|
65
|
+
css: [commonStyles, buttonStyles]
|
|
66
|
+
})));
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
exports.ButtonIndicator = ButtonIndicator;
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.default = void 0;
|
|
11
|
+
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
+
|
|
16
|
+
var _core = require("@emotion/core");
|
|
17
|
+
|
|
18
|
+
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
19
|
+
|
|
20
|
+
var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
|
|
21
|
+
|
|
22
|
+
var _components = require("@atlaskit/theme/components");
|
|
23
|
+
|
|
24
|
+
var _appearances = require("./appearances");
|
|
25
|
+
|
|
26
|
+
var _constants = require("./constants");
|
|
27
|
+
|
|
28
|
+
var _indicator = require("./indicator");
|
|
29
|
+
|
|
30
|
+
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); }
|
|
31
|
+
|
|
32
|
+
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; }
|
|
33
|
+
|
|
34
|
+
/** @jsx jsx */
|
|
35
|
+
var packageName = "@atlaskit/progress-indicator";
|
|
36
|
+
var packageVersion = "9.1.2";
|
|
37
|
+
var containerStyles = (0, _core.css)({
|
|
38
|
+
display: 'flex',
|
|
39
|
+
justifyContent: 'center',
|
|
40
|
+
gap: "var(".concat(_constants.varDotsMargin, ")")
|
|
41
|
+
});
|
|
42
|
+
/**
|
|
43
|
+
* __ProgressDots__
|
|
44
|
+
*
|
|
45
|
+
* A progress indicator shows the user where they are along the steps of a journey.
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
var ProgressDots = function ProgressDots(_ref) {
|
|
49
|
+
var _ref2;
|
|
50
|
+
|
|
51
|
+
var _ref$appearance = _ref.appearance,
|
|
52
|
+
appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
|
|
53
|
+
_ref$ariaControls = _ref.ariaControls,
|
|
54
|
+
ariaControls = _ref$ariaControls === void 0 ? 'panel' : _ref$ariaControls,
|
|
55
|
+
_ref$ariaLabel = _ref.ariaLabel,
|
|
56
|
+
ariaLabel = _ref$ariaLabel === void 0 ? 'tab' : _ref$ariaLabel,
|
|
57
|
+
_ref$size = _ref.size,
|
|
58
|
+
size = _ref$size === void 0 ? 'default' : _ref$size,
|
|
59
|
+
_ref$spacing = _ref.spacing,
|
|
60
|
+
gutter = _ref$spacing === void 0 ? 'comfortable' : _ref$spacing,
|
|
61
|
+
selectedIndex = _ref.selectedIndex,
|
|
62
|
+
testId = _ref.testId,
|
|
63
|
+
values = _ref.values,
|
|
64
|
+
onSelect = _ref.onSelect;
|
|
65
|
+
var tablistRef = (0, _react.useRef)(null);
|
|
66
|
+
var onSelectWithAnalytics = (0, _analyticsNext.usePlatformLeafEventHandler)({
|
|
67
|
+
fn: onSelect || _noop.default,
|
|
68
|
+
action: 'selected',
|
|
69
|
+
componentName: 'progressIndicator',
|
|
70
|
+
packageName: packageName,
|
|
71
|
+
packageVersion: packageVersion
|
|
72
|
+
});
|
|
73
|
+
var handleKeyDown = (0, _react.useCallback)(function (event) {
|
|
74
|
+
var indicators = Array.from(tablistRef.current.children); // bail if the target isn't an indicator
|
|
75
|
+
|
|
76
|
+
if (!indicators.includes(event.target)) {
|
|
77
|
+
return;
|
|
78
|
+
} // bail if not valid arrow key
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
var isLeft = event.key === 'ArrowLeft';
|
|
82
|
+
var isRight = event.key === 'ArrowRight';
|
|
83
|
+
|
|
84
|
+
if (!isLeft && !isRight) {
|
|
85
|
+
return;
|
|
86
|
+
} // bail if at either end of the values
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
var isAlpha = isLeft && selectedIndex === 0;
|
|
90
|
+
var isOmega = isRight && selectedIndex === values.length - 1;
|
|
91
|
+
|
|
92
|
+
if (isAlpha || isOmega) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
var index = isLeft ? selectedIndex - 1 : selectedIndex + 1; // call the consumer's select method and focus the applicable indicator
|
|
97
|
+
|
|
98
|
+
if (onSelect) {
|
|
99
|
+
onSelectWithAnalytics({
|
|
100
|
+
event: event,
|
|
101
|
+
index: index
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (typeof indicators[index].focus === 'function') {
|
|
106
|
+
indicators[index].focus();
|
|
107
|
+
}
|
|
108
|
+
}, [onSelectWithAnalytics, selectedIndex, values, onSelect]);
|
|
109
|
+
(0, _react.useEffect)(function () {
|
|
110
|
+
if (onSelect) {
|
|
111
|
+
document.addEventListener('keydown', handleKeyDown, false);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return function () {
|
|
115
|
+
if (onSelect) {
|
|
116
|
+
document.removeEventListener('keydown', handleKeyDown);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}, [onSelect, handleKeyDown]);
|
|
120
|
+
var theme = (0, _components.useGlobalTheme)();
|
|
121
|
+
return (0, _core.jsx)("div", {
|
|
122
|
+
"data-testid": testId,
|
|
123
|
+
css: containerStyles,
|
|
124
|
+
style: (_ref2 = {}, (0, _defineProperty2.default)(_ref2, _constants.varDotsSize, "".concat(_constants.sizes[size], "px")), (0, _defineProperty2.default)(_ref2, _constants.varDotsMargin, "".concat(_constants.sizes[size] / _constants.spacingDivision[gutter], "px")), _ref2),
|
|
125
|
+
ref: function ref(r) {
|
|
126
|
+
tablistRef.current = r;
|
|
127
|
+
},
|
|
128
|
+
role: "tablist"
|
|
129
|
+
}, values.map(function (_, index) {
|
|
130
|
+
var isSelected = selectedIndex === index;
|
|
131
|
+
var tabId = "".concat(ariaLabel).concat(index);
|
|
132
|
+
var panelId = "".concat(ariaControls).concat(index);
|
|
133
|
+
var backgroundColor = (0, _appearances.getBgColor)(appearance, isSelected)({
|
|
134
|
+
theme: theme
|
|
135
|
+
});
|
|
136
|
+
return onSelect ? (0, _core.jsx)(_indicator.ButtonIndicator, {
|
|
137
|
+
key: index,
|
|
138
|
+
style: {
|
|
139
|
+
backgroundColor: backgroundColor
|
|
140
|
+
},
|
|
141
|
+
"aria-controls": panelId,
|
|
142
|
+
"aria-label": tabId,
|
|
143
|
+
"aria-selected": isSelected,
|
|
144
|
+
id: tabId,
|
|
145
|
+
onClick: function onClick(event) {
|
|
146
|
+
return onSelectWithAnalytics({
|
|
147
|
+
event: event,
|
|
148
|
+
index: index
|
|
149
|
+
});
|
|
150
|
+
},
|
|
151
|
+
tabIndex: isSelected ? 0 : -1,
|
|
152
|
+
"data-testid": testId && "".concat(testId, "-ind-").concat(index)
|
|
153
|
+
}) : (0, _core.jsx)(_indicator.PresentationalIndicator, {
|
|
154
|
+
"data-testid": testId && "".concat(testId, "-ind-").concat(index),
|
|
155
|
+
key: index,
|
|
156
|
+
style: {
|
|
157
|
+
backgroundColor: backgroundColor
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
}));
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
var _default = ProgressDots;
|
|
164
|
+
exports.default = _default;
|
package/dist/cjs/index.js
CHANGED
|
@@ -8,8 +8,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
Object.defineProperty(exports, "ProgressIndicator", {
|
|
9
9
|
enumerable: true,
|
|
10
10
|
get: function get() {
|
|
11
|
-
return
|
|
11
|
+
return _progressDots.default;
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _progressDots = _interopRequireDefault(require("./components/progress-dots"));
|
package/dist/cjs/version.json
CHANGED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
2
|
+
import { B100, B400, B75, DN30, DN300A, DN600, DN70, N0, N50, N900, P300, P400, P75 } from '@atlaskit/theme/colors';
|
|
3
|
+
import { themed } from '@atlaskit/theme/components';
|
|
4
|
+
const colorMap = {
|
|
5
|
+
default: themed({
|
|
6
|
+
light: N50,
|
|
7
|
+
dark: DN70
|
|
8
|
+
}),
|
|
9
|
+
help: themed({
|
|
10
|
+
light: P75,
|
|
11
|
+
dark: DN70
|
|
12
|
+
}),
|
|
13
|
+
inverted: themed({
|
|
14
|
+
light: 'rgba(255, 255, 255, 0.4)',
|
|
15
|
+
dark: DN300A
|
|
16
|
+
}),
|
|
17
|
+
primary: themed({
|
|
18
|
+
light: B75,
|
|
19
|
+
dark: DN70
|
|
20
|
+
})
|
|
21
|
+
};
|
|
22
|
+
const selectedColorMap = {
|
|
23
|
+
default: themed({
|
|
24
|
+
light: N900,
|
|
25
|
+
dark: DN600
|
|
26
|
+
}),
|
|
27
|
+
help: themed({
|
|
28
|
+
light: P400,
|
|
29
|
+
dark: P300
|
|
30
|
+
}),
|
|
31
|
+
inverted: themed({
|
|
32
|
+
light: N0,
|
|
33
|
+
dark: DN30
|
|
34
|
+
}),
|
|
35
|
+
primary: themed({
|
|
36
|
+
light: B400,
|
|
37
|
+
dark: B100
|
|
38
|
+
})
|
|
39
|
+
};
|
|
40
|
+
export const getBgColor = (appearance, isSelected) => isSelected ? selectedColorMap[appearance] : colorMap[appearance];
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import { css, jsx } from '@emotion/core';
|
|
5
|
+
import FocusRing from '@atlaskit/focus-ring';
|
|
6
|
+
import { varDotsMargin, varDotsSize } from './constants';
|
|
7
|
+
const commonStyles = css({
|
|
8
|
+
width: `var(${varDotsSize})`,
|
|
9
|
+
height: `var(${varDotsSize})`,
|
|
10
|
+
position: 'relative',
|
|
11
|
+
borderRadius: '50%',
|
|
12
|
+
'&::before': {
|
|
13
|
+
display: 'block',
|
|
14
|
+
width: `calc(var(${varDotsSize}) + var(${varDotsMargin}))`,
|
|
15
|
+
height: `calc(var(${varDotsSize}) + var(${varDotsMargin}))`,
|
|
16
|
+
position: 'absolute',
|
|
17
|
+
top: `calc(-1 * var(${varDotsMargin}) / 2)`,
|
|
18
|
+
left: `calc(-1 * var(${varDotsMargin}) / 2)`,
|
|
19
|
+
content: '""'
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const buttonStyles = css({
|
|
23
|
+
padding: 0,
|
|
24
|
+
border: 0,
|
|
25
|
+
cursor: 'pointer',
|
|
26
|
+
outline: 0
|
|
27
|
+
});
|
|
28
|
+
/**
|
|
29
|
+
* __Presentational indicator__
|
|
30
|
+
*
|
|
31
|
+
* A presentational indicator with no interactivity
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
export const PresentationalIndicator = props => jsx("div", _extends({}, props, {
|
|
35
|
+
css: commonStyles,
|
|
36
|
+
role: "presentation"
|
|
37
|
+
}));
|
|
38
|
+
/**
|
|
39
|
+
* __Button indicator__
|
|
40
|
+
*
|
|
41
|
+
* An interactive indicator.
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
export const ButtonIndicator = props => {
|
|
45
|
+
return jsx(FocusRing, null, jsx("button", _extends({}, props, {
|
|
46
|
+
role: "tab",
|
|
47
|
+
type: "button",
|
|
48
|
+
css: [commonStyles, buttonStyles]
|
|
49
|
+
})));
|
|
50
|
+
};
|