beem-component 1.6.8 → 1.6.9
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.
|
@@ -19,7 +19,7 @@ var _iconStyles = require("../iconStyles");
|
|
|
19
19
|
|
|
20
20
|
var _colors = require("../colors");
|
|
21
21
|
|
|
22
|
-
var _excluded = ["variant", "size", "disabled", "children", "leadingIcon", "trailingIcon", "color", "closeButton", "onHide"];
|
|
22
|
+
var _excluded = ["variant", "size", "disabled", "children", "leadingIcon", "trailingIcon", "color", "bgColor", "closeButton", "onHide"];
|
|
23
23
|
|
|
24
24
|
var _templateObject;
|
|
25
25
|
|
|
@@ -53,7 +53,7 @@ var Color = function Color(_ref) {
|
|
|
53
53
|
var variant = _ref.variant,
|
|
54
54
|
color = _ref.color;
|
|
55
55
|
|
|
56
|
-
if (variant === 'success' || variant === 'warning' || variant === 'danger') {
|
|
56
|
+
if (variant === 'success' || variant === 'warning' || variant === 'danger' || variant === 'primary') {
|
|
57
57
|
return "".concat(_colors.BmPrimaryWhite);
|
|
58
58
|
}
|
|
59
59
|
|
|
@@ -76,13 +76,16 @@ var BeemTag = _styledComponents.default.button(_templateObject || (_templateObje
|
|
|
76
76
|
|
|
77
77
|
return show ? 'flex' : 'none';
|
|
78
78
|
}, function (_ref3) {
|
|
79
|
-
var variant = _ref3.variant
|
|
79
|
+
var variant = _ref3.variant,
|
|
80
|
+
bgColor = _ref3.bgColor;
|
|
81
|
+
if (bgColor && !variant) return bgColor;
|
|
80
82
|
if (variant === 'neutral') return "".concat(_colors.BmGrey100);
|
|
81
83
|
if (variant === 'success') return "".concat(_colors.BmSecondaryDarkGreen);
|
|
82
84
|
if (variant === 'warning') return "".concat(_colors.BmPrimaryGold);
|
|
83
85
|
if (variant === 'danger') return "".concat(_colors.BmSecondaryRed);
|
|
84
86
|
if (variant === 'light') return "".concat(_colors.BmPrimaryWhite);
|
|
85
|
-
if (
|
|
87
|
+
if (variant === 'primary') return "".concat(_colors.BmPrimaryBlue);
|
|
88
|
+
if (!variant && !bgColor) return "".concat(_colors.BmGrey100);
|
|
86
89
|
}, function (_ref4) {
|
|
87
90
|
var variant = _ref4.variant;
|
|
88
91
|
if (variant === 'neutral') return "".concat(_colors.BmGrey100);
|
|
@@ -113,6 +116,7 @@ var BmTag = function BmTag(props) {
|
|
|
113
116
|
leadingIcon = props.leadingIcon,
|
|
114
117
|
trailingIcon = props.trailingIcon,
|
|
115
118
|
color = props.color,
|
|
119
|
+
bgColor = props.bgColor,
|
|
116
120
|
closeButton = props.closeButton,
|
|
117
121
|
onHide = props.onHide,
|
|
118
122
|
rest = _objectWithoutProperties(props, _excluded);
|
|
@@ -124,7 +128,8 @@ var BmTag = function BmTag(props) {
|
|
|
124
128
|
children: children,
|
|
125
129
|
color: color,
|
|
126
130
|
closeButton: closeButton,
|
|
127
|
-
show: toggle
|
|
131
|
+
show: toggle,
|
|
132
|
+
bgColor: bgColor
|
|
128
133
|
}, rest), leadingIcon && /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
|
|
129
134
|
disabled: disabled,
|
|
130
135
|
icon: leadingIcon,
|
|
@@ -24,6 +24,12 @@ var _default = {
|
|
|
24
24
|
},
|
|
25
25
|
description: 'Color of the Icons and Text, will work only if variant is not present'
|
|
26
26
|
},
|
|
27
|
+
bgColor: {
|
|
28
|
+
control: {
|
|
29
|
+
type: 'text'
|
|
30
|
+
},
|
|
31
|
+
description: 'Background Color of Tags, will work only if variant is not present'
|
|
32
|
+
},
|
|
27
33
|
closeButton: {
|
|
28
34
|
control: {
|
|
29
35
|
type: 'boolean'
|
|
@@ -44,7 +50,7 @@ var _default = {
|
|
|
44
50
|
}
|
|
45
51
|
},
|
|
46
52
|
variant: {
|
|
47
|
-
options: ['success', 'warning', 'danger', 'light', 'neutral', undefined],
|
|
53
|
+
options: ['success', 'warning', 'danger', 'light', 'neutral', 'primary', undefined],
|
|
48
54
|
control: {
|
|
49
55
|
type: 'select'
|
|
50
56
|
},
|
package/package.json
CHANGED
package/src/App.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { BmTag } from './lib/components';
|
|
3
3
|
|
|
4
4
|
const Chat = () => {
|
|
5
|
-
return
|
|
5
|
+
return (
|
|
6
|
+
<BmTag bgColor="red" variant="primary" color="white">
|
|
7
|
+
<p>Hello</p>
|
|
8
|
+
</BmTag>
|
|
9
|
+
);
|
|
6
10
|
};
|
|
7
11
|
|
|
8
12
|
export default Chat;
|
|
@@ -13,10 +13,16 @@ import {
|
|
|
13
13
|
BmGrey100,
|
|
14
14
|
BmGrey400,
|
|
15
15
|
BmPrimaryGold,
|
|
16
|
+
BmPrimaryBlue,
|
|
16
17
|
} from '../colors';
|
|
17
18
|
|
|
18
19
|
const Color = ({ variant, color }) => {
|
|
19
|
-
if (
|
|
20
|
+
if (
|
|
21
|
+
variant === 'success' ||
|
|
22
|
+
variant === 'warning' ||
|
|
23
|
+
variant === 'danger' ||
|
|
24
|
+
variant === 'primary'
|
|
25
|
+
) {
|
|
20
26
|
return `${BmPrimaryWhite}`;
|
|
21
27
|
}
|
|
22
28
|
if (!variant && color) {
|
|
@@ -38,13 +44,15 @@ const BeemTag = styled.button`
|
|
|
38
44
|
align-items: center;
|
|
39
45
|
padding: 0.25rem 0.5rem;
|
|
40
46
|
border-radius: 0.25rem;
|
|
41
|
-
background: ${({ variant }) => {
|
|
47
|
+
background: ${({ variant, bgColor }) => {
|
|
48
|
+
if (bgColor && !variant) return bgColor;
|
|
42
49
|
if (variant === 'neutral') return `${BmGrey100}`;
|
|
43
50
|
if (variant === 'success') return `${BmSecondaryDarkGreen}`;
|
|
44
51
|
if (variant === 'warning') return `${BmPrimaryGold}`;
|
|
45
52
|
if (variant === 'danger') return `${BmSecondaryRed}`;
|
|
46
53
|
if (variant === 'light') return `${BmPrimaryWhite}`;
|
|
47
|
-
if (
|
|
54
|
+
if (variant === 'primary') return `${BmPrimaryBlue}`;
|
|
55
|
+
if (!variant && !bgColor) return `${BmGrey100}`;
|
|
48
56
|
}};
|
|
49
57
|
border: 0.071rem solid
|
|
50
58
|
${({ variant }) => {
|
|
@@ -76,6 +84,7 @@ export const BmTag = (props) => {
|
|
|
76
84
|
leadingIcon,
|
|
77
85
|
trailingIcon,
|
|
78
86
|
color,
|
|
87
|
+
bgColor,
|
|
79
88
|
closeButton,
|
|
80
89
|
onHide,
|
|
81
90
|
...rest
|
|
@@ -90,6 +99,7 @@ export const BmTag = (props) => {
|
|
|
90
99
|
color={color}
|
|
91
100
|
closeButton={closeButton}
|
|
92
101
|
show={toggle}
|
|
102
|
+
bgColor={bgColor}
|
|
93
103
|
{...rest}
|
|
94
104
|
>
|
|
95
105
|
{leadingIcon && (
|
|
@@ -12,6 +12,11 @@ export default {
|
|
|
12
12
|
description:
|
|
13
13
|
'Color of the Icons and Text, will work only if variant is not present',
|
|
14
14
|
},
|
|
15
|
+
bgColor: {
|
|
16
|
+
control: { type: 'text' },
|
|
17
|
+
description:
|
|
18
|
+
'Background Color of Tags, will work only if variant is not present',
|
|
19
|
+
},
|
|
15
20
|
closeButton: {
|
|
16
21
|
control: { type: 'boolean' },
|
|
17
22
|
description: 'Will display (x) - Optional',
|
|
@@ -27,7 +32,15 @@ export default {
|
|
|
27
32
|
defaultValue: { summary: 'small' },
|
|
28
33
|
},
|
|
29
34
|
variant: {
|
|
30
|
-
options: [
|
|
35
|
+
options: [
|
|
36
|
+
'success',
|
|
37
|
+
'warning',
|
|
38
|
+
'danger',
|
|
39
|
+
'light',
|
|
40
|
+
'neutral',
|
|
41
|
+
'primary',
|
|
42
|
+
undefined,
|
|
43
|
+
],
|
|
31
44
|
control: { type: 'select' },
|
|
32
45
|
description: 'Type of tag',
|
|
33
46
|
defaultValue: { summary: 'neutral' },
|