@semcore/card 2.5.0 → 3.0.2
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 +16 -0
- package/lib/cjs/Card.js +53 -26
- package/lib/cjs/Card.js.map +1 -1
- package/lib/cjs/style/card.shadow.css +16 -1
- package/lib/es6/Card.js +54 -25
- package/lib/es6/Card.js.map +1 -1
- package/lib/es6/style/card.shadow.css +16 -1
- package/lib/types/index.d.ts +3 -1
- package/package.json +6 -1
- package/src/Card.js +33 -4
- package/src/index.d.ts +3 -1
- package/src/style/card.shadow.css +16 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
|
5
|
+
## [3.0.1] - 2022-02-24
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Added repository field to package.json file.
|
|
10
|
+
|
|
11
|
+
## [3.0.0] - 2022-02-18
|
|
12
|
+
|
|
13
|
+
### BREAK
|
|
14
|
+
|
|
15
|
+
- `Card` was divided into Header and Body
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- Background was added
|
|
20
|
+
|
|
5
21
|
## [2.5.0] - 2021-02-18
|
|
6
22
|
|
|
7
23
|
### Fixed
|
package/lib/cjs/Card.js
CHANGED
|
@@ -33,6 +33,8 @@ var _tooltip = _interopRequireDefault(require("@semcore/tooltip"));
|
|
|
33
33
|
|
|
34
34
|
var _m = _interopRequireDefault(require("@semcore/icon/Info/m"));
|
|
35
35
|
|
|
36
|
+
var _findComponent = require("@semcore/utils/lib/findComponent");
|
|
37
|
+
|
|
36
38
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
37
39
|
|
|
38
40
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -50,72 +52,97 @@ var style = (
|
|
|
50
52
|
/*__reshadow_css_start__*/
|
|
51
53
|
_core.sstyled.insert(
|
|
52
54
|
/*__inner_css_start__*/
|
|
53
|
-
".
|
|
55
|
+
".___SCard_1g2jr_gg_{border:1px solid #cccccc;border-radius:2px;box-sizing:border-box;background:#fff}.___STitle_1g2jr_gg_{font-size:19px;font-weight:500}.___SIcon_1g2jr_gg_{margin-left:4px;color:#a6b0b3;cursor:help}.___SDescription_1g2jr_gg_{margin-bottom:12px;font-size:14px;color:#757575}.___SHeader_1g2jr_gg_{padding-bottom:0;padding-left:24px;padding-right:24px;padding-top:20px}.___SBody_1g2jr_gg_{padding-bottom:24px;padding-left:24px;padding-right:24px;padding-top:20px}"
|
|
54
56
|
/*__inner_css_end__*/
|
|
55
|
-
, "
|
|
57
|
+
, "11udogg_gg_")
|
|
56
58
|
/*__reshadow_css_end__*/
|
|
57
59
|
, {
|
|
58
|
-
"__SCard": "
|
|
59
|
-
"__STitle": "
|
|
60
|
-
"__SIcon": "
|
|
61
|
-
"__SDescription": "
|
|
60
|
+
"__SCard": "___SCard_1g2jr_gg_",
|
|
61
|
+
"__STitle": "___STitle_1g2jr_gg_",
|
|
62
|
+
"__SIcon": "___SIcon_1g2jr_gg_",
|
|
63
|
+
"__SDescription": "___SDescription_1g2jr_gg_",
|
|
64
|
+
"__SHeader": "___SHeader_1g2jr_gg_",
|
|
65
|
+
"__SBody": "___SBody_1g2jr_gg_"
|
|
62
66
|
});
|
|
63
67
|
|
|
64
|
-
var
|
|
65
|
-
(0, _inherits2["default"])(
|
|
68
|
+
var CardRoot = /*#__PURE__*/function (_Component) {
|
|
69
|
+
(0, _inherits2["default"])(CardRoot, _Component);
|
|
66
70
|
|
|
67
|
-
var _super = _createSuper(
|
|
71
|
+
var _super = _createSuper(CardRoot);
|
|
68
72
|
|
|
69
|
-
function
|
|
70
|
-
(0, _classCallCheck2["default"])(this,
|
|
73
|
+
function CardRoot() {
|
|
74
|
+
(0, _classCallCheck2["default"])(this, CardRoot);
|
|
71
75
|
return _super.apply(this, arguments);
|
|
72
76
|
}
|
|
73
77
|
|
|
74
|
-
(0, _createClass2["default"])(
|
|
78
|
+
(0, _createClass2["default"])(CardRoot, [{
|
|
75
79
|
key: "render",
|
|
76
80
|
value: function render() {
|
|
77
81
|
var _ref = this ? this.asProps : arguments[0],
|
|
78
|
-
|
|
82
|
+
_ref6;
|
|
79
83
|
|
|
80
84
|
var SCard = _flexBox.Box;
|
|
81
|
-
var
|
|
82
|
-
|
|
85
|
+
var _this$asProps = this.asProps,
|
|
86
|
+
Children = _this$asProps.Children,
|
|
87
|
+
styles = _this$asProps.styles;
|
|
88
|
+
var advanceMode = (0, _findComponent.isAdvanceMode)(Children, [Card.Header.displayName, Card.Body.displayName]);
|
|
89
|
+
return _ref6 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SCard, _ref6.cn("SCard", _objectSpread({}, (0, _core.assignProps)({}, _ref))), advanceMode ? /*#__PURE__*/_react["default"].createElement(Children, _ref6.cn("Children", {})) : /*#__PURE__*/_react["default"].createElement(Card.Body, null, /*#__PURE__*/_react["default"].createElement(Children, _ref6.cn("Children", {}))));
|
|
83
90
|
}
|
|
84
91
|
}]);
|
|
85
|
-
return
|
|
92
|
+
return CardRoot;
|
|
86
93
|
}(_core.Component);
|
|
87
94
|
|
|
88
|
-
(0, _defineProperty2["default"])(
|
|
89
|
-
(0, _defineProperty2["default"])(
|
|
95
|
+
(0, _defineProperty2["default"])(CardRoot, "displayName", 'Card');
|
|
96
|
+
(0, _defineProperty2["default"])(CardRoot, "style", style);
|
|
90
97
|
|
|
91
98
|
function Title(props) {
|
|
92
99
|
var _ref2 = this ? this.asProps : arguments[0],
|
|
93
|
-
|
|
100
|
+
_ref7;
|
|
94
101
|
|
|
95
102
|
var styles = props.styles,
|
|
96
103
|
hint = props.hint;
|
|
97
104
|
var STitle = _typography.Text;
|
|
98
105
|
var SIcon = _m["default"];
|
|
99
|
-
return
|
|
106
|
+
return _ref7 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(STitle, _ref7.cn("STitle", _objectSpread({}, (0, _core.assignProps)({}, _ref2)))), hint && /*#__PURE__*/_react["default"].createElement(_tooltip["default"], _ref7.cn("Tooltip", {
|
|
100
107
|
"title": hint
|
|
101
|
-
}), /*#__PURE__*/_react["default"].createElement(SIcon,
|
|
108
|
+
}), /*#__PURE__*/_react["default"].createElement(SIcon, _ref7.cn("SIcon", {}))));
|
|
102
109
|
}
|
|
103
110
|
|
|
104
111
|
function Description(props) {
|
|
105
112
|
var _ref3 = this ? this.asProps : arguments[0],
|
|
106
|
-
|
|
113
|
+
_ref8;
|
|
107
114
|
|
|
108
115
|
var styles = props.styles;
|
|
109
116
|
var SDescription = _typography.Text;
|
|
110
|
-
return
|
|
117
|
+
return _ref8 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SDescription, _ref8.cn("SDescription", _objectSpread({}, (0, _core.assignProps)({
|
|
111
118
|
"tag": "p"
|
|
112
119
|
}, _ref3))));
|
|
113
120
|
}
|
|
114
121
|
|
|
115
|
-
|
|
122
|
+
function Header(props) {
|
|
123
|
+
var _ref4 = this ? this.asProps : arguments[0],
|
|
124
|
+
_ref9;
|
|
125
|
+
|
|
126
|
+
var styles = props.styles;
|
|
127
|
+
var SHeader = _flexBox.Box;
|
|
128
|
+
return _ref9 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SHeader, _ref9.cn("SHeader", _objectSpread({}, (0, _core.assignProps)(_objectSpread({}, props), _ref4))));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function Body(props) {
|
|
132
|
+
var _ref5 = this ? this.asProps : arguments[0],
|
|
133
|
+
_ref10;
|
|
134
|
+
|
|
135
|
+
var styles = props.styles;
|
|
136
|
+
var SBody = _flexBox.Box;
|
|
137
|
+
return _ref10 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SBody, _ref10.cn("SBody", _objectSpread({}, (0, _core.assignProps)(_objectSpread({}, props), _ref5))));
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
var Card = (0, _core["default"])(CardRoot, {
|
|
116
141
|
Title: Title,
|
|
117
|
-
Description: Description
|
|
142
|
+
Description: Description,
|
|
143
|
+
Header: Header,
|
|
144
|
+
Body: Body
|
|
118
145
|
});
|
|
119
|
-
|
|
146
|
+
var _default = Card;
|
|
120
147
|
exports["default"] = _default;
|
|
121
148
|
//# sourceMappingURL=Card.js.map
|
package/lib/cjs/Card.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Card.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["../../src/Card.js"],"names":["CardRoot","SCard","Box","asProps","Children","styles","advanceMode","Card","Header","displayName","Body","Component","style","Title","props","hint","STitle","Text","SIcon","Info","Description","SDescription","SHeader","SBody"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;;AADA;;AAEA;;AACA;;AACA;;AACA;;AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;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AAR,GAAmBS,KAAnB,CAAQT,MAAR;AACA,MAAMiB,OAAO,GAC2BpB,YADxC;AACA,iBAAO,mBAAQG,MAAR,CAAP,eAAuB,gCAAC,OAAD,iFAA0BS,KAA1B,YAAvB;AACD;;AAED,SAASJ,IAAT,CAAcI,KAAd,EAAqB;AAAA;AAAA;;AACnB,MAAQT,MAAR,GAAmBS,KAAnB,CAAQT,MAAR;AACA,MAAMkB,KAAK,GAC2BrB,YADtC;AACA,kBAAO,mBAAQG,MAAR,CAAP,eAAuB,gCAAC,KAAD,gFAAwBS,KAAxB,YAAvB;AACD;;AAED,IAAMP,IAAI,GAAG,sBAAgBP,QAAhB,EAA0B;AACrCa,EAAAA,KAAK,EAALA,KADqC;AAErCO,EAAAA,WAAW,EAAXA,WAFqC;AAGrCZ,EAAAA,MAAM,EAANA,MAHqC;AAIrCE,EAAAA,IAAI,EAAJA;AAJqC,CAA1B,CAAb;eAOeH,I","sourcesContent":["import React from 'react';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport { Box } from '@semcore/flex-box';\nimport { Text } from '@semcore/typography';\nimport Tooltip from '@semcore/tooltip';\nimport Info from '@semcore/icon/Info/m';\n\nimport style from './style/card.shadow.css';\nimport { isAdvanceMode } from '@semcore/utils/lib/findComponent';\n\nclass CardRoot extends Component {\n static displayName = 'Card';\n\n static style = style;\n\n render() {\n const SCard = Root;\n const { Children, styles } = this.asProps;\n\n const advanceMode = isAdvanceMode(Children, [Card.Header.displayName, Card.Body.displayName]);\n\n return sstyled(styles)(\n <SCard render={Box}>\n {advanceMode ? (\n <Children />\n ) : (\n <Card.Body>\n <Children />\n </Card.Body>\n )}\n </SCard>,\n );\n }\n}\n\nfunction Title(props) {\n const { styles, hint } = props;\n const STitle = Root;\n const SIcon = Info;\n return sstyled(styles)(\n <>\n <STitle render={Text} />\n {hint && (\n <Tooltip title={hint}>\n <SIcon />\n </Tooltip>\n )}\n </>,\n );\n}\n\nfunction Description(props) {\n const { styles } = props;\n const SDescription = Root;\n return sstyled(styles)(<SDescription render={Text} tag=\"p\" />);\n}\n\nfunction Header(props) {\n const { styles } = props;\n const SHeader = Root;\n return sstyled(styles)(<SHeader render={Box} {...props} />);\n}\n\nfunction Body(props) {\n const { styles } = props;\n const SBody = Root;\n return sstyled(styles)(<SBody render={Box} {...props} />);\n}\n\nconst Card = createComponent(CardRoot, {\n Title,\n Description,\n Header,\n Body,\n});\n\nexport default Card;\n"],"file":"Card.js"}
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
SCard {
|
|
4
4
|
border: 1px solid var(--gray80);
|
|
5
5
|
border-radius: 2px;
|
|
6
|
-
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
background: var(--white);
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
STitle {
|
|
@@ -22,3 +23,17 @@ SDescription {
|
|
|
22
23
|
font-size: var(--fs-200);
|
|
23
24
|
color: var(--gray60);
|
|
24
25
|
}
|
|
26
|
+
|
|
27
|
+
SHeader {
|
|
28
|
+
padding-bottom: 0;
|
|
29
|
+
padding-left: 24px;
|
|
30
|
+
padding-right: 24px;
|
|
31
|
+
padding-top: 20px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
SBody {
|
|
35
|
+
padding-bottom: 24px;
|
|
36
|
+
padding-left: 24px;
|
|
37
|
+
padding-right: 24px;
|
|
38
|
+
padding-top: 20px;
|
|
39
|
+
}
|
package/lib/es6/Card.js
CHANGED
|
@@ -5,6 +5,8 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
5
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
6
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
7
7
|
import { sstyled as _sstyled } from "@semcore/core";
|
|
8
|
+
import { assignProps as _assignProps5 } from "@semcore/core";
|
|
9
|
+
import { assignProps as _assignProps4 } from "@semcore/core";
|
|
8
10
|
import { assignProps as _assignProps3 } from "@semcore/core";
|
|
9
11
|
import { assignProps as _assignProps2 } from "@semcore/core";
|
|
10
12
|
import { assignProps as _assignProps } from "@semcore/core";
|
|
@@ -29,73 +31,100 @@ var style = (
|
|
|
29
31
|
/*__reshadow_css_start__*/
|
|
30
32
|
_sstyled.insert(
|
|
31
33
|
/*__inner_css_start__*/
|
|
32
|
-
".
|
|
34
|
+
".___SCard_1g2jr_gg_{border:1px solid #cccccc;border-radius:2px;box-sizing:border-box;background:#fff}.___STitle_1g2jr_gg_{font-size:19px;font-weight:500}.___SIcon_1g2jr_gg_{margin-left:4px;color:#a6b0b3;cursor:help}.___SDescription_1g2jr_gg_{margin-bottom:12px;font-size:14px;color:#757575}.___SHeader_1g2jr_gg_{padding-bottom:0;padding-left:24px;padding-right:24px;padding-top:20px}.___SBody_1g2jr_gg_{padding-bottom:24px;padding-left:24px;padding-right:24px;padding-top:20px}"
|
|
33
35
|
/*__inner_css_end__*/
|
|
34
|
-
, "
|
|
36
|
+
, "11udogg_gg_")
|
|
35
37
|
/*__reshadow_css_end__*/
|
|
36
38
|
, {
|
|
37
|
-
"__SCard": "
|
|
38
|
-
"__STitle": "
|
|
39
|
-
"__SIcon": "
|
|
40
|
-
"__SDescription": "
|
|
39
|
+
"__SCard": "___SCard_1g2jr_gg_",
|
|
40
|
+
"__STitle": "___STitle_1g2jr_gg_",
|
|
41
|
+
"__SIcon": "___SIcon_1g2jr_gg_",
|
|
42
|
+
"__SDescription": "___SDescription_1g2jr_gg_",
|
|
43
|
+
"__SHeader": "___SHeader_1g2jr_gg_",
|
|
44
|
+
"__SBody": "___SBody_1g2jr_gg_"
|
|
41
45
|
});
|
|
46
|
+
import { isAdvanceMode } from '@semcore/utils/lib/findComponent';
|
|
42
47
|
|
|
43
|
-
var
|
|
44
|
-
_inherits(
|
|
48
|
+
var CardRoot = /*#__PURE__*/function (_Component) {
|
|
49
|
+
_inherits(CardRoot, _Component);
|
|
45
50
|
|
|
46
|
-
var _super = _createSuper(
|
|
51
|
+
var _super = _createSuper(CardRoot);
|
|
47
52
|
|
|
48
|
-
function
|
|
49
|
-
_classCallCheck(this,
|
|
53
|
+
function CardRoot() {
|
|
54
|
+
_classCallCheck(this, CardRoot);
|
|
50
55
|
|
|
51
56
|
return _super.apply(this, arguments);
|
|
52
57
|
}
|
|
53
58
|
|
|
54
|
-
_createClass(
|
|
59
|
+
_createClass(CardRoot, [{
|
|
55
60
|
key: "render",
|
|
56
61
|
value: function render() {
|
|
57
62
|
var _ref = this ? this.asProps : arguments[0],
|
|
58
|
-
|
|
63
|
+
_ref6;
|
|
59
64
|
|
|
60
65
|
var SCard = Box;
|
|
61
|
-
var
|
|
62
|
-
|
|
66
|
+
var _this$asProps = this.asProps,
|
|
67
|
+
Children = _this$asProps.Children,
|
|
68
|
+
styles = _this$asProps.styles;
|
|
69
|
+
var advanceMode = isAdvanceMode(Children, [Card.Header.displayName, Card.Body.displayName]);
|
|
70
|
+
return _ref6 = sstyled(styles), /*#__PURE__*/React.createElement(SCard, _ref6.cn("SCard", _objectSpread({}, _assignProps({}, _ref))), advanceMode ? /*#__PURE__*/React.createElement(Children, _ref6.cn("Children", {})) : /*#__PURE__*/React.createElement(Card.Body, null, /*#__PURE__*/React.createElement(Children, _ref6.cn("Children", {}))));
|
|
63
71
|
}
|
|
64
72
|
}]);
|
|
65
73
|
|
|
66
|
-
return
|
|
74
|
+
return CardRoot;
|
|
67
75
|
}(Component);
|
|
68
76
|
|
|
69
|
-
_defineProperty(
|
|
77
|
+
_defineProperty(CardRoot, "displayName", 'Card');
|
|
70
78
|
|
|
71
|
-
_defineProperty(
|
|
79
|
+
_defineProperty(CardRoot, "style", style);
|
|
72
80
|
|
|
73
81
|
function Title(props) {
|
|
74
82
|
var _ref2 = this ? this.asProps : arguments[0],
|
|
75
|
-
|
|
83
|
+
_ref7;
|
|
76
84
|
|
|
77
85
|
var styles = props.styles,
|
|
78
86
|
hint = props.hint;
|
|
79
87
|
var STitle = Text;
|
|
80
88
|
var SIcon = Info;
|
|
81
|
-
return
|
|
89
|
+
return _ref7 = sstyled(styles), /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(STitle, _ref7.cn("STitle", _objectSpread({}, _assignProps2({}, _ref2)))), hint && /*#__PURE__*/React.createElement(Tooltip, _ref7.cn("Tooltip", {
|
|
82
90
|
"title": hint
|
|
83
|
-
}), /*#__PURE__*/React.createElement(SIcon,
|
|
91
|
+
}), /*#__PURE__*/React.createElement(SIcon, _ref7.cn("SIcon", {}))));
|
|
84
92
|
}
|
|
85
93
|
|
|
86
94
|
function Description(props) {
|
|
87
95
|
var _ref3 = this ? this.asProps : arguments[0],
|
|
88
|
-
|
|
96
|
+
_ref8;
|
|
89
97
|
|
|
90
98
|
var styles = props.styles;
|
|
91
99
|
var SDescription = Text;
|
|
92
|
-
return
|
|
100
|
+
return _ref8 = sstyled(styles), /*#__PURE__*/React.createElement(SDescription, _ref8.cn("SDescription", _objectSpread({}, _assignProps3({
|
|
93
101
|
"tag": "p"
|
|
94
102
|
}, _ref3))));
|
|
95
103
|
}
|
|
96
104
|
|
|
97
|
-
|
|
105
|
+
function Header(props) {
|
|
106
|
+
var _ref4 = this ? this.asProps : arguments[0],
|
|
107
|
+
_ref9;
|
|
108
|
+
|
|
109
|
+
var styles = props.styles;
|
|
110
|
+
var SHeader = Box;
|
|
111
|
+
return _ref9 = sstyled(styles), /*#__PURE__*/React.createElement(SHeader, _ref9.cn("SHeader", _objectSpread({}, _assignProps4(_objectSpread({}, props), _ref4))));
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function Body(props) {
|
|
115
|
+
var _ref5 = this ? this.asProps : arguments[0],
|
|
116
|
+
_ref10;
|
|
117
|
+
|
|
118
|
+
var styles = props.styles;
|
|
119
|
+
var SBody = Box;
|
|
120
|
+
return _ref10 = sstyled(styles), /*#__PURE__*/React.createElement(SBody, _ref10.cn("SBody", _objectSpread({}, _assignProps5(_objectSpread({}, props), _ref5))));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
var Card = createComponent(CardRoot, {
|
|
98
124
|
Title: Title,
|
|
99
|
-
Description: Description
|
|
125
|
+
Description: Description,
|
|
126
|
+
Header: Header,
|
|
127
|
+
Body: Body
|
|
100
128
|
});
|
|
129
|
+
export default Card;
|
|
101
130
|
//# sourceMappingURL=Card.js.map
|
package/lib/es6/Card.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Card.js"],"names":["React","createComponent","Component","sstyled","Root","Box","Text","Tooltip","Info","
|
|
1
|
+
{"version":3,"sources":["../../src/Card.js"],"names":["React","createComponent","Component","sstyled","Root","Box","Text","Tooltip","Info","isAdvanceMode","CardRoot","SCard","asProps","Children","styles","advanceMode","Card","Header","displayName","Body","style","Title","props","hint","STitle","SIcon","Description","SDescription","SHeader","SBody"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,eAAP,IAA0BC,SAA1B,EAAqCC,OAArC,EAA8CC,IAA9C,QAA0D,eAA1D;AACA,SAASC,GAAT,QAAoB,mBAApB;AACA,SAASC,IAAT,QAAqB,qBAArB;AACA,OAAOC,OAAP,MAAoB,kBAApB;AACA,OAAOC,IAAP,MAAiB,sBAAjB;;;;;;;;;;;;;;;;;;;AAGA,SAASC,aAAT,QAA8B,kCAA9B;;IAEMC,Q;;;;;;;;;;;;;WAKJ,kBAAS;AAAA;AAAA;;AACP,UAAMC,KAAK,GAMMN,GANjB;AACA,0BAA6B,KAAKO,OAAlC;AAAA,UAAQC,QAAR,iBAAQA,QAAR;AAAA,UAAkBC,MAAlB,iBAAkBA,MAAlB;AAEA,UAAMC,WAAW,GAAGN,aAAa,CAACI,QAAD,EAAW,CAACG,IAAI,CAACC,MAAL,CAAYC,WAAb,EAA0BF,IAAI,CAACG,IAAL,CAAUD,WAApC,CAAX,CAAjC;AAEA,qBAAOf,OAAO,CAACW,MAAD,CAAd,eACE,oBAAC,KAAD,gEACGC,WAAW,gBAC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ED,IAAMN,IAAI,GAAGf,eAAe,CAACS,QAAD,EAAW;AACrCW,EAAAA,KAAK,EAALA,KADqC;AAErCK,EAAAA,WAAW,EAAXA,WAFqC;AAGrCT,EAAAA,MAAM,EAANA,MAHqC;AAIrCE,EAAAA,IAAI,EAAJA;AAJqC,CAAX,CAA5B;AAOA,eAAeH,IAAf","sourcesContent":["import React from 'react';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport { Box } from '@semcore/flex-box';\nimport { Text } from '@semcore/typography';\nimport Tooltip from '@semcore/tooltip';\nimport Info from '@semcore/icon/Info/m';\n\nimport style from './style/card.shadow.css';\nimport { isAdvanceMode } from '@semcore/utils/lib/findComponent';\n\nclass CardRoot extends Component {\n static displayName = 'Card';\n\n static style = style;\n\n render() {\n const SCard = Root;\n const { Children, styles } = this.asProps;\n\n const advanceMode = isAdvanceMode(Children, [Card.Header.displayName, Card.Body.displayName]);\n\n return sstyled(styles)(\n <SCard render={Box}>\n {advanceMode ? (\n <Children />\n ) : (\n <Card.Body>\n <Children />\n </Card.Body>\n )}\n </SCard>,\n );\n }\n}\n\nfunction Title(props) {\n const { styles, hint } = props;\n const STitle = Root;\n const SIcon = Info;\n return sstyled(styles)(\n <>\n <STitle render={Text} />\n {hint && (\n <Tooltip title={hint}>\n <SIcon />\n </Tooltip>\n )}\n </>,\n );\n}\n\nfunction Description(props) {\n const { styles } = props;\n const SDescription = Root;\n return sstyled(styles)(<SDescription render={Text} tag=\"p\" />);\n}\n\nfunction Header(props) {\n const { styles } = props;\n const SHeader = Root;\n return sstyled(styles)(<SHeader render={Box} {...props} />);\n}\n\nfunction Body(props) {\n const { styles } = props;\n const SBody = Root;\n return sstyled(styles)(<SBody render={Box} {...props} />);\n}\n\nconst Card = createComponent(CardRoot, {\n Title,\n Description,\n Header,\n Body,\n});\n\nexport default Card;\n"],"file":"Card.js"}
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
SCard {
|
|
4
4
|
border: 1px solid var(--gray80);
|
|
5
5
|
border-radius: 2px;
|
|
6
|
-
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
background: var(--white);
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
STitle {
|
|
@@ -22,3 +23,17 @@ SDescription {
|
|
|
22
23
|
font-size: var(--fs-200);
|
|
23
24
|
color: var(--gray60);
|
|
24
25
|
}
|
|
26
|
+
|
|
27
|
+
SHeader {
|
|
28
|
+
padding-bottom: 0;
|
|
29
|
+
padding-left: 24px;
|
|
30
|
+
padding-right: 24px;
|
|
31
|
+
padding-top: 20px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
SBody {
|
|
35
|
+
padding-bottom: 24px;
|
|
36
|
+
padding-left: 24px;
|
|
37
|
+
padding-right: 24px;
|
|
38
|
+
padding-top: 20px;
|
|
39
|
+
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CProps, ReturnEl } from '@semcore/core';
|
|
3
|
-
import { IBoxProps } from '@semcore/flex-box';
|
|
3
|
+
import { Box, IBoxProps } from '@semcore/flex-box';
|
|
4
4
|
import { Text, ITextProps } from '@semcore/typography';
|
|
5
5
|
|
|
6
6
|
export interface ITitleProps extends ITextProps {
|
|
@@ -13,6 +13,8 @@ export interface ITitleProps extends ITextProps {
|
|
|
13
13
|
declare const Card: (<T>(props: CProps<IBoxProps & T>) => ReturnEl) & {
|
|
14
14
|
Title: <T>(props: ITitleProps & T) => ReturnEl;
|
|
15
15
|
Description: typeof Text;
|
|
16
|
+
Header: typeof Box;
|
|
17
|
+
Body: typeof Box;
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
export default Card;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/card",
|
|
3
3
|
"description": "SEMRush Card Component",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "3.0.2",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -25,5 +25,10 @@
|
|
|
25
25
|
},
|
|
26
26
|
"jest": {
|
|
27
27
|
"preset": "@semcore/jest-preset-ui"
|
|
28
|
+
},
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "https://github.com/semrush/intergalactic.git",
|
|
32
|
+
"directory": "semcore/card"
|
|
28
33
|
}
|
|
29
34
|
}
|
package/src/Card.js
CHANGED
|
@@ -6,17 +6,30 @@ import Tooltip from '@semcore/tooltip';
|
|
|
6
6
|
import Info from '@semcore/icon/Info/m';
|
|
7
7
|
|
|
8
8
|
import style from './style/card.shadow.css';
|
|
9
|
+
import { isAdvanceMode } from '@semcore/utils/lib/findComponent';
|
|
9
10
|
|
|
10
|
-
class
|
|
11
|
+
class CardRoot extends Component {
|
|
11
12
|
static displayName = 'Card';
|
|
12
13
|
|
|
13
14
|
static style = style;
|
|
14
15
|
|
|
15
16
|
render() {
|
|
16
17
|
const SCard = Root;
|
|
17
|
-
const { styles } = this.asProps;
|
|
18
|
+
const { Children, styles } = this.asProps;
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
const advanceMode = isAdvanceMode(Children, [Card.Header.displayName, Card.Body.displayName]);
|
|
21
|
+
|
|
22
|
+
return sstyled(styles)(
|
|
23
|
+
<SCard render={Box}>
|
|
24
|
+
{advanceMode ? (
|
|
25
|
+
<Children />
|
|
26
|
+
) : (
|
|
27
|
+
<Card.Body>
|
|
28
|
+
<Children />
|
|
29
|
+
</Card.Body>
|
|
30
|
+
)}
|
|
31
|
+
</SCard>,
|
|
32
|
+
);
|
|
20
33
|
}
|
|
21
34
|
}
|
|
22
35
|
|
|
@@ -42,7 +55,23 @@ function Description(props) {
|
|
|
42
55
|
return sstyled(styles)(<SDescription render={Text} tag="p" />);
|
|
43
56
|
}
|
|
44
57
|
|
|
45
|
-
|
|
58
|
+
function Header(props) {
|
|
59
|
+
const { styles } = props;
|
|
60
|
+
const SHeader = Root;
|
|
61
|
+
return sstyled(styles)(<SHeader render={Box} {...props} />);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function Body(props) {
|
|
65
|
+
const { styles } = props;
|
|
66
|
+
const SBody = Root;
|
|
67
|
+
return sstyled(styles)(<SBody render={Box} {...props} />);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const Card = createComponent(CardRoot, {
|
|
46
71
|
Title,
|
|
47
72
|
Description,
|
|
73
|
+
Header,
|
|
74
|
+
Body,
|
|
48
75
|
});
|
|
76
|
+
|
|
77
|
+
export default Card;
|
package/src/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CProps, ReturnEl } from '@semcore/core';
|
|
3
|
-
import { IBoxProps } from '@semcore/flex-box';
|
|
3
|
+
import { Box, IBoxProps } from '@semcore/flex-box';
|
|
4
4
|
import { Text, ITextProps } from '@semcore/typography';
|
|
5
5
|
|
|
6
6
|
export interface ITitleProps extends ITextProps {
|
|
@@ -13,6 +13,8 @@ export interface ITitleProps extends ITextProps {
|
|
|
13
13
|
declare const Card: (<T>(props: CProps<IBoxProps & T>) => ReturnEl) & {
|
|
14
14
|
Title: <T>(props: ITitleProps & T) => ReturnEl;
|
|
15
15
|
Description: typeof Text;
|
|
16
|
+
Header: typeof Box;
|
|
17
|
+
Body: typeof Box;
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
export default Card;
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
SCard {
|
|
4
4
|
border: 1px solid var(--gray80);
|
|
5
5
|
border-radius: 2px;
|
|
6
|
-
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
background: var(--white);
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
STitle {
|
|
@@ -22,3 +23,17 @@ SDescription {
|
|
|
22
23
|
font-size: var(--fs-200);
|
|
23
24
|
color: var(--gray60);
|
|
24
25
|
}
|
|
26
|
+
|
|
27
|
+
SHeader {
|
|
28
|
+
padding-bottom: 0;
|
|
29
|
+
padding-left: 24px;
|
|
30
|
+
padding-right: 24px;
|
|
31
|
+
padding-top: 20px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
SBody {
|
|
35
|
+
padding-bottom: 24px;
|
|
36
|
+
padding-left: 24px;
|
|
37
|
+
padding-right: 24px;
|
|
38
|
+
padding-top: 20px;
|
|
39
|
+
}
|