@dnb/eufemia 9.39.0 → 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.
Files changed (197) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/cjs/components/accordion/style/_accordion.scss +2 -2
  3. package/cjs/components/accordion/style/dnb-accordion.css +3 -3
  4. package/cjs/components/accordion/style/dnb-accordion.min.css +1 -1
  5. package/cjs/components/dialog/Dialog.d.ts +1 -1
  6. package/cjs/components/dialog/parts/DialogAction.d.ts +5 -4
  7. package/cjs/components/dialog/parts/DialogAction.js +23 -4
  8. package/cjs/components/dialog/style/_dialog.scss +7 -30
  9. package/cjs/components/dialog/style/dnb-dialog.css +21 -44
  10. package/cjs/components/dialog/style/dnb-dialog.min.css +1 -1
  11. package/cjs/components/dialog/style/themes/dnb-dialog-theme-ui.css +20 -0
  12. package/cjs/components/dialog/style/themes/dnb-dialog-theme-ui.min.css +1 -1
  13. package/cjs/components/dialog/style/themes/dnb-dialog-theme-ui.scss +29 -0
  14. package/cjs/components/drawer/style/_drawer.scss +1 -0
  15. package/cjs/components/drawer/style/dnb-drawer.css +12 -22
  16. package/cjs/components/drawer/style/dnb-drawer.min.css +1 -1
  17. package/cjs/components/height-animation/useHeightAnimation.js +5 -5
  18. package/cjs/components/lib.d.ts +1 -1
  19. package/cjs/components/modal/style/dnb-modal.css +11 -22
  20. package/cjs/components/modal/style/dnb-modal.min.css +1 -1
  21. package/cjs/components/number-format/NumberFormat.js +1 -1
  22. package/cjs/components/table/Table.js +1 -1
  23. package/cjs/components/table/TableContainer.js +3 -1
  24. package/cjs/components/table/TableStickyHeader.d.ts +4 -1
  25. package/cjs/components/table/TableStickyHeader.js +112 -83
  26. package/cjs/components/table/TableTh.d.ts +1 -1
  27. package/cjs/components/table/TableTh.js +4 -1
  28. package/cjs/components/table/style/_table-cell.scss +4 -4
  29. package/cjs/components/table/style/_table-container.scss +7 -17
  30. package/cjs/components/table/style/_table-deprecated.scss +74 -0
  31. package/cjs/components/table/style/_table-header-buttons.scss +2 -1
  32. package/cjs/components/table/style/_table-sticky.scss +24 -23
  33. package/cjs/components/table/style/_table-td.scss +27 -46
  34. package/cjs/components/table/style/_table-th.scss +44 -0
  35. package/cjs/components/table/style/_table.scss +13 -71
  36. package/cjs/components/table/style/dnb-table.css +181 -132
  37. package/cjs/components/table/style/dnb-table.min.css +1 -1
  38. package/cjs/components/table/style/themes/dnb-table-theme-ui.css +78 -63
  39. package/cjs/components/table/style/themes/dnb-table-theme-ui.min.css +1 -1
  40. package/cjs/components/table/style/themes/dnb-table-theme-ui.scss +42 -17
  41. package/cjs/components/visually-hidden/VisuallyHidden.d.ts +2 -11
  42. package/cjs/components/visually-hidden/VisuallyHidden.js +2 -5
  43. package/cjs/components/visually-hidden/style/_visually-hidden.scss +0 -8
  44. package/cjs/components/visually-hidden/style/dnb-visually-hidden.css +10 -42
  45. package/cjs/components/visually-hidden/style/dnb-visually-hidden.min.css +1 -1
  46. package/cjs/elements/Table.d.ts +6 -2
  47. package/cjs/elements/Td.d.ts +6 -2
  48. package/cjs/elements/Th.d.ts +6 -2
  49. package/cjs/elements/Tr.d.ts +6 -2
  50. package/cjs/shared/Eufemia.js +1 -1
  51. package/cjs/style/core/helper-classes/helper-classes.scss +3 -0
  52. package/cjs/style/core/utilities.scss +15 -16
  53. package/cjs/style/dnb-ui-basis.css +20 -13
  54. package/cjs/style/dnb-ui-basis.min.css +1 -1
  55. package/cjs/style/dnb-ui-components.css +205 -199
  56. package/cjs/style/dnb-ui-components.min.css +4 -4
  57. package/cjs/style/dnb-ui-core.css +20 -13
  58. package/cjs/style/dnb-ui-core.min.css +1 -1
  59. package/cjs/style/themes/theme-eiendom/dnb-theme-eiendom.css +98 -63
  60. package/cjs/style/themes/theme-eiendom/dnb-theme-eiendom.min.css +2 -2
  61. package/cjs/style/themes/theme-ui/dnb-theme-ui.css +98 -63
  62. package/cjs/style/themes/theme-ui/dnb-theme-ui.min.css +2 -2
  63. package/components/accordion/style/_accordion.scss +2 -2
  64. package/components/accordion/style/dnb-accordion.css +3 -3
  65. package/components/accordion/style/dnb-accordion.min.css +1 -1
  66. package/components/dialog/Dialog.d.ts +1 -1
  67. package/components/dialog/parts/DialogAction.d.ts +5 -4
  68. package/components/dialog/parts/DialogAction.js +19 -11
  69. package/components/dialog/style/_dialog.scss +7 -30
  70. package/components/dialog/style/dnb-dialog.css +21 -44
  71. package/components/dialog/style/dnb-dialog.min.css +1 -1
  72. package/components/dialog/style/themes/dnb-dialog-theme-ui.css +20 -0
  73. package/components/dialog/style/themes/dnb-dialog-theme-ui.min.css +1 -1
  74. package/components/dialog/style/themes/dnb-dialog-theme-ui.scss +29 -0
  75. package/components/drawer/style/_drawer.scss +1 -0
  76. package/components/drawer/style/dnb-drawer.css +12 -22
  77. package/components/drawer/style/dnb-drawer.min.css +1 -1
  78. package/components/height-animation/useHeightAnimation.js +4 -3
  79. package/components/lib.d.ts +1 -1
  80. package/components/modal/style/dnb-modal.css +11 -22
  81. package/components/modal/style/dnb-modal.min.css +1 -1
  82. package/components/number-format/NumberFormat.js +1 -1
  83. package/components/table/Table.js +1 -1
  84. package/components/table/TableContainer.js +3 -1
  85. package/components/table/TableStickyHeader.d.ts +4 -1
  86. package/components/table/TableStickyHeader.js +112 -51
  87. package/components/table/TableTh.d.ts +1 -1
  88. package/components/table/TableTh.js +4 -1
  89. package/components/table/style/_table-cell.scss +4 -4
  90. package/components/table/style/_table-container.scss +7 -17
  91. package/components/table/style/_table-deprecated.scss +74 -0
  92. package/components/table/style/_table-header-buttons.scss +2 -1
  93. package/components/table/style/_table-sticky.scss +24 -23
  94. package/components/table/style/_table-td.scss +27 -46
  95. package/components/table/style/_table-th.scss +44 -0
  96. package/components/table/style/_table.scss +13 -71
  97. package/components/table/style/dnb-table.css +181 -132
  98. package/components/table/style/dnb-table.min.css +1 -1
  99. package/components/table/style/themes/dnb-table-theme-ui.css +78 -63
  100. package/components/table/style/themes/dnb-table-theme-ui.min.css +1 -1
  101. package/components/table/style/themes/dnb-table-theme-ui.scss +42 -17
  102. package/components/visually-hidden/VisuallyHidden.d.ts +2 -11
  103. package/components/visually-hidden/VisuallyHidden.js +2 -5
  104. package/components/visually-hidden/style/_visually-hidden.scss +0 -8
  105. package/components/visually-hidden/style/dnb-visually-hidden.css +10 -42
  106. package/components/visually-hidden/style/dnb-visually-hidden.min.css +1 -1
  107. package/elements/Table.d.ts +6 -2
  108. package/elements/Td.d.ts +6 -2
  109. package/elements/Th.d.ts +6 -2
  110. package/elements/Tr.d.ts +6 -2
  111. package/es/components/accordion/style/_accordion.scss +2 -2
  112. package/es/components/accordion/style/dnb-accordion.css +3 -3
  113. package/es/components/accordion/style/dnb-accordion.min.css +1 -1
  114. package/es/components/dialog/Dialog.d.ts +1 -1
  115. package/es/components/dialog/parts/DialogAction.d.ts +5 -4
  116. package/es/components/dialog/parts/DialogAction.js +21 -11
  117. package/es/components/dialog/style/_dialog.scss +7 -30
  118. package/es/components/dialog/style/dnb-dialog.css +21 -44
  119. package/es/components/dialog/style/dnb-dialog.min.css +1 -1
  120. package/es/components/dialog/style/themes/dnb-dialog-theme-ui.css +20 -0
  121. package/es/components/dialog/style/themes/dnb-dialog-theme-ui.min.css +1 -1
  122. package/es/components/dialog/style/themes/dnb-dialog-theme-ui.scss +29 -0
  123. package/es/components/drawer/style/_drawer.scss +1 -0
  124. package/es/components/drawer/style/dnb-drawer.css +12 -22
  125. package/es/components/drawer/style/dnb-drawer.min.css +1 -1
  126. package/es/components/height-animation/useHeightAnimation.js +4 -3
  127. package/es/components/lib.d.ts +1 -1
  128. package/es/components/modal/style/dnb-modal.css +11 -22
  129. package/es/components/modal/style/dnb-modal.min.css +1 -1
  130. package/es/components/number-format/NumberFormat.js +1 -1
  131. package/es/components/table/Table.js +1 -1
  132. package/es/components/table/TableContainer.js +3 -1
  133. package/es/components/table/TableStickyHeader.d.ts +4 -1
  134. package/es/components/table/TableStickyHeader.js +112 -48
  135. package/es/components/table/TableTh.d.ts +1 -1
  136. package/es/components/table/TableTh.js +4 -1
  137. package/es/components/table/style/_table-cell.scss +4 -4
  138. package/es/components/table/style/_table-container.scss +7 -17
  139. package/es/components/table/style/_table-deprecated.scss +74 -0
  140. package/es/components/table/style/_table-header-buttons.scss +2 -1
  141. package/es/components/table/style/_table-sticky.scss +24 -23
  142. package/es/components/table/style/_table-td.scss +27 -46
  143. package/es/components/table/style/_table-th.scss +44 -0
  144. package/es/components/table/style/_table.scss +13 -71
  145. package/es/components/table/style/dnb-table.css +181 -132
  146. package/es/components/table/style/dnb-table.min.css +1 -1
  147. package/es/components/table/style/themes/dnb-table-theme-ui.css +78 -63
  148. package/es/components/table/style/themes/dnb-table-theme-ui.min.css +1 -1
  149. package/es/components/table/style/themes/dnb-table-theme-ui.scss +42 -17
  150. package/es/components/visually-hidden/VisuallyHidden.d.ts +2 -11
  151. package/es/components/visually-hidden/VisuallyHidden.js +2 -5
  152. package/es/components/visually-hidden/style/_visually-hidden.scss +0 -8
  153. package/es/components/visually-hidden/style/dnb-visually-hidden.css +10 -42
  154. package/es/components/visually-hidden/style/dnb-visually-hidden.min.css +1 -1
  155. package/es/elements/Table.d.ts +6 -2
  156. package/es/elements/Td.d.ts +6 -2
  157. package/es/elements/Th.d.ts +6 -2
  158. package/es/elements/Tr.d.ts +6 -2
  159. package/es/shared/Eufemia.js +1 -1
  160. package/es/style/core/helper-classes/helper-classes.scss +3 -0
  161. package/es/style/core/utilities.scss +15 -16
  162. package/es/style/dnb-ui-basis.css +20 -13
  163. package/es/style/dnb-ui-basis.min.css +1 -1
  164. package/es/style/dnb-ui-components.css +205 -199
  165. package/es/style/dnb-ui-components.min.css +4 -4
  166. package/es/style/dnb-ui-core.css +20 -13
  167. package/es/style/dnb-ui-core.min.css +1 -1
  168. package/es/style/themes/theme-eiendom/dnb-theme-eiendom.css +98 -63
  169. package/es/style/themes/theme-eiendom/dnb-theme-eiendom.min.css +2 -2
  170. package/es/style/themes/theme-ui/dnb-theme-ui.css +98 -63
  171. package/es/style/themes/theme-ui/dnb-theme-ui.min.css +2 -2
  172. package/esm/dnb-ui-basis.min.mjs +2 -2
  173. package/esm/dnb-ui-components.min.mjs +4 -4
  174. package/esm/dnb-ui-elements.min.mjs +4 -4
  175. package/esm/dnb-ui-extensions.min.mjs +4 -4
  176. package/esm/dnb-ui-lib.min.mjs +4 -4
  177. package/esm/dnb-ui-web-components.min.mjs +4 -4
  178. package/package.json +2 -2
  179. package/shared/Eufemia.js +1 -1
  180. package/style/core/helper-classes/helper-classes.scss +3 -0
  181. package/style/core/utilities.scss +15 -16
  182. package/style/dnb-ui-basis.css +20 -13
  183. package/style/dnb-ui-basis.min.css +1 -1
  184. package/style/dnb-ui-components.css +205 -199
  185. package/style/dnb-ui-components.min.css +4 -4
  186. package/style/dnb-ui-core.css +20 -13
  187. package/style/dnb-ui-core.min.css +1 -1
  188. package/style/themes/theme-eiendom/dnb-theme-eiendom.css +98 -63
  189. package/style/themes/theme-eiendom/dnb-theme-eiendom.min.css +2 -2
  190. package/style/themes/theme-ui/dnb-theme-ui.css +98 -63
  191. package/style/themes/theme-ui/dnb-theme-ui.min.css +2 -2
  192. package/umd/dnb-ui-basis.min.js +3 -3
  193. package/umd/dnb-ui-components.min.js +5 -5
  194. package/umd/dnb-ui-elements.min.js +4 -4
  195. package/umd/dnb-ui-extensions.min.js +5 -5
  196. package/umd/dnb-ui-lib.min.js +5 -5
  197. package/umd/dnb-ui-web-components.min.js +5 -5
