@propellerads/card 4.0.1 → 5.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/dist/index.d.ts +23 -20
- package/dist/index.js +79 -6
- package/dist/index.js.map +1 -0
- package/package.json +23 -17
- package/dist/card.cjs.development.js +0 -76
- package/dist/card.cjs.development.js.map +0 -1
- package/dist/card.cjs.production.min.js +0 -2
- package/dist/card.cjs.production.min.js.map +0 -1
- package/dist/card.esm.js +0 -69
- package/dist/card.esm.js.map +0 -1
- package/dist/style.d.ts +0 -20
package/dist/index.d.ts
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
onClick?: (string
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import { ReactNode, FC } from 'react';
|
|
2
|
+
import { CSSObject } from 'styled-components';
|
|
3
|
+
|
|
4
|
+
type CardCustomStyles = Pick<CSSObject, 'padding' | 'borderRadius' | 'width'> & {
|
|
5
|
+
bgColor?: CSSObject['backgroundColor'];
|
|
6
|
+
activeBgColor?: CSSObject['backgroundColor'];
|
|
7
|
+
};
|
|
8
|
+
type CardProps = {
|
|
9
|
+
title?: ReactNode;
|
|
10
|
+
action?: ReactNode;
|
|
11
|
+
label?: ReactNode;
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
isActive?: boolean;
|
|
14
|
+
elementId?: string;
|
|
15
|
+
className?: string;
|
|
16
|
+
customStyles?: CardCustomStyles;
|
|
17
|
+
onClick?: (elementId?: string) => void;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
declare const Card: FC<CardProps>;
|
|
21
|
+
|
|
22
|
+
export { Card as default };
|
|
23
|
+
export type { CardCustomStyles, CardProps };
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,81 @@
|
|
|
1
|
+
import { jsxs as n, jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import i, { css as o } from "styled-components";
|
|
3
|
+
import { borderRadius as m, gray95 as x, white as y, spacing as e, actionColor as f, fontBig as v, lineHeight as b, black as h } from "@propellerads/stylevariables";
|
|
4
|
+
const S = i.div`
|
|
5
|
+
height: 100%;
|
|
6
|
+
border-radius: ${m}px;
|
|
7
|
+
border: solid 2px ${x};
|
|
8
|
+
background-color: ${y};
|
|
9
|
+
padding: ${e * 6}px;
|
|
1
10
|
|
|
2
|
-
|
|
11
|
+
${(t) => t.$isActive && o`
|
|
12
|
+
border-color: ${f};
|
|
13
|
+
`}
|
|
3
14
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
15
|
+
${(t) => t.$customStyles.padding !== void 0 && o`
|
|
16
|
+
padding: ${t.$customStyles.padding}px;
|
|
17
|
+
`}
|
|
18
|
+
|
|
19
|
+
${(t) => t.$customStyles.width !== void 0 && o`
|
|
20
|
+
width: ${t.$customStyles.width};
|
|
21
|
+
`}
|
|
22
|
+
|
|
23
|
+
${(t) => t.$customStyles.borderRadius !== void 0 && o`
|
|
24
|
+
border-radius: ${t.$customStyles.borderRadius}px;
|
|
25
|
+
`}
|
|
26
|
+
|
|
27
|
+
${(t) => t.$customStyles.activeBgColor !== void 0 && t.$customStyles.bgColor !== void 0 && o`
|
|
28
|
+
background-color: ${t.$isActive ? t.$customStyles.activeBgColor : t.$customStyles.bgColor};
|
|
29
|
+
`}
|
|
30
|
+
`, p = i.div`
|
|
31
|
+
display: flex;
|
|
32
|
+
margin-bottom: ${e * 3}px;
|
|
33
|
+
`, C = i.div`
|
|
34
|
+
flex: 1;
|
|
35
|
+
font-size: ${v}px;
|
|
36
|
+
font-weight: bold;
|
|
37
|
+
line-height: ${b}px;
|
|
38
|
+
color: ${h};
|
|
39
|
+
`, w = i.div`
|
|
40
|
+
flex: 1;
|
|
41
|
+
align-items: flex-start;
|
|
42
|
+
justify-content: flex-end;
|
|
43
|
+
display: flex;
|
|
44
|
+
`, k = i.div`
|
|
45
|
+
margin-top: ${e * 4}px;
|
|
46
|
+
|
|
47
|
+
button + button {
|
|
48
|
+
margin-left: ${e * 2}px;
|
|
49
|
+
}
|
|
50
|
+
`, R = ({
|
|
51
|
+
children: t,
|
|
52
|
+
className: $,
|
|
53
|
+
title: s,
|
|
54
|
+
action: l,
|
|
55
|
+
label: r,
|
|
56
|
+
isActive: a = !1,
|
|
57
|
+
elementId: c,
|
|
58
|
+
customStyles: u = {},
|
|
59
|
+
onClick: g
|
|
60
|
+
}) => /* @__PURE__ */ n(
|
|
61
|
+
S,
|
|
62
|
+
{
|
|
63
|
+
className: $,
|
|
64
|
+
$isActive: a,
|
|
65
|
+
id: c,
|
|
66
|
+
$customStyles: u,
|
|
67
|
+
onClick: () => g?.(c),
|
|
68
|
+
children: [
|
|
69
|
+
(s || r) && /* @__PURE__ */ n(p, { children: [
|
|
70
|
+
s && /* @__PURE__ */ d(C, { children: s }),
|
|
71
|
+
r && /* @__PURE__ */ d(w, { children: r })
|
|
72
|
+
] }),
|
|
73
|
+
/* @__PURE__ */ d("div", { children: t }),
|
|
74
|
+
l && /* @__PURE__ */ d(k, { children: l })
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
export {
|
|
79
|
+
R as default
|
|
80
|
+
};
|
|
81
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/style.tsx","../src/index.tsx"],"sourcesContent":["import styled, {css} from 'styled-components';\nimport {\n black,\n borderRadius,\n fontBig,\n gray95,\n actionColor,\n lineHeight,\n spacing,\n white,\n} from '@propellerads/stylevariables';\nimport type {CardCustomStyles} from './types';\n\ntype StyledCardProps = {\n $isActive: boolean;\n $customStyles: CardCustomStyles;\n};\n\nconst StyledCard = styled.div<StyledCardProps>`\n height: 100%;\n border-radius: ${borderRadius}px;\n border: solid 2px ${gray95};\n background-color: ${white};\n padding: ${spacing * 6}px;\n\n ${(props) =>\n props.$isActive &&\n css`\n border-color: ${actionColor};\n `}\n\n ${(props) =>\n props.$customStyles.padding !== undefined &&\n css`\n padding: ${props.$customStyles.padding}px;\n `}\n\n ${(props) =>\n props.$customStyles.width !== undefined &&\n css`\n width: ${props.$customStyles.width};\n `}\n\n ${(props) =>\n props.$customStyles.borderRadius !== undefined &&\n css`\n border-radius: ${props.$customStyles.borderRadius}px;\n `}\n\n ${(props) =>\n props.$customStyles.activeBgColor !== undefined &&\n props.$customStyles.bgColor !== undefined &&\n css`\n background-color: ${props.$isActive ? props.$customStyles.activeBgColor : props.$customStyles.bgColor};\n `}\n`;\n\nconst Header = styled.div`\n display: flex;\n margin-bottom: ${spacing * 3}px;\n`;\n\nconst Title = styled.div`\n flex: 1;\n font-size: ${fontBig}px;\n font-weight: bold;\n line-height: ${lineHeight}px;\n color: ${black};\n`;\n\nconst Label = styled.div`\n flex: 1;\n align-items: flex-start;\n justify-content: flex-end;\n display: flex;\n`;\n\nconst Action = styled.div`\n margin-top: ${spacing * 4}px;\n\n button + button {\n margin-left: ${spacing * 2}px;\n }\n`;\n\nexport {StyledCard, Header, Title, Label, Action};\n","import type {FC} from 'react';\nimport {Action, Header, Label, StyledCard, Title} from './style';\nimport type {CardProps} from './types';\n\nconst Card: FC<CardProps> = ({\n children,\n className,\n title,\n action,\n label,\n isActive = false,\n elementId,\n customStyles = {},\n onClick,\n}) => {\n return (\n <StyledCard\n className={className}\n $isActive={isActive}\n id={elementId}\n $customStyles={customStyles}\n onClick={() => onClick?.(elementId)}\n >\n {(title || label) && (\n <Header>\n {title && <Title>{title}</Title>}\n {label && <Label>{label}</Label>}\n </Header>\n )}\n\n <div>{children}</div>\n {action && <Action>{action}</Action>}\n </StyledCard>\n );\n};\n\nexport default Card;\nexport type {CardCustomStyles, CardProps} from './types';\n"],"names":["StyledCard","styled","borderRadius","gray95","white","spacing","props","css","actionColor","Header","Title","fontBig","lineHeight","black","Label","Action","Card","children","className","title","action","label","isActive","elementId","customStyles","onClick","jsxs","jsx"],"mappings":";;;AAkBA,MAAMA,IAAaC,EAAO;AAAA;AAAA,mBAEPC,CAAY;AAAA,sBACTC,CAAM;AAAA,sBACNC,CAAK;AAAA,aACdC,IAAU,CAAC;AAAA;AAAA,IAEpB,CAACC,MACDA,EAAM,aACNC;AAAA,sBACkBC,CAAW;AAAA,KAC5B;AAAA;AAAA,IAED,CAACF,MACDA,EAAM,cAAc,YAAY,UAChCC;AAAA,iBACaD,EAAM,cAAc,OAAO;AAAA,KACvC;AAAA;AAAA,IAED,CAACA,MACDA,EAAM,cAAc,UAAU,UAC9BC;AAAA,eACWD,EAAM,cAAc,KAAK;AAAA,KACnC;AAAA;AAAA,IAED,CAACA,MACDA,EAAM,cAAc,iBAAiB,UACrCC;AAAA,uBACmBD,EAAM,cAAc,YAAY;AAAA,KAClD;AAAA;AAAA,IAED,CAACA,MACDA,EAAM,cAAc,kBAAkB,UACtCA,EAAM,cAAc,YAAY,UAChCC;AAAA,0BACsBD,EAAM,YAAYA,EAAM,cAAc,gBAAgBA,EAAM,cAAc,OAAO;AAAA,KACtG;AAAA,GAGCG,IAASR,EAAO;AAAA;AAAA,mBAEHI,IAAU,CAAC;AAAA,GAGxBK,IAAQT,EAAO;AAAA;AAAA,eAENU,CAAO;AAAA;AAAA,iBAELC,CAAU;AAAA,WAChBC,CAAK;AAAA,GAGVC,IAAQb,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA,GAOfc,IAASd,EAAO;AAAA,gBACNI,IAAU,CAAC;AAAA;AAAA;AAAA,mBAGRA,IAAU,CAAC;AAAA;AAAA,GC7ExBW,IAAsB,CAAC;AAAA,EAC3B,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,WAAAC;AAAA,EACA,cAAAC,IAAe,CAAA;AAAA,EACf,SAAAC;AACF,MAEI,gBAAAC;AAAA,EAAC1B;AAAA,EAAA;AAAA,IACC,WAAAkB;AAAA,IACA,WAAWI;AAAA,IACX,IAAIC;AAAA,IACJ,eAAeC;AAAA,IACf,SAAS,MAAMC,IAAUF,CAAS;AAAA,IAEhC,UAAA;AAAA,OAAAJ,KAASE,wBACRZ,GAAA,EACE,UAAA;AAAA,QAAAU,KAAS,gBAAAQ,EAACjB,KAAO,UAAAS,EAAA,CAAM;AAAA,QACvBE,KAAS,gBAAAM,EAACb,GAAA,EAAO,UAAAO,EAAA,CAAM;AAAA,MAAA,GAC1B;AAAA,MAGF,gBAAAM,EAAC,SAAK,UAAAV,GAAS;AAAA,MACdG,KAAU,gBAAAO,EAACZ,GAAA,EAAQ,UAAAK,EAAA,CAAO;AAAA,IAAA;AAAA,EAAA;AAAA;"}
|
package/package.json
CHANGED
|
@@ -1,35 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@propellerads/card",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
3
|
+
"version": "5.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"import": "./dist/index.js"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
7
12
|
"files": [
|
|
8
13
|
"dist"
|
|
9
14
|
],
|
|
10
15
|
"repository": "https://github.com/propellerads/ui-components.git",
|
|
11
16
|
"author": "i.pasyuk@propellerads.net",
|
|
12
17
|
"license": "MIT",
|
|
13
|
-
"private": false,
|
|
14
18
|
"bugs": {
|
|
15
19
|
"url": "https://github.com/propellerads/ui-components/issues"
|
|
16
20
|
},
|
|
17
|
-
"homepage": "https://github.com/propellerads/ui-components#readme",
|
|
18
21
|
"scripts": {
|
|
19
|
-
"
|
|
20
|
-
"start": "tsdx watch",
|
|
21
|
-
"build": "tsdx build"
|
|
22
|
+
"build": "tsc && vite build && rollup -c rollup.dts.config.mjs"
|
|
22
23
|
},
|
|
24
|
+
"homepage": "https://github.com/propellerads/ui-components#readme",
|
|
25
|
+
"private": false,
|
|
23
26
|
"dependencies": {
|
|
24
|
-
"@propellerads/stylevariables": "^2.0.
|
|
25
|
-
},
|
|
26
|
-
"devDependencies": {
|
|
27
|
-
"tsdx": "0.14.1",
|
|
28
|
-
"tslib": "2.6.2",
|
|
29
|
-
"typescript": "4.9.5"
|
|
27
|
+
"@propellerads/stylevariables": "^2.0.2"
|
|
30
28
|
},
|
|
31
29
|
"peerDependencies": {
|
|
32
|
-
"react": "
|
|
33
|
-
"styled-components": "5.1.1"
|
|
30
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
31
|
+
"styled-components": "^5.1.1 || ^6.0.0"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/react": "^19.2.14",
|
|
35
|
+
"@vitejs/plugin-react": "^5.1.4",
|
|
36
|
+
"rollup": "^4.58.0",
|
|
37
|
+
"rollup-plugin-dts": "^6.3.0",
|
|
38
|
+
"typescript": "^5.9.3",
|
|
39
|
+
"vite": "^7.3.1"
|
|
34
40
|
}
|
|
35
41
|
}
|
|
@@ -1,76 +0,0 @@
|
|
|
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(e, t) {
|
|
13
|
-
return t || (t = e.slice(0)), e.raw = t, e;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
|
|
17
|
-
var StyledCard = /*#__PURE__*/styled__default.div.attrs(function (props) {
|
|
18
|
-
return {
|
|
19
|
-
className: props.className
|
|
20
|
-
};
|
|
21
|
-
})(_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$className = _ref.className,
|
|
41
|
-
className = _ref$className === void 0 ? undefined : _ref$className,
|
|
42
|
-
_ref$title = _ref.title,
|
|
43
|
-
title = _ref$title === void 0 ? undefined : _ref$title,
|
|
44
|
-
_ref$action = _ref.action,
|
|
45
|
-
action = _ref$action === void 0 ? undefined : _ref$action,
|
|
46
|
-
_ref$label = _ref.label,
|
|
47
|
-
label = _ref$label === void 0 ? undefined : _ref$label,
|
|
48
|
-
_ref$isActive = _ref.isActive,
|
|
49
|
-
isActive = _ref$isActive === void 0 ? false : _ref$isActive,
|
|
50
|
-
_ref$width = _ref.width,
|
|
51
|
-
width = _ref$width === void 0 ? undefined : _ref$width,
|
|
52
|
-
_ref$elementId = _ref.elementId,
|
|
53
|
-
elementId = _ref$elementId === void 0 ? undefined : _ref$elementId,
|
|
54
|
-
_ref$customStyles = _ref.customStyles,
|
|
55
|
-
customStyles = _ref$customStyles === void 0 ? {} : _ref$customStyles,
|
|
56
|
-
_ref$onClick = _ref.onClick,
|
|
57
|
-
onClick = _ref$onClick === void 0 ? undefined : _ref$onClick;
|
|
58
|
-
var handleClick = function handleClick() {
|
|
59
|
-
if (onClick) {
|
|
60
|
-
onClick(elementId);
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
return React.createElement(StyledCard, {
|
|
64
|
-
className: className,
|
|
65
|
-
style: {
|
|
66
|
-
width: width
|
|
67
|
-
},
|
|
68
|
-
isActive: isActive,
|
|
69
|
-
id: elementId,
|
|
70
|
-
customStyles: customStyles,
|
|
71
|
-
onClick: handleClick
|
|
72
|
-
}, (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));
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
exports.default = Card;
|
|
76
|
-
//# sourceMappingURL=card.cjs.development.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"card.cjs.development.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +0,0 @@
|
|
|
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
|
-
//# sourceMappingURL=card.cjs.production.min.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"card.cjs.production.min.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/card.esm.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
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(e, t) {
|
|
6
|
-
return t || (t = e.slice(0)), e.raw = t, e;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
|
|
10
|
-
var StyledCard = /*#__PURE__*/styled.div.attrs(function (props) {
|
|
11
|
-
return {
|
|
12
|
-
className: props.className
|
|
13
|
-
};
|
|
14
|
-
})(_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$className = _ref.className,
|
|
34
|
-
className = _ref$className === void 0 ? undefined : _ref$className,
|
|
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$elementId = _ref.elementId,
|
|
46
|
-
elementId = _ref$elementId === void 0 ? undefined : _ref$elementId,
|
|
47
|
-
_ref$customStyles = _ref.customStyles,
|
|
48
|
-
customStyles = _ref$customStyles === void 0 ? {} : _ref$customStyles,
|
|
49
|
-
_ref$onClick = _ref.onClick,
|
|
50
|
-
onClick = _ref$onClick === void 0 ? undefined : _ref$onClick;
|
|
51
|
-
var handleClick = function handleClick() {
|
|
52
|
-
if (onClick) {
|
|
53
|
-
onClick(elementId);
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
return React.createElement(StyledCard, {
|
|
57
|
-
className: className,
|
|
58
|
-
style: {
|
|
59
|
-
width: width
|
|
60
|
-
},
|
|
61
|
-
isActive: isActive,
|
|
62
|
-
id: elementId,
|
|
63
|
-
customStyles: customStyles,
|
|
64
|
-
onClick: handleClick
|
|
65
|
-
}, (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));
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export default Card;
|
|
69
|
-
//# sourceMappingURL=card.esm.js.map
|
package/dist/card.esm.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"card.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/style.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
interface IProps {
|
|
2
|
-
isActive: boolean;
|
|
3
|
-
padding?: number;
|
|
4
|
-
borderRadius?: number;
|
|
5
|
-
className?: string;
|
|
6
|
-
customStyles?: {
|
|
7
|
-
padding?: number;
|
|
8
|
-
borderRadius?: number;
|
|
9
|
-
bgColor?: string;
|
|
10
|
-
activeBgColor?: string;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
declare const StyledCard: import("styled-components").StyledComponent<"div", any, {
|
|
14
|
-
className: string | undefined;
|
|
15
|
-
} & IProps, "className">;
|
|
16
|
-
declare const Header: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
17
|
-
declare const Title: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
18
|
-
declare const Label: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
19
|
-
declare const Action: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
20
|
-
export { StyledCard, Header, Title, Label, Action };
|