@entur/table 4.9.14-beta.1 → 4.9.14-beta.4

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.
@@ -0,0 +1,509 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var utils = require('@entur/utils');
6
+ var React = require('react');
7
+ var classNames = require('classnames');
8
+ var a11y = require('@entur/a11y');
9
+ var layout = require('@entur/layout');
10
+ var icons = require('@entur/icons');
11
+ var get = require('lodash.get');
12
+ var form = require('@entur/form');
13
+ var tooltip = require('@entur/tooltip');
14
+ var expand = require('@entur/expand');
15
+ var button = require('@entur/button');
16
+
17
+ function _extends() {
18
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
19
+ for (var e = 1; e < arguments.length; e++) {
20
+ var t = arguments[e];
21
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
22
+ }
23
+ return n;
24
+ }, _extends.apply(null, arguments);
25
+ }
26
+ function _objectDestructuringEmpty(t) {
27
+ if (null == t) throw new TypeError("Cannot destructure " + t);
28
+ }
29
+ function _objectWithoutPropertiesLoose(r, e) {
30
+ if (null == r) return {};
31
+ var t = {};
32
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
33
+ if (-1 !== e.indexOf(n)) continue;
34
+ t[n] = r[n];
35
+ }
36
+ return t;
37
+ }
38
+
39
+ var _excluded$8 = ["className", "fixed", "spacing", "sortable", "changeSortDescription", "stickyHeader"];
40
+ var Table = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
41
+ var className = _ref.className,
42
+ _ref$fixed = _ref.fixed,
43
+ fixed = _ref$fixed === void 0 ? false : _ref$fixed,
44
+ _ref$spacing = _ref.spacing,
45
+ spacing = _ref$spacing === void 0 ? 'default' : _ref$spacing,
46
+ _ref$sortable = _ref.sortable,
47
+ sortable = _ref$sortable === void 0 ? false : _ref$sortable,
48
+ _ref$changeSortDescri = _ref.changeSortDescription,
49
+ changeSortDescription = _ref$changeSortDescri === void 0 ? 'Tabelloverskrifter med knapper kan trykkes på for å endre sortering,' : _ref$changeSortDescri,
50
+ _ref$stickyHeader = _ref.stickyHeader,
51
+ stickyHeader = _ref$stickyHeader === void 0 ? false : _ref$stickyHeader,
52
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$8);
53
+ var sortableHeaderId = utils.useRandomId('sortable-header');
54
+ var tableRef = React.useRef(null);
55
+ React.useEffect(function () {
56
+ if (stickyHeader) {
57
+ var _tableElement$parentN;
58
+ /* We check when an inserted div above the header
59
+ is outside our scrolling container to determine when
60
+ the table header becomes sticky. This is necessary
61
+ to conditionally add our box-shadow when the
62
+ header is overlapping table rows */
63
+ var tableElement = tableRef.current;
64
+ var observerElement = document.createElement('div');
65
+ observerElement.classList.add('sticky-observer');
66
+ tableElement == null || (_tableElement$parentN = tableElement.parentNode) == null || _tableElement$parentN.insertBefore(observerElement, tableElement);
67
+ var observer = new IntersectionObserver(function (entries) {
68
+ tableElement == null || tableElement.classList.toggle('eds-table--sticky-header--active', !entries[0].isIntersecting);
69
+ }, {
70
+ threshold: [0, 1]
71
+ });
72
+ observer.observe(observerElement);
73
+ return function () {
74
+ observer.unobserve(observerElement);
75
+ observerElement.remove();
76
+ };
77
+ }
78
+ }, [stickyHeader]);
79
+ return React.createElement(React.Fragment, null, React.createElement("table", _extends({
80
+ className: classNames('eds-table', {
81
+ 'eds-table--fixed': fixed
82
+ }, {
83
+ 'eds-table--middle': spacing === 'middle'
84
+ }, {
85
+ 'eds-table--small': spacing === 'small'
86
+ }, {
87
+ 'eds-table--sortable': sortable
88
+ }, {
89
+ 'eds-table--sticky-header': stickyHeader
90
+ }, className),
91
+ ref: utils.mergeRefs(ref, tableRef),
92
+ "aria-describedby": sortable ? sortableHeaderId : undefined
93
+ }, rest)), sortable && React.createElement(a11y.VisuallyHidden, {
94
+ id: sortableHeaderId
95
+ }, changeSortDescription));
96
+ });
97
+
98
+ var _excluded$7 = ["className"];
99
+ var TableHead = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
100
+ var className = _ref.className,
101
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$7);
102
+ return React.createElement("thead", _extends({
103
+ className: classNames('eds-table__head', className),
104
+ ref: ref
105
+ }, props));
106
+ });
107
+
108
+ var _excluded$6 = ["className"];
109
+ var TableBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
110
+ var className = _ref.className,
111
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$6);
112
+ return React.createElement("tbody", _extends({
113
+ className: classNames('eds-table__body', className),
114
+ ref: ref
115
+ }, rest));
116
+ });
117
+
118
+ var TableFooter = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
119
+ var props = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
120
+ return React.createElement("tfoot", _extends({
121
+ ref: ref
122
+ }, props));
123
+ });
124
+
125
+ var _excluded$5 = ["className", "hover", "active", "error"];
126
+ var TableRow = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
127
+ var className = _ref.className,
128
+ _ref$hover = _ref.hover,
129
+ hover = _ref$hover === void 0 ? false : _ref$hover,
130
+ _ref$active = _ref.active,
131
+ active = _ref$active === void 0 ? false : _ref$active,
132
+ _ref$error = _ref.error,
133
+ error = _ref$error === void 0 ? false : _ref$error,
134
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$5);
135
+ return React.createElement("tr", _extends({
136
+ className: classNames('eds-table__row', className, {
137
+ 'eds-table__row--hover': hover,
138
+ 'eds-table__row--active': active,
139
+ 'eds-table__row--error': error
140
+ }),
141
+ ref: ref
142
+ }, rest));
143
+ });
144
+
145
+ var _excluded$4 = ["className", "padding", "status", "variant", "children"];
146
+ function mapStatusToVariant(status) {
147
+ switch (status) {
148
+ case 'positive':
149
+ return 'success';
150
+ case 'negative':
151
+ return 'negative';
152
+ case 'neutral':
153
+ return 'neutral';
154
+ default:
155
+ return 'neutral';
156
+ }
157
+ }
158
+ var DataCell = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
159
+ var className = _ref.className,
160
+ _ref$padding = _ref.padding,
161
+ padding = _ref$padding === void 0 ? 'default' : _ref$padding,
162
+ status = _ref.status,
163
+ variant = _ref.variant,
164
+ children = _ref.children,
165
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
166
+ // If variant is undefined and status is defined, map status to variant
167
+ if (!variant && status) {
168
+ variant = mapStatusToVariant(status);
169
+ }
170
+ return React.createElement("td", _extends({
171
+ ref: ref,
172
+ className: classNames('eds-table__data-cell', className, {
173
+ 'eds-table__data-cell--padding-checkbox': padding === 'checkbox',
174
+ 'eds-table__data-cell--padding-radio': padding === 'radio',
175
+ 'eds-table__data-cell--padding-overflow-menu': padding === 'overflow-menu'
176
+ })
177
+ }, rest), variant ? React.createElement(layout.BulletBadge, {
178
+ variant: variant
179
+ }, children) : children);
180
+ });
181
+
182
+ var _excluded$3 = ["className", "children", "name", "sortable", "sortConfig", "padding", "sortableButtonProps", "sortedAscendingAriaLabel", "sortedDescendingAriaLabel"],
183
+ _excluded2$1 = ["className"];
184
+ var HeaderCell = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
185
+ var className = _ref.className,
186
+ children = _ref.children,
187
+ name = _ref.name,
188
+ _ref$sortable = _ref.sortable,
189
+ sortable = _ref$sortable === void 0 ? false : _ref$sortable,
190
+ sortConfig = _ref.sortConfig,
191
+ _ref$padding = _ref.padding,
192
+ padding = _ref$padding === void 0 ? 'default' : _ref$padding,
193
+ sortableButtonProps = _ref.sortableButtonProps,
194
+ _ref$sortedAscendingA = _ref.sortedAscendingAriaLabel,
195
+ sortedAscendingAriaLabel = _ref$sortedAscendingA === void 0 ? ', sortert stigende' : _ref$sortedAscendingA,
196
+ _ref$sortedDescending = _ref.sortedDescendingAriaLabel,
197
+ sortedDescendingAriaLabel = _ref$sortedDescending === void 0 ? ', sortert synkende' : _ref$sortedDescending,
198
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
199
+ var _React$useState = React.useState(false),
200
+ isCurrentlySorted = _React$useState[0],
201
+ setIsCurrentlySorted = _React$useState[1];
202
+ React.useEffect(function () {
203
+ sortConfig && name && setIsCurrentlySorted(sortConfig && name === sortConfig.key);
204
+ }, [sortConfig, name]);
205
+ var ariaSort = isCurrentlySorted ? sortConfig && sortConfig.order : undefined;
206
+ return React.createElement("th", _extends({
207
+ className: classNames('eds-table__header-cell', className, {
208
+ 'eds-table__header-cell--sortable': sortable,
209
+ 'eds-table__header-cell--padding-radio': padding === 'radio',
210
+ 'eds-table__header-cell--padding-checkbox': padding === 'checkbox',
211
+ 'eds-table__header-cell--padding-overflow-menu': padding === 'overflow-menu'
212
+ }),
213
+ "aria-sort": ariaSort,
214
+ ref: ref
215
+ }, rest), sortable && sortConfig && sortableButtonProps ? React.createElement(SortableHeaderCellButton, {
216
+ sortableButtonProps: sortableButtonProps,
217
+ sortConfig: sortConfig,
218
+ isCurrentlySorted: isCurrentlySorted,
219
+ ariaSort: ariaSort,
220
+ sortedAscendingAriaLabel: sortedAscendingAriaLabel,
221
+ sortedDescendingAriaLabel: sortedDescendingAriaLabel
222
+ }, children) : children);
223
+ });
224
+ var SortableHeaderCellButton = function SortableHeaderCellButton(_ref2) {
225
+ var sortConfig = _ref2.sortConfig,
226
+ sortableButtonProps = _ref2.sortableButtonProps,
227
+ isCurrentlySorted = _ref2.isCurrentlySorted,
228
+ children = _ref2.children,
229
+ ariaSort = _ref2.ariaSort,
230
+ sortedAscendingAriaLabel = _ref2.sortedAscendingAriaLabel,
231
+ sortedDescendingAriaLabel = _ref2.sortedDescendingAriaLabel;
232
+ var _useState = React.useState(''),
233
+ sortedAriaInfo = _useState[0],
234
+ setSortedAriaInfo = _useState[1];
235
+ var className = sortableButtonProps.className,
236
+ rest = _objectWithoutPropertiesLoose(sortableButtonProps, _excluded2$1);
237
+ var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
238
+ React.useEffect(function () {
239
+ var DISMISS_SORT_INFO_TIME = 3000;
240
+ if (sortConfig.order == 'ascending') {
241
+ setSortedAriaInfo(sortedAscendingAriaLabel);
242
+ } else if (sortConfig.order == 'descending') {
243
+ setSortedAriaInfo(sortedDescendingAriaLabel);
244
+ }
245
+ var dismissAriaTimer = setTimeout(function () {
246
+ setSortedAriaInfo('');
247
+ if (isFirefox) setSortedAriaInfo(', sort ' + sortConfig.order);
248
+ }, DISMISS_SORT_INFO_TIME);
249
+ return function () {
250
+ return clearTimeout(dismissAriaTimer);
251
+ };
252
+ }, [sortConfig.order]);
253
+ return React.createElement("button", _extends({
254
+ className: classNames('eds-table__header-cell-button', className),
255
+ type: "button",
256
+ "aria-sort": ariaSort
257
+ }, rest), children, (!isCurrentlySorted || sortConfig.order === 'none') && React.createElement(icons.UnsortedIcon, {
258
+ size: "1em",
259
+ className: "eds-table__header-cell-button-icon",
260
+ "aria-hidden": "true"
261
+ }), isCurrentlySorted && sortConfig.order === 'ascending' && React.createElement(icons.UpArrowIcon, {
262
+ size: "1em",
263
+ className: "eds-table__header-cell-button-icon",
264
+ "aria-hidden": "true"
265
+ }), isCurrentlySorted && sortConfig.order === 'descending' && React.createElement(icons.DownArrowIcon, {
266
+ size: "1em",
267
+ className: "eds-table__header-cell-button-icon",
268
+ "aria-hidden": "true"
269
+ }), React.createElement(a11y.VisuallyHidden, null, isCurrentlySorted && sortedAriaInfo));
270
+ };
271
+
272
+ var _excluded$2 = ["name", "sortable", "buttonProps"],
273
+ _excluded2 = ["sortable"];
274
+ function useSortableData(tableData, externalSortConfig) {
275
+ if (externalSortConfig === void 0) {
276
+ externalSortConfig = {
277
+ key: '',
278
+ order: 'none'
279
+ };
280
+ }
281
+ var _useState = React.useState(externalSortConfig),
282
+ sortConfig = _useState[0],
283
+ setSortConfig = _useState[1];
284
+ var onSortRequested = function onSortRequested(key) {
285
+ var sortingNewColumn = key !== sortConfig.key;
286
+ if (sortingNewColumn || sortConfig.order === 'none') return setSortConfig({
287
+ key: key,
288
+ order: 'ascending'
289
+ });
290
+ if (sortConfig.order === 'ascending') return setSortConfig({
291
+ key: key,
292
+ order: 'descending'
293
+ });
294
+ if (sortConfig.order === 'descending') return setSortConfig({
295
+ key: key,
296
+ order: 'none'
297
+ });
298
+ };
299
+ var tableSortedAscending = React.useMemo(function () {
300
+ return [].concat(tableData).sort(function (a, b) {
301
+ var _get$toString, _get, _get$toString2, _get2;
302
+ var valueOfA = (_get$toString = (_get = get(a, sortConfig.key, a)) == null ? void 0 : _get.toString()) != null ? _get$toString : '';
303
+ var valueOfB = (_get$toString2 = (_get2 = get(b, sortConfig.key, b)) == null ? void 0 : _get2.toString()) != null ? _get$toString2 : '';
304
+ var stringComparator = new Intl.Collator(['no', 'en'], {
305
+ numeric: true,
306
+ sensitivity: 'base'
307
+ });
308
+ return stringComparator.compare(valueOfA, valueOfB);
309
+ });
310
+ }, [tableData, sortConfig.key]);
311
+ var sortedData = React.useMemo(function () {
312
+ switch (sortConfig.order) {
313
+ case 'ascending':
314
+ {
315
+ return tableSortedAscending;
316
+ }
317
+ case 'descending':
318
+ {
319
+ return [].concat(tableSortedAscending).reverse();
320
+ }
321
+ case 'none':
322
+ {
323
+ return tableData;
324
+ }
325
+ default:
326
+ {
327
+ return tableData;
328
+ }
329
+ }
330
+ }, [sortConfig.order, tableData, tableSortedAscending]);
331
+ var getSortableHeaderProps = function getSortableHeaderProps(_ref) {
332
+ var name = _ref.name,
333
+ _ref$sortable = _ref.sortable,
334
+ sortable = _ref$sortable === void 0 ? true : _ref$sortable,
335
+ buttonProps = _ref.buttonProps,
336
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
337
+ return _extends({
338
+ name: name,
339
+ sortable: sortable,
340
+ sortConfig: sortConfig,
341
+ sortableButtonProps: _extends({
342
+ onClick: function onClick() {
343
+ return onSortRequested(name);
344
+ }
345
+ }, buttonProps)
346
+ }, props);
347
+ };
348
+ var getSortableTableProps = function getSortableTableProps(_temp) {
349
+ var _ref2 = _temp === void 0 ? {} : _temp,
350
+ _ref2$sortable = _ref2.sortable,
351
+ sortable = _ref2$sortable === void 0 ? true : _ref2$sortable,
352
+ props = _objectWithoutPropertiesLoose(_ref2, _excluded2);
353
+ return _extends({
354
+ sortable: sortable,
355
+ sortConfig: sortConfig
356
+ }, props);
357
+ };
358
+ return {
359
+ sortedData: sortedData,
360
+ getSortableHeaderProps: getSortableHeaderProps,
361
+ getSortableTableProps: getSortableTableProps
362
+ };
363
+ }
364
+
365
+ var _excluded$1 = ["children", "className", "feedback", "variant", "outlined"];
366
+ var EditableCell = function EditableCell(_ref) {
367
+ var children = _ref.children,
368
+ className = _ref.className,
369
+ feedback = _ref.feedback,
370
+ variant = _ref.variant,
371
+ _ref$outlined = _ref.outlined,
372
+ outlined = _ref$outlined === void 0 ? false : _ref$outlined,
373
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
374
+ return React.createElement(form.VariantProvider, {
375
+ variant: variant
376
+ }, React.createElement(DataCell, _extends({
377
+ className: classNames('eds-editable-cell', {
378
+ 'eds-editable-cell--outlined': outlined
379
+ }, className)
380
+ }, rest), React.createElement(tooltip.Tooltip, {
381
+ disableHoverListener: !feedback,
382
+ disableFocusListener: !feedback,
383
+ placement: "bottom",
384
+ content: feedback || undefined,
385
+ variant: feedback ? 'negative' : undefined
386
+ }, children)));
387
+ };
388
+
389
+ var ExpandableRow = function ExpandableRow(_ref) {
390
+ var _ref$open = _ref.open,
391
+ open = _ref$open === void 0 ? false : _ref$open,
392
+ children = _ref.children,
393
+ colSpan = _ref.colSpan;
394
+ return React.createElement("tr", null, React.createElement("td", {
395
+ colSpan: colSpan
396
+ }, React.createElement(expand.BaseExpand, {
397
+ open: open
398
+ }, children)));
399
+ };
400
+
401
+ var _excluded = ["open", "onClick"];
402
+ var ExpandRowButton = function ExpandRowButton(_ref) {
403
+ var open = _ref.open,
404
+ onClick = _ref.onClick,
405
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
406
+ return React.createElement(button.IconButton, _extends({
407
+ className: classNames('eds-expand-row-button', {
408
+ 'eds-expand-row-button--open': open
409
+ }),
410
+ onClick: onClick,
411
+ "aria-label": open ? 'Lukk tabellrad' : 'Utvid tabellrad',
412
+ type: "button"
413
+ }, rest), React.createElement(icons.DownArrowIcon, {
414
+ "aria-hidden": true,
415
+ className: "eds-expand-row-button__icon"
416
+ }));
417
+ };
418
+
419
+ function onTableKeypress(event, currentRow, maxRow, allowWrap) {
420
+ var keyPress = event.key;
421
+ switch (keyPress) {
422
+ case 'ArrowUp':
423
+ event.preventDefault();
424
+ if (allowWrap) {
425
+ return currentRow === 0 ? maxRow - 1 : currentRow - 1;
426
+ } else {
427
+ return currentRow > 0 ? currentRow - 1 : 0;
428
+ }
429
+ case 'ArrowDown':
430
+ event.preventDefault();
431
+ if (allowWrap) {
432
+ return currentRow === maxRow - 1 ? 0 : currentRow + 1;
433
+ } else {
434
+ return currentRow < maxRow - 1 ? currentRow + 1 : currentRow;
435
+ }
436
+ default:
437
+ return currentRow;
438
+ }
439
+ }
440
+ var useTableKeyboardNavigation = function useTableKeyboardNavigation(numberOfRows, allowWrap) {
441
+ var _tableBodyRef$current;
442
+ if (numberOfRows === void 0) {
443
+ numberOfRows = 0;
444
+ }
445
+ if (allowWrap === void 0) {
446
+ allowWrap = true;
447
+ }
448
+ var _useState = React.useState(numberOfRows),
449
+ currentRow = _useState[0],
450
+ setCurrentRow = _useState[1];
451
+ var _useState2 = React.useState(0),
452
+ maxRow = _useState2[0],
453
+ setMaxRow = _useState2[1];
454
+ var tableBodyRef = React.useRef(null);
455
+ var tableHasFocus = tableBodyRef == null || (_tableBodyRef$current = tableBodyRef.current) == null ? void 0 : _tableBodyRef$current.contains(document.activeElement);
456
+ React.useEffect(function () {
457
+ var _tableBodyRef$current2;
458
+ tableBodyRef && tableBodyRef.current && tableHasFocus && ((_tableBodyRef$current2 = tableBodyRef.current.childNodes[currentRow].childNodes[0].parentElement) == null ? void 0 : _tableBodyRef$current2.focus());
459
+ }, [currentRow, tableHasFocus]);
460
+ function getTableBodyNavigationProps() {
461
+ for (var _len = arguments.length, rest = new Array(_len), _key = 0; _key < _len; _key++) {
462
+ rest[_key] = arguments[_key];
463
+ }
464
+ return _extends({
465
+ ref: tableBodyRef
466
+ }, rest);
467
+ }
468
+ var tableRowRef = React.useRef(null);
469
+ function getTableRowNavigationProps(row) {
470
+ if (row >= maxRow) {
471
+ setMaxRow(row + 1);
472
+ }
473
+ var tabIndex = currentRow ? 0 : -1;
474
+ for (var _len2 = arguments.length, rest = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
475
+ rest[_key2 - 1] = arguments[_key2];
476
+ }
477
+ return _extends({
478
+ tabIndex: tabIndex,
479
+ ref: tableRowRef,
480
+ onClick: function onClick() {
481
+ return setCurrentRow(row);
482
+ },
483
+ onKeyDown: function onKeyDown(e) {
484
+ var newCell = onTableKeypress(e, currentRow, numberOfRows, allowWrap);
485
+ setCurrentRow(newCell);
486
+ }
487
+ }, rest);
488
+ }
489
+ return {
490
+ getTableRowNavigationProps: getTableRowNavigationProps,
491
+ getTableBodyNavigationProps: getTableBodyNavigationProps
492
+ };
493
+ };
494
+
495
+ utils.warnAboutMissingStyles('table');
496
+
497
+ exports.DataCell = DataCell;
498
+ exports.EditableCell = EditableCell;
499
+ exports.ExpandRowButton = ExpandRowButton;
500
+ exports.ExpandableRow = ExpandableRow;
501
+ exports.HeaderCell = HeaderCell;
502
+ exports.Table = Table;
503
+ exports.TableBody = TableBody;
504
+ exports.TableFooter = TableFooter;
505
+ exports.TableHead = TableHead;
506
+ exports.TableRow = TableRow;
507
+ exports.useSortableData = useSortableData;
508
+ exports.useTableKeyboardNavigation = useTableKeyboardNavigation;
509
+ //# sourceMappingURL=table.cjs.development.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.cjs.development.js","sources":["../src/Table.tsx","../src/TableHead.tsx","../src/TableBody.tsx","../src/TableFooter.tsx","../src/TableRow.tsx","../src/DataCell.tsx","../src/HeaderCell.tsx","../src/useSortableTable.ts","../src/EditableCell.tsx","../src/ExpandableRow.tsx","../src/ExpandRowButton.tsx","../src/useTableKeyboardNavigation.ts","../src/index.tsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport classNames from 'classnames';\nimport { useRandomId, mergeRefs } from '@entur/utils';\nimport { VisuallyHidden } from '@entur/a11y';\n\nexport type TableProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Setter tettheten mellom rader og kolonner. Bruk gjerne middle og small for for sider med høy informasjonstetthet\n * @default \"default\"\n */\n spacing?: 'default' | 'middle' | 'small';\n /** Setter kolonne-layout til å være uavhengig av innhold\n * @default false\n */\n fixed?: boolean;\n /** Om header-raden skal bli værende på skjermen når man skroller tabellen\n * @default false\n */\n stickyHeader?: boolean;\n /** Innholdet i tabellen */\n children: React.ReactNode;\n [key: string]: any;\n};\nexport const Table = React.forwardRef<HTMLTableElement, TableProps>(\n (\n {\n className,\n fixed = false,\n spacing = 'default',\n sortable = false,\n changeSortDescription = 'Tabelloverskrifter med knapper kan trykkes på for å endre sortering,',\n stickyHeader = false,\n ...rest\n },\n ref,\n ) => {\n const sortableHeaderId = useRandomId('sortable-header');\n\n const tableRef = useRef<HTMLTableElement>(null);\n\n useEffect(() => {\n if (stickyHeader) {\n /* We check when an inserted div above the header \n is outside our scrolling container to determine when\n the table header becomes sticky. This is necessary\n to conditionally add our box-shadow when the \n header is overlapping table rows */\n const tableElement = tableRef.current;\n const observerElement = document.createElement('div');\n observerElement.classList.add('sticky-observer');\n\n tableElement?.parentNode?.insertBefore(observerElement, tableElement);\n\n const observer = new IntersectionObserver(\n entries => {\n tableElement?.classList.toggle(\n 'eds-table--sticky-header--active',\n !entries[0].isIntersecting,\n );\n },\n { threshold: [0, 1] },\n );\n\n observer.observe(observerElement);\n\n return () => {\n observer.unobserve(observerElement);\n observerElement.remove();\n };\n }\n }, [stickyHeader]);\n\n return (\n <>\n <table\n className={classNames(\n 'eds-table',\n { 'eds-table--fixed': fixed },\n { 'eds-table--middle': spacing === 'middle' },\n { 'eds-table--small': spacing === 'small' },\n { 'eds-table--sortable': sortable },\n { 'eds-table--sticky-header': stickyHeader },\n className,\n )}\n ref={mergeRefs(ref, tableRef)}\n aria-describedby={sortable ? sortableHeaderId : undefined}\n {...rest}\n />\n {sortable && (\n <VisuallyHidden id={sortableHeaderId}>\n {changeSortDescription}\n </VisuallyHidden>\n )}\n </>\n );\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\n\nexport type TableHeadProps = {\n /** Kolonneoverskrifter */\n children: React.ReactNode;\n /** Esktra klassenavn */\n className?: string;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLTableSectionElement>,\n HTMLTableSectionElement\n>;\n\nexport const TableHead = React.forwardRef<\n HTMLTableSectionElement,\n TableHeadProps\n>(({ className, ...props }, ref) => (\n <thead\n className={classNames('eds-table__head', className)}\n ref={ref}\n {...props}\n />\n));\n","import React from 'react';\nimport classNames from 'classnames';\n\nexport type TableBodyProps = {\n /** Tabellrader */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n ref?: React.Ref<HTMLTableSectionElement>;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLTableSectionElement>,\n HTMLTableSectionElement\n>;\n\nexport const TableBody = React.forwardRef<\n HTMLTableSectionElement,\n TableBodyProps\n>(({ className, ...rest }, ref) => (\n <tbody\n className={classNames('eds-table__body', className)}\n ref={ref}\n {...rest}\n />\n));\n","import React from 'react';\n\nexport type TableFooterProps = {\n /** Tabellrader */\n children: React.ReactNode;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLTableSectionElement>,\n HTMLTableSectionElement\n>;\n\nexport const TableFooter = React.forwardRef<\n HTMLTableSectionElement,\n TableFooterProps\n>(({ ...props }, ref) => <tfoot ref={ref} {...props} />);\n","import React from 'react';\nimport classNames from 'classnames';\n\nexport type TableRowProps = {\n /** Tabellceller */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /**Hvis satt, så vil tabellraden endre fargen ved hover\n * @default false\n */\n hover?: boolean;\n /** Om raden er klikkbar, så vil raden endre farge, og musepekeren vil symbolisere interaktivitet\n * @default false\n */\n active?: boolean;\n /**Signalisere om at det er en feil i tabellraden\n * @default false\n */\n error?: boolean;\n ref?: React.Ref<HTMLTableRowElement>;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLTableRowElement>,\n HTMLTableRowElement\n>;\n\nexport const TableRow = React.forwardRef<HTMLTableRowElement, TableRowProps>(\n (\n { className, hover = false, active = false, error = false, ...rest },\n ref: React.Ref<HTMLTableRowElement>,\n ) => (\n <tr\n className={classNames('eds-table__row', className, {\n 'eds-table__row--hover': hover,\n 'eds-table__row--active': active,\n 'eds-table__row--error': error,\n })}\n ref={ref}\n {...rest}\n />\n ),\n);\n","import React from 'react';\nimport classNames from 'classnames';\n\nimport { BulletBadge } from '@entur/layout';\nimport { VariantType } from '@entur/utils';\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst danger = 'danger';\n\nexport type DataCellProps = {\n /** Innholdet i tabellcellen */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Størrelse som settes for DataCell for ulikt innhold av komponenter */\n padding?: 'default' | 'checkbox' | 'radio' | 'overflow-menu';\n /** @deprecated bruk variant */\n status?: 'positive' | 'negative' | 'neutral';\n /** Hvilken type status man vil vise */\n variant?: 'primary' | 'neutral' | VariantType | typeof danger | typeof info;\n} & React.DetailedHTMLProps<\n React.TdHTMLAttributes<HTMLTableDataCellElement>,\n HTMLTableDataCellElement\n>;\n\nfunction mapStatusToVariant(\n status: 'positive' | 'negative' | 'neutral',\n): DataCellProps['variant'] {\n switch (status) {\n case 'positive':\n return 'success';\n case 'negative':\n return 'negative';\n case 'neutral':\n return 'neutral';\n default:\n return 'neutral';\n }\n}\n\nexport const DataCell = React.forwardRef<\n HTMLTableDataCellElement,\n DataCellProps\n>(\n (\n { className, padding = 'default', status, variant, children, ...rest },\n ref: React.Ref<HTMLTableDataCellElement>,\n ) => {\n // If variant is undefined and status is defined, map status to variant\n if (!variant && status) {\n variant = mapStatusToVariant(status);\n }\n return (\n <td\n ref={ref}\n className={classNames('eds-table__data-cell', className, {\n 'eds-table__data-cell--padding-checkbox': padding === 'checkbox',\n 'eds-table__data-cell--padding-radio': padding === 'radio',\n 'eds-table__data-cell--padding-overflow-menu':\n padding === 'overflow-menu',\n })}\n {...rest}\n >\n {variant ? (\n <BulletBadge variant={variant}>{children}</BulletBadge>\n ) : (\n children\n )}\n </td>\n );\n },\n);\n","import React, { useEffect, useState } from 'react';\nimport classNames from 'classnames';\n\nimport { DownArrowIcon, UpArrowIcon, UnsortedIcon } from '@entur/icons';\n\nimport { ExternalSortConfig } from '.';\n\nimport './HeaderCell.scss';\nimport { VisuallyHidden } from '@entur/a11y';\n\nexport type HeaderCellProps = {\n /** Kolonneoverskrift */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Størrelse som settes for HeaderCell for ulikt innhold av komponenter */\n padding?: 'default' | 'checkbox' | 'radio' | 'overflow-menu';\n\n /** Ekstra props som kan sendes til sorteringsknappelementet. Benyttes via useSortableTable */\n sortableButtonProps?: React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n >;\n\n /** Om komponenten brukes til sortering. Benytt via useSortableTable\n * @default false\n */\n sortable?: boolean;\n /** Konfigurering og rekkefølgen på sortering. Benyttes via useSortableTable */\n sortConfig?: ExternalSortConfig;\n /** Navnet det skal sorteres på. Benyttes via useSortableTable */\n name?: string;\n sortedAscendingAriaLabel?: string;\n sortedDescendingAriaLabel?: string;\n} & React.DetailedHTMLProps<\n React.ThHTMLAttributes<HTMLTableCellElement>,\n HTMLTableCellElement\n>;\n\nexport const HeaderCell = React.forwardRef<\n HTMLTableCellElement,\n HeaderCellProps\n>(\n (\n {\n className,\n children,\n name,\n sortable = false,\n sortConfig,\n padding = 'default',\n sortableButtonProps,\n sortedAscendingAriaLabel = ', sortert stigende',\n sortedDescendingAriaLabel = ', sortert synkende',\n ...rest\n },\n ref,\n ) => {\n const [isCurrentlySorted, setIsCurrentlySorted] =\n React.useState<boolean>(false);\n React.useEffect(() => {\n sortConfig &&\n name &&\n setIsCurrentlySorted(sortConfig && name === sortConfig.key);\n }, [sortConfig, name]);\n const ariaSort = isCurrentlySorted\n ? sortConfig && sortConfig.order\n : undefined;\n\n return (\n <th\n className={classNames('eds-table__header-cell', className, {\n 'eds-table__header-cell--sortable': sortable,\n 'eds-table__header-cell--padding-radio': padding === 'radio',\n 'eds-table__header-cell--padding-checkbox': padding === 'checkbox',\n 'eds-table__header-cell--padding-overflow-menu':\n padding === 'overflow-menu',\n })}\n aria-sort={ariaSort}\n ref={ref}\n {...rest}\n >\n {sortable && sortConfig && sortableButtonProps ? (\n <SortableHeaderCellButton\n sortableButtonProps={sortableButtonProps}\n sortConfig={sortConfig}\n isCurrentlySorted={isCurrentlySorted}\n ariaSort={ariaSort}\n sortedAscendingAriaLabel={sortedAscendingAriaLabel}\n sortedDescendingAriaLabel={sortedDescendingAriaLabel}\n >\n {children}\n </SortableHeaderCellButton>\n ) : (\n children\n )}\n </th>\n );\n },\n);\n\ntype SortableHeaderCellButtonProps = {\n sortConfig: ExternalSortConfig;\n isCurrentlySorted: boolean;\n sortableButtonProps: React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n >;\n ariaSort?: 'none' | 'ascending' | 'descending' | 'other' | undefined;\n sortedAscendingAriaLabel?: string;\n sortedDescendingAriaLabel?: string;\n};\n\nconst SortableHeaderCellButton: React.FC<SortableHeaderCellButtonProps> = ({\n sortConfig,\n sortableButtonProps,\n isCurrentlySorted,\n children,\n ariaSort,\n sortedAscendingAriaLabel,\n sortedDescendingAriaLabel,\n}) => {\n const [sortedAriaInfo, setSortedAriaInfo] = useState<string | undefined>('');\n\n const { className, ...rest } = sortableButtonProps;\n\n const isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;\n\n useEffect(() => {\n const DISMISS_SORT_INFO_TIME = 3000;\n if (sortConfig.order == 'ascending') {\n setSortedAriaInfo(sortedAscendingAriaLabel);\n } else if (sortConfig.order == 'descending') {\n setSortedAriaInfo(sortedDescendingAriaLabel);\n }\n const dismissAriaTimer = setTimeout(() => {\n setSortedAriaInfo('');\n if (isFirefox) setSortedAriaInfo(', sort ' + sortConfig.order);\n }, DISMISS_SORT_INFO_TIME);\n\n return () => clearTimeout(dismissAriaTimer);\n }, [sortConfig.order]);\n\n return (\n <button\n className={classNames('eds-table__header-cell-button', className)}\n type=\"button\"\n aria-sort={ariaSort}\n {...rest}\n >\n {children}\n {(!isCurrentlySorted || sortConfig.order === 'none') && (\n <UnsortedIcon\n size=\"1em\"\n className=\"eds-table__header-cell-button-icon\"\n aria-hidden=\"true\"\n />\n )}\n {isCurrentlySorted && sortConfig.order === 'ascending' && (\n <UpArrowIcon\n size=\"1em\"\n className=\"eds-table__header-cell-button-icon\"\n aria-hidden=\"true\"\n />\n )}\n {isCurrentlySorted && sortConfig.order === 'descending' && (\n <DownArrowIcon\n size=\"1em\"\n className=\"eds-table__header-cell-button-icon\"\n aria-hidden=\"true\"\n />\n )}\n <VisuallyHidden>{isCurrentlySorted && sortedAriaInfo}</VisuallyHidden>\n </button>\n );\n};\n","import {\n ButtonHTMLAttributes,\n DetailedHTMLProps,\n useMemo,\n useState,\n} from 'react';\nimport get from 'lodash.get';\n\nexport type ExternalSortConfig = {\n /**\n * @default \"\"\n */\n key: string;\n /** @default \"none\" */\n order: 'ascending' | 'descending' | 'none';\n};\n\nexport function useSortableData<T>(\n tableData: T[],\n externalSortConfig: ExternalSortConfig = { key: '', order: 'none' },\n): {\n sortedData: T[];\n getSortableHeaderProps: (\n args: SortableHeaderProps,\n ) => SortableHeaderReturnProps;\n getSortableTableProps: (\n args?: SortableTableProps,\n ) => SortableTableReturnProps;\n} {\n const [sortConfig, setSortConfig] = useState(externalSortConfig);\n\n const onSortRequested = (key: string) => {\n const sortingNewColumn = key !== sortConfig.key;\n if (sortingNewColumn || sortConfig.order === 'none')\n return setSortConfig({ key, order: 'ascending' });\n if (sortConfig.order === 'ascending')\n return setSortConfig({ key, order: 'descending' });\n if (sortConfig.order === 'descending')\n return setSortConfig({ key, order: 'none' });\n };\n\n const tableSortedAscending = useMemo(\n () =>\n [...tableData].sort((a: any, b: any) => {\n const valueOfA: string = get(a, sortConfig.key, a)?.toString() ?? '';\n const valueOfB: string = get(b, sortConfig.key, b)?.toString() ?? '';\n\n const stringComparator = new Intl.Collator(['no', 'en'], {\n numeric: true,\n sensitivity: 'base',\n });\n\n return stringComparator.compare(valueOfA, valueOfB);\n }),\n [tableData, sortConfig.key],\n );\n\n const sortedData = useMemo(() => {\n switch (sortConfig.order) {\n case 'ascending': {\n return tableSortedAscending;\n }\n case 'descending': {\n return [...tableSortedAscending].reverse();\n }\n case 'none': {\n return tableData;\n }\n default: {\n return tableData;\n }\n }\n }, [sortConfig.order, tableData, tableSortedAscending]);\n\n const getSortableHeaderProps = ({\n name,\n sortable = true,\n buttonProps,\n ...props\n }: SortableHeaderProps): SortableHeaderReturnProps => {\n return {\n name,\n sortable,\n sortConfig: sortConfig,\n sortableButtonProps: {\n onClick: () => onSortRequested(name),\n ...buttonProps,\n },\n ...props,\n };\n };\n\n const getSortableTableProps = ({\n sortable = true,\n ...props\n }: SortableTableProps = {}): SortableTableReturnProps => {\n return {\n sortable,\n sortConfig: sortConfig,\n ...props,\n };\n };\n\n return { sortedData, getSortableHeaderProps, getSortableTableProps };\n}\n\nexport type SortableHeaderProps = {\n /** Navnet headeren skal se etter i forhold til sortering av items */\n name: string;\n /** Om headeren skal være sorterbar eller ikke\n * @default true */\n sortable?: boolean;\n /** Props som sendes til knapp-elementet */\n buttonProps?: Omit<\n DetailedHTMLProps<\n ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n >,\n 'type' | 'onClick'\n >;\n [key: string]: any;\n};\n\nexport type SortableHeaderReturnProps = {\n name: string;\n sortable: boolean;\n sortConfig: ExternalSortConfig;\n [key: string]: any;\n};\n\nexport type SortableTableProps = {\n /** @default true */\n sortable?: boolean;\n [key: string]: any;\n};\n\nexport type SortableTableReturnProps = {\n /** @default true */\n sortable?: boolean;\n sortConfig: ExternalSortConfig;\n [key: string]: any;\n};\n","import classNames from 'classnames';\nimport React from 'react';\nimport { DataCell } from './DataCell';\n\nimport { VariantProvider } from '@entur/form';\nimport { VariantType } from '@entur/utils';\nimport { Tooltip } from '@entur/tooltip';\n\nimport './EditableCell.scss';\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\ntype EditableCellProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Inputelementet som skal være i tabellcellen */\n children: React.ReactElement;\n /** Valideringsvariant for EditableCell */\n variant?: VariantType | typeof error | typeof info;\n /** Varselmelding, som vil komme som en Tooltip under EditableCell */\n feedback?: string;\n /** Om cellen skal vise omriss til enhver tid\n * @default false\n */\n outlined?: boolean;\n [key: string]: any;\n};\n\nexport const EditableCell: React.FC<EditableCellProps> = ({\n children,\n className,\n feedback,\n variant,\n outlined = false,\n ...rest\n}) => {\n return (\n <VariantProvider variant={variant}>\n <DataCell\n className={classNames(\n 'eds-editable-cell',\n {\n 'eds-editable-cell--outlined': outlined,\n },\n className,\n )}\n {...rest}\n >\n <Tooltip\n disableHoverListener={!feedback}\n disableFocusListener={!feedback}\n placement=\"bottom\"\n content={feedback || undefined}\n variant={feedback ? 'negative' : undefined}\n >\n {children}\n </Tooltip>\n </DataCell>\n </VariantProvider>\n );\n};\n","import React from 'react';\nimport { BaseExpand } from '@entur/expand';\n\nexport type ExpandableRowProps = {\n /** Antall kolonner tabellraden er */\n colSpan: number;\n /** Innholdet til ExpandableRow */\n children: React.ReactNode;\n /** Om ExpandableRow er åpen\n * @default false\n */\n open?: boolean;\n};\n\nexport const ExpandableRow: React.FC<ExpandableRowProps> = ({\n open = false,\n children,\n colSpan,\n}) => {\n return (\n <tr>\n <td colSpan={colSpan}>\n <BaseExpand open={open}>{children}</BaseExpand>\n </td>\n </tr>\n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport { DownArrowIcon } from '@entur/icons';\nimport { IconButton } from '@entur/button';\nimport './ExpandRowButton.scss';\n\nexport type ExpandRowButtonProps = {\n open: boolean;\n onClick: (e: React.MouseEvent) => void;\n} & React.ButtonHTMLAttributes<HTMLButtonElement>;\n\nexport const ExpandRowButton: React.FC<ExpandRowButtonProps> = ({\n open,\n onClick,\n ...rest\n}) => {\n return (\n <IconButton\n className={classNames('eds-expand-row-button', {\n 'eds-expand-row-button--open': open,\n })}\n onClick={onClick}\n aria-label={open ? 'Lukk tabellrad' : 'Utvid tabellrad'}\n type=\"button\"\n {...rest}\n >\n <DownArrowIcon aria-hidden className=\"eds-expand-row-button__icon\" />\n </IconButton>\n );\n};\n","import { useState, useEffect, useRef, KeyboardEvent } from 'react';\nimport { TableBodyProps, TableRowProps } from './index';\n\nfunction onTableKeypress(\n event: KeyboardEvent,\n currentRow: number,\n maxRow: number,\n allowWrap?: boolean,\n) {\n const keyPress = event.key;\n switch (keyPress) {\n case 'ArrowUp':\n event.preventDefault();\n if (allowWrap) {\n return currentRow === 0 ? maxRow - 1 : currentRow - 1;\n } else {\n return currentRow > 0 ? currentRow - 1 : 0;\n }\n case 'ArrowDown':\n event.preventDefault();\n if (allowWrap) {\n return currentRow === maxRow - 1 ? 0 : currentRow + 1;\n } else {\n return currentRow < maxRow - 1 ? currentRow + 1 : currentRow;\n }\n default:\n return currentRow;\n }\n}\n\nexport type useTableKeyboardNavigationProps = (\n /** Antall rader i tabellen */\n numberOfRows: number,\n /** Tillate at man kan navigere sirkulært\n * @default false\n */\n allowWrap?: boolean,\n) => {\n getTableRowNavigationProps: (\n /** Raden i tabellen (0-indeksert) */\n row: number,\n ) => Partial<TableRowProps>;\n getTableBodyNavigationProps: () => Partial<TableBodyProps>;\n};\n\nexport const useTableKeyboardNavigation: useTableKeyboardNavigationProps = (\n numberOfRows = 0,\n allowWrap = true,\n) => {\n const [currentRow, setCurrentRow] = useState(numberOfRows);\n const [maxRow, setMaxRow] = useState(0);\n\n const tableBodyRef = useRef<HTMLTableSectionElement>(null);\n const tableHasFocus = tableBodyRef?.current?.contains(document.activeElement);\n\n useEffect(() => {\n tableBodyRef &&\n tableBodyRef.current &&\n tableHasFocus &&\n tableBodyRef.current.childNodes[\n currentRow\n ].childNodes[0].parentElement?.focus();\n }, [currentRow, tableHasFocus]);\n\n function getTableBodyNavigationProps(...rest: any): Partial<TableBodyProps> {\n return {\n ref: tableBodyRef,\n ...rest,\n };\n }\n\n const tableRowRef = useRef<HTMLTableRowElement>(null);\n function getTableRowNavigationProps(\n row: number,\n ...rest: any\n ): Partial<TableRowProps> {\n if (row >= maxRow) {\n setMaxRow(row + 1);\n }\n const tabIndex = currentRow ? 0 : -1;\n return {\n tabIndex,\n ref: tableRowRef,\n onClick: () => setCurrentRow(row),\n onKeyDown: (e: KeyboardEvent) => {\n const newCell = onTableKeypress(e, currentRow, numberOfRows, allowWrap);\n setCurrentRow(newCell);\n },\n ...rest,\n };\n }\n return { getTableRowNavigationProps, getTableBodyNavigationProps };\n};\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('table');\n\nexport * from './Table';\nexport * from './TableHead';\nexport * from './TableBody';\nexport * from './TableFooter';\nexport * from './TableRow';\nexport * from './DataCell';\nexport * from './HeaderCell';\nexport * from './useSortableTable';\nexport * from './EditableCell';\nexport * from './ExpandableRow';\nexport * from './ExpandRowButton';\nexport * from './useTableKeyboardNavigation';\n"],"names":["Table","React","forwardRef","_ref","ref","className","_ref$fixed","fixed","_ref$spacing","spacing","_ref$sortable","sortable","_ref$changeSortDescri","changeSortDescription","_ref$stickyHeader","stickyHeader","rest","_objectWithoutPropertiesLoose","_excluded","sortableHeaderId","useRandomId","tableRef","useRef","useEffect","_tableElement$parentN","tableElement","current","observerElement","document","createElement","classList","add","parentNode","insertBefore","observer","IntersectionObserver","entries","toggle","isIntersecting","threshold","observe","unobserve","remove","Fragment","_extends","classNames","mergeRefs","undefined","VisuallyHidden","id","TableHead","props","TableBody","TableFooter","_objectDestructuringEmpty","TableRow","_ref$hover","hover","_ref$active","active","_ref$error","error","mapStatusToVariant","status","DataCell","_ref$padding","padding","variant","children","BulletBadge","HeaderCell","name","sortConfig","sortableButtonProps","_ref$sortedAscendingA","sortedAscendingAriaLabel","_ref$sortedDescending","sortedDescendingAriaLabel","_React$useState","useState","isCurrentlySorted","setIsCurrentlySorted","key","ariaSort","order","SortableHeaderCellButton","_ref2","_useState","sortedAriaInfo","setSortedAriaInfo","_excluded2","isFirefox","navigator","userAgent","toLowerCase","indexOf","DISMISS_SORT_INFO_TIME","dismissAriaTimer","setTimeout","clearTimeout","type","UnsortedIcon","size","UpArrowIcon","DownArrowIcon","useSortableData","tableData","externalSortConfig","setSortConfig","onSortRequested","sortingNewColumn","tableSortedAscending","useMemo","concat","sort","a","b","_get$toString","_get","_get$toString2","_get2","valueOfA","get","toString","valueOfB","stringComparator","Intl","Collator","numeric","sensitivity","compare","sortedData","reverse","getSortableHeaderProps","buttonProps","onClick","getSortableTableProps","_temp","_ref2$sortable","EditableCell","feedback","_ref$outlined","outlined","VariantProvider","Tooltip","disableHoverListener","disableFocusListener","placement","content","ExpandableRow","_ref$open","open","colSpan","BaseExpand","ExpandRowButton","IconButton","onTableKeypress","event","currentRow","maxRow","allowWrap","keyPress","preventDefault","useTableKeyboardNavigation","numberOfRows","_tableBodyRef$current","setCurrentRow","_useState2","setMaxRow","tableBodyRef","tableHasFocus","contains","activeElement","_tableBodyRef$current2","childNodes","parentElement","focus","getTableBodyNavigationProps","_len","arguments","length","Array","_key","tableRowRef","getTableRowNavigationProps","row","tabIndex","_len2","_key2","onKeyDown","e","newCell","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;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,EAA3BA,2BAAAA;GAA6B,CAAA;AACpE;;ACzFAe,4BAAsB,CAAC,OAAO,CAAC;;;;;;;;;;;;;;;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@entur/utils"),r=require("react"),t=require("classnames"),a=require("@entur/a11y"),n=require("@entur/layout"),o=require("@entur/icons"),l=require("lodash.get"),s=require("@entur/form"),i=require("@entur/tooltip"),d=require("@entur/expand"),c=require("@entur/button");function u(){return u=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var a in t)({}).hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},u.apply(null,arguments)}function f(e,r){if(null==e)return{};var t={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(-1!==r.indexOf(a))continue;t[a]=e[a]}return t}var b=["className","fixed","spacing","sortable","changeSortDescription","stickyHeader"],v=r.forwardRef((function(n,o){var l=n.className,s=n.fixed,i=void 0!==s&&s,d=n.spacing,c=void 0===d?"default":d,v=n.sortable,m=void 0!==v&&v,p=n.changeSortDescription,g=void 0===p?"Tabelloverskrifter med knapper kan trykkes på for å endre sortering,":p,h=n.stickyHeader,w=void 0!==h&&h,_=f(n,b),y=e.useRandomId("sortable-header"),E=r.useRef(null);return r.useEffect((function(){if(w){var e,r=E.current,t=document.createElement("div");t.classList.add("sticky-observer"),null==r||null==(e=r.parentNode)||e.insertBefore(t,r);var a=new IntersectionObserver((function(e){null==r||r.classList.toggle("eds-table--sticky-header--active",!e[0].isIntersecting)}),{threshold:[0,1]});return a.observe(t),function(){a.unobserve(t),t.remove()}}}),[w]),r.createElement(r.Fragment,null,r.createElement("table",u({className:t("eds-table",{"eds-table--fixed":i},{"eds-table--middle":"middle"===c},{"eds-table--small":"small"===c},{"eds-table--sortable":m},{"eds-table--sticky-header":w},l),ref:e.mergeRefs(o,E),"aria-describedby":m?y:void 0},_)),m&&r.createElement(a.VisuallyHidden,{id:y},g))})),m=["className"],p=r.forwardRef((function(e,a){var n=e.className,o=f(e,m);return r.createElement("thead",u({className:t("eds-table__head",n),ref:a},o))})),g=["className"],h=r.forwardRef((function(e,a){var n=e.className,o=f(e,g);return r.createElement("tbody",u({className:t("eds-table__body",n),ref:a},o))})),w=r.forwardRef((function(e,t){var a=u({},(function(e){if(null==e)throw new TypeError("Cannot destructure "+e)}(e),e));return r.createElement("tfoot",u({ref:t},a))})),_=["className","hover","active","error"],y=r.forwardRef((function(e,a){var n=e.className,o=e.hover,l=void 0!==o&&o,s=e.active,i=void 0!==s&&s,d=e.error,c=void 0!==d&&d,b=f(e,_);return r.createElement("tr",u({className:t("eds-table__row",n,{"eds-table__row--hover":l,"eds-table__row--active":i,"eds-table__row--error":c}),ref:a},b))})),E=["className","padding","status","variant","children"],N=r.forwardRef((function(e,a){var o=e.className,l=e.padding,s=void 0===l?"default":l,i=e.status,d=e.variant,c=e.children,b=f(e,E);return!d&&i&&(d=function(e){switch(e){case"positive":return"success";case"negative":return"negative";default:return"neutral"}}(i)),r.createElement("td",u({ref:a,className:t("eds-table__data-cell",o,{"eds-table__data-cell--padding-checkbox":"checkbox"===s,"eds-table__data-cell--padding-radio":"radio"===s,"eds-table__data-cell--padding-overflow-menu":"overflow-menu"===s})},b),d?r.createElement(n.BulletBadge,{variant:d},c):c)})),k=["className","children","name","sortable","sortConfig","padding","sortableButtonProps","sortedAscendingAriaLabel","sortedDescendingAriaLabel"],x=["className"],A=r.forwardRef((function(e,a){var n=e.className,o=e.children,l=e.name,s=e.sortable,i=void 0!==s&&s,d=e.sortConfig,c=e.padding,b=void 0===c?"default":c,v=e.sortableButtonProps,m=e.sortedAscendingAriaLabel,p=void 0===m?", sortert stigende":m,g=e.sortedDescendingAriaLabel,h=void 0===g?", sortert synkende":g,w=f(e,k),_=r.useState(!1),y=_[0],E=_[1];r.useEffect((function(){d&&l&&E(d&&l===d.key)}),[d,l]);var N=y?d&&d.order:void 0;return r.createElement("th",u({className:t("eds-table__header-cell",n,{"eds-table__header-cell--sortable":i,"eds-table__header-cell--padding-radio":"radio"===b,"eds-table__header-cell--padding-checkbox":"checkbox"===b,"eds-table__header-cell--padding-overflow-menu":"overflow-menu"===b}),"aria-sort":N,ref:a},w),i&&d&&v?r.createElement(C,{sortableButtonProps:v,sortConfig:d,isCurrentlySorted:y,ariaSort:N,sortedAscendingAriaLabel:p,sortedDescendingAriaLabel:h},o):o)})),C=function(e){var n=e.sortConfig,l=e.sortableButtonProps,s=e.isCurrentlySorted,i=e.children,d=e.ariaSort,c=e.sortedAscendingAriaLabel,b=e.sortedDescendingAriaLabel,v=r.useState(""),m=v[0],p=v[1],g=l.className,h=f(l,x),w=navigator.userAgent.toLowerCase().indexOf("firefox")>-1;return r.useEffect((function(){"ascending"==n.order?p(c):"descending"==n.order&&p(b);var e=setTimeout((function(){p(""),w&&p(", sort "+n.order)}),3e3);return function(){return clearTimeout(e)}}),[n.order]),r.createElement("button",u({className:t("eds-table__header-cell-button",g),type:"button","aria-sort":d},h),i,(!s||"none"===n.order)&&r.createElement(o.UnsortedIcon,{size:"1em",className:"eds-table__header-cell-button-icon","aria-hidden":"true"}),s&&"ascending"===n.order&&r.createElement(o.UpArrowIcon,{size:"1em",className:"eds-table__header-cell-button-icon","aria-hidden":"true"}),s&&"descending"===n.order&&r.createElement(o.DownArrowIcon,{size:"1em",className:"eds-table__header-cell-button-icon","aria-hidden":"true"}),r.createElement(a.VisuallyHidden,null,s&&m))},S=["name","sortable","buttonProps"],R=["sortable"],D=["children","className","feedback","variant","outlined"],P=["open","onClick"];e.warnAboutMissingStyles("table"),exports.DataCell=N,exports.EditableCell=function(e){var a=e.children,n=e.className,o=e.feedback,l=e.variant,d=e.outlined,c=void 0!==d&&d,b=f(e,D);return r.createElement(s.VariantProvider,{variant:l},r.createElement(N,u({className:t("eds-editable-cell",{"eds-editable-cell--outlined":c},n)},b),r.createElement(i.Tooltip,{disableHoverListener:!o,disableFocusListener:!o,placement:"bottom",content:o||void 0,variant:o?"negative":void 0},a)))},exports.ExpandRowButton=function(e){var a=e.open,n=e.onClick,l=f(e,P);return r.createElement(c.IconButton,u({className:t("eds-expand-row-button",{"eds-expand-row-button--open":a}),onClick:n,"aria-label":a?"Lukk tabellrad":"Utvid tabellrad",type:"button"},l),r.createElement(o.DownArrowIcon,{"aria-hidden":!0,className:"eds-expand-row-button__icon"}))},exports.ExpandableRow=function(e){var t=e.open;return r.createElement("tr",null,r.createElement("td",{colSpan:e.colSpan},r.createElement(d.BaseExpand,{open:void 0!==t&&t},e.children)))},exports.HeaderCell=A,exports.Table=v,exports.TableBody=h,exports.TableFooter=w,exports.TableHead=p,exports.TableRow=y,exports.useSortableData=function(e,t){void 0===t&&(t={key:"",order:"none"});var a=r.useState(t),n=a[0],o=a[1],s=r.useMemo((function(){return[].concat(e).sort((function(e,r){var t,a,o,s,i=null!=(t=null==(a=l(e,n.key,e))?void 0:a.toString())?t:"",d=null!=(o=null==(s=l(r,n.key,r))?void 0:s.toString())?o:"";return new Intl.Collator(["no","en"],{numeric:!0,sensitivity:"base"}).compare(i,d)}))}),[e,n.key]);return{sortedData:r.useMemo((function(){switch(n.order){case"ascending":return s;case"descending":return[].concat(s).reverse();default:return e}}),[n.order,e,s]),getSortableHeaderProps:function(e){var r=e.name,t=e.sortable,a=void 0===t||t,l=e.buttonProps,s=f(e,S);return u({name:r,sortable:a,sortConfig:n,sortableButtonProps:u({onClick:function(){return(e=r)!==n.key||"none"===n.order?o({key:e,order:"ascending"}):"ascending"===n.order?o({key:e,order:"descending"}):"descending"===n.order?o({key:e,order:"none"}):void 0;var e}},l)},s)},getSortableTableProps:function(e){var r=void 0===e?{}:e,t=r.sortable,a=void 0===t||t,o=f(r,R);return u({sortable:a,sortConfig:n},o)}}},exports.useTableKeyboardNavigation=function(e,t){var a;void 0===e&&(e=0),void 0===t&&(t=!0);var n=r.useState(e),o=n[0],l=n[1],s=r.useState(0),i=s[0],d=s[1],c=r.useRef(null),f=null==c||null==(a=c.current)?void 0:a.contains(document.activeElement);r.useEffect((function(){var e;c&&c.current&&f&&(null==(e=c.current.childNodes[o].childNodes[0].parentElement)||e.focus())}),[o,f]);var b=r.useRef(null);return{getTableRowNavigationProps:function(r){r>=i&&d(r+1);for(var a=o?0:-1,n=arguments.length,s=new Array(n>1?n-1:0),c=1;c<n;c++)s[c-1]=arguments[c];return u({tabIndex:a,ref:b,onClick:function(){return l(r)},onKeyDown:function(r){var a=function(e,r,t,a){switch(e.key){case"ArrowUp":return e.preventDefault(),a?0===r?t-1:r-1:r>0?r-1:0;case"ArrowDown":return e.preventDefault(),a?r===t-1?0:r+1:r<t-1?r+1:r;default:return r}}(r,o,e,t);l(a)}},s)},getTableBodyNavigationProps:function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];return u({ref:c},r)}}};
2
+ //# sourceMappingURL=table.cjs.production.min.js.map