@@ -1,12 +1,11 @@
1
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
-
3
1
  var _tr;
4
2
 
5
3
  import "core-js/modules/es.parse-float.js";
6
4
  import "core-js/modules/es.array.includes.js";
7
5
  import "core-js/modules/es.string.includes.js";
8
6
  import React from 'react';
9
- import { warn } from '../../shared/component-helper';
7
+ import { getPreviousSibling, warn } from '../../shared/component-helper';
8
+ import { getOffsetTop } from '../../shared/helpers';
10
9
  export var useStickyHeader = function useStickyHeader(_ref) {
11
10
  var sticky = _ref.sticky,
12
11
  stickyOffset = _ref.stickyOffset,
@@ -17,78 +16,144 @@ export var useStickyHeader = function useStickyHeader(_ref) {
17
16
  }
18
17
 
19
18
  var elementRef = React.useRef();
20
- var intersectionObserver = React.useRef(null);
21
19
  React.useEffect(function () {
22
20
  if (sticky) {
23
- if (typeof IntersectionObserver === 'undefined') {
24
- stickyWarning('IntersectionObserver not supported');
25
- return;
26
- }
27
-
28
- if (!elementRef.current) {
29
- stickyWarning('No ref element given');
30
- }
31
-
32
- var tableElem = elementRef.current;
33
- var thHeight = 80;
21
+ var isSticky = false;
22
+ var thHeight = 0;
34
23
  var offsetTopPx = 0;
24
+ var tableOffset = 0;
25
+ var tableHeight = 0;
26
+ var totalOffset = 0;
27
+ var hasScrollbar = null;
28
+ var scrollViewElem = null;
29
+ var timeout = null;
35
30
 
36
31
  try {
32
+ var tableElem = elementRef.current;
37
33
  var trElem = tableElem.querySelector('thead > tr:first-of-type, thead > .dnb-table__tr:first-of-type');
38
- offsetTopPx = parseFloat(String(stickyOffset || '0'));
34
+ var thElem = getThElement(tableElem);
35
+ var inIframe = window.self !== window.top;
36
+
37
+ var setSizes = function setSizes() {
38
+ offsetTopPx = parseFloat(String(stickyOffset)) || 0;
39
+
40
+ if (offsetTopPx > 0) {
41
+ if (String(stickyOffset).includes('rem')) {
42
+ offsetTopPx = Math.round(offsetTopPx * 16);
43
+ }
44
+ }
39
45
 
40
- if (offsetTopPx > 0) {
41
- if (String(stickyOffset).includes('em')) {
42
- offsetTopPx = Math.round(offsetTopPx * 16);
43
- trElem.style.setProperty('--table-top', String(stickyOffset));
46
+ var modalElem = getPreviousSibling('.dnb-modal__content', tableElem);
47
+
48
+ if (modalElem) {
49
+ scrollViewElem = modalElem.querySelector('.dnb-scroll-view');
50
+
51
+ if (offsetTopPx === 0) {
52
+ offsetTopPx = modalElem.querySelector('.dnb-modal__header__bar').offsetHeight || 0;
53
+ }
44
54
  } else {
55
+ var scrollElem = getPreviousSibling('.dnb-scroll-view', tableElem);
56
+
57
+ if (scrollElem) {
58
+ hasScrollbar = scrollElem.scrollHeight - 1 > scrollElem.offsetHeight;
59
+
60
+ if (hasScrollbar) {
61
+ scrollViewElem = scrollElem;
62
+ }
63
+ }
64
+ }
65
+
66
+ thHeight = thElem.offsetHeight;
67
+ tableHeight = tableElem.offsetHeight;
68
+ tableOffset = getOffsetTop(tableElem);
69
+ totalOffset = tableOffset - (inIframe ? 0 : offsetTopPx);
70
+
71
+ if (sticky === 'css-position') {
45
72
  trElem.style.setProperty('--table-top', "".concat(offsetTopPx / 16, "rem"));
46
73
  }
47
- }
74
+ };
48
75
 
49
- var thElem = getThElement(tableElem);
50
- thHeight = thElem && parseFloat(window.getComputedStyle(thElem).height) || thHeight;
51
- intersectionObserver.current = new IntersectionObserver(function (entries) {
52
- var _entries = _slicedToArray(entries, 1),
53
- entry = _entries[0];
76
+ var offset = 0;
54
77
 
78
+ var onScroll = function onScroll() {
79
+ if (scrollViewElem) {
80
+ offset = scrollViewElem.scrollTop;
81
+ } else {
82
+ offset = window.pageYOffset;
83
+ }
84
+
85
+ offset -= hasScrollbar ? offsetTopPx : totalOffset;
86
+
87
+ if (offset > 0 && offset < tableHeight - thHeight) {
88
+ if (sticky !== 'css-position') {
89
+ trElem.style.setProperty('--table-offset', String(offset) + 'px');
90
+ }
91
+
92
+ if (!isSticky) {
93
+ isSticky = true;
94
+ trElem.classList.add('is-sticky');
95
+ }
96
+ } else {
97
+ if (isSticky) {
98
+ isSticky = false;
99
+
100
+ if (offset <= 0) {
101
+ if (sticky !== 'css-position') {
102
+ trElem.style.removeProperty('--table-offset');
103
+ }
104
+ }
105
+
106
+ trElem.classList.remove('is-sticky');
107
+ }
108
+ }
109
+ };
110
+
111
+ var onResize = function onResize() {
112
+ setSizes();
113
+ onScroll();
114
+ };
115
+
116
+ var applyObservers = function applyObservers() {
55
117
  try {
56
- if (entry.isIntersecting) {
57
- trElem.classList.remove('show-shadow');
58
- } else {
59
- trElem.classList.add('show-shadow');
118
+ trElem.classList.add('sticky');
119
+
120
+ if (sticky === 'css-position') {
121
+ trElem.classList.add('css-position');
60
122
  }
123
+
124
+ setSizes();
125
+ var scrollElem = scrollViewElem || document;
126
+ scrollElem.addEventListener('scroll', onScroll);
127
+ window.addEventListener('resize', onResize);
61
128
  } catch (e) {
62
129
  stickyWarning(e);
63
130
  }
64
- }, {
65
- rootMargin: "-".concat(thHeight + offsetTopPx, "px 0px 0px 0px")
66
- });
67
- trElem.classList.add('sticky');
68
- var tdElem = tableElem.querySelector('tbody > tr.dnb-table__sticky-helper > td:first-of-type') || getTdElement(tableElem);
69
-
70
- if (tdElem) {
71
- intersectionObserver.current.observe(tdElem);
72
- }
131
+ };
132
+
133
+ timeout = setTimeout(applyObservers, 100);
134
+ return function () {
135
+ clearTimeout(timeout);
136
+ document.removeEventListener('scroll', onScroll);
137
+ window.removeEventListener('resize', onResize);
138
+ };
73
139
  } catch (e) {
74
140
  stickyWarning(e);
75
141
  }
76
142
  }
77
-
78
- return function () {
79
- var _intersectionObserver;
80
-
81
- (_intersectionObserver = intersectionObserver.current) === null || _intersectionObserver === void 0 ? void 0 : _intersectionObserver.disconnect();
82
- };
83
143
  }, [elementRef, sticky, stickyOffset]);
84
144
  return {
85
145
  elementRef: elementRef
86
146
  };
87
147
  };
88
148
  export var StickyHelper = function StickyHelper() {
149
+ warn('Table.StickyHelper is deprecated!');
89
150
  return _tr || (_tr = React.createElement("tr", {
90
- className: "dnb-table__sticky-helper"
91
- }, React.createElement("td", null)));
151
+ className: "dnb-table__sticky-helper",
152
+ "aria-hidden": true,
153
+ role: "presentation"
154
+ }, React.createElement("td", {
155
+ colSpan: 100
156
+ })));
92
157
  };
