@semcore/card 2.2.1 → 2.4.1
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 +25 -0
- package/lib/cjs/Card.js +63 -34
- package/lib/cjs/Card.js.map +1 -1
- package/lib/cjs/index.js +5 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/style/card.shadow.css +16 -0
- package/lib/es6/Card.js +59 -33
- package/lib/es6/Card.js.map +1 -1
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/style/card.shadow.css +16 -0
- package/lib/types/index.d.ts +20 -2
- package/package.json +5 -5
- package/src/Card.js +77 -0
- package/src/index.d.ts +20 -0
- package/src/{index.tsx → index.js} +0 -0
- package/src/style/card.shadow.css +16 -0
- package/lib/types/Card.d.ts +0 -16
- package/src/Card.tsx +0 -62
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
|
5
|
+
## [2.4.1] - 2021-02-14
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- Up version of `Utils`
|
|
10
|
+
|
|
11
|
+
## [2.4.0] - 2022-02-03
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- Changed styles
|
|
16
|
+
|
|
17
|
+
## [2.3.0] - 2022-01-18
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- Up version icons and use new icon.
|
|
22
|
+
- Rewrite code from TS to JS 🧑💻
|
|
23
|
+
|
|
24
|
+
## [2.2.2] - 2021-9-20
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
- Fixed padding
|
|
29
|
+
|
|
5
30
|
## [2.2.1] - 2021-8-26
|
|
6
31
|
|
|
7
32
|
### Changed
|
package/lib/cjs/Card.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
-
|
|
5
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
4
|
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
@@ -31,11 +31,17 @@ var _typography = require("@semcore/typography");
|
|
|
31
31
|
|
|
32
32
|
var _tooltip = _interopRequireDefault(require("@semcore/tooltip"));
|
|
33
33
|
|
|
34
|
-
var
|
|
34
|
+
var _m = _interopRequireDefault(require("@semcore/icon/Info/m"));
|
|
35
|
+
|
|
36
|
+
var _findComponent = require("@semcore/utils/lib/findComponent");
|
|
37
|
+
|
|
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); }
|
|
35
39
|
|
|
36
|
-
function
|
|
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; }
|
|
37
41
|
|
|
38
|
-
function
|
|
42
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
43
|
+
|
|
44
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
39
45
|
|
|
40
46
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
41
47
|
|
|
@@ -46,74 +52,97 @@ var style = (
|
|
|
46
52
|
/*__reshadow_css_start__*/
|
|
47
53
|
_core.sstyled.insert(
|
|
48
54
|
/*__inner_css_start__*/
|
|
49
|
-
".
|
|
55
|
+
".___SCard_81jzm_gg_{border:1px solid #cccccc;border-radius:2px;box-sizing:border-box;background:#fff}.___STitle_81jzm_gg_{font-size:19px;font-weight:500}.___SIcon_81jzm_gg_{margin-left:4px;color:#a6b0b3;cursor:help}.___SDescription_81jzm_gg_{margin-bottom:12px;font-size:14px;color:#757575}.___SHeader_81jzm_gg_{padding-bottom:0}.___SBody_81jzm_gg_,.___SHeader_81jzm_gg_{padding-left:24px;padding-right:24px;padding-top:20px}.___SBody_81jzm_gg_{padding-bottom:24px}"
|
|
50
56
|
/*__inner_css_end__*/
|
|
51
|
-
, "
|
|
57
|
+
, "11udogg_gg_")
|
|
52
58
|
/*__reshadow_css_end__*/
|
|
53
59
|
, {
|
|
54
|
-
"__SCard": "
|
|
55
|
-
"__STitle": "
|
|
56
|
-
"__SIcon": "
|
|
57
|
-
"__SDescription": "
|
|
60
|
+
"__SCard": "___SCard_81jzm_gg_",
|
|
61
|
+
"__STitle": "___STitle_81jzm_gg_",
|
|
62
|
+
"__SIcon": "___SIcon_81jzm_gg_",
|
|
63
|
+
"__SDescription": "___SDescription_81jzm_gg_",
|
|
64
|
+
"__SHeader": "___SHeader_81jzm_gg_",
|
|
65
|
+
"__SBody": "___SBody_81jzm_gg_"
|
|
58
66
|
});
|
|
59
67
|
|
|
60
|
-
var
|
|
61
|
-
(0, _inherits2["default"])(
|
|
68
|
+
var CardRoot = /*#__PURE__*/function (_Component) {
|
|
69
|
+
(0, _inherits2["default"])(CardRoot, _Component);
|
|
62
70
|
|
|
63
|
-
var _super = _createSuper(
|
|
71
|
+
var _super = _createSuper(CardRoot);
|
|
64
72
|
|
|
65
|
-
function
|
|
66
|
-
(0, _classCallCheck2["default"])(this,
|
|
73
|
+
function CardRoot() {
|
|
74
|
+
(0, _classCallCheck2["default"])(this, CardRoot);
|
|
67
75
|
return _super.apply(this, arguments);
|
|
68
76
|
}
|
|
69
77
|
|
|
70
|
-
(0, _createClass2["default"])(
|
|
78
|
+
(0, _createClass2["default"])(CardRoot, [{
|
|
71
79
|
key: "render",
|
|
72
80
|
value: function render() {
|
|
73
81
|
var _ref = this ? this.asProps : arguments[0],
|
|
74
|
-
|
|
82
|
+
_ref6;
|
|
75
83
|
|
|
76
84
|
var SCard = _flexBox.Box;
|
|
77
|
-
var
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
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", {}))));
|
|
81
90
|
}
|
|
82
91
|
}]);
|
|
83
|
-
return
|
|
92
|
+
return CardRoot;
|
|
84
93
|
}(_core.Component);
|
|
85
94
|
|
|
86
|
-
(0, _defineProperty2["default"])(
|
|
87
|
-
(0, _defineProperty2["default"])(
|
|
95
|
+
(0, _defineProperty2["default"])(CardRoot, "displayName", 'Card');
|
|
96
|
+
(0, _defineProperty2["default"])(CardRoot, "style", style);
|
|
88
97
|
|
|
89
98
|
function Title(props) {
|
|
90
99
|
var _ref2 = this ? this.asProps : arguments[0],
|
|
91
|
-
|
|
100
|
+
_ref7;
|
|
92
101
|
|
|
93
102
|
var styles = props.styles,
|
|
94
103
|
hint = props.hint;
|
|
95
104
|
var STitle = _typography.Text;
|
|
96
|
-
var SIcon =
|
|
97
|
-
return
|
|
105
|
+
var SIcon = _m["default"];
|
|
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", {
|
|
98
107
|
"title": hint
|
|
99
|
-
}), /*#__PURE__*/_react["default"].createElement(SIcon,
|
|
108
|
+
}), /*#__PURE__*/_react["default"].createElement(SIcon, _ref7.cn("SIcon", {}))));
|
|
100
109
|
}
|
|
101
110
|
|
|
102
111
|
function Description(props) {
|
|
103
112
|
var _ref3 = this ? this.asProps : arguments[0],
|
|
104
|
-
|
|
113
|
+
_ref8;
|
|
105
114
|
|
|
106
115
|
var styles = props.styles;
|
|
107
116
|
var SDescription = _typography.Text;
|
|
108
|
-
return
|
|
117
|
+
return _ref8 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SDescription, _ref8.cn("SDescription", _objectSpread({}, (0, _core.assignProps)({
|
|
109
118
|
"tag": "p"
|
|
110
119
|
}, _ref3))));
|
|
111
120
|
}
|
|
112
121
|
|
|
113
|
-
|
|
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, {
|
|
114
141
|
Title: Title,
|
|
115
|
-
Description: Description
|
|
142
|
+
Description: Description,
|
|
143
|
+
Header: Header,
|
|
144
|
+
Body: Body
|
|
116
145
|
});
|
|
117
|
-
|
|
146
|
+
var _default = Card;
|
|
118
147
|
exports["default"] = _default;
|
|
119
148
|
//# sourceMappingURL=Card.js.map
|
package/lib/cjs/Card.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Card.
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEMA,Q;;;;;;;;;;;;WAKJ,kBAAS;AAAA;AAAA;;AACP,UAAMC,KAAK,GAMMC,YANjB;AACA,0BAA6B,KAAKC,OAAlC;AAAA,UAAQC,QAAR,iBAAQA,QAAR;AAAA,UAAkBC,MAAlB,iBAAkBA,MAAlB;AAEA,UAAMC,WAAW,GAAG,kCAAcF,QAAd,EAAwB,CAACG,IAAI,CAACC,MAAL,CAAYC,WAAb,EAA0BF,IAAI,CAACG,IAAL,CAAUD,WAApC,CAAxB,CAApB;AAEA,qBAAO,mBAAQJ,MAAR,CAAP,eACE,gCAAC,KAAD,0EACGC,WAAW,gBACV,gCAAC,QAAD,2BADU,gBAGV,gCAAC,IAAD,CAAM,IAAN,qBACE,gCAAC,QAAD,2BADF,CAJJ,CADF;AAWD;;;EAtBoBK,e;;iCAAjBX,Q,iBACiB,M;iCADjBA,Q,WAGWY,K;;AAsBjB,SAASC,KAAT,CAAeC,KAAf,EAAsB;AAAA;AAAA;;AACpB,MAAQT,MAAR,GAAyBS,KAAzB,CAAQT,MAAR;AAAA,MAAgBU,IAAhB,GAAyBD,KAAzB,CAAgBC,IAAhB;AACA,MAAMC,MAAM,GAIQC,gBAJpB;AACA,MAAMC,KAAK,GAAGC,aAAd;AACA,iBAAO,mBAAQd,MAAR,CAAP,eACE,+EACE,gCAAC,MAAD,2EADF,EAEGU,IAAI,iBACH,gCAAC,mBAAD;AAAA,aAAgBA;AAAhB,mBACE,gCAAC,KAAD,wBADF,CAHJ,CADF;AAUD;;AAED,SAASK,WAAT,CAAqBN,KAArB,EAA4B;AAAA;AAAA;;AAC1B,MAAQT,MAAR,GAAmBS,KAAnB,CAAQT,MAAR;AACA,MAAMgB,YAAY,GAC2BJ,gBAD7C;AACA,iBAAO,mBAAQZ,MAAR,CAAP,eAAuB,gCAAC,YAAD;AAAA,WAAgC;AAAhC,cAAvB;AACD;;AAED,SAASG,MAAT,CAAgBM,KAAhB,EAAuB;AAAA;AAAA;;AACrB,MAAQT,MAAR,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"}
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
@@ -26,4 +26,8 @@ Object.keys(_Card).forEach(function (key) {
|
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
28
|
});
|
|
29
|
+
|
|
30
|
+
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); }
|
|
31
|
+
|
|
32
|
+
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; }
|
|
29
33
|
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.
|
|
1
|
+
{"version":3,"sources":["../../src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export { default } from './Card';\nexport * from './Card';\n"],"file":"index.js"}
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
SCard {
|
|
4
4
|
border: 1px solid var(--gray80);
|
|
5
5
|
border-radius: 2px;
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
background: var(--white);
|
|
6
8
|
}
|
|
7
9
|
|
|
8
10
|
STitle {
|
|
@@ -21,3 +23,17 @@ SDescription {
|
|
|
21
23
|
font-size: var(--fs-200);
|
|
22
24
|
color: var(--gray60);
|
|
23
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,13 +5,15 @@ 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";
|
|
11
13
|
|
|
12
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
14
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
13
15
|
|
|
14
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
16
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
15
17
|
|
|
16
18
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
17
19
|
|
|
@@ -20,85 +22,109 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
20
22
|
import React from 'react';
|
|
21
23
|
import createComponent, { Component, sstyled, Root } from '@semcore/core';
|
|
22
24
|
import { Box } from '@semcore/flex-box';
|
|
23
|
-
import { Text } from '@semcore/typography';
|
|
24
|
-
|
|
25
|
+
import { Text } from '@semcore/typography';
|
|
25
26
|
import Tooltip from '@semcore/tooltip';
|
|
26
|
-
import
|
|
27
|
+
import Info from '@semcore/icon/Info/m';
|
|
27
28
|
|
|
28
29
|
/*__reshadow-styles__:"./style/card.shadow.css"*/
|
|
29
30
|
var style = (
|
|
30
31
|
/*__reshadow_css_start__*/
|
|
31
32
|
_sstyled.insert(
|
|
32
33
|
/*__inner_css_start__*/
|
|
33
|
-
".
|
|
34
|
+
".___SCard_81jzm_gg_{border:1px solid #cccccc;border-radius:2px;box-sizing:border-box;background:#fff}.___STitle_81jzm_gg_{font-size:19px;font-weight:500}.___SIcon_81jzm_gg_{margin-left:4px;color:#a6b0b3;cursor:help}.___SDescription_81jzm_gg_{margin-bottom:12px;font-size:14px;color:#757575}.___SHeader_81jzm_gg_{padding-bottom:0}.___SBody_81jzm_gg_,.___SHeader_81jzm_gg_{padding-left:24px;padding-right:24px;padding-top:20px}.___SBody_81jzm_gg_{padding-bottom:24px}"
|
|
34
35
|
/*__inner_css_end__*/
|
|
35
|
-
, "
|
|
36
|
+
, "11udogg_gg_")
|
|
36
37
|
/*__reshadow_css_end__*/
|
|
37
38
|
, {
|
|
38
|
-
"__SCard": "
|
|
39
|
-
"__STitle": "
|
|
40
|
-
"__SIcon": "
|
|
41
|
-
"__SDescription": "
|
|
39
|
+
"__SCard": "___SCard_81jzm_gg_",
|
|
40
|
+
"__STitle": "___STitle_81jzm_gg_",
|
|
41
|
+
"__SIcon": "___SIcon_81jzm_gg_",
|
|
42
|
+
"__SDescription": "___SDescription_81jzm_gg_",
|
|
43
|
+
"__SHeader": "___SHeader_81jzm_gg_",
|
|
44
|
+
"__SBody": "___SBody_81jzm_gg_"
|
|
42
45
|
});
|
|
46
|
+
import { isAdvanceMode } from '@semcore/utils/lib/findComponent';
|
|
43
47
|
|
|
44
|
-
var
|
|
45
|
-
_inherits(
|
|
48
|
+
var CardRoot = /*#__PURE__*/function (_Component) {
|
|
49
|
+
_inherits(CardRoot, _Component);
|
|
46
50
|
|
|
47
|
-
var _super = _createSuper(
|
|
51
|
+
var _super = _createSuper(CardRoot);
|
|
48
52
|
|
|
49
|
-
function
|
|
50
|
-
_classCallCheck(this,
|
|
53
|
+
function CardRoot() {
|
|
54
|
+
_classCallCheck(this, CardRoot);
|
|
51
55
|
|
|
52
56
|
return _super.apply(this, arguments);
|
|
53
57
|
}
|
|
54
58
|
|
|
55
|
-
_createClass(
|
|
59
|
+
_createClass(CardRoot, [{
|
|
56
60
|
key: "render",
|
|
57
61
|
value: function render() {
|
|
58
62
|
var _ref = this ? this.asProps : arguments[0],
|
|
59
|
-
|
|
63
|
+
_ref6;
|
|
60
64
|
|
|
61
65
|
var SCard = Box;
|
|
62
|
-
var
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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", {}))));
|
|
66
71
|
}
|
|
67
72
|
}]);
|
|
68
73
|
|
|
69
|
-
return
|
|
74
|
+
return CardRoot;
|
|
70
75
|
}(Component);
|
|
71
76
|
|
|
72
|
-
_defineProperty(
|
|
77
|
+
_defineProperty(CardRoot, "displayName", 'Card');
|
|
73
78
|
|
|
74
|
-
_defineProperty(
|
|
79
|
+
_defineProperty(CardRoot, "style", style);
|
|
75
80
|
|
|
76
81
|
function Title(props) {
|
|
77
82
|
var _ref2 = this ? this.asProps : arguments[0],
|
|
78
|
-
|
|
83
|
+
_ref7;
|
|
79
84
|
|
|
80
85
|
var styles = props.styles,
|
|
81
86
|
hint = props.hint;
|
|
82
87
|
var STitle = Text;
|
|
83
|
-
var SIcon =
|
|
84
|
-
return
|
|
88
|
+
var SIcon = Info;
|
|
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", {
|
|
85
90
|
"title": hint
|
|
86
|
-
}), /*#__PURE__*/React.createElement(SIcon,
|
|
91
|
+
}), /*#__PURE__*/React.createElement(SIcon, _ref7.cn("SIcon", {}))));
|
|
87
92
|
}
|
|
88
93
|
|
|
89
94
|
function Description(props) {
|
|
90
95
|
var _ref3 = this ? this.asProps : arguments[0],
|
|
91
|
-
|
|
96
|
+
_ref8;
|
|
92
97
|
|
|
93
98
|
var styles = props.styles;
|
|
94
99
|
var SDescription = Text;
|
|
95
|
-
return
|
|
100
|
+
return _ref8 = sstyled(styles), /*#__PURE__*/React.createElement(SDescription, _ref8.cn("SDescription", _objectSpread({}, _assignProps3({
|
|
96
101
|
"tag": "p"
|
|
97
102
|
}, _ref3))));
|
|
98
103
|
}
|
|
99
104
|
|
|
100
|
-
|
|
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, {
|
|
101
124
|
Title: Title,
|
|
102
|
-
Description: Description
|
|
125
|
+
Description: Description,
|
|
126
|
+
Header: Header,
|
|
127
|
+
Body: Body
|
|
103
128
|
});
|
|
129
|
+
export default Card;
|
|
104
130
|
//# sourceMappingURL=Card.js.map
|
package/lib/es6/Card.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Card.
|
|
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,gBACV,oBAAC,QAAD,2BADU,gBAGV,oBAAC,IAAD,CAAM,IAAN,qBACE,oBAAC,QAAD,2BADF,CAJJ,CADF;AAWD;;;;EAtBoBb,S;;gBAAjBQ,Q,iBACiB,M;;gBADjBA,Q,WAGWU,K;;AAsBjB,SAASC,KAAT,CAAeC,KAAf,EAAsB;AAAA;AAAA;;AACpB,MAAQR,MAAR,GAAyBQ,KAAzB,CAAQR,MAAR;AAAA,MAAgBS,IAAhB,GAAyBD,KAAzB,CAAgBC,IAAhB;AACA,MAAMC,MAAM,GAIQlB,IAJpB;AACA,MAAMmB,KAAK,GAAGjB,IAAd;AACA,iBAAOL,OAAO,CAACW,MAAD,CAAd,eACE,uDACE,oBAAC,MAAD,kEADF,EAEGS,IAAI,iBACH,oBAAC,OAAD;AAAA,aAAgBA;AAAhB,mBACE,oBAAC,KAAD,wBADF,CAHJ,CADF;AAUD;;AAED,SAASG,WAAT,CAAqBJ,KAArB,EAA4B;AAAA;AAAA;;AAC1B,MAAQR,MAAR,GAAmBQ,KAAnB,CAAQR,MAAR;AACA,MAAMa,YAAY,GAC2BrB,IAD7C;AACA,iBAAOH,OAAO,CAACW,MAAD,CAAd,eAAuB,oBAAC,YAAD;AAAA,WAAgC;AAAhC,cAAvB;AACD;;AAED,SAASG,MAAT,CAAgBK,KAAhB,EAAuB;AAAA;AAAA;;AACrB,MAAQR,MAAR,GAAmBQ,KAAnB,CAAQR,MAAR;AACA,MAAMc,OAAO,GAC2BvB,GADxC;AACA,iBAAOF,OAAO,CAACW,MAAD,CAAd,eAAuB,oBAAC,OAAD,wEAA0BQ,KAA1B,YAAvB;AACD;;AAED,SAASH,IAAT,CAAcG,KAAd,EAAqB;AAAA;AAAA;;AACnB,MAAQR,MAAR,GAAmBQ,KAAnB,CAAQR,MAAR;AACA,MAAMe,KAAK,GAC2BxB,GADtC;AACA,kBAAOF,OAAO,CAACW,MAAD,CAAd,eAAuB,oBAAC,KAAD,uEAAwBQ,KAAxB,YAAvB;AACD;;AAED,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"}
|
package/lib/es6/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.
|
|
1
|
+
{"version":3,"sources":["../../src/index.js"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,QAAxB;AACA,cAAc,QAAd","sourcesContent":["export { default } from './Card';\nexport * from './Card';\n"],"file":"index.js"}
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
SCard {
|
|
4
4
|
border: 1px solid var(--gray80);
|
|
5
5
|
border-radius: 2px;
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
background: var(--white);
|
|
6
8
|
}
|
|
7
9
|
|
|
8
10
|
STitle {
|
|
@@ -21,3 +23,17 @@ SDescription {
|
|
|
21
23
|
font-size: var(--fs-200);
|
|
22
24
|
color: var(--gray60);
|
|
23
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,2 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CProps, ReturnEl } from '@semcore/core';
|
|
3
|
+
import { Box, IBoxProps } from '@semcore/flex-box';
|
|
4
|
+
import { Text, ITextProps } from '@semcore/typography';
|
|
5
|
+
|
|
6
|
+
export interface ITitleProps extends ITextProps {
|
|
7
|
+
/**
|
|
8
|
+
* Tooltip text
|
|
9
|
+
*/
|
|
10
|
+
hint?: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
declare const Card: (<T>(props: CProps<IBoxProps & T>) => ReturnEl) & {
|
|
14
|
+
Title: <T>(props: ITitleProps & T) => ReturnEl;
|
|
15
|
+
Description: typeof Text;
|
|
16
|
+
Header: typeof Box;
|
|
17
|
+
Body: typeof Box;
|
|
18
|
+
};
|
|
19
|
+
|
|
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": "2.
|
|
4
|
+
"version": "2.4.1",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -9,21 +9,21 @@
|
|
|
9
9
|
"author": "Roman Lysov <r.lysov@semrush.com>",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"scripts": {
|
|
12
|
-
"build": "build",
|
|
12
|
+
"build": "build --source=js",
|
|
13
13
|
"test": "jest"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@semcore/utils": "^3.
|
|
16
|
+
"@semcore/utils": "^3.31",
|
|
17
17
|
"@semcore/flex-box": "^4",
|
|
18
18
|
"@semcore/typography": "^3",
|
|
19
19
|
"@semcore/tooltip": "^4",
|
|
20
|
-
"@semcore/icon": "^2"
|
|
20
|
+
"@semcore/icon": "^2.16"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"@semcore/core": "^1.11",
|
|
24
24
|
"react": "16.8 - 17"
|
|
25
25
|
},
|
|
26
26
|
"jest": {
|
|
27
|
-
"preset": "jest-preset-ui"
|
|
27
|
+
"preset": "@semcore/jest-preset-ui"
|
|
28
28
|
}
|
|
29
29
|
}
|
package/src/Card.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import createComponent, { Component, sstyled, Root } from '@semcore/core';
|
|
3
|
+
import { Box } from '@semcore/flex-box';
|
|
4
|
+
import { Text } from '@semcore/typography';
|
|
5
|
+
import Tooltip from '@semcore/tooltip';
|
|
6
|
+
import Info from '@semcore/icon/Info/m';
|
|
7
|
+
|
|
8
|
+
import style from './style/card.shadow.css';
|
|
9
|
+
import { isAdvanceMode } from '@semcore/utils/lib/findComponent';
|
|
10
|
+
|
|
11
|
+
class CardRoot extends Component {
|
|
12
|
+
static displayName = 'Card';
|
|
13
|
+
|
|
14
|
+
static style = style;
|
|
15
|
+
|
|
16
|
+
render() {
|
|
17
|
+
const SCard = Root;
|
|
18
|
+
const { Children, styles } = this.asProps;
|
|
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
|
+
);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function Title(props) {
|
|
37
|
+
const { styles, hint } = props;
|
|
38
|
+
const STitle = Root;
|
|
39
|
+
const SIcon = Info;
|
|
40
|
+
return sstyled(styles)(
|
|
41
|
+
<>
|
|
42
|
+
<STitle render={Text} />
|
|
43
|
+
{hint && (
|
|
44
|
+
<Tooltip title={hint}>
|
|
45
|
+
<SIcon />
|
|
46
|
+
</Tooltip>
|
|
47
|
+
)}
|
|
48
|
+
</>,
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function Description(props) {
|
|
53
|
+
const { styles } = props;
|
|
54
|
+
const SDescription = Root;
|
|
55
|
+
return sstyled(styles)(<SDescription render={Text} tag="p" />);
|
|
56
|
+
}
|
|
57
|
+
|
|
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, {
|
|
71
|
+
Title,
|
|
72
|
+
Description,
|
|
73
|
+
Header,
|
|
74
|
+
Body,
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
export default Card;
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CProps, ReturnEl } from '@semcore/core';
|
|
3
|
+
import { Box, IBoxProps } from '@semcore/flex-box';
|
|
4
|
+
import { Text, ITextProps } from '@semcore/typography';
|
|
5
|
+
|
|
6
|
+
export interface ITitleProps extends ITextProps {
|
|
7
|
+
/**
|
|
8
|
+
* Tooltip text
|
|
9
|
+
*/
|
|
10
|
+
hint?: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
declare const Card: (<T>(props: CProps<IBoxProps & T>) => ReturnEl) & {
|
|
14
|
+
Title: <T>(props: ITitleProps & T) => ReturnEl;
|
|
15
|
+
Description: typeof Text;
|
|
16
|
+
Header: typeof Box;
|
|
17
|
+
Body: typeof Box;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default Card;
|
|
File without changes
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
SCard {
|
|
4
4
|
border: 1px solid var(--gray80);
|
|
5
5
|
border-radius: 2px;
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
background: var(--white);
|
|
6
8
|
}
|
|
7
9
|
|
|
8
10
|
STitle {
|
|
@@ -21,3 +23,17 @@ SDescription {
|
|
|
21
23
|
font-size: var(--fs-200);
|
|
22
24
|
color: var(--gray60);
|
|
23
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/Card.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React, { ComponentProps, HTMLAttributes } from 'react';
|
|
2
|
-
import { Merge } from '@semcore/core';
|
|
3
|
-
import { ITextProps, Text } from '@semcore/typography';
|
|
4
|
-
export interface ITitleProps extends ITextProps {
|
|
5
|
-
/**
|
|
6
|
-
* Tooltip text
|
|
7
|
-
*/
|
|
8
|
-
hint?: React.ReactNode;
|
|
9
|
-
}
|
|
10
|
-
declare const _default: import("@semcore/core").ComponentType<import("@semcore/core").PropsAndRef<Merge<import("@semcore/flex-box").IBoxProps, React.HTMLAttributes<HTMLDivElement>>, {}, {}>, {
|
|
11
|
-
Title: Merge<ITitleProps, HTMLAttributes<HTMLSpanElement>>;
|
|
12
|
-
Description: ComponentProps<typeof Text>;
|
|
13
|
-
}, {}, {
|
|
14
|
-
[key: string]: (arg: unknown) => void;
|
|
15
|
-
}, null>;
|
|
16
|
-
export default _default;
|
package/src/Card.tsx
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import React, { ComponentProps, HTMLAttributes } from 'react';
|
|
2
|
-
import createComponent, { Component, Merge, sstyled, Root } from '@semcore/core';
|
|
3
|
-
import { Box } from '@semcore/flex-box';
|
|
4
|
-
import { ITextProps, Text } from '@semcore/typography';
|
|
5
|
-
// eslint-disable-next-line import/no-named-as-default
|
|
6
|
-
import Tooltip from '@semcore/tooltip';
|
|
7
|
-
import InfoXS from '@semcore/icon/lib/Info/xs';
|
|
8
|
-
|
|
9
|
-
import style from './style/card.shadow.css';
|
|
10
|
-
|
|
11
|
-
export interface ITitleProps extends ITextProps {
|
|
12
|
-
/**
|
|
13
|
-
* Tooltip text
|
|
14
|
-
*/
|
|
15
|
-
hint?: React.ReactNode;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
class Card extends Component {
|
|
19
|
-
static displayName = 'Card';
|
|
20
|
-
|
|
21
|
-
static style = style;
|
|
22
|
-
|
|
23
|
-
render() {
|
|
24
|
-
const SCard = Root;
|
|
25
|
-
const { styles } = this.asProps;
|
|
26
|
-
|
|
27
|
-
return sstyled(styles)(<SCard render={Box} p={6} />);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function Title(props) {
|
|
32
|
-
const { styles, hint } = props;
|
|
33
|
-
const STitle = Root;
|
|
34
|
-
const SIcon = InfoXS;
|
|
35
|
-
return sstyled(styles)(
|
|
36
|
-
<>
|
|
37
|
-
<STitle render={Text} />
|
|
38
|
-
{hint && (
|
|
39
|
-
<Tooltip title={hint}>
|
|
40
|
-
<SIcon />
|
|
41
|
-
</Tooltip>
|
|
42
|
-
)}
|
|
43
|
-
</>,
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function Description(props) {
|
|
48
|
-
const { styles } = props;
|
|
49
|
-
const SDescription = Root;
|
|
50
|
-
return sstyled(styles)(<SDescription render={Text} tag="p" />);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export default createComponent<
|
|
54
|
-
ComponentProps<typeof Box>,
|
|
55
|
-
{
|
|
56
|
-
Title: Merge<ITitleProps, HTMLAttributes<HTMLSpanElement>>;
|
|
57
|
-
Description: ComponentProps<typeof Text>;
|
|
58
|
-
}
|
|
59
|
-
>(Card, {
|
|
60
|
-
Title,
|
|
61
|
-
Description,
|
|
62
|
-
});
|