@atlaskit/status 1.0.0 → 1.1.0

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.
Files changed (131) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/cjs/components/Status.js +5 -2
  3. package/dist/cjs/components/StatusPicker.js +24 -18
  4. package/dist/cjs/components/analytics.js +2 -2
  5. package/dist/cjs/components/i18n.js +5 -0
  6. package/dist/cjs/components/internal/color-palette.js +84 -24
  7. package/dist/cjs/components/internal/color.js +21 -10
  8. package/dist/cjs/i18n/cs.js +4 -3
  9. package/dist/cjs/i18n/da.js +4 -3
  10. package/dist/cjs/i18n/de.js +4 -3
  11. package/dist/cjs/i18n/en_ZZ.js +24 -0
  12. package/dist/cjs/i18n/es.js +4 -3
  13. package/dist/cjs/i18n/et.js +2 -2
  14. package/dist/cjs/i18n/fi.js +4 -3
  15. package/dist/cjs/i18n/fr.js +4 -3
  16. package/dist/cjs/i18n/hu.js +4 -3
  17. package/dist/cjs/i18n/it.js +4 -3
  18. package/dist/cjs/i18n/ja.js +4 -3
  19. package/dist/cjs/i18n/ko.js +4 -3
  20. package/dist/cjs/i18n/nb.js +4 -3
  21. package/dist/cjs/i18n/nl.js +4 -3
  22. package/dist/cjs/i18n/pl.js +4 -3
  23. package/dist/cjs/i18n/pt_BR.js +4 -3
  24. package/dist/cjs/i18n/pt_PT.js +2 -2
  25. package/dist/cjs/i18n/ru.js +4 -3
  26. package/dist/cjs/i18n/sk.js +2 -2
  27. package/dist/cjs/i18n/sv.js +4 -3
  28. package/dist/cjs/i18n/th.js +4 -3
  29. package/dist/cjs/i18n/tr.js +4 -3
  30. package/dist/cjs/i18n/uk.js +4 -3
  31. package/dist/cjs/i18n/vi.js +4 -3
  32. package/dist/cjs/i18n/zh.js +4 -3
  33. package/dist/cjs/i18n/zh_TW.js +4 -3
  34. package/dist/cjs/version.json +1 -1
  35. package/dist/es2019/components/Status.js +6 -2
  36. package/dist/es2019/components/StatusPicker.js +20 -13
  37. package/dist/es2019/components/i18n.js +5 -0
  38. package/dist/es2019/components/internal/color-palette.js +77 -18
  39. package/dist/es2019/components/internal/color.js +25 -13
  40. package/dist/es2019/i18n/cs.js +4 -3
  41. package/dist/es2019/i18n/da.js +4 -3
  42. package/dist/es2019/i18n/de.js +4 -3
  43. package/dist/es2019/i18n/en_ZZ.js +16 -0
  44. package/dist/es2019/i18n/es.js +4 -3
  45. package/dist/es2019/i18n/et.js +2 -2
  46. package/dist/es2019/i18n/fi.js +4 -3
  47. package/dist/es2019/i18n/fr.js +4 -3
  48. package/dist/es2019/i18n/hu.js +4 -3
  49. package/dist/es2019/i18n/it.js +4 -3
  50. package/dist/es2019/i18n/ja.js +4 -3
  51. package/dist/es2019/i18n/ko.js +4 -3
  52. package/dist/es2019/i18n/nb.js +4 -3
  53. package/dist/es2019/i18n/nl.js +4 -3
  54. package/dist/es2019/i18n/pl.js +4 -3
  55. package/dist/es2019/i18n/pt_BR.js +4 -3
  56. package/dist/es2019/i18n/pt_PT.js +2 -2
  57. package/dist/es2019/i18n/ru.js +4 -3
  58. package/dist/es2019/i18n/sk.js +2 -2
  59. package/dist/es2019/i18n/sv.js +4 -3
  60. package/dist/es2019/i18n/th.js +4 -3
  61. package/dist/es2019/i18n/tr.js +4 -3
  62. package/dist/es2019/i18n/uk.js +4 -3
  63. package/dist/es2019/i18n/vi.js +4 -3
  64. package/dist/es2019/i18n/zh.js +4 -3
  65. package/dist/es2019/i18n/zh_TW.js +4 -3
  66. package/dist/es2019/version.json +1 -1
  67. package/dist/esm/components/Status.js +6 -2
  68. package/dist/esm/components/StatusPicker.js +25 -19
  69. package/dist/esm/components/analytics.js +2 -2
  70. package/dist/esm/components/i18n.js +5 -0
  71. package/dist/esm/components/internal/color-palette.js +86 -24
  72. package/dist/esm/components/internal/color.js +22 -11
  73. package/dist/esm/i18n/cs.js +4 -3
  74. package/dist/esm/i18n/da.js +4 -3
  75. package/dist/esm/i18n/de.js +4 -3
  76. package/dist/esm/i18n/en_ZZ.js +16 -0
  77. package/dist/esm/i18n/es.js +4 -3
  78. package/dist/esm/i18n/et.js +2 -2
  79. package/dist/esm/i18n/fi.js +4 -3
  80. package/dist/esm/i18n/fr.js +4 -3
  81. package/dist/esm/i18n/hu.js +4 -3
  82. package/dist/esm/i18n/it.js +4 -3
  83. package/dist/esm/i18n/ja.js +4 -3
  84. package/dist/esm/i18n/ko.js +4 -3
  85. package/dist/esm/i18n/nb.js +4 -3
  86. package/dist/esm/i18n/nl.js +4 -3
  87. package/dist/esm/i18n/pl.js +4 -3
  88. package/dist/esm/i18n/pt_BR.js +4 -3
  89. package/dist/esm/i18n/pt_PT.js +2 -2
  90. package/dist/esm/i18n/ru.js +4 -3
  91. package/dist/esm/i18n/sk.js +2 -2
  92. package/dist/esm/i18n/sv.js +4 -3
  93. package/dist/esm/i18n/th.js +4 -3
  94. package/dist/esm/i18n/tr.js +4 -3
  95. package/dist/esm/i18n/uk.js +4 -3
  96. package/dist/esm/i18n/vi.js +4 -3
  97. package/dist/esm/i18n/zh.js +4 -3
  98. package/dist/esm/i18n/zh_TW.js +4 -3
  99. package/dist/esm/version.json +1 -1
  100. package/dist/types/components/Status.d.ts +2 -1
  101. package/dist/types/components/StatusPicker.d.ts +5 -13
  102. package/dist/types/components/i18n.d.ts +5 -0
  103. package/dist/types/components/internal/color-palette.d.ts +2 -2
  104. package/dist/types/components/internal/color.d.ts +4 -3
  105. package/dist/types/i18n/cs.d.ts +2 -1
  106. package/dist/types/i18n/da.d.ts +2 -1
  107. package/dist/types/i18n/de.d.ts +2 -1
  108. package/dist/types/i18n/en_ZZ.d.ts +16 -0
  109. package/dist/types/i18n/es.d.ts +2 -1
  110. package/dist/types/i18n/et.d.ts +1 -1
  111. package/dist/types/i18n/fi.d.ts +2 -1
  112. package/dist/types/i18n/fr.d.ts +2 -1
  113. package/dist/types/i18n/hu.d.ts +2 -1
  114. package/dist/types/i18n/it.d.ts +2 -1
  115. package/dist/types/i18n/ja.d.ts +2 -1
  116. package/dist/types/i18n/ko.d.ts +2 -1
  117. package/dist/types/i18n/nb.d.ts +2 -1
  118. package/dist/types/i18n/nl.d.ts +2 -1
  119. package/dist/types/i18n/pl.d.ts +2 -1
  120. package/dist/types/i18n/pt_BR.d.ts +2 -1
  121. package/dist/types/i18n/pt_PT.d.ts +1 -1
  122. package/dist/types/i18n/ru.d.ts +2 -1
  123. package/dist/types/i18n/sk.d.ts +1 -1
  124. package/dist/types/i18n/sv.d.ts +2 -1
  125. package/dist/types/i18n/th.d.ts +2 -1
  126. package/dist/types/i18n/tr.d.ts +2 -1
  127. package/dist/types/i18n/uk.d.ts +2 -1
  128. package/dist/types/i18n/vi.d.ts +2 -1
  129. package/dist/types/i18n/zh.d.ts +2 -1
  130. package/dist/types/i18n/zh_TW.d.ts +2 -1
  131. package/package.json +14 -7
