@dnb/eufemia 9.46.2 → 9.47.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 (83) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/cjs/components/table/TableContainer.d.ts +3 -3
  3. package/cjs/components/table/TableContainer.js +20 -1
  4. package/cjs/components/table/TableTh.js +2 -2
  5. package/cjs/components/table/style/_table-accordion.scss +52 -8
  6. package/cjs/components/table/style/_table-container.scss +20 -2
  7. package/cjs/components/table/style/_table-td.scss +35 -67
  8. package/cjs/components/table/style/_table-th.scss +41 -34
  9. package/cjs/components/table/style/_table.scss +12 -13
  10. package/cjs/components/table/style/dnb-table-mixins.css +0 -0
  11. package/cjs/components/table/style/dnb-table-mixins.min.css +0 -0
  12. package/cjs/components/table/style/dnb-table-mixins.scss +11 -0
  13. package/cjs/components/table/style/dnb-table.css +124 -137
  14. package/cjs/components/table/style/dnb-table.min.css +8 -7
  15. package/cjs/components/table/style/themes/dnb-table-theme-ui.css +7 -3
  16. package/cjs/components/table/style/themes/dnb-table-theme-ui.min.css +1 -1
  17. package/cjs/components/table/style/themes/dnb-table-theme-ui.scss +6 -12
  18. package/cjs/shared/Eufemia.js +1 -1
  19. package/cjs/style/dnb-ui-components.css +124 -137
  20. package/cjs/style/dnb-ui-components.min.css +8 -7
  21. package/cjs/style/themes/theme-eiendom/dnb-theme-eiendom.css +7 -3
  22. package/cjs/style/themes/theme-eiendom/dnb-theme-eiendom.min.css +1 -1
  23. package/cjs/style/themes/theme-ui/dnb-theme-ui.css +7 -3
  24. package/cjs/style/themes/theme-ui/dnb-theme-ui.min.css +1 -1
  25. package/components/table/TableContainer.d.ts +3 -3
  26. package/components/table/TableContainer.js +21 -1
  27. package/components/table/TableTh.js +2 -2
  28. package/components/table/style/_table-accordion.scss +52 -8
  29. package/components/table/style/_table-container.scss +20 -2
  30. package/components/table/style/_table-td.scss +35 -67
  31. package/components/table/style/_table-th.scss +41 -34
  32. package/components/table/style/_table.scss +12 -13
  33. package/components/table/style/dnb-table-mixins.css +0 -0
  34. package/components/table/style/dnb-table-mixins.min.css +0 -0
  35. package/components/table/style/dnb-table-mixins.scss +11 -0
  36. package/components/table/style/dnb-table.css +124 -137
  37. package/components/table/style/dnb-table.min.css +8 -7
  38. package/components/table/style/themes/dnb-table-theme-ui.css +7 -3
  39. package/components/table/style/themes/dnb-table-theme-ui.min.css +1 -1
  40. package/components/table/style/themes/dnb-table-theme-ui.scss +6 -12
  41. package/es/components/table/TableContainer.d.ts +3 -3
  42. package/es/components/table/TableContainer.js +21 -1
  43. package/es/components/table/TableTh.js +2 -2
  44. package/es/components/table/style/_table-accordion.scss +52 -8
  45. package/es/components/table/style/_table-container.scss +20 -2
  46. package/es/components/table/style/_table-td.scss +35 -67
  47. package/es/components/table/style/_table-th.scss +41 -34
  48. package/es/components/table/style/_table.scss +12 -13
  49. package/es/components/table/style/dnb-table-mixins.css +0 -0
  50. package/es/components/table/style/dnb-table-mixins.min.css +0 -0
  51. package/es/components/table/style/dnb-table-mixins.scss +11 -0
  52. package/es/components/table/style/dnb-table.css +124 -137
  53. package/es/components/table/style/dnb-table.min.css +8 -7
  54. package/es/components/table/style/themes/dnb-table-theme-ui.css +7 -3
  55. package/es/components/table/style/themes/dnb-table-theme-ui.min.css +1 -1
  56. package/es/components/table/style/themes/dnb-table-theme-ui.scss +6 -12
  57. package/es/shared/Eufemia.js +1 -1
  58. package/es/style/dnb-ui-components.css +124 -137
  59. package/es/style/dnb-ui-components.min.css +8 -7
  60. package/es/style/themes/theme-eiendom/dnb-theme-eiendom.css +7 -3
  61. package/es/style/themes/theme-eiendom/dnb-theme-eiendom.min.css +1 -1
  62. package/es/style/themes/theme-ui/dnb-theme-ui.css +7 -3
  63. package/es/style/themes/theme-ui/dnb-theme-ui.min.css +1 -1
  64. package/esm/dnb-ui-basis.min.mjs +1 -1
  65. package/esm/dnb-ui-components.min.mjs +1 -1
  66. package/esm/dnb-ui-elements.min.mjs +2 -2
  67. package/esm/dnb-ui-extensions.min.mjs +1 -1
  68. package/esm/dnb-ui-lib.min.mjs +2 -2
  69. package/esm/dnb-ui-web-components.min.mjs +1 -1
  70. package/package.json +1 -1
  71. package/shared/Eufemia.js +1 -1
  72. package/style/dnb-ui-components.css +124 -137
  73. package/style/dnb-ui-components.min.css +8 -7
  74. package/style/themes/theme-eiendom/dnb-theme-eiendom.css +7 -3
  75. package/style/themes/theme-eiendom/dnb-theme-eiendom.min.css +1 -1
  76. package/style/themes/theme-ui/dnb-theme-ui.css +7 -3
  77. package/style/themes/theme-ui/dnb-theme-ui.min.css +1 -1
  78. package/umd/dnb-ui-basis.min.js +1 -1
  79. package/umd/dnb-ui-components.min.js +1 -1
  80. package/umd/dnb-ui-elements.min.js +2 -2
  81. package/umd/dnb-ui-extensions.min.js +1 -1
  82. package/umd/dnb-ui-lib.min.js +2 -2
  83. package/umd/dnb-ui-web-components.min.js +1 -1
