@atlaskit/badge 15.2.7 → 16.0.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 +18 -0
- package/dist/cjs/badge.js +20 -9
- package/dist/es2019/badge.js +22 -10
- package/dist/esm/badge.js +22 -10
- package/package.json +12 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/badge
|
|
2
2
|
|
|
3
|
+
## 16.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#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.
|
|
8
|
+
|
|
9
|
+
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.
|
|
10
|
+
|
|
11
|
+
## 15.3.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#87252](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/87252) [`eef585934a84`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/eef585934a84) - Add react 18 support
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 15.2.7
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/cjs/badge.js
CHANGED
|
@@ -8,13 +8,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _text = _interopRequireDefault(require("@atlaskit/ds-explorations/text"));
|
|
11
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
12
|
var _primitives = require("@atlaskit/primitives");
|
|
12
13
|
var _utils = require("./internal/utils");
|
|
13
14
|
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
15
|
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
16
|
var boxStyles = (0, _primitives.xcss)({
|
|
19
17
|
borderRadius: 'border.radius.200',
|
|
20
18
|
display: 'inline-flex',
|
|
@@ -44,15 +42,20 @@ var Badge = /*#__PURE__*/(0, _react.memo)(function Badge(_ref) {
|
|
|
44
42
|
as: "span",
|
|
45
43
|
backgroundColor: backgroundColors[appearance],
|
|
46
44
|
xcss: boxStyles,
|
|
47
|
-
style:
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
style: {
|
|
46
|
+
background: style === null || style === void 0 ? void 0 : style.backgroundColor,
|
|
47
|
+
color: style === null || style === void 0 ? void 0 : style.color
|
|
48
|
+
},
|
|
50
49
|
paddingInline: "space.075"
|
|
51
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
50
|
+
}, (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.remove-badge-text-style-inheritance_add9o') ? /*#__PURE__*/_react.default.createElement(_primitives.Text, {
|
|
51
|
+
size: "UNSAFE_small",
|
|
52
|
+
align: "center",
|
|
53
|
+
color: style !== null && style !== void 0 && style.color ? 'inherit' : textColors[appearance]
|
|
54
|
+
}, typeof children === 'number' && max ? (0, _utils.formatValue)(children, max) : children) : /*#__PURE__*/_react.default.createElement(_text.default, {
|
|
52
55
|
fontSize: "size.075",
|
|
53
56
|
lineHeight: "lineHeight.100",
|
|
54
57
|
textAlign: "center",
|
|
55
|
-
color:
|
|
58
|
+
color: textColorsOld[appearance],
|
|
56
59
|
UNSAFE_style: style !== null && style !== void 0 && style.color ? {
|
|
57
60
|
color: style.color
|
|
58
61
|
} : undefined
|
|
@@ -68,11 +71,19 @@ var backgroundColors = {
|
|
|
68
71
|
primaryInverted: 'elevation.surface',
|
|
69
72
|
removed: 'color.background.danger'
|
|
70
73
|
};
|
|
71
|
-
var
|
|
74
|
+
var textColorsOld = {
|
|
72
75
|
added: 'success',
|
|
73
76
|
default: 'color.text',
|
|
74
77
|
important: 'inverse',
|
|
75
78
|
primary: 'inverse',
|
|
76
79
|
primaryInverted: 'brand',
|
|
77
80
|
removed: 'danger'
|
|
81
|
+
};
|
|
82
|
+
var textColors = {
|
|
83
|
+
added: 'color.text.success',
|
|
84
|
+
default: 'color.text',
|
|
85
|
+
important: 'color.text.inverse',
|
|
86
|
+
primary: 'color.text.inverse',
|
|
87
|
+
primaryInverted: 'color.text.brand',
|
|
88
|
+
removed: 'color.text.danger'
|
|
78
89
|
};
|
package/dist/es2019/badge.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
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
|
|
5
|
-
import {
|
|
2
|
+
import OldText from '@atlaskit/ds-explorations/text';
|
|
3
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
4
|
+
import { Box, Text, xcss } from '@atlaskit/primitives';
|
|
6
5
|
import { formatValue } from './internal/utils';
|
|
7
6
|
const boxStyles = xcss({
|
|
8
7
|
borderRadius: 'border.radius.200',
|
|
@@ -31,15 +30,20 @@ const Badge = /*#__PURE__*/memo(function Badge({
|
|
|
31
30
|
as: "span",
|
|
32
31
|
backgroundColor: backgroundColors[appearance],
|
|
33
32
|
xcss: boxStyles,
|
|
34
|
-
style:
|
|
35
|
-
|
|
36
|
-
|
|
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
|
+
},
|
|
37
37
|
paddingInline: "space.075"
|
|
38
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
38
|
+
}, getBooleanFF('platform.design-system-team.remove-badge-text-style-inheritance_add9o') ? /*#__PURE__*/React.createElement(Text, {
|
|
39
|
+
size: "UNSAFE_small",
|
|
40
|
+
align: "center",
|
|
41
|
+
color: style !== null && style !== void 0 && style.color ? 'inherit' : textColors[appearance]
|
|
42
|
+
}, typeof children === 'number' && max ? formatValue(children, max) : children) : /*#__PURE__*/React.createElement(OldText, {
|
|
39
43
|
fontSize: "size.075",
|
|
40
44
|
lineHeight: "lineHeight.100",
|
|
41
45
|
textAlign: "center",
|
|
42
|
-
color:
|
|
46
|
+
color: textColorsOld[appearance],
|
|
43
47
|
UNSAFE_style: style !== null && style !== void 0 && style.color ? {
|
|
44
48
|
color: style.color
|
|
45
49
|
} : undefined
|
|
@@ -55,11 +59,19 @@ const backgroundColors = {
|
|
|
55
59
|
primaryInverted: 'elevation.surface',
|
|
56
60
|
removed: 'color.background.danger'
|
|
57
61
|
};
|
|
58
|
-
const
|
|
62
|
+
const textColorsOld = {
|
|
59
63
|
added: 'success',
|
|
60
64
|
default: 'color.text',
|
|
61
65
|
important: 'inverse',
|
|
62
66
|
primary: 'inverse',
|
|
63
67
|
primaryInverted: 'brand',
|
|
64
68
|
removed: 'danger'
|
|
69
|
+
};
|
|
70
|
+
const textColors = {
|
|
71
|
+
added: 'color.text.success',
|
|
72
|
+
default: 'color.text',
|
|
73
|
+
important: 'color.text.inverse',
|
|
74
|
+
primary: 'color.text.inverse',
|
|
75
|
+
primaryInverted: 'color.text.brand',
|
|
76
|
+
removed: 'color.text.danger'
|
|
65
77
|
};
|
package/dist/esm/badge.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
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
|
|
5
|
-
import {
|
|
2
|
+
import OldText from '@atlaskit/ds-explorations/text';
|
|
3
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
4
|
+
import { Box, Text, xcss } from '@atlaskit/primitives';
|
|
6
5
|
import { formatValue } from './internal/utils';
|
|
7
6
|
var boxStyles = xcss({
|
|
8
7
|
borderRadius: 'border.radius.200',
|
|
@@ -33,15 +32,20 @@ var Badge = /*#__PURE__*/memo(function Badge(_ref) {
|
|
|
33
32
|
as: "span",
|
|
34
33
|
backgroundColor: backgroundColors[appearance],
|
|
35
34
|
xcss: boxStyles,
|
|
36
|
-
style:
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
style: {
|
|
36
|
+
background: style === null || style === void 0 ? void 0 : style.backgroundColor,
|
|
37
|
+
color: style === null || style === void 0 ? void 0 : style.color
|
|
38
|
+
},
|
|
39
39
|
paddingInline: "space.075"
|
|
40
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
40
|
+
}, getBooleanFF('platform.design-system-team.remove-badge-text-style-inheritance_add9o') ? /*#__PURE__*/React.createElement(Text, {
|
|
41
|
+
size: "UNSAFE_small",
|
|
42
|
+
align: "center",
|
|
43
|
+
color: style !== null && style !== void 0 && style.color ? 'inherit' : textColors[appearance]
|
|
44
|
+
}, typeof children === 'number' && max ? formatValue(children, max) : children) : /*#__PURE__*/React.createElement(OldText, {
|
|
41
45
|
fontSize: "size.075",
|
|
42
46
|
lineHeight: "lineHeight.100",
|
|
43
47
|
textAlign: "center",
|
|
44
|
-
color:
|
|
48
|
+
color: textColorsOld[appearance],
|
|
45
49
|
UNSAFE_style: style !== null && style !== void 0 && style.color ? {
|
|
46
50
|
color: style.color
|
|
47
51
|
} : undefined
|
|
@@ -57,11 +61,19 @@ var backgroundColors = {
|
|
|
57
61
|
primaryInverted: 'elevation.surface',
|
|
58
62
|
removed: 'color.background.danger'
|
|
59
63
|
};
|
|
60
|
-
var
|
|
64
|
+
var textColorsOld = {
|
|
61
65
|
added: 'success',
|
|
62
66
|
default: 'color.text',
|
|
63
67
|
important: 'inverse',
|
|
64
68
|
primary: 'inverse',
|
|
65
69
|
primaryInverted: 'brand',
|
|
66
70
|
removed: 'danger'
|
|
71
|
+
};
|
|
72
|
+
var textColors = {
|
|
73
|
+
added: 'color.text.success',
|
|
74
|
+
default: 'color.text',
|
|
75
|
+
important: 'color.text.inverse',
|
|
76
|
+
primary: 'color.text.inverse',
|
|
77
|
+
primaryInverted: 'color.text.brand',
|
|
78
|
+
removed: 'color.text.danger'
|
|
67
79
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/badge",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "16.0.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/"
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"name": "Badge",
|
|
33
33
|
"category": "Components"
|
|
34
34
|
},
|
|
35
|
-
"runReact18":
|
|
35
|
+
"runReact18": true
|
|
36
36
|
},
|
|
37
37
|
"af:exports": {
|
|
38
38
|
"./types": "./src/entry-points/types.tsx",
|
|
@@ -40,12 +40,13 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@atlaskit/codemod-utils": "^4.2.0",
|
|
43
|
-
"@atlaskit/ds-explorations": "^3.
|
|
44
|
-
"@atlaskit/
|
|
43
|
+
"@atlaskit/ds-explorations": "^3.4.0",
|
|
44
|
+
"@atlaskit/platform-feature-flags": "^0.2.5",
|
|
45
|
+
"@atlaskit/primitives": "^5.5.0",
|
|
45
46
|
"@babel/runtime": "^7.0.0"
|
|
46
47
|
},
|
|
47
48
|
"peerDependencies": {
|
|
48
|
-
"react": "^16.8.0"
|
|
49
|
+
"react": "^16.8.0 || ^17.0.0 || ~18.2.0"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
52
|
"@af/accessibility-testing": "*",
|
|
@@ -87,5 +88,10 @@
|
|
|
87
88
|
}
|
|
88
89
|
},
|
|
89
90
|
"homepage": "https://atlassian.design/components/badge/",
|
|
90
|
-
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
|
|
91
|
+
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1",
|
|
92
|
+
"platform-feature-flags": {
|
|
93
|
+
"platform.design-system-team.remove-badge-text-style-inheritance_add9o": {
|
|
94
|
+
"type": "boolean"
|
|
95
|
+
}
|
|
96
|
+
}
|
|
91
97
|
}
|