@@ -8,16 +8,17 @@ exports.default = void 0;
8
8
  /**
9
9
  * NOTE:
10
10
  *
11
- * This file is automatically generated by i18n-tools.
11
+ * This file is automatically generated by Traduki 2.0.
12
12
  * DO NOT CHANGE IT BY HAND or your changes will be lost.
13
13
  */
14
- // Norwegian Bokmål
14
+ //Norwegian (Bokmål)
15
15
  var _default = {
16
16
  'fabric.status.color.blue': 'Blå',
17
17
  'fabric.status.color.green': 'Grønn',
18
18
  'fabric.status.color.grey': 'Grå',
19
19
  'fabric.status.color.purple': 'Lilla',
20
20
  'fabric.status.color.red': 'Rød',
21
- 'fabric.status.color.yellow': 'Gul'
21
+ 'fabric.status.color.yellow': 'Gul',
22
+ 'fabric.status.input.label': 'Angi en status'
22
23
  };
23
24
  exports.default = _default;
@@ -8,16 +8,17 @@ exports.default = void 0;
8
8
  /**
9
9
  * NOTE:
10
10
  *
11
- * This file is automatically generated by i18n-tools.
11
+ * This file is automatically generated by Traduki 2.0.
12
12
  * DO NOT CHANGE IT BY HAND or your changes will be lost.
13
13
  */
