beem-component 1.9.0 → 1.9.1

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.
@@ -11,7 +11,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
  var _icons = require("@material-ui/icons");
12
12
  var _iconStyles = require("../iconStyles");
13
13
  var _colors = require("../colors");
14
- var _excluded = ["variant", "size", "disabled", "children", "leadingIcon", "trailingIcon", "color", "bgColor", "closeButton", "onHide"];
14
+ var _excluded = ["variant", "size", "disabled", "children", "leadingIcon", "trailingIcon", "color", "textColor", "bgColor", "closeButton", "onHide"];
15
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
16
  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); }
17
17
  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; }
@@ -26,7 +26,11 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
26
26
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
27
27
  var Color = function Color(_ref) {
28
28
  var variant = _ref.variant,
29
- color = _ref.color;
29
+ color = _ref.color,
30
+ textColor = _ref.textColor;
31
+ if (textColor) {
32
+ return textColor;
33
+ }
30
34
  if (variant === 'success' || variant === 'warning' || variant === 'danger' || variant === 'primary') {
31
35
  return "".concat(_colors.BmPrimaryWhite);
32
36
  }
@@ -65,10 +69,12 @@ var BeemTag = _styledComponents.default.button.withConfig({
65
69
  return "".concat(_colors.BmGrey100);
66
70
  }, function (_ref5) {
67
71
  var variant = _ref5.variant,
68
- color = _ref5.color;
72
+ color = _ref5.color,
73
+ textColor = _ref5.textColor;
69
74
  return Color({
70
75
  variant: variant,
71
- color: color
76
+ color: color,
77
+ textColor: textColor
72
78
  });
73
79
  });
74
80
  var BmTag = function BmTag(props) {
@@ -83,6 +89,7 @@ var BmTag = function BmTag(props) {
83
89
  leadingIcon = props.leadingIcon,
84
90
  trailingIcon = props.trailingIcon,
85
91
  color = props.color,
92
+ textColor = props.textColor,
86
93
  bgColor = props.bgColor,
87
94
  closeButton = props.closeButton,
88
95
  onHide = props.onHide,
@@ -93,6 +100,7 @@ var BmTag = function BmTag(props) {
93
100
  disabled: disabled,
94
101
  children: children,
95
102
  color: color,
103
+ textColor: textColor,
96
104
  closeButton: closeButton,
97
105
  show: toggle,
98
106
  bgColor: bgColor
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "beem-component",
3
- "version": "1.9.0",
3
+ "version": "1.9.1",
4
4
  "private": false,
5
5
  "main": "dist/components/index.js",
6
6
  "scripts": {
package/src/App.js CHANGED
@@ -1,9 +1,22 @@
1
1
  import React, { useState } from 'react';
2
- import { BmRowLabel, GlobalStyle } from './lib/components';
2
+ import CircleIcon from '@mui/icons-material/Circle';
3
+ import { BmRowLabel, BmTag, GlobalStyle } from './lib/components';
3
4
  import BmButtonGroup from './lib/components/ButtonGroup/buttonGroup';
4
5
  import { BmInputCounter } from './lib/components/InputCounter/inputCounter';
5
6
  import BmMultiDateSelector from './lib/components/MultipleDateSelector/multipleDateSelector';
6
7
  import BmStepper from './lib/components/Stepper/stepper';
8
+ import {
9
+ BmBgLightBlue,
10
+ // BmGrey200,
11
+ BmGrey400,
12
+ BmGrey50,
13
+ BmPrimaryBlue,
14
+ BmPrimaryGold,
15
+ BmSecondaryGreen,
16
+ BmSecondaryGreen8,
17
+ BmSecondaryPurple,
18
+ BmSecondaryRed,
19
+ } from './lib/components/colors';
7
20
 
8
21
  const App = () => {
9
22
  const [item, setItem] = useState();
@@ -57,6 +70,22 @@ const App = () => {
57
70
  },
58
71
  ];
59
72
 
73
+ const statusa = 'rejected';
74
+
75
+ const getStatusValue = (status) => {
76
+ const STATUSES_V2 = {
77
+ pending: BmPrimaryGold,
78
+ inprogress: BmPrimaryBlue,
79
+ 'sent-to-mno': BmSecondaryPurple,
80
+ whitelisted: BmBgLightBlue,
81
+ 'partial-approved': BmSecondaryGreen8,
82
+ active: BmSecondaryGreen,
83
+ rejected: BmSecondaryRed,
84
+ inactive: BmGrey400,
85
+ };
86
+ return STATUSES_V2[status] || '';
87
+ };
88
+
60
89
  return (
61
90
  <>
62
91
  <GlobalStyle />
@@ -92,6 +121,15 @@ const App = () => {
92
121
  );
93
122
  })}
94
123
  <BmRowLabel disabled>Hello</BmRowLabel>
124
+ <BmTag
125
+ color={getStatusValue(statusa)}
126
+ leadingIcon={<CircleIcon />}
127
+ size="xsmall"
128
+ textColor="black"
129
+ bgColor={BmGrey50}
130
+ >
131
+ <p>Hello</p>
132
+ </BmTag>
95
133
  </>
96
134
  );
97
135
  };
@@ -16,7 +16,10 @@ import {
16
16
  BmPrimaryBlue,
17
17
  } from '../colors';
18
18
 
19
- const Color = ({ variant, color }) => {
19
+ const Color = ({ variant, color, textColor }) => {
20
+ if (textColor) {
21
+ return textColor;
22
+ }
20
23
  if (
21
24
  variant === 'success' ||
22
25
  variant === 'warning' ||
@@ -64,7 +67,8 @@ const BeemTag = styled.button`
64
67
  return `${BmGrey100}`;
65
68
  }};
66
69
  > * {
67
- color: ${({ variant, color }) => Color({ variant, color })};
70
+ color: ${({ variant, color, textColor }) =>
71
+ Color({ variant, color, textColor })};
68
72
  text-transform: uppercase;
69
73
  }
70
74
 
@@ -84,6 +88,7 @@ export const BmTag = (props) => {
84
88
  leadingIcon,
85
89
  trailingIcon,
86
90
  color,
91
+ textColor,
87
92
  bgColor,
88
93
  closeButton,
89
94
  onHide,
@@ -97,6 +102,7 @@ export const BmTag = (props) => {
97
102
  disabled={disabled}
98
103
  children={children}
99
104
  color={color}
105
+ textColor={textColor}
100
106
  closeButton={closeButton}
101
107
  show={toggle}
102
108
  bgColor={bgColor}