@atlaskit/badge 18.1.6 → 18.2.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/badge
2
2
 
3
+ ## 18.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`2f3c3d27e42b2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2f3c3d27e42b2) -
8
+ [ux] Updates badge styles to reflect our new visual design language. These changes were previously
9
+ behind a feature flag and are now fully rolled out.
10
+
3
11
  ## 18.1.6
4
12
 
5
13
  ### Patch Changes
@@ -1,22 +1,15 @@
1
1
 
2
- ._2rko1mok{border-radius:var(--ds-radius-large,8px)}
3
- ._2rkolb4i{border-radius:var(--ds-radius-xsmall,2px)}._18zr12x7{padding-inline:var(--ds-space-075,6px)}
4
- ._18zr1b66{padding-inline:var(--ds-space-050,4px)}
2
+ ._2rkolb4i{border-radius:var(--ds-radius-xsmall,2px)}._18zr1b66{padding-inline:var(--ds-space-050,4px)}
5
3
  ._1bah1h6o{justify-content:center}
6
4
  ._1e0c116y{display:inline-flex}
7
5
  ._1kz6184x{block-size:min-content}
8
6
  ._1o9zidpf{flex-shrink:0}
9
7
  ._1ul91ejb{min-width:var(--ds-space-300,24px)}
10
8
  ._bfhk1366{background-color:#fd9891}
11
- ._bfhk1bay{background-color:var(--ds-background-success,#e3fcef)}
12
9
  ._bfhk1fkg{background-color:#dddee1}
13
10
  ._bfhk1gly{background-color:var(--ds-background-danger,#ffeceb)}
14
- ._bfhk1v7l{background-color:var(--ds-background-danger-bold,#de350b)}
15
11
  ._bfhk1ymo{background-color:#8fb8f6}
16
- ._bfhklecj{background-color:var(--ds-background-neutral,#dfe1e6)}
17
12
  ._bfhkmv6i{background-color:var(--ds-background-success,#dcfff1)}
18
- ._bfhkomb0{background-color:var(--ds-background-brand-bold,#0052cc)}
19
- ._bfhktaeo{background-color:var(--ds-background-danger,#ffebe6)}
20
13
  ._bfhkvuon{background-color:var(--ds-surface,#fff)}
21
14
  ._syaz1e6v{color:var(--ds-text-brand,#0c66e4)}
22
15
  ._syaz1fxt{color:var(--ds-text,#172b4d)}
package/dist/cjs/badge.js CHANGED
@@ -1,4 +1,4 @@
1
- /* badge.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* badge.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  "use strict";
3
3
 
4
4
  var _typeof = require("@babel/runtime/helpers/typeof");
@@ -15,19 +15,9 @@ var _primitives = require("@atlaskit/primitives");
15
15
  var _utils = require("./internal/utils");
16
16
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
17
17
  // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
18
- var boxStyles = {
19
- root: "_2rko1mok _18zr12x7 _1e0c116y _1o9zidpf _1kz6184x",
20
- added: "_bfhk1bay",
21
- default: "_bfhklecj",
22
- important: "_bfhk1v7l",
23
- primary: "_bfhkomb0",
24
- primaryInverted: "_bfhkvuon",
25
- removed: "_bfhktaeo"
26
- };
27
-
28
18
  /**
29
19
  * Visual refresh colors.
30
- * Hardcoded hex colors are used as the they should not change based on theme, and there are no appropriate color tokens.
20
+ * Hardcoded hex colors are used as the they will be updated in the labelling system work and we want to avoid frequent UI changes.\
31
21
  *
32
22
  * Using separate variables as opposed to an object, to comply with UI styling standard
33
23
  * https://atlassian.design/components/eslint-plugin-ui-styling-standard/no-unsafe-values/usage#object-access
@@ -71,41 +61,17 @@ var Badge = /*#__PURE__*/(0, _react.memo)(function Badge(_ref) {
71
61
  max = _ref$max === void 0 ? 99 : _ref$max,
72
62
  style = _ref.style,
73
63
  testId = _ref.testId;
74
- // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
75
- if ((0, _platformFeatureFlags.fg)('platform-component-visual-refresh')) {
76
- return /*#__PURE__*/React.createElement("span", {
77
- "data-testid": testId,
78
- style: {
79
- background: style === null || style === void 0 ? void 0 : style.backgroundColor,
80
- color: style === null || style === void 0 ? void 0 : style.color
81
- },
82
- className: (0, _runtime.ax)([styles.root, styles[appearance]])
83
- }, /*#__PURE__*/React.createElement(_primitives.Text, {
84
- size: "small",
85
- align: "center",
86
- color: "inherit"
87
- }, badgeValueWithNegativeNumberSupported(children, max)));
88
- }
89
64
  return /*#__PURE__*/React.createElement("span", {
90
65
  "data-testid": testId,
91
66
  style: {
92
- backgroundColor: style === null || style === void 0 ? void 0 : style.backgroundColor,
67
+ background: style === null || style === void 0 ? void 0 : style.backgroundColor,
93
68
  color: style === null || style === void 0 ? void 0 : style.color
94
69
  },
95
- className: (0, _runtime.ax)([boxStyles.root, boxStyles[appearance]])
70
+ className: (0, _runtime.ax)([styles.root, styles[appearance]])
96
71
  }, /*#__PURE__*/React.createElement(_primitives.Text, {
97
- size: "UNSAFE_small",
72
+ size: "small",
98
73
  align: "center",
99
- color: style !== null && style !== void 0 && style.color ? 'inherit' : textColors[appearance]
74
+ color: "inherit"
100
75
  }, badgeValueWithNegativeNumberSupported(children, max)));
101
76
  });
102
- Badge.displayName = 'Badge';
103
- var _default = exports.default = Badge;
104
- var textColors = {
105
- added: 'color.text.success',
106
- default: 'color.text',
107
- important: 'color.text.inverse',
108
- primary: 'color.text.inverse',
109
- primaryInverted: 'color.text.brand',
110
- removed: 'color.text.danger'
111
- };
77
+ var _default = exports.default = Badge;
@@ -1,22 +1,15 @@
1
1
 
2
- ._2rko1mok{border-radius:var(--ds-radius-large,8px)}
3
- ._2rkolb4i{border-radius:var(--ds-radius-xsmall,2px)}._18zr12x7{padding-inline:var(--ds-space-075,6px)}
4
- ._18zr1b66{padding-inline:var(--ds-space-050,4px)}
2
+ ._2rkolb4i{border-radius:var(--ds-radius-xsmall,2px)}._18zr1b66{padding-inline:var(--ds-space-050,4px)}
5
3
  ._1bah1h6o{justify-content:center}
6
4
  ._1e0c116y{display:inline-flex}
7
5
  ._1kz6184x{block-size:min-content}
8
6
  ._1o9zidpf{flex-shrink:0}
9
7
  ._1ul91ejb{min-width:var(--ds-space-300,24px)}
10
8
  ._bfhk1366{background-color:#fd9891}
11
- ._bfhk1bay{background-color:var(--ds-background-success,#e3fcef)}
12
9
  ._bfhk1fkg{background-color:#dddee1}
13
10
  ._bfhk1gly{background-color:var(--ds-background-danger,#ffeceb)}
14
- ._bfhk1v7l{background-color:var(--ds-background-danger-bold,#de350b)}
15
11
  ._bfhk1ymo{background-color:#8fb8f6}
16
- ._bfhklecj{background-color:var(--ds-background-neutral,#dfe1e6)}
17
12
  ._bfhkmv6i{background-color:var(--ds-background-success,#dcfff1)}
18
- ._bfhkomb0{background-color:var(--ds-background-brand-bold,#0052cc)}
19
- ._bfhktaeo{background-color:var(--ds-background-danger,#ffebe6)}
20
13
  ._bfhkvuon{background-color:var(--ds-surface,#fff)}
21
14
  ._syaz1e6v{color:var(--ds-text-brand,#0c66e4)}
22
15
  ._syaz1fxt{color:var(--ds-text,#172b4d)}
@@ -1,4 +1,4 @@
1
- /* badge.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* badge.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import "./badge.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -7,19 +7,9 @@ import { fg } from '@atlaskit/platform-feature-flags';
7
7
  // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
8
8
  import { Text } from '@atlaskit/primitives';
9
9
  import { formatValue, formatValueWithNegativeSupport } from './internal/utils';
10
- const boxStyles = {
11
- root: "_2rko1mok _18zr12x7 _1e0c116y _1o9zidpf _1kz6184x",
12
- added: "_bfhk1bay",
13
- default: "_bfhklecj",
14
- important: "_bfhk1v7l",
15
- primary: "_bfhkomb0",
16
- primaryInverted: "_bfhkvuon",
17
- removed: "_bfhktaeo"
18
- };
19
-
20
10
  /**
21
11
  * Visual refresh colors.
22
- * Hardcoded hex colors are used as the they should not change based on theme, and there are no appropriate color tokens.
12
+ * Hardcoded hex colors are used as the they will be updated in the labelling system work and we want to avoid frequent UI changes.\
23
13
  *
24
14
  * Using separate variables as opposed to an object, to comply with UI styling standard
25
15
  * https://atlassian.design/components/eslint-plugin-ui-styling-standard/no-unsafe-values/usage#object-access
@@ -61,41 +51,17 @@ const Badge = /*#__PURE__*/memo(function Badge({
61
51
  style,
62
52
  testId
63
53
  }) {
64
- // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
65
- if (fg('platform-component-visual-refresh')) {
66
- return /*#__PURE__*/React.createElement("span", {
67
- "data-testid": testId,
68
- style: {
69
- background: style === null || style === void 0 ? void 0 : style.backgroundColor,
70
- color: style === null || style === void 0 ? void 0 : style.color
71
- },
72
- className: ax([styles.root, styles[appearance]])
73
- }, /*#__PURE__*/React.createElement(Text, {
74
- size: "small",
75
- align: "center",
76
- color: "inherit"
77
- }, badgeValueWithNegativeNumberSupported(children, max)));
78
- }
79
54
  return /*#__PURE__*/React.createElement("span", {
80
55
  "data-testid": testId,
81
56
  style: {
82
- backgroundColor: style === null || style === void 0 ? void 0 : style.backgroundColor,
57
+ background: style === null || style === void 0 ? void 0 : style.backgroundColor,
83
58
  color: style === null || style === void 0 ? void 0 : style.color
84
59
  },
85
- className: ax([boxStyles.root, boxStyles[appearance]])
60
+ className: ax([styles.root, styles[appearance]])
86
61
  }, /*#__PURE__*/React.createElement(Text, {
87
- size: "UNSAFE_small",
62
+ size: "small",
88
63
  align: "center",
89
- color: style !== null && style !== void 0 && style.color ? 'inherit' : textColors[appearance]
64
+ color: "inherit"
90
65
  }, badgeValueWithNegativeNumberSupported(children, max)));
91
66
  });
92
- Badge.displayName = 'Badge';
93
- export default Badge;
94
- const textColors = {
95
- added: 'color.text.success',
96
- default: 'color.text',
97
- important: 'color.text.inverse',
98
- primary: 'color.text.inverse',
99
- primaryInverted: 'color.text.brand',
100
- removed: 'color.text.danger'
101
- };
67
+ export default Badge;
@@ -1,22 +1,15 @@
1
1
 
2
- ._2rko1mok{border-radius:var(--ds-radius-large,8px)}
3
- ._2rkolb4i{border-radius:var(--ds-radius-xsmall,2px)}._18zr12x7{padding-inline:var(--ds-space-075,6px)}
4
- ._18zr1b66{padding-inline:var(--ds-space-050,4px)}
2
+ ._2rkolb4i{border-radius:var(--ds-radius-xsmall,2px)}._18zr1b66{padding-inline:var(--ds-space-050,4px)}
5
3
  ._1bah1h6o{justify-content:center}
6
4
  ._1e0c116y{display:inline-flex}
7
5
  ._1kz6184x{block-size:min-content}
8
6
  ._1o9zidpf{flex-shrink:0}
9
7
  ._1ul91ejb{min-width:var(--ds-space-300,24px)}
10
8
  ._bfhk1366{background-color:#fd9891}
11
- ._bfhk1bay{background-color:var(--ds-background-success,#e3fcef)}
12
9
  ._bfhk1fkg{background-color:#dddee1}
13
10
  ._bfhk1gly{background-color:var(--ds-background-danger,#ffeceb)}
14
- ._bfhk1v7l{background-color:var(--ds-background-danger-bold,#de350b)}
15
11
  ._bfhk1ymo{background-color:#8fb8f6}
16
- ._bfhklecj{background-color:var(--ds-background-neutral,#dfe1e6)}
17
12
  ._bfhkmv6i{background-color:var(--ds-background-success,#dcfff1)}
18
- ._bfhkomb0{background-color:var(--ds-background-brand-bold,#0052cc)}
19
- ._bfhktaeo{background-color:var(--ds-background-danger,#ffebe6)}
20
13
  ._bfhkvuon{background-color:var(--ds-surface,#fff)}
21
14
  ._syaz1e6v{color:var(--ds-text-brand,#0c66e4)}
22
15
  ._syaz1fxt{color:var(--ds-text,#172b4d)}
package/dist/esm/badge.js CHANGED
@@ -1,4 +1,4 @@
1
- /* badge.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* badge.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import "./badge.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -7,19 +7,9 @@ import { fg } from '@atlaskit/platform-feature-flags';
7
7
  // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
8
8
  import { Text } from '@atlaskit/primitives';
9
9
  import { formatValue, formatValueWithNegativeSupport } from './internal/utils';
10
- var boxStyles = {
11
- root: "_2rko1mok _18zr12x7 _1e0c116y _1o9zidpf _1kz6184x",
12
- added: "_bfhk1bay",
13
- default: "_bfhklecj",
14
- important: "_bfhk1v7l",
15
- primary: "_bfhkomb0",
16
- primaryInverted: "_bfhkvuon",
17
- removed: "_bfhktaeo"
18
- };
19
-
20
10
  /**
21
11
  * Visual refresh colors.
22
- * Hardcoded hex colors are used as the they should not change based on theme, and there are no appropriate color tokens.
12
+ * Hardcoded hex colors are used as the they will be updated in the labelling system work and we want to avoid frequent UI changes.\
23
13
  *
24
14
  * Using separate variables as opposed to an object, to comply with UI styling standard
25
15
  * https://atlassian.design/components/eslint-plugin-ui-styling-standard/no-unsafe-values/usage#object-access
@@ -63,41 +53,17 @@ var Badge = /*#__PURE__*/memo(function Badge(_ref) {
63
53
  max = _ref$max === void 0 ? 99 : _ref$max,
64
54
  style = _ref.style,
65
55
  testId = _ref.testId;
66
- // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
67
- if (fg('platform-component-visual-refresh')) {
68
- return /*#__PURE__*/React.createElement("span", {
69
- "data-testid": testId,
70
- style: {
71
- background: style === null || style === void 0 ? void 0 : style.backgroundColor,
72
- color: style === null || style === void 0 ? void 0 : style.color
73
- },
74
- className: ax([styles.root, styles[appearance]])
75
- }, /*#__PURE__*/React.createElement(Text, {
76
- size: "small",
77
- align: "center",
78
- color: "inherit"
79
- }, badgeValueWithNegativeNumberSupported(children, max)));
80
- }
81
56
  return /*#__PURE__*/React.createElement("span", {
82
57
  "data-testid": testId,
83
58
  style: {
84
- backgroundColor: style === null || style === void 0 ? void 0 : style.backgroundColor,
59
+ background: style === null || style === void 0 ? void 0 : style.backgroundColor,
85
60
  color: style === null || style === void 0 ? void 0 : style.color
86
61
  },
87
- className: ax([boxStyles.root, boxStyles[appearance]])
62
+ className: ax([styles.root, styles[appearance]])
88
63
  }, /*#__PURE__*/React.createElement(Text, {
89
- size: "UNSAFE_small",
64
+ size: "small",
90
65
  align: "center",
91
- color: style !== null && style !== void 0 && style.color ? 'inherit' : textColors[appearance]
66
+ color: "inherit"
92
67
  }, badgeValueWithNegativeNumberSupported(children, max)));
93
68
  });
94
- Badge.displayName = 'Badge';
95
- export default Badge;
96
- var textColors = {
97
- added: 'color.text.success',
98
- default: 'color.text',
99
- important: 'color.text.inverse',
100
- primary: 'color.text.inverse',
101
- primaryInverted: 'color.text.brand',
102
- removed: 'color.text.danger'
103
- };
69
+ export default Badge;
package/offerings.json ADDED
@@ -0,0 +1,36 @@
1
+ [
2
+ {
3
+ "name": "Badge",
4
+ "package": "@atlaskit/badge",
5
+ "import": {
6
+ "name": "Badge",
7
+ "package": "@atlaskit/badge",
8
+ "type": "default"
9
+ },
10
+ "keywords": ["badge", "indicator", "numeric", "tally", "score", "count", "status"],
11
+ "categories": ["status-indicators"],
12
+ "shortDescription": "A badge is a visual indicator for numeric values such as tallies and scores, providing quick visual feedback.",
13
+ "status": "general-availability",
14
+ "accessibilityGuidelines": [
15
+ "Ensure badge content is announced by screen readers",
16
+ "Use appropriate color contrast for text readability",
17
+ "Provide meaningful context for numeric values",
18
+ "Consider alternative text for non-numeric badges"
19
+ ],
20
+ "usageGuidelines": [
21
+ "Use for displaying counts, scores, or status indicators",
22
+ "Keep badge content concise and meaningful",
23
+ "Use appropriate appearance variants for different contexts",
24
+ "Position badges near relevant content",
25
+ "Consider maximum value display limits"
26
+ ],
27
+ "contentGuidelines": [
28
+ "Use clear, concise numeric or text values",
29
+ "Ensure values are meaningful to users",
30
+ "Consider localization for number formatting",
31
+ "Use consistent formatting across similar badges"
32
+ ],
33
+ "generativeInstructions": "./docs/ai/badge-instructions.md",
34
+ "examples": ["./examples/ai/badge.tsx"]
35
+ }
36
+ ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/badge",
3
- "version": "18.1.6",
3
+ "version": "18.2.0",
4
4
  "description": "A badge is a visual indicator for numeric values such as tallies and scores.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -34,8 +34,8 @@
34
34
  "dependencies": {
35
35
  "@atlaskit/codemod-utils": "^4.2.0",
36
36
  "@atlaskit/platform-feature-flags": "^1.1.0",
37
- "@atlaskit/primitives": "^14.13.0",
38
- "@atlaskit/tokens": "^6.2.0",
37
+ "@atlaskit/primitives": "^14.15.0",
38
+ "@atlaskit/tokens": "^6.4.0",
39
39
  "@babel/runtime": "^7.0.0",
40
40
  "@compiled/react": "^0.18.3"
41
41
  },
@@ -46,11 +46,11 @@
46
46
  "@af/accessibility-testing": "workspace:^",
47
47
  "@af/integration-testing": "workspace:^",
48
48
  "@af/visual-regression": "workspace:^",
49
- "@atlaskit/docs": "^11.0.0",
50
- "@atlaskit/ds-lib": "^5.0.0",
49
+ "@atlaskit/docs": "^11.1.0",
50
+ "@atlaskit/ds-lib": "^5.1.0",
51
51
  "@atlaskit/link": "^3.2.0",
52
52
  "@atlaskit/section-message": "^8.7.0",
53
- "@atlaskit/theme": "^20.0.0",
53
+ "@atlaskit/theme": "^21.0.0",
54
54
  "@atlassian/feature-flags-test-utils": "^0.3.0",
55
55
  "@atlassian/ssr-tests": "0.3.0",
56
56
  "@testing-library/react": "^13.4.0",
@@ -82,9 +82,6 @@
82
82
  },
83
83
  "homepage": "https://atlassian.design/components/badge/",
84
84
  "platform-feature-flags": {
85
- "platform-component-visual-refresh": {
86
- "type": "boolean"
87
- },
88
85
  "platform_ken_2029_negative_numbers_badge": {
89
86
  "type": "boolean"
90
87
  }