@propellerads/card 3.0.0 → 3.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,3 +1,6 @@
1
+ #### `3.1.0`
2
+ * added `customStyles` prop
3
+
1
4
  #### `3.0.0`
2
5
  * added onClick prop
3
6
  * migrated to TypeScript
@@ -17,18 +17,23 @@ function _taggedTemplateLiteralLoose(strings, raw) {
17
17
  return strings;
18
18
  }
19
19
 
20
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
21
- var StyledCard = /*#__PURE__*/styled__default.div(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n height: 100%;\n border-radius: ", "px;\n border: solid 2px ", ";\n background-color: ", ";\n padding: ", "px;\n \n ", "\n\n ", "\n\n ", "\n"])), stylevariables.borderRadius, stylevariables.gray95, stylevariables.white, stylevariables.spacing * 6, function (props) {
20
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
21
+ var StyledCard = /*#__PURE__*/styled__default.div(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n height: 100%;\n border-radius: ", "px;\n border: solid 2px ", ";\n background-color: ", ";\n padding: ", "px;\n \n ", "\n\n ", "\n\n ", "\n\n ", "\n"])), stylevariables.borderRadius, stylevariables.gray95, stylevariables.white, stylevariables.spacing * 6, function (props) {
22
22
  return props.isActive && styled.css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n border-color: ", ";\n "])), stylevariables.actionColor);
23
23
  }, function (props) {
24
- return props.padding && styled.css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n padding: ", "px;\n "])), props.padding);
24
+ var _props$customStyles;
25
+ return ((_props$customStyles = props.customStyles) == null ? void 0 : _props$customStyles.padding) && styled.css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n padding: ", "px;\n "])), props.customStyles.padding);
25
26
  }, function (props) {
26
- return props.borderRadius && styled.css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n border-radius: ", "px;\n "])), props.borderRadius);
27
+ var _props$customStyles2;
28
+ return ((_props$customStyles2 = props.customStyles) == null ? void 0 : _props$customStyles2.borderRadius) && styled.css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n border-radius: ", "px;\n "])), props.customStyles.borderRadius);
29
+ }, function (props) {
30
+ var _props$customStyles3, _props$customStyles4;
31
+ return ((_props$customStyles3 = props.customStyles) == null ? void 0 : _props$customStyles3.activeBgColor) && ((_props$customStyles4 = props.customStyles) == null ? void 0 : _props$customStyles4.bgColor) && styled.css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n "])), props.isActive ? props.customStyles.activeBgColor : props.customStyles.bgColor);
27
32
  });