@@ -9,7 +9,7 @@ export declare type TableContainerProps = {
9
9
  React.ReactElement<TableContainerHeadProps>,
10
10
  React.ReactElement<TableContainerBodyProps>,
11
11
  React.ReactElement<TableContainerFootProps>
12
- ];
12
+ ] | React.ReactElement<TableContainerBodyProps>;
13
13
  };
14
14
  export declare type TableContainerAllProps = TableContainerProps & React.TableHTMLAttributes<HTMLTableRowElement> & SpacingProps;
15
15
  declare function TableContainer(props: TableContainerAllProps): JSX.Element;
@@ -30,13 +30,13 @@ export declare type TableContainerHeadProps = {
30
30
  /**
31
31
  * The content of the component.
32
32
  */
33
- children: React.ReactNode;
33
+ children?: React.ReactNode;
34
34
  };
35
35
  export declare function TableContainerHead(props: TableContainerHeadProps & React.HTMLAttributes<HTMLDivElement>): JSX.Element;
36
36
  export declare type TableContainerFootProps = {
37
37
  /**
38
38
  * The content of the component.
39
39
  */
40
- children: React.ReactNode;
40
+ children?: React.ReactNode;
41
41
  };
42
42
  export declare function TableContainerFoot(props: TableContainerFootProps & React.HTMLAttributes<HTMLDivElement>): JSX.Element;
@@ -1,5 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+
4
+ var _TableContainer$Head, _TableContainer$Foot;
5
+
3
6
  const _excluded = ["children", "className"],
4
7
  _excluded2 = ["children", "className"],
5
8
  _excluded3 = ["children", "className"],
@@ -10,6 +13,8 @@ import TableScrollView from './TableScrollView';
10
13
  import { createSpacingClasses } from '../space/SpacingUtils';
11
14
  import { validateDOMAttributes } from '../../shared/component-helper';
12
15
  export default function TableContainer(props) {
16
+ var _content$, _content$2;
17
+
13
18
  const {
14
19
  children,
15
20
  className
@@ -19,9 +24,24 @@ export default function TableContainer(props) {
19
24
  const spacingClasses = createSpacingClasses(props);
20
25
  validateDOMAttributes(props, rest);
21
26
  const ScrollView = TableScrollView;
27
+ const isArray = Array.isArray(children);
28
+ const content = isArray ? children : [children];
29
+
30
+ if (((_content$ = content[0]) === null || _content$ === void 0 ? void 0 : _content$.type) !== TableContainer.Head) {
31
+ content.unshift(_TableContainer$Head || (_TableContainer$Head = React.createElement(TableContainer.Head, {
32
+ key: "head"
33
+ })));
34
+ }
35
+
36
+ if (((_content$2 = content[2]) === null || _content$2 === void 0 ? void 0 : _content$2.type) !== TableContainer.Foot) {
37
+ content.push(_TableContainer$Foot || (_TableContainer$Foot = React.createElement(TableContainer.Foot, {
38
+ key: "foot"
39
+ })));
40
+ }
41
+
22
42
  return React.createElement("section", _extends({
23
43
  className: classnames('dnb-table__container', className, spacingClasses)
24
- }, rest), React.createElement(ScrollView, null, children));
44
+ }, rest), React.createElement(ScrollView, null, content));
25
45
  }
