@propellerads/card 2.2.0 → 3.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/CHANGELOG.md +7 -0
- package/dist/card.cjs.development.js +71 -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 +64 -0
- package/dist/card.esm.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +8 -0
- package/dist/style.d.ts +14 -0
- package/package.json +14 -17
- package/dist/index.esm.js +0 -120
- package/dist/index.esm.min.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
#### `3.0.0`
|
|
2
|
+
* added onClick prop
|
|
3
|
+
* migrated to TypeScript
|
|
4
|
+
|
|
5
|
+
#### `2.3.0`
|
|
6
|
+
* it's possible to overwrite default padding and border-radius
|
|
7
|
+
|
|
1
8
|
#### `2.2.0`
|
|
2
9
|
* updated `width` type - now it could be a number or a string
|
|
3
10
|
* marked unused dependencies to `peerDependencies`
|
|
@@ -0,0 +1,71 @@
|
|
|
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;
|
|
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) {
|
|
22
|
+
return props.isActive && styled.css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n border-color: ", ";\n "])), stylevariables.actionColor);
|
|
23
|
+
}, function (props) {
|
|
24
|
+
return props.padding && styled.css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n padding: ", "px;\n "])), props.padding);
|
|
25
|
+
}, function (props) {
|
|
26
|
+
return props.borderRadius && styled.css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n border-radius: ", "px;\n "])), props.borderRadius);
|
|
27
|
+
});
|
|
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);
|
|
32
|
+
|
|
33
|
+
var Card = function Card(_ref) {
|
|
34
|
+
var children = _ref.children,
|
|
35
|
+
_ref$title = _ref.title,
|
|
36
|
+
title = _ref$title === void 0 ? undefined : _ref$title,
|
|
37
|
+
_ref$action = _ref.action,
|
|
38
|
+
action = _ref$action === void 0 ? undefined : _ref$action,
|
|
39
|
+
_ref$label = _ref.label,
|
|
40
|
+
label = _ref$label === void 0 ? undefined : _ref$label,
|
|
41
|
+
_ref$isActive = _ref.isActive,
|
|
42
|
+
isActive = _ref$isActive === void 0 ? false : _ref$isActive,
|
|
43
|
+
_ref$width = _ref.width,
|
|
44
|
+
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
|
+
_ref$elementId = _ref.elementId,
|
|
50
|
+
elementId = _ref$elementId === void 0 ? undefined : _ref$elementId,
|
|
51
|
+
_ref$onClick = _ref.onClick,
|
|
52
|
+
onClick = _ref$onClick === void 0 ? undefined : _ref$onClick;
|
|
53
|
+
var handleClick = function handleClick() {
|
|
54
|
+
if (onClick) {
|
|
55
|
+
onClick(elementId);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
return React.createElement(StyledCard, {
|
|
59
|
+
style: {
|
|
60
|
+
width: width
|
|
61
|
+
},
|
|
62
|
+
isActive: isActive,
|
|
63
|
+
id: elementId,
|
|
64
|
+
borderRadius: borderRadius,
|
|
65
|
+
padding: padding,
|
|
66
|
+
onClick: handleClick
|
|
67
|
+
}, (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
|
+
};
|
|
69
|
+
|
|
70
|
+
exports.default = Card;
|
|
71
|
+
//# 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,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))};
|
|
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,64 @@
|
|
|
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;
|
|
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) {
|
|
15
|
+
return props.isActive && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n border-color: ", ";\n "])), actionColor);
|
|
16
|
+
}, function (props) {
|
|
17
|
+
return props.padding && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n padding: ", "px;\n "])), props.padding);
|
|
18
|
+
}, function (props) {
|
|
19
|
+
return props.borderRadius && css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n border-radius: ", "px;\n "])), props.borderRadius);
|
|
20
|
+
});
|
|
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);
|
|
25
|
+
|
|
26
|
+
var Card = function Card(_ref) {
|
|
27
|
+
var children = _ref.children,
|
|
28
|
+
_ref$title = _ref.title,
|
|
29
|
+
title = _ref$title === void 0 ? undefined : _ref$title,
|
|
30
|
+
_ref$action = _ref.action,
|
|
31
|
+
action = _ref$action === void 0 ? undefined : _ref$action,
|
|
32
|
+
_ref$label = _ref.label,
|
|
33
|
+
label = _ref$label === void 0 ? undefined : _ref$label,
|
|
34
|
+
_ref$isActive = _ref.isActive,
|
|
35
|
+
isActive = _ref$isActive === void 0 ? false : _ref$isActive,
|
|
36
|
+
_ref$width = _ref.width,
|
|
37
|
+
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
|
+
_ref$elementId = _ref.elementId,
|
|
43
|
+
elementId = _ref$elementId === void 0 ? undefined : _ref$elementId,
|
|
44
|
+
_ref$onClick = _ref.onClick,
|
|
45
|
+
onClick = _ref$onClick === void 0 ? undefined : _ref$onClick;
|
|
46
|
+
var handleClick = function handleClick() {
|
|
47
|
+
if (onClick) {
|
|
48
|
+
onClick(elementId);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
return React.createElement(StyledCard, {
|
|
52
|
+
style: {
|
|
53
|
+
width: width
|
|
54
|
+
},
|
|
55
|
+
isActive: isActive,
|
|
56
|
+
id: elementId,
|
|
57
|
+
borderRadius: borderRadius,
|
|
58
|
+
padding: padding,
|
|
59
|
+
onClick: handleClick
|
|
60
|
+
}, (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
|
+
};
|
|
62
|
+
|
|
63
|
+
export default Card;
|
|
64
|
+
//# 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,14 @@
|
|
|
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
|
+
padding?: number;
|
|
9
|
+
borderRadius?: number;
|
|
10
|
+
elementId?: string;
|
|
11
|
+
onClick?: (string: any) => string;
|
|
12
|
+
}
|
|
13
|
+
declare const Card: ({ children, title, action, label, isActive, width, padding, borderRadius, elementId, onClick, }: IProps) => JSX.Element;
|
|
14
|
+
export default Card;
|
package/dist/index.js
ADDED
package/dist/style.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface IProps {
|
|
2
|
+
isActive: boolean;
|
|
3
|
+
padding?: number;
|
|
4
|
+
borderRadius?: number;
|
|
5
|
+
style: {
|
|
6
|
+
width: number | string | undefined;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
declare const StyledCard: import("styled-components").StyledComponent<"div", any, IProps, never>;
|
|
10
|
+
declare const Header: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
11
|
+
declare const Title: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
12
|
+
declare const Label: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
13
|
+
declare const Action: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
14
|
+
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.0.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": "99cc04ab639c3957e82da4b01e15d7ee980bb311"
|
|
39
36
|
}
|
package/dist/index.esm.js
DELETED
|
@@ -1,120 +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 _templateObject6() {
|
|
19
|
-
var data = _taggedTemplateLiteral(["\n margin-top: ", "px;\n \n button + button{\n margin-left: ", "px;\n }\n"]);
|
|
20
|
-
|
|
21
|
-
_templateObject6 = function _templateObject6() {
|
|
22
|
-
return data;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
return data;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function _templateObject5() {
|
|
29
|
-
var data = _taggedTemplateLiteral(["\n flex: 1;\n align-items: flex-start;\n justify-content: flex-end;\n display: flex;\n"]);
|
|
30
|
-
|
|
31
|
-
_templateObject5 = function _templateObject5() {
|
|
32
|
-
return data;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
return data;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function _templateObject4() {
|
|
39
|
-
var data = _taggedTemplateLiteral(["\n flex: 1;\n font-size: ", "px;\n font-weight: bold;\n line-height: ", "px;\n color: ", ";\n"]);
|
|
40
|
-
|
|
41
|
-
_templateObject4 = function _templateObject4() {
|
|
42
|
-
return data;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
return data;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function _templateObject3() {
|
|
49
|
-
var data = _taggedTemplateLiteral(["\n display: flex;\n margin-bottom: ", "px; \n"]);
|
|
50
|
-
|
|
51
|
-
_templateObject3 = function _templateObject3() {
|
|
52
|
-
return data;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
return data;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function _templateObject2() {
|
|
59
|
-
var data = _taggedTemplateLiteral(["\n border-color: ", ";\n "]);
|
|
60
|
-
|
|
61
|
-
_templateObject2 = function _templateObject2() {
|
|
62
|
-
return data;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
return data;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function _templateObject() {
|
|
69
|
-
var data = _taggedTemplateLiteral(["\n height: 100%;\n border-radius: ", "px;\n border: solid 2px ", ";\n background-color: ", ";\n padding: ", "px;\n \n ", "\n"]);
|
|
70
|
-
|
|
71
|
-
_templateObject = function _templateObject() {
|
|
72
|
-
return data;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
return data;
|
|
76
|
-
}
|
|
77
|
-
var StyledCard = styled.div(_templateObject(), borderRadius, gray95, white, spacing * 6, function (props) {
|
|
78
|
-
return props.isActive && css(_templateObject2(), actionColor);
|
|
79
|
-
});
|
|
80
|
-
var Header = styled.div(_templateObject3(), spacing * 3);
|
|
81
|
-
var Title = styled.div(_templateObject4(), fontBig, lineHeight, black);
|
|
82
|
-
var Label = styled.div(_templateObject5());
|
|
83
|
-
var Action = styled.div(_templateObject6(), spacing * 4, spacing * 2);
|
|
84
|
-
|
|
85
|
-
var Card = function Card(_ref) {
|
|
86
|
-
var children = _ref.children,
|
|
87
|
-
title = _ref.title,
|
|
88
|
-
action = _ref.action,
|
|
89
|
-
label = _ref.label,
|
|
90
|
-
isActive = _ref.isActive,
|
|
91
|
-
width = _ref.width,
|
|
92
|
-
elementId = _ref.elementId;
|
|
93
|
-
return /*#__PURE__*/React.createElement(StyledCard, {
|
|
94
|
-
style: {
|
|
95
|
-
width: width
|
|
96
|
-
},
|
|
97
|
-
isActive: isActive,
|
|
98
|
-
id: elementId
|
|
99
|
-
}, (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));
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
Card.propTypes = {
|
|
103
|
-
title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
104
|
-
action: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
105
|
-
label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
106
|
-
children: PropTypes.oneOfType([PropTypes.string, PropTypes.element, PropTypes.node]).isRequired,
|
|
107
|
-
isActive: PropTypes.bool,
|
|
108
|
-
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
109
|
-
elementId: PropTypes.string
|
|
110
|
-
};
|
|
111
|
-
Card.defaultProps = {
|
|
112
|
-
isActive: false,
|
|
113
|
-
title: undefined,
|
|
114
|
-
action: undefined,
|
|
115
|
-
label: undefined,
|
|
116
|
-
width: undefined,
|
|
117
|
-
elementId: undefined
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
export default Card;
|
package/dist/index.esm.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"react";import n from"prop-types";import t,{css as r}from"styled-components";import{borderRadius as i,gray95 as o,white as l,spacing as u,actionColor as c,fontBig as d,lineHeight as f,black as a}from"@propellerads/stylevariables";function p(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}function s(){var e=p(["\n margin-top: ","px;\n \n button + button{\n margin-left: ","px;\n }\n"]);return s=function(){return e},e}function m(){var e=p(["\n flex: 1;\n align-items: flex-start;\n justify-content: flex-end;\n display: flex;\n"]);return m=function(){return e},e}function v(){var e=p(["\n flex: 1;\n font-size: ","px;\n font-weight: bold;\n line-height: ","px;\n color: ",";\n"]);return v=function(){return e},e}function b(){var e=p(["\n display: flex;\n margin-bottom: ","px; \n"]);return b=function(){return e},e}function g(){var e=p(["\n border-color: ",";\n "]);return g=function(){return e},e}function x(){var e=p(["\n height: 100%;\n border-radius: ","px;\n border: solid 2px ",";\n background-color: ",";\n padding: ","px;\n \n ","\n"]);return x=function(){return e},e}var y=t.div(x(),i,o,l,6*u,(function(e){return e.isActive&&r(g(),c)})),h=t.div(b(),3*u),O=t.div(v(),d,f,a),w=t.div(m()),E=t.div(s(),4*u,2*u),T=function(n){var t=n.children,r=n.title,i=n.action,o=n.label,l=n.isActive,u=n.width,c=n.elementId;return e.createElement(y,{style:{width:u},isActive:l,id:c},(r||o)&&e.createElement(h,null,r&&e.createElement(O,null,r),o&&e.createElement(w,null,o)),e.createElement("div",null,t),i&&e.createElement(E,null,i))};T.propTypes={title:n.oneOfType([n.string,n.element]),action:n.oneOfType([n.string,n.element]),label:n.oneOfType([n.string,n.element]),children:n.oneOfType([n.string,n.element,n.node]).isRequired,isActive:n.bool,width:n.oneOfType([n.number,n.string]),elementId:n.string},T.defaultProps={isActive:!1,title:void 0,action:void 0,label:void 0,width:void 0,elementId:void 0};export default T;
|