@atlaskit/progress-indicator 9.1.0 → 9.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/progress-indicator
2
2
 
3
+ ## 9.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`7d89d624097`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7d89d624097) - Fix for focus being incorrectly retained when indicators were not interactive.
8
+
3
9
  ## 9.1.0
4
10
 
5
11
  ### Minor Changes
@@ -11,9 +11,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
11
11
 
12
12
  var _core = require("@emotion/core");
13
13
 
14
- var _colors = require("@atlaskit/theme/colors");
15
-
16
- var _tokens = require("@atlaskit/tokens");
14
+ var _focusRing = _interopRequireDefault(require("@atlaskit/focus-ring"));
17
15
 
18
16
  var _constants = require("./constants");
19
17
 
@@ -37,10 +35,7 @@ var buttonStyles = (0, _core.css)({
37
35
  padding: 0,
38
36
  border: 0,
39
37
  cursor: 'pointer',
40
- outline: 0,
41
- '&:focus': {
42
- boxShadow: "0 0 0 2px ".concat((0, _tokens.token)('color.border.focus', _colors.B100))
43
- }
38
+ outline: 0
44
39
  });
45
40
  /**
46
41
  * __Presentational indicator__
@@ -64,11 +59,11 @@ var PresentationalIndicator = function PresentationalIndicator(props) {
64
59
  exports.PresentationalIndicator = PresentationalIndicator;
65
60
 
66
61
  var ButtonIndicator = function ButtonIndicator(props) {
67
- return (0, _core.jsx)("button", (0, _extends2.default)({}, props, {
62
+ return (0, _core.jsx)(_focusRing.default, null, (0, _core.jsx)("button", (0, _extends2.default)({}, props, {
68
63
  role: "tab",
69
64
  type: "button",
70
65
  css: [commonStyles, buttonStyles]
71
- }));
66
+ })));
72
67
  };
73
68
 
74
69
  exports.ButtonIndicator = ButtonIndicator;
@@ -7,7 +7,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
7
7
  Object.defineProperty(exports, "__esModule", {
8
8
  value: true
9
9
  });
10
- exports.default = exports.ProgressDotsWithoutAnalytics = void 0;
10
+ exports.default = void 0;
11
11
 
12
12
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
13
 
@@ -17,6 +17,8 @@ var _core = require("@emotion/core");
17
17
 
18
18
  var _analyticsNext = require("@atlaskit/analytics-next");
19
19
 
20
+ var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
21
+
20
22
  var _components = require("@atlaskit/theme/components");
21
23
 
22
24
  var _appearances = require("./appearances");
@@ -31,7 +33,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
31
33
 
32
34
  /** @jsx jsx */
33
35
  var packageName = "@atlaskit/progress-indicator";
