@atlaskit/badge 15.3.0 → 16.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/badge
2
2
 
3
+ ## 16.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#94806](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/94806) [`6f40240a7290`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6f40240a7290) - Removed feature flag from previous release, keeping the newer changes.
8
+
9
+ ## 16.0.0
10
+
11
+ ### Major Changes
12
+
13
+ - [#88033](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/88033) [`8c3fac87dcc9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8c3fac87dcc9) - Badge now sets specific font size, line height, font style, and font family properties under the hood. If you previously had Badge wrapped with elements like `<em>` or `<strong>` that specify font style or font weight properties, there will be a visual difference as these styles are overriden within Badge. Avoid wrapping Badge in elements that modify text properties.
14
+
15
+ If you need to preserve these styles, wrap the children of Badge instead, for example: `<Badge><em>1</em></Badge>`. Please note however this is not fully supported and will not work with the `max` prop.
16
+
3
17
  ## 15.3.0
4
18
 
5
19
  ### Minor Changes
package/dist/cjs/badge.js CHANGED
@@ -1,20 +1,15 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  var _typeof = require("@babel/runtime/helpers/typeof");
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
8
  var _react = _interopRequireWildcard(require("react"));
10
- var _text = _interopRequireDefault(require("@atlaskit/ds-explorations/text"));
11
9
  var _primitives = require("@atlaskit/primitives");
12
10
  var _utils = require("./internal/utils");
13
11
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
14
12
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
15
- /* eslint-disable @atlassian/tangerine/import/entry-points */
16
- /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
17
-
18
13
  var boxStyles = (0, _primitives.xcss)({
19
14
  borderRadius: 'border.radius.200',
20
15
  display: 'inline-flex',
@@ -44,18 +39,15 @@ var Badge = /*#__PURE__*/(0, _react.memo)(function Badge(_ref) {
44
39
  as: "span",
45
40
  backgroundColor: backgroundColors[appearance],
46
41
  xcss: boxStyles,
47
- style: style !== null && style !== void 0 && style.backgroundColor ? {
48
- backgroundColor: style.backgroundColor
49
- } : undefined,
42
+ style: {
43
+ background: style === null || style === void 0 ? void 0 : style.backgroundColor,
44
+ color: style === null || style === void 0 ? void 0 : style.color
45
+ },
50
46
  paddingInline: "space.075"
51
- }, /*#__PURE__*/_react.default.createElement(_text.default, {
52
- fontSize: "size.075",
53
- lineHeight: "lineHeight.100",
54
- textAlign: "center",
55
- color: textColors[appearance],
56
- UNSAFE_style: style !== null && style !== void 0 && style.color ? {
57
- color: style.color
58
- } : undefined
47
+ }, /*#__PURE__*/_react.default.createElement(_primitives.Text, {
48
+ size: "UNSAFE_small",
49
+ align: "center",
50
+ color: style !== null && style !== void 0 && style.color ? 'inherit' : textColors[appearance]
59
51
  }, typeof children === 'number' && max ? (0, _utils.formatValue)(children, max) : children));
60
52
  });
61
53
  Badge.displayName = 'Badge';
@@ -69,10 +61,10 @@ var backgroundColors = {
69
61
  removed: 'color.background.danger'
70
62
  };
71
63
  var textColors = {
72
- added: 'success',
64
+ added: 'color.text.success',
73
65
  default: 'color.text',
74
- important: 'inverse',
75
- primary: 'inverse',
76
- primaryInverted: 'brand',
77
- removed: 'danger'
66
+ important: 'color.text.inverse',
67
+ primary: 'color.text.inverse',
68
+ primaryInverted: 'color.text.brand',
69
+ removed: 'color.text.danger'
78
70
  };
@@ -1,8 +1,5 @@
1
- /* eslint-disable @atlassian/tangerine/import/entry-points */
2
- /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
3
1
  import React, { memo } from 'react';
4
- import Text from '@atlaskit/ds-explorations/text';
5
- import { Box, xcss } from '@atlaskit/primitives';
2
+ import { Box, Text, xcss } from '@atlaskit/primitives';
6
3
  import { formatValue } from './internal/utils';
7
4
  const boxStyles = xcss({
8
5
  borderRadius: 'border.radius.200',
@@ -31,18 +28,15 @@ const Badge = /*#__PURE__*/memo(function Badge({
31
28
  as: "span",
32
29
  backgroundColor: backgroundColors[appearance],
33
30
  xcss: boxStyles,
34
- style: style !== null && style !== void 0 && style.backgroundColor ? {
35
- backgroundColor: style.backgroundColor
36
- } : undefined,
31
+ style: {
32
+ background: style === null || style === void 0 ? void 0 : style.backgroundColor,
33
+ color: style === null || style === void 0 ? void 0 : style.color
34
+ },
37
35
  paddingInline: "space.075"
38
36
  }, /*#__PURE__*/React.createElement(Text, {
39
- fontSize: "size.075",
40
- lineHeight: "lineHeight.100",
41
- textAlign: "center",
42
- color: textColors[appearance],
43
- UNSAFE_style: style !== null && style !== void 0 && style.color ? {
44
- color: style.color
45
- } : undefined
37
+ size: "UNSAFE_small",
38
+ align: "center",
39
+ color: style !== null && style !== void 0 && style.color ? 'inherit' : textColors[appearance]
46
40
  }, typeof children === 'number' && max ? formatValue(children, max) : children));
47
41
  });
48
42
  Badge.displayName = 'Badge';
@@ -56,10 +50,10 @@ const backgroundColors = {
56
50
  removed: 'color.background.danger'
57
51
  };
58
52
  const textColors = {
59
- added: 'success',
53
+ added: 'color.text.success',
60
54
  default: 'color.text',
61
- important: 'inverse',
62
- primary: 'inverse',
63
- primaryInverted: 'brand',
64
- removed: 'danger'
55
+ important: 'color.text.inverse',
56
+ primary: 'color.text.inverse',
57
+ primaryInverted: 'color.text.brand',
58
+ removed: 'color.text.danger'
65
59
  };
package/dist/esm/badge.js CHANGED
@@ -1,8 +1,5 @@
1
- /* eslint-disable @atlassian/tangerine/import/entry-points */
2
- /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
3
1
  import React, { memo } from 'react';
4
- import Text from '@atlaskit/ds-explorations/text';
5
- import { Box, xcss } from '@atlaskit/primitives';
2
+ import { Box, Text, xcss } from '@atlaskit/primitives';
6
3
  import { formatValue } from './internal/utils';
7
4
  var boxStyles = xcss({
8
5
  borderRadius: 'border.radius.200',
@@ -33,18 +30,15 @@ var Badge = /*#__PURE__*/memo(function Badge(_ref) {
33
30
  as: "span",
34
31
  backgroundColor: backgroundColors[appearance],
35
32
  xcss: boxStyles,
36
- style: style !== null && style !== void 0 && style.backgroundColor ? {
37
- backgroundColor: style.backgroundColor
38
- } : undefined,
33
+ style: {
34
+ background: style === null || style === void 0 ? void 0 : style.backgroundColor,
35
+ color: style === null || style === void 0 ? void 0 : style.color
36
+ },
39
37
  paddingInline: "space.075"
40
38
  }, /*#__PURE__*/React.createElement(Text, {
41
- fontSize: "size.075",
42
- lineHeight: "lineHeight.100",
43
- textAlign: "center",
44
- color: textColors[appearance],
45
- UNSAFE_style: style !== null && style !== void 0 && style.color ? {
46
- color: style.color
47
- } : undefined
39
+ size: "UNSAFE_small",
40
+ align: "center",
41
+ color: style !== null && style !== void 0 && style.color ? 'inherit' : textColors[appearance]
48
42
  }, typeof children === 'number' && max ? formatValue(children, max) : children));
49
43
  });
50
44
  Badge.displayName = 'Badge';
@@ -58,10 +52,10 @@ var backgroundColors = {
58
52
  removed: 'color.background.danger'
59
53
  };
60
54
  var textColors = {
61
- added: 'success',
55
+ added: 'color.text.success',
62
56
  default: 'color.text',
63
- important: 'inverse',
64
- primary: 'inverse',
65
- primaryInverted: 'brand',
66
- removed: 'danger'
57
+ important: 'color.text.inverse',
58
+ primary: 'color.text.inverse',
59
+ primaryInverted: 'color.text.brand',
60
+ removed: 'color.text.danger'
67
61
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/badge",
3
- "version": "15.3.0",
3
+ "version": "16.1.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/"
@@ -40,8 +40,7 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@atlaskit/codemod-utils": "^4.2.0",
43
- "@atlaskit/ds-explorations": "^3.4.0",
44
- "@atlaskit/primitives": "^5.4.0",
43
+ "@atlaskit/primitives": "^5.6.0",
45
44
  "@babel/runtime": "^7.0.0"
46
45
  },
47
46
  "peerDependencies": {
@@ -51,7 +50,7 @@
51
50
  "@af/accessibility-testing": "*",
52
51
  "@af/integration-testing": "*",
53
52
  "@af/visual-regression": "*",
54
- "@atlaskit/ds-lib": "^2.2.0",
53
+ "@atlaskit/ds-lib": "^2.3.0",
55
54
  "@atlaskit/ssr": "*",
56
55
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
57
56
  "@emotion/react": "^11.7.1",