@dnb/eufemia 9.38.0-beta.1 → 9.38.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 +6 -1
- package/cjs/components/lib.d.ts +2 -3
- package/cjs/components/table/Table.d.ts +21 -6
- package/cjs/components/table/Table.js +14 -3
- package/cjs/components/table/TableContainer.d.ts +42 -0
- package/cjs/components/table/TableContainer.js +86 -0
- package/cjs/components/table/TableScrollView.d.ts +10 -0
- package/cjs/components/table/TableScrollView.js +40 -0
- package/cjs/components/table/TableStickyHeader.d.ts +2 -2
- package/cjs/components/table/TableTd.d.ts +10 -0
- package/cjs/components/table/TableTd.js +4 -2
- package/cjs/components/table/TableTh.d.ts +1 -0
- package/cjs/components/table/TableTh.js +14 -2
- package/cjs/components/table/TableTr.d.ts +5 -0
- package/cjs/components/table/TableTr.js +3 -2
- package/cjs/components/table/style/_table-cell.scss +21 -0
- package/cjs/components/table/style/_table-container.scss +61 -0
- package/cjs/components/table/style/_table-header-buttons.scss +0 -5
- package/cjs/components/table/style/_table-sticky.scss +42 -0
- package/cjs/components/table/style/_table-td.scss +132 -0
- package/cjs/components/table/style/_table-th.scss +36 -0
- package/cjs/components/table/style/_table-tr.scss +31 -0
- package/cjs/components/table/style/_table.scss +9 -36
- package/cjs/components/table/style/dnb-table.css +264 -37
- package/cjs/components/table/style/dnb-table.min.css +2 -2
- package/cjs/components/table/style/themes/dnb-table-theme-ui.css +12 -71
- 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 +6 -72
- package/cjs/elements/Table.d.ts +6 -2
- package/cjs/elements/Td.d.ts +6 -2
- package/cjs/elements/Th.d.ts +6 -2
- package/cjs/elements/Tr.d.ts +6 -2
- package/cjs/elements/index.d.ts +1 -5
- package/cjs/elements/index.js +0 -32
- package/cjs/elements/lib.d.ts +1 -7
- package/cjs/elements/lib.js +0 -27
- package/cjs/index.d.ts +1 -4
- package/cjs/index.js +0 -24
- package/cjs/shared/Eufemia.js +1 -1
- package/cjs/style/dnb-ui-components.css +252 -37
- package/cjs/style/dnb-ui-components.min.css +2 -2
- package/cjs/style/dnb-ui-elements.css +15 -3
- package/cjs/style/dnb-ui-elements.min.css +1 -1
- package/cjs/style/dnb-ui-tags.css +25 -6
- package/cjs/style/dnb-ui-tags.min.css +1 -1
- package/cjs/style/elements/_anchor-mixins.scss +8 -4
- package/cjs/style/elements/typography.scss +14 -0
- package/cjs/style/themes/theme-eiendom/dnb-theme-eiendom.css +27 -74
- package/cjs/style/themes/theme-eiendom/dnb-theme-eiendom.min.css +2 -2
- package/cjs/style/themes/theme-ui/dnb-theme-ui.css +27 -74
- package/cjs/style/themes/theme-ui/dnb-theme-ui.min.css +2 -2
- package/components/lib.d.ts +2 -3
- package/components/table/Table.d.ts +21 -6
- package/components/table/Table.js +8 -3
- package/components/table/TableContainer.d.ts +42 -0
- package/components/table/TableContainer.js +52 -0
- package/components/table/TableScrollView.d.ts +10 -0
- package/components/table/TableScrollView.js +15 -0
- package/components/table/TableStickyHeader.d.ts +2 -2
- package/components/table/TableTd.d.ts +10 -0
- package/components/table/TableTd.js +4 -2
- package/components/table/TableTh.d.ts +1 -0
- package/components/table/TableTh.js +15 -2
- package/components/table/TableTr.d.ts +5 -0
- package/components/table/TableTr.js +3 -2
- package/components/table/style/_table-cell.scss +21 -0
- package/components/table/style/_table-container.scss +61 -0
- package/components/table/style/_table-header-buttons.scss +0 -5
- package/components/table/style/_table-sticky.scss +42 -0
- package/components/table/style/_table-td.scss +132 -0
- package/components/table/style/_table-th.scss +36 -0
- package/components/table/style/_table-tr.scss +31 -0
- package/components/table/style/_table.scss +9 -36
- package/components/table/style/dnb-table.css +264 -37
- package/components/table/style/dnb-table.min.css +2 -2
- package/components/table/style/themes/dnb-table-theme-ui.css +12 -71
- package/components/table/style/themes/dnb-table-theme-ui.min.css +1 -1
- package/components/table/style/themes/dnb-table-theme-ui.scss +6 -72
- package/elements/Table.d.ts +6 -2
- package/elements/Td.d.ts +6 -2
- package/elements/Th.d.ts +6 -2
- package/elements/Tr.d.ts +6 -2
- package/elements/index.d.ts +1 -5
- package/elements/index.js +1 -5
- package/elements/lib.d.ts +1 -7
- package/elements/lib.js +1 -7
- package/es/components/lib.d.ts +2 -3
- package/es/components/table/Table.d.ts +21 -6
- package/es/components/table/Table.js +9 -4
- package/es/components/table/TableContainer.d.ts +42 -0
- package/es/components/table/TableContainer.js +60 -0
- package/es/components/table/TableScrollView.d.ts +10 -0
- package/es/components/table/TableScrollView.js +17 -0
- package/es/components/table/TableStickyHeader.d.ts +2 -2
- package/es/components/table/TableTd.d.ts +10 -0
- package/es/components/table/TableTd.js +5 -3
- package/es/components/table/TableTh.d.ts +1 -0
- package/es/components/table/TableTh.js +16 -2
- package/es/components/table/TableTr.d.ts +5 -0
- package/es/components/table/TableTr.js +3 -2
- package/es/components/table/style/_table-cell.scss +21 -0
- package/es/components/table/style/_table-container.scss +61 -0
- package/es/components/table/style/_table-header-buttons.scss +0 -5
- package/es/components/table/style/_table-sticky.scss +42 -0
- package/es/components/table/style/_table-td.scss +132 -0
- package/es/components/table/style/_table-th.scss +36 -0
- package/es/components/table/style/_table-tr.scss +31 -0
- package/es/components/table/style/_table.scss +9 -36
- package/es/components/table/style/dnb-table.css +264 -37
- package/es/components/table/style/dnb-table.min.css +2 -2
- package/es/components/table/style/themes/dnb-table-theme-ui.css +12 -71
- 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 +6 -72
- package/es/elements/Table.d.ts +6 -2
- package/es/elements/Td.d.ts +6 -2
- package/es/elements/Th.d.ts +6 -2
- package/es/elements/Tr.d.ts +6 -2
- package/es/elements/index.d.ts +1 -5
- package/es/elements/index.js +1 -5
- package/es/elements/lib.d.ts +1 -7
- package/es/elements/lib.js +1 -7
- package/es/index.d.ts +1 -4
- package/es/index.js +1 -4
- package/es/shared/Eufemia.js +1 -1
- package/es/style/dnb-ui-components.css +252 -37
- package/es/style/dnb-ui-components.min.css +2 -2
- package/es/style/dnb-ui-elements.css +15 -3
- package/es/style/dnb-ui-elements.min.css +1 -1
- package/es/style/dnb-ui-tags.css +25 -6
- package/es/style/dnb-ui-tags.min.css +1 -1
- package/es/style/elements/_anchor-mixins.scss +8 -4
- package/es/style/elements/typography.scss +14 -0
- package/es/style/themes/theme-eiendom/dnb-theme-eiendom.css +27 -74
- package/es/style/themes/theme-eiendom/dnb-theme-eiendom.min.css +2 -2
- package/es/style/themes/theme-ui/dnb-theme-ui.css +27 -74
- package/es/style/themes/theme-ui/dnb-theme-ui.min.css +2 -2
- package/esm/dnb-ui-basis.min.mjs +1 -1
- package/esm/dnb-ui-components.min.mjs +1 -1
- package/esm/dnb-ui-elements.min.mjs +4 -4
- package/esm/dnb-ui-extensions.min.mjs +1 -1
- package/esm/dnb-ui-lib.min.mjs +2 -2
- package/esm/dnb-ui-web-components.min.mjs +2 -2
- package/index.d.ts +1 -4
- package/index.js +1 -4
- package/package.json +1 -1
- package/shared/Eufemia.js +1 -1
- package/style/dnb-ui-components.css +252 -37
- package/style/dnb-ui-components.min.css +2 -2
- package/style/dnb-ui-elements.css +15 -3
- package/style/dnb-ui-elements.min.css +1 -1
- package/style/dnb-ui-tags.css +25 -6
- package/style/dnb-ui-tags.min.css +1 -1
- package/style/elements/_anchor-mixins.scss +8 -4
- package/style/elements/typography.scss +14 -0
- package/style/themes/theme-eiendom/dnb-theme-eiendom.css +27 -74
- package/style/themes/theme-eiendom/dnb-theme-eiendom.min.css +2 -2
- package/style/themes/theme-ui/dnb-theme-ui.css +27 -74
- package/style/themes/theme-ui/dnb-theme-ui.min.css +2 -2
- package/umd/dnb-ui-basis.min.js +1 -1
- package/umd/dnb-ui-components.min.js +1 -1
- package/umd/dnb-ui-elements.min.js +5 -5
- package/umd/dnb-ui-extensions.min.js +1 -1
- package/umd/dnb-ui-lib.min.js +2 -2
- package/umd/dnb-ui-web-components.min.js +2 -2
|
@@ -6,84 +6,18 @@
|
|
|
6
6
|
@import '../../../../style/themes/imports.scss';
|
|
7
7
|
|
|
8
8
|
.dnb-table {
|
|
9
|
-
// Header part
|
|
10
|
-
& > tr > th,
|
|
11
|
-
& > tr > td,
|
|
12
|
-
& > thead > tr > th,
|
|
13
|
-
& > tbody > tr > td,
|
|
14
|
-
&__th,
|
|
15
|
-
&__td {
|
|
16
|
-
position: relative;
|
|
17
|
-
|
|
18
|
-
font-size: var(--font-size-basis);
|
|
19
|
-
line-height: var(--line-height-basis);
|
|
20
|
-
border-spacing: 0;
|
|
21
|
-
|
|
22
|
-
word-break: keep-all;
|
|
23
|
-
}
|
|
24
|
-
/* stylelint-disable-next-line */
|
|
25
|
-
& > tr > th,
|
|
26
|
-
& > thead > tr > th,
|
|
27
|
-
&__th {
|
|
28
|
-
padding: var(--spacing-x-large) var(--spacing-small)
|
|
29
|
-
var(--spacing-x-small);
|
|
30
|
-
|
|
31
|
-
font-weight: var(--font-weight-medium);
|
|
32
|
-
color: var(--color-black);
|
|
33
|
-
|
|
34
|
-
vertical-align: bottom;
|
|
35
|
-
|
|
36
|
-
&:not([align]) {
|
|
37
|
-
text-align: inherit;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
@include IS_FF {
|
|
41
|
-
// to get the perfect height of pixles, to this:
|
|
42
|
-
padding-bottom: calc(var(--spacing-x-small) - 0.5px);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
background-color: var(--color-white);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Body part
|
|
49
|
-
/* stylelint-disable-next-line */
|
|
50
|
-
& > tr > td,
|
|
51
|
-
& > tbody > tr > td,
|
|
52
|
-
&__td,
|
|
53
|
-
& > tr > th[scope='row'] {
|
|
54
|
-
padding: var(--spacing-small);
|
|
55
|
-
padding-top: calc(var(--spacing-small) * 1.25);
|
|
56
|
-
padding-bottom: calc(var(--spacing-small) * 1.188); /* 19/16 */
|
|
57
|
-
|
|
58
|
-
color: var(--theme-color-black-80, currentColor);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// Needs a double & & for specificity
|
|
62
|
-
& > tbody > tr,
|
|
63
|
-
& &__tr,
|
|
64
|
-
& &__tr--even {
|
|
65
|
-
background-color: var(--color-lavender);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Needs a double & & for specificity
|
|
69
|
-
& > tbody > tr:not(#{&}__tr--even):nth-of-type(2n),
|
|
70
|
-
& &__tr:not(#{&}__tr--even):nth-of-type(2n),
|
|
71
|
-
& &__tr--odd {
|
|
72
|
-
background-color: var(--color-white);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
9
|
// Border
|
|
76
|
-
& > thead > tr > th::after,
|
|
77
|
-
& > tbody > tr:last-of-type > td::after,
|
|
78
|
-
& > thead > &__tr > &__th::after,
|
|
79
|
-
& > tbody > &__tr:last-of-type > &__td::after {
|
|
10
|
+
&:not(#{&}--border) > thead > tr > th::after,
|
|
11
|
+
&:not(#{&}--border) > tbody > tr:last-of-type > td::after,
|
|
12
|
+
&:not(#{&}--border) > thead > &__tr > &__th::after,
|
|
13
|
+
&:not(#{&}--border) > tbody > &__tr:last-of-type > &__td::after {
|
|
80
14
|
content: '';
|
|
81
15
|
position: absolute;
|
|
82
16
|
left: 0;
|
|
83
17
|
right: 0;
|
|
84
|
-
bottom: -
|
|
18
|
+
bottom: -0.0625rem;
|
|
85
19
|
|
|
86
|
-
height:
|
|
20
|
+
height: 0.0625rem;
|
|
87
21
|
background-color: var(--color-black-8);
|
|
88
22
|
}
|
|
89
23
|
}
|
package/elements/Table.d.ts
CHANGED
package/elements/Td.d.ts
CHANGED
package/elements/Th.d.ts
CHANGED
package/elements/Tr.d.ts
CHANGED
package/elements/index.d.ts
CHANGED
|
@@ -22,9 +22,5 @@ import Ol from "./Ol";
|
|
|
22
22
|
import P from "./P";
|
|
23
23
|
import Paragraph from "./Paragraph";
|
|
24
24
|
import Span from "./Span";
|
|
25
|
-
import Table from "./Table";
|
|
26
|
-
import Td from "./Td";
|
|
27
|
-
import Th from "./Th";
|
|
28
|
-
import Tr from "./Tr";
|
|
29
25
|
import Ul from "./Ul";
|
|
30
|
-
export { Anchor, Blockquote, Code, Dd, Div, Dl, Dt, H, H1, H2, H3, H4, H5, H6, Hr, Img, Ingress, Lead, Li, Link, Ol, P, Paragraph, Span,
|
|
26
|
+
export { Anchor, Blockquote, Code, Dd, Div, Dl, Dt, H, H1, H2, H3, H4, H5, H6, Hr, Img, Ingress, Lead, Li, Link, Ol, P, Paragraph, Span, Ul };
|
package/elements/index.js
CHANGED
|
@@ -22,9 +22,5 @@ import Ol from './Ol';
|
|
|
22
22
|
import P from './P';
|
|
23
23
|
import Paragraph from './Paragraph';
|
|
24
24
|
import Span from './Span';
|
|
25
|
-
import Table from './Table';
|
|
26
|
-
import Td from './Td';
|
|
27
|
-
import Th from './Th';
|
|
28
|
-
import Tr from './Tr';
|
|
29
25
|
import Ul from './Ul';
|
|
30
|
-
export { Anchor, Blockquote, Code, Dd, Div, Dl, Dt, H, H1, H2, H3, H4, H5, H6, Hr, Img, Ingress, Lead, Li, Link, Ol, P, Paragraph, Span,
|
|
26
|
+
export { Anchor, Blockquote, Code, Dd, Div, Dl, Dt, H, H1, H2, H3, H4, H5, H6, Hr, Img, Ingress, Lead, Li, Link, Ol, P, Paragraph, Span, Ul };
|
package/elements/lib.d.ts
CHANGED
|
@@ -49,9 +49,6 @@ export function getElements(): {
|
|
|
49
49
|
tagName: string;
|
|
50
50
|
};
|
|
51
51
|
Span: import("react").FC<import("./Span").SpanProps>;
|
|
52
|
-
Td: typeof Td;
|
|
53
|
-
Th: typeof Th;
|
|
54
|
-
Tr: typeof Tr;
|
|
55
52
|
Ul: ({ nested, inside, outside, ...p }?: import("./Ul").UlAllProps) => JSX.Element;
|
|
56
53
|
};
|
|
57
54
|
import Anchor from "./Anchor";
|
|
@@ -78,8 +75,5 @@ import Ol from "./Ol";
|
|
|
78
75
|
import P from "./P";
|
|
79
76
|
import Paragraph from "./Paragraph";
|
|
80
77
|
import Span from "./Span";
|
|
81
|
-
import Td from "./Td";
|
|
82
|
-
import Th from "./Th";
|
|
83
|
-
import Tr from "./Tr";
|
|
84
78
|
import Ul from "./Ul";
|
|
85
|
-
export { Anchor, Blockquote, Code, Dd, Div, Dl, Dt, H, H1, H2, H3, H4, H5, H6, Hr, Img, Ingress, Lead, Li, Link, Ol, P, Paragraph, Span,
|
|
79
|
+
export { Anchor, Blockquote, Code, Dd, Div, Dl, Dt, H, H1, H2, H3, H4, H5, H6, Hr, Img, Ingress, Lead, Li, Link, Ol, P, Paragraph, Span, Ul };
|
package/elements/lib.js
CHANGED
|
@@ -22,11 +22,8 @@ import Ol from './Ol';
|
|
|
22
22
|
import P from './P';
|
|
23
23
|
import Paragraph from './Paragraph';
|
|
24
24
|
import Span from './Span';
|
|
25
|
-
import Td from './Td';
|
|
26
|
-
import Th from './Th';
|
|
27
|
-
import Tr from './Tr';
|
|
28
25
|
import Ul from './Ul';
|
|
29
|
-
export { Anchor, Blockquote, Code, Dd, Div, Dl, Dt, H, H1, H2, H3, H4, H5, H6, Hr, Img, Ingress, Lead, Li, Link, Ol, P, Paragraph, Span,
|
|
26
|
+
export { Anchor, Blockquote, Code, Dd, Div, Dl, Dt, H, H1, H2, H3, H4, H5, H6, Hr, Img, Ingress, Lead, Li, Link, Ol, P, Paragraph, Span, Ul };
|
|
30
27
|
export var getElements = function getElements() {
|
|
31
28
|
return {
|
|
32
29
|
Anchor: Anchor,
|
|
@@ -53,9 +50,6 @@ export var getElements = function getElements() {
|
|
|
53
50
|
P: P,
|
|
54
51
|
Paragraph: Paragraph,
|
|
55
52
|
Span: Span,
|
|
56
|
-
Td: Td,
|
|
57
|
-
Th: Th,
|
|
58
|
-
Tr: Tr,
|
|
59
53
|
Ul: Ul
|
|
60
54
|
};
|
|
61
55
|
};
|
package/es/components/lib.d.ts
CHANGED
|
@@ -51,10 +51,9 @@ export function getComponents(): {
|
|
|
51
51
|
StepIndicator: typeof StepIndicator;
|
|
52
52
|
Switch: typeof Switch;
|
|
53
53
|
Table: {
|
|
54
|
-
(componentProps: import("./table/Table").
|
|
55
|
-
space?: import("./space/types").SpaceTypes | import("./space/types").SpacingElementProps;
|
|
56
|
-
}): JSX.Element;
|
|
54
|
+
(componentProps: import("./table/Table").TableAllProps): JSX.Element;
|
|
57
55
|
StickyHelper: () => JSX.Element;
|
|
56
|
+
ScrollView: typeof import("./table/TableScrollView").default;
|
|
58
57
|
};
|
|
59
58
|
Tabs: typeof Tabs;
|
|
60
59
|
Tag: {
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import ScrollView from './TableScrollView';
|
|
3
|
+
import { StickyHelper } from './TableStickyHeader';
|
|
4
|
+
import type { StickyTableHeaderProps } from './TableStickyHeader';
|
|
5
|
+
import type { SkeletonShow } from '../skeleton/Skeleton';
|
|
6
|
+
import type { SpacingProps } from '../../shared/types';
|
|
5
7
|
export declare type TableSizes = 'large' | 'medium';
|
|
6
8
|
export declare type TableVariants = 'generic';
|
|
7
9
|
export { StickyHelper };
|
|
8
|
-
export
|
|
10
|
+
export { ScrollView };
|
|
11
|
+
export declare type TableProps = {
|
|
9
12
|
/**
|
|
10
13
|
* The content of the component.
|
|
11
14
|
*/
|
|
@@ -28,18 +31,30 @@ export interface TableProps extends StickyTableHeaderProps {
|
|
|
28
31
|
* Default: generic.
|
|
29
32
|
*/
|
|
30
33
|
variant?: TableVariants;
|
|
34
|
+
/**
|
|
35
|
+
* Use `true` to show borders between table data cell
|
|
36
|
+
* Default: false
|
|
37
|
+
*/
|
|
38
|
+
border?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Use `true` to show a outline border around the table
|
|
41
|
+
* Default: false
|
|
42
|
+
*/
|
|
43
|
+
outline?: boolean;
|
|
31
44
|
/**
|
|
32
45
|
* Defines if the table should behave with a fixed table layout, using: "table-layout: fixed;"
|
|
33
46
|
* Default: null.
|
|
34
47
|
*/
|
|
35
48
|
fixed?: boolean;
|
|
36
|
-
}
|
|
49
|
+
} & StickyTableHeaderProps;
|
|
50
|
+
export declare type TableAllProps = TableProps & React.TableHTMLAttributes<HTMLTableElement> & SpacingProps;
|
|
37
51
|
export declare const defaultProps: {
|
|
38
52
|
size: string;
|
|
39
53
|
variant: string;
|
|
40
54
|
};
|
|
41
55
|
declare const Table: {
|
|
42
|
-
(componentProps:
|
|
56
|
+
(componentProps: TableAllProps): JSX.Element;
|
|
43
57
|
StickyHelper: () => JSX.Element;
|
|
58
|
+
ScrollView: typeof ScrollView;
|
|
44
59
|
};
|
|
45
60
|
export default Table;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
-
const _excluded = ["className", "children", "size", "skeleton", "variant", "sticky", "stickyOffset", "fixed"];
|
|
4
|
+
const _excluded = ["className", "children", "size", "skeleton", "variant", "sticky", "stickyOffset", "fixed", "border", "outline"];
|
|
5
5
|
|
|
6
6
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
7
7
|
|
|
@@ -14,9 +14,11 @@ import Provider from '../../shared/Provider';
|
|
|
14
14
|
import { createSpacingClasses } from '../space/SpacingHelper';
|
|
15
15
|
import { createSkeletonClass } from '../skeleton/SkeletonHelper';
|
|
16
16
|
import { extendPropsWithContext, validateDOMAttributes } from '../../shared/component-helper';
|
|
17
|
+
import ScrollView from './TableScrollView';
|
|
17
18
|
import TableContext from './TableContext';
|
|
18
19
|
import { useStickyHeader, StickyHelper } from './TableStickyHeader';
|
|
19
20
|
export { StickyHelper };
|
|
21
|
+
export { ScrollView };
|
|
20
22
|
export const defaultProps = {
|
|
21
23
|
size: 'large',
|
|
22
24
|
variant: 'generic'
|
|
@@ -36,7 +38,9 @@ const Table = componentProps => {
|
|
|
36
38
|
variant,
|
|
37
39
|
sticky,
|
|
38
40
|
stickyOffset,
|
|
39
|
-
fixed
|
|
41
|
+
fixed,
|
|
42
|
+
border,
|
|
43
|
+
outline
|
|
40
44
|
} = allProps,
|
|
41
45
|
props = _objectWithoutProperties(allProps, _excluded);
|
|
42
46
|
|
|
@@ -60,7 +64,7 @@ const Table = componentProps => {
|
|
|
60
64
|
allProps: _objectSpread(_objectSpread({}, context.getTranslation(componentProps).Table), allProps)
|
|
61
65
|
}
|
|
62
66
|
}, React.createElement("table", _extends({
|
|
63
|
-
className: classnames('dnb-table', spacingClasses, skeletonClasses, className, variant && `dnb-table__variant--${variant}`, size && `dnb-table__size--${size}`, sticky && `dnb-table--sticky`, fixed && `dnb-table--fixed`),
|
|
67
|
+
className: classnames('dnb-table', spacingClasses, skeletonClasses, className, variant && `dnb-table__variant--${variant}`, size && `dnb-table__size--${size}`, sticky && `dnb-table--sticky`, fixed && `dnb-table--fixed`, border && `dnb-table--border`, outline && `dnb-table--outline`),
|
|
64
68
|
ref: elementRef
|
|
65
69
|
}, props), children)));
|
|
66
70
|
|
|
@@ -71,4 +75,5 @@ const Table = componentProps => {
|
|
|
71
75
|
};
|
|
72
76
|
|
|
73
77
|
export default Table;
|
|
74
|
-
Table.StickyHelper = StickyHelper;
|
|
78
|
+
Table.StickyHelper = StickyHelper;
|
|
79
|
+
Table.ScrollView = ScrollView;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TableProps } from './Table';
|
|
3
|
+
import type { SpacingProps } from '../space/types';
|
|
4
|
+
export declare type TableContainerProps = {
|
|
5
|
+
/**
|
|
6
|
+
* The content of the component.
|
|
7
|
+
*/
|
|
8
|
+
children: [
|
|
9
|
+
React.ReactElement<TableContainerHeadProps>,
|
|
10
|
+
React.ReactElement<TableContainerBodyProps>,
|
|
11
|
+
React.ReactElement<TableContainerFootProps>
|
|
12
|
+
];
|
|
13
|
+
};
|
|
14
|
+
export declare type TableContainerAllProps = TableContainerProps & React.TableHTMLAttributes<HTMLTableRowElement> & SpacingProps;
|
|
15
|
+
declare function TableContainer(props: TableContainerAllProps): JSX.Element;
|
|
16
|
+
declare namespace TableContainer {
|
|
17
|
+
var Body: typeof TableContainerBody;
|
|
18
|
+
var Head: typeof TableContainerHead;
|
|
19
|
+
var Foot: typeof TableContainerFoot;
|
|
20
|
+
}
|
|
21
|
+
export default TableContainer;
|
|
22
|
+
export declare type TableContainerBodyProps = {
|
|
23
|
+
/**
|
|
24
|
+
* The content of the component.
|
|
25
|
+
*/
|
|
26
|
+
children: React.ReactElement<TableProps> | Array<React.ReactElement<TableProps>>;
|
|
27
|
+
};
|
|
28
|
+
export declare function TableContainerBody(props: TableContainerBodyProps & React.HTMLAttributes<HTMLDivElement>): JSX.Element;
|
|
29
|
+
export declare type TableContainerHeadProps = {
|
|
30
|
+
/**
|
|
31
|
+
* The content of the component.
|
|
32
|
+
*/
|
|
33
|
+
children: React.ReactNode;
|
|
34
|
+
};
|
|
35
|
+
export declare function TableContainerHead(props: TableContainerHeadProps & React.HTMLAttributes<HTMLDivElement>): JSX.Element;
|
|
36
|
+
export declare type TableContainerFootProps = {
|
|
37
|
+
/**
|
|
38
|
+
* The content of the component.
|
|
39
|
+
*/
|
|
40
|
+
children: React.ReactNode;
|
|
41
|
+
};
|
|
42
|
+
export declare function TableContainerFoot(props: TableContainerFootProps & React.HTMLAttributes<HTMLDivElement>): JSX.Element;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
const _excluded = ["children", "className"],
|
|
4
|
+
_excluded2 = ["children", "className"],
|
|
5
|
+
_excluded3 = ["children", "className"],
|
|
6
|
+
_excluded4 = ["children", "className"];
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import classnames from 'classnames';
|
|
9
|
+
import ScrollView from '../../fragments/scroll-view/ScrollView';
|
|
10
|
+
import { createSpacingClasses } from '../space/SpacingUtils';
|
|
11
|
+
import { validateDOMAttributes } from '../../shared/component-helper';
|
|
12
|
+
export default function TableContainer(props) {
|
|
13
|
+
const {
|
|
14
|
+
children,
|
|
15
|
+
className
|
|
16
|
+
} = props,
|
|
17
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
18
|
+
|
|
19
|
+
const spacingClasses = createSpacingClasses(props);
|
|
20
|
+
validateDOMAttributes(props, rest);
|
|
21
|
+
return React.createElement("section", _extends({
|
|
22
|
+
className: classnames('dnb-table__container', className, spacingClasses)
|
|
23
|
+
}, rest), React.createElement(ScrollView, null, children));
|
|
24
|
+
}
|
|
25
|
+
export function TableContainerBody(props) {
|
|
26
|
+
const {
|
|
27
|
+
children,
|
|
28
|
+
className
|
|
29
|
+
} = props,
|
|
30
|
+
rest = _objectWithoutProperties(props, _excluded2);
|
|
31
|
+
|
|
32
|
+
return React.createElement("div", _extends({
|
|
33
|
+
className: classnames('dnb-table__container__body', className)
|
|
34
|
+
}, rest), children);
|
|
35
|
+
}
|
|
36
|
+
export function TableContainerHead(props) {
|
|
37
|
+
const {
|
|
38
|
+
children,
|
|
39
|
+
className
|
|
40
|
+
} = props,
|
|
41
|
+
rest = _objectWithoutProperties(props, _excluded3);
|
|
42
|
+
|
|
43
|
+
return React.createElement("div", _extends({
|
|
44
|
+
className: classnames('dnb-table__container__head', className)
|
|
45
|
+
}, rest), children);
|
|
46
|
+
}
|
|
47
|
+
export function TableContainerFoot(props) {
|
|
48
|
+
const {
|
|
49
|
+
children,
|
|
50
|
+
className
|
|
51
|
+
} = props,
|
|
52
|
+
rest = _objectWithoutProperties(props, _excluded4);
|
|
53
|
+
|
|
54
|
+
return React.createElement("div", _extends({
|
|
55
|
+
className: classnames('dnb-table__container__foot', className)
|
|
56
|
+
}, rest), children);
|
|
57
|
+
}
|
|
58
|
+
TableContainer.Body = TableContainerBody;
|
|
59
|
+
TableContainer.Head = TableContainerHead;
|
|
60
|
+
TableContainer.Foot = TableContainerFoot;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SpacingProps } from '../../shared/types';
|
|
3
|
+
export declare type TableScrollViewProps = {
|
|
4
|
+
/**
|
|
5
|
+
* The content of the component.
|
|
6
|
+
*/
|
|
7
|
+
children: React.ReactElement<HTMLTableElement>;
|
|
8
|
+
};
|
|
9
|
+
export declare type TableScrollViewAllProps = TableScrollViewProps & Omit<React.TableHTMLAttributes<HTMLDivElement>, 'children'> & SpacingProps;
|
|
10
|
+
export default function TableScrollView(props: TableScrollViewAllProps): JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
const _excluded = ["className", "children"];
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import classnames from 'classnames';
|
|
6
|
+
import ScrollView from '../../fragments/scroll-view/ScrollView';
|
|
7
|
+
export default function TableScrollView(props) {
|
|
8
|
+
const {
|
|
9
|
+
className,
|
|
10
|
+
children
|
|
11
|
+
} = props,
|
|
12
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
13
|
+
|
|
14
|
+
return React.createElement(ScrollView, _extends({
|
|
15
|
+
className: classnames('dnb-table__scroll-view', className)
|
|
16
|
+
}, rest), children);
|
|
17
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare type StickyTableHeaderProps = {
|
|
3
3
|
/**
|
|
4
4
|
* Makes the Table header sticky
|
|
5
5
|
* Default: false
|
|
@@ -14,7 +14,7 @@ export interface StickyTableHeaderProps {
|
|
|
14
14
|
* @deprecated Please use `stickyOffset`
|
|
15
15
|
*/
|
|
16
16
|
sticky_offset?: string | number;
|
|
17
|
-
}
|
|
17
|
+
};
|
|
18
18
|
export declare const useStickyHeader: ({ sticky, stickyOffset, sticky_offset, }: StickyTableHeaderProps) => {
|
|
19
19
|
elementRef: React.MutableRefObject<HTMLTableElement>;
|
|
20
20
|
};
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export declare type TableTdProps = {
|
|
3
|
+
/**
|
|
4
|
+
* if set to `true`, no padding will be added
|
|
5
|
+
* Default: false
|
|
6
|
+
*/
|
|
7
|
+
noSpacing?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Set to `horizontal` for padding on left and right side
|
|
10
|
+
* Default: false
|
|
11
|
+
*/
|
|
12
|
+
spacing?: 'horizontal';
|
|
3
13
|
/**
|
|
4
14
|
* The content of the component.
|
|
5
15
|
* Default: null
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
const _excluded = ["className", "children"];
|
|
3
|
+
const _excluded = ["className", "children", "noSpacing", "spacing"];
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import classnames from 'classnames';
|
|
6
6
|
export default function Td(componentProps) {
|
|
7
7
|
const {
|
|
8
8
|
className,
|
|
9
|
-
children
|
|
9
|
+
children,
|
|
10
|
+
noSpacing,
|
|
11
|
+
spacing
|
|
10
12
|
} = componentProps,
|
|
11
13
|
props = _objectWithoutProperties(componentProps, _excluded);
|
|
12
14
|
|
|
13
15
|
return React.createElement("td", _extends({
|
|
14
16
|
role: "cell",
|
|
15
|
-
className: classnames('dnb-table__td', className)
|
|
17
|
+
className: classnames('dnb-table__td', className, noSpacing && 'dnb-table__td--no-spacing', spacing && `dnb-table__td--spacing-${spacing}`)
|
|
16
18
|
}, props), children);
|
|
17
19
|
}
|
|
@@ -32,5 +32,6 @@ declare function Th(componentProps: TableThProps & React.ThHTMLAttributes<HTMLTa
|
|
|
32
32
|
declare namespace Th {
|
|
33
33
|
var SortButton: typeof TableSortButton;
|
|
34
34
|
var HelpButton: typeof TableHelpButton;
|
|
35
|
+
var Horizontal: ({ className, ...rest }: React.ThHTMLAttributes<HTMLDivElement>) => JSX.Element;
|
|
35
36
|
}
|
|
36
37
|
export default Th;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
const _excluded = ["className", "children", "sortable", "active", "reversed", "noWrap"]
|
|
3
|
+
const _excluded = ["className", "children", "sortable", "active", "reversed", "noWrap"],
|
|
4
|
+
_excluded2 = ["className"];
|
|
4
5
|
import React from 'react';
|
|
5
6
|
import classnames from 'classnames';
|
|
6
7
|
import TableSortButton from './TableSortButton';
|
|
@@ -21,5 +22,18 @@ export default function Th(componentProps) {
|
|
|
21
22
|
className: classnames('dnb-table__th', className, sortable && 'dnb-table--sortable', active && 'dnb-table--active', reversed && 'dnb-table--reversed', noWrap && 'dnb-table--no-wrap')
|
|
22
23
|
}, props), children);
|
|
23
24
|
}
|
|
25
|
+
|
|
26
|
+
function Horizontal(_ref) {
|
|
27
|
+
let {
|
|
28
|
+
className = null
|
|
29
|
+
} = _ref,
|
|
30
|
+
rest = _objectWithoutProperties(_ref, _excluded2);
|
|
31
|
+
|
|
32
|
+
return React.createElement("div", _extends({}, rest, {
|
|
33
|
+
className: classnames('dnb-table__th__horizontal', className)
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
|
|
24
37
|
Th.SortButton = TableSortButton;
|
|
25
|
-
Th.HelpButton = TableHelpButton;
|
|
38
|
+
Th.HelpButton = TableHelpButton;
|
|
39
|
+
Th.Horizontal = Horizontal;
|
|
@@ -5,6 +5,11 @@ export declare type TableTrProps = {
|
|
|
5
5
|
* The variant of the tr
|
|
6
6
|
*/
|
|
7
7
|
variant?: 'even' | 'odd';
|
|
8
|
+
/**
|
|
9
|
+
* If set to true, the inherited header text will not wrap to new lines
|
|
10
|
+
* Default: false
|
|
11
|
+
*/
|
|
12
|
+
noWrap?: boolean;
|
|
8
13
|
/**
|
|
9
14
|
* The content of the component.
|
|
10
15
|
*/
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
const _excluded = ["variant", "children", "className"];
|
|
3
|
+
const _excluded = ["variant", "noWrap", "children", "className"];
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import classnames from 'classnames';
|
|
6
6
|
import TableContext from './TableContext';
|
|
7
7
|
export default function Tr(componentProps) {
|
|
8
8
|
const {
|
|
9
9
|
variant,
|
|
10
|
+
noWrap,
|
|
10
11
|
children,
|
|
11
12
|
className: _className
|
|
12
13
|
} = componentProps,
|
|
@@ -17,7 +18,7 @@ export default function Tr(componentProps) {
|
|
|
17
18
|
} = useHandleTrVariant({
|
|
18
19
|
variant
|
|
19
20
|
});
|
|
20
|
-
const className = classnames('dnb-table__tr', _className, currentVariant && `dnb-table__tr--${currentVariant}
|
|
21
|
+
const className = classnames('dnb-table__tr', _className, currentVariant && `dnb-table__tr--${currentVariant}`, noWrap && 'dnb-table--no-wrap');
|
|
21
22
|
return React.createElement("tr", _extends({
|
|
22
23
|
role: "row",
|
|
23
24
|
className: className
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Table component
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
.dnb-table {
|
|
7
|
+
& > tr > th,
|
|
8
|
+
& > tr > td,
|
|
9
|
+
& > thead > tr > th,
|
|
10
|
+
& > tbody > tr > td,
|
|
11
|
+
&__th,
|
|
12
|
+
&__td {
|
|
13
|
+
position: relative;
|
|
14
|
+
|
|
15
|
+
font-size: var(--font-size-basis);
|
|
16
|
+
line-height: var(--line-height-basis);
|
|
17
|
+
border-spacing: 0;
|
|
18
|
+
|
|
19
|
+
word-break: keep-all;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Table component
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
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
|
+
.dnb-table__container {
|
|
19
|
+
position: relative;
|
|
20
|
+
|
|
21
|
+
--border: 0.0625rem solid var(--color-black-8);
|
|
22
|
+
background-color: var(--color-white);
|
|
23
|
+
|
|
24
|
+
&::after {
|
|
25
|
+
@include tableBorder();
|
|
26
|
+
|
|
27
|
+
border: var(--border);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&,
|
|
31
|
+
&::after {
|
|
32
|
+
border-radius: 0.5rem;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&,
|
|
36
|
+
&__body,
|
|
37
|
+
&__head,
|
|
38
|
+
&__foot {
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&__body {
|
|
44
|
+
.dnb-table {
|
|
45
|
+
&:not([class*='space__bottom']) {
|
|
46
|
+
margin-bottom: 0;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&__head {
|
|
52
|
+
padding: 2rem 1rem 0;
|
|
53
|
+
|
|
54
|
+
.dnb-spacing & .dnb-h--large:not([class*='space__top']) {
|
|
55
|
+
margin: 0;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
&__foot {
|
|
59
|
+
padding: 0.5rem 1rem 2rem;
|
|
60
|
+
}
|
|
61
|
+
}
|