14
- // Dutch
14
+ //Dutch (Netherlands)
15
15
  var _default = {
16
16
  'fabric.status.color.blue': 'Blauw',
17
17
  'fabric.status.color.green': 'Groen',
18
18
  'fabric.status.color.grey': 'Grijs',
19
19
  'fabric.status.color.purple': 'Paars',
20
20
  'fabric.status.color.red': 'Rood',
21
- 'fabric.status.color.yellow': 'Geel'
21
+ 'fabric.status.color.yellow': 'Geel',
22
+ 'fabric.status.input.label': 'Status instellen'
22
23
  };
23
24
  exports.default = _default;
@@ -8,16 +8,17 @@ exports.default = void 0;
8
8
  /**
9
9
  * NOTE:
10
10
  *
11
- * This file is automatically generated by i18n-tools.
11
+ * This file is automatically generated by Traduki 2.0.
12
12
  * DO NOT CHANGE IT BY HAND or your changes will be lost.
13
13
  */
14
- // Polish
14
+ //Polish (Poland)
15
15
  var _default = {
16
16
  'fabric.status.color.blue': 'Niebieski',
17
17
  'fabric.status.color.green': 'Zielony',
18
18
  'fabric.status.color.grey': 'Szary',
19
19
  'fabric.status.color.purple': 'Fioletowy',
20
20
  'fabric.status.color.red': 'Czerwony',
21
- 'fabric.status.color.yellow': 'Żółty'
21
+ 'fabric.status.color.yellow': 'Żółty',
22
+ 'fabric.status.input.label': 'Ustaw status'
22
23
  };
23
24
  exports.default = _default;
@@ -8,16 +8,17 @@ exports.default = void 0;
8
8
  /**
9
9
  * NOTE:
10
10
  *
11
- * This file is automatically generated by i18n-tools.
11
+ * This file is automatically generated by Traduki 2.0.
12
12
  * DO NOT CHANGE IT BY HAND or your changes will be lost.
13
13
  */
14
- // Portuguese (Brazil)
14
+ //Portuguese (Brazil)
15
15
  var _default = {
16
16
  'fabric.status.color.blue': 'Azul',
17
17
  'fabric.status.color.green': 'Verde',
18
18
  'fabric.status.color.grey': 'Cinza',
19
19
  'fabric.status.color.purple': 'Roxo',
20
20
  'fabric.status.color.red': 'Vermelho',
21
- 'fabric.status.color.yellow': 'Amarelo'
21
+ 'fabric.status.color.yellow': 'Amarelo',
22
+ 'fabric.status.input.label': 'Definir status'
22
23
  };
23
24
  exports.default = _default;
@@ -8,10 +8,10 @@ exports.default = void 0;
8
8
  /**
9
9
  * NOTE:
10
10
  *
11
- * This file is automatically generated by i18n-tools.
11
+ * This file is automatically generated by Traduki 2.0.
12
12
  * DO NOT CHANGE IT BY HAND or your changes will be lost.
13
13
  */
