@propellerads/card 4.0.2 → 5.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/README.md +1 -1
- package/dist/index.css +1 -0
- package/dist/index.d.ts +29 -20
- package/dist/index.js +39 -7
- package/dist/index.js.map +1 -0
- package/package.json +33 -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/README.md
CHANGED
package/dist/index.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.card{height:100%;padding:var(--card-padding,var(--space-24,24px));border:solid 2px var(--color-formal,#f2f2f2);border-radius:var(--card-radius,var(--radius-8,8px));background-color:var(--color-light-inversion,#fff)}.card--active{border-color:var(--color-action,#0080ff)}.card--custom-width{width:var(--card-width)}.card--custom-bg{background-color:var(--card-bg)}.card__header{margin-bottom:var(--space-12,12px);display:flex}.card__title{color:var(--color-dark-inversion,#000);flex:1;font-size:18px;font-weight:700;line-height:36px}.card__label{flex:1;justify-content:flex-end;align-items:flex-start;display:flex}.card__action{margin-top:var(--space-16,16px)}.card__action button+button{margin-left:var(--space-8,8px)}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,20 +1,29 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
width?:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import { ReactNode, FC } from 'react';
|
|
2
|
+
|
|
3
|
+
/** A length: a number is pixels, a string is used as is (`'50%'`, `'1rem'`). */
|
|
4
|
+
type CardLength = number | string;
|
|
5
|
+
type CardCustomStyles = {
|
|
6
|
+
padding?: CardLength;
|
|
7
|
+
borderRadius?: CardLength;
|
|
8
|
+
width?: CardLength;
|
|
9
|
+
/** The background; applied when `activeBgColor` is given too. */
|
|
10
|
+
bgColor?: string;
|
|
11
|
+
/** The background of an active card; applied when `bgColor` is given too. */
|
|
12
|
+
activeBgColor?: string;
|
|
13
|
+
};
|
|
14
|
+
type CardProps = {
|
|
15
|
+
title?: ReactNode;
|
|
16
|
+
action?: ReactNode;
|
|
17
|
+
label?: ReactNode;
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
isActive?: boolean;
|
|
20
|
+
elementId?: string;
|
|
21
|
+
className?: string;
|
|
22
|
+
customStyles?: CardCustomStyles;
|
|
23
|
+
onClick?: (elementId?: string) => void;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
declare const Card: FC<CardProps>;
|
|
27
|
+
|
|
28
|
+
export { Card as default };
|
|
29
|
+
export type { CardCustomStyles, CardProps };
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,40 @@
|
|
|
1
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import './index.css';// src/index.tsx
|
|
3
|
+
var n = (e) => typeof e == "number" ? `${e}px` : e, r = ({ padding: e, borderRadius: t, width: r, bgColor: i, activeBgColor: a }, o) => {
|
|
4
|
+
let s = {};
|
|
5
|
+
return e !== void 0 && (s["--card-padding"] = n(e)), t !== void 0 && (s["--card-radius"] = n(t)), r !== void 0 && (s["--card-width"] = n(r)), i !== void 0 && a !== void 0 && (s["--card-bg"] = o ? a : i), s;
|
|
6
|
+
}, i = ({ children: n, className: i, title: a, action: o, label: s, isActive: c = !1, elementId: l, customStyles: u = {}, onClick: d }) => {
|
|
7
|
+
let f = r(u, c), p = [
|
|
8
|
+
"card",
|
|
9
|
+
c && "card--active",
|
|
10
|
+
f["--card-width"] !== void 0 && "card--custom-width",
|
|
11
|
+
f["--card-bg"] !== void 0 && "card--custom-bg",
|
|
12
|
+
i
|
|
13
|
+
].filter(Boolean).join(" ");
|
|
14
|
+
return /* @__PURE__ */ t("div", {
|
|
15
|
+
className: p,
|
|
16
|
+
id: l,
|
|
17
|
+
style: f,
|
|
18
|
+
onClick: () => d?.(l),
|
|
19
|
+
children: [
|
|
20
|
+
(a || s) && /* @__PURE__ */ t("div", {
|
|
21
|
+
className: "card__header",
|
|
22
|
+
children: [a && /* @__PURE__ */ e("div", {
|
|
23
|
+
className: "card__title",
|
|
24
|
+
children: a
|
|
25
|
+
}), s && /* @__PURE__ */ e("div", {
|
|
26
|
+
className: "card__label",
|
|
27
|
+
children: s
|
|
28
|
+
})]
|
|
29
|
+
}),
|
|
30
|
+
/* @__PURE__ */ e("div", { children: n }),
|
|
31
|
+
o && /* @__PURE__ */ e("div", {
|
|
32
|
+
className: "card__action",
|
|
33
|
+
children: o
|
|
34
|
+
})
|
|
35
|
+
]
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
export { i as default };
|
|
1
39
|
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
if (process.env.NODE_ENV === 'production') {
|
|
5
|
-
module.exports = require('./card.cjs.production.min.js')
|
|
6
|
-
} else {
|
|
7
|
-
module.exports = require('./card.cjs.development.js')
|
|
8
|
-
}
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["toLength","value","getCardStyle","style","padding","borderRadius","width","bgColor","activeBgColor","isActive","Card","customStyles","classes","className","elementId","onClick","title","label","action"],"sources":["../src/index.tsx"],"sourcesContent":["import type {CSSProperties, FC} from 'react';\nimport './card.css';\nimport type {CardCustomStyles, CardProps} from './types';\n\nconst toLength = (value: number | string) => (typeof value === 'number' ? `${value}px` : value);\n\ntype CardStyle = CSSProperties & Record<`--card-${string}`, string>;\n\n/** `customStyles` as the custom properties card.css reads. */\nconst getCardStyle = ({padding, borderRadius, width, bgColor, activeBgColor}: CardCustomStyles, isActive: boolean) => {\n const style: CardStyle = {};\n\n if (padding !== undefined) {\n style['--card-padding'] = toLength(padding);\n }\n\n if (borderRadius !== undefined) {\n style['--card-radius'] = toLength(borderRadius);\n }\n\n if (width !== undefined) {\n style['--card-width'] = toLength(width);\n }\n\n // Both or neither, as before: a single colour leaves the card white\n if (bgColor !== undefined && activeBgColor !== undefined) {\n style['--card-bg'] = isActive ? activeBgColor : bgColor;\n }\n\n return style;\n};\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 const style = getCardStyle(customStyles, isActive);\n const classes = [\n 'card',\n isActive && 'card--active',\n style['--card-width'] !== undefined && 'card--custom-width',\n style['--card-bg'] !== undefined && 'card--custom-bg',\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n // biome-ignore lint/a11y/useKeyWithClickEvents: a clickable card without a keyboard path is the behaviour of 5.x, out of scope of moving off styled-components\n <div className={classes} id={elementId} style={style} onClick={() => onClick?.(elementId)}>\n {(title || label) && (\n <div className=\"card__header\">\n {title && <div className=\"card__title\">{title}</div>}\n {label && <div className=\"card__label\">{label}</div>}\n </div>\n )}\n\n <div>{children}</div>\n {action && <div className=\"card__action\">{action}</div>}\n </div>\n );\n};\n\nexport default Card;\nexport type {CardCustomStyles, CardProps} from './types';\n"],"mappings":";;AAIA,IAAMA,KAAY,MAA4B,OAAOC,KAAU,WAAW,GAAGA,EAAM,MAAMA,GAKnFC,KAAgB,EAAC,YAAS,iBAAc,UAAO,YAAS,oBAAkC,MAAsB;CACpH,IAAMC,IAAmB,CAAC;CAmB1B,OAjBIC,MAAY,KAAA,MACd,EAAM,oBAAoBJ,EAASI,CAAO,IAGxCC,MAAiB,KAAA,MACnB,EAAM,mBAAmBL,EAASK,CAAY,IAG5CC,MAAU,KAAA,MACZ,EAAM,kBAAkBN,EAASM,CAAK,IAIpCC,MAAY,KAAA,KAAaC,MAAkB,KAAA,MAC7C,EAAM,eAAeC,IAAWD,IAAgBD,IAG3CJ;AACT,GAEMO,KAAuB,EAC3B,aACA,cACA,UACA,WACA,UACA,cAAW,IACX,cACA,kBAAe,CAAC,GAChB,iBACI;CACJ,IAAMP,IAAQD,EAAaS,GAAcF,CAAQ,GAC3CG,IAAU;EACd;EACAH,KAAY;EACZN,EAAM,oBAAoB,KAAA,KAAa;EACvCA,EAAM,iBAAiB,KAAA,KAAa;EACpCU;CACF,CAAC,CACE,OAAO,OAAO,CAAC,CACf,KAAK,GAAG;CAEX,OAEE,kBAAC,OAAD;EAAK,WAAWD;EAAS,IAAIE;EAAkB;EAAO,eAAeC,IAAUD,CAAS;EAAxF,UAAA;IACIE,KAASC,MACT,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACGD,KAAS,kBAAC,OAAD;KAAK,WAAU;KAAe,UAAAA;IAAW,CAAA,GAClDC,KAAS,kBAAC,OAAD;KAAK,WAAU;KAAe,UAAAA;IAAW,CAAA,CAChD;;GAGP,kBAAC,OAAD,EAAM,YAAc,CAAA;GACnBC,KAAU,kBAAC,OAAD;IAAK,WAAU;IAAgB,UAAAA;GAAY,CAAA;EACnD;;AAET"}
|
package/package.json
CHANGED
|
@@ -1,34 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@propellerads/card",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
3
|
+
"version": "5.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"style": "dist/index.css",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./index.css": "./dist/index.css"
|
|
13
|
+
},
|
|
14
|
+
"sideEffects": [
|
|
15
|
+
"**/*.css"
|
|
16
|
+
],
|
|
7
17
|
"files": [
|
|
8
18
|
"dist"
|
|
9
19
|
],
|
|
10
20
|
"repository": "https://github.com/propellerads/ui-components.git",
|
|
11
21
|
"author": "i.pasyuk@propellerads.net",
|
|
12
22
|
"license": "MIT",
|
|
13
|
-
"private": false,
|
|
14
23
|
"bugs": {
|
|
15
24
|
"url": "https://github.com/propellerads/ui-components/issues"
|
|
16
25
|
},
|
|
17
|
-
"homepage": "https://github.com/propellerads/ui-components#readme",
|
|
18
26
|
"scripts": {
|
|
19
|
-
"
|
|
20
|
-
|
|
27
|
+
"build": "tsc && vite build && rollup -c rollup.dts.config.mjs"
|
|
28
|
+
},
|
|
29
|
+
"homepage": "https://github.com/propellerads/ui-components#readme",
|
|
30
|
+
"private": false,
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"@propellerads/tokens": ">=0.4.0",
|
|
33
|
+
"react": "^18.0.0 || ^19.0.0"
|
|
21
34
|
},
|
|
22
|
-
"
|
|
23
|
-
"@propellerads/
|
|
35
|
+
"peerDependenciesMeta": {
|
|
36
|
+
"@propellerads/tokens": {
|
|
37
|
+
"optional": true
|
|
38
|
+
}
|
|
24
39
|
},
|
|
25
40
|
"devDependencies": {
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
"
|
|
41
|
+
"@propellerads/tokens": "workspace:^",
|
|
42
|
+
"@types/react": "^19.2.14",
|
|
43
|
+
"@vitejs/plugin-react": "^6.0.1",
|
|
44
|
+
"rollup": "^4.60.3",
|
|
45
|
+
"rollup-plugin-dts": "^6.4.1",
|
|
46
|
+
"typescript": "^6.0.3",
|
|
47
|
+
"vite": "^8.0.11",
|
|
48
|
+
"vite-plugin-lib-inject-css": "^2.2.2"
|
|
33
49
|
}
|
|
34
50
|
}
|
|
@@ -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 };
|