@stokr/components-library 2.3.37 → 2.3.39-beta.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/dist/components/AdminDashboard/Table/ReactTable.js +3 -55
- package/dist/components/AdminDashboard/Table/ReactTable.stories.js +159 -22
- package/dist/components/AdminDashboard/Table/ReactTableWrapper.js +40 -14
- package/dist/components/Button/Button.stories.js +113 -30
- package/dist/components/Button/Button.styles.js +12 -6
- package/dist/components/Button/GlareButton.js +296 -0
- package/dist/components/Button/GlareButton.stories.js +137 -0
- package/dist/components/Footer/Footer.js +7 -6
- package/dist/components/Footer/Footer.styles.js +1 -1
- package/dist/components/Footer/FooterMenu.js +8 -3
- package/dist/components/Header/Header.js +9 -16
- package/dist/components/Header/Header.styles.js +1 -1
- package/dist/context/AuthContext.js +165 -113
- package/dist/styles/colors.js +1 -0
- package/dist/utils/km_ify.js +8 -0
- package/package.json +2 -1
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.ReactTable = ReactTable;
|
|
8
|
-
exports.default =
|
|
8
|
+
exports.default = void 0;
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _reactTable = require("react-table");
|
|
11
11
|
var _Table = require("./Table.styles");
|
|
@@ -14,6 +14,7 @@ var _PaginationControls = _interopRequireDefault(require("../../Pagination/Pagin
|
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
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); }
|
|
16
16
|
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; }
|
|
17
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
17
18
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18
19
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
19
20
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -25,59 +26,6 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
25
26
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
26
27
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
27
28
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
28
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
29
|
-
//This components is used only to memoize the values before we sent them to the react-table
|
|
30
|
-
var ReactTableWrapper = function ReactTableWrapper(props) {
|
|
31
|
-
var makeNewColumns = function makeNewColumns(data) {
|
|
32
|
-
return data === null || data === void 0 ? void 0 : data.map(function (column) {
|
|
33
|
-
if (column.key === 'dropdown') {
|
|
34
|
-
return {
|
|
35
|
-
Header: function Header() {
|
|
36
|
-
return null;
|
|
37
|
-
},
|
|
38
|
-
id: column.key,
|
|
39
|
-
Cell: function Cell(_ref) {
|
|
40
|
-
var row = _ref.row;
|
|
41
|
-
return (
|
|
42
|
-
/*#__PURE__*/
|
|
43
|
-
// Use Cell to render an expander for dropdown cell.
|
|
44
|
-
// We can use the getToggleRowExpandedProps prop-getter
|
|
45
|
-
// to build the expander. (moved to the whole row to make it easier to click)
|
|
46
|
-
_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement(_Table.TableDropdownIcon, {
|
|
47
|
-
isActive: row.isExpanded
|
|
48
|
-
}))
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
return {
|
|
54
|
-
Header: column.label,
|
|
55
|
-
accessor: column.key
|
|
56
|
-
//totalWidth: 50, // column.width,
|
|
57
|
-
};
|
|
58
|
-
});
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
var memoizedColumns = _react.default.useMemo(function () {
|
|
62
|
-
return makeNewColumns(props.columns);
|
|
63
|
-
}, []);
|
|
64
|
-
var memoizedData = _react.default.useMemo(function () {
|
|
65
|
-
return props.data;
|
|
66
|
-
}, []);
|
|
67
|
-
var memoizedSubColumns = _react.default.useMemo(function () {
|
|
68
|
-
return makeNewColumns(props.subColumns);
|
|
69
|
-
}, []);
|
|
70
|
-
return /*#__PURE__*/_react.default.createElement(ReactTable, _extends({
|
|
71
|
-
columns: memoizedColumns,
|
|
72
|
-
data: memoizedData,
|
|
73
|
-
subColumns: memoizedSubColumns,
|
|
74
|
-
blue: props.blue,
|
|
75
|
-
withSubTable: props.withSubTable,
|
|
76
|
-
calculateSubData: props.calculateSubData,
|
|
77
|
-
noPagination: props.noPagination
|
|
78
|
-
}, props));
|
|
79
|
-
};
|
|
80
|
-
exports.ReactTableWrapper = ReactTableWrapper;
|
|
81
29
|
function ReactTable(props) {
|
|
82
30
|
var columns = props.columns,
|
|
83
31
|
data = props.data,
|
|
@@ -178,5 +126,5 @@ ReactTable.defaultProps = {
|
|
|
178
126
|
withSubTable: false,
|
|
179
127
|
isSubTable: false
|
|
180
128
|
};
|
|
181
|
-
var _default =
|
|
129
|
+
var _default = ReactTable;
|
|
182
130
|
exports.default = _default;
|
|
@@ -3,41 +3,128 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = exports.WithCustomStyling = exports.Default = void 0;
|
|
6
|
+
exports.default = exports.WrapperWithSubTable = exports.WithoutPagination = exports.WithSubTable = exports.WithCustomStyling = exports.DefaultWrapper = exports.Default = exports.BlueWrapper = exports.BlueTable = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _ReactTable = require("./ReactTable");
|
|
9
|
+
var _ReactTableWrapper = require("./ReactTableWrapper");
|
|
9
10
|
var _global = _interopRequireDefault(require("../../../styles/global"));
|
|
10
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
13
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
16
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
17
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
11
18
|
var _default = {
|
|
12
19
|
title: 'Components Library/React table',
|
|
13
|
-
component: _ReactTable.ReactTable
|
|
20
|
+
component: _ReactTable.ReactTable,
|
|
21
|
+
parameters: {
|
|
22
|
+
docs: {
|
|
23
|
+
description: {
|
|
24
|
+
component: 'A flexible and customizable data table component with sorting, pagination, and custom styling options.'
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
argTypes: {
|
|
29
|
+
data: {
|
|
30
|
+
control: 'object'
|
|
31
|
+
},
|
|
32
|
+
columns: {
|
|
33
|
+
control: 'object'
|
|
34
|
+
},
|
|
35
|
+
noPagination: {
|
|
36
|
+
control: 'boolean'
|
|
37
|
+
},
|
|
38
|
+
blue: {
|
|
39
|
+
control: 'boolean'
|
|
40
|
+
},
|
|
41
|
+
withSubTable: {
|
|
42
|
+
control: 'boolean'
|
|
43
|
+
},
|
|
44
|
+
customTdStyles: {
|
|
45
|
+
control: 'function'
|
|
46
|
+
},
|
|
47
|
+
customThStyles: {
|
|
48
|
+
control: 'function'
|
|
49
|
+
}
|
|
50
|
+
}
|
|
14
51
|
}; // Sample columns and data for demonstration
|
|
15
52
|
exports.default = _default;
|
|
16
53
|
var columns = [{
|
|
17
54
|
Header: 'ID',
|
|
18
|
-
accessor: 'id'
|
|
55
|
+
accessor: 'id'
|
|
19
56
|
}, {
|
|
20
57
|
Header: 'Name',
|
|
21
58
|
accessor: 'name'
|
|
22
59
|
}, {
|
|
23
60
|
Header: 'Status',
|
|
24
61
|
accessor: 'status'
|
|
62
|
+
}, {
|
|
63
|
+
Header: '',
|
|
64
|
+
accessor: 'dropdown'
|
|
65
|
+
}];
|
|
66
|
+
var columnsWrapper = [{
|
|
67
|
+
label: 'ID',
|
|
68
|
+
key: 'id'
|
|
69
|
+
}, {
|
|
70
|
+
label: 'Name',
|
|
71
|
+
key: 'name'
|
|
72
|
+
}, {
|
|
73
|
+
label: 'Status',
|
|
74
|
+
key: 'status'
|
|
75
|
+
}, {
|
|
76
|
+
label: '',
|
|
77
|
+
key: 'dropdown'
|
|
78
|
+
}];
|
|
79
|
+
var subColumns = [{
|
|
80
|
+
Header: 'Detail ID',
|
|
81
|
+
accessor: 'detailId'
|
|
82
|
+
}, {
|
|
83
|
+
Header: 'Detail Name',
|
|
84
|
+
accessor: 'detailName'
|
|
85
|
+
}];
|
|
86
|
+
var subColumnsWrapper = [{
|
|
87
|
+
label: 'Detail ID',
|
|
88
|
+
key: 'detailId'
|
|
89
|
+
}, {
|
|
90
|
+
label: 'Detail Name',
|
|
91
|
+
key: 'detailName'
|
|
25
92
|
}];
|
|
26
93
|
var data = [{
|
|
27
94
|
id: 1,
|
|
28
95
|
name: 'Alice',
|
|
29
|
-
status: 'Active'
|
|
96
|
+
status: 'Active',
|
|
97
|
+
subData: [{
|
|
98
|
+
detailId: 101,
|
|
99
|
+
detailName: 'Detail A1'
|
|
100
|
+
}, {
|
|
101
|
+
detailId: 102,
|
|
102
|
+
detailName: 'Detail A2'
|
|
103
|
+
}]
|
|
30
104
|
}, {
|
|
31
105
|
id: 2,
|
|
32
106
|
name: 'Bob',
|
|
33
|
-
status: 'Inactive'
|
|
107
|
+
status: 'Inactive',
|
|
108
|
+
subData: [{
|
|
109
|
+
detailId: 201,
|
|
110
|
+
detailName: 'Detail B1'
|
|
111
|
+
}, {
|
|
112
|
+
detailId: 202,
|
|
113
|
+
detailName: 'Detail B2'
|
|
114
|
+
}]
|
|
34
115
|
}, {
|
|
35
116
|
id: 3,
|
|
36
117
|
name: 'Carol',
|
|
37
|
-
status: 'Active'
|
|
118
|
+
status: 'Active',
|
|
119
|
+
subData: []
|
|
120
|
+
}, {
|
|
121
|
+
id: 4,
|
|
122
|
+
name: 'Dave',
|
|
123
|
+
status: 'Pending',
|
|
124
|
+
subData: []
|
|
38
125
|
}];
|
|
39
126
|
|
|
40
|
-
// Custom styling
|
|
127
|
+
// Custom styling functions
|
|
41
128
|
var customTdStyles = function customTdStyles(index, row) {
|
|
42
129
|
if (index === 0) {
|
|
43
130
|
return {
|
|
@@ -51,32 +138,82 @@ var customTdStyles = function customTdStyles(index, row) {
|
|
|
51
138
|
backgroundColor: 'lightgray'
|
|
52
139
|
};
|
|
53
140
|
}
|
|
141
|
+
if (row.status === 'Pending') {
|
|
142
|
+
return {
|
|
143
|
+
backgroundColor: 'lightyellow'
|
|
144
|
+
};
|
|
145
|
+
}
|
|
54
146
|
return {}; // default style
|
|
55
147
|
};
|
|
56
148
|
|
|
57
|
-
// Custom styling function
|
|
58
149
|
var customThStyles = function customThStyles(column) {
|
|
59
150
|
return {
|
|
60
151
|
backgroundColor: 'lightblue'
|
|
61
|
-
};
|
|
152
|
+
};
|
|
62
153
|
};
|
|
63
154
|
|
|
155
|
+
// Function to calculate sub data
|
|
156
|
+
var calculateSubData = function calculateSubData(row) {
|
|
157
|
+
return row.original.subData || [];
|
|
158
|
+
};
|
|
64
159
|
var Template = function Template(args) {
|
|
65
160
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_global.default, null), /*#__PURE__*/_react.default.createElement(_ReactTable.ReactTable, args));
|
|
66
161
|
};
|
|
67
|
-
var
|
|
68
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
69
|
-
columns: columns,
|
|
70
|
-
data: data
|
|
71
|
-
});
|
|
162
|
+
var TemplateWrapper = function TemplateWrapper(args) {
|
|
163
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_global.default, null), /*#__PURE__*/_react.default.createElement(_ReactTableWrapper.ReactTableWrapper, args));
|
|
72
164
|
};
|
|
165
|
+
var Default = Template.bind({});
|
|
73
166
|
exports.Default = Default;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
167
|
+
Default.args = {
|
|
168
|
+
columns: columns,
|
|
169
|
+
data: data,
|
|
170
|
+
noPagination: false
|
|
171
|
+
};
|
|
172
|
+
var WithoutPagination = Template.bind({});
|
|
173
|
+
exports.WithoutPagination = WithoutPagination;
|
|
174
|
+
WithoutPagination.args = _objectSpread(_objectSpread({}, Default.args), {}, {
|
|
175
|
+
noPagination: true
|
|
176
|
+
});
|
|
177
|
+
var WithCustomStyling = Template.bind({});
|
|
178
|
+
exports.WithCustomStyling = WithCustomStyling;
|
|
179
|
+
WithCustomStyling.args = _objectSpread(_objectSpread({}, Default.args), {}, {
|
|
180
|
+
customTdStyles: customTdStyles,
|
|
181
|
+
customThStyles: customThStyles
|
|
182
|
+
});
|
|
183
|
+
var WithSubTable = Template.bind({});
|
|
184
|
+
exports.WithSubTable = WithSubTable;
|
|
185
|
+
WithSubTable.args = _objectSpread(_objectSpread({}, Default.args), {}, {
|
|
186
|
+
withSubTable: true,
|
|
187
|
+
subColumns: subColumns,
|
|
188
|
+
calculateSubData: calculateSubData
|
|
189
|
+
});
|
|
190
|
+
var BlueTable = Template.bind({});
|
|
191
|
+
exports.BlueTable = BlueTable;
|
|
192
|
+
BlueTable.args = _objectSpread(_objectSpread({}, Default.args), {}, {
|
|
193
|
+
blue: true
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
// Wrapper examples
|
|
197
|
+
var DefaultWrapper = TemplateWrapper.bind({});
|
|
198
|
+
exports.DefaultWrapper = DefaultWrapper;
|
|
199
|
+
DefaultWrapper.args = {
|
|
200
|
+
columns: columnsWrapper,
|
|
201
|
+
data: data,
|
|
202
|
+
noPagination: false
|
|
203
|
+
};
|
|
204
|
+
var WrapperWithSubTable = TemplateWrapper.bind({});
|
|
205
|
+
exports.WrapperWithSubTable = WrapperWithSubTable;
|
|
206
|
+
WrapperWithSubTable.args = {
|
|
207
|
+
columns: columnsWrapper,
|
|
208
|
+
data: data,
|
|
209
|
+
withSubTable: true,
|
|
210
|
+
subColumns: subColumnsWrapper,
|
|
211
|
+
calculateSubData: calculateSubData
|
|
81
212
|
};
|
|
82
|
-
|
|
213
|
+
var BlueWrapper = TemplateWrapper.bind({});
|
|
214
|
+
exports.BlueWrapper = BlueWrapper;
|
|
215
|
+
BlueWrapper.args = {
|
|
216
|
+
columns: columnsWrapper,
|
|
217
|
+
data: data,
|
|
218
|
+
blue: true
|
|
219
|
+
};
|
|
@@ -7,17 +7,23 @@ exports.default = exports.ReactTableWrapper = void 0;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _ReactTable = _interopRequireDefault(require("./ReactTable"));
|
|
9
9
|
var _Table = require("./Table.styles");
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
var _excluded = ["columns", "subColumns"];
|
|
10
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
13
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
14
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
15
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
16
|
+
//This components is used only to memoize the values before we sent them to the react-table
|
|
12
17
|
var ReactTableWrapper = function ReactTableWrapper(props) {
|
|
13
18
|
var makeNewColumns = function makeNewColumns(data) {
|
|
14
|
-
|
|
19
|
+
if (!data || !Array.isArray(data)) return [];
|
|
20
|
+
return data.map(function (column) {
|
|
15
21
|
if (column.key === 'dropdown' || column.accessor === 'dropdown') {
|
|
16
22
|
return {
|
|
17
23
|
Header: function Header() {
|
|
18
24
|
return null;
|
|
19
25
|
},
|
|
20
|
-
id: column.key,
|
|
26
|
+
id: column.key || column.accessor,
|
|
21
27
|
Cell: function Cell(_ref) {
|
|
22
28
|
var row = _ref.row;
|
|
23
29
|
return (
|
|
@@ -33,30 +39,50 @@ var ReactTableWrapper = function ReactTableWrapper(props) {
|
|
|
33
39
|
};
|
|
34
40
|
}
|
|
35
41
|
return {
|
|
36
|
-
Header: column.label,
|
|
37
|
-
accessor: column.key
|
|
42
|
+
Header: column.label || column.Header,
|
|
43
|
+
accessor: column.key || column.accessor
|
|
38
44
|
};
|
|
39
45
|
});
|
|
40
46
|
};
|
|
41
47
|
var memoizedColumns = _react.default.useMemo(function () {
|
|
42
48
|
return makeNewColumns(props.columns);
|
|
43
|
-
}, []);
|
|
49
|
+
}, [props.columns]);
|
|
44
50
|
var memoizedData = _react.default.useMemo(function () {
|
|
45
51
|
return props.data;
|
|
46
|
-
}, []);
|
|
52
|
+
}, [props.data]);
|
|
47
53
|
var memoizedSubColumns = _react.default.useMemo(function () {
|
|
48
|
-
return makeNewColumns(props.subColumns);
|
|
49
|
-
}, []);
|
|
54
|
+
return props.subColumns ? makeNewColumns(props.subColumns) : undefined;
|
|
55
|
+
}, [props.subColumns]);
|
|
56
|
+
|
|
57
|
+
// Create a new props object without the original columns and subColumns
|
|
58
|
+
var columns = props.columns,
|
|
59
|
+
subColumns = props.subColumns,
|
|
60
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
50
61
|
return /*#__PURE__*/_react.default.createElement(_ReactTable.default, _extends({
|
|
51
62
|
columns: memoizedColumns,
|
|
52
63
|
data: memoizedData,
|
|
53
|
-
subColumns: memoizedSubColumns
|
|
54
|
-
|
|
55
|
-
withSubTable: props.withSubTable,
|
|
56
|
-
calculateSubData: props.calculateSubData,
|
|
57
|
-
noPagination: props.noPagination
|
|
58
|
-
}, props));
|
|
64
|
+
subColumns: memoizedSubColumns
|
|
65
|
+
}, restProps));
|
|
59
66
|
};
|
|
60
67
|
exports.ReactTableWrapper = ReactTableWrapper;
|
|
68
|
+
ReactTableWrapper.propTypes = {
|
|
69
|
+
columns: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
70
|
+
key: _propTypes.default.string,
|
|
71
|
+
label: _propTypes.default.string
|
|
72
|
+
})).isRequired,
|
|
73
|
+
data: _propTypes.default.array.isRequired,
|
|
74
|
+
subColumns: _propTypes.default.array,
|
|
75
|
+
calculateSubData: _propTypes.default.func,
|
|
76
|
+
blue: _propTypes.default.bool,
|
|
77
|
+
noPagination: _propTypes.default.bool,
|
|
78
|
+
withSubTable: _propTypes.default.bool,
|
|
79
|
+
customTdStyles: _propTypes.default.func,
|
|
80
|
+
customThStyles: _propTypes.default.func
|
|
81
|
+
};
|
|
82
|
+
ReactTableWrapper.defaultProps = {
|
|
83
|
+
blue: false,
|
|
84
|
+
noPagination: false,
|
|
85
|
+
withSubTable: false
|
|
86
|
+
};
|
|
61
87
|
var _default = ReactTableWrapper;
|
|
62
88
|
exports.default = _default;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = exports.
|
|
6
|
+
exports.default = exports.WithMinWidth = exports.WithMargin = exports.WithBottomMargin = exports.Secondary = exports.Primary = exports.OutlineBlack = exports.Outline = exports.OnlyText = exports.Negative = exports.Fluid = exports.Disabled = exports.Centered = exports.ButtonGroup = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _Button = _interopRequireDefault(require("./Button.styles"));
|
|
9
9
|
var _ComponentWrapper = require("../ComponentWrapper/ComponentWrapper.styles");
|
|
@@ -15,56 +15,139 @@ var _default = {
|
|
|
15
15
|
title: 'Components Library/Buttons/Button',
|
|
16
16
|
component: _Button.default,
|
|
17
17
|
argTypes: {
|
|
18
|
+
children: {
|
|
19
|
+
control: 'text'
|
|
20
|
+
},
|
|
21
|
+
onClick: {
|
|
22
|
+
action: 'clicked'
|
|
23
|
+
},
|
|
18
24
|
secondary: {
|
|
19
|
-
|
|
20
|
-
defaultValue: false
|
|
25
|
+
control: 'boolean'
|
|
21
26
|
},
|
|
22
27
|
disabled: {
|
|
23
|
-
|
|
24
|
-
defaultValue: false
|
|
28
|
+
control: 'boolean'
|
|
25
29
|
},
|
|
26
30
|
negative: {
|
|
27
|
-
|
|
28
|
-
defaultValue: false
|
|
31
|
+
control: 'boolean'
|
|
29
32
|
},
|
|
30
33
|
center: {
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
control: 'boolean'
|
|
35
|
+
},
|
|
36
|
+
fluid: {
|
|
37
|
+
control: 'boolean'
|
|
38
|
+
},
|
|
39
|
+
outline: {
|
|
40
|
+
control: 'boolean'
|
|
41
|
+
},
|
|
42
|
+
outlineBlack: {
|
|
43
|
+
control: 'boolean'
|
|
44
|
+
},
|
|
45
|
+
onlyText: {
|
|
46
|
+
control: 'boolean'
|
|
47
|
+
},
|
|
48
|
+
minWidth: {
|
|
49
|
+
control: 'text'
|
|
50
|
+
},
|
|
51
|
+
marginTop: {
|
|
52
|
+
control: 'text'
|
|
53
|
+
},
|
|
54
|
+
marginRight: {
|
|
55
|
+
control: 'text'
|
|
56
|
+
},
|
|
57
|
+
withMarginBottom: {
|
|
58
|
+
control: 'boolean'
|
|
33
59
|
}
|
|
34
|
-
// outLine: { type: 'boolean', defaultValue: false },
|
|
35
|
-
// marginTop: { type: 'boolean', defaultValue: false },
|
|
36
|
-
// marginRight: { type: 'boolean', defaultValue: false },
|
|
37
60
|
}
|
|
38
61
|
};
|
|
39
62
|
exports.default = _default;
|
|
40
63
|
var Template = function Template(args) {
|
|
41
64
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_global.default, null), /*#__PURE__*/_react.default.createElement(_ComponentWrapper.ComponentWrapper, null, /*#__PURE__*/_react.default.createElement(_ButtonContainer.ButtonContainer, null, /*#__PURE__*/_react.default.createElement(_Button.default, args, "Button"))));
|
|
42
65
|
};
|
|
43
|
-
var
|
|
44
|
-
exports.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
66
|
+
var Primary = Template.bind({});
|
|
67
|
+
exports.Primary = Primary;
|
|
68
|
+
Primary.args = {
|
|
69
|
+
children: 'Primary Button'
|
|
70
|
+
};
|
|
71
|
+
var Secondary = Template.bind({});
|
|
72
|
+
exports.Secondary = Secondary;
|
|
73
|
+
Secondary.args = {
|
|
74
|
+
children: 'Secondary Button',
|
|
49
75
|
secondary: true
|
|
50
76
|
};
|
|
51
|
-
var
|
|
52
|
-
exports.
|
|
53
|
-
|
|
77
|
+
var Disabled = Template.bind({});
|
|
78
|
+
exports.Disabled = Disabled;
|
|
79
|
+
Disabled.args = {
|
|
80
|
+
children: 'Disabled Button',
|
|
54
81
|
disabled: true
|
|
55
82
|
};
|
|
56
|
-
var
|
|
57
|
-
exports.
|
|
58
|
-
|
|
83
|
+
var Negative = Template.bind({});
|
|
84
|
+
exports.Negative = Negative;
|
|
85
|
+
Negative.args = {
|
|
86
|
+
children: 'Negative Button',
|
|
59
87
|
negative: true
|
|
60
88
|
};
|
|
61
|
-
var
|
|
62
|
-
exports.
|
|
63
|
-
|
|
89
|
+
var Outline = Template.bind({});
|
|
90
|
+
exports.Outline = Outline;
|
|
91
|
+
Outline.args = {
|
|
92
|
+
children: 'Outline Button',
|
|
93
|
+
outline: true
|
|
94
|
+
};
|
|
95
|
+
var OutlineBlack = Template.bind({});
|
|
96
|
+
exports.OutlineBlack = OutlineBlack;
|
|
97
|
+
OutlineBlack.args = {
|
|
98
|
+
children: 'Outline Black Button',
|
|
99
|
+
outlineBlack: true
|
|
100
|
+
};
|
|
101
|
+
var OnlyText = Template.bind({});
|
|
102
|
+
exports.OnlyText = OnlyText;
|
|
103
|
+
OnlyText.args = {
|
|
104
|
+
children: 'Text Only Button',
|
|
105
|
+
onlyText: true
|
|
106
|
+
};
|
|
107
|
+
var Fluid = Template.bind({});
|
|
108
|
+
exports.Fluid = Fluid;
|
|
109
|
+
Fluid.args = {
|
|
110
|
+
children: 'Fluid Width Button',
|
|
111
|
+
fluid: true
|
|
112
|
+
};
|
|
113
|
+
var WithMinWidth = Template.bind({});
|
|
114
|
+
exports.WithMinWidth = WithMinWidth;
|
|
115
|
+
WithMinWidth.args = {
|
|
116
|
+
children: 'Min Width Button',
|
|
117
|
+
minWidth: '200px'
|
|
118
|
+
};
|
|
119
|
+
var Centered = Template.bind({});
|
|
120
|
+
exports.Centered = Centered;
|
|
121
|
+
Centered.args = {
|
|
122
|
+
children: 'Centered Button',
|
|
64
123
|
center: true
|
|
65
124
|
};
|
|
66
|
-
var
|
|
67
|
-
|
|
125
|
+
var WithMargin = Template.bind({});
|
|
126
|
+
exports.WithMargin = WithMargin;
|
|
127
|
+
WithMargin.args = {
|
|
128
|
+
children: 'Button with Margin',
|
|
129
|
+
marginTop: '20px',
|
|
130
|
+
marginRight: '20px'
|
|
131
|
+
};
|
|
132
|
+
var WithBottomMargin = Template.bind({});
|
|
133
|
+
exports.WithBottomMargin = WithBottomMargin;
|
|
134
|
+
WithBottomMargin.args = {
|
|
135
|
+
children: 'Button with Bottom Margin',
|
|
136
|
+
withMarginBottom: true
|
|
137
|
+
};
|
|
138
|
+
var ButtonGroup = function ButtonGroup() {
|
|
139
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
140
|
+
style: {
|
|
141
|
+
display: 'flex',
|
|
142
|
+
gap: '10px'
|
|
143
|
+
}
|
|
144
|
+
}, /*#__PURE__*/_react.default.createElement(_Button.default, null, "Primary"), /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
145
|
+
secondary: true
|
|
146
|
+
}, "Secondary"), /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
147
|
+
outlineBlack: true
|
|
148
|
+
}, "Outline Black"), /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
149
|
+
negative: true
|
|
150
|
+
}, "Negative"));
|
|
68
151
|
};
|
|
69
152
|
|
|
70
153
|
// export const DoubleButton = args => (
|
|
@@ -77,4 +160,4 @@ var ButtonLong = function ButtonLong(args) {
|
|
|
77
160
|
//other props mentioned in Button.styles that are not in propTypes:
|
|
78
161
|
//type, minWidth, fluid, onlyText, outLine, marginTop, isUpdates, isDone..
|
|
79
162
|
// Doublebuttons not showing, cannot find use
|
|
80
|
-
exports.
|
|
163
|
+
exports.ButtonGroup = ButtonGroup;
|
|
@@ -8,7 +8,7 @@ exports.default = exports.Button = void 0;
|
|
|
8
8
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
10
|
var _theme = _interopRequireDefault(require("../../styles/theme"));
|
|
11
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13;
|
|
11
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14;
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
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); }
|
|
14
14
|
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; }
|
|
@@ -20,7 +20,7 @@ var Button = _styledComponents.default.button.attrs(function (props) {
|
|
|
20
20
|
}).withConfig({
|
|
21
21
|
displayName: "Buttonstyles__Button",
|
|
22
22
|
componentId: "sc-1bxw8qq-0"
|
|
23
|
-
})(["display:inline-block;height:auto;min-height:40px;max-width:100%;background-color:", ";border:1px solid ", ";font-weight:bold;font-size:12px;line-height:16px;color:", ";text-transform:uppercase;text-align:center;letter-spacing:2px;border-radius:28px;padding:11px 32px;margin:0;outline:0;vertical-align:baseline;text-shadow:none;user-select:none;cursor:pointer;transition:color 0.2s,background-color 0.2s,border-color 0.2s;", " ", " ", " ", " ", " ", " &:hover,&:focus,&:active{background-color:", ";border-color:", ";color:", ";}", " ", " ", " ", " ", " ", " ", " ", ""], function (props) {
|
|
23
|
+
})(["display:inline-block;height:auto;min-height:40px;max-width:100%;background-color:", ";border:1px solid ", ";font-weight:bold;font-size:12px;line-height:16px;color:", ";text-transform:uppercase;text-align:center;letter-spacing:2px;border-radius:28px;padding:11px 32px;margin:0;outline:0;vertical-align:baseline;text-shadow:none;user-select:none;cursor:pointer;transition:color 0.2s,background-color 0.2s,border-color 0.2s;", " ", " ", " ", " ", " ", " &:hover,&:focus,&:active{background-color:", ";border-color:", ";color:", ";}", " ", " ", " ", " ", " ", " ", " ", " ", ""], function (props) {
|
|
24
24
|
return _theme.default.cPrimary;
|
|
25
25
|
}, function (props) {
|
|
26
26
|
return _theme.default.cPrimary;
|
|
@@ -60,9 +60,11 @@ var Button = _styledComponents.default.button.attrs(function (props) {
|
|
|
60
60
|
}, function (props) {
|
|
61
61
|
return props.outline && (0, _styledComponents.css)(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n border-color: ", ";\n background-color: transparent;\n color: ", ";\n\n &:hover,\n &:focus,\n &:active {\n background-color: ", ";\n border-color: ", ";\n color: ", ";\n }\n "])), _theme.default.cWhite, _theme.default.cWhite, _theme.default.cWhite, _theme.default.cWhite, _theme.default.cWarning);
|
|
62
62
|
}, function (props) {
|
|
63
|
-
return props.
|
|
63
|
+
return props.outlineBlack && (0, _styledComponents.css)(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n border-color: ", ";\n background-color: ", ";\n color: ", ";\n\n &:hover,\n &:focus,\n &:active {\n background-color: ", ";\n border-color: ", ";\n color: ", ";\n }\n "])), _theme.default.grey4, _theme.default.cWhite, _theme.default.cBlack, _theme.default.cPrimary, _theme.default.cPrimary, _theme.default.cWhite);
|
|
64
64
|
}, function (props) {
|
|
65
|
-
return props.
|
|
65
|
+
return props.marginTop && (0, _styledComponents.css)(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n margin-top: ", ";\n "])), props.marginTop);
|
|
66
|
+
}, function (props) {
|
|
67
|
+
return props.marginRight && (0, _styledComponents.css)(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n margin-right: ", ";\n "])), props.marginRight);
|
|
66
68
|
}, function (props) {
|
|
67
69
|
return props.isLoginMobile && "\n margin-bottom: 20px;\n width: 163.94px;\n ";
|
|
68
70
|
});
|
|
@@ -71,13 +73,17 @@ Button.propTypes = {
|
|
|
71
73
|
secondary: _propTypes.default.bool,
|
|
72
74
|
disabled: _propTypes.default.bool,
|
|
73
75
|
negative: _propTypes.default.bool,
|
|
74
|
-
center: _propTypes.default.bool
|
|
76
|
+
center: _propTypes.default.bool,
|
|
77
|
+
outline: _propTypes.default.bool,
|
|
78
|
+
outlineBlack: _propTypes.default.bool
|
|
75
79
|
};
|
|
76
80
|
Button.defaultProps = {
|
|
77
81
|
secondary: false,
|
|
78
82
|
disabled: false,
|
|
79
83
|
negative: false,
|
|
80
|
-
center: false
|
|
84
|
+
center: false,
|
|
85
|
+
outline: false,
|
|
86
|
+
outlineBlack: false
|
|
81
87
|
};
|
|
82
88
|
var _default = Button;
|
|
83
89
|
exports.default = _default;
|