@semcore/card 2.2.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 ADDED
@@ -0,0 +1,112 @@
1
+ # Changelog
2
+
3
+ CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
4
+
5
+ ## [2.2.2] - 2021-9-20
6
+
7
+ ### Fixed
8
+
9
+ - Fixed padding
10
+
11
+ ## [2.2.1] - 2021-8-26
12
+
13
+ ### Changed
14
+
15
+ - Add 'sideEffect=false' for more optimal build via webpack
16
+
17
+ ## [2.2.0] - 2021-04-26
18
+
19
+ ### Changed
20
+
21
+ - Version of dependence `@semcore/core` has been changed to `1.11`.
22
+ - Improved performance. Removed one component wrapper.
23
+ - The style processing system has been changed.
24
+ - Removed the ability to apply media styles via a plugin `babel-plugin-react-semcore`.
25
+
26
+ ## [2.1.0] - 2020-12-17
27
+
28
+ ### Added
29
+
30
+ - Added supported react@17.
31
+
32
+ ## [2.0.3] - 2020-10-29
33
+
34
+ ### Fixed
35
+
36
+ - Added the placeholder for ID style tag to improve collision protection.
37
+
38
+ ## [2.0.2] - 2020-09-08
39
+
40
+ ### Fixed
41
+
42
+ - Fixed possible styles collisions between components with different versions, but same styles
43
+
44
+ ## [2.0.1] - 2020-06-10
45
+
46
+ ### Fixed
47
+
48
+ - Исправлены TS типы
49
+
50
+ ## [2.0.0] - 2020-06-08
51
+
52
+ ### BREAK
53
+
54
+ - Изменения описаны в [migration guide](/internal/migration-guide)
55
+
56
+ ## [1.2.3] - 2020-04-07
57
+
58
+ ### Fixed
59
+
60
+ - Исправлено поведение при котором отображалась иконка и тултип при пустом `hint`.
61
+
62
+ ## [1.2.2] - 2020-03-23
63
+
64
+ ### Fixed
65
+
66
+ - Исправлена проблема в установке произвольного className в `Description` и `Title`.
67
+
68
+ ## [1.2.1] - 2020-03-06
69
+
70
+ ### Added
71
+
72
+ - Добавили средную жирность для начертания шрифта в компоненте `Card.Title` (`font-weigth: 500`)
73
+
74
+ ## [1.2.0] - 2020-02-13
75
+
76
+ ### Added
77
+
78
+ - Добавились компоненты `Card.Title` и `Card.Description`
79
+
80
+ ## [1.1.0] - 2019-12-12
81
+
82
+ ### Added
83
+
84
+ - Появилась возможность добавления различных стилистических тем через css переменные
85
+ - Появилась возможность оптицонально подключать адаптивноссть
86
+ - Появилась возможность изолировать стили даже в пределах одной страницы
87
+
88
+ ### Changed
89
+
90
+ - Изменен алгоритм вставки стилей в head
91
+
92
+ ### Removed
93
+
94
+ - Убраны относительные единицы измерения(rem), которые использовались для адаптивности
95
+
96
+ ## [1.0.4] - 2019-09-30
97
+
98
+ ### Fixed
99
+
100
+ - Исправлены ts типы
101
+
102
+ ## [1.0.3] - 2019-09-30
103
+
104
+ ### Changed
105
+
106
+ - Нужные зависимости перенесены в `utils`, размер должен стать меньше
107
+
108
+ ## [1.0.0] - 2018-03-13
109
+
110
+ ### Added
111
+
112
+ - Initial release
package/README.md ADDED
File without changes
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
+
5
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports["default"] = void 0;
11
+
12
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
+
14
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
+
16
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
17
+
18
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
19
+
20
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
21
+
22
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
23
+
24
+ var _core = _interopRequireWildcard(require("@semcore/core"));
25
+
26
+ var _react = _interopRequireDefault(require("react"));
27
+
28
+ var _flexBox = require("@semcore/flex-box");
29
+
30
+ var _typography = require("@semcore/typography");
31
+
32
+ var _tooltip = _interopRequireDefault(require("@semcore/tooltip"));
33
+
34
+ var _xs = _interopRequireDefault(require("@semcore/icon/lib/Info/xs"));
35
+
36
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
37
+
38
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
39
+
40
+ 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
+
42
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
43
+
44
+ /*__reshadow-styles__:"./style/card.shadow.css"*/
45
+ var style = (
46
+ /*__reshadow_css_start__*/
47
+ _core.sstyled.insert(
48
+ /*__inner_css_start__*/
49
+ ".___SCard_30o7x_gg_{border:1px solid #ccc;border-radius:2px;padding:20px 24px 24px}.___STitle_30o7x_gg_{font-size:19px;font-weight:500}.___SIcon_30o7x_gg_{margin-left:4px;color:#a6b0b3;cursor:help}.___SDescription_30o7x_gg_{margin-bottom:12px;font-size:14px;color:#757575}"
50
+ /*__inner_css_end__*/
51
+ , "3hx1s_gg_")
52
+ /*__reshadow_css_end__*/
53
+ , {
54
+ "__SCard": "___SCard_30o7x_gg_",
55
+ "__STitle": "___STitle_30o7x_gg_",
56
+ "__SIcon": "___SIcon_30o7x_gg_",
57
+ "__SDescription": "___SDescription_30o7x_gg_"
58
+ });
59
+
60
+ var Card = /*#__PURE__*/function (_Component) {
61
+ (0, _inherits2["default"])(Card, _Component);
62
+
63
+ var _super = _createSuper(Card);
64
+
65
+ function Card() {
66
+ (0, _classCallCheck2["default"])(this, Card);
67
+ return _super.apply(this, arguments);
68
+ }
69
+
70
+ (0, _createClass2["default"])(Card, [{
71
+ key: "render",
72
+ value: function render() {
73
+ var _ref = this ? this.asProps : arguments[0],
74
+ _ref4;
75
+
76
+ var SCard = _flexBox.Box;
77
+ var styles = this.asProps.styles;
78
+ return _ref4 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SCard, _ref4.cn("SCard", _objectSpread({}, (0, _core.assignProps)({}, _ref))));
79
+ }
80
+ }]);
81
+ return Card;
82
+ }(_core.Component);
83
+
84
+ (0, _defineProperty2["default"])(Card, "displayName", 'Card');
85
+ (0, _defineProperty2["default"])(Card, "style", style);
86
+
87
+ function Title(props) {
88
+ var _ref2 = this ? this.asProps : arguments[0],
89
+ _ref5;
90
+
91
+ var styles = props.styles,
92
+ hint = props.hint;
93
+ var STitle = _typography.Text;
94
+ var SIcon = _xs["default"];
95
+ return _ref5 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(STitle, _ref5.cn("STitle", _objectSpread({}, (0, _core.assignProps)({}, _ref2)))), hint && /*#__PURE__*/_react["default"].createElement(_tooltip["default"], _ref5.cn("Tooltip", {
96
+ "title": hint
97
+ }), /*#__PURE__*/_react["default"].createElement(SIcon, _ref5.cn("SIcon", {}))));
98
+ }
99
+
100
+ function Description(props) {
101
+ var _ref3 = this ? this.asProps : arguments[0],
102
+ _ref6;
103
+
104
+ var styles = props.styles;
105
+ var SDescription = _typography.Text;
106
+ return _ref6 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SDescription, _ref6.cn("SDescription", _objectSpread({}, (0, _core.assignProps)({
107
+ "tag": "p"
108
+ }, _ref3))));
109
+ }
110
+
111
+ var _default = (0, _core["default"])(Card, {
112
+ Title: Title,
113
+ Description: Description
114
+ });
115
+
116
+ exports["default"] = _default;
117
+ //# sourceMappingURL=Card.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/Card.tsx"],"names":["Card","SCard","Box","styles","asProps","Component","style","Title","props","hint","STitle","Text","SIcon","InfoXS","Description","SDescription"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;;AADA;;AAEA;;AACA;;AAEA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;IAWMA,I;;;;;;;;;;;;WAKJ,kBAAS;AAAA;AAAA;;AACP,UAAMC,KAAK,GAG2BC,YAHtC;AADO,UAECC,MAFD,GAEY,KAAKC,OAFjB,CAECD,MAFD;AAIP,qBAAO,mBAAQA,MAAR,CAAP,eAAuB,gCAAC,KAAD,yEAAvB;AACD;;;EAVgBE,e;;iCAAbL,I,iBACiB,M;iCADjBA,I,WAGWM,K;;AAUjB,SAASC,KAAT,CAAeC,KAAf,EAAsB;AAAA;AAAA;;AAAA,MACZL,MADY,GACKK,KADL,CACZL,MADY;AAAA,MACJM,IADI,GACKD,KADL,CACJC,IADI;AAEpB,MAAMC,MAAM,GAIQC,gBAJpB;AACA,MAAMC,KAAK,GAAGC,cAAd;AACA,iBAAO,mBAAQV,MAAR,CAAP,eACE,+EACE,gCAAC,MAAD,2EADF,EAEGM,IAAI,iBACH,gCAAC,mBAAD;AAAA,aAAgBA;AAAhB,mBACE,gCAAC,KAAD,wBADF,CAHJ,CADF;AAUD;;AAED,SAASK,WAAT,CAAqBN,KAArB,EAA4B;AAAA;AAAA;;AAAA,MAClBL,MADkB,GACPK,KADO,CAClBL,MADkB;AAE1B,MAAMY,YAAY,GAC2BJ,gBAD7C;AACA,iBAAO,mBAAQR,MAAR,CAAP,eAAuB,gCAAC,YAAD;AAAA,WAAgC;AAAhC,cAAvB;AACD;;eAEc,sBAMbH,IANa,EAMP;AACNO,EAAAA,KAAK,EAALA,KADM;AAENO,EAAAA,WAAW,EAAXA;AAFM,CANO,C","sourcesContent":["import React, { ComponentProps, HTMLAttributes } from 'react';\nimport createComponent, { Component, Merge, sstyled, Root } from '@semcore/core';\nimport { Box } from '@semcore/flex-box';\nimport { ITextProps, Text } from '@semcore/typography';\n// eslint-disable-next-line import/no-named-as-default\nimport Tooltip from '@semcore/tooltip';\nimport InfoXS from '@semcore/icon/lib/Info/xs';\n\nimport style from './style/card.shadow.css';\n\nexport interface ITitleProps extends ITextProps {\n /**\n * Tooltip text\n */\n hint?: React.ReactNode;\n}\n\nclass Card extends Component {\n static displayName = 'Card';\n\n static style = style;\n\n render() {\n const SCard = Root;\n const { styles } = this.asProps;\n\n return sstyled(styles)(<SCard render={Box} />);\n }\n}\n\nfunction Title(props) {\n const { styles, hint } = props;\n const STitle = Root;\n const SIcon = InfoXS;\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\nexport default createComponent<\n ComponentProps<typeof Box>,\n {\n Title: Merge<ITitleProps, HTMLAttributes<HTMLSpanElement>>;\n Description: ComponentProps<typeof Text>;\n }\n>(Card, {\n Title,\n Description,\n});\n"],"file":"Card.js"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ var _exportNames = {};
9
+ Object.defineProperty(exports, "default", {
10
+ enumerable: true,
11
+ get: function get() {
12
+ return _Card["default"];
13
+ }
14
+ });
15
+
16
+ var _Card = _interopRequireWildcard(require("./Card"));
17
+
18
+ Object.keys(_Card).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
21
+ if (key in exports && exports[key] === _Card[key]) return;
22
+ Object.defineProperty(exports, key, {
23
+ enumerable: true,
24
+ get: function get() {
25
+ return _Card[key];
26
+ }
27
+ });
28
+ });
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/index.tsx"],"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"}
@@ -0,0 +1,24 @@
1
+ @import '@semcore/utils/style/var.css';
2
+
3
+ SCard {
4
+ border: 1px solid var(--gray80);
5
+ border-radius: 2px;
6
+ padding: 20px 24px 24px;
7
+ }
8
+
9
+ STitle {
10
+ font-size: var(--fs-400);
11
+ font-weight: 500;
12
+ }
13
+
14
+ SIcon {
15
+ margin-left: 4px;
16
+ color: var(--stone);
17
+ cursor: help;
18
+ }
19
+
20
+ SDescription {
21
+ margin-bottom: 12px;
22
+ font-size: var(--fs-200);
23
+ color: var(--gray60);
24
+ }
@@ -0,0 +1,102 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/createClass";
3
+ import _inherits from "@babel/runtime/helpers/inherits";
4
+ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
+ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
7
+ import { sstyled as _sstyled } from "@semcore/core";
8
+ import { assignProps as _assignProps3 } from "@semcore/core";
9
+ import { assignProps as _assignProps2 } from "@semcore/core";
10
+ import { assignProps as _assignProps } from "@semcore/core";
11
+
12
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
13
+
14
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
15
+
16
+ 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
+
18
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
19
+
20
+ import React from 'react';
21
+ import createComponent, { Component, sstyled, Root } from '@semcore/core';
22
+ import { Box } from '@semcore/flex-box';
23
+ import { Text } from '@semcore/typography'; // eslint-disable-next-line import/no-named-as-default
24
+
25
+ import Tooltip from '@semcore/tooltip';
26
+ import InfoXS from '@semcore/icon/lib/Info/xs';
27
+
28
+ /*__reshadow-styles__:"./style/card.shadow.css"*/
29
+ var style = (
30
+ /*__reshadow_css_start__*/
31
+ _sstyled.insert(
32
+ /*__inner_css_start__*/
33
+ ".___SCard_30o7x_gg_{border:1px solid #ccc;border-radius:2px;padding:20px 24px 24px}.___STitle_30o7x_gg_{font-size:19px;font-weight:500}.___SIcon_30o7x_gg_{margin-left:4px;color:#a6b0b3;cursor:help}.___SDescription_30o7x_gg_{margin-bottom:12px;font-size:14px;color:#757575}"
34
+ /*__inner_css_end__*/
35
+ , "3hx1s_gg_")
36
+ /*__reshadow_css_end__*/
37
+ , {
38
+ "__SCard": "___SCard_30o7x_gg_",
39
+ "__STitle": "___STitle_30o7x_gg_",
40
+ "__SIcon": "___SIcon_30o7x_gg_",
41
+ "__SDescription": "___SDescription_30o7x_gg_"
42
+ });
43
+
44
+ var Card = /*#__PURE__*/function (_Component) {
45
+ _inherits(Card, _Component);
46
+
47
+ var _super = _createSuper(Card);
48
+
49
+ function Card() {
50
+ _classCallCheck(this, Card);
51
+
52
+ return _super.apply(this, arguments);
53
+ }
54
+
55
+ _createClass(Card, [{
56
+ key: "render",
57
+ value: function render() {
58
+ var _ref = this ? this.asProps : arguments[0],
59
+ _ref4;
60
+
61
+ var SCard = Box;
62
+ var styles = this.asProps.styles;
63
+ return _ref4 = sstyled(styles), /*#__PURE__*/React.createElement(SCard, _ref4.cn("SCard", _objectSpread({}, _assignProps({}, _ref))));
64
+ }
65
+ }]);
66
+
67
+ return Card;
68
+ }(Component);
69
+
70
+ _defineProperty(Card, "displayName", 'Card');
71
+
72
+ _defineProperty(Card, "style", style);
73
+
74
+ function Title(props) {
75
+ var _ref2 = this ? this.asProps : arguments[0],
76
+ _ref5;
77
+
78
+ var styles = props.styles,
79
+ hint = props.hint;
80
+ var STitle = Text;
81
+ var SIcon = InfoXS;
82
+ return _ref5 = sstyled(styles), /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(STitle, _ref5.cn("STitle", _objectSpread({}, _assignProps2({}, _ref2)))), hint && /*#__PURE__*/React.createElement(Tooltip, _ref5.cn("Tooltip", {
83
+ "title": hint
84
+ }), /*#__PURE__*/React.createElement(SIcon, _ref5.cn("SIcon", {}))));
85
+ }
86
+
87
+ function Description(props) {
88
+ var _ref3 = this ? this.asProps : arguments[0],
89
+ _ref6;
90
+
91
+ var styles = props.styles;
92
+ var SDescription = Text;
93
+ return _ref6 = sstyled(styles), /*#__PURE__*/React.createElement(SDescription, _ref6.cn("SDescription", _objectSpread({}, _assignProps3({
94
+ "tag": "p"
95
+ }, _ref3))));
96
+ }
97
+
98
+ export default createComponent(Card, {
99
+ Title: Title,
100
+ Description: Description
101
+ });
102
+ //# sourceMappingURL=Card.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/Card.tsx"],"names":["React","createComponent","Component","sstyled","Root","Box","Text","Tooltip","InfoXS","Card","SCard","styles","asProps","style","Title","props","hint","STitle","SIcon","Description","SDescription"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,OAAOA,KAAP,MAAsD,OAAtD;AACA,OAAOC,eAAP,IAA0BC,SAA1B,EAA4CC,OAA5C,EAAqDC,IAArD,QAAiE,eAAjE;AACA,SAASC,GAAT,QAAoB,mBAApB;AACA,SAAqBC,IAArB,QAAiC,qBAAjC,C,CACA;;AACA,OAAOC,OAAP,MAAoB,kBAApB;AACA,OAAOC,MAAP,MAAmB,2BAAnB;;;;;;;;;;;;;;;;;;IAWMC,I;;;;;;;;;;;;;WAKJ,kBAAS;AAAA;AAAA;;AACP,UAAMC,KAAK,GAG2BL,GAHtC;AADO,UAECM,MAFD,GAEY,KAAKC,OAFjB,CAECD,MAFD;AAIP,qBAAOR,OAAO,CAACQ,MAAD,CAAd,eAAuB,oBAAC,KAAD,+DAAvB;AACD;;;;EAVgBT,S;;gBAAbO,I,iBACiB,M;;gBADjBA,I,WAGWI,K;;AAUjB,SAASC,KAAT,CAAeC,KAAf,EAAsB;AAAA;AAAA;;AAAA,MACZJ,MADY,GACKI,KADL,CACZJ,MADY;AAAA,MACJK,IADI,GACKD,KADL,CACJC,IADI;AAEpB,MAAMC,MAAM,GAIQX,IAJpB;AACA,MAAMY,KAAK,GAAGV,MAAd;AACA,iBAAOL,OAAO,CAACQ,MAAD,CAAd,eACE,uDACE,oBAAC,MAAD,kEADF,EAEGK,IAAI,iBACH,oBAAC,OAAD;AAAA,aAAgBA;AAAhB,mBACE,oBAAC,KAAD,wBADF,CAHJ,CADF;AAUD;;AAED,SAASG,WAAT,CAAqBJ,KAArB,EAA4B;AAAA;AAAA;;AAAA,MAClBJ,MADkB,GACPI,KADO,CAClBJ,MADkB;AAE1B,MAAMS,YAAY,GAC2Bd,IAD7C;AACA,iBAAOH,OAAO,CAACQ,MAAD,CAAd,eAAuB,oBAAC,YAAD;AAAA,WAAgC;AAAhC,cAAvB;AACD;;AAED,eAAeV,eAAe,CAM5BQ,IAN4B,EAMtB;AACNK,EAAAA,KAAK,EAALA,KADM;AAENK,EAAAA,WAAW,EAAXA;AAFM,CANsB,CAA9B","sourcesContent":["import React, { ComponentProps, HTMLAttributes } from 'react';\nimport createComponent, { Component, Merge, sstyled, Root } from '@semcore/core';\nimport { Box } from '@semcore/flex-box';\nimport { ITextProps, Text } from '@semcore/typography';\n// eslint-disable-next-line import/no-named-as-default\nimport Tooltip from '@semcore/tooltip';\nimport InfoXS from '@semcore/icon/lib/Info/xs';\n\nimport style from './style/card.shadow.css';\n\nexport interface ITitleProps extends ITextProps {\n /**\n * Tooltip text\n */\n hint?: React.ReactNode;\n}\n\nclass Card extends Component {\n static displayName = 'Card';\n\n static style = style;\n\n render() {\n const SCard = Root;\n const { styles } = this.asProps;\n\n return sstyled(styles)(<SCard render={Box} />);\n }\n}\n\nfunction Title(props) {\n const { styles, hint } = props;\n const STitle = Root;\n const SIcon = InfoXS;\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\nexport default createComponent<\n ComponentProps<typeof Box>,\n {\n Title: Merge<ITitleProps, HTMLAttributes<HTMLSpanElement>>;\n Description: ComponentProps<typeof Text>;\n }\n>(Card, {\n Title,\n Description,\n});\n"],"file":"Card.js"}
@@ -0,0 +1,3 @@
1
+ export { default } from './Card';
2
+ export * from './Card';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/index.tsx"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,QAAxB;AACA,cAAc,QAAd","sourcesContent":["export { default } from './Card';\nexport * from './Card';\n"],"file":"index.js"}
@@ -0,0 +1,24 @@
1
+ @import '@semcore/utils/style/var.css';
2
+
3
+ SCard {
4
+ border: 1px solid var(--gray80);
5
+ border-radius: 2px;
6
+ padding: 20px 24px 24px;
7
+ }
8
+
9
+ STitle {
10
+ font-size: var(--fs-400);
11
+ font-weight: 500;
12
+ }
13
+
14
+ SIcon {
15
+ margin-left: 4px;
16
+ color: var(--stone);
17
+ cursor: help;
18
+ }
19
+
20
+ SDescription {
21
+ margin-bottom: 12px;
22
+ font-size: var(--fs-200);
23
+ color: var(--gray60);
24
+ }
@@ -0,0 +1,16 @@
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;
@@ -0,0 +1,2 @@
1
+ export { default } from './Card';
2
+ export * from './Card';
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@semcore/card",
3
+ "description": "SEMRush Card Component",
4
+ "version": "2.2.2",
5
+ "main": "lib/cjs/index.js",
6
+ "module": "lib/es6/index.js",
7
+ "typings": "lib/types/index.d.ts",
8
+ "sideEffects": false,
9
+ "author": "Roman Lysov <r.lysov@semrush.com>",
10
+ "license": "MIT",
11
+ "scripts": {
12
+ "build": "build",
13
+ "test": "jest"
14
+ },
15
+ "dependencies": {
16
+ "@semcore/utils": "^3.15",
17
+ "@semcore/flex-box": "^4",
18
+ "@semcore/typography": "^3",
19
+ "@semcore/tooltip": "^4",
20
+ "@semcore/icon": "^2"
21
+ },
22
+ "peerDependencies": {
23
+ "@semcore/core": "^1.11",
24
+ "react": "16.8 - 17"
25
+ },
26
+ "jest": {
27
+ "preset": "jest-preset-ui"
28
+ }
29
+ }
package/src/Card.tsx ADDED
@@ -0,0 +1,62 @@
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} />);
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
+ });
package/src/index.tsx ADDED
@@ -0,0 +1,2 @@
1
+ export { default } from './Card';
2
+ export * from './Card';
@@ -0,0 +1,24 @@
1
+ @import '@semcore/utils/style/var.css';
2
+
3
+ SCard {
4
+ border: 1px solid var(--gray80);
5
+ border-radius: 2px;
6
+ padding: 20px 24px 24px;
7
+ }
8
+
9
+ STitle {
10
+ font-size: var(--fs-400);
11
+ font-weight: 500;
12
+ }
13
+
14
+ SIcon {
15
+ margin-left: 4px;
16
+ color: var(--stone);
17
+ cursor: help;
18
+ }
19
+
20
+ SDescription {
21
+ margin-bottom: 12px;
22
+ font-size: var(--fs-200);
23
+ color: var(--gray60);
24
+ }