@dnb/eufemia 9.39.1 → 9.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/cjs/components/accordion/style/_accordion.scss +2 -2
- package/cjs/components/accordion/style/dnb-accordion.css +3 -3
- package/cjs/components/accordion/style/dnb-accordion.min.css +1 -1
- package/cjs/components/dialog/Dialog.d.ts +1 -1
- package/cjs/components/dialog/parts/DialogAction.d.ts +5 -4
- package/cjs/components/dialog/parts/DialogAction.js +23 -4
- package/cjs/components/dialog/style/_dialog.scss +7 -30
- package/cjs/components/dialog/style/dnb-dialog.css +21 -44
- package/cjs/components/dialog/style/dnb-dialog.min.css +1 -1
- package/cjs/components/dialog/style/themes/dnb-dialog-theme-ui.css +20 -0
- package/cjs/components/dialog/style/themes/dnb-dialog-theme-ui.min.css +1 -1
- package/cjs/components/dialog/style/themes/dnb-dialog-theme-ui.scss +29 -0
- package/cjs/components/drawer/style/_drawer.scss +1 -0
- package/cjs/components/drawer/style/dnb-drawer.css +12 -22
- package/cjs/components/drawer/style/dnb-drawer.min.css +1 -1
- package/cjs/components/lib.d.ts +1 -1
- package/cjs/components/modal/style/dnb-modal.css +11 -22
- package/cjs/components/modal/style/dnb-modal.min.css +1 -1
- package/cjs/components/number-format/NumberFormat.js +1 -1
- package/cjs/components/table/Table.js +1 -1
- package/cjs/components/table/TableContainer.js +3 -1
- package/cjs/components/table/TableStickyHeader.d.ts +4 -1
- package/cjs/components/table/TableStickyHeader.js +112 -83
- package/cjs/components/table/TableTh.d.ts +1 -1
- package/cjs/components/table/TableTh.js +4 -1
- package/cjs/components/table/style/_table-cell.scss +4 -4
- package/cjs/components/table/style/_table-container.scss +7 -17
- package/cjs/components/table/style/_table-deprecated.scss +74 -0
- package/cjs/components/table/style/_table-header-buttons.scss +2 -1
- package/cjs/components/table/style/_table-sticky.scss +24 -23
- package/cjs/components/table/style/_table-td.scss +27 -46
- package/cjs/components/table/style/_table-th.scss +44 -0
- package/cjs/components/table/style/_table.scss +13 -71
- package/cjs/components/table/style/dnb-table.css +181 -132
- package/cjs/components/table/style/dnb-table.min.css +1 -1
- package/cjs/components/table/style/themes/dnb-table-theme-ui.css +78 -63
- package/cjs/components/table/style/themes/dnb-table-theme-ui.min.css +1 -1
- package/cjs/components/table/style/themes/dnb-table-theme-ui.scss +42 -17
- package/cjs/components/visually-hidden/VisuallyHidden.d.ts +2 -11
- package/cjs/components/visually-hidden/VisuallyHidden.js +2 -5
- package/cjs/components/visually-hidden/style/_visually-hidden.scss +0 -8
- package/cjs/components/visually-hidden/style/dnb-visually-hidden.css +10 -42
- package/cjs/components/visually-hidden/style/dnb-visually-hidden.min.css +1 -1
- package/cjs/shared/Eufemia.js +1 -1
- package/cjs/style/core/helper-classes/helper-classes.scss +3 -0
- package/cjs/style/core/utilities.scss +15 -16
- package/cjs/style/dnb-ui-basis.css +20 -13
- package/cjs/style/dnb-ui-basis.min.css +1 -1
- package/cjs/style/dnb-ui-components.css +205 -199
- package/cjs/style/dnb-ui-components.min.css +4 -4
- package/cjs/style/dnb-ui-core.css +20 -13
- package/cjs/style/dnb-ui-core.min.css +1 -1
- package/cjs/style/themes/theme-eiendom/dnb-theme-eiendom.css +98 -63
- package/cjs/style/themes/theme-eiendom/dnb-theme-eiendom.min.css +2 -2
- package/cjs/style/themes/theme-ui/dnb-theme-ui.css +98 -63
- package/cjs/style/themes/theme-ui/dnb-theme-ui.min.css +2 -2
- package/components/accordion/style/_accordion.scss +2 -2
- package/components/accordion/style/dnb-accordion.css +3 -3
- package/components/accordion/style/dnb-accordion.min.css +1 -1
- package/components/dialog/Dialog.d.ts +1 -1
- package/components/dialog/parts/DialogAction.d.ts +5 -4
- package/components/dialog/parts/DialogAction.js +19 -11
- package/components/dialog/style/_dialog.scss +7 -30
- package/components/dialog/style/dnb-dialog.css +21 -44
- package/components/dialog/style/dnb-dialog.min.css +1 -1
- package/components/dialog/style/themes/dnb-dialog-theme-ui.css +20 -0
- package/components/dialog/style/themes/dnb-dialog-theme-ui.min.css +1 -1
- package/components/dialog/style/themes/dnb-dialog-theme-ui.scss +29 -0
- package/components/drawer/style/_drawer.scss +1 -0
- package/components/drawer/style/dnb-drawer.css +12 -22
- package/components/drawer/style/dnb-drawer.min.css +1 -1
- package/components/lib.d.ts +1 -1
- package/components/modal/style/dnb-modal.css +11 -22
- package/components/modal/style/dnb-modal.min.css +1 -1
- package/components/number-format/NumberFormat.js +1 -1
- package/components/table/Table.js +1 -1
- package/components/table/TableContainer.js +3 -1
- package/components/table/TableStickyHeader.d.ts +4 -1
- package/components/table/TableStickyHeader.js +112 -51
- package/components/table/TableTh.d.ts +1 -1
- package/components/table/TableTh.js +4 -1
- package/components/table/style/_table-cell.scss +4 -4
- package/components/table/style/_table-container.scss +7 -17
- package/components/table/style/_table-deprecated.scss +74 -0
- package/components/table/style/_table-header-buttons.scss +2 -1
- package/components/table/style/_table-sticky.scss +24 -23
- package/components/table/style/_table-td.scss +27 -46
- package/components/table/style/_table-th.scss +44 -0
- package/components/table/style/_table.scss +13 -71
- package/components/table/style/dnb-table.css +181 -132
- package/components/table/style/dnb-table.min.css +1 -1
- package/components/table/style/themes/dnb-table-theme-ui.css +78 -63
- package/components/table/style/themes/dnb-table-theme-ui.min.css +1 -1
- package/components/table/style/themes/dnb-table-theme-ui.scss +42 -17
- package/components/visually-hidden/VisuallyHidden.d.ts +2 -11
- package/components/visually-hidden/VisuallyHidden.js +2 -5
- package/components/visually-hidden/style/_visually-hidden.scss +0 -8
- package/components/visually-hidden/style/dnb-visually-hidden.css +10 -42
- package/components/visually-hidden/style/dnb-visually-hidden.min.css +1 -1
- package/es/components/accordion/style/_accordion.scss +2 -2
- package/es/components/accordion/style/dnb-accordion.css +3 -3
- package/es/components/accordion/style/dnb-accordion.min.css +1 -1
- package/es/components/dialog/Dialog.d.ts +1 -1
- package/es/components/dialog/parts/DialogAction.d.ts +5 -4
- package/es/components/dialog/parts/DialogAction.js +21 -11
- package/es/components/dialog/style/_dialog.scss +7 -30
- package/es/components/dialog/style/dnb-dialog.css +21 -44
- package/es/components/dialog/style/dnb-dialog.min.css +1 -1
- package/es/components/dialog/style/themes/dnb-dialog-theme-ui.css +20 -0
- package/es/components/dialog/style/themes/dnb-dialog-theme-ui.min.css +1 -1
- package/es/components/dialog/style/themes/dnb-dialog-theme-ui.scss +29 -0
- package/es/components/drawer/style/_drawer.scss +1 -0
- package/es/components/drawer/style/dnb-drawer.css +12 -22
- package/es/components/drawer/style/dnb-drawer.min.css +1 -1
- package/es/components/lib.d.ts +1 -1
- package/es/components/modal/style/dnb-modal.css +11 -22
- package/es/components/modal/style/dnb-modal.min.css +1 -1
- package/es/components/number-format/NumberFormat.js +1 -1
- package/es/components/table/Table.js +1 -1
- package/es/components/table/TableContainer.js +3 -1
- package/es/components/table/TableStickyHeader.d.ts +4 -1
- package/es/components/table/TableStickyHeader.js +112 -48
- package/es/components/table/TableTh.d.ts +1 -1
- package/es/components/table/TableTh.js +4 -1
- package/es/components/table/style/_table-cell.scss +4 -4
- package/es/components/table/style/_table-container.scss +7 -17
- package/es/components/table/style/_table-deprecated.scss +74 -0
- package/es/components/table/style/_table-header-buttons.scss +2 -1
- package/es/components/table/style/_table-sticky.scss +24 -23
- package/es/components/table/style/_table-td.scss +27 -46
- package/es/components/table/style/_table-th.scss +44 -0
- package/es/components/table/style/_table.scss +13 -71
- package/es/components/table/style/dnb-table.css +181 -132
- package/es/components/table/style/dnb-table.min.css +1 -1
- package/es/components/table/style/themes/dnb-table-theme-ui.css +78 -63
- package/es/components/table/style/themes/dnb-table-theme-ui.min.css +1 -1
- package/es/components/table/style/themes/dnb-table-theme-ui.scss +42 -17
- package/es/components/visually-hidden/VisuallyHidden.d.ts +2 -11
- package/es/components/visually-hidden/VisuallyHidden.js +2 -5
- package/es/components/visually-hidden/style/_visually-hidden.scss +0 -8
- package/es/components/visually-hidden/style/dnb-visually-hidden.css +10 -42
- package/es/components/visually-hidden/style/dnb-visually-hidden.min.css +1 -1
- package/es/shared/Eufemia.js +1 -1
- package/es/style/core/helper-classes/helper-classes.scss +3 -0
- package/es/style/core/utilities.scss +15 -16
- package/es/style/dnb-ui-basis.css +20 -13
- package/es/style/dnb-ui-basis.min.css +1 -1
- package/es/style/dnb-ui-components.css +205 -199
- package/es/style/dnb-ui-components.min.css +4 -4
- package/es/style/dnb-ui-core.css +20 -13
- package/es/style/dnb-ui-core.min.css +1 -1
- package/es/style/themes/theme-eiendom/dnb-theme-eiendom.css +98 -63
- package/es/style/themes/theme-eiendom/dnb-theme-eiendom.min.css +2 -2
- package/es/style/themes/theme-ui/dnb-theme-ui.css +98 -63
- package/es/style/themes/theme-ui/dnb-theme-ui.min.css +2 -2
- package/esm/dnb-ui-basis.min.mjs +2 -2
- package/esm/dnb-ui-components.min.mjs +4 -4
- package/esm/dnb-ui-elements.min.mjs +4 -4
- package/esm/dnb-ui-extensions.min.mjs +4 -4
- package/esm/dnb-ui-lib.min.mjs +4 -4
- package/esm/dnb-ui-web-components.min.mjs +4 -4
- package/package.json +2 -2
- package/shared/Eufemia.js +1 -1
- package/style/core/helper-classes/helper-classes.scss +3 -0
- package/style/core/utilities.scss +15 -16
- package/style/dnb-ui-basis.css +20 -13
- package/style/dnb-ui-basis.min.css +1 -1
- package/style/dnb-ui-components.css +205 -199
- package/style/dnb-ui-components.min.css +4 -4
- package/style/dnb-ui-core.css +20 -13
- package/style/dnb-ui-core.min.css +1 -1
- package/style/themes/theme-eiendom/dnb-theme-eiendom.css +98 -63
- package/style/themes/theme-eiendom/dnb-theme-eiendom.min.css +2 -2
- package/style/themes/theme-ui/dnb-theme-ui.css +98 -63
- package/style/themes/theme-ui/dnb-theme-ui.min.css +2 -2
- package/umd/dnb-ui-basis.min.js +3 -3
- package/umd/dnb-ui-components.min.js +5 -5
- package/umd/dnb-ui-elements.min.js +4 -4
- package/umd/dnb-ui-extensions.min.js +5 -5
- package/umd/dnb-ui-lib.min.js +5 -5
- package/umd/dnb-ui-web-components.min.js +5 -5
|
@@ -4,7 +4,7 @@ export declare type StickyTableHeaderProps = {
|
|
|
4
4
|
* Makes the Table header sticky
|
|
5
5
|
* Default: false
|
|
6
6
|
*/
|
|
7
|
-
sticky?: boolean;
|
|
7
|
+
sticky?: boolean | 'css-position';
|
|
8
8
|
/**
|
|
9
9
|
* The offset from top in rem or em unit
|
|
10
10
|
* Default: false
|
|
@@ -18,4 +18,7 @@ export declare type StickyTableHeaderProps = {
|
|
|
18
18
|
export declare const useStickyHeader: ({ sticky, stickyOffset, sticky_offset, }: StickyTableHeaderProps) => {
|
|
19
19
|
elementRef: React.MutableRefObject<HTMLTableElement>;
|
|
20
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* Deprecated in v10
|
|
23
|
+
*/
|
|
21
24
|
export declare const StickyHelper: () => JSX.Element;
|
|
@@ -1,27 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.symbol.js");
|
|
4
|
-
|
|
5
|
-
require("core-js/modules/es.symbol.description.js");
|
|
6
|
-
|
|
7
|
-
require("core-js/modules/es.object.to-string.js");
|
|
8
|
-
|
|
9
|
-
require("core-js/modules/es.symbol.iterator.js");
|
|
10
|
-
|
|
11
|
-
require("core-js/modules/es.array.iterator.js");
|
|
12
|
-
|
|
13
|
-
require("core-js/modules/es.string.iterator.js");
|
|
14
|
-
|
|
15
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
16
|
-
|
|
17
|
-
require("core-js/modules/es.array.slice.js");
|
|
18
|
-
|
|
19
|
-
require("core-js/modules/es.function.name.js");
|
|
20
|
-
|
|
21
|
-
require("core-js/modules/es.array.from.js");
|
|
22
|
-
|
|
23
|
-
require("core-js/modules/es.regexp.exec.js");
|
|
24
|
-
|
|
25
3
|
Object.defineProperty(exports, "__esModule", {
|
|
26
4
|
value: true
|
|
27
5
|
});
|
|
@@ -37,22 +15,12 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
37
15
|
|
|
38
16
|
var _componentHelper = require("../../shared/component-helper");
|
|
39
17
|
|
|
18
|
+
var _helpers = require("../../shared/helpers");
|
|
19
|
+
|
|
40
20
|
var _tr;
|
|
41
21
|
|
|
42
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
43
23
|
|
|
44
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
45
|
-
|
|
46
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
47
|
-
|
|
48
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
49
|
-
|
|
50
|
-
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; }
|
|
51
|
-
|
|
52
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
53
|
-
|
|
54
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
55
|
-
|
|
56
24
|
var useStickyHeader = function useStickyHeader(_ref) {
|
|
57
25
|
var sticky = _ref.sticky,
|
|
58
26
|
stickyOffset = _ref.stickyOffset,
|
|
@@ -64,70 +32,130 @@ var useStickyHeader = function useStickyHeader(_ref) {
|
|
|
64
32
|
|
|
65
33
|
var elementRef = _react.default.useRef();
|
|
66
34
|
|
|
67
|
-
var intersectionObserver = _react.default.useRef(null);
|
|
68
|
-
|
|
69
35
|
_react.default.useEffect(function () {
|
|
70
36
|
if (sticky) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
if (!elementRef.current) {
|
|
77
|
-
stickyWarning('No ref element given');
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
var tableElem = elementRef.current;
|
|
81
|
-
var thHeight = 80;
|
|
37
|
+
var isSticky = false;
|
|
38
|
+
var thHeight = 0;
|
|
82
39
|
var offsetTopPx = 0;
|
|
40
|
+
var tableOffset = 0;
|
|
41
|
+
var tableHeight = 0;
|
|
42
|
+
var totalOffset = 0;
|
|
43
|
+
var hasScrollbar = null;
|
|
44
|
+
var scrollViewElem = null;
|
|
45
|
+
var timeout = null;
|
|
83
46
|
|
|
84
47
|
try {
|
|
48
|
+
var tableElem = elementRef.current;
|
|
85
49
|
var trElem = tableElem.querySelector('thead > tr:first-of-type, thead > .dnb-table__tr:first-of-type');
|
|
86
|
-
|
|
50
|
+
var thElem = getThElement(tableElem);
|
|
51
|
+
var inIframe = window.self !== window.top;
|
|
52
|
+
|
|
53
|
+
var setSizes = function setSizes() {
|
|
54
|
+
offsetTopPx = parseFloat(String(stickyOffset)) || 0;
|
|
55
|
+
|
|
56
|
+
if (offsetTopPx > 0) {
|
|
57
|
+
if (String(stickyOffset).includes('rem')) {
|
|
58
|
+
offsetTopPx = Math.round(offsetTopPx * 16);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
var modalElem = (0, _componentHelper.getPreviousSibling)('.dnb-modal__content', tableElem);
|
|
87
63
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
64
|
+
if (modalElem) {
|
|
65
|
+
scrollViewElem = modalElem.querySelector('.dnb-scroll-view');
|
|
66
|
+
|
|
67
|
+
if (offsetTopPx === 0) {
|
|
68
|
+
offsetTopPx = modalElem.querySelector('.dnb-modal__header__bar').offsetHeight || 0;
|
|
69
|
+
}
|
|
92
70
|
} else {
|
|
71
|
+
var scrollElem = (0, _componentHelper.getPreviousSibling)('.dnb-scroll-view', tableElem);
|
|
72
|
+
|
|
73
|
+
if (scrollElem) {
|
|
74
|
+
hasScrollbar = scrollElem.scrollHeight - 1 > scrollElem.offsetHeight;
|
|
75
|
+
|
|
76
|
+
if (hasScrollbar) {
|
|
77
|
+
scrollViewElem = scrollElem;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
thHeight = thElem.offsetHeight;
|
|
83
|
+
tableHeight = tableElem.offsetHeight;
|
|
84
|
+
tableOffset = (0, _helpers.getOffsetTop)(tableElem);
|
|
85
|
+
totalOffset = tableOffset - (inIframe ? 0 : offsetTopPx);
|
|
86
|
+
|
|
87
|
+
if (sticky === 'css-position') {
|
|
93
88
|
trElem.style.setProperty('--table-top', "".concat(offsetTopPx / 16, "rem"));
|
|
94
89
|
}
|
|
95
|
-
}
|
|
90
|
+
};
|
|
96
91
|
|
|
97
|
-
var
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
92
|
+
var offset = 0;
|
|
93
|
+
|
|
94
|
+
var onScroll = function onScroll() {
|
|
95
|
+
if (scrollViewElem) {
|
|
96
|
+
offset = scrollViewElem.scrollTop;
|
|
97
|
+
} else {
|
|
98
|
+
offset = window.pageYOffset;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
offset -= hasScrollbar ? offsetTopPx : totalOffset;
|
|
102
|
+
|
|
103
|
+
if (offset > 0 && offset < tableHeight - thHeight) {
|
|
104
|
+
if (sticky !== 'css-position') {
|
|
105
|
+
trElem.style.setProperty('--table-offset', String(offset) + 'px');
|
|
106
|
+
}
|
|
102
107
|
|
|
108
|
+
if (!isSticky) {
|
|
109
|
+
isSticky = true;
|
|
110
|
+
trElem.classList.add('is-sticky');
|
|
111
|
+
}
|
|
112
|
+
} else {
|
|
113
|
+
if (isSticky) {
|
|
114
|
+
isSticky = false;
|
|
115
|
+
|
|
116
|
+
if (offset <= 0) {
|
|
117
|
+
if (sticky !== 'css-position') {
|
|
118
|
+
trElem.style.removeProperty('--table-offset');
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
trElem.classList.remove('is-sticky');
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
var onResize = function onResize() {
|
|
128
|
+
setSizes();
|
|
129
|
+
onScroll();
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
var applyObservers = function applyObservers() {
|
|
103
133
|
try {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
trElem.classList.add('
|
|
134
|
+
trElem.classList.add('sticky');
|
|
135
|
+
|
|
136
|
+
if (sticky === 'css-position') {
|
|
137
|
+
trElem.classList.add('css-position');
|
|
108
138
|
}
|
|
139
|
+
|
|
140
|
+
setSizes();
|
|
141
|
+
var scrollElem = scrollViewElem || document;
|
|
142
|
+
scrollElem.addEventListener('scroll', onScroll);
|
|
143
|
+
window.addEventListener('resize', onResize);
|
|
109
144
|
} catch (e) {
|
|
110
145
|
stickyWarning(e);
|
|
111
146
|
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
timeout = setTimeout(applyObservers, 100);
|
|
150
|
+
return function () {
|
|
151
|
+
clearTimeout(timeout);
|
|
152
|
+
document.removeEventListener('scroll', onScroll);
|
|
153
|
+
window.removeEventListener('resize', onResize);
|
|
154
|
+
};
|
|
121
155
|
} catch (e) {
|
|
122
156
|
stickyWarning(e);
|
|
123
157
|
}
|
|
124
158
|
}
|
|
125
|
-
|
|
126
|
-
return function () {
|
|
127
|
-
var _intersectionObserver;
|
|
128
|
-
|
|
129
|
-
(_intersectionObserver = intersectionObserver.current) === null || _intersectionObserver === void 0 ? void 0 : _intersectionObserver.disconnect();
|
|
130
|
-
};
|
|
131
159
|
}, [elementRef, sticky, stickyOffset]);
|
|
132
160
|
|
|
133
161
|
return {
|
|
@@ -138,9 +166,14 @@ var useStickyHeader = function useStickyHeader(_ref) {
|
|
|
138
166
|
exports.useStickyHeader = useStickyHeader;
|
|
139
167
|
|
|
140
168
|
var StickyHelper = function StickyHelper() {
|
|
169
|
+
(0, _componentHelper.warn)('Table.StickyHelper is deprecated!');
|
|
141
170
|
return _tr || (_tr = _react.default.createElement("tr", {
|
|
142
|
-
className: "dnb-table__sticky-helper"
|
|
143
|
-
|
|
171
|
+
className: "dnb-table__sticky-helper",
|
|
172
|
+
"aria-hidden": true,
|
|
173
|
+
role: "presentation"
|
|
174
|
+
}, _react.default.createElement("td", {
|
|
175
|
+
colSpan: 100
|
|
176
|
+
})));
|
|
144
177
|
};
|
|
145
178
|
|
|
146
179
|
exports.StickyHelper = StickyHelper;
|
|
@@ -150,10 +183,6 @@ var stickyWarning = function stickyWarning() {
|
|
|
150
183
|
(0, _componentHelper.warn)('Could not enable Sticky mode in table:', message);
|
|
151
184
|
};
|
|
152
185
|
|
|
153
|
-
var getTdElement = function getTdElement(element) {
|
|
154
|
-
return element.querySelector('tbody > tr:not(.dnb-table__sticky-helper):first-of-type > td:first-of-type, tbody > .dnb-table__tr:first-of-type > .dnb-table__td:first-of-type');
|
|
155
|
-
};
|
|
156
|
-
|
|
157
186
|
var getThElement = function getThElement(element) {
|
|
158
187
|
return element.querySelector('thead > tr:first-of-type > th:first-of-type, thead > .dnb-table__tr:first-of-type > .dnb-table__th:first-of-type');
|
|
159
188
|
};
|
|
@@ -26,7 +26,7 @@ export declare type TableThProps = {
|
|
|
26
26
|
/**
|
|
27
27
|
* The content of the table header given as Tr.
|
|
28
28
|
*/
|
|
29
|
-
children
|
|
29
|
+
children?: TableThChildren | Array<TableThChildren>;
|
|
30
30
|
};
|
|
31
31
|
declare function Th(componentProps: TableThProps & React.ThHTMLAttributes<HTMLTableCellElement>): JSX.Element;
|
|
32
32
|
declare namespace Th {
|
|
@@ -41,8 +41,11 @@ function Th(componentProps) {
|
|
|
41
41
|
noWrap = componentProps.noWrap,
|
|
42
42
|
props = _objectWithoutProperties(componentProps, _excluded);
|
|
43
43
|
|
|
44
|
+
var role = props.scope === 'row' ? 'rowheader' : 'columnheader';
|
|
45
|
+
var scope = props.scope === 'row' ? 'row' : 'col';
|
|
44
46
|
return _react.default.createElement("th", _extends({
|
|
45
|
-
role:
|
|
47
|
+
role: role,
|
|
48
|
+
scope: scope,
|
|
46
49
|
className: (0, _classnames.default)('dnb-table__th', className, sortable && 'dnb-table--sortable', active && 'dnb-table--active', reversed && 'dnb-table--reversed', noWrap && 'dnb-table--no-wrap')
|
|
47
50
|
}, props), children);
|
|
48
51
|
}
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
.dnb-table {
|
|
7
|
-
& > tr > th,
|
|
8
|
-
& > tr > td,
|
|
9
|
-
& > thead > tr > th,
|
|
10
|
-
& > tbody > tr > td,
|
|
7
|
+
& > tr > th, /* should be deprecated */
|
|
8
|
+
& > tr > td, /* should be deprecated */
|
|
9
|
+
& > thead > tr > th, /* should be deprecated */
|
|
10
|
+
& > tbody > tr > td, /* should be deprecated */
|
|
11
11
|
&__th,
|
|
12
12
|
&__td {
|
|
13
13
|
position: relative;
|
|
@@ -3,28 +3,13 @@
|
|
|
3
3
|
*
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
@mixin tableBorder {
|
|
7
|
-
content: '';
|
|
8
|
-
position: absolute;
|
|
9
|
-
top: 0;
|
|
10
|
-
left: 0;
|
|
11
|
-
right: 0;
|
|
12
|
-
bottom: 0;
|
|
13
|
-
z-index: 1;
|
|
14
|
-
|
|
15
|
-
pointer-events: none;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
6
|
.dnb-table__container {
|
|
19
7
|
position: relative;
|
|
20
8
|
|
|
21
|
-
--border: 0.0625rem solid var(--color-black-8);
|
|
22
|
-
background-color: var(--color-white);
|
|
23
|
-
|
|
24
9
|
&::after {
|
|
25
10
|
@include tableBorder();
|
|
26
|
-
|
|
27
|
-
border: var(--
|
|
11
|
+
z-index: 3; // over sticky-header
|
|
12
|
+
border: var(--outline);
|
|
28
13
|
}
|
|
29
14
|
|
|
30
15
|
&,
|
|
@@ -58,4 +43,9 @@
|
|
|
58
43
|
&__foot {
|
|
59
44
|
padding: 0.5rem 1rem 2rem;
|
|
60
45
|
}
|
|
46
|
+
|
|
47
|
+
// When placed inside a Modal/Drawer, let the parent scroll-bar do its job.
|
|
48
|
+
.dnb-modal__content & .dnb-table__scroll-view {
|
|
49
|
+
overflow: visible;
|
|
50
|
+
}
|
|
61
51
|
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Table deprecated parts
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
.dnb-table {
|
|
7
|
+
/* stylelint-disable */
|
|
8
|
+
|
|
9
|
+
// deprecated – can be removed in v10
|
|
10
|
+
&,
|
|
11
|
+
&--left {
|
|
12
|
+
text-align: left;
|
|
13
|
+
}
|
|
14
|
+
&--right {
|
|
15
|
+
text-align: right;
|
|
16
|
+
}
|
|
17
|
+
&--center {
|
|
18
|
+
text-align: center;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// deprecated – can be removed in v10
|
|
22
|
+
&--small,
|
|
23
|
+
&--small > tr > th,
|
|
24
|
+
&--small > tr > td,
|
|
25
|
+
&--small > thead > tr > th,
|
|
26
|
+
&--small > tbody > tr > td {
|
|
27
|
+
font-size: var(--font-size-small);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// deprecated – can be removed in v10
|
|
31
|
+
& > tr#{&}--small > th,
|
|
32
|
+
& > tr#{&}--small > td,
|
|
33
|
+
& > thead > tr#{&}--small > th,
|
|
34
|
+
& > tbody > tr#{&}--small > td {
|
|
35
|
+
font-size: var(--font-size-small);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// deprecated – can be removed in v10
|
|
39
|
+
& > tr > th#{&}--small,
|
|
40
|
+
& > tr > td#{&}--small,
|
|
41
|
+
& > thead > tr > th#{&}--small,
|
|
42
|
+
& > tbody > tr > td#{&}--small,
|
|
43
|
+
&__th#{&}--small,
|
|
44
|
+
&__td#{&}--small {
|
|
45
|
+
font-size: var(--font-size-small);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// deprecated – can be removed in v10
|
|
49
|
+
&--x-small,
|
|
50
|
+
&--x-small > tr > th,
|
|
51
|
+
&--x-small > tr > td,
|
|
52
|
+
&--x-small > thead > tr > th,
|
|
53
|
+
&--x-small > tbody > tr > td {
|
|
54
|
+
font-size: var(--font-size-x-small);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// deprecated – can be removed in v10
|
|
58
|
+
& > tr#{&}--x-small > th,
|
|
59
|
+
& > tr#{&}--x-small > td,
|
|
60
|
+
& > thead > tr#{&}--x-small > th,
|
|
61
|
+
& > tbody > tr#{&}--x-small > td {
|
|
62
|
+
font-size: var(--font-size-x-small);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// deprecated – can be removed in v10
|
|
66
|
+
& > tr > th#{&}--x-small,
|
|
67
|
+
& > tr > td#{&}--x-small,
|
|
68
|
+
& > thead > tr > th#{&}--x-small,
|
|
69
|
+
& > tbody > tr > td#{&}--x-small,
|
|
70
|
+
&__th#{&}--x-small,
|
|
71
|
+
&__td#{&}--x-small {
|
|
72
|
+
font-size: var(--font-size-x-small);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
// reset anchor
|
|
34
34
|
box-shadow: none;
|
|
35
35
|
|
|
36
|
-
line-height:
|
|
36
|
+
line-height: inherit;
|
|
37
37
|
|
|
38
38
|
margin: 0;
|
|
39
39
|
padding: 0;
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
.dnb-button__text {
|
|
48
48
|
margin: 0;
|
|
49
49
|
font-size: inherit;
|
|
50
|
+
line-height: inherit;
|
|
50
51
|
|
|
51
52
|
// underline
|
|
52
53
|
&::after {
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
.dnb-table {
|
|
7
|
+
// Deprecated in v10
|
|
7
8
|
&__sticky-helper > td {
|
|
8
9
|
display: block;
|
|
9
10
|
overflow: hidden;
|
|
@@ -11,32 +12,32 @@
|
|
|
11
12
|
height: 0;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
// Target th because of Safari transparent issue
|
|
16
|
+
tr.sticky:not(.css-position) th {
|
|
17
|
+
position: relative;
|
|
18
|
+
z-index: 3; // over borders and TDs
|
|
19
|
+
|
|
20
|
+
will-change: transform;
|
|
21
|
+
transform: translate3d(0, var(--table-offset, 0), 0);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
tr.sticky.css-position {
|
|
15
25
|
position: sticky;
|
|
26
|
+
z-index: 3; // over borders and TDs
|
|
16
27
|
top: var(--table-top, 0); // is set by "stickyOffset" prop
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
&::before {
|
|
20
|
-
content: '';
|
|
21
|
-
position: absolute;
|
|
22
|
-
opacity: 0;
|
|
23
|
-
left: 0;
|
|
24
|
-
right: 0;
|
|
25
|
-
bottom: 0;
|
|
26
|
-
height: 6px;
|
|
28
|
+
}
|
|
27
29
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
tr.sticky.is-sticky th::before {
|
|
31
|
+
content: '';
|
|
32
|
+
position: absolute;
|
|
33
|
+
left: 0;
|
|
34
|
+
right: 0;
|
|
35
|
+
bottom: 0;
|
|
36
|
+
height: 6px;
|
|
32
37
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
tr.sticky.show-shadow th::before {
|
|
40
|
-
opacity: 1;
|
|
38
|
+
// The @mixin defaultDropShadow() does not work in this case
|
|
39
|
+
// because we need only a bottom shadow (with clip-path)
|
|
40
|
+
box-shadow: var(--shadow-default-x) -2px 12px 8px var(--shadow-default-color);
|
|
41
|
+
clip-path: inset(6px 0 -48px 0);
|
|
41
42
|
}
|
|
42
43
|
}
|
|
@@ -5,24 +5,9 @@
|
|
|
5
5
|
|
|
6
6
|
@import './_table-header-buttons.scss';
|
|
7
7
|
|
|
8
|
-
@mixin tableBorder {
|
|
9
|
-
content: '';
|
|
10
|
-
position: absolute;
|
|
11
|
-
top: 0;
|
|
12
|
-
left: 0;
|
|
13
|
-
right: 0;
|
|
14
|
-
bottom: 0;
|
|
15
|
-
z-index: -1;
|
|
16
|
-
|
|
17
|
-
pointer-events: none;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
8
|
.dnb-table {
|
|
21
9
|
// table border
|
|
22
|
-
--border: 0.0625rem solid var(--color-black-8);
|
|
23
10
|
&--border tbody &__td {
|
|
24
|
-
z-index: 2; // ensure border is behind content
|
|
25
|
-
|
|
26
11
|
&::after {
|
|
27
12
|
@include tableBorder();
|
|
28
13
|
|
|
@@ -40,26 +25,7 @@
|
|
|
40
25
|
}
|
|
41
26
|
|
|
42
27
|
// table outline
|
|
43
|
-
--outline: 0.0625rem solid var(--color-black-8);
|
|
44
|
-
&--outline thead &__th {
|
|
45
|
-
z-index: 2; // ensure border is behind content
|
|
46
|
-
|
|
47
|
-
&::after {
|
|
48
|
-
@include tableBorder();
|
|
49
|
-
|
|
50
|
-
border-top: var(--outline);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
&:first-of-type::after {
|
|
54
|
-
border-left: var(--outline);
|
|
55
|
-
}
|
|
56
|
-
&:last-of-type::after {
|
|
57
|
-
border-right: var(--outline);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
28
|
&--outline tbody &__td {
|
|
61
|
-
z-index: 2; // ensure border is behind content
|
|
62
|
-
|
|
63
29
|
&:first-of-type::after,
|
|
64
30
|
&:last-of-type::after {
|
|
65
31
|
@include tableBorder();
|
|
@@ -71,38 +37,53 @@
|
|
|
71
37
|
&:last-of-type::after {
|
|
72
38
|
border-right: var(--outline);
|
|
73
39
|
}
|
|
40
|
+
|
|
41
|
+
/* stylelint-disable */
|
|
42
|
+
&,
|
|
43
|
+
&::before,
|
|
44
|
+
&::after {
|
|
45
|
+
transition: border-radius 400ms var(--easing-default);
|
|
46
|
+
}
|
|
47
|
+
/* stylelint-enable */
|
|
74
48
|
}
|
|
75
49
|
&--outline tbody &__tr:last-of-type &__td {
|
|
76
|
-
z-index: 2; // ensure border is behind content
|
|
77
|
-
|
|
78
50
|
&::after {
|
|
79
51
|
@include tableBorder();
|
|
80
52
|
|
|
81
53
|
border-bottom: var(--outline);
|
|
82
54
|
}
|
|
83
55
|
}
|
|
84
|
-
&--outline
|
|
56
|
+
&--outline tbody &__tr:last-of-type &__td:first-of-type {
|
|
85
57
|
&,
|
|
58
|
+
&::before,
|
|
86
59
|
&::after {
|
|
87
|
-
border-radius: 0
|
|
60
|
+
border-radius: 0 0 0 0.5rem;
|
|
88
61
|
}
|
|
89
62
|
}
|
|
90
|
-
&--outline
|
|
63
|
+
&--outline tbody &__tr:last-of-type &__td:last-of-type {
|
|
91
64
|
&,
|
|
65
|
+
&::before,
|
|
92
66
|
&::after {
|
|
93
|
-
border-radius: 0 0.5rem 0
|
|
67
|
+
border-radius: 0 0 0.5rem 0;
|
|
94
68
|
}
|
|
95
69
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
70
|
+
|
|
71
|
+
// reset parts if a "th" is used before td (row header)
|
|
72
|
+
&--outline tbody &__tr &__th ~ &__td:first-of-type {
|
|
73
|
+
&:first-of-type::after {
|
|
74
|
+
border-left: none;
|
|
100
75
|
}
|
|
101
76
|
}
|
|
102
|
-
&--
|
|
77
|
+
&--border tbody &__tr &__th ~ &__td:first-of-type {
|
|
78
|
+
&:first-of-type::after {
|
|
79
|
+
border-left: var(--border);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
&--outline tbody &__tr:last-of-type &__th ~ &__td:first-of-type {
|
|
103
83
|
&,
|
|
84
|
+
&::before,
|
|
104
85
|
&::after {
|
|
105
|
-
border-radius: 0 0 0
|
|
86
|
+
border-radius: 0 0 0 0;
|
|
106
87
|
}
|
|
107
88
|
}
|
|
108
89
|
|
|
@@ -10,4 +10,48 @@
|
|
|
10
10
|
display: flex;
|
|
11
11
|
align-items: flex-end; // bottom align help-button or other additional elements
|
|
12
12
|
}
|
|
13
|
+
|
|
14
|
+
// table border
|
|
15
|
+
&--outline thead &__th {
|
|
16
|
+
&::after {
|
|
17
|
+
@include tableBorder();
|
|
18
|
+
|
|
19
|
+
border-top: var(--outline);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&:first-of-type::after {
|
|
23
|
+
border-left: var(--outline);
|
|
24
|
+
}
|
|
25
|
+
&:last-of-type::after {
|
|
26
|
+
border-right: var(--outline);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
&--outline thead &__th:first-of-type {
|
|
30
|
+
&,
|
|
31
|
+
&::after {
|
|
32
|
+
border-radius: 0.5rem 0 0 0;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
&--outline thead &__th:last-of-type {
|
|
36
|
+
&,
|
|
37
|
+
&::after {
|
|
38
|
+
border-radius: 0 0.5rem 0 0;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
&--outline tbody &__th:first-of-type::after {
|
|
42
|
+
@include tableBorder();
|
|
43
|
+
|
|
44
|
+
border-left: var(--outline);
|
|
45
|
+
}
|
|
46
|
+
&--outline tbody &__tr:last-of-type &__th {
|
|
47
|
+
&::after {
|
|
48
|
+
@include tableBorder();
|
|
49
|
+
|
|
50
|
+
border-bottom: var(--outline);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&:first-of-type::after {
|
|
54
|
+
border-radius: 0 0 0 0.5rem;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
13
57
|
}
|