@propellerads/card 2.3.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 +7 -0
- package/dist/card.cjs.development.js +73 -0
- package/dist/card.cjs.development.js.map +1 -0
- package/dist/card.cjs.production.min.js +2 -0
- package/dist/card.cjs.production.min.js.map +1 -0
- package/dist/card.esm.js +66 -0
- package/dist/card.esm.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +8 -0
- package/dist/style.d.ts +17 -0
- package/package.json +14 -17
- package/dist/index.esm.js +0 -152
- package/dist/index.esm.min.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
6
|
+
|
|
7
|
+
var React = _interopDefault(require('react'));
|
|
8
|
+
var styled = require('styled-components');
|
|
9
|
+
var styled__default = _interopDefault(styled);
|
|
10
|
+
var stylevariables = require('@propellerads/stylevariables');
|
|
11
|
+
|
|
12
|
+
function _taggedTemplateLiteralLoose(strings, raw) {
|
|
13
|
+
if (!raw) {
|
|
14
|
+
raw = strings.slice(0);
|
|
15
|
+
}
|
|
16
|
+
strings.raw = raw;
|
|
17
|
+
return strings;
|
|
18
|
+
}
|
|
19
|
+
|
|
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);
|
|
23
|
+
}, function (props) {
|
|
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);
|
|
26
|
+
}, function (props) {
|
|
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);
|
|
32
|
+
});
|
|
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
|
+
|
|
38
|
+
var Card = function Card(_ref) {
|
|
39
|
+
var children = _ref.children,
|
|
40
|
+
_ref$title = _ref.title,
|
|
41
|
+
title = _ref$title === void 0 ? undefined : _ref$title,
|
|
42
|
+
_ref$action = _ref.action,
|
|
43
|
+
action = _ref$action === void 0 ? undefined : _ref$action,
|
|
44
|
+
_ref$label = _ref.label,
|
|
45
|
+
label = _ref$label === void 0 ? undefined : _ref$label,
|
|
46
|
+
_ref$isActive = _ref.isActive,
|
|
47
|
+
isActive = _ref$isActive === void 0 ? false : _ref$isActive,
|
|
48
|
+
_ref$width = _ref.width,
|
|
49
|
+
width = _ref$width === void 0 ? undefined : _ref$width,
|
|
50
|
+
_ref$elementId = _ref.elementId,
|
|
51
|
+
elementId = _ref$elementId === void 0 ? undefined : _ref$elementId,
|
|
52
|
+
_ref$customStyles = _ref.customStyles,
|
|
53
|
+
customStyles = _ref$customStyles === void 0 ? {} : _ref$customStyles,
|
|
54
|
+
_ref$onClick = _ref.onClick,
|
|
55
|
+
onClick = _ref$onClick === void 0 ? undefined : _ref$onClick;
|
|
56
|
+
var handleClick = function handleClick() {
|
|
57
|
+
if (onClick) {
|
|
58
|
+
onClick(elementId);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
return React.createElement(StyledCard, {
|
|
62
|
+
style: {
|
|
63
|
+
width: width
|
|
64
|
+
},
|
|
65
|
+
isActive: isActive,
|
|
66
|
+
id: elementId,
|
|
67
|
+
customStyles: customStyles,
|
|
68
|
+
onClick: handleClick
|
|
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));
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
exports.default = Card;
|
|
73
|
+
//# sourceMappingURL=card.cjs.development.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.cjs.development.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +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))};
|
|
2
|
+
//# sourceMappingURL=card.cjs.production.min.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.cjs.production.min.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/card.esm.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
import { borderRadius, gray95, white, spacing, actionColor, fontBig, lineHeight, black } from '@propellerads/stylevariables';
|
|
4
|
+
|
|
5
|
+
function _taggedTemplateLiteralLoose(strings, raw) {
|
|
6
|
+
if (!raw) {
|
|
7
|
+
raw = strings.slice(0);
|
|
8
|
+
}
|
|
9
|
+
strings.raw = raw;
|
|
10
|
+
return strings;
|
|
11
|
+
}
|
|
12
|
+
|
|
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);
|
|
16
|
+
}, function (props) {
|
|
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);
|
|
19
|
+
}, function (props) {
|
|
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);
|
|
25
|
+
});
|
|
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
|
+
|
|
31
|
+
var Card = function Card(_ref) {
|
|
32
|
+
var children = _ref.children,
|
|
33
|
+
_ref$title = _ref.title,
|
|
34
|
+
title = _ref$title === void 0 ? undefined : _ref$title,
|
|
35
|
+
_ref$action = _ref.action,
|
|
36
|
+
action = _ref$action === void 0 ? undefined : _ref$action,
|
|
37
|
+
_ref$label = _ref.label,
|
|
38
|
+
label = _ref$label === void 0 ? undefined : _ref$label,
|
|
39
|
+
_ref$isActive = _ref.isActive,
|
|
40
|
+
isActive = _ref$isActive === void 0 ? false : _ref$isActive,
|
|
41
|
+
_ref$width = _ref.width,
|
|
42
|
+
width = _ref$width === void 0 ? undefined : _ref$width,
|
|
43
|
+
_ref$elementId = _ref.elementId,
|
|
44
|
+
elementId = _ref$elementId === void 0 ? undefined : _ref$elementId,
|
|
45
|
+
_ref$customStyles = _ref.customStyles,
|
|
46
|
+
customStyles = _ref$customStyles === void 0 ? {} : _ref$customStyles,
|
|
47
|
+
_ref$onClick = _ref.onClick,
|
|
48
|
+
onClick = _ref$onClick === void 0 ? undefined : _ref$onClick;
|
|
49
|
+
var handleClick = function handleClick() {
|
|
50
|
+
if (onClick) {
|
|
51
|
+
onClick(elementId);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
return React.createElement(StyledCard, {
|
|
55
|
+
style: {
|
|
56
|
+
width: width
|
|
57
|
+
},
|
|
58
|
+
isActive: isActive,
|
|
59
|
+
id: elementId,
|
|
60
|
+
customStyles: customStyles,
|
|
61
|
+
onClick: handleClick
|
|
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));
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export default Card;
|
|
66
|
+
//# sourceMappingURL=card.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface IProps {
|
|
2
|
+
title?: string | Node;
|
|
3
|
+
action?: string | Node;
|
|
4
|
+
label?: string | Node;
|
|
5
|
+
children: string | Node;
|
|
6
|
+
isActive?: boolean;
|
|
7
|
+
width?: string | number;
|
|
8
|
+
elementId?: string;
|
|
9
|
+
customStyles?: {
|
|
10
|
+
padding?: number;
|
|
11
|
+
borderRadius?: number;
|
|
12
|
+
bgColor?: string;
|
|
13
|
+
activeBgColor?: string;
|
|
14
|
+
};
|
|
15
|
+
onClick?: (string: any) => string;
|
|
16
|
+
}
|
|
17
|
+
declare const Card: ({ children, title, action, label, isActive, width, elementId, customStyles, onClick, }: IProps) => JSX.Element;
|
|
18
|
+
export default Card;
|
package/dist/index.js
ADDED
package/dist/style.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
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>;
|
|
13
|
+
declare const Header: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
14
|
+
declare const Title: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
15
|
+
declare const Label: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
16
|
+
declare const Action: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
17
|
+
export { StyledCard, Header, Title, Label, Action, };
|
package/package.json
CHANGED
|
@@ -1,39 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@propellerads/card",
|
|
3
|
-
"version": "
|
|
4
|
-
"main": "dist/index.
|
|
5
|
-
"module": "dist/
|
|
3
|
+
"version": "3.1.0",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"module": "dist/card.esm.js",
|
|
6
|
+
"typings": "dist/index.d.ts",
|
|
6
7
|
"files": [
|
|
7
8
|
"dist"
|
|
8
9
|
],
|
|
9
10
|
"repository": "https://github.com/propellerads/ui-components.git",
|
|
10
11
|
"author": "i.pasyuk@propellerads.net",
|
|
11
12
|
"license": "MIT",
|
|
13
|
+
"private": false,
|
|
12
14
|
"bugs": {
|
|
13
15
|
"url": "https://github.com/propellerads/ui-components/issues"
|
|
14
16
|
},
|
|
17
|
+
"homepage": "https://github.com/propellerads/ui-components#readme",
|
|
15
18
|
"scripts": {
|
|
16
|
-
"prepublishOnly": "
|
|
19
|
+
"prepublishOnly": "tsdx build",
|
|
20
|
+
"start": "tsdx watch",
|
|
21
|
+
"build": "tsdx build"
|
|
17
22
|
},
|
|
18
|
-
"homepage": "https://github.com/propellerads/ui-components#readme",
|
|
19
|
-
"private": false,
|
|
20
23
|
"dependencies": {
|
|
21
|
-
"@propellerads/stylevariables": "^1.3.
|
|
24
|
+
"@propellerads/stylevariables": "^1.3.1"
|
|
22
25
|
},
|
|
23
26
|
"devDependencies": {
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"@babel/preset-env": "^7.10.2",
|
|
28
|
-
"@babel/preset-react": "^7.10.1",
|
|
29
|
-
"rollup": "^2.16.1",
|
|
30
|
-
"rollup-plugin-babel": "^4.4.0",
|
|
31
|
-
"rollup-plugin-terser": "^6.1.0"
|
|
27
|
+
"tsdx": "^0.14.1",
|
|
28
|
+
"tslib": "^2.3.1",
|
|
29
|
+
"typescript": "^4.4.2"
|
|
32
30
|
},
|
|
33
31
|
"peerDependencies": {
|
|
34
|
-
"prop-types": "15.7.2",
|
|
35
32
|
"react": "^17.0.2",
|
|
36
33
|
"styled-components": "5.1.1"
|
|
37
34
|
},
|
|
38
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "43906fa3ebddc80b084aad7cc3ebb8c7ed37b180"
|
|
39
36
|
}
|
package/dist/index.esm.js
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import styled, { css } from 'styled-components';
|
|
4
|
-
import { borderRadius, gray95, white, spacing, actionColor, fontBig, lineHeight, black } from '@propellerads/stylevariables';
|
|
5
|
-
|
|
6
|
-
function _taggedTemplateLiteral(strings, raw) {
|
|
7
|
-
if (!raw) {
|
|
8
|
-
raw = strings.slice(0);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return Object.freeze(Object.defineProperties(strings, {
|
|
12
|
-
raw: {
|
|
13
|
-
value: Object.freeze(raw)
|
|
14
|
-
}
|
|
15
|
-
}));
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function _templateObject8() {
|
|
19
|
-
var data = _taggedTemplateLiteral(["\n margin-top: ", "px;\n \n button + button{\n margin-left: ", "px;\n }\n"]);
|
|
20
|
-
|
|
21
|
-
_templateObject8 = function _templateObject8() {
|
|
22
|
-
return data;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
return data;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function _templateObject7() {
|
|
29
|
-
var data = _taggedTemplateLiteral(["\n flex: 1;\n align-items: flex-start;\n justify-content: flex-end;\n display: flex;\n"]);
|
|
30
|
-
|
|
31
|
-
_templateObject7 = function _templateObject7() {
|
|
32
|
-
return data;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
return data;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function _templateObject6() {
|
|
39
|
-
var data = _taggedTemplateLiteral(["\n flex: 1;\n font-size: ", "px;\n font-weight: bold;\n line-height: ", "px;\n color: ", ";\n"]);
|
|
40
|
-
|
|
41
|
-
_templateObject6 = function _templateObject6() {
|
|
42
|
-
return data;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
return data;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function _templateObject5() {
|
|
49
|
-
var data = _taggedTemplateLiteral(["\n display: flex;\n margin-bottom: ", "px; \n"]);
|
|
50
|
-
|
|
51
|
-
_templateObject5 = function _templateObject5() {
|
|
52
|
-
return data;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
return data;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function _templateObject4() {
|
|
59
|
-
var data = _taggedTemplateLiteral(["\n border-radius: ", "px;\n "]);
|
|
60
|
-
|
|
61
|
-
_templateObject4 = function _templateObject4() {
|
|
62
|
-
return data;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
return data;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function _templateObject3() {
|
|
69
|
-
var data = _taggedTemplateLiteral(["\n padding: ", "px;\n "]);
|
|
70
|
-
|
|
71
|
-
_templateObject3 = function _templateObject3() {
|
|
72
|
-
return data;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
return data;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function _templateObject2() {
|
|
79
|
-
var data = _taggedTemplateLiteral(["\n border-color: ", ";\n "]);
|
|
80
|
-
|
|
81
|
-
_templateObject2 = function _templateObject2() {
|
|
82
|
-
return data;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
return data;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function _templateObject() {
|
|
89
|
-
var data = _taggedTemplateLiteral(["\n height: 100%;\n border-radius: ", "px;\n border: solid 2px ", ";\n background-color: ", ";\n padding: ", "px;\n \n ", "\n\n ", "\n\n ", "\n"]);
|
|
90
|
-
|
|
91
|
-
_templateObject = function _templateObject() {
|
|
92
|
-
return data;
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
return data;
|
|
96
|
-
}
|
|
97
|
-
var StyledCard = styled.div(_templateObject(), borderRadius, gray95, white, spacing * 6, function (props) {
|
|
98
|
-
return props.isActive && css(_templateObject2(), actionColor);
|
|
99
|
-
}, function (props) {
|
|
100
|
-
return props.padding && css(_templateObject3(), props.padding);
|
|
101
|
-
}, function (props) {
|
|
102
|
-
return props.borderRadius && css(_templateObject4(), props.borderRadius);
|
|
103
|
-
});
|
|
104
|
-
var Header = styled.div(_templateObject5(), spacing * 3);
|
|
105
|
-
var Title = styled.div(_templateObject6(), fontBig, lineHeight, black);
|
|
106
|
-
var Label = styled.div(_templateObject7());
|
|
107
|
-
var Action = styled.div(_templateObject8(), spacing * 4, spacing * 2);
|
|
108
|
-
|
|
109
|
-
var Card = function Card(_ref) {
|
|
110
|
-
var children = _ref.children,
|
|
111
|
-
title = _ref.title,
|
|
112
|
-
action = _ref.action,
|
|
113
|
-
label = _ref.label,
|
|
114
|
-
isActive = _ref.isActive,
|
|
115
|
-
width = _ref.width,
|
|
116
|
-
padding = _ref.padding,
|
|
117
|
-
borderRadius = _ref.borderRadius,
|
|
118
|
-
elementId = _ref.elementId;
|
|
119
|
-
return /*#__PURE__*/React.createElement(StyledCard, {
|
|
120
|
-
style: {
|
|
121
|
-
width: width
|
|
122
|
-
},
|
|
123
|
-
isActive: isActive,
|
|
124
|
-
id: elementId,
|
|
125
|
-
borderRadius: borderRadius,
|
|
126
|
-
padding: padding
|
|
127
|
-
}, (title || label) && /*#__PURE__*/React.createElement(Header, null, title && /*#__PURE__*/React.createElement(Title, null, title), label && /*#__PURE__*/React.createElement(Label, null, label)), /*#__PURE__*/React.createElement("div", null, children), action && /*#__PURE__*/React.createElement(Action, null, action));
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
Card.propTypes = {
|
|
131
|
-
title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
132
|
-
action: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
133
|
-
label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
134
|
-
children: PropTypes.oneOfType([PropTypes.string, PropTypes.element, PropTypes.node]).isRequired,
|
|
135
|
-
isActive: PropTypes.bool,
|
|
136
|
-
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
137
|
-
padding: PropTypes.oneOfType([PropTypes.number]),
|
|
138
|
-
borderRadius: PropTypes.oneOfType([PropTypes.number]),
|
|
139
|
-
elementId: PropTypes.string
|
|
140
|
-
};
|
|
141
|
-
Card.defaultProps = {
|
|
142
|
-
isActive: false,
|
|
143
|
-
title: undefined,
|
|
144
|
-
action: undefined,
|
|
145
|
-
label: undefined,
|
|
146
|
-
width: undefined,
|
|
147
|
-
padding: undefined,
|
|
148
|
-
borderRadius: undefined,
|
|
149
|
-
elementId: undefined
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
export default Card;
|
package/dist/index.esm.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import n from"react";import e from"prop-types";import r,{css as t}from"styled-components";import{borderRadius as i,gray95 as o,white as d,spacing as u,actionColor as l,fontBig as a,lineHeight as c,black as f}from"@propellerads/stylevariables";function p(n,e){return e||(e=n.slice(0)),Object.freeze(Object.defineProperties(n,{raw:{value:Object.freeze(e)}}))}function s(){var n=p(["\n margin-top: ","px;\n \n button + button{\n margin-left: ","px;\n }\n"]);return s=function(){return n},n}function m(){var n=p(["\n flex: 1;\n align-items: flex-start;\n justify-content: flex-end;\n display: flex;\n"]);return m=function(){return n},n}function v(){var n=p(["\n flex: 1;\n font-size: ","px;\n font-weight: bold;\n line-height: ","px;\n color: ",";\n"]);return v=function(){return n},n}function b(){var n=p(["\n display: flex;\n margin-bottom: ","px; \n"]);return b=function(){return n},n}function g(){var n=p(["\n border-radius: ","px;\n "]);return g=function(){return n},n}function x(){var n=p(["\n padding: ","px;\n "]);return x=function(){return n},n}function y(){var n=p(["\n border-color: ",";\n "]);return y=function(){return n},n}function h(){var n=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"]);return h=function(){return n},n}var O=r.div(h(),i,o,d,6*u,(function(n){return n.isActive&&t(y(),l)}),(function(n){return n.padding&&t(x(),n.padding)}),(function(n){return n.borderRadius&&t(g(),n.borderRadius)})),T=r.div(b(),3*u),R=r.div(v(),a,c,f),w=r.div(m()),E=r.div(s(),4*u,2*u),A=function(e){var r=e.children,t=e.title,i=e.action,o=e.label,d=e.isActive,u=e.width,l=e.padding,a=e.borderRadius,c=e.elementId;return n.createElement(O,{style:{width:u},isActive:d,id:c,borderRadius:a,padding:l},(t||o)&&n.createElement(T,null,t&&n.createElement(R,null,t),o&&n.createElement(w,null,o)),n.createElement("div",null,r),i&&n.createElement(E,null,i))};A.propTypes={title:e.oneOfType([e.string,e.element]),action:e.oneOfType([e.string,e.element]),label:e.oneOfType([e.string,e.element]),children:e.oneOfType([e.string,e.element,e.node]).isRequired,isActive:e.bool,width:e.oneOfType([e.number,e.string]),padding:e.oneOfType([e.number]),borderRadius:e.oneOfType([e.number]),elementId:e.string},A.defaultProps={isActive:!1,title:void 0,action:void 0,label:void 0,width:void 0,padding:void 0,borderRadius:void 0,elementId:void 0};export default A;
|