14
- // Portuguese (Portugal)
14
+ //Portuguese (Portugal)
15
15
  var _default = {
16
16
  'fabric.status.color.blue': 'Azul',
17
17
  'fabric.status.color.green': 'Verde',
@@ -8,16 +8,17 @@ exports.default = void 0;
8
8
  /**
9
9
  * NOTE:
10
10
  *
11
- * This file is automatically generated by i18n-tools.
11
+ * This file is automatically generated by Traduki 2.0.
12
12
  * DO NOT CHANGE IT BY HAND or your changes will be lost.
13
13
  */
14
- // Russian
14
+ //Russian
15
15
  var _default = {
16
16
  'fabric.status.color.blue': 'Синий',
17
17
  'fabric.status.color.green': 'Зеленый',
18
18
  'fabric.status.color.grey': 'Серый',
19
19
  'fabric.status.color.purple': 'Фиолетовый',
20
20
  'fabric.status.color.red': 'Красный',
21
- 'fabric.status.color.yellow': 'Желтый'
21
+ 'fabric.status.color.yellow': 'Желтый',
22
+ 'fabric.status.input.label': 'Задать статус'
22
23
  };
23
24
  exports.default = _default;
@@ -8,10 +8,10 @@ exports.default = void 0;
8
8
  /**
9
9
  * NOTE:
10
10
  *
11
- * This file is automatically generated by i18n-tools.
11
+ * This file is automatically generated by Traduki 2.0.
12
12
  * DO NOT CHANGE IT BY HAND or your changes will be lost.
13
13
  */
14
- // Slovak
14
+ //Slovak
15
15
  var _default = {
16
16
  'fabric.status.color.blue': 'Modrá',
17
17
  'fabric.status.color.green': 'Zelená',
@@ -8,16 +8,17 @@ exports.default = void 0;
8
8
  /**
9
9
  * NOTE:
10
10
  *
11
- * This file is automatically generated by i18n-tools.
11
+ * This file is automatically generated by Traduki 2.0.
12
12
  * DO NOT CHANGE IT BY HAND or your changes will be lost.
13
13
  */
14
- // Swedish
14
+ //Swedish
15
15
  var _default = {
16
16
  'fabric.status.color.blue': 'Blå',
17
17
  'fabric.status.color.green': 'Grön',
18
18
  'fabric.status.color.grey': 'Grå',
19
19
  'fabric.status.color.purple': 'Lila',
20
20
  'fabric.status.color.red': 'Röd',
21
- 'fabric.status.color.yellow': 'Gul'
21
+ 'fabric.status.color.yellow': 'Gul',
22
+ 'fabric.status.input.label': 'Ange status'
22
23
  };
23
24
  exports.default = _default;
@@ -8,16 +8,17 @@ exports.default = void 0;
8
8
  /**
9
9
  * NOTE:
10
10
  *
11
- * This file is automatically generated by i18n-tools.
11
+ * This file is automatically generated by Traduki 2.0.
12
12
  * DO NOT CHANGE IT BY HAND or your changes will be lost.
13
13
  */
14
- // Thai
14
+ //Thai (Thailand)
15
15
  var _default = {
16
16
  'fabric.status.color.blue': 'น้ำเงิน',
17
17
  'fabric.status.color.green': 'เขียว',
18
18
  'fabric.status.color.grey': 'เทา',
19
19
  'fabric.status.color.purple': 'ม่วง',
20
20
  'fabric.status.color.red': 'แดง',
21
- 'fabric.status.color.yellow': 'เหลือง'
21
+ 'fabric.status.color.yellow': 'เหลือง',
22
+ 'fabric.status.input.label': 'ตั้งค่าสถานะ'
22
23
  };
23
24
  exports.default = _default;
@@ -8,16 +8,17 @@ exports.default = void 0;
8
8
  /**
9
9
  * NOTE:
10
10
  *
11
- * This file is automatically generated by i18n-tools.
11
+ * This file is automatically generated by Traduki 2.0.
12
12
  * DO NOT CHANGE IT BY HAND or your changes will be lost.
13
13
  */
14
- // Turkish
14
+ //Turkish (Turkey)
15
15
  var _default = {
16
16
  'fabric.status.color.blue': 'Mavi',
17
17
  'fabric.status.color.green': 'Yeşil',
18
18
  'fabric.status.color.grey': 'Gri',
19
19
  'fabric.status.color.purple': 'Mor',
20
20
  'fabric.status.color.red': 'Kırmızı',
21
- 'fabric.status.color.yellow': 'Sarı'
21
+ 'fabric.status.color.yellow': 'Sarı',
22
+ 'fabric.status.input.label': 'Durum ayarlayın'
22
23
  };
23
24
  exports.default = _default;
@@ -8,16 +8,17 @@ exports.default = void 0;
8
8
  /**
9
9
  * NOTE:
10
10
  *
11
- * This file is automatically generated by i18n-tools.
11
+ * This file is automatically generated by Traduki 2.0.
12
12
  * DO NOT CHANGE IT BY HAND or your changes will be lost.
13
13
  */
14
- // Ukrainian
14
+ //Ukrainian (Ukraine)
15
15
  var _default = {
16
16
  'fabric.status.color.blue': 'Синій',
17
17
  'fabric.status.color.green': 'Зелений',
18
18
  'fabric.status.color.grey': 'Сірий',
19
19
  'fabric.status.color.purple': 'Фіолетовий',
20
20
  'fabric.status.color.red': 'Червоний',
21
- 'fabric.status.color.yellow': 'Жовтий'
21
+ 'fabric.status.color.yellow': 'Жовтий',
22
+ 'fabric.status.input.label': 'Додати статус'
22
23
  };
23
24
  exports.default = _default;
@@ -8,16 +8,17 @@ exports.default = void 0;
8
8
  /**
9
9
  * NOTE:
10
10
  *
11
- * This file is automatically generated by i18n-tools.
11
+ * This file is automatically generated by Traduki 2.0.
12
12
  * DO NOT CHANGE IT BY HAND or your changes will be lost.
13
13
  */
14
- // Vietnamese
14
+ //Vietnamese (Vietnam)
15
15
  var _default = {
16
16
  'fabric.status.color.blue': 'Xanh lam',
17
17
  'fabric.status.color.green': 'Xanh lục',
18
18
  'fabric.status.color.grey': 'Xám',
19
19
  'fabric.status.color.purple': 'Tím',
20
20
  'fabric.status.color.red': 'Đỏ',
21
- 'fabric.status.color.yellow': 'Vàng'
21
+ 'fabric.status.color.yellow': 'Vàng',
22
+ 'fabric.status.input.label': 'Đặt trạng thái'
22
23
  };
23
24
  exports.default = _default;
@@ -8,16 +8,17 @@ exports.default = void 0;
8
8
  /**
9
9
  * NOTE:
10
10
  *
11
- * This file is automatically generated by i18n-tools.
11
+ * This file is automatically generated by Traduki 2.0.
12
12
  * DO NOT CHANGE IT BY HAND or your changes will be lost.
13
13
  */
14
- // Chinese
14
+ //Chinese (Simplified)
15
15
  var _default = {
16
16
  'fabric.status.color.blue': '蓝色',
17
17
  'fabric.status.color.green': '绿色',
18
18
  'fabric.status.color.grey': '灰色',
19
19
  'fabric.status.color.purple': '紫色',
20
20
  'fabric.status.color.red': '红色',
21
- 'fabric.status.color.yellow': '黄色'
21
+ 'fabric.status.color.yellow': '黄色',
22
+ 'fabric.status.input.label': '设置状态'
22
23
  };
23
24
  exports.default = _default;
@@ -8,16 +8,17 @@ exports.default = void 0;
8
8
  /**
9
9
  * NOTE:
10
10
  *
11
- * This file is automatically generated by i18n-tools.
11
+ * This file is automatically generated by Traduki 2.0.
12
12
  * DO NOT CHANGE IT BY HAND or your changes will be lost.
13
13
  */
14
- // undefined
14
+ //Chinese (Traditional)
15
15
  var _default = {
16
16
  'fabric.status.color.blue': '藍色',
17
17
  'fabric.status.color.green': '綠色',
18
18
  'fabric.status.color.grey': '灰色',
19
19
  'fabric.status.color.purple': '紫色',
20
20
  'fabric.status.color.red': '紅色',
21
- 'fabric.status.color.yellow': '黃色'
21
+ 'fabric.status.color.yellow': '黃色',
22
+ 'fabric.status.input.label': '設定狀態'
22
23
  };
23
24
  exports.default = _default;
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/status",
3
- "version": "1.0.0"
3
+ "version": "1.1.0"
4
4
  }
@@ -5,6 +5,8 @@ import Lozenge from '@atlaskit/lozenge';
5
5
  import { withAnalyticsEvents } from '@atlaskit/analytics-next';
6
6
  import { createStatusAnalyticsAndFire } from './analytics';
7
7
  import { ANALYTICS_HOVER_DELAY } from './constants';
8
+
9
+ /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
8
10
  const colorToLozengeAppearanceMap = {
9
11
  neutral: 'default',
10
12
  purple: 'new',
@@ -13,6 +15,8 @@ const colorToLozengeAppearanceMap = {
13
15
  yellow: 'moved',
14
16
  green: 'success'
15
17
  };
18
+ /* eslint-enable @atlaskit/design-system/ensure-design-token-usage */
19
+
16
20
  const DEFAULT_APPEARANCE = 'default';
17
21
  const MAX_WIDTH = 200;
18
22
 
@@ -49,7 +53,7 @@ class StatusInternal extends PureComponent {
49
53
  text,
50
54
  color,
51
55
  style,
52
- localId,
56
+ role,
53
57
  onClick
54
58
  } = this.props;
55
59
 
@@ -67,7 +71,7 @@ class StatusInternal extends PureComponent {
67
71
  "data-node-type": "status",
68
72
  "data-color": color,
69
73
  "data-style": style,
70
- id: localId
74
+ role: role
71
75
  }, /*#__PURE__*/React.createElement(Lozenge, {
72
76
  appearance: appearance,
73
77
  maxWidth: MAX_WIDTH
@@ -1,14 +1,18 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+
3
+ /** @jsx jsx */
2
4
  import TextField from '@atlaskit/textfield';
3
5
  import { gridSize } from '@atlaskit/theme/constants';
4
- import React from 'react';
5
- import { PureComponent } from 'react';
6
- import styled from 'styled-components';
6
+ import React, { PureComponent } from 'react';
7
+ import { injectIntl } from 'react-intl-next';
8
+ import { css, jsx } from '@emotion/react';
7
9
  import ColorPalette from './internal/color-palette';
8
- const FieldTextWrapper = styled.div`
10
+ import { messages } from './i18n';
11
+ const fieldTextWrapperStyles = css`
9
12
  margin: 0 ${gridSize()}px;
10
13
  `;
11
- export class StatusPicker extends PureComponent {
14
+
15
+ class Picker extends PureComponent {
12
16
  constructor(...args) {
13
17
  super(...args);
14
18
 
@@ -41,15 +45,16 @@ export class StatusPicker extends PureComponent {
41
45
  const {
42
46
  text,
43
47
  selectedColor,
44
- localId,
45
48
  onColorClick,
46
- onColorHover
49
+ onColorHover,
50
+ intl
47
51
  } = this.props; // Using <React.Fragment> instead of [] to workaround Enzyme
48
52
  // (https://github.com/airbnb/enzyme/issues/1149)
49
53
 
50
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FieldTextWrapper, {
54
+ return jsx(React.Fragment, null, jsx("div", {
55
+ css: fieldTextWrapperStyles,
51
56
  key: this.fieldTextWrapperKey
52
- }, /*#__PURE__*/React.createElement(TextField, {
57
+ }, jsx(TextField, {
53
58
  value: text,
54
59
  isCompact: true,
55
60
  ref: this.handleInputRef,
@@ -57,8 +62,8 @@ export class StatusPicker extends PureComponent {
57
62
  onKeyPress: this.onKeyPress,
58
63
  spellCheck: false,
59
64
  autoComplete: "off",
60
- "aria-labelledby": localId
61
- })), /*#__PURE__*/React.createElement(ColorPalette, {
65
+ "aria-label": intl.formatMessage(messages.statusInputLabel)
66
+ })), jsx(ColorPalette, {
62
67
  key: this.colorPaletteKey,
63
68
  onClick: onColorClick,
64
69
  onHover: onColorHover,
@@ -68,6 +73,8 @@ export class StatusPicker extends PureComponent {
68
73
 
69
74
  }
70
75
 
71
- _defineProperty(StatusPicker, "defaultProps", {
76
+ _defineProperty(Picker, "defaultProps", {
72
77
  autoFocus: true
73
- });
78
+ });
79
+
80
+ export const StatusPicker = injectIntl(Picker);
@@ -29,5 +29,10 @@ export const messages = defineMessages({
29
29
  id: 'fabric.status.color.green',
30
30
  defaultMessage: 'Green',
31
31
  description: 'Tooltip for the green color in color palette'
32
+ },
33
+ statusInputLabel: {
34
+ id: 'fabric.status.input.label',
35
+ defaultMessage: 'Set a status',
36
+ description: 'Aria label text for the status input field'
32
37
  }
33
38
  });
@@ -1,33 +1,92 @@
1
+ /** @jsx jsx */
1
2
  import { gridSize } from '@atlaskit/theme/constants';
2
3
  import * as colors from '@atlaskit/theme/colors';
3
- import React from 'react';
4
- import styled from 'styled-components';
4
+ import { token } from '@atlaskit/tokens';
5
+ import React, { useEffect, useRef, useCallback } from 'react';
6
+ import { css, jsx } from '@emotion/react';
5
7
  import Color from './color'; // color value, label, background, borderColor
6
8
 
7
- const palette = [['neutral', colors.N40, colors.N400], ['purple', colors.P50, colors.P400], ['blue', colors.B50, colors.B400], ['red', colors.R50, colors.R400], ['yellow', colors.Y75, colors.Y400], ['green', colors.G50, colors.G400]];
8
- const ColorPaletteWrapper = styled.div`
9
+ const palette = [['neutral', token('color.background.neutral', colors.N40), token('color.text', colors.N400)], ['purple', token('color.background.discovery', colors.P50), token('color.text.discovery', colors.P400)], ['blue', token('color.background.information', colors.B50), token('color.text.information', colors.B400)], ['red', token('color.background.danger', colors.R50), token('color.text.danger', colors.R400)], ['yellow', token('color.background.warning', colors.Y75), token('color.text.warning', colors.Y400)], ['green', token('color.background.success', colors.G50), token('color.text.success', colors.G400)]];
10
+ const colorPaletteWrapperStyles = css`
9
11
  margin: ${gridSize()}px ${gridSize()}px 0 ${gridSize()}px;
10
12
  /* Firefox bug fix: https://product-fabric.atlassian.net/browse/ED-1789 */
11
13
  display: flex;
12
14
  flex-wrap: wrap;
13
15
  `;
16
+ const VK_LEFT = 37; //ArrowLeft
17
+
18
+ const VK_RIGHT = 39; //ArrowRight
19
+
20
+ const VK_UP = 38; //ArrowUp
21
+
22
+ const VK_DOWN = 40; //ArrowDown
23
+
14
24
  export default (({
15
25
  cols = 7,
16
26
  onClick,
17
27
  selectedColor,
18
28
  className,
19
29
  onHover
20
- }) => /*#__PURE__*/React.createElement(ColorPaletteWrapper, {
21
- className: className,
22
- style: {
23
- maxWidth: cols * 32
24
- }
25
- }, palette.map(([colorValue, backgroundColor, borderColor]) => /*#__PURE__*/React.createElement(Color, {
26
- key: colorValue,
27
- value: colorValue,
28
- backgroundColor: backgroundColor,
29
- borderColor: borderColor,
30
- onClick: onClick,
31
- onHover: onHover,
32
- isSelected: colorValue === selectedColor
33
- }))));
30
+ }) => {
31
+ const colorRefs = useRef([]);
32
+ useEffect(() => {
33
+ colorRefs.current = colorRefs.current.slice(0, palette.length);
34
+ }, []);
35
+ const memoizedHandleKeyDown = useCallback(e => {
36
+ const colorIndex = palette.findIndex(([colorValue]) => colorValue === selectedColor);
37
+ let newColorIndex = null;
38
+
39
+ switch (e.keyCode) {
40
+ case VK_RIGHT:
41
+ case VK_DOWN:
42
+ e.preventDefault();
43
+ newColorIndex = colorIndex + 1 > palette.length - 1 ? 0 : colorIndex + 1;
44
+ break;
45
+
46
+ case VK_LEFT:
47
+ case VK_UP:
48
+ e.preventDefault();
49
+ newColorIndex = colorIndex - 1 < 0 ? palette.length - 1 : colorIndex - 1;
50
+ break;
51
+ }
52
+
53
+ if (newColorIndex === null) {
54
+ return;
55
+ }
56
+
57
+ const newColorValue = palette[newColorIndex][0];
58
+ const newRef = colorRefs.current[newColorIndex];
59
+ newRef === null || newRef === void 0 ? void 0 : newRef.focus();
60
+ onClick(newColorValue);
61
+ }, [selectedColor, onClick, colorRefs]);
62
+ return (
63
+ /**
64
+ We need to disable below eslint rule becuase of role "radiogroup". This role was added
65
+ in https://a11y-internal.atlassian.net/browse/AK-832 to fix accessibility issue.
66
+ When we migrated to emotion from styled component, we started getting this error.
67
+ Task added in https://product-fabric.atlassian.net/wiki/spaces/E/pages/3182068181/Potential+improvements#Moderate-changes.
68
+ */
69
+ // eslint-disable-next-line jsx-a11y/interactive-supports-focus
70
+ jsx("div", {
71
+ css: colorPaletteWrapperStyles,
72
+ className: className,
73
+ role: "radiogroup",
74
+ style: {
75
+ maxWidth: cols * 32
76
+ },
77
+ onKeyDown: memoizedHandleKeyDown
78
+ }, palette.map(([colorValue, backgroundColor, borderColor], i) => {
79
+ return jsx(Color, {
80
+ key: colorValue,
81
+ value: colorValue,
82
+ backgroundColor: backgroundColor,
83
+ borderColor: borderColor,
84
+ onClick: onClick,
85
+ onHover: onHover,
86
+ isSelected: colorValue === selectedColor,
87
+ tabIndex: colorValue === selectedColor ? 0 : -1,
88
+ setRef: el => colorRefs.current[i] = el
89
+ });
90
+ }))
91
+ );
92
+ });
@@ -1,25 +1,27 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+
3
+ /** @jsx jsx */
2
4
  import EditorDoneIcon from '@atlaskit/icon/glyph/editor/done';
3
5
  import { N900, N0, N50 } from '@atlaskit/theme/colors';
4
- import React from 'react';
5
- import { PureComponent } from 'react';
6
+ import { token } from '@atlaskit/tokens';
7
+ import React, { PureComponent } from 'react';
6
8
  import { FormattedMessage } from 'react-intl-next';
7
- import styled from 'styled-components';
9
+ import { css, jsx } from '@emotion/react';
8
10
  import { ANALYTICS_HOVER_DELAY } from '../constants';
9
11
  import { messages } from '../i18n';
10
- const Button = styled.button`
12
+ const buttonStyles = css`
11
13
  height: 24px;
12
14
  width: 24px;
13
- background: ${N900};
15
+ background: ${token('color.background.neutral', N900)};
14
16
  padding: 0;
15
17
  border-radius: 4px;
16
- border: 1px solid ${N0};
18
+ border: 1px solid ${token('color.border', N0)};
17
19
  cursor: pointer;
18
20
  display: block;
19
21
  box-sizing: border-box;
20
22
  overflow: hidden;
21
23
  `;
22
- const ButtonWrapper = styled.span`
24
+ const buttonWrapperStyles = css`
23
25
  border: 1px solid transparent;
24
26
  margin: 0 2px;
25
27
  font-size: 0;
@@ -28,7 +30,7 @@ const ButtonWrapper = styled.span`
28
30
  padding: 1px;
29
31
  border-radius: 6px;
30
32
  &:hover {
31
- border: 1px solid ${N50};
33
+ border: 1px solid ${token('color.border', N50)};
32
34
  }
33
35
  `;
34
36
  export default class Color extends PureComponent {
@@ -74,22 +76,32 @@ export default class Color extends PureComponent {
74
76
  backgroundColor,
75
77
  isSelected,
76
78
  borderColor,
77
- value
79
+ value,
80
+ setRef
78
81
  } = this.props;
79
82
  const borderStyle = `1px solid ${borderColor}`;
80
- return /*#__PURE__*/React.createElement(ButtonWrapper, null, /*#__PURE__*/React.createElement(FormattedMessage, messages[`${value}Color`], labels => /*#__PURE__*/React.createElement(Button, {
83
+ return jsx("span", {
84
+ css: buttonWrapperStyles
85
+ }, jsx(FormattedMessage, messages[`${value}Color`], labels => jsx("button", {
86
+ css: buttonStyles,
81
87
  onClick: this.onClick,
82
88
  onMouseEnter: this.onMouseEnter,
83
89
  onMouseLeave: this.onMouseLeave,
84
90
  onMouseDown: this.onMouseDown,
85
91
  tabIndex: tabIndex,
86
92
  className: `${isSelected ? 'selected' : ''}`,
87
- title: labels[0],
93
+ title: labels[0] // button element does not support aria-selected.
94
+ // For button selected (to be precise pressed) or not
95
+ // use aria-pressed as per
96
+ // https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/button_role#associated_aria_roles_states_and_properties
97
+ ,
98
+ "aria-pressed": isSelected,
88
99
  style: {
89
100
  backgroundColor: backgroundColor || 'transparent',
90
101
  border: borderStyle
91
- }
92
- }, isSelected && /*#__PURE__*/React.createElement(EditorDoneIcon, {
102
+ },
103
+ ref: setRef
104
+ }, isSelected && jsx(EditorDoneIcon, {
93
105
  primaryColor: borderColor,
94
106
  label: labels[0]
95
107
  }))));
@@ -1,15 +1,16 @@
1
1
  /**
2
2
  * NOTE:
3
3
  *
4
- * This file is automatically generated by i18n-tools.
4
+ * This file is automatically generated by Traduki 2.0.
5
5
  * DO NOT CHANGE IT BY HAND or your changes will be lost.
6
6
  */
7
- // Czech
7
+ //Czech
8
8
  export default {
9
9
  'fabric.status.color.blue': 'Modrá',
10
10
  'fabric.status.color.green': 'Zelená',
11
11
  'fabric.status.color.grey': 'Šedá',
12
12
  'fabric.status.color.purple': 'Fialová',
13
13
  'fabric.status.color.red': 'Červená',
14
- 'fabric.status.color.yellow': 'Žlutá'
14
+ 'fabric.status.color.yellow': 'Žlutá',
15
+ 'fabric.status.input.label': 'Nastavit stav'
15
16
  };
@@ -1,15 +1,16 @@
1
1
  /**
2
2
  * NOTE:
3
3
  *
4
- * This file is automatically generated by i18n-tools.
4
+ * This file is automatically generated by Traduki 2.0.
5
5
  * DO NOT CHANGE IT BY HAND or your changes will be lost.
6
6
  */
7
- // Danish
7
+ //Danish (Denmark)
8
8
  export default {
9
9
  'fabric.status.color.blue': 'Blå',
10
10
  'fabric.status.color.green': 'Grøn',
11
11
  'fabric.status.color.grey': 'Grå',
12
12
  'fabric.status.color.purple': 'Lilla',
13
13
  'fabric.status.color.red': 'Rød',
14
- 'fabric.status.color.yellow': 'Gul'
14
+ 'fabric.status.color.yellow': 'Gul',
15
+ 'fabric.status.input.label': 'Angiv en status'
15
16
  };