28
- var Header = /*#__PURE__*/styled__default.div(_templateObject5 || (_templateObject5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n margin-bottom: ", "px; \n"])), stylevariables.spacing * 3);
29
- var Title = /*#__PURE__*/styled__default.div(_templateObject6 || (_templateObject6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n flex: 1;\n font-size: ", "px;\n font-weight: bold;\n line-height: ", "px;\n color: ", ";\n"])), stylevariables.fontBig, stylevariables.lineHeight, stylevariables.black);
30
- var Label = /*#__PURE__*/styled__default.div(_templateObject7 || (_templateObject7 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n flex: 1;\n align-items: flex-start;\n justify-content: flex-end;\n display: flex;\n"])));
31
- var Action = /*#__PURE__*/styled__default.div(_templateObject8 || (_templateObject8 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-top: ", "px;\n \n button + button{\n margin-left: ", "px;\n }\n"])), stylevariables.spacing * 4, stylevariables.spacing * 2);
33
+ var Header = /*#__PURE__*/styled__default.div(_templateObject6 || (_templateObject6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n margin-bottom: ", "px; \n"])), stylevariables.spacing * 3);
34
+ var Title = /*#__PURE__*/styled__default.div(_templateObject7 || (_templateObject7 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n flex: 1;\n font-size: ", "px;\n font-weight: bold;\n line-height: ", "px;\n color: ", ";\n"])), stylevariables.fontBig, stylevariables.lineHeight, stylevariables.black);
35
+ var Label = /*#__PURE__*/styled__default.div(_templateObject8 || (_templateObject8 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n flex: 1;\n align-items: flex-start;\n justify-content: flex-end;\n display: flex;\n"])));
36
+ var Action = /*#__PURE__*/styled__default.div(_templateObject9 || (_templateObject9 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-top: ", "px;\n \n button + button{\n margin-left: ", "px;\n }\n"])), stylevariables.spacing * 4, stylevariables.spacing * 2);
32
37
 
33
38
  var Card = function Card(_ref) {
34
39
  var children = _ref.children,
@@ -42,12 +47,10 @@ var Card = function Card(_ref) {
42
47
  isActive = _ref$isActive === void 0 ? false : _ref$isActive,
43
48
  _ref$width = _ref.width,
44
49
  width = _ref$width === void 0 ? undefined : _ref$width,
45
- _ref$padding = _ref.padding,
46
- padding = _ref$padding === void 0 ? undefined : _ref$padding,
47
- _ref$borderRadius = _ref.borderRadius,
48
- borderRadius = _ref$borderRadius === void 0 ? undefined : _ref$borderRadius,
49
50
  _ref$elementId = _ref.elementId,
50
51
  elementId = _ref$elementId === void 0 ? undefined : _ref$elementId,
52
+ _ref$customStyles = _ref.customStyles,
53
+ customStyles = _ref$customStyles === void 0 ? {} : _ref$customStyles,
51
54
  _ref$onClick = _ref.onClick,
52
55
  onClick = _ref$onClick === void 0 ? undefined : _ref$onClick;
53
56
  var handleClick = function handleClick() {
@@ -61,8 +64,7 @@ var Card = function Card(_ref) {
61
64
  },
62
65
  isActive: isActive,
63
66
  id: elementId,
64
- borderRadius: borderRadius,
65
- padding: padding,
67
+ customStyles: customStyles,
66
68
  onClick: handleClick
67
69
  }, (title || label) && React.createElement(Header, null, title && React.createElement(Title, null, title), label && React.createElement(Label, null, label)), React.createElement("div", null, children), action && React.createElement(Action, null, action));
68
70
  };
@@ -1 +1 @@
1
- {"version":3,"file":"card.cjs.development.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"card.cjs.development.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,2 +1,2 @@
1
- "use strict";function n(n){return n&&"object"==typeof n&&"default"in n?n.default:n}Object.defineProperty(exports,"__esModule",{value:!0});var e,i,t,d,r,o,l,a,c=n(require("react")),s=require("styled-components"),u=n(s),v=require("@propellerads/stylevariables");function p(n,e){return e||(e=n.slice(0)),n.raw=e,n}var f=u.div(e||(e=p(["\n height: 100%;\n border-radius: ","px;\n border: solid 2px ",";\n background-color: ",";\n padding: ","px;\n \n ","\n\n ","\n\n ","\n"])),v.borderRadius,v.gray95,v.white,6*v.spacing,(function(n){return n.isActive&&s.css(i||(i=p(["\n border-color: ",";\n "])),v.actionColor)}),(function(n){return n.padding&&s.css(t||(t=p(["\n padding: ","px;\n "])),n.padding)}),(function(n){return n.borderRadius&&s.css(d||(d=p(["\n border-radius: ","px;\n "])),n.borderRadius)})),g=u.div(r||(r=p(["\n display: flex;\n margin-bottom: ","px; \n"])),3*v.spacing),b=u.div(o||(o=p(["\n flex: 1;\n font-size: ","px;\n font-weight: bold;\n line-height: ","px;\n color: ",";\n"])),v.fontBig,v.lineHeight,v.black),x=u.div(l||(l=p(["\n flex: 1;\n align-items: flex-start;\n justify-content: flex-end;\n display: flex;\n"]))),m=u.div(a||(a=p(["\n margin-top: ","px;\n \n button + button{\n margin-left: ","px;\n }\n"])),4*v.spacing,2*v.spacing);exports.default=function(n){var e=n.children,i=n.title,t=void 0===i?void 0:i,d=n.action,r=void 0===d?void 0:d,o=n.label,l=void 0===o?void 0:o,a=n.isActive,s=n.width,u=n.padding,v=n.borderRadius,p=n.elementId,h=void 0===p?void 0:p,y=n.onClick,E=void 0===y?void 0:y;return c.createElement(f,{style:{width:void 0===s?void 0:s},isActive:void 0!==a&&a,id:h,borderRadius:void 0===v?void 0:v,padding:void 0===u?void 0:u,onClick:function(){E&&E(h)}},(t||l)&&c.createElement(g,null,t&&c.createElement(b,null,t),l&&c.createElement(x,null,l)),c.createElement("div",null,e),r&&c.createElement(m,null,r))};
1
+ "use strict";function n(n){return n&&"object"==typeof n&&"default"in n?n.default:n}Object.defineProperty(exports,"__esModule",{value:!0});var e,t,i,o,l,r,d,s,c,u=n(require("react")),a=require("styled-components"),v=n(a),p=require("@propellerads/stylevariables");function f(n,e){return e||(e=n.slice(0)),n.raw=e,n}var g=v.div(e||(e=f(["\n height: 100%;\n border-radius: ","px;\n border: solid 2px ",";\n background-color: ",";\n padding: ","px;\n \n ","\n\n ","\n\n ","\n\n ","\n"])),p.borderRadius,p.gray95,p.white,6*p.spacing,(function(n){return n.isActive&&a.css(t||(t=f(["\n border-color: ",";\n "])),p.actionColor)}),(function(n){var e;return(null==(e=n.customStyles)?void 0:e.padding)&&a.css(i||(i=f(["\n padding: ","px;\n "])),n.customStyles.padding)}),(function(n){var e;return(null==(e=n.customStyles)?void 0:e.borderRadius)&&a.css(o||(o=f(["\n border-radius: ","px;\n "])),n.customStyles.borderRadius)}),(function(n){var e,t;return(null==(e=n.customStyles)?void 0:e.activeBgColor)&&(null==(t=n.customStyles)?void 0:t.bgColor)&&a.css(l||(l=f(["\n background-color: ",";\n "])),n.isActive?n.customStyles.activeBgColor:n.customStyles.bgColor)})),m=v.div(r||(r=f(["\n display: flex;\n margin-bottom: ","px; \n"])),3*p.spacing),b=v.div(d||(d=f(["\n flex: 1;\n font-size: ","px;\n font-weight: bold;\n line-height: ","px;\n color: ",";\n"])),p.fontBig,p.lineHeight,p.black),y=v.div(s||(s=f(["\n flex: 1;\n align-items: flex-start;\n justify-content: flex-end;\n display: flex;\n"]))),x=v.div(c||(c=f(["\n margin-top: ","px;\n \n button + button{\n margin-left: ","px;\n }\n"])),4*p.spacing,2*p.spacing);exports.default=function(n){var e=n.children,t=n.title,i=void 0===t?void 0:t,o=n.action,l=void 0===o?void 0:o,r=n.label,d=void 0===r?void 0:r,s=n.isActive,c=n.width,a=n.elementId,v=void 0===a?void 0:a,p=n.customStyles,f=n.onClick,h=void 0===f?void 0:f;return u.createElement(g,{style:{width:void 0===c?void 0:c},isActive:void 0!==s&&s,id:v,customStyles:void 0===p?{}:p,onClick:function(){h&&h(v)}},(i||d)&&u.createElement(m,null,i&&u.createElement(b,null,i),d&&u.createElement(y,null,d)),u.createElement("div",null,e),l&&u.createElement(x,null,l))};
2
2
  //# sourceMappingURL=card.cjs.production.min.js.map
package/dist/card.esm.js CHANGED
@@ -10,18 +10,23 @@ function _taggedTemplateLiteralLoose(strings, raw) {
10
10
  return strings;
11
11
  }
12
12
 
13
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
14
- var StyledCard = /*#__PURE__*/styled.div(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n height: 100%;\n border-radius: ", "px;\n border: solid 2px ", ";\n background-color: ", ";\n padding: ", "px;\n \n ", "\n\n ", "\n\n ", "\n"])), borderRadius, gray95, white, spacing * 6, function (props) {
13
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
14
+ var StyledCard = /*#__PURE__*/styled.div(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n height: 100%;\n border-radius: ", "px;\n border: solid 2px ", ";\n background-color: ", ";\n padding: ", "px;\n \n ", "\n\n ", "\n\n ", "\n\n ", "\n"])), borderRadius, gray95, white, spacing * 6, function (props) {
15
15
  return props.isActive && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n border-color: ", ";\n "])), actionColor);
16
16
  }, function (props) {
17
- return props.padding && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n padding: ", "px;\n "])), props.padding);
17
+ var _props$customStyles;
18
+ return ((_props$customStyles = props.customStyles) == null ? void 0 : _props$customStyles.padding) && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n padding: ", "px;\n "])), props.customStyles.padding);
18
19
  }, function (props) {
19
- return props.borderRadius && css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n border-radius: ", "px;\n "])), props.borderRadius);
20
+ var _props$customStyles2;
21
+ return ((_props$customStyles2 = props.customStyles) == null ? void 0 : _props$customStyles2.borderRadius) && css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n border-radius: ", "px;\n "])), props.customStyles.borderRadius);
22
+ }, function (props) {
23
+ var _props$customStyles3, _props$customStyles4;
24
+ return ((_props$customStyles3 = props.customStyles) == null ? void 0 : _props$customStyles3.activeBgColor) && ((_props$customStyles4 = props.customStyles) == null ? void 0 : _props$customStyles4.bgColor) && css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n "])), props.isActive ? props.customStyles.activeBgColor : props.customStyles.bgColor);
20
25
  });
21
- var Header = /*#__PURE__*/styled.div(_templateObject5 || (_templateObject5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n margin-bottom: ", "px; \n"])), spacing * 3);
22
- var Title = /*#__PURE__*/styled.div(_templateObject6 || (_templateObject6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n flex: 1;\n font-size: ", "px;\n font-weight: bold;\n line-height: ", "px;\n color: ", ";\n"])), fontBig, lineHeight, black);
23
- var Label = /*#__PURE__*/styled.div(_templateObject7 || (_templateObject7 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n flex: 1;\n align-items: flex-start;\n justify-content: flex-end;\n display: flex;\n"])));
24
- var Action = /*#__PURE__*/styled.div(_templateObject8 || (_templateObject8 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-top: ", "px;\n \n button + button{\n margin-left: ", "px;\n }\n"])), spacing * 4, spacing * 2);
26
+ var Header = /*#__PURE__*/styled.div(_templateObject6 || (_templateObject6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n margin-bottom: ", "px; \n"])), spacing * 3);
27
+ var Title = /*#__PURE__*/styled.div(_templateObject7 || (_templateObject7 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n flex: 1;\n font-size: ", "px;\n font-weight: bold;\n line-height: ", "px;\n color: ", ";\n"])), fontBig, lineHeight, black);
28
+ var Label = /*#__PURE__*/styled.div(_templateObject8 || (_templateObject8 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n flex: 1;\n align-items: flex-start;\n justify-content: flex-end;\n display: flex;\n"])));
29
+ var Action = /*#__PURE__*/styled.div(_templateObject9 || (_templateObject9 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-top: ", "px;\n \n button + button{\n margin-left: ", "px;\n }\n"])), spacing * 4, spacing * 2);
25
30
 
26
31
  var Card = function Card(_ref) {
27
32
  var children = _ref.children,
@@ -35,12 +40,10 @@ var Card = function Card(_ref) {
35
40
  isActive = _ref$isActive === void 0 ? false : _ref$isActive,
36
41
  _ref$width = _ref.width,
37
42
  width = _ref$width === void 0 ? undefined : _ref$width,
38
- _ref$padding = _ref.padding,
39
- padding = _ref$padding === void 0 ? undefined : _ref$padding,
40
- _ref$borderRadius = _ref.borderRadius,
41
- borderRadius = _ref$borderRadius === void 0 ? undefined : _ref$borderRadius,
42
43
  _ref$elementId = _ref.elementId,
43
44
  elementId = _ref$elementId === void 0 ? undefined : _ref$elementId,
45
+ _ref$customStyles = _ref.customStyles,
46
+ customStyles = _ref$customStyles === void 0 ? {} : _ref$customStyles,
44
47
  _ref$onClick = _ref.onClick,
45
48
  onClick = _ref$onClick === void 0 ? undefined : _ref$onClick;
46
49
  var handleClick = function handleClick() {
@@ -54,8 +57,7 @@ var Card = function Card(_ref) {
54
57
  },
55
58
  isActive: isActive,
56
59
  id: elementId,
57
- borderRadius: borderRadius,
58
- padding: padding,
60
+ customStyles: customStyles,
59
61
  onClick: handleClick
60
62
  }, (title || label) && React.createElement(Header, null, title && React.createElement(Title, null, title), label && React.createElement(Label, null, label)), React.createElement("div", null, children), action && React.createElement(Action, null, action));
61
63
  };
@@ -1 +1 @@
1
- {"version":3,"file":"card.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"card.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.d.ts CHANGED
@@ -5,10 +5,14 @@ interface IProps {
5
5
  children: string | Node;
6
6
  isActive?: boolean;
7
7
  width?: string | number;
8
- padding?: number;
9
- borderRadius?: number;
10
8
  elementId?: string;
9
+ customStyles?: {
10
+ padding?: number;
11
+ borderRadius?: number;
12
+ bgColor?: string;
13
+ activeBgColor?: string;
14
+ };
11
15
  onClick?: (string: any) => string;
12
16
  }
13
- declare const Card: ({ children, title, action, label, isActive, width, padding, borderRadius, elementId, onClick, }: IProps) => JSX.Element;
17
+ declare const Card: ({ children, title, action, label, isActive, width, elementId, customStyles, onClick, }: IProps) => JSX.Element;
14
18
  export default Card;
package/dist/style.d.ts CHANGED
@@ -2,8 +2,11 @@ interface IProps {
2
2
  isActive: boolean;
3
3
  padding?: number;
4
4
  borderRadius?: number;
5
- style: {
6
- width: number | string | undefined;
5
+ customStyles?: {
6
+ padding?: number;
7
+ borderRadius?: number;
8
+ bgColor?: string;
9
+ activeBgColor?: string;
7
10
  };
8
11
  }
9
12
  declare const StyledCard: import("styled-components").StyledComponent<"div", any, IProps, never>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@propellerads/card",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/card.esm.js",
6
6
  "typings": "dist/index.d.ts",
@@ -32,5 +32,5 @@
32
32
  "react": "^17.0.2",
33
33
  "styled-components": "5.1.1"
34
34
  },
35
- "gitHead": "99cc04ab639c3957e82da4b01e15d7ee980bb311"
35
+ "gitHead": "43906fa3ebddc80b084aad7cc3ebb8c7ed37b180"
36
36
  }