@propellerads/card 3.1.0 → 4.0.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/README.md CHANGED
@@ -7,8 +7,10 @@
7
7
  [Github](https://github.com/propellerads/ui-components/tree/master/Components/Card)
8
8
 
9
9
  ## Installation
10
- * `yarn add @propellerads/card` or `npm install @propellerads/card -S`
10
+
11
+ - `yarn add @propellerads/card` or `npm install @propellerads/card -S`
11
12
 
12
13
  ### How to use
13
- * `import Card from '@propellerads/card';`
14
- * And render `<Card>Your content</Card>`
14
+
15
+ - `import Card from '@propellerads/card';`
16
+ - And render `<Card>Your content</Card>`
@@ -18,8 +18,12 @@ function _taggedTemplateLiteralLoose(strings, raw) {
18
18
  }
19
19
 
20
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
- return props.isActive && styled.css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n border-color: ", ";\n "])), stylevariables.actionColor);
21
+ var StyledCard = /*#__PURE__*/styled__default.div.attrs(function (props) {
22
+ return {
23
+ className: props.className
24
+ };
25
+ })(_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) {
26
+ return props.isActive && styled.css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n border-color: ", ";\n "])), stylevariables.actionColor);
23
27
  }, function (props) {
24
28
  var _props$customStyles;
25
29
  return ((_props$customStyles = props.customStyles) == null ? void 0 : _props$customStyles.padding) && styled.css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n padding: ", "px;\n "])), props.customStyles.padding);
@@ -30,13 +34,15 @@ var StyledCard = /*#__PURE__*/styled__default.div(_templateObject || (_templateO
30
34
  var _props$customStyles3, _props$customStyles4;
31
35
  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);
32
36
  });
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);
37
+ var Header = /*#__PURE__*/styled__default.div(_templateObject6 || (_templateObject6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n margin-bottom: ", "px;\n"])), stylevariables.spacing * 3);
38
+ 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);
39
+ 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"])));
40
+ 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);
37
41
 
38
42
  var Card = function Card(_ref) {
39
43
  var children = _ref.children,
44
+ _ref$className = _ref.className,
45
+ className = _ref$className === void 0 ? undefined : _ref$className,
40
46
  _ref$title = _ref.title,
41
47
  title = _ref$title === void 0 ? undefined : _ref$title,
42
48
  _ref$action = _ref.action,
@@ -59,6 +65,7 @@ var Card = function Card(_ref) {
59
65
  }
60
66
  };
