intelicoreact 0.3.6 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.js +54 -0
- package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.scss +19 -0
- package/dist/Atomic/FormElements/SwitchableRow/partial/AnyOuterClass.scss +18 -0
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.js +89 -0
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.scss +85 -0
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/partial/AnyOuterClass.scss +76 -0
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/partial/constructor.js +39 -0
- package/package.json +1 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.default = void 0;
|
|
11
|
+
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
+
|
|
14
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
+
|
|
16
|
+
var _Switcher = _interopRequireDefault(require("../Switcher/Switcher"));
|
|
17
|
+
|
|
18
|
+
require("./SwitchableRow.scss");
|
|
19
|
+
|
|
20
|
+
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); }
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
var RC_default = 'switchable-row';
|
|
25
|
+
|
|
26
|
+
var SwitchableRow = function SwitchableRow(props) {
|
|
27
|
+
var _ref = props || {},
|
|
28
|
+
_ref$RC = _ref.RC,
|
|
29
|
+
RC = _ref$RC === void 0 ? RC_default : _ref$RC,
|
|
30
|
+
className = _ref.className,
|
|
31
|
+
children = _ref.children,
|
|
32
|
+
isActive = _ref.isActive,
|
|
33
|
+
setIsActive = _ref.setIsActive,
|
|
34
|
+
switcherLabel = _ref.switcherLabel,
|
|
35
|
+
isSwitcherLabelBold = _ref.isSwitcherLabelBold,
|
|
36
|
+
testId = _ref.testId,
|
|
37
|
+
id = _ref.id;
|
|
38
|
+
|
|
39
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
40
|
+
className: (0, _classnames.default)(RC, className),
|
|
41
|
+
"data-testid": "".concat(RC, "-").concat(testId)
|
|
42
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
43
|
+
className: (0, _classnames.default)("".concat(RC, "__cell"))
|
|
44
|
+
}, /*#__PURE__*/_react.default.createElement(_Switcher.default, {
|
|
45
|
+
isActive: isActive,
|
|
46
|
+
onChange: setIsActive,
|
|
47
|
+
isLabelBold: isSwitcherLabelBold,
|
|
48
|
+
label: switcherLabel,
|
|
49
|
+
"data-testid": "switchable-row-".concat(testId, "-switcher")
|
|
50
|
+
})), children);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
var _default = SwitchableRow;
|
|
54
|
+
exports.default = _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
@import "../../../scss/vars";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
.switchable-row {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-flow: row nowrap;
|
|
7
|
+
justify-content: flex-start;
|
|
8
|
+
align-items: center;
|
|
9
|
+
|
|
10
|
+
&__cell {
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
height: 100%;
|
|
13
|
+
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-flow: row nowrap;
|
|
16
|
+
justify-content: flex-start;
|
|
17
|
+
align-items: center;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
@import url('https://fonts.googleapis.com/css2?family=Sarabun&display=swap');
|
|
2
|
+
|
|
3
|
+
.any-outer-class__switchable-row {
|
|
4
|
+
height: 40px;
|
|
5
|
+
|
|
6
|
+
.switchable-row__cell {
|
|
7
|
+
width: calc((100% - 200px)/3);
|
|
8
|
+
padding: 8px 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.switchable-row__cell:first-of-type {
|
|
12
|
+
width: 200px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.switchable-row__cell>div {
|
|
16
|
+
width: 90%;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
|
|
16
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
|
+
|
|
18
|
+
require("./WidgetWithSwitchableRows.scss");
|
|
19
|
+
|
|
20
|
+
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; }
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
var RC = 'widget-with-switchable-rows';
|
|
25
|
+
|
|
26
|
+
var WidgetWithSwitchableRows = function WidgetWithSwitchableRows(props) {
|
|
27
|
+
var _ref = props || {},
|
|
28
|
+
className = _ref.className,
|
|
29
|
+
title = _ref.title,
|
|
30
|
+
rightHeaderContent = _ref.rightHeaderContent,
|
|
31
|
+
columns = _ref.columns,
|
|
32
|
+
rows = _ref.rows,
|
|
33
|
+
CellComponent = _ref.CellComponent,
|
|
34
|
+
_onChange = _ref.onChange;
|
|
35
|
+
|
|
36
|
+
var preperedColumns = [_objectSpread(_objectSpread({}, columns[0]), {}, {
|
|
37
|
+
key: 'isActive',
|
|
38
|
+
type: 'switcher'
|
|
39
|
+
})].concat((0, _toConsumableArray2.default)(columns.slice(1)));
|
|
40
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
41
|
+
className: (0, _classnames.default)(RC, className)
|
|
42
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
43
|
+
className: (0, _classnames.default)("".concat(RC, "__header"))
|
|
44
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
45
|
+
className: (0, _classnames.default)("".concat(RC, "__title-block"))
|
|
46
|
+
}, title), /*#__PURE__*/_react.default.createElement("div", {
|
|
47
|
+
className: (0, _classnames.default)("".concat(RC, "__right-header-content-block"))
|
|
48
|
+
}, rightHeaderContent)), /*#__PURE__*/_react.default.createElement("div", {
|
|
49
|
+
className: (0, _classnames.default)("".concat(RC, "__body"))
|
|
50
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
51
|
+
className: (0, _classnames.default)("".concat(RC, "__thead"))
|
|
52
|
+
}, preperedColumns.map(function (field) {
|
|
53
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
54
|
+
key: field.key,
|
|
55
|
+
className: (0, _classnames.default)("".concat(RC, "__thead-cell"), field.theadCellClassName, field.columnClassName, (0, _defineProperty2.default)({}, "".concat(RC, "__thead-cell_reqiured"), field.isRequired)),
|
|
56
|
+
"data-key": field.key
|
|
57
|
+
}, field.label);
|
|
58
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
59
|
+
className: (0, _classnames.default)("".concat(RC, "__table"))
|
|
60
|
+
}, rows.map(function (row) {
|
|
61
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
62
|
+
key: row.id,
|
|
63
|
+
className: (0, _classnames.default)("".concat(RC, "__row")),
|
|
64
|
+
"data-id": row.id
|
|
65
|
+
}, preperedColumns.map(function (cell) {
|
|
66
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
67
|
+
key: "".concat(row.id, "-").concat(cell.key),
|
|
68
|
+
className: (0, _classnames.default)("".concat(RC, "__cell"), cell.cellClassName, cell.columnClassName)
|
|
69
|
+
}, /*#__PURE__*/_react.default.createElement(CellComponent, {
|
|
70
|
+
field: _objectSpread(_objectSpread({}, cell), {}, {
|
|
71
|
+
value: row[cell.key],
|
|
72
|
+
rowData: row
|
|
73
|
+
}, cell.key === 'isActive' ? {
|
|
74
|
+
disabled: cell.disabled,
|
|
75
|
+
label: row.label
|
|
76
|
+
} : {
|
|
77
|
+
disabled: !row.isActive,
|
|
78
|
+
label: cell.label
|
|
79
|
+
}),
|
|
80
|
+
onChange: function onChange(val) {
|
|
81
|
+
return _onChange(val, cell.key, row.id);
|
|
82
|
+
}
|
|
83
|
+
}));
|
|
84
|
+
}));
|
|
85
|
+
}))));
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
var _default = WidgetWithSwitchableRows;
|
|
89
|
+
exports.default = _default;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
@import "../../../scss/vars";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
.widget-with-switchable-rows {
|
|
5
|
+
--row-height: 44px;
|
|
6
|
+
--thead-height: 20px;
|
|
7
|
+
--grid-template-columns: 1fr 1fr 1fr;
|
|
8
|
+
|
|
9
|
+
background-color: #FFFFFF;
|
|
10
|
+
border-radius: 3px;
|
|
11
|
+
border: 1px solid #E2E5EC;
|
|
12
|
+
|
|
13
|
+
&__header {
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
height: var(--row-height);
|
|
16
|
+
padding: 12px 16px 12px 16px;
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-flow: row nowrap;
|
|
19
|
+
justify-content: space-between;
|
|
20
|
+
align-items: center;
|
|
21
|
+
border-bottom: 1px solid #E2E5EC;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&__title-block,
|
|
25
|
+
&__right-header-content-block {
|
|
26
|
+
width: fit-content;
|
|
27
|
+
height: 100%;
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-flow: row nowrap;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
align-items: center;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&__body {
|
|
35
|
+
padding: 8px 16px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&__thead {
|
|
39
|
+
box-sizing: border-box;
|
|
40
|
+
height: var(--thead-height);
|
|
41
|
+
display: grid;
|
|
42
|
+
grid-template-columns: var(--grid-template-columns);
|
|
43
|
+
|
|
44
|
+
&-cell {
|
|
45
|
+
text-align: right;
|
|
46
|
+
text-transform: uppercase;
|
|
47
|
+
|
|
48
|
+
&:first-of-type {
|
|
49
|
+
text-align: left;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&_reqiured {
|
|
53
|
+
&::after {
|
|
54
|
+
content: '*';
|
|
55
|
+
color: red;
|
|
56
|
+
margin-left: 3px;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&__row {
|
|
63
|
+
box-sizing: border-box;
|
|
64
|
+
height: var(--row-height);
|
|
65
|
+
padding: 8px 0;
|
|
66
|
+
display: grid;
|
|
67
|
+
grid-template-columns: var(--grid-template-columns);
|
|
68
|
+
border-bottom: 1px solid #EBEFF2;
|
|
69
|
+
|
|
70
|
+
&:last-of-type {
|
|
71
|
+
border-bottom: none;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&__cell {
|
|
76
|
+
display: flex;
|
|
77
|
+
flex-flow: row nowrap;
|
|
78
|
+
justify-content: flex-end;
|
|
79
|
+
align-items: center;
|
|
80
|
+
|
|
81
|
+
&:first-of-type {
|
|
82
|
+
justify-content: flex-start;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap');
|
|
2
|
+
|
|
3
|
+
.any-outer-class__widget-with-switchable-rows {
|
|
4
|
+
&.widget-with-switchable-rows {
|
|
5
|
+
--grid-template-columns: 40% repeat(2, 1fr);
|
|
6
|
+
width: 565px;
|
|
7
|
+
|
|
8
|
+
border-radius: 6px;
|
|
9
|
+
box-shadow: 0px 0.7px 2px rgba(60, 77, 106, 0.1), 0px 1.9px 2px rgba(60, 77, 106, 0.07), 0px 4.5px 6px rgba(60, 77, 106, 0.05);
|
|
10
|
+
border: none;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.widget-with-switchable-rows__title-block {
|
|
14
|
+
font-family: 'Roboto';
|
|
15
|
+
font-style: normal;
|
|
16
|
+
font-weight: 500;
|
|
17
|
+
font-size: 13px;
|
|
18
|
+
line-height: 20px;
|
|
19
|
+
color: #1E1E2D;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.widget-with-switchable-rows__thead-cell {
|
|
23
|
+
font-family: 'Roboto';
|
|
24
|
+
font-style: normal;
|
|
25
|
+
font-weight: 400;
|
|
26
|
+
font-size: 10px;
|
|
27
|
+
line-height: 20px;
|
|
28
|
+
color: #9AA0B9;
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.widget-with-switchable-rows__cell {
|
|
34
|
+
.input__wrap {
|
|
35
|
+
width: 60px;
|
|
36
|
+
background: #F7FAFC;
|
|
37
|
+
border: 1px solid #E2E5EC;
|
|
38
|
+
border-radius: 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.input {
|
|
42
|
+
font-family: 'Roboto';
|
|
43
|
+
font-style: normal;
|
|
44
|
+
font-weight: 300;
|
|
45
|
+
font-size: 13px;
|
|
46
|
+
line-height: 20px;
|
|
47
|
+
color: #1E1E2D;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.switcher__button-content_active {
|
|
51
|
+
background-color: #2680C1;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.switcher__label {
|
|
55
|
+
font-family: 'Roboto';
|
|
56
|
+
font-style: normal;
|
|
57
|
+
font-weight: 400;
|
|
58
|
+
font-size: 13px;
|
|
59
|
+
line-height: 20px;
|
|
60
|
+
color: #1E1E2D;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
.delete-icon {
|
|
68
|
+
width: 16px;
|
|
69
|
+
height: 16px;
|
|
70
|
+
display: flex;
|
|
71
|
+
flex-flow: row nowrap;
|
|
72
|
+
justify-content: center;
|
|
73
|
+
align-items: center;
|
|
74
|
+
cursor: pointer;
|
|
75
|
+
color: red;
|
|
76
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var constructor = [// первый элемент относится к свитчеру, можно пробросить доп. пропы
|
|
8
|
+
// невозможно сменить ключ и тип (ключ - isActive, тип - switcher)
|
|
9
|
+
// label применится к шапке таблички, но в самих строках label свитчера - это label строки
|
|
10
|
+
{
|
|
11
|
+
label: 'lender',
|
|
12
|
+
cellClassName: ''
|
|
13
|
+
}, {
|
|
14
|
+
key: 'key1',
|
|
15
|
+
label: 'Transaction Fee split, %',
|
|
16
|
+
isRequired: true,
|
|
17
|
+
theadCellClassName: '',
|
|
18
|
+
cellClassName: '',
|
|
19
|
+
columnClassName: '',
|
|
20
|
+
onlyNumbers: {
|
|
21
|
+
type: 'float',
|
|
22
|
+
decimalPlaces: 2
|
|
23
|
+
}
|
|
24
|
+
}, {
|
|
25
|
+
key: 'key2',
|
|
26
|
+
label: 'Revenue Share split, %',
|
|
27
|
+
isRequired: true,
|
|
28
|
+
theadCellClassName: '',
|
|
29
|
+
cellClassName: '',
|
|
30
|
+
columnClassName: '',
|
|
31
|
+
onlyNumbers: {
|
|
32
|
+
type: 'float',
|
|
33
|
+
decimalPlaces: 2
|
|
34
|
+
},
|
|
35
|
+
min: 0,
|
|
36
|
+
max: 50
|
|
37
|
+
}];
|
|
38
|
+
var _default = constructor;
|
|
39
|
+
exports.default = _default;
|