26
46
  export function TableContainerBody(props) {
27
47
  const {
@@ -17,8 +17,8 @@ export default function Th(componentProps) {
17
17
  } = componentProps,
18
18
  props = _objectWithoutProperties(componentProps, _excluded);
19
19
 
20
- const role = props.scope === 'row' ? 'rowheader' : 'columnheader';
21
- const scope = props.scope === 'row' ? 'row' : 'col';
20
+ const role = props.scope === 'row' || props.scope === 'rowgroup' ? 'rowheader' : 'columnheader';
21
+ const scope = props.scope === 'row' ? 'row' : props.scope || 'col';
22
22
  const ariaSort = sortable ? reversed ? 'descending' : 'ascending' : undefined;
23
23
  return React.createElement("th", _extends({
24
24
  role: role,
@@ -72,13 +72,17 @@
72
72
  position: relative;
73
73
  z-index: 2;
74
74
  }
75
- &__tr--has-accordion-content:hover,
76
- &__tr--has-accordion-content:active,
77
- &__tr--has-accordion-content:focus,
78
75
  &__tr--has-accordion-content#{&}__tr--expanded,
79
76
  &__tr__accordion_content {
80
- // ensure borders are visible in certain states
81
- z-index: 3;
77
+ z-index: 3; // ensure borders are visible in certain states
78
+ }
79
+
80
+ &__tr--has-accordion-content {
81
+ &:hover,
82
+ &:active,
83
+ html[data-whatinput='keyboard'] &:focus {
84
+ z-index: 5; // over table outline border
85
+ }
82
86
  }
83
87
 
84
88
  &__tr--has-accordion-content#{&}__tr--expanded
@@ -129,6 +133,13 @@
129
133
  }
130
134
  }
131
135
 
136
+ &--outline
137
+ tbody
138
+ &__tr--has-accordion-content:not(#{&}__tr--expanded):not(:nth-last-child(2))
139
+ &__td::before {
140
+ bottom: -0.0625rem;
141
+ }
142
+
132
143
  &__tr--has-accordion-content#{&}__tr--expanded:not(&__tr--disabled):hover
133
144
  &__td {
134
145
  background-color: var(--color-white);
@@ -193,14 +204,16 @@
193
204
  @include IS_SAFARI_DESKTOP {
194
205
  &[hidden] {
195
206
  /**
196
- * By reverting the display from "none" to "block",
197
- * we trick VoiceOver to not make this row as the end of the table. We still need "hidden" to get the correct number of rows (childCount).
198
- */
207
+ * By reverting the display from "none" to "block",
208
+ * we trick VoiceOver to not make this row as the end of the table. We still need "hidden" to get the correct number of rows (childCount).
209
+ */
199
210
  display: block;
200
211
  }
201
212
  }
202
213
 
203
214
  td {
215
+ padding: 0 !important; // medium and small size sets padding – but we never want a padding on this td
216
+
204
217
  width: calc(100% - 3.5rem);
205
218
 
206
219
  .dnb-table__size--medium & {
@@ -279,9 +292,40 @@
279
292
  vertical-align: top;
280
293
  }
281
294
 
295
+ &--outline
296
+ tbody
297
+ &__tr#{&}__tr--has-accordion-content:not(#{&}__tr--expanded):nth-last-child(2)
298
+ &__td:first-of-type {
299
+ &,
300
+ &::before,
301
+ &::after {
302
+ border-radius: 0 0 0 0.5rem;
303
+ }
304
+ }
305
+ &--outline tbody &__tr:last-of-type &__td:last-of-type,
306
+ &--outline
307
+ tbody
308
+ &__tr#{&}__tr--has-accordion-content:not(#{&}__tr--expanded):nth-last-child(2)
309
+ &__td:last-of-type {
310
+ &,
311
+ &::before,
312
+ &::after {
313
+ border-radius: 0 0 0.5rem 0;
314
+ }
315
+ }
316
+ &--outline tbody &__tr#{&}__tr__accordion_content:last-of-type &__td {
317
+ &,
318
+ &::before,
319
+ &::after {
320
+ border-radius: 0 0 0.5rem 0.5rem;
321
+ }
322
+ }
323
+
324
+ // stylelint-disable-next-line
282
325
  &__tr--has-accordion-content:not(&__tr--disabled) {
283
326
  cursor: pointer;
284
327
  }
328
+
285
329
  // prevent selection while animating – useful when user double-clicks
286
330
  // TODO: Our SASS version does not support :has – so we may use this in future
287
331
  // &__tr--has-accordion-content:has(& + &__tr__accordion_content--animating) {
@@ -34,6 +34,22 @@
34
34
  &__size--large .dnb-table__th {
35
35
  padding-top: 1.5rem;
36
36
  }
37
+
38
+ position: relative; // because of bottom border
39
+ &::after {
40
+ @include tableBorder();
41
+ border-bottom: var(--border);
42
+ }
43
+
44
+ /* stylelint-disable */
45
+ & tbody:first-child,
46
+ & > :not(thead) + tbody {
47
+ .dnb-table__tr:first-of-type .dnb-table__th::after,
48
+ .dnb-table__tr:first-of-type .dnb-table__td::after {
49
+ border-top: none;
50
+ }
51
+ }
52
+ /* stylelint-enable */
37
53
  }
38
54
  }
39
55
 
@@ -41,7 +57,8 @@
41
57
  padding: 2rem 1rem 0;
42
58
 
43
59
  &--empty {
44
- padding: 0.5rem 0 0;
60
+ padding: 0;
61
+ min-height: 1.5rem;
45
62
  }
46
63
 
47
64
  .dnb-spacing & .dnb-h--large:not([class*='space__top']) {
@@ -53,7 +70,8 @@
53
70
  padding-bottom: 1.25rem; // because of 8px scrollbar
54
71
 
55
72
  &--empty {
56
- padding-bottom: 1.5rem;
73
+ padding: 0;
74
+ min-height: 1rem;
57
75
  }
58
76
  }
59
77
 
@@ -16,80 +16,18 @@
16
16
  border-bottom: none;
17
17
  }
18
18
  }
