@clayui/badge 3.106.1 → 3.111.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
@@ -3,6 +3,16 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [3.111.0](https://github.com/liferay/clay/compare/v3.110.0...v3.111.0) (2024-02-15)
7
+
8
+ **Note:** Version bump only for package @clayui/badge
9
+
10
+ # [3.107.0](https://github.com/liferay/clay/compare/v3.106.1...v3.107.0) (2023-11-27)
11
+
12
+ ### Features
13
+
14
+ - **@clayui/badge:** Adds attributes translucent and dark ([77162ef](https://github.com/liferay/clay/commit/77162efe62cd3822f4a64e23b3469e46cee5c530))
15
+
6
16
  ## [3.106.1](https://github.com/liferay/clay/compare/v3.106.0...v3.106.1) (2023-10-26)
7
17
 
8
18
  **Note:** Version bump only for package @clayui/badge
package/lib/index.d.ts CHANGED
@@ -5,14 +5,24 @@
5
5
  import React from 'react';
6
6
  declare type DisplayType = 'primary' | 'secondary' | 'info' | 'danger' | 'success' | 'warning' | 'beta' | 'beta-dark';
7
7
  interface IProps extends React.HTMLAttributes<HTMLSpanElement> {
8
+ /**
9
+ * Flag to indicate if the badge should use the clay-dark variant.
10
+ */
11
+ dark?: boolean;
8
12
  /**
9
13
  * Determines the color of the badge.
14
+ * The values `beta` and `beta-dark` are deprecated since v3.100.0 - use
15
+ * `translucent` and `dark` instead.
10
16
  */
11
17
  displayType?: DisplayType;
12
18
  /**
13
19
  * Info that is shown inside of the badge itself.
14
20
  */
15
21
  label?: string | number;
22
+ /**
23
+ * Flag to indicate if the badge should use the translucent variant.
24
+ */
25
+ translucent?: boolean;
16
26
  }
17
27
  declare const ClayBadge: React.ForwardRefExoticComponent<IProps & React.RefAttributes<HTMLSpanElement>>;
18
28
  export default ClayBadge;
package/lib/index.js CHANGED
@@ -9,7 +9,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
9
9
 
10
10
  var _react = _interopRequireDefault(require("react"));
11
11
 
12
- var _excluded = ["className", "displayType", "label"];
12
+ var _excluded = ["className", "dark", "displayType", "label", "translucent"];
13
13
 
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
15
 
@@ -21,13 +21,27 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
21
21
 
22
22
  var ClayBadge = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
23
23
  var className = _ref.className,
24
+ dark = _ref.dark,
24
25
  _ref$displayType = _ref.displayType,
25
26
  displayType = _ref$displayType === void 0 ? 'primary' : _ref$displayType,
26
27
  label = _ref.label,
28
+ translucent = _ref.translucent,
27
29
  otherProps = _objectWithoutProperties(_ref, _excluded);
28
30
 
31
+ if (displayType === 'beta') {
32
+ displayType = 'info';
33
+ translucent = true;
34
+ } else if (displayType === 'beta-dark') {
35
+ dark = true;
36
+ displayType = 'info';
37
+ translucent = true;
38
+ }
39
+
29
40
  return /*#__PURE__*/_react.default.createElement("span", _extends({}, otherProps, {
30
- className: (0, _classnames.default)('badge', "badge-".concat(displayType), className),
41
+ className: (0, _classnames.default)('badge', "badge-".concat(displayType), className, {
42
+ 'badge-translucent': translucent,
43
+ 'clay-dark': dark
44
+ }),
31
45
  ref: ref
32
46
  }), /*#__PURE__*/_react.default.createElement("span", {
33
47
  className: "badge-item badge-item-expand"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clayui/badge",
3
- "version": "3.106.1",
3
+ "version": "3.111.0",
4
4
  "description": "ClayBadge component",
5
5
  "license": "BSD-3-Clause",
6
6
  "repository": "https://github.com/liferay/clay",
@@ -17,7 +17,6 @@
17
17
  "scripts": {
18
18
  "build": "cross-env NODE_ENV=production babel src --root-mode upward --out-dir lib --extensions .ts,.tsx",
19
19
  "buildTypes": "cross-env NODE_ENV=production tsc --project ./tsconfig.declarations.json",
20
- "prepublishOnly": "yarn build && yarn buildTypes",
21
20
  "test": "jest --config ../../jest.config.js"
22
21
  },
23
22
  "keywords": [
@@ -35,5 +34,5 @@
35
34
  "browserslist": [
36
35
  "extends browserslist-config-clay"
37
36
  ],
38
- "gitHead": "b5345687d03988ed7d2409305d394434b9800b34"
37
+ "gitHead": "7dae7b1ba2f61516876e5799dc95045a5adb2c18"
39
38
  }