34
- var packageVersion = "9.1.0";
36
+ var packageVersion = "9.1.1";
35
37
  var containerStyles = (0, _core.css)({
36
38
  display: 'flex',
37
39
  justifyContent: 'center',
@@ -61,6 +63,13 @@ var ProgressDots = function ProgressDots(_ref) {
61
63
  values = _ref.values,
62
64
  onSelect = _ref.onSelect;
63
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
+ });
64
73
  var handleKeyDown = (0, _react.useCallback)(function (event) {
65
74
  var indicators = Array.from(tablistRef.current.children); // bail if the target isn't an indicator
66
75
 
@@ -87,7 +96,7 @@ var ProgressDots = function ProgressDots(_ref) {
87
96
  var index = isLeft ? selectedIndex - 1 : selectedIndex + 1; // call the consumer's select method and focus the applicable indicator
88
97
 
89
98
  if (onSelect) {
90
- onSelect({
99
+ onSelectWithAnalytics({
91
100
  event: event,
92
101
  index: index
93
102
  });
@@ -96,7 +105,7 @@ var ProgressDots = function ProgressDots(_ref) {
96
105
  if (typeof indicators[index].focus === 'function') {
97
106
  indicators[index].focus();
98
107
  }
99
- }, [onSelect, selectedIndex, values]);
108
+ }, [onSelectWithAnalytics, selectedIndex, values, onSelect]);
100
109
  (0, _react.useEffect)(function () {
101
110
  if (onSelect) {
102
111
  document.addEventListener('keydown', handleKeyDown, false);
@@ -134,7 +143,7 @@ var ProgressDots = function ProgressDots(_ref) {
134
143
  "aria-selected": isSelected,
135
144
  id: tabId,
136
145
  onClick: function onClick(event) {
137
- return onSelect({
146
+ return onSelectWithAnalytics({
138
147
  event: event,
139
148
  index: index
140
149
  });
@@ -151,23 +160,5 @@ var ProgressDots = function ProgressDots(_ref) {
151
160
  }));
152
161
  };
153
162
 
154
- exports.ProgressDotsWithoutAnalytics = ProgressDots;
155
- var createAndFireEventOnAtlaskit = (0, _analyticsNext.createAndFireEvent)('atlaskit');
156
-
157
- var _default = (0, _analyticsNext.withAnalyticsContext)({
158
- componentName: 'progressIndicator',
159
- packageName: packageName,
160
- packageVersion: packageVersion
161
- })((0, _analyticsNext.withAnalyticsEvents)({
162
- onSelect: createAndFireEventOnAtlaskit({
163
- action: 'selected',
164
- actionSubject: 'progressIndicator',
165
- attributes: {
166
- componentName: 'progressIndicator',
167
- packageName: packageName,
168
- packageVersion: packageVersion
169
- }
170
- })
171
- })(ProgressDots));
172
-
163
+ var _default = ProgressDots;
173
164
  exports.default = _default;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/progress-indicator",
3
- "version": "9.1.0",
3
+ "version": "9.1.1",
4
4
  "sideEffects": false
5
5
  }
@@ -2,8 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
 
3
3
  /** @jsx jsx */
4
4
  import { css, jsx } from '@emotion/core';
5
- import { B100 } from '@atlaskit/theme/colors';
6
- import { token } from '@atlaskit/tokens';
5
+ import FocusRing from '@atlaskit/focus-ring';
7
6
  import { varDotsMargin, varDotsSize } from './constants';
8
7
  const commonStyles = css({
9
8
  width: `var(${varDotsSize})`,
@@ -24,10 +23,7 @@ const buttonStyles = css({
24
23
  padding: 0,
25
24
  border: 0,
26
25
  cursor: 'pointer',
27
- outline: 0,
28
- '&:focus': {
29
- boxShadow: `0 0 0 2px ${token('color.border.focus', B100)}`
30
- }
26
+ outline: 0
31
27
  });
32
28
  /**
33
29
  * __Presentational indicator__
@@ -46,9 +42,9 @@ export const PresentationalIndicator = props => jsx("div", _extends({}, props, {
46
42
  */
47
43
 
48
44
  export const ButtonIndicator = props => {
49
- return jsx("button", _extends({}, props, {
45
+ return jsx(FocusRing, null, jsx("button", _extends({}, props, {
50
46
  role: "tab",
51
47
  type: "button",
52
48
  css: [commonStyles, buttonStyles]
53
- }));
49
+ })));
54
50
  };
@@ -1,13 +1,14 @@
1
1
  /** @jsx jsx */
2
2
  import React, { useCallback, useEffect, useRef } from 'react';
3
3
  import { css, jsx } from '@emotion/core';
4
- import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
4
+ import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
5
+ import noop from '@atlaskit/ds-lib/noop';
5
6
  import { useGlobalTheme } from '@atlaskit/theme/components';
6
7
  import { getBgColor } from './appearances';
7
8
  import { sizes, spacingDivision, varDotsMargin, varDotsSize } from './constants';
8
9
  import { ButtonIndicator, PresentationalIndicator } from './indicator';
9
10
  const packageName = "@atlaskit/progress-indicator";
10
- const packageVersion = "9.1.0";
11
+ const packageVersion = "9.1.1";
11
12
  const containerStyles = css({
12
13
  display: 'flex',
13
14
  justifyContent: 'center',
@@ -33,6 +34,13 @@ const ProgressDots = ({
33
34
  onSelect
34
35
  }) => {
35
36
  const tablistRef = useRef(null);
37
+ const onSelectWithAnalytics = usePlatformLeafEventHandler({
38
+ fn: onSelect || noop,
39
+ action: 'selected',
40
+ componentName: 'progressIndicator',
41
+ packageName,
42
+ packageVersion
43
+ });
36
44
  const handleKeyDown = useCallback(event => {
37
45
  const indicators = Array.from(tablistRef.current.children); // bail if the target isn't an indicator
38
46
 
@@ -59,7 +67,7 @@ const ProgressDots = ({
59
67
  const index = isLeft ? selectedIndex - 1 : selectedIndex + 1; // call the consumer's select method and focus the applicable indicator
60
68
 
61
69
  if (onSelect) {
62
- onSelect({
70
+ onSelectWithAnalytics({
63
71
  event: event,
64
72
  index
65
73
  });
@@ -68,7 +76,7 @@ const ProgressDots = ({
68
76
  if (typeof indicators[index].focus === 'function') {
69
77
  indicators[index].focus();
70
78
  }
71
- }, [onSelect, selectedIndex, values]);
79
+ }, [onSelectWithAnalytics, selectedIndex, values, onSelect]);
72
80
  useEffect(() => {
73
81
  if (onSelect) {
74
82
  document.addEventListener('keydown', handleKeyDown, false);
@@ -108,7 +116,7 @@ const ProgressDots = ({
108
116
  "aria-label": tabId,
109
117
  "aria-selected": isSelected,
110
118
  id: tabId,
111
- onClick: event => onSelect({
119
+ onClick: event => onSelectWithAnalytics({
112
120
  event,
113
121
  index
114
122
  }),
@@ -124,20 +132,4 @@ const ProgressDots = ({
124
132
  }));
125
133
  };
126
134
 
127
- export { ProgressDots as ProgressDotsWithoutAnalytics };
128
- const createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
129
- export default withAnalyticsContext({
130
- componentName: 'progressIndicator',
131
- packageName,
132
- packageVersion
133
- })(withAnalyticsEvents({
134
- onSelect: createAndFireEventOnAtlaskit({
135
- action: 'selected',
136
- actionSubject: 'progressIndicator',
137
- attributes: {
138
- componentName: 'progressIndicator',
139
- packageName,
140
- packageVersion
141
- }
142
- })
143
- })(ProgressDots));
135
+ export default ProgressDots;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/progress-indicator",
3
- "version": "9.1.0",
3
+ "version": "9.1.1",
4
4
  "sideEffects": false
5
5
  }
@@ -2,8 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
 
3
3
  /** @jsx jsx */
4
4
  import { css, jsx } from '@emotion/core';
5
- import { B100 } from '@atlaskit/theme/colors';
6
- import { token } from '@atlaskit/tokens';
5
+ import FocusRing from '@atlaskit/focus-ring';
7
6
  import { varDotsMargin, varDotsSize } from './constants';
8
7
  var commonStyles = css({
9
8
  width: "var(".concat(varDotsSize, ")"),
@@ -24,10 +23,7 @@ var buttonStyles = css({
24
23
  padding: 0,
25
24
  border: 0,
26
25
  cursor: 'pointer',
27
- outline: 0,
28
- '&:focus': {
29
- boxShadow: "0 0 0 2px ".concat(token('color.border.focus', B100))
30
- }
26
+ outline: 0
31
27
  });
32
28
  /**
33
29
  * __Presentational indicator__
@@ -48,9 +44,9 @@ export var PresentationalIndicator = function PresentationalIndicator(props) {
48
44
  */
49
45
 
50
46
  export var ButtonIndicator = function ButtonIndicator(props) {
51
- return jsx("button", _extends({}, props, {
47
+ return jsx(FocusRing, null, jsx("button", _extends({}, props, {
52
48
  role: "tab",
53
49
  type: "button",
54
50
  css: [commonStyles, buttonStyles]
55
- }));
51
+ })));
56
52
  };
@@ -3,13 +3,14 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  /** @jsx jsx */
4
4
  import React, { useCallback, useEffect, useRef } from 'react';
5
5
  import { css, jsx } from '@emotion/core';
6
- import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
6
+ import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
7
+ import noop from '@atlaskit/ds-lib/noop';
7
8
  import { useGlobalTheme } from '@atlaskit/theme/components';
8
9
  import { getBgColor } from './appearances';
9
10
  import { sizes, spacingDivision, varDotsMargin, varDotsSize } from './constants';
10
11
  import { ButtonIndicator, PresentationalIndicator } from './indicator';
11
12
  var packageName = "@atlaskit/progress-indicator";
12
- var packageVersion = "9.1.0";
13
+ var packageVersion = "9.1.1";
13
14
  var containerStyles = css({
14
15
  display: 'flex',
15
16
  justifyContent: 'center',
@@ -39,6 +40,13 @@ var ProgressDots = function ProgressDots(_ref) {
39
40
  values = _ref.values,
40
41
  onSelect = _ref.onSelect;
41
42
  var tablistRef = useRef(null);
43
+ var onSelectWithAnalytics = usePlatformLeafEventHandler({
44
+ fn: onSelect || noop,
45
+ action: 'selected',
46
+ componentName: 'progressIndicator',
47
+ packageName: packageName,
48
+ packageVersion: packageVersion
49
+ });
42
50
  var handleKeyDown = useCallback(function (event) {
43
51
  var indicators = Array.from(tablistRef.current.children); // bail if the target isn't an indicator
44
52
 
@@ -65,7 +73,7 @@ var ProgressDots = function ProgressDots(_ref) {
65
73
  var index = isLeft ? selectedIndex - 1 : selectedIndex + 1; // call the consumer's select method and focus the applicable indicator
66
74
 
67
75
  if (onSelect) {
68
- onSelect({
76
+ onSelectWithAnalytics({
69
77
  event: event,
70
78
  index: index
71
79
  });
@@ -74,7 +82,7 @@ var ProgressDots = function ProgressDots(_ref) {
74
82
  if (typeof indicators[index].focus === 'function') {
75
83
  indicators[index].focus();
76
84
  }
77
- }, [onSelect, selectedIndex, values]);
85
+ }, [onSelectWithAnalytics, selectedIndex, values, onSelect]);
78
86
  useEffect(function () {
79
87
  if (onSelect) {
80
88
  document.addEventListener('keydown', handleKeyDown, false);
@@ -112,7 +120,7 @@ var ProgressDots = function ProgressDots(_ref) {
112
120
  "aria-selected": isSelected,
113
121
  id: tabId,
114
122
  onClick: function onClick(event) {
115
- return onSelect({
123
+ return onSelectWithAnalytics({
116
124
  event: event,
117
125
  index: index
118
126
  });
@@ -129,20 +137,4 @@ var ProgressDots = function ProgressDots(_ref) {
129
137
  }));
130
138
  };
131
139
 
132
- export { ProgressDots as ProgressDotsWithoutAnalytics };
133
- var createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
134
- export default withAnalyticsContext({
135
- componentName: 'progressIndicator',
136
- packageName: packageName,
137
- packageVersion: packageVersion
138
- })(withAnalyticsEvents({
139
- onSelect: createAndFireEventOnAtlaskit({
140
- action: 'selected',
141
- actionSubject: 'progressIndicator',
142
- attributes: {
143
- componentName: 'progressIndicator',
144
- packageName: packageName,
145
- packageVersion: packageVersion
146
- }
147
- })
148
- })(ProgressDots));
140
+ export default ProgressDots;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/progress-indicator",
3
- "version": "9.1.0",
3
+ "version": "9.1.1",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import React, { FC } from 'react';
2
+ import { FC } from 'react';
3
3
  import type { ProgressDotsProps } from '../types';
4
4
  /**
5
5
  * __ProgressDots__
@@ -7,6 +7,4 @@ import type { ProgressDotsProps } from '../types';
7
7
  * A progress indicator shows the user where they are along the steps of a journey.
8
8
  */
9
9
  declare const ProgressDots: FC<ProgressDotsProps>;
10
- export { ProgressDots as ProgressDotsWithoutAnalytics };
11
- declare const _default: React.ForwardRefExoticComponent<Pick<Pick<React.PropsWithChildren<ProgressDotsProps>, "appearance" | "children" | "ariaControls" | "ariaLabel" | "size" | "spacing" | "selectedIndex" | "testId" | "values" | "onSelect"> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "appearance" | "children" | "ariaControls" | "ariaLabel" | "size" | "spacing" | "selectedIndex" | "testId" | "values" | "onSelect" | "key" | "analyticsContext"> & React.RefAttributes<any>>;
12
- export default _default;
10
+ export default ProgressDots;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
- import type { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
2
+ import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
3
  import type { DotsAppearance, Size, Spacing } from './components/types';
4
- export interface ProgressDotsProps extends WithAnalyticsEventsProps {
4
+ export interface ProgressDotsProps {
5
5
  /**
6
6
  * The color of the indicators
7
7
  */
@@ -20,7 +20,7 @@ export interface ProgressDotsProps extends WithAnalyticsEventsProps {
20
20
  onSelect?: (eventData: {
21
21
  event: React.MouseEvent<HTMLButtonElement>;
22
22
  index: number;
23
- }) => void;
23
+ }, analyticsEvent: UIAnalyticsEvent) => void;
24
24
  /**
25
25
  * Which indicator is currently selected
26
26
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/progress-indicator",
3
- "version": "9.1.0",
3
+ "version": "9.1.1",
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/"
@@ -24,8 +24,9 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@atlaskit/analytics-next": "^8.0.0",
27
+ "@atlaskit/ds-lib": "^1.3.0",
28
+ "@atlaskit/focus-ring": "^0.2.1",
27
29
  "@atlaskit/theme": "^12.0.0",
28
- "@atlaskit/tokens": "^0.2.0",
29
30
  "@babel/runtime": "^7.0.0",
30
31
  "@emotion/core": "^10.0.9"
31
32
  },