93
158
 
94
159
  var stickyWarning = function stickyWarning() {
@@ -96,10 +161,6 @@ var stickyWarning = function stickyWarning() {
96
161
  warn('Could not enable Sticky mode in table:', message);
97
162
  };
98
163
 
99
- var getTdElement = function getTdElement(element) {
100
- 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');
101
- };
102
-
103
164
  var getThElement = function getThElement(element) {
104
165
  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');
105
166
  };
@@ -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: TableThChildren | Array<TableThChildren>;
29
+ children?: TableThChildren | Array<TableThChildren>;
30
30
  };
31
31
  declare function Th(componentProps: TableThProps & React.ThHTMLAttributes<HTMLTableCellElement>): JSX.Element;
32
32
  declare namespace Th {
@@ -15,8 +15,11 @@ export default function Th(componentProps) {
15
15
  noWrap = componentProps.noWrap,
16
16
  props = _objectWithoutProperties(componentProps, _excluded);
17
17
 
18
+ var role = props.scope === 'row' ? 'rowheader' : 'columnheader';
19
+ var scope = props.scope === 'row' ? 'row' : 'col';
18
20
  return React.createElement("th", _extends({
19
- role: "columnheader",
21
+ role: role,
22
+ scope: scope,
20
23
  className: classnames('dnb-table__th', className, sortable && 'dnb-table--sortable', active && 'dnb-table--active', reversed && 'dnb-table--reversed', noWrap && 'dnb-table--no-wrap')
21
24
  }, props), children);
22
25
  }
@@ -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(--border);
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: var(--line-height-basis);
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
- tr.sticky th {
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
- z-index: 2;
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
- // The @mixin defaultDropShadow() does not work in this case
29
- // because we need only a bottom shadow (with clip-path)
30
- box-shadow: var(--shadow-default-x) -2px 12px 8px var(--shadow-default-color);
31
- clip-path: inset(6px 0 -48px 0);
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
- transition: opacity 300ms ease-out;
34
- [data-visual-test-wrapper] & {
35
- transition: none;
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 thead &__th:first-of-type {
56
+ &--outline tbody &__tr:last-of-type &__td:first-of-type {
85
57
  &,
58
+ &::before,
86
59
  &::after {
87
- border-radius: 0.5rem 0 0 0;
60
+ border-radius: 0 0 0 0.5rem;
88
61
  }
89
62
  }
90
- &--outline thead &__th:last-of-type {
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 0;
67
+ border-radius: 0 0 0.5rem 0;
94
68
  }
95
69
  }
96
- &--outline tbody &__tr:last-of-type &__td:first-of-type {
97
- &,
98
- &::after {
99
- border-radius: 0 0 0 0.5rem;
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
- &--outline tbody &__tr:last-of-type &__td:last-of-type {
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.5rem 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
  }