@entur/table 4.6.17 → 4.6.18
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/DataCell.d.ts +12 -12
- package/dist/EditableCell.d.ts +20 -20
- package/dist/ExpandRowButton.d.ts +7 -7
- package/dist/ExpandableRow.d.ts +12 -12
- package/dist/HeaderCell.d.ts +24 -24
- package/dist/Table.d.ts +21 -21
- package/dist/TableBody.d.ts +9 -9
- package/dist/TableFooter.d.ts +6 -6
- package/dist/TableHead.d.ts +8 -8
- package/dist/TableRow.d.ts +21 -21
- package/dist/index.d.ts +13 -13
- package/dist/styles.css +148 -148
- package/dist/table.cjs.development.js +45 -51
- package/dist/table.cjs.development.js.map +1 -1
- package/dist/table.cjs.production.min.js +1 -1
- package/dist/table.cjs.production.min.js.map +1 -1
- package/dist/table.esm.js +4 -4
- package/dist/useSortableTable.d.ts +41 -41
- package/dist/useTableKeyboardNavigation.d.ts +14 -14
- package/package.json +9 -9
package/dist/styles.css
CHANGED
|
@@ -1,128 +1,71 @@
|
|
|
1
1
|
/* DO NOT CHANGE!*/
|
|
2
2
|
/* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
.eds-table--fixed {
|
|
12
|
-
table-layout: fixed;
|
|
13
|
-
}
|
|
14
|
-
.eds-table--sticky-header {
|
|
15
|
-
position: relative;
|
|
3
|
+
.eds-table__header-cell {
|
|
4
|
+
color: #656782;
|
|
5
|
+
font-size: 0.875rem;
|
|
6
|
+
font-weight: 500;
|
|
7
|
+
text-align: left;
|
|
8
|
+
height: 3rem;
|
|
9
|
+
padding: 0 1.5rem;
|
|
16
10
|
}
|
|
17
|
-
.eds-
|
|
18
|
-
|
|
19
|
-
padding: 1rem 1.5rem;
|
|
11
|
+
.eds-table--middle .eds-table__header-cell, .eds-table--small .eds-table__header-cell {
|
|
12
|
+
padding: 0 1rem;
|
|
20
13
|
}
|
|
21
|
-
.eds-contrast .eds-
|
|
14
|
+
.eds-contrast .eds-table__header-cell {
|
|
15
|
+
color: #aeb7e2;
|
|
22
16
|
border-bottom-color: #393d79;
|
|
23
17
|
}
|
|
24
|
-
.eds-
|
|
25
|
-
padding: 0.5rem 1rem;
|
|
26
|
-
height: 3rem;
|
|
27
|
-
}
|
|
28
|
-
.eds-table--small .eds-table__data-cell {
|
|
29
|
-
padding: 0.25rem 1rem;
|
|
30
|
-
height: 2rem;
|
|
31
|
-
}
|
|
32
|
-
.eds-table__data-cell--padding-checkbox {
|
|
18
|
+
.eds-table__header-cell--padding-checkbox {
|
|
33
19
|
width: 3rem;
|
|
34
|
-
padding: 0
|
|
20
|
+
padding: 0 0 1rem 1.25rem;
|
|
35
21
|
}
|
|
36
|
-
.eds-
|
|
22
|
+
.eds-table__header-cell--padding-radio {
|
|
37
23
|
width: 3rem;
|
|
38
|
-
padding:
|
|
24
|
+
padding: 0 0 1rem 1.25rem;
|
|
39
25
|
}
|
|
40
|
-
.eds-
|
|
26
|
+
.eds-table__header-cell--padding-overflow-menu {
|
|
41
27
|
width: 3rem;
|
|
42
28
|
padding: 1rem 0.75rem;
|
|
43
29
|
}
|
|
44
|
-
.eds-
|
|
30
|
+
.eds-table__header-cell--sortable:focus {
|
|
31
|
+
outline: none;
|
|
32
|
+
box-shadow: 0 0 0 0.125rem #ffffff, 0 0 0 0.25rem #181c56;
|
|
33
|
+
outline-offset: 0.125rem;
|
|
34
|
+
}
|
|
35
|
+
.eds-table__header-cell-button {
|
|
45
36
|
position: relative;
|
|
37
|
+
text-align: left;
|
|
38
|
+
height: 100%;
|
|
39
|
+
width: 100%;
|
|
40
|
+
padding: 0;
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
-webkit-appearance: none;
|
|
43
|
+
-moz-appearance: none;
|
|
44
|
+
appearance: none;
|
|
45
|
+
border: none;
|
|
46
|
+
background: none;
|
|
47
|
+
color: inherit;
|
|
48
|
+
font-size: inherit;
|
|
49
|
+
font-weight: inherit;
|
|
50
|
+
font-family: inherit;
|
|
46
51
|
}
|
|
47
|
-
.eds-
|
|
48
|
-
left: 0;
|
|
49
|
-
top: 1.3125rem;
|
|
50
|
-
content: "";
|
|
52
|
+
.eds-table__header-cell-button-icon {
|
|
51
53
|
position: absolute;
|
|
52
|
-
|
|
53
|
-
width: 0.625rem;
|
|
54
|
-
border-radius: 50%;
|
|
55
|
-
}
|
|
56
|
-
.eds-table--small .eds-table__data-cell[class*=eds-table__data-cell--status]:before {
|
|
57
|
-
top: 0.5625rem;
|
|
58
|
-
}
|
|
59
|
-
.eds-table--middle .eds-table__data-cell[class*=eds-table__data-cell--status]:before {
|
|
60
|
-
top: 0.8125rem;
|
|
61
|
-
}
|
|
62
|
-
.eds-table__data-cell--status-positive:before {
|
|
63
|
-
background: #1a8e60;
|
|
64
|
-
}
|
|
65
|
-
.eds-contrast .eds-table__data-cell--status-positive:before {
|
|
66
|
-
background: #5ac39a;
|
|
67
|
-
}
|
|
68
|
-
.eds-table__data-cell--status-negative:before {
|
|
69
|
-
background: #d31b1b;
|
|
70
|
-
}
|
|
71
|
-
.eds-contrast .eds-table__data-cell--status-negative:before {
|
|
72
|
-
background: #ff9494;
|
|
73
|
-
}
|
|
74
|
-
.eds-table__data-cell--status-neutral:before {
|
|
75
|
-
background: #d1d3d3;
|
|
76
|
-
}
|
|
77
|
-
.eds-contrast .eds-table__data-cell--status-neutral:before {
|
|
78
|
-
background: #babbcf;
|
|
79
|
-
}
|
|
80
|
-
.eds-table__body > .eds-table__row {
|
|
81
|
-
border-bottom: 0.125rem solid #e9e9e9;
|
|
82
|
-
}
|
|
83
|
-
.eds-contrast .eds-table__body > .eds-table__row {
|
|
84
|
-
border-color: #393d79;
|
|
54
|
+
margin-left: 0.25rem;
|
|
85
55
|
}
|
|
86
|
-
.eds-
|
|
56
|
+
.eds-table__header-cell-button:focus {
|
|
87
57
|
outline: 2px solid #181c56;
|
|
88
58
|
}
|
|
89
|
-
.eds-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
.eds-contrast .eds-table__body > .eds-table__row--hover:hover {
|
|
93
|
-
background: #292b6a;
|
|
94
|
-
}
|
|
95
|
-
.eds-table__body > .eds-table__row--active {
|
|
96
|
-
background: #ebebf1;
|
|
97
|
-
border: 0.125rem solid #d1d4e3;
|
|
98
|
-
}
|
|
99
|
-
.eds-contrast .eds-table__body > .eds-table__row--active {
|
|
100
|
-
border-color: #393d79;
|
|
101
|
-
background: #393d79;
|
|
102
|
-
}
|
|
103
|
-
.eds-table__body > .eds-table__row--error {
|
|
104
|
-
background: #ffcece;
|
|
105
|
-
border-color: #ff9494;
|
|
106
|
-
}
|
|
107
|
-
.eds-table__head {
|
|
108
|
-
border-bottom: 0.125rem solid #e9e9e9;
|
|
109
|
-
}
|
|
110
|
-
.eds-contrast .eds-table__head {
|
|
111
|
-
border-color: #393d79;
|
|
59
|
+
.eds-contrast .eds-table__header-cell-button:focus {
|
|
60
|
+
outline: 2px solid #ffffff;
|
|
112
61
|
}
|
|
113
|
-
.eds-table--sticky-header
|
|
62
|
+
.eds-table--sticky-header .eds-table__header-cell {
|
|
63
|
+
background-color: #ffffff;
|
|
114
64
|
position: sticky;
|
|
115
65
|
top: 0;
|
|
116
|
-
box-shadow: 0px 10px 8px -10px rgba(0, 0, 0, 0.15);
|
|
117
|
-
border-bottom: none;
|
|
118
|
-
}
|
|
119
|
-
/* DO NOT CHANGE!*/
|
|
120
|
-
/* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
|
|
121
|
-
.eds-expand-row-button__icon {
|
|
122
|
-
transition: transform ease-in-out 0.2s;
|
|
123
66
|
}
|
|
124
|
-
.eds-
|
|
125
|
-
|
|
67
|
+
.eds-contrast .eds-table--sticky-header .eds-table__header-cell {
|
|
68
|
+
background-color: #181c56;
|
|
126
69
|
}
|
|
127
70
|
/* DO NOT CHANGE!*/
|
|
128
71
|
/* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
|
|
@@ -243,70 +186,127 @@
|
|
|
243
186
|
}
|
|
244
187
|
/* DO NOT CHANGE!*/
|
|
245
188
|
/* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
|
|
246
|
-
.eds-
|
|
247
|
-
|
|
248
|
-
font-size: 0.875rem;
|
|
249
|
-
font-weight: 500;
|
|
250
|
-
text-align: left;
|
|
251
|
-
height: 3rem;
|
|
252
|
-
padding: 0 1.5rem;
|
|
189
|
+
.eds-expand-row-button__icon {
|
|
190
|
+
transition: transform ease-in-out 0.2s;
|
|
253
191
|
}
|
|
254
|
-
.eds-
|
|
255
|
-
|
|
192
|
+
.eds-expand-row-button--open .eds-expand-row-button__icon {
|
|
193
|
+
transform: rotate(180deg);
|
|
256
194
|
}
|
|
257
|
-
|
|
258
|
-
|
|
195
|
+
/* DO NOT CHANGE!*/
|
|
196
|
+
/* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
|
|
197
|
+
:root {
|
|
198
|
+
--eds-table: 1;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.eds-table {
|
|
202
|
+
border-collapse: collapse;
|
|
203
|
+
width: 100%;
|
|
204
|
+
}
|
|
205
|
+
.eds-table--fixed {
|
|
206
|
+
table-layout: fixed;
|
|
207
|
+
}
|
|
208
|
+
.eds-table--sticky-header {
|
|
209
|
+
position: relative;
|
|
210
|
+
}
|
|
211
|
+
.eds-table__data-cell {
|
|
212
|
+
height: 3.75rem;
|
|
213
|
+
padding: 1rem 1.5rem;
|
|
214
|
+
}
|
|
215
|
+
.eds-contrast .eds-table__data-cell {
|
|
259
216
|
border-bottom-color: #393d79;
|
|
260
217
|
}
|
|
261
|
-
.eds-
|
|
218
|
+
.eds-table--middle .eds-table__data-cell {
|
|
219
|
+
padding: 0.5rem 1rem;
|
|
220
|
+
height: 3rem;
|
|
221
|
+
}
|
|
222
|
+
.eds-table--small .eds-table__data-cell {
|
|
223
|
+
padding: 0.25rem 1rem;
|
|
224
|
+
height: 2rem;
|
|
225
|
+
}
|
|
226
|
+
.eds-table__data-cell--padding-checkbox {
|
|
262
227
|
width: 3rem;
|
|
263
|
-
padding: 0 0
|
|
228
|
+
padding: 0.5rem 0 0.75rem 1.25rem;
|
|
264
229
|
}
|
|
265
|
-
.eds-
|
|
230
|
+
.eds-table__data-cell--padding-radio {
|
|
266
231
|
width: 3rem;
|
|
267
|
-
padding:
|
|
232
|
+
padding: 1rem 0 1rem 1.25rem;
|
|
268
233
|
}
|
|
269
|
-
.eds-
|
|
234
|
+
.eds-table__data-cell--padding-overflow-menu {
|
|
270
235
|
width: 3rem;
|
|
271
236
|
padding: 1rem 0.75rem;
|
|
272
237
|
}
|
|
273
|
-
.eds-
|
|
274
|
-
outline: none;
|
|
275
|
-
box-shadow: 0 0 0 0.125rem #ffffff, 0 0 0 0.25rem #181c56;
|
|
276
|
-
outline-offset: 0.125rem;
|
|
277
|
-
}
|
|
278
|
-
.eds-table__header-cell-button {
|
|
238
|
+
.eds-table__data-cell[class*=eds-table__data-cell--status] {
|
|
279
239
|
position: relative;
|
|
280
|
-
text-align: left;
|
|
281
|
-
height: 100%;
|
|
282
|
-
width: 100%;
|
|
283
|
-
padding: 0;
|
|
284
|
-
cursor: pointer;
|
|
285
|
-
-webkit-appearance: none;
|
|
286
|
-
-moz-appearance: none;
|
|
287
|
-
appearance: none;
|
|
288
|
-
border: none;
|
|
289
|
-
background: none;
|
|
290
|
-
color: inherit;
|
|
291
|
-
font-size: inherit;
|
|
292
|
-
font-weight: inherit;
|
|
293
|
-
font-family: inherit;
|
|
294
240
|
}
|
|
295
|
-
.eds-
|
|
241
|
+
.eds-table__data-cell[class*=eds-table__data-cell--status]:before {
|
|
242
|
+
left: 0;
|
|
243
|
+
top: 1.3125rem;
|
|
244
|
+
content: "";
|
|
296
245
|
position: absolute;
|
|
297
|
-
|
|
246
|
+
height: 0.625rem;
|
|
247
|
+
width: 0.625rem;
|
|
248
|
+
border-radius: 50%;
|
|
298
249
|
}
|
|
299
|
-
.eds-
|
|
250
|
+
.eds-table--small .eds-table__data-cell[class*=eds-table__data-cell--status]:before {
|
|
251
|
+
top: 0.5625rem;
|
|
252
|
+
}
|
|
253
|
+
.eds-table--middle .eds-table__data-cell[class*=eds-table__data-cell--status]:before {
|
|
254
|
+
top: 0.8125rem;
|
|
255
|
+
}
|
|
256
|
+
.eds-table__data-cell--status-positive:before {
|
|
257
|
+
background: #1a8e60;
|
|
258
|
+
}
|
|
259
|
+
.eds-contrast .eds-table__data-cell--status-positive:before {
|
|
260
|
+
background: #5ac39a;
|
|
261
|
+
}
|
|
262
|
+
.eds-table__data-cell--status-negative:before {
|
|
263
|
+
background: #d31b1b;
|
|
264
|
+
}
|
|
265
|
+
.eds-contrast .eds-table__data-cell--status-negative:before {
|
|
266
|
+
background: #ff9494;
|
|
267
|
+
}
|
|
268
|
+
.eds-table__data-cell--status-neutral:before {
|
|
269
|
+
background: #d1d3d3;
|
|
270
|
+
}
|
|
271
|
+
.eds-contrast .eds-table__data-cell--status-neutral:before {
|
|
272
|
+
background: #babbcf;
|
|
273
|
+
}
|
|
274
|
+
.eds-table__body > .eds-table__row {
|
|
275
|
+
border-bottom: 0.125rem solid #e9e9e9;
|
|
276
|
+
}
|
|
277
|
+
.eds-contrast .eds-table__body > .eds-table__row {
|
|
278
|
+
border-color: #393d79;
|
|
279
|
+
}
|
|
280
|
+
.eds-table__body > .eds-table__row:focus {
|
|
300
281
|
outline: 2px solid #181c56;
|
|
301
282
|
}
|
|
302
|
-
.eds-
|
|
303
|
-
|
|
283
|
+
.eds-table__body > .eds-table__row--hover:hover {
|
|
284
|
+
background: #f3f3f3;
|
|
304
285
|
}
|
|
305
|
-
.eds-
|
|
306
|
-
background
|
|
286
|
+
.eds-contrast .eds-table__body > .eds-table__row--hover:hover {
|
|
287
|
+
background: #292b6a;
|
|
288
|
+
}
|
|
289
|
+
.eds-table__body > .eds-table__row--active {
|
|
290
|
+
background: #ebebf1;
|
|
291
|
+
border: 0.125rem solid #d1d4e3;
|
|
292
|
+
}
|
|
293
|
+
.eds-contrast .eds-table__body > .eds-table__row--active {
|
|
294
|
+
border-color: #393d79;
|
|
295
|
+
background: #393d79;
|
|
296
|
+
}
|
|
297
|
+
.eds-table__body > .eds-table__row--error {
|
|
298
|
+
background: #ffcece;
|
|
299
|
+
border-color: #ff9494;
|
|
300
|
+
}
|
|
301
|
+
.eds-table__head {
|
|
302
|
+
border-bottom: 0.125rem solid #e9e9e9;
|
|
303
|
+
}
|
|
304
|
+
.eds-contrast .eds-table__head {
|
|
305
|
+
border-color: #393d79;
|
|
306
|
+
}
|
|
307
|
+
.eds-table--sticky-header--active .eds-table__head {
|
|
307
308
|
position: sticky;
|
|
308
309
|
top: 0;
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
background-color: #181c56;
|
|
310
|
+
box-shadow: 0px 10px 8px -10px rgba(0, 0, 0, 0.15);
|
|
311
|
+
border-bottom: none;
|
|
312
312
|
}
|
|
@@ -13,12 +13,6 @@ var tooltip = require('@entur/tooltip');
|
|
|
13
13
|
var expand = require('@entur/expand');
|
|
14
14
|
var button = require('@entur/button');
|
|
15
15
|
|
|
16
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
17
|
-
|
|
18
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
19
|
-
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
20
|
-
var get__default = /*#__PURE__*/_interopDefaultLegacy(get);
|
|
21
|
-
|
|
22
16
|
function _extends() {
|
|
23
17
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
24
18
|
for (var i = 1; i < arguments.length; i++) {
|
|
@@ -50,7 +44,7 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
50
44
|
}
|
|
51
45
|
|
|
52
46
|
var _excluded$8 = ["className", "fixed", "spacing", "sortable", "changeSortDescription", "stickyHeader"];
|
|
53
|
-
var Table = /*#__PURE__*/
|
|
47
|
+
var Table = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
54
48
|
var className = _ref.className,
|
|
55
49
|
_ref$fixed = _ref.fixed,
|
|
56
50
|
fixed = _ref$fixed === void 0 ? false : _ref$fixed,
|
|
@@ -68,10 +62,10 @@ var Table = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, re
|
|
|
68
62
|
React.useEffect(function () {
|
|
69
63
|
if (stickyHeader) {
|
|
70
64
|
var _tableElement$parentN;
|
|
71
|
-
/* We check when an inserted div above the header
|
|
72
|
-
is outside our scrolling container to determine when
|
|
73
|
-
the table header becomes sticky. This is necessary
|
|
74
|
-
to conditionally add our box-shadow when the
|
|
65
|
+
/* We check when an inserted div above the header
|
|
66
|
+
is outside our scrolling container to determine when
|
|
67
|
+
the table header becomes sticky. This is necessary
|
|
68
|
+
to conditionally add our box-shadow when the
|
|
75
69
|
header is overlapping table rows */
|
|
76
70
|
var tableElement = tableRef.current;
|
|
77
71
|
var observerElement = document.createElement('div');
|
|
@@ -89,8 +83,8 @@ var Table = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, re
|
|
|
89
83
|
};
|
|
90
84
|
}
|
|
91
85
|
}, [stickyHeader]);
|
|
92
|
-
return
|
|
93
|
-
className:
|
|
86
|
+
return React.createElement(React.Fragment, null, React.createElement("table", _extends({
|
|
87
|
+
className: classNames('eds-table', {
|
|
94
88
|
'eds-table--fixed': fixed
|
|
95
89
|
}, {
|
|
96
90
|
'eds-table--middle': spacing === 'middle'
|
|
@@ -103,40 +97,40 @@ var Table = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, re
|
|
|
103
97
|
}, className),
|
|
104
98
|
ref: utils.mergeRefs(ref, tableRef),
|
|
105
99
|
"aria-describedby": sortable ? sortableHeaderId : undefined
|
|
106
|
-
}, rest)), sortable &&
|
|
100
|
+
}, rest)), sortable && React.createElement(a11y.VisuallyHidden, {
|
|
107
101
|
id: sortableHeaderId
|
|
108
102
|
}, changeSortDescription));
|
|
109
103
|
});
|
|
110
104
|
|
|
111
105
|
var _excluded$7 = ["className"];
|
|
112
|
-
var TableHead = /*#__PURE__*/
|
|
106
|
+
var TableHead = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
113
107
|
var className = _ref.className,
|
|
114
108
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$7);
|
|
115
|
-
return
|
|
116
|
-
className:
|
|
109
|
+
return React.createElement("thead", _extends({
|
|
110
|
+
className: classNames('eds-table__head', className),
|
|
117
111
|
ref: ref
|
|
118
112
|
}, props));
|
|
119
113
|
});
|
|
120
114
|
|
|
121
115
|
var _excluded$6 = ["className"];
|
|
122
|
-
var TableBody = /*#__PURE__*/
|
|
116
|
+
var TableBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
123
117
|
var className = _ref.className,
|
|
124
118
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$6);
|
|
125
|
-
return
|
|
126
|
-
className:
|
|
119
|
+
return React.createElement("tbody", _extends({
|
|
120
|
+
className: classNames('eds-table__body', className),
|
|
127
121
|
ref: ref
|
|
128
122
|
}, rest));
|
|
129
123
|
});
|
|
130
124
|
|
|
131
|
-
var TableFooter = /*#__PURE__*/
|
|
125
|
+
var TableFooter = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
132
126
|
var props = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
133
|
-
return
|
|
127
|
+
return React.createElement("tfoot", _extends({
|
|
134
128
|
ref: ref
|
|
135
129
|
}, props));
|
|
136
130
|
});
|
|
137
131
|
|
|
138
132
|
var _excluded$5 = ["className", "hover", "active", "error"];
|
|
139
|
-
var TableRow = /*#__PURE__*/
|
|
133
|
+
var TableRow = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
140
134
|
var className = _ref.className,
|
|
141
135
|
_ref$hover = _ref.hover,
|
|
142
136
|
hover = _ref$hover === void 0 ? false : _ref$hover,
|
|
@@ -145,8 +139,8 @@ var TableRow = /*#__PURE__*/React__default["default"].forwardRef(function (_ref,
|
|
|
145
139
|
_ref$error = _ref.error,
|
|
146
140
|
error = _ref$error === void 0 ? false : _ref$error,
|
|
147
141
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$5);
|
|
148
|
-
return
|
|
149
|
-
className:
|
|
142
|
+
return React.createElement("tr", _extends({
|
|
143
|
+
className: classNames('eds-table__row', className, {
|
|
150
144
|
'eds-table__row--hover': hover,
|
|
151
145
|
'eds-table__row--active': active,
|
|
152
146
|
'eds-table__row--error': error
|
|
@@ -156,7 +150,7 @@ var TableRow = /*#__PURE__*/React__default["default"].forwardRef(function (_ref,
|
|
|
156
150
|
});
|
|
157
151
|
|
|
158
152
|
var _excluded$4 = ["className", "padding", "status"];
|
|
159
|
-
var DataCell = /*#__PURE__*/
|
|
153
|
+
var DataCell = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
160
154
|
var _classNames;
|
|
161
155
|
var className = _ref.className,
|
|
162
156
|
_ref$padding = _ref.padding,
|
|
@@ -164,15 +158,15 @@ var DataCell = /*#__PURE__*/React__default["default"].forwardRef(function (_ref,
|
|
|
164
158
|
_ref$status = _ref.status,
|
|
165
159
|
status = _ref$status === void 0 ? undefined : _ref$status,
|
|
166
160
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
167
|
-
return
|
|
161
|
+
return React.createElement("td", _extends({
|
|
168
162
|
ref: ref,
|
|
169
|
-
className:
|
|
163
|
+
className: classNames('eds-table__data-cell', className, (_classNames = {}, _classNames["eds-table__data-cell--status-" + status] = status, _classNames['eds-table__data-cell--padding-checkbox'] = padding === 'checkbox', _classNames['eds-table__data-cell--padding-radio'] = padding === 'radio', _classNames['eds-table__data-cell--padding-overflow-menu'] = padding === 'overflow-menu', _classNames))
|
|
170
164
|
}, rest));
|
|
171
165
|
});
|
|
172
166
|
|
|
173
167
|
var _excluded$3 = ["className", "children", "name", "sortable", "sortConfig", "padding", "sortableButtonProps", "sortedAscendingAriaLabel", "sortedDescendingAriaLabel"],
|
|
174
168
|
_excluded2$1 = ["className"];
|
|
175
|
-
var HeaderCell = /*#__PURE__*/
|
|
169
|
+
var HeaderCell = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
176
170
|
var className = _ref.className,
|
|
177
171
|
children = _ref.children,
|
|
178
172
|
name = _ref.name,
|
|
@@ -187,15 +181,15 @@ var HeaderCell = /*#__PURE__*/React__default["default"].forwardRef(function (_re
|
|
|
187
181
|
_ref$sortedDescending = _ref.sortedDescendingAriaLabel,
|
|
188
182
|
sortedDescendingAriaLabel = _ref$sortedDescending === void 0 ? ', sortert synkende' : _ref$sortedDescending,
|
|
189
183
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
190
|
-
var _React$useState =
|
|
184
|
+
var _React$useState = React.useState(false),
|
|
191
185
|
isCurrentlySorted = _React$useState[0],
|
|
192
186
|
setIsCurrentlySorted = _React$useState[1];
|
|
193
|
-
|
|
187
|
+
React.useEffect(function () {
|
|
194
188
|
sortConfig && name && setIsCurrentlySorted(sortConfig && name === sortConfig.key);
|
|
195
189
|
}, [sortConfig, name]);
|
|
196
190
|
var ariaSort = isCurrentlySorted ? sortConfig && sortConfig.order : undefined;
|
|
197
|
-
return
|
|
198
|
-
className:
|
|
191
|
+
return React.createElement("th", _extends({
|
|
192
|
+
className: classNames('eds-table__header-cell', className, {
|
|
199
193
|
'eds-table__header-cell--sortable': sortable,
|
|
200
194
|
'eds-table__header-cell--padding-radio': padding === 'radio',
|
|
201
195
|
'eds-table__header-cell--padding-checkbox': padding === 'checkbox',
|
|
@@ -203,7 +197,7 @@ var HeaderCell = /*#__PURE__*/React__default["default"].forwardRef(function (_re
|
|
|
203
197
|
}),
|
|
204
198
|
"aria-sort": ariaSort,
|
|
205
199
|
ref: ref
|
|
206
|
-
}, rest), sortable && sortConfig && sortableButtonProps ?
|
|
200
|
+
}, rest), sortable && sortConfig && sortableButtonProps ? React.createElement(SortableHeaderCellButton, {
|
|
207
201
|
sortableButtonProps: sortableButtonProps,
|
|
208
202
|
sortConfig: sortConfig,
|
|
209
203
|
isCurrentlySorted: isCurrentlySorted,
|
|
@@ -241,23 +235,23 @@ var SortableHeaderCellButton = function SortableHeaderCellButton(_ref2) {
|
|
|
241
235
|
return clearTimeout(dismissAriaTimer);
|
|
242
236
|
};
|
|
243
237
|
}, [sortConfig.order]);
|
|
244
|
-
return
|
|
245
|
-
className:
|
|
238
|
+
return React.createElement("button", _extends({
|
|
239
|
+
className: classNames('eds-table__header-cell-button', className),
|
|
246
240
|
type: "button",
|
|
247
241
|
"aria-sort": ariaSort
|
|
248
|
-
}, rest), children, (!isCurrentlySorted || sortConfig.order === 'none') &&
|
|
242
|
+
}, rest), children, (!isCurrentlySorted || sortConfig.order === 'none') && React.createElement(icons.UnsortedIcon, {
|
|
249
243
|
size: "1rem",
|
|
250
244
|
className: "eds-table__header-cell-button-icon",
|
|
251
245
|
"aria-hidden": "true"
|
|
252
|
-
}), isCurrentlySorted && sortConfig.order === 'ascending' &&
|
|
246
|
+
}), isCurrentlySorted && sortConfig.order === 'ascending' && React.createElement(icons.UpArrowIcon, {
|
|
253
247
|
size: "1rem",
|
|
254
248
|
className: "eds-table__header-cell-button-icon",
|
|
255
249
|
"aria-hidden": "true"
|
|
256
|
-
}), isCurrentlySorted && sortConfig.order === 'descending' &&
|
|
250
|
+
}), isCurrentlySorted && sortConfig.order === 'descending' && React.createElement(icons.DownArrowIcon, {
|
|
257
251
|
size: "1rem",
|
|
258
252
|
className: "eds-table__header-cell-button-icon",
|
|
259
253
|
"aria-hidden": "true"
|
|
260
|
-
}),
|
|
254
|
+
}), React.createElement(a11y.VisuallyHidden, null, isCurrentlySorted && sortedAriaInfo));
|
|
261
255
|
};
|
|
262
256
|
|
|
263
257
|
var _excluded$2 = ["name", "sortable", "buttonProps"],
|
|
@@ -288,8 +282,8 @@ function useSortableData(tableData, externalSortConfig) {
|
|
|
288
282
|
});
|
|
289
283
|
};
|
|
290
284
|
var tableSortedAscending = [].concat(tableData).sort(function (a, b) {
|
|
291
|
-
var valueOfA =
|
|
292
|
-
var valueOfB =
|
|
285
|
+
var valueOfA = get(a, sortConfig.key, a);
|
|
286
|
+
var valueOfB = get(b, sortConfig.key, b);
|
|
293
287
|
var comparableAValue = typeof valueOfA === 'string' ? valueOfA.toLowerCase() : valueOfA;
|
|
294
288
|
var comparableBValue = typeof valueOfB === 'string' ? valueOfB.toLowerCase() : valueOfB;
|
|
295
289
|
if (comparableAValue < comparableBValue) return -1;
|
|
@@ -349,13 +343,13 @@ var EditableCell = function EditableCell(_ref) {
|
|
|
349
343
|
_ref$outlined = _ref.outlined,
|
|
350
344
|
outlined = _ref$outlined === void 0 ? false : _ref$outlined,
|
|
351
345
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
352
|
-
return
|
|
346
|
+
return React.createElement(form.VariantProvider, {
|
|
353
347
|
variant: variant
|
|
354
|
-
},
|
|
355
|
-
className:
|
|
348
|
+
}, React.createElement(DataCell, _extends({
|
|
349
|
+
className: classNames('eds-editable-cell', {
|
|
356
350
|
'eds-editable-cell--outlined': outlined
|
|
357
351
|
}, className)
|
|
358
|
-
}, rest),
|
|
352
|
+
}, rest), React.createElement(tooltip.Tooltip, {
|
|
359
353
|
disableHoverListener: !feedback,
|
|
360
354
|
disableFocusListener: !feedback,
|
|
361
355
|
placement: "bottom",
|
|
@@ -369,9 +363,9 @@ var ExpandableRow = function ExpandableRow(_ref) {
|
|
|
369
363
|
open = _ref$open === void 0 ? false : _ref$open,
|
|
370
364
|
children = _ref.children,
|
|
371
365
|
colSpan = _ref.colSpan;
|
|
372
|
-
return
|
|
366
|
+
return React.createElement("tr", null, React.createElement("td", {
|
|
373
367
|
colSpan: colSpan
|
|
374
|
-
},
|
|
368
|
+
}, React.createElement(expand.BaseExpand, {
|
|
375
369
|
open: open
|
|
376
370
|
}, children)));
|
|
377
371
|
};
|
|
@@ -381,13 +375,13 @@ var ExpandRowButton = function ExpandRowButton(_ref) {
|
|
|
381
375
|
var open = _ref.open,
|
|
382
376
|
onClick = _ref.onClick,
|
|
383
377
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
384
|
-
return
|
|
385
|
-
className:
|
|
378
|
+
return React.createElement(button.IconButton, _extends({
|
|
379
|
+
className: classNames('eds-expand-row-button', {
|
|
386
380
|
'eds-expand-row-button--open': open
|
|
387
381
|
}),
|
|
388
382
|
onClick: onClick,
|
|
389
383
|
"aria-label": open ? 'Lukk tabellrad' : 'Utvid tabellrad'
|
|
390
|
-
}, rest),
|
|
384
|
+
}, rest), React.createElement(icons.DownArrowIcon, {
|
|
391
385
|
"aria-hidden": true,
|
|
392
386
|
className: "eds-expand-row-button__icon"
|
|
393
387
|
}));
|