@atlaskit/badge 15.0.22 → 15.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,23 @@
1
1
  # @atlaskit/badge
2
2
 
3
+ ## 15.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`56507598609`](https://bitbucket.org/atlassian/atlassian-frontend/commits/56507598609) - Skip minor dependency bump
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+
13
+ ## 15.0.23
14
+
15
+ ### Patch Changes
16
+
17
+ - [`a7f643a0ee7`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a7f643a0ee7) - Updated badge line-height to use design system values, removed block padding. There are no visual or behaviour changes.
18
+ - [`eadbf13d8c0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/eadbf13d8c0) - Updated usages of `Text`, `Box`, `Stack`, and `Inline` primitives to reflect their updated APIs. There are no visual or behaviour changes.
19
+ - Updated dependencies
20
+
3
21
  ## 15.0.22
4
22
 
5
23
  ### Patch Changes
package/dist/cjs/badge.js CHANGED
@@ -1,28 +1,18 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  var _typeof = require("@babel/runtime/helpers/typeof");
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
8
  exports.default = void 0;
11
-
12
9
  var _react = _interopRequireWildcard(require("react"));
13
-
14
10
  var _box = _interopRequireDefault(require("@atlaskit/ds-explorations/box"));
15
-
16
11
  var _text = _interopRequireDefault(require("@atlaskit/ds-explorations/text"));
17
-
18
12
  var _utils = require("./internal/utils");
19
-
20
13
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
-
22
14
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
-
24
15
  /* eslint-disable @atlassian/tangerine/import/entry-points */
25
-
26
16
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
27
17
 
28
18
  /**
@@ -36,27 +26,26 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
36
26
  */
37
27
  var Badge = /*#__PURE__*/(0, _react.memo)(function Badge(_ref) {
38
28
  var _ref$appearance = _ref.appearance,
39
- appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
40
- _ref$children = _ref.children,
41
- children = _ref$children === void 0 ? 0 : _ref$children,
42
- _ref$max = _ref.max,
43
- max = _ref$max === void 0 ? 99 : _ref$max,
44
- style = _ref.style,
45
- testId = _ref.testId;
29
+ appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
30
+ _ref$children = _ref.children,
31
+ children = _ref$children === void 0 ? 0 : _ref$children,
32
+ _ref$max = _ref.max,
33
+ max = _ref$max === void 0 ? 99 : _ref$max,
34
+ style = _ref.style,
35
+ testId = _ref.testId;
46
36
  return /*#__PURE__*/_react.default.createElement(_box.default, {
47
37
  testId: testId,
48
38
  as: "span",
49
39
  backgroundColor: backgroundColors[appearance],
50
40
  borderRadius: "badge",
51
41
  display: "inlineFlex",
52
- paddingInline: "scale.075",
53
- paddingBlock: "scale.025",
42
+ paddingInline: "space.075",
54
43
  UNSAFE_style: style !== null && style !== void 0 && style.backgroundColor ? {
55
44
  backgroundColor: style.backgroundColor
56
45
  } : undefined
57
46
  }, /*#__PURE__*/_react.default.createElement(_text.default, {
58
- fontSize: "12px",
59
- lineHeight: "12px",
47
+ fontSize: "size.075",
48
+ lineHeight: "lineHeight.100",
60
49
  textAlign: "center",
61
50
  color: textColors[appearance],
62
51
  UNSAFE_style: style !== null && style !== void 0 && style.color ? {
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
@@ -11,5 +10,4 @@ Object.defineProperty(exports, "default", {
11
10
  return _badge.default;
12
11
  }
13
12
  });
14
-
15
13
  var _badge = _interopRequireDefault(require("../badge"));
package/dist/cjs/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
@@ -11,5 +10,4 @@ Object.defineProperty(exports, "default", {
11
10
  return _badge.default;
12
11
  }
13
12
  });
14
-
15
13
  var _badge = _interopRequireDefault(require("./badge"));
@@ -4,28 +4,21 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.formatValue = formatValue;
7
-
8
7
  function getSafeValue() {
9
8
  var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
10
-
11
9
  if (value < 0) {
12
10
  return 0;
13
11
  }
14
-
15
12
  return value;
16
13
  }
17
-
18
14
  function formatValue(value, max) {
19
15
  var safeValue = getSafeValue(value);
20
16
  var safeMax = getSafeValue(max);
21
-
22
17
  if (safeMax && safeMax < safeValue) {
23
18
  return "".concat(safeMax, "+");
24
19
  }
25
-
26
20
  if (safeValue === Infinity) {
27
21
  return '∞';
28
22
  }
29
-
30
23
  return safeValue.toString();
31
24
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/badge",
3
- "version": "15.0.22",
3
+ "version": "15.1.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,11 +1,9 @@
1
1
  /* eslint-disable @atlassian/tangerine/import/entry-points */
2
-
3
2
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
4
3
  import React, { memo } from 'react';
5
4
  import Box from '@atlaskit/ds-explorations/box';
6
5
  import Text from '@atlaskit/ds-explorations/text';
7
6
  import { formatValue } from './internal/utils';
8
-
9
7
  /**
10
8
  * __Badge__
11
9
  *
@@ -28,14 +26,13 @@ const Badge = /*#__PURE__*/memo(function Badge({
28
26
  backgroundColor: backgroundColors[appearance],
29
27
  borderRadius: "badge",
30
28
  display: "inlineFlex",
31
- paddingInline: "scale.075",
32
- paddingBlock: "scale.025",
29
+ paddingInline: "space.075",
33
30
  UNSAFE_style: style !== null && style !== void 0 && style.backgroundColor ? {
34
31
  backgroundColor: style.backgroundColor
35
32
  } : undefined
36
33
  }, /*#__PURE__*/React.createElement(Text, {
37
- fontSize: "12px",
38
- lineHeight: "12px",
34
+ fontSize: "size.075",
35
+ lineHeight: "lineHeight.100",
39
36
  textAlign: "center",
40
37
  color: textColors[appearance],
41
38
  UNSAFE_style: style !== null && style !== void 0 && style.color ? {
@@ -2,21 +2,16 @@ function getSafeValue(value = 0) {
2
2
  if (value < 0) {
3
3
  return 0;
4
4
  }
5
-
6
5
  return value;
7
6
  }
8
-
9
7
  export function formatValue(value, max) {
10
8
  const safeValue = getSafeValue(value);
11
9
  const safeMax = getSafeValue(max);
12
-
13
10
  if (safeMax && safeMax < safeValue) {
14
11
  return `${safeMax}+`;
15
12
  }
16
-
17
13
  if (safeValue === Infinity) {
18
14
  return '∞';
19
15
  }
20
-
21
16
  return safeValue.toString();
22
17
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/badge",
3
- "version": "15.0.22",
3
+ "version": "15.1.0",
4
4
  "sideEffects": false
5
5
  }
package/dist/esm/badge.js CHANGED
@@ -1,11 +1,9 @@
1
1
  /* eslint-disable @atlassian/tangerine/import/entry-points */
2
-
3
2
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
4
3
  import React, { memo } from 'react';
5
4
  import Box from '@atlaskit/ds-explorations/box';
6
5
  import Text from '@atlaskit/ds-explorations/text';
7
6
  import { formatValue } from './internal/utils';
8
-
9
7
  /**
10
8
  * __Badge__
11
9
  *
@@ -17,27 +15,26 @@ import { formatValue } from './internal/utils';
17
15
  */
18
16
  var Badge = /*#__PURE__*/memo(function Badge(_ref) {
19
17
  var _ref$appearance = _ref.appearance,
20
- appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
21
- _ref$children = _ref.children,
22
- children = _ref$children === void 0 ? 0 : _ref$children,
23
- _ref$max = _ref.max,
24
- max = _ref$max === void 0 ? 99 : _ref$max,
25
- style = _ref.style,
26
- testId = _ref.testId;
18
+ appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
19
+ _ref$children = _ref.children,
20
+ children = _ref$children === void 0 ? 0 : _ref$children,
21
+ _ref$max = _ref.max,
22
+ max = _ref$max === void 0 ? 99 : _ref$max,
23
+ style = _ref.style,
24
+ testId = _ref.testId;
27
25
  return /*#__PURE__*/React.createElement(Box, {
28
26
  testId: testId,
29
27
  as: "span",
30
28
  backgroundColor: backgroundColors[appearance],
31
29
  borderRadius: "badge",
32
30
  display: "inlineFlex",
33
- paddingInline: "scale.075",
34
- paddingBlock: "scale.025",
31
+ paddingInline: "space.075",
35
32
  UNSAFE_style: style !== null && style !== void 0 && style.backgroundColor ? {
36
33
  backgroundColor: style.backgroundColor
37
34
  } : undefined
38
35
  }, /*#__PURE__*/React.createElement(Text, {
39
- fontSize: "12px",
40
- lineHeight: "12px",
36
+ fontSize: "size.075",
37
+ lineHeight: "lineHeight.100",
41
38
  textAlign: "center",
42
39
  color: textColors[appearance],
43
40
  UNSAFE_style: style !== null && style !== void 0 && style.color ? {
@@ -1,24 +1,18 @@
1
1
  function getSafeValue() {
2
2
  var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
3
-
4
3
  if (value < 0) {
5
4
  return 0;
6
5
  }
7
-
8
6
  return value;
9
7
  }
10
-
11
8
  export function formatValue(value, max) {
12
9
  var safeValue = getSafeValue(value);
13
10
  var safeMax = getSafeValue(max);
14
-
15
11
  if (safeMax && safeMax < safeValue) {
16
12
  return "".concat(safeMax, "+");
17
13
  }
18
-
19
14
  if (safeValue === Infinity) {
20
15
  return '∞';
21
16
  }
22
-
23
17
  return safeValue.toString();
24
18
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/badge",
3
- "version": "15.0.22",
3
+ "version": "15.1.0",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/badge",
3
- "version": "15.0.22",
3
+ "version": "15.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/"
@@ -12,18 +12,9 @@
12
12
  "module": "dist/esm/index.js",
13
13
  "module:es2019": "dist/es2019/index.js",
14
14
  "types": "dist/types/index.d.ts",
15
- "typesVersions": {
16
- ">=4.0 <4.5": {
17
- "*": [
18
- "dist/types-ts4.0/*",
19
- "dist/types-ts4.0/index.d.ts"
20
- ]
21
- }
22
- },
23
15
  "sideEffects": false,
24
16
  "atlaskit:src": "src/index.tsx",
25
17
  "atlassian": {
26
- "disableProductCI": true,
27
18
  "team": "Design System Team",
28
19
  "releaseModel": "scheduled",
29
20
  "website": {
@@ -36,18 +27,18 @@
36
27
  ".": "./src/index.tsx"
37
28
  },
38
29
  "dependencies": {
39
- "@atlaskit/codemod-utils": "^4.1.0",
40
- "@atlaskit/ds-explorations": "^1.0.0",
30
+ "@atlaskit/codemod-utils": "^4.2.0",
31
+ "@atlaskit/ds-explorations": "^2.1.0",
41
32
  "@babel/runtime": "^7.0.0"
42
33
  },
43
34
  "peerDependencies": {
44
35
  "react": "^16.8.0"
45
36
  },
46
37
  "devDependencies": {
47
- "@atlaskit/button": "^16.4.0",
38
+ "@atlaskit/button": "^16.7.0",
48
39
  "@atlaskit/docs": "*",
49
- "@atlaskit/ds-lib": "^2.1.1",
50
- "@atlaskit/section-message": "^6.3.0",
40
+ "@atlaskit/ds-lib": "^2.2.0",
41
+ "@atlaskit/section-message": "^6.4.0",
51
42
  "@atlaskit/ssr": "*",
52
43
  "@atlaskit/theme": "*",
53
44
  "@atlaskit/tokens": "*",
@@ -79,8 +70,10 @@
79
70
  "lite-mode"
80
71
  ],
81
72
  "analytics": "analytics-next",
82
- "design-tokens": "spacing",
83
- "theming": "tokens",
73
+ "design-tokens": [
74
+ "color",
75
+ "spacing"
76
+ ],
84
77
  "deprecation": "no-deprecated-imports"
85
78
  }
86
79
  },
package/report.api.md CHANGED
@@ -1,12 +1,17 @@
1
+ <!-- API Report Version: 2.3 -->
2
+
1
3
  ## API Report File for "@atlaskit/badge"
2
4
 
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
5
+ > Do not edit this file. This report is auto-generated using [API Extractor](https://api-extractor.com/).
6
+ > [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
7
+
8
+ ### Table of contents
4
9
 
5
- <!--
6
- Generated API Report version: 2.0
7
- -->
10
+ - [Main Entry Types](#main-entry-types)
8
11
 
9
- [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
12
+ ### Main Entry Types
13
+
14
+ <!--SECTION START: Main Entry Types-->
10
15
 
11
16
  ```ts
12
17
  import type { CSSProperties } from 'react';
@@ -20,8 +25,8 @@ export default Badge;
20
25
  // @public (undocumented)
21
26
  export interface BadgeProps {
22
27
  appearance?: ThemeAppearance;
23
- children?: number | ReactNode;
24
- max?: number | false;
28
+ children?: ReactNode | number;
29
+ max?: false | number;
25
30
  style?: Pick<CSSProperties, 'backgroundColor' | 'color'>;
26
31
  testId?: string;
27
32
  }
@@ -37,3 +42,5 @@ type ThemeAppearance =
37
42
 
38
43
  // (No @packageDocumentation comment for this package)
39
44
  ```
45
+
46
+ <!--SECTION END: Main Entry Types-->
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import type { BadgeProps } from './types';
3
- /**
4
- * __Badge__
5
- *
6
- * This component gives you the full badge functionality and automatically formats the number you provide in \`children\`.
7
- *
8
- * - [Examples](https://atlassian.design/components/badge/examples)
9
- * - [Code](https://atlassian.design/components/badge/code)
10
- * - [Usage](https://atlassian.design/components/badge/usage)
11
- */
12
- declare const Badge: React.NamedExoticComponent<BadgeProps>;
13
- export default Badge;
@@ -1,2 +0,0 @@
1
- export { default } from '../badge';
2
- export type { BadgeProps } from '../types';
@@ -1 +0,0 @@
1
- export type { BadgeProps } from '../types';
@@ -1,2 +0,0 @@
1
- export { default } from './badge';
2
- export type { BadgeProps } from './types';
@@ -1 +0,0 @@
1
- export declare function formatValue(value?: string | number, max?: number): string;
@@ -1,29 +0,0 @@
1
- import type { CSSProperties, ReactNode } from 'react';
2
- export declare type ThemeAppearance = 'added' | 'default' | 'important' | 'primary' | 'primaryInverted' | 'removed';
3
- export interface BadgeProps {
4
- /**
5
- * Affects the visual style of the badge.
6
- */
7
- appearance?: ThemeAppearance;
8
- /**
9
- * The value displayed within the badge. A `ReactNode` can be provided for
10
- * custom-formatted numbers, however, badge should only be used in cases where you want to represent
11
- * a number.
12
- * Use a [lozenge](/packages/design-system/lozenge) for non-numeric information.
13
- */
14
- children?: number | ReactNode;
15
- /**
16
- * The maximum value to display. Defaults to `99`. If the value is 100, and max is 50, "50+" will be displayed.
17
- * This value should be greater than 0. If set to `false` the original value will be displayed regardless of
18
- * whether it is larger than the default maximum value.
19
- */
20
- max?: number | false;
21
- /**
22
- * Style customization to apply to the badge. Only `backgroundColor` and `color` are supported.
23
- */
24
- style?: Pick<CSSProperties, 'backgroundColor' | 'color'>;
25
- /**
26
- * A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests
27
- */
28
- testId?: string;
29
- }