@atlaskit/badge 18.4.5 → 18.4.6
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 +6 -0
- package/dist/cjs/appearance-mapping-to-old.js +25 -0
- package/dist/cjs/appearance-mapping.js +26 -0
- package/dist/cjs/badge-new.js +3 -43
- package/dist/cjs/badge.js +8 -5
- package/dist/cjs/internal/{utils.js → format-value-with-negative-support.js} +0 -20
- package/dist/cjs/internal/format-value.js +25 -0
- package/dist/es2019/appearance-mapping-to-old.js +19 -0
- package/dist/es2019/appearance-mapping.js +20 -0
- package/dist/es2019/badge-new.js +1 -41
- package/dist/es2019/badge.js +4 -2
- package/dist/es2019/internal/{utils.js → format-value-with-negative-support.js} +0 -18
- package/dist/es2019/internal/format-value.js +18 -0
- package/dist/esm/appearance-mapping-to-old.js +19 -0
- package/dist/esm/appearance-mapping.js +20 -0
- package/dist/esm/badge-new.js +1 -41
- package/dist/esm/badge.js +4 -2
- package/dist/esm/internal/{utils.js → format-value-with-negative-support.js} +0 -19
- package/dist/esm/internal/format-value.js +19 -0
- package/dist/types/appearance-mapping-to-old.d.ts +5 -0
- package/dist/types/appearance-mapping.d.ts +6 -0
- package/dist/types/badge-new.d.ts +1 -11
- package/dist/{types-ts4.5/internal/utils.d.ts → types/internal/format-value-with-negative-support.d.ts} +0 -1
- package/dist/types/internal/format-value.d.ts +1 -0
- package/dist/types-ts4.5/appearance-mapping-to-old.d.ts +5 -0
- package/dist/types-ts4.5/appearance-mapping.d.ts +6 -0
- package/dist/types-ts4.5/badge-new.d.ts +1 -11
- package/dist/{types/internal/utils.d.ts → types-ts4.5/internal/format-value-with-negative-support.d.ts} +0 -1
- package/dist/types-ts4.5/internal/format-value.d.ts +1 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.appearanceMappingToOld = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* @jsxRuntime classic
|
|
9
|
+
* @jsx jsx
|
|
10
|
+
*/
|
|
11
|
+
var appearanceMappingToOld = exports.appearanceMappingToOld = {
|
|
12
|
+
added: 'added',
|
|
13
|
+
removed: 'removed',
|
|
14
|
+
default: 'default',
|
|
15
|
+
primary: 'primary',
|
|
16
|
+
primaryInverted: 'primaryInverted',
|
|
17
|
+
important: 'important',
|
|
18
|
+
danger: 'removed',
|
|
19
|
+
success: 'added',
|
|
20
|
+
information: 'primary',
|
|
21
|
+
inverse: 'primaryInverted',
|
|
22
|
+
neutral: 'default',
|
|
23
|
+
warning: 'default',
|
|
24
|
+
discovery: 'default'
|
|
25
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.appearanceMapping = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* @jsxRuntime classic
|
|
9
|
+
* @jsx jsx
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
var appearanceMapping = exports.appearanceMapping = {
|
|
13
|
+
added: 'success',
|
|
14
|
+
removed: 'danger',
|
|
15
|
+
default: 'neutral',
|
|
16
|
+
primary: 'information',
|
|
17
|
+
primaryInverted: 'inverse',
|
|
18
|
+
important: 'danger',
|
|
19
|
+
warning: 'warning',
|
|
20
|
+
discovery: 'discovery',
|
|
21
|
+
danger: 'danger',
|
|
22
|
+
success: 'success',
|
|
23
|
+
information: 'information',
|
|
24
|
+
inverse: 'inverse',
|
|
25
|
+
neutral: 'neutral'
|
|
26
|
+
};
|
package/dist/cjs/badge-new.js
CHANGED
|
@@ -5,54 +5,14 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default =
|
|
8
|
+
exports.default = void 0;
|
|
9
9
|
require("./badge-new.compiled.css");
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var React = _react;
|
|
12
12
|
var _runtime = require("@compiled/react/runtime");
|
|
13
13
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
14
|
-
var
|
|
14
|
+
var _formatValue = require("./internal/format-value");
|
|
15
15
|
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); }
|
|
16
|
-
/**
|
|
17
|
-
* Mapping from old appearance names to new appearance names for visual refresh.
|
|
18
|
-
* Used when Badge component passes old prop names to BadgeNew.
|
|
19
|
-
*/
|
|
20
|
-
var appearanceMapping = exports.appearanceMapping = {
|
|
21
|
-
added: 'success',
|
|
22
|
-
removed: 'danger',
|
|
23
|
-
default: 'neutral',
|
|
24
|
-
primary: 'information',
|
|
25
|
-
primaryInverted: 'inverse',
|
|
26
|
-
important: 'danger',
|
|
27
|
-
warning: 'warning',
|
|
28
|
-
discovery: 'discovery',
|
|
29
|
-
danger: 'danger',
|
|
30
|
-
success: 'success',
|
|
31
|
-
information: 'information',
|
|
32
|
-
inverse: 'inverse',
|
|
33
|
-
neutral: 'neutral'
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Mapping from new appearance names to old appearance names for visual refresh.
|
|
38
|
-
* Used when BadgeNew migration is done.
|
|
39
|
-
*/
|
|
40
|
-
var appearanceMappingToOld = exports.appearanceMappingToOld = {
|
|
41
|
-
added: 'added',
|
|
42
|
-
removed: 'removed',
|
|
43
|
-
default: 'default',
|
|
44
|
-
primary: 'primary',
|
|
45
|
-
primaryInverted: 'primaryInverted',
|
|
46
|
-
important: 'important',
|
|
47
|
-
danger: 'removed',
|
|
48
|
-
success: 'added',
|
|
49
|
-
information: 'primary',
|
|
50
|
-
inverse: 'primaryInverted',
|
|
51
|
-
neutral: 'default',
|
|
52
|
-
warning: 'default',
|
|
53
|
-
discovery: 'default'
|
|
54
|
-
};
|
|
55
|
-
|
|
56
16
|
/* eslint-disable @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors */
|
|
57
17
|
// Nested selectors with data attributes are required for theme switching
|
|
58
18
|
var stylesNew = {
|
|
@@ -68,7 +28,7 @@ var stylesNew = {
|
|
|
68
28
|
/* eslint-enable @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors */
|
|
69
29
|
|
|
70
30
|
var badgeValueWithNegativeNumberSupported = function badgeValueWithNegativeNumberSupported(children, max) {
|
|
71
|
-
return typeof children === 'number' && max ? (0,
|
|
31
|
+
return typeof children === 'number' && max ? (0, _formatValue.formatValue)(children, max) : children;
|
|
72
32
|
};
|
|
73
33
|
|
|
74
34
|
/**
|
package/dist/cjs/badge.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* badge.tsx generated by @compiled/babel-plugin v0.39.1 */
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
5
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
6
|
Object.defineProperty(exports, "__esModule", {
|
|
6
7
|
value: true
|
|
@@ -12,8 +13,10 @@ var React = _react;
|
|
|
12
13
|
var _runtime = require("@compiled/react/runtime");
|
|
13
14
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
15
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
15
|
-
var
|
|
16
|
-
var
|
|
16
|
+
var _appearanceMapping = require("./appearance-mapping");
|
|
17
|
+
var _appearanceMappingToOld = require("./appearance-mapping-to-old");
|
|
18
|
+
var _badgeNew = _interopRequireDefault(require("./badge-new"));
|
|
19
|
+
var _formatValueWithNegativeSupport = require("./internal/format-value-with-negative-support");
|
|
17
20
|
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); }
|
|
18
21
|
/**
|
|
19
22
|
* Visual refresh colors.
|
|
@@ -36,7 +39,7 @@ var styles = {
|
|
|
36
39
|
removed: "_bfhk1gly _syazi7uo"
|
|
37
40
|
};
|
|
38
41
|
var badgeValueWithNegativeNumberSupported = function badgeValueWithNegativeNumberSupported(children, max) {
|
|
39
|
-
return typeof children === 'number' && typeof max === 'number' ? (0,
|
|
42
|
+
return typeof children === 'number' && typeof max === 'number' ? (0, _formatValueWithNegativeSupport.formatValueWithNegativeSupport)(children, max) : children;
|
|
40
43
|
};
|
|
41
44
|
|
|
42
45
|
/**
|
|
@@ -59,7 +62,7 @@ var Badge = /*#__PURE__*/(0, _react.memo)(function Badge(_ref) {
|
|
|
59
62
|
testId = _ref.testId;
|
|
60
63
|
if ((0, _platformFeatureFlags.fg)('platform-dst-lozenge-tag-badge-visual-uplifts')) {
|
|
61
64
|
// Map old appearance names to new ones
|
|
62
|
-
var newAppearance =
|
|
65
|
+
var newAppearance = _appearanceMapping.appearanceMapping[appearance];
|
|
63
66
|
return /*#__PURE__*/React.createElement(_badgeNew.default, {
|
|
64
67
|
appearance: newAppearance,
|
|
65
68
|
max: max,
|
|
@@ -67,7 +70,7 @@ var Badge = /*#__PURE__*/(0, _react.memo)(function Badge(_ref) {
|
|
|
67
70
|
testId: testId
|
|
68
71
|
}, children);
|
|
69
72
|
}
|
|
70
|
-
var oldAppearance =
|
|
73
|
+
var oldAppearance = _appearanceMappingToOld.appearanceMappingToOld[appearance];
|
|
71
74
|
return /*#__PURE__*/React.createElement("span", {
|
|
72
75
|
"data-testid": testId,
|
|
73
76
|
style: {
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.formatValue = formatValue;
|
|
7
6
|
exports.formatValueWithNegativeSupport = formatValueWithNegativeSupport;
|
|
8
7
|
function getSafeValueWithNegativeSupport() {
|
|
9
8
|
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
@@ -34,23 +33,4 @@ function formatValueWithNegativeSupport(value, max) {
|
|
|
34
33
|
return '∞';
|
|
35
34
|
}
|
|
36
35
|
return safeValue.toString();
|
|
37
|
-
}
|
|
38
|
-
function getSafeValue() {
|
|
39
|
-
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
40
|
-
var numericValue = +value;
|
|
41
|
-
if (numericValue < 0) {
|
|
42
|
-
return 0;
|
|
43
|
-
}
|
|
44
|
-
return value;
|
|
45
|
-
}
|
|
46
|
-
function formatValue(value, max) {
|
|
47
|
-
var safeValue = getSafeValue(value);
|
|
48
|
-
var safeMax = getSafeValue(max);
|
|
49
|
-
if (safeMax && safeMax < safeValue) {
|
|
50
|
-
return "".concat(safeMax, "+");
|
|
51
|
-
}
|
|
52
|
-
if (safeValue === Infinity) {
|
|
53
|
-
return '∞';
|
|
54
|
-
}
|
|
55
|
-
return safeValue.toString();
|
|
56
36
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.formatValue = formatValue;
|
|
7
|
+
function getSafeValue() {
|
|
8
|
+
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
9
|
+
var numericValue = +value;
|
|
10
|
+
if (numericValue < 0) {
|
|
11
|
+
return 0;
|
|
12
|
+
}
|
|
13
|
+
return value;
|
|
14
|
+
}
|
|
15
|
+
function formatValue(value, max) {
|
|
16
|
+
var safeValue = getSafeValue(value);
|
|
17
|
+
var safeMax = getSafeValue(max);
|
|
18
|
+
if (safeMax && safeMax < safeValue) {
|
|
19
|
+
return "".concat(safeMax, "+");
|
|
20
|
+
}
|
|
21
|
+
if (safeValue === Infinity) {
|
|
22
|
+
return '∞';
|
|
23
|
+
}
|
|
24
|
+
return safeValue.toString();
|
|
25
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
export const appearanceMappingToOld = {
|
|
6
|
+
added: 'added',
|
|
7
|
+
removed: 'removed',
|
|
8
|
+
default: 'default',
|
|
9
|
+
primary: 'primary',
|
|
10
|
+
primaryInverted: 'primaryInverted',
|
|
11
|
+
important: 'important',
|
|
12
|
+
danger: 'removed',
|
|
13
|
+
success: 'added',
|
|
14
|
+
information: 'primary',
|
|
15
|
+
inverse: 'primaryInverted',
|
|
16
|
+
neutral: 'default',
|
|
17
|
+
warning: 'default',
|
|
18
|
+
discovery: 'default'
|
|
19
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export const appearanceMapping = {
|
|
7
|
+
added: 'success',
|
|
8
|
+
removed: 'danger',
|
|
9
|
+
default: 'neutral',
|
|
10
|
+
primary: 'information',
|
|
11
|
+
primaryInverted: 'inverse',
|
|
12
|
+
important: 'danger',
|
|
13
|
+
warning: 'warning',
|
|
14
|
+
discovery: 'discovery',
|
|
15
|
+
danger: 'danger',
|
|
16
|
+
success: 'success',
|
|
17
|
+
information: 'information',
|
|
18
|
+
inverse: 'inverse',
|
|
19
|
+
neutral: 'neutral'
|
|
20
|
+
};
|
package/dist/es2019/badge-new.js
CHANGED
|
@@ -4,47 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
5
|
import { memo } from 'react';
|
|
6
6
|
import { Text } from '@atlaskit/primitives/compiled';
|
|
7
|
-
import { formatValue } from './internal/
|
|
8
|
-
/**
|
|
9
|
-
* Mapping from old appearance names to new appearance names for visual refresh.
|
|
10
|
-
* Used when Badge component passes old prop names to BadgeNew.
|
|
11
|
-
*/
|
|
12
|
-
export const appearanceMapping = {
|
|
13
|
-
added: 'success',
|
|
14
|
-
removed: 'danger',
|
|
15
|
-
default: 'neutral',
|
|
16
|
-
primary: 'information',
|
|
17
|
-
primaryInverted: 'inverse',
|
|
18
|
-
important: 'danger',
|
|
19
|
-
warning: 'warning',
|
|
20
|
-
discovery: 'discovery',
|
|
21
|
-
danger: 'danger',
|
|
22
|
-
success: 'success',
|
|
23
|
-
information: 'information',
|
|
24
|
-
inverse: 'inverse',
|
|
25
|
-
neutral: 'neutral'
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Mapping from new appearance names to old appearance names for visual refresh.
|
|
30
|
-
* Used when BadgeNew migration is done.
|
|
31
|
-
*/
|
|
32
|
-
export const appearanceMappingToOld = {
|
|
33
|
-
added: 'added',
|
|
34
|
-
removed: 'removed',
|
|
35
|
-
default: 'default',
|
|
36
|
-
primary: 'primary',
|
|
37
|
-
primaryInverted: 'primaryInverted',
|
|
38
|
-
important: 'important',
|
|
39
|
-
danger: 'removed',
|
|
40
|
-
success: 'added',
|
|
41
|
-
information: 'primary',
|
|
42
|
-
inverse: 'primaryInverted',
|
|
43
|
-
neutral: 'default',
|
|
44
|
-
warning: 'default',
|
|
45
|
-
discovery: 'default'
|
|
46
|
-
};
|
|
47
|
-
|
|
7
|
+
import { formatValue } from './internal/format-value';
|
|
48
8
|
/* eslint-disable @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors */
|
|
49
9
|
// Nested selectors with data attributes are required for theme switching
|
|
50
10
|
const stylesNew = {
|
package/dist/es2019/badge.js
CHANGED
|
@@ -5,8 +5,10 @@ import { ax, ix } from "@compiled/react/runtime";
|
|
|
5
5
|
import { memo } from 'react';
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
7
|
import { Text } from '@atlaskit/primitives/compiled';
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
8
|
+
import { appearanceMapping } from './appearance-mapping';
|
|
9
|
+
import { appearanceMappingToOld } from './appearance-mapping-to-old';
|
|
10
|
+
import BadgeNew from './badge-new';
|
|
11
|
+
import { formatValueWithNegativeSupport } from './internal/format-value-with-negative-support';
|
|
10
12
|
/**
|
|
11
13
|
* Visual refresh colors.
|
|
12
14
|
* Hardcoded hex colors are used as the they will be updated in the labelling system work and we want to avoid frequent UI changes.\
|
|
@@ -26,22 +26,4 @@ export function formatValueWithNegativeSupport(value, max) {
|
|
|
26
26
|
return '∞';
|
|
27
27
|
}
|
|
28
28
|
return safeValue.toString();
|
|
29
|
-
}
|
|
30
|
-
function getSafeValue(value = 0) {
|
|
31
|
-
const numericValue = +value;
|
|
32
|
-
if (numericValue < 0) {
|
|
33
|
-
return 0;
|
|
34
|
-
}
|
|
35
|
-
return value;
|
|
36
|
-
}
|
|
37
|
-
export function formatValue(value, max) {
|
|
38
|
-
const safeValue = getSafeValue(value);
|
|
39
|
-
const safeMax = getSafeValue(max);
|
|
40
|
-
if (safeMax && safeMax < safeValue) {
|
|
41
|
-
return `${safeMax}+`;
|
|
42
|
-
}
|
|
43
|
-
if (safeValue === Infinity) {
|
|
44
|
-
return '∞';
|
|
45
|
-
}
|
|
46
|
-
return safeValue.toString();
|
|
47
29
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
function getSafeValue(value = 0) {
|
|
2
|
+
const numericValue = +value;
|
|
3
|
+
if (numericValue < 0) {
|
|
4
|
+
return 0;
|
|
5
|
+
}
|
|
6
|
+
return value;
|
|
7
|
+
}
|
|
8
|
+
export function formatValue(value, max) {
|
|
9
|
+
const safeValue = getSafeValue(value);
|
|
10
|
+
const safeMax = getSafeValue(max);
|
|
11
|
+
if (safeMax && safeMax < safeValue) {
|
|
12
|
+
return `${safeMax}+`;
|
|
13
|
+
}
|
|
14
|
+
if (safeValue === Infinity) {
|
|
15
|
+
return '∞';
|
|
16
|
+
}
|
|
17
|
+
return safeValue.toString();
|
|
18
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
export var appearanceMappingToOld = {
|
|
6
|
+
added: 'added',
|
|
7
|
+
removed: 'removed',
|
|
8
|
+
default: 'default',
|
|
9
|
+
primary: 'primary',
|
|
10
|
+
primaryInverted: 'primaryInverted',
|
|
11
|
+
important: 'important',
|
|
12
|
+
danger: 'removed',
|
|
13
|
+
success: 'added',
|
|
14
|
+
information: 'primary',
|
|
15
|
+
inverse: 'primaryInverted',
|
|
16
|
+
neutral: 'default',
|
|
17
|
+
warning: 'default',
|
|
18
|
+
discovery: 'default'
|
|
19
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export var appearanceMapping = {
|
|
7
|
+
added: 'success',
|
|
8
|
+
removed: 'danger',
|
|
9
|
+
default: 'neutral',
|
|
10
|
+
primary: 'information',
|
|
11
|
+
primaryInverted: 'inverse',
|
|
12
|
+
important: 'danger',
|
|
13
|
+
warning: 'warning',
|
|
14
|
+
discovery: 'discovery',
|
|
15
|
+
danger: 'danger',
|
|
16
|
+
success: 'success',
|
|
17
|
+
information: 'information',
|
|
18
|
+
inverse: 'inverse',
|
|
19
|
+
neutral: 'neutral'
|
|
20
|
+
};
|
package/dist/esm/badge-new.js
CHANGED
|
@@ -4,47 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
5
|
import { memo } from 'react';
|
|
6
6
|
import { Text } from '@atlaskit/primitives/compiled';
|
|
7
|
-
import { formatValue } from './internal/
|
|
8
|
-
/**
|
|
9
|
-
* Mapping from old appearance names to new appearance names for visual refresh.
|
|
10
|
-
* Used when Badge component passes old prop names to BadgeNew.
|
|
11
|
-
*/
|
|
12
|
-
export var appearanceMapping = {
|
|
13
|
-
added: 'success',
|
|
14
|
-
removed: 'danger',
|
|
15
|
-
default: 'neutral',
|
|
16
|
-
primary: 'information',
|
|
17
|
-
primaryInverted: 'inverse',
|
|
18
|
-
important: 'danger',
|
|
19
|
-
warning: 'warning',
|
|
20
|
-
discovery: 'discovery',
|
|
21
|
-
danger: 'danger',
|
|
22
|
-
success: 'success',
|
|
23
|
-
information: 'information',
|
|
24
|
-
inverse: 'inverse',
|
|
25
|
-
neutral: 'neutral'
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Mapping from new appearance names to old appearance names for visual refresh.
|
|
30
|
-
* Used when BadgeNew migration is done.
|
|
31
|
-
*/
|
|
32
|
-
export var appearanceMappingToOld = {
|
|
33
|
-
added: 'added',
|
|
34
|
-
removed: 'removed',
|
|
35
|
-
default: 'default',
|
|
36
|
-
primary: 'primary',
|
|
37
|
-
primaryInverted: 'primaryInverted',
|
|
38
|
-
important: 'important',
|
|
39
|
-
danger: 'removed',
|
|
40
|
-
success: 'added',
|
|
41
|
-
information: 'primary',
|
|
42
|
-
inverse: 'primaryInverted',
|
|
43
|
-
neutral: 'default',
|
|
44
|
-
warning: 'default',
|
|
45
|
-
discovery: 'default'
|
|
46
|
-
};
|
|
47
|
-
|
|
7
|
+
import { formatValue } from './internal/format-value';
|
|
48
8
|
/* eslint-disable @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors */
|
|
49
9
|
// Nested selectors with data attributes are required for theme switching
|
|
50
10
|
var stylesNew = {
|
package/dist/esm/badge.js
CHANGED
|
@@ -5,8 +5,10 @@ import { ax, ix } from "@compiled/react/runtime";
|
|
|
5
5
|
import { memo } from 'react';
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
7
|
import { Text } from '@atlaskit/primitives/compiled';
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
8
|
+
import { appearanceMapping } from './appearance-mapping';
|
|
9
|
+
import { appearanceMappingToOld } from './appearance-mapping-to-old';
|
|
10
|
+
import BadgeNew from './badge-new';
|
|
11
|
+
import { formatValueWithNegativeSupport } from './internal/format-value-with-negative-support';
|
|
10
12
|
/**
|
|
11
13
|
* Visual refresh colors.
|
|
12
14
|
* Hardcoded hex colors are used as the they will be updated in the labelling system work and we want to avoid frequent UI changes.\
|
|
@@ -27,23 +27,4 @@ export function formatValueWithNegativeSupport(value, max) {
|
|
|
27
27
|
return '∞';
|
|
28
28
|
}
|
|
29
29
|
return safeValue.toString();
|
|
30
|
-
}
|
|
31
|
-
function getSafeValue() {
|
|
32
|
-
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
33
|
-
var numericValue = +value;
|
|
34
|
-
if (numericValue < 0) {
|
|
35
|
-
return 0;
|
|
36
|
-
}
|
|
37
|
-
return value;
|
|
38
|
-
}
|
|
39
|
-
export function formatValue(value, max) {
|
|
40
|
-
var safeValue = getSafeValue(value);
|
|
41
|
-
var safeMax = getSafeValue(max);
|
|
42
|
-
if (safeMax && safeMax < safeValue) {
|
|
43
|
-
return "".concat(safeMax, "+");
|
|
44
|
-
}
|
|
45
|
-
if (safeValue === Infinity) {
|
|
46
|
-
return '∞';
|
|
47
|
-
}
|
|
48
|
-
return safeValue.toString();
|
|
49
30
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
function getSafeValue() {
|
|
2
|
+
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
3
|
+
var numericValue = +value;
|
|
4
|
+
if (numericValue < 0) {
|
|
5
|
+
return 0;
|
|
6
|
+
}
|
|
7
|
+
return value;
|
|
8
|
+
}
|
|
9
|
+
export function formatValue(value, max) {
|
|
10
|
+
var safeValue = getSafeValue(value);
|
|
11
|
+
var safeMax = getSafeValue(max);
|
|
12
|
+
if (safeMax && safeMax < safeValue) {
|
|
13
|
+
return "".concat(safeMax, "+");
|
|
14
|
+
}
|
|
15
|
+
if (safeValue === Infinity) {
|
|
16
|
+
return '∞';
|
|
17
|
+
}
|
|
18
|
+
return safeValue.toString();
|
|
19
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
export declare const appearanceMappingToOld: Record<'added' | 'removed' | 'default' | 'primary' | 'primaryInverted' | 'important' | 'warning' | 'discovery' | 'danger' | 'success' | 'information' | 'inverse' | 'neutral', 'added' | 'removed' | 'default' | 'primary' | 'primaryInverted' | 'important'>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
import type { NewAppearance } from './types';
|
|
6
|
+
export declare const appearanceMapping: Record<'added' | 'removed' | 'default' | 'primary' | 'primaryInverted' | 'important' | 'warning' | 'discovery' | 'danger' | 'success' | 'information' | 'inverse' | 'neutral', NewAppearance>;
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
import type { BadgeNewProps
|
|
2
|
-
/**
|
|
3
|
-
* Mapping from old appearance names to new appearance names for visual refresh.
|
|
4
|
-
* Used when Badge component passes old prop names to BadgeNew.
|
|
5
|
-
*/
|
|
6
|
-
export declare const appearanceMapping: Record<'added' | 'removed' | 'default' | 'primary' | 'primaryInverted' | 'important' | 'warning' | 'discovery' | 'danger' | 'success' | 'information' | 'inverse' | 'neutral', NewAppearance>;
|
|
7
|
-
/**
|
|
8
|
-
* Mapping from new appearance names to old appearance names for visual refresh.
|
|
9
|
-
* Used when BadgeNew migration is done.
|
|
10
|
-
*/
|
|
11
|
-
export declare const appearanceMappingToOld: Record<'added' | 'removed' | 'default' | 'primary' | 'primaryInverted' | 'important' | 'warning' | 'discovery' | 'danger' | 'success' | 'information' | 'inverse' | 'neutral', 'added' | 'removed' | 'default' | 'primary' | 'primaryInverted' | 'important'>;
|
|
1
|
+
import type { BadgeNewProps } from './types';
|
|
12
2
|
/**
|
|
13
3
|
* __BadgeNew__
|
|
14
4
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function formatValue(value?: string | number, max?: number): string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
export declare const appearanceMappingToOld: Record<'added' | 'removed' | 'default' | 'primary' | 'primaryInverted' | 'important' | 'warning' | 'discovery' | 'danger' | 'success' | 'information' | 'inverse' | 'neutral', 'added' | 'removed' | 'default' | 'primary' | 'primaryInverted' | 'important'>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
import type { NewAppearance } from './types';
|
|
6
|
+
export declare const appearanceMapping: Record<'added' | 'removed' | 'default' | 'primary' | 'primaryInverted' | 'important' | 'warning' | 'discovery' | 'danger' | 'success' | 'information' | 'inverse' | 'neutral', NewAppearance>;
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
import type { BadgeNewProps
|
|
2
|
-
/**
|
|
3
|
-
* Mapping from old appearance names to new appearance names for visual refresh.
|
|
4
|
-
* Used when Badge component passes old prop names to BadgeNew.
|
|
5
|
-
*/
|
|
6
|
-
export declare const appearanceMapping: Record<'added' | 'removed' | 'default' | 'primary' | 'primaryInverted' | 'important' | 'warning' | 'discovery' | 'danger' | 'success' | 'information' | 'inverse' | 'neutral', NewAppearance>;
|
|
7
|
-
/**
|
|
8
|
-
* Mapping from new appearance names to old appearance names for visual refresh.
|
|
9
|
-
* Used when BadgeNew migration is done.
|
|
10
|
-
*/
|
|
11
|
-
export declare const appearanceMappingToOld: Record<'added' | 'removed' | 'default' | 'primary' | 'primaryInverted' | 'important' | 'warning' | 'discovery' | 'danger' | 'success' | 'information' | 'inverse' | 'neutral', 'added' | 'removed' | 'default' | 'primary' | 'primaryInverted' | 'important'>;
|
|
1
|
+
import type { BadgeNewProps } from './types';
|
|
12
2
|
/**
|
|
13
3
|
* __BadgeNew__
|
|
14
4
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function formatValue(value?: string | number, max?: number): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/badge",
|
|
3
|
-
"version": "18.4.
|
|
3
|
+
"version": "18.4.6",
|
|
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/"
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
53
|
-
"@atlaskit/primitives": "^
|
|
54
|
-
"@atlaskit/tokens": "^
|
|
53
|
+
"@atlaskit/primitives": "^19.0.0",
|
|
54
|
+
"@atlaskit/tokens": "^13.0.0",
|
|
55
55
|
"@babel/runtime": "^7.0.0",
|
|
56
56
|
"@compiled/react": "^0.20.0"
|
|
57
57
|
},
|