glints-aries 4.0.178 → 4.0.179
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.
|
@@ -4,6 +4,7 @@ export declare type BadgeStatusVariant = typeof badgeStatusVariant[number];
|
|
|
4
4
|
export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
5
|
children?: React.ReactNode;
|
|
6
6
|
status?: BadgeStatusVariant;
|
|
7
|
+
textColor?: string;
|
|
7
8
|
}
|
|
8
|
-
export declare const Badge: ({ children, status, ...props }: BadgeProps) => JSX.Element;
|
|
9
|
+
export declare const Badge: ({ children, status, textColor, ...props }: BadgeProps) => JSX.Element;
|
|
9
10
|
export {};
|
package/es/@next/Badge/Badge.js
CHANGED
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
|
-
var _excluded = ["children", "status"];
|
|
3
|
+
var _excluded = ["children", "status", "textColor"];
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { Typography } from '../Typography';
|
|
6
6
|
import { Neutral } from '../utilities/colors';
|
|
7
7
|
import { BadgeStyle } from './BadgeStyle';
|
|
8
8
|
var badgeStatusVariant = ['neutral', 'success', 'informational', 'warning', 'critical', 'promotion', 'new'];
|
|
9
|
+
var renderTextColor = function renderTextColor(textColor, status) {
|
|
10
|
+
if (textColor) {
|
|
11
|
+
return textColor;
|
|
12
|
+
}
|
|
13
|
+
if (status === 'new') {
|
|
14
|
+
return Neutral.B100;
|
|
15
|
+
}
|
|
16
|
+
return Neutral.B18;
|
|
17
|
+
};
|
|
9
18
|
export var Badge = function Badge(_ref) {
|
|
10
19
|
var children = _ref.children,
|
|
11
20
|
status = _ref.status,
|
|
21
|
+
textColor = _ref.textColor,
|
|
12
22
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
13
|
-
var content = typeof children === 'string' ? /*#__PURE__*/React.createElement(Typography, {
|
|
23
|
+
var content = typeof children === 'string' || typeof children === 'number' ? /*#__PURE__*/React.createElement(Typography, {
|
|
14
24
|
variant: "overline",
|
|
15
|
-
color: status
|
|
25
|
+
color: renderTextColor(textColor, status),
|
|
16
26
|
as: 'span'
|
|
17
27
|
}, children) : children;
|
|
18
28
|
return /*#__PURE__*/React.createElement(BadgeStyle, _extends({
|
|
@@ -8,7 +8,16 @@ export default {
|
|
|
8
8
|
component: Badge,
|
|
9
9
|
decorators: [function (Story) {
|
|
10
10
|
return /*#__PURE__*/React.createElement(BaseContainer, null, Story());
|
|
11
|
-
}]
|
|
11
|
+
}],
|
|
12
|
+
argTypes: {
|
|
13
|
+
textColor: {
|
|
14
|
+
description: 'Text color of the badge',
|
|
15
|
+
control: 'color',
|
|
16
|
+
table: {
|
|
17
|
+
category: 'Colors'
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
12
21
|
};
|
|
13
22
|
var Template = function Template(args) {
|
|
14
23
|
return /*#__PURE__*/React.createElement(Badge, args, defaultText);
|
|
@@ -4,6 +4,7 @@ export declare type BadgeStatusVariant = typeof badgeStatusVariant[number];
|
|
|
4
4
|
export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
5
|
children?: React.ReactNode;
|
|
6
6
|
status?: BadgeStatusVariant;
|
|
7
|
+
textColor?: string;
|
|
7
8
|
}
|
|
8
|
-
export declare const Badge: ({ children, status, ...props }: BadgeProps) => JSX.Element;
|
|
9
|
+
export declare const Badge: ({ children, status, textColor, ...props }: BadgeProps) => JSX.Element;
|
|
9
10
|
export {};
|
package/lib/@next/Badge/Badge.js
CHANGED
|
@@ -9,15 +9,25 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
var _Typography = require("../Typography");
|
|
10
10
|
var _colors = require("../utilities/colors");
|
|
11
11
|
var _BadgeStyle = require("./BadgeStyle");
|
|
12
|
-
var _excluded = ["children", "status"];
|
|
12
|
+
var _excluded = ["children", "status", "textColor"];
|
|
13
13
|
var badgeStatusVariant = ['neutral', 'success', 'informational', 'warning', 'critical', 'promotion', 'new'];
|
|
14
|
+
var renderTextColor = function renderTextColor(textColor, status) {
|
|
15
|
+
if (textColor) {
|
|
16
|
+
return textColor;
|
|
17
|
+
}
|
|
18
|
+
if (status === 'new') {
|
|
19
|
+
return _colors.Neutral.B100;
|
|
20
|
+
}
|
|
21
|
+
return _colors.Neutral.B18;
|
|
22
|
+
};
|
|
14
23
|
var Badge = function Badge(_ref) {
|
|
15
24
|
var children = _ref.children,
|
|
16
25
|
status = _ref.status,
|
|
26
|
+
textColor = _ref.textColor,
|
|
17
27
|
props = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
|
|
18
|
-
var content = typeof children === 'string' ? /*#__PURE__*/_react["default"].createElement(_Typography.Typography, {
|
|
28
|
+
var content = typeof children === 'string' || typeof children === 'number' ? /*#__PURE__*/_react["default"].createElement(_Typography.Typography, {
|
|
19
29
|
variant: "overline",
|
|
20
|
-
color: status
|
|
30
|
+
color: renderTextColor(textColor, status),
|
|
21
31
|
as: 'span'
|
|
22
32
|
}, children) : children;
|
|
23
33
|
return /*#__PURE__*/_react["default"].createElement(_BadgeStyle.BadgeStyle, (0, _extends2["default"])({
|
|
@@ -13,7 +13,16 @@ var _default = {
|
|
|
13
13
|
component: _Badge.Badge,
|
|
14
14
|
decorators: [function (Story) {
|
|
15
15
|
return /*#__PURE__*/_react["default"].createElement(_GlintsContainer.BaseContainer, null, Story());
|
|
16
|
-
}]
|
|
16
|
+
}],
|
|
17
|
+
argTypes: {
|
|
18
|
+
textColor: {
|
|
19
|
+
description: 'Text color of the badge',
|
|
20
|
+
control: 'color',
|
|
21
|
+
table: {
|
|
22
|
+
category: 'Colors'
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
17
26
|
};
|
|
18
27
|
exports["default"] = _default;
|
|
19
28
|
var Template = function Template(args) {
|