@atlaskit/status 1.1.3 → 1.1.4

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,12 @@
1
1
  # @atlaskit/status
2
2
 
3
+ ## 1.1.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`721bc4d7794`](https://bitbucket.org/atlassian/atlassian-frontend/commits/721bc4d7794) - ED-14377 To remove the imports of version.json which is deprecated
8
+ - [`b3fedfabde4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b3fedfabde4) - Changing status colors with tab and shfit-tab
9
+
3
10
  ## 1.1.3
4
11
 
5
12
  ### Patch Changes
@@ -9,14 +9,14 @@ exports.createStatusAnalyticsAndFire = exports.ELEMENTS_CHANNEL = void 0;
9
9
 
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
 
12
- var _version = require("../version.json");
13
-
14
12
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
15
13
 
16
14
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
17
15
 
18
16
  var ELEMENTS_CHANNEL = 'fabric-elements';
19
17
  exports.ELEMENTS_CHANNEL = ELEMENTS_CHANNEL;
18
+ var packageName = "@atlaskit/status";
19
+ var packageVersion = "1.1.4";
20
20
 
21
21
  var createStatusAnalyticsAndFire = function createStatusAnalyticsAndFire(createAnalyticsEvent) {
22
22
  return function (payload) {
@@ -28,8 +28,8 @@ var createStatusAnalyticsAndFire = function createStatusAnalyticsAndFire(createA
28
28
  statusPayload.attributes = {};
29
29
  }
30
30
 
31
- statusPayload.attributes.packageName = _version.name;
32
- statusPayload.attributes.packageVersion = _version.version;
31
+ statusPayload.attributes.packageName = packageName;
32
+ statusPayload.attributes.packageVersion = packageVersion;
33
33
  statusPayload.attributes.componentName = 'status';
34
34
  var event = createAnalyticsEvent(statusPayload);
35
35
  event.fire(ELEMENTS_CHANNEL);
@@ -42,6 +42,8 @@ var VK_UP = 38; //ArrowUp
42
42
 
43
43
  var VK_DOWN = 40; //ArrowDown
44
44
 
45
+ var VK_TAB = 9;
46
+
45
47
  var _default = function _default(_ref) {
46
48
  var _ref$cols = _ref.cols,
47
49
  cols = _ref$cols === void 0 ? 7 : _ref$cols,
@@ -62,17 +64,36 @@ var _default = function _default(_ref) {
62
64
  });
63
65
  var newColorIndex = null;
64
66
 
67
+ var nextColor = function nextColor() {
68
+ return colorIndex + 1 > palette.length - 1 ? 0 : colorIndex + 1;
69
+ };
70
+
71
+ var previousColor = function previousColor() {
72
+ return colorIndex - 1 < 0 ? palette.length - 1 : colorIndex - 1;
73
+ };
74
+
65
75
  switch (e.keyCode) {
66
76
  case VK_RIGHT:
67
77
  case VK_DOWN:
68
78
  e.preventDefault();
69
- newColorIndex = colorIndex + 1 > palette.length - 1 ? 0 : colorIndex + 1;
79
+ newColorIndex = nextColor();
70
80
  break;
71
81
 
72
82
  case VK_LEFT:
73
83
  case VK_UP:
74
84
  e.preventDefault();
75
- newColorIndex = colorIndex - 1 < 0 ? palette.length - 1 : colorIndex - 1;
85
+ newColorIndex = previousColor();
86
+ break;
87
+
88
+ case VK_TAB:
89
+ e.preventDefault();
90
+
91
+ if (e.shiftKey) {
92
+ newColorIndex = previousColor();
93
+ } else {
94
+ newColorIndex = nextColor();
95
+ }
96
+
76
97
  break;
77
98
  }
78
99
 
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/status",
3
- "version": "1.1.3"
3
+ "version": "1.1.4"
4
4
  }
@@ -1,5 +1,6 @@
1
- import { name as packageName, version as packageVersion } from '../version.json';
2
1
  export const ELEMENTS_CHANNEL = 'fabric-elements';
2
+ const packageName = "@atlaskit/status";
3
+ const packageVersion = "1.1.4";
3
4
  export const createStatusAnalyticsAndFire = createAnalyticsEvent => payload => {
4
5
  const statusPayload = { ...payload,
5
6
  eventType: 'ui'
@@ -21,6 +21,7 @@ const VK_UP = 38; //ArrowUp
21
21
 
22
22
  const VK_DOWN = 40; //ArrowDown
23
23
 
24
+ const VK_TAB = 9;
24
25
  export default (({
25
26
  cols = 7,
26
27
  onClick,
@@ -36,17 +37,32 @@ export default (({
36
37
  const colorIndex = palette.findIndex(([colorValue]) => colorValue === selectedColor);
37
38
  let newColorIndex = null;
38
39
 
40
+ const nextColor = () => colorIndex + 1 > palette.length - 1 ? 0 : colorIndex + 1;
41
+
42
+ const previousColor = () => colorIndex - 1 < 0 ? palette.length - 1 : colorIndex - 1;
43
+
39
44
  switch (e.keyCode) {
40
45
  case VK_RIGHT:
41
46
  case VK_DOWN:
42
47
  e.preventDefault();
43
- newColorIndex = colorIndex + 1 > palette.length - 1 ? 0 : colorIndex + 1;
48
+ newColorIndex = nextColor();
44
49
  break;
45
50
 
46
51
  case VK_LEFT:
47
52
  case VK_UP:
48
53
  e.preventDefault();
49
- newColorIndex = colorIndex - 1 < 0 ? palette.length - 1 : colorIndex - 1;
54
+ newColorIndex = previousColor();
55
+ break;
56
+
57
+ case VK_TAB:
58
+ e.preventDefault();
59
+
60
+ if (e.shiftKey) {
61
+ newColorIndex = previousColor();
62
+ } else {
63
+ newColorIndex = nextColor();
64
+ }
65
+
50
66
  break;
51
67
  }
52
68
 
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/status",
3
- "version": "1.1.3"
3
+ "version": "1.1.4"
4
4
  }
@@ -4,8 +4,9 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
4
4
 
5
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
6
 
7
- import { name as packageName, version as packageVersion } from '../version.json';
8
7
  export var ELEMENTS_CHANNEL = 'fabric-elements';
8
+ var packageName = "@atlaskit/status";
9
+ var packageVersion = "1.1.4";
9
10
  export var createStatusAnalyticsAndFire = function createStatusAnalyticsAndFire(createAnalyticsEvent) {
10
11
  return function (payload) {
11
12
  var statusPayload = _objectSpread(_objectSpread({}, payload), {}, {
@@ -21,6 +21,7 @@ var VK_UP = 38; //ArrowUp
21
21
 
22
22
  var VK_DOWN = 40; //ArrowDown
23
23
 
24
+ var VK_TAB = 9;
24
25
  export default (function (_ref) {
25
26
  var _ref$cols = _ref.cols,
26
27
  cols = _ref$cols === void 0 ? 7 : _ref$cols,
@@ -41,17 +42,36 @@ export default (function (_ref) {
41
42
  });
42
43
  var newColorIndex = null;
43
44
 
45
+ var nextColor = function nextColor() {
46
+ return colorIndex + 1 > palette.length - 1 ? 0 : colorIndex + 1;
47
+ };
48
+
49
+ var previousColor = function previousColor() {
50
+ return colorIndex - 1 < 0 ? palette.length - 1 : colorIndex - 1;
51
+ };
52
+
44
53
  switch (e.keyCode) {
45
54
  case VK_RIGHT:
46
55
  case VK_DOWN:
47
56
  e.preventDefault();
48
- newColorIndex = colorIndex + 1 > palette.length - 1 ? 0 : colorIndex + 1;
57
+ newColorIndex = nextColor();
49
58
  break;
50
59
 
51
60
  case VK_LEFT:
52
61
  case VK_UP:
53
62
  e.preventDefault();
54
- newColorIndex = colorIndex - 1 < 0 ? palette.length - 1 : colorIndex - 1;
63
+ newColorIndex = previousColor();
64
+ break;
65
+
66
+ case VK_TAB:
67
+ e.preventDefault();
68
+
69
+ if (e.shiftKey) {
70
+ newColorIndex = previousColor();
71
+ } else {
72
+ newColorIndex = nextColor();
73
+ }
74
+
55
75
  break;
56
76
  }
57
77
 
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/status",
3
- "version": "1.1.3"
3
+ "version": "1.1.4"
4
4
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/status",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "Fabric Status React Components",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "devDependencies": {
42
42
  "@atlaskit/docs": "^9.0.0",
43
- "@atlaskit/editor-test-helpers": "^17.0.0",
43
+ "@atlaskit/editor-test-helpers": "^17.1.0",
44
44
  "@atlaskit/elements-test-helpers": "^0.7.0",
45
45
  "@atlaskit/visual-regression": "*",
46
46
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
package/report.api.md ADDED
@@ -0,0 +1,58 @@
1
+ ## API Report File for "@atlaskit/status"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+ import { default as React_2 } from 'react';
7
+ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
8
+ import { WithIntlProps } from 'react-intl-next';
9
+ import { WrappedComponentProps } from 'react-intl-next';
10
+
11
+ export declare type Color =
12
+ | 'neutral'
13
+ | 'purple'
14
+ | 'blue'
15
+ | 'red'
16
+ | 'yellow'
17
+ | 'green';
18
+
19
+ declare type ColorType = Color;
20
+
21
+ declare interface OwnProps {
22
+ text: string;
23
+ color: Color;
24
+ style?: StatusStyle;
25
+ localId?: string;
26
+ onClick?: (event: React_2.SyntheticEvent<any>) => void;
27
+ onHover?: () => void;
28
+ role?: string;
29
+ }
30
+
31
+ export declare type Props = OwnProps & WithAnalyticsEventsProps;
32
+
33
+ export declare const Status: React_2.ForwardRefExoticComponent<
34
+ Omit<Props, keyof WithAnalyticsEventsProps> & React_2.RefAttributes<any>
35
+ >;
36
+
37
+ export declare const StatusPicker: React_2.FC<
38
+ WithIntlProps<StatusPickerProps & WrappedComponentProps<'intl'>>
39
+ > & {
40
+ WrappedComponent: React_2.ComponentType<
41
+ StatusPickerProps & WrappedComponentProps<'intl'>
42
+ >;
43
+ };
44
+
45
+ export declare interface StatusPickerProps {
46
+ selectedColor: ColorType;
47
+ text: string;
48
+ onEnter: () => void;
49
+ onColorClick: (value: ColorType) => void;
50
+ onColorHover?: (value: ColorType) => void;
51
+ onTextChanged: (value: string) => void;
52
+ autoFocus?: boolean;
53
+ }
54
+
55
+ export declare type StatusStyle = 'bold' | 'subtle';
56
+
57
+ export {};
58
+ ```