61
67
  return React.createElement(StyledCard, {
68
+ className: className,
62
69
  style: {
63
70
  width: width
64
71
  },
@@ -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,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))};
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,s,d,c,a=n(require("react")),u=require("styled-components"),v=n(u),p=require("@propellerads/stylevariables");function m(n,e){return e||(e=n.slice(0)),n.raw=e,n}var f=v.div.attrs((function(n){return{className:n.className}}))(e||(e=m(["\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&&u.css(t||(t=m(["\n border-color: ",";\n "])),p.actionColor)}),(function(n){var e;return(null==(e=n.customStyles)?void 0:e.padding)&&u.css(i||(i=m(["\n padding: ","px;\n "])),n.customStyles.padding)}),(function(n){var e;return(null==(e=n.customStyles)?void 0:e.borderRadius)&&u.css(o||(o=m(["\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)&&u.css(l||(l=m(["\n background-color: ",";\n "])),n.isActive?n.customStyles.activeBgColor:n.customStyles.bgColor)})),g=v.div(r||(r=m(["\n display: flex;\n margin-bottom: ","px;\n"])),3*p.spacing),b=v.div(s||(s=m(["\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(d||(d=m(["\n flex: 1;\n align-items: flex-start;\n justify-content: flex-end;\n display: flex;\n"]))),x=v.div(c||(c=m(["\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.className,i=n.title,o=void 0===i?void 0:i,l=n.action,r=void 0===l?void 0:l,s=n.label,d=void 0===s?void 0:s,c=n.isActive,u=n.width,v=n.elementId,p=void 0===v?void 0:v,m=n.customStyles,h=n.onClick,S=void 0===h?void 0:h;return a.createElement(f,{className:void 0===t?void 0:t,style:{width:void 0===u?void 0:u},isActive:void 0!==c&&c,id:p,customStyles:void 0===m?{}:m,onClick:function(){S&&S(p)}},(o||d)&&a.createElement(g,null,o&&a.createElement(b,null,o),d&&a.createElement(y,null,d)),a.createElement("div",null,e),r&&a.createElement(x,null,r))};
2
2
  //# sourceMappingURL=card.cjs.production.min.js.map
package/dist/card.esm.js CHANGED
@@ -11,8 +11,12 @@ function _taggedTemplateLiteralLoose(strings, raw) {
11
11
  }
12
12
 
13
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
- return props.isActive && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n border-color: ", ";\n "])), actionColor);
14
+ var StyledCard = /*#__PURE__*/styled.div.attrs(function (props) {
15
+ return {
16
+ className: props.className
17
+ };
18
+ })(_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) {
19
+ return props.isActive && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n border-color: ", ";\n "])), actionColor);
16
20
  }, function (props) {
17
21
  var _props$customStyles;
18
22
  return ((_props$customStyles = props.customStyles) == null ? void 0 : _props$customStyles.padding) && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n padding: ", "px;\n "])), props.customStyles.padding);
@@ -23,13 +27,15 @@ var StyledCard = /*#__PURE__*/styled.div(_templateObject || (_templateObject = /
23
27
  var _props$customStyles3, _props$customStyles4;
24
28
  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);
25
29
  });
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);
30
+ var Header = /*#__PURE__*/styled.div(_templateObject6 || (_templateObject6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n margin-bottom: ", "px;\n"])), spacing * 3);
31
+ 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);
32
+ 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"])));
33
+ 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);
30
34
 
31
35
  var Card = function Card(_ref) {
32
36
  var children = _ref.children,
37
+ _ref$className = _ref.className,
38
+ className = _ref$className === void 0 ? undefined : _ref$className,
33
39
  _ref$title = _ref.title,
34
40
  title = _ref$title === void 0 ? undefined : _ref$title,
35
41
  _ref$action = _ref.action,
@@ -52,6 +58,7 @@ var Card = function Card(_ref) {
52
58
  }
53
59
  };
54
60
  return React.createElement(StyledCard, {
61
+ className: className,
55
62
  style: {
56
63
  width: width
57
64
  },
@@ -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
@@ -1,11 +1,13 @@
1
+ import React, { ReactNode } from 'react';
1
2
  interface IProps {
2
- title?: string | Node;
3
- action?: string | Node;
4
- label?: string | Node;
5
- children: string | Node;
3
+ title?: ReactNode;
4
+ action?: ReactNode;
5
+ label?: ReactNode;
6
+ children: ReactNode;
6
7
  isActive?: boolean;
7
8
  width?: string | number;
8
9
  elementId?: string;
10
+ className?: string;
9
11
  customStyles?: {
10
12
  padding?: number;
11
13
  borderRadius?: number;
@@ -14,5 +16,5 @@ interface IProps {
14
16
  };
15
17
  onClick?: (string: any) => string;
16
18
  }
17
- declare const Card: ({ children, title, action, label, isActive, width, elementId, customStyles, onClick, }: IProps) => JSX.Element;
19
+ declare const Card: ({ children, className, title, action, label, isActive, width, elementId, customStyles, onClick, }: IProps) => React.JSX.Element;
18
20
  export default Card;
package/dist/style.d.ts CHANGED
@@ -1,17 +1,8 @@
1
- interface IProps {
2
- isActive: boolean;
3
- padding?: number;
4
- borderRadius?: number;
5
- customStyles?: {
6
- padding?: number;
7
- borderRadius?: number;
8
- bgColor?: string;
9
- activeBgColor?: string;
10
- };
11
- }
12
- declare const StyledCard: import("styled-components").StyledComponent<"div", any, IProps, never>;
1
+ declare const StyledCard: import("styled-components").StyledComponent<"div", any, {
2
+ className: string | undefined;
3
+ }, "className">;
13
4
  declare const Header: import("styled-components").StyledComponent<"div", any, {}, never>;
14
5
  declare const Title: import("styled-components").StyledComponent<"div", any, {}, never>;
15
6
  declare const Label: import("styled-components").StyledComponent<"div", any, {}, never>;
16
7
  declare const Action: import("styled-components").StyledComponent<"div", any, {}, never>;
17
- export { StyledCard, Header, Title, Label, Action, };
8
+ export { StyledCard, Header, Title, Label, Action };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@propellerads/card",
3
- "version": "3.1.0",
3
+ "version": "4.0.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/card.esm.js",
6
6
  "typings": "dist/index.d.ts",
@@ -26,11 +26,10 @@
26
26
  "devDependencies": {
27
27
  "tsdx": "^0.14.1",
28
28
  "tslib": "^2.3.1",
29
- "typescript": "^4.4.2"
29
+ "typescript": "^4.9.5"
30
30
  },
31
31
  "peerDependencies": {
32
- "react": "^17.0.2",
32
+ "react": ">=18 <19",
33
33
  "styled-components": "5.1.1"
34
- },
35
- "gitHead": "43906fa3ebddc80b084aad7cc3ebb8c7ed37b180"
34
+ }
36
35
  }
package/CHANGELOG.md DELETED
@@ -1,28 +0,0 @@
1
- #### `3.1.0`
2
- * added `customStyles` prop
3
-
4
- #### `3.0.0`
5
- * added onClick prop
6
- * migrated to TypeScript
7
-
8
- #### `2.3.0`
9
- * it's possible to overwrite default padding and border-radius
10
-
11
- #### `2.2.0`
12
- * updated `width` type - now it could be a number or a string
13
- * marked unused dependencies to `peerDependencies`
14
-
15
- #### `2.1.0`
16
- * update style-variables
17
-
18
- #### `2.0.1`
19
-
20
- * Styles changes: borders
21
-
22
- #### `2.0.0`
23
-
24
- * update deps
25
-
26
- #### `1.0.4`
27
-
28
- * Set card height to 100%