19
- &:not(#{&}--outline) tbody &__tr:last-of-type &__td::after,
20
- &:not(#{&}--outline) tbody &__tr &__td[rowspan]::after {
21
- bottom: -0.0625rem;
22
- border-bottom: var(--border);
23
- }
24
19
 
25
20
  // table outline
26
- &--outline tbody &__td {
27
- &:first-of-type::after,
28
- &:last-of-type::after {
29
- @include tableBorder();
30
- }
31
-
32
- &:first-of-type::after {
33
- border-left: var(--outline);
34
- }
35
- &:last-of-type::after {
36
- border-right: var(--outline);
37
- }
38
-
39
- /* stylelint-disable */
21
+ &--outline {
22
+ position: relative;
40
23
  &,
41
- &::before,
42
24
  &::after {
43
- transition: border-radius 400ms var(--easing-default);
25
+ border-radius: 0.5rem;
44
26
  }
45
- /* stylelint-enable */
46
- }
47
- &--outline tbody &__tr:last-of-type &__td {
48
27
  &::after {
49
28
  @include tableBorder();
50
-
51
- border-bottom: var(--outline);
52
- }
53
- }
54
- &--outline thead &__th:first-of-type {
55
- &,
56
- &::after {
57
- border-radius: 0.5rem 0 0 0;
58
- }
59
- }
60
- &--outline thead &__th:last-of-type {
61
- &,
62
- &::after {
63
- border-radius: 0 0.5rem 0 0;
64
- }
65
- }
66
- &--outline tbody &__tr:last-of-type &__td:first-of-type,
67
- &--outline
68
- tbody
69
- &__tr#{&}__tr--has-accordion-content:not(#{&}__tr--expanded):nth-last-child(2)
70
- &__td:first-of-type {
71
- &,
72
- &::before,
73
- &::after {
74
- border-radius: 0 0 0 0.5rem;
75
- }
76
- }
77
- &--outline tbody &__tr:last-of-type &__td:last-of-type,
78
- &--outline
79
- tbody
80
- &__tr#{&}__tr--has-accordion-content:not(#{&}__tr--expanded):nth-last-child(2)
81
- &__td:last-of-type {
82
- &,
83
- &::before,
84
- &::after {
85
- border-radius: 0 0 0.5rem 0;
86
- }
87
- }
88
- &--outline tbody &__tr#{&}__tr__accordion_content:last-of-type &__td {
89
- &,
90
- &::before,
91
- &::after {
92
- border-radius: 0 0 0.5rem 0.5rem;
29
+ z-index: 3;
30
+ border: var(--outline);
93
31
  }
94
32
  }
95
33
 
@@ -112,6 +50,36 @@
112
50
  }
113
51
  }
114
52
 
53
+ // no thead, should have th in body
54
+ /* stylelint-disable */
55
+ &--outline tbody:first-child &__tr:first-of-type &__th,
56
+ &--outline > :not(thead) + tbody &__tr:first-of-type &__th {
57
+ &::after {
58
+ border-top: var(--outline);
59
+ }
60
+ &:first-of-type,
61
+ &:first-of-type::after {
62
+ border-radius: 0.5rem 0 0 0;
63
+ }
64
+ }
65
+ &--outline > tbody:first-child &__tr:first-of-type &__td,
66
+ &--outline > :not(thead) + tbody &__tr:first-of-type &__td {
67
+ &::after {
68
+ border-top: var(--outline);
69
+ }
70
+ &:last-of-type,
71
+ &:last-of-type::after {
72
+ border-radius: 0 0.5rem 0 0;
73
+ }
74
+ }
75
+ &:not(&--outline)#{&}--border > tbody:first-child &__td:last-of-type,
76
+ &:not(&--outline)#{&}--border > :not(thead) + tbody &__td:last-of-type {
77
+ &::after {
78
+ border-right: var(--border);
79
+ }
80
+ }
81
+ /* stylelint-enable */
82
+
115
83
  // spacing
116
84
  &__td--no-spacing,
117
85
  td#{&}__td--no-spacing {
@@ -12,46 +12,53 @@
12
12
  }
13
13
 
14
14
  // table border
15
- &--outline thead &__th {
15
+ &--border tbody &__th {
16
16
  &::after {
17
17
  @include tableBorder();
18
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;
19
+ border-top: var(--border);
39
20
  }
40
21
  }
41
- &--outline tbody &__th:first-of-type::after {
42
- @include tableBorder();
22
+ // &--outline thead &__th {
23
+ // &::after {
24
+ // @include tableBorder();
43
25
 
44
- border-left: var(--outline);
45
- }
46
- &--outline tbody &__tr:last-of-type &__th {
47
- &::after {
48
- @include tableBorder();
26
+ // border-top: var(--outline);
27
+ // }
49
28
 
50
- border-bottom: var(--outline);
51
- }
29
+ // &:first-of-type::after {
30
+ // border-left: var(--outline);
31
+ // }
32
+ // &:last-of-type::after {
33
+ // border-right: var(--outline);
34
+ // }
35
+ // }
36
+ // &--outline thead &__th:first-of-type {
37
+ // &,
38
+ // &::after {
39
+ // border-radius: 0.5rem 0 0 0;
40
+ // }
41
+ // }
42
+ // &--outline thead &__th:last-of-type {
43
+ // &,
44
+ // &::after {
45
+ // border-radius: 0 0.5rem 0 0;
46
+ // }
47
+ // }
48
+ // &--outline tbody &__th:first-of-type::after {
49
+ // @include tableBorder();
52
50
 
53
- &:first-of-type::after {
54
- border-radius: 0 0 0 0.5rem;
55
- }
56
- }
51
+ // border-left: var(--outline);
52
+ // }
53
+ // &--outline tbody &__tr:last-of-type &__th {
54
+ // &::after {
55
+ // @include tableBorder();
56
+
57
+ // border-bottom: var(--outline);
58
+ // }
59
+
60
+ // &:first-of-type::after {
61
+ // border-radius: 0 0 0 0.5rem;
62
+ // }
63
+ // }
57
64
  }
@@ -3,18 +3,7 @@
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
-
6
+ @import './dnb-table-mixins.scss';
18
7
  @import './_table-header-buttons.scss';
19
8
 
20
9
  .dnb-table {
@@ -39,9 +28,19 @@
39
28
 
40
29
  & > caption {
41
30
  caption-side: bottom;
42
- margin-top: 0.5rem;
31
+ padding: 0.5rem 0 0.5rem 1rem;
43
32
 
44
33
  font-size: var(--font-size-basis);
34
+ background-color: var(--color-white);
35
+ text-align: left;
36
+ }
37
+ &--border > caption:not(.dnb-sr-only) {
38
+ position: relative;
39
+ &::after {
40
+ @include tableBorder();
41
+ top: -0.0625rem; // so we are behind the border-bottom (end of table)
42
+ border-top: var(--border);
43
+ }
45
44
  }
46
45
 
47
46
  &.dnb-skeleton {
File without changes
@@ -0,0 +1,11 @@
1
+ @mixin tableBorder {
2
+ content: '';
3
+ position: absolute;
4
+ top: 0;
5
+ left: 0;
6
+ right: 0;
7
+ bottom: 0;
8
+ z-index: 1;
9
+
10
+ pointer-events: none;
11
+ }