@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
|
@@ -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;
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["className", "children", "size", "skeleton", "variant", "sticky", "stickyOffset", "fixed"];
|
|
5
|
+
var _excluded = ["className", "children", "size", "skeleton", "variant", "sticky", "stickyOffset", "fixed", "border", "outline"];
|
|
6
6
|
|
|
7
7
|
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; }
|
|
8
8
|
|
|
@@ -23,9 +23,11 @@ import Provider from '../../shared/Provider';
|
|
|
23
23
|
import { createSpacingClasses } from '../space/SpacingHelper';
|
|
24
24
|
import { createSkeletonClass } from '../skeleton/SkeletonHelper';
|
|
25
25
|
import { extendPropsWithContext, validateDOMAttributes } from '../../shared/component-helper';
|
|
26
|
+
import ScrollView from './TableScrollView';
|
|
26
27
|
import TableContext from './TableContext';
|
|
27
28
|
import { useStickyHeader, StickyHelper } from './TableStickyHeader';
|
|
28
29
|
export { StickyHelper };
|
|
30
|
+
export { ScrollView };
|
|
29
31
|
export var defaultProps = {
|
|
30
32
|
size: 'large',
|
|
31
33
|
variant: 'generic'
|
|
@@ -45,6 +47,8 @@ var Table = function Table(componentProps) {
|
|
|
45
47
|
sticky = allProps.sticky,
|
|
46
48
|
stickyOffset = allProps.stickyOffset,
|
|
47
49
|
fixed = allProps.fixed,
|
|
50
|
+
border = allProps.border,
|
|
51
|
+
outline = allProps.outline,
|
|
48
52
|
props = _objectWithoutProperties(allProps, _excluded);
|
|
49
53
|
|
|
50
54
|
var skeletonClasses = createSkeletonClass('font', skeleton, context);
|
|
@@ -73,7 +77,7 @@ var Table = function Table(componentProps) {
|
|
|
73
77
|
allProps: _objectSpread(_objectSpread({}, context.getTranslation(componentProps).Table), allProps)
|
|
74
78
|
}
|
|
75
79
|
}, React.createElement("table", _extends({
|
|
76
|
-
className: classnames('dnb-table', spacingClasses, skeletonClasses, className, variant && "dnb-table__variant--".concat(variant), size && "dnb-table__size--".concat(size), sticky && "dnb-table--sticky", fixed && "dnb-table--fixed"),
|
|
80
|
+
className: classnames('dnb-table', spacingClasses, skeletonClasses, className, variant && "dnb-table__variant--".concat(variant), size && "dnb-table__size--".concat(size), sticky && "dnb-table--sticky", fixed && "dnb-table--fixed", border && "dnb-table--border", outline && "dnb-table--outline"),
|
|
77
81
|
ref: elementRef
|
|
78
82
|
}, props), children)));
|
|
79
83
|
|
|
@@ -84,4 +88,5 @@ var Table = function Table(componentProps) {
|
|
|
84
88
|
};
|
|
85
89
|
|
|
86
90
|
export default Table;
|
|
87
|
-
Table.StickyHelper = StickyHelper;
|
|
91
|
+
Table.StickyHelper = StickyHelper;
|
|
92
|
+
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,52 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _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
|
+
var children = props.children,
|
|
14
|
+
className = props.className,
|
|
15
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
16
|
+
|
|
17
|
+
var spacingClasses = createSpacingClasses(props);
|
|
18
|
+
validateDOMAttributes(props, rest);
|
|
19
|
+
return React.createElement("section", _extends({
|
|
20
|
+
className: classnames('dnb-table__container', className, spacingClasses)
|
|
21
|
+
}, rest), React.createElement(ScrollView, null, children));
|
|
22
|
+
}
|
|
23
|
+
export function TableContainerBody(props) {
|
|
24
|
+
var children = props.children,
|
|
25
|
+
className = props.className,
|
|
26
|
+
rest = _objectWithoutProperties(props, _excluded2);
|
|
27
|
+
|
|
28
|
+
return React.createElement("div", _extends({
|
|
29
|
+
className: classnames('dnb-table__container__body', className)
|
|
30
|
+
}, rest), children);
|
|
31
|
+
}
|
|
32
|
+
export function TableContainerHead(props) {
|
|
33
|
+
var children = props.children,
|
|
34
|
+
className = props.className,
|
|
35
|
+
rest = _objectWithoutProperties(props, _excluded3);
|
|
36
|
+
|
|
37
|
+
return React.createElement("div", _extends({
|
|
38
|
+
className: classnames('dnb-table__container__head', className)
|
|
39
|
+
}, rest), children);
|
|
40
|
+
}
|
|
41
|
+
export function TableContainerFoot(props) {
|
|
42
|
+
var children = props.children,
|
|
43
|
+
className = props.className,
|
|
44
|
+
rest = _objectWithoutProperties(props, _excluded4);
|
|
45
|
+
|
|
46
|
+
return React.createElement("div", _extends({
|
|
47
|
+
className: classnames('dnb-table__container__foot', className)
|
|
48
|
+
}, rest), children);
|
|
49
|
+
}
|
|
50
|
+
TableContainer.Body = TableContainerBody;
|
|
51
|
+
TableContainer.Head = TableContainerHead;
|
|
52
|
+
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,15 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _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
|
+
var className = props.className,
|
|
9
|
+
children = props.children,
|
|
10
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
11
|
+
|
|
12
|
+
return React.createElement(ScrollView, _extends({
|
|
13
|
+
className: classnames('dnb-table__scroll-view', className)
|
|
14
|
+
}, rest), children);
|
|
15
|
+
}
|
|
@@ -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,15 +1,17 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["className", "children"];
|
|
3
|
+
var _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
|
var className = componentProps.className,
|
|
8
8
|
children = componentProps.children,
|
|
9
|
+
noSpacing = componentProps.noSpacing,
|
|
10
|
+
spacing = componentProps.spacing,
|
|
9
11
|
props = _objectWithoutProperties(componentProps, _excluded);
|
|
10
12
|
|
|
11
13
|
return React.createElement("td", _extends({
|
|
12
14
|
role: "cell",
|
|
13
|
-
className: classnames('dnb-table__td', className)
|
|
15
|
+
className: classnames('dnb-table__td', className, noSpacing && 'dnb-table__td--no-spacing', spacing && "dnb-table__td--spacing-".concat(spacing))
|
|
14
16
|
}, props), children);
|
|
15
17
|
}
|
|
@@ -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
|
-
var _excluded = ["className", "children", "sortable", "active", "reversed", "noWrap"]
|
|
3
|
+
var _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';
|
|
@@ -19,5 +20,17 @@ export default function Th(componentProps) {
|
|
|
19
20
|
className: classnames('dnb-table__th', className, sortable && 'dnb-table--sortable', active && 'dnb-table--active', reversed && 'dnb-table--reversed', noWrap && 'dnb-table--no-wrap')
|
|
20
21
|
}, props), children);
|
|
21
22
|
}
|
|
23
|
+
|
|
24
|
+
function Horizontal(_ref) {
|
|
25
|
+
var _ref$className = _ref.className,
|
|
26
|
+
className = _ref$className === void 0 ? null : _ref$className,
|
|
27
|
+
rest = _objectWithoutProperties(_ref, _excluded2);
|
|
28
|
+
|
|
29
|
+
return React.createElement("div", _extends({}, rest, {
|
|
30
|
+
className: classnames('dnb-table__th__horizontal', className)
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
|
|
22
34
|
Th.SortButton = TableSortButton;
|
|
23
|
-
Th.HelpButton = TableHelpButton;
|
|
35
|
+
Th.HelpButton = TableHelpButton;
|
|
36
|
+
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,11 +1,12 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["variant", "children", "className"];
|
|
3
|
+
var _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
|
var variant = componentProps.variant,
|
|
9
|
+
noWrap = componentProps.noWrap,
|
|
9
10
|
children = componentProps.children,
|
|
10
11
|
_className = componentProps.className,
|
|
11
12
|
props = _objectWithoutProperties(componentProps, _excluded);
|
|
@@ -15,7 +16,7 @@ export default function Tr(componentProps) {
|
|
|
15
16
|
}),
|
|
16
17
|
currentVariant = _useHandleTrVariant.currentVariant;
|
|
17
18
|
|
|
18
|
-
var className = classnames('dnb-table__tr', _className, currentVariant && "dnb-table__tr--".concat(currentVariant));
|
|
19
|
+
var className = classnames('dnb-table__tr', _className, currentVariant && "dnb-table__tr--".concat(currentVariant), noWrap && 'dnb-table--no-wrap');
|
|
19
20
|
return React.createElement("tr", _extends({
|
|
20
21
|
role: "row",
|
|
21
22
|
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
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Table component
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
.dnb-table {
|
|
7
|
+
&__sticky-helper > td {
|
|
8
|
+
display: block;
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
padding: 0 !important;
|
|
11
|
+
height: 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
tr.sticky th {
|
|
15
|
+
position: sticky;
|
|
16
|
+
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;
|
|
27
|
+
|
|
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);
|
|
32
|
+
|
|
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;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Table component
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
@import './_table-header-buttons.scss';
|
|
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
|
+
.dnb-table {
|
|
21
|
+
& > tr > td,
|
|
22
|
+
& > tbody > tr > td,
|
|
23
|
+
&__td,
|
|
24
|
+
& > tr > th[scope='row'] {
|
|
25
|
+
padding: var(--spacing-small);
|
|
26
|
+
padding-top: calc(var(--spacing-small) * 1.25); // 20px
|
|
27
|
+
padding-bottom: calc(var(--spacing-small) * 1.25); // 20px
|
|
28
|
+
|
|
29
|
+
color: var(--theme-color-black-80, currentColor);
|
|
30
|
+
|
|
31
|
+
vertical-align: baseline;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// table border
|
|
35
|
+
--border: 0.0625rem solid var(--color-black-8);
|
|
36
|
+
&--border tbody &__td {
|
|
37
|
+
z-index: 2; // ensure border is behind content
|
|
38
|
+
|
|
39
|
+
&::after {
|
|
40
|
+
@include tableBorder();
|
|
41
|
+
|
|
42
|
+
border: var(--border);
|
|
43
|
+
border-right: none;
|
|
44
|
+
border-bottom: none;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&:first-of-type::after {
|
|
48
|
+
border-left: none;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
&:not(#{&}--outline) tbody &__tr:last-of-type &__td::after {
|
|
52
|
+
border-bottom: var(--border);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// table outline
|
|
56
|
+
--outline: 0.0625rem solid var(--color-black-8);
|
|
57
|
+
&--outline thead &__th {
|
|
58
|
+
z-index: 2; // ensure border is behind content
|
|
59
|
+
|
|
60
|
+
&::after {
|
|
61
|
+
@include tableBorder();
|
|
62
|
+
|
|
63
|
+
border-top: var(--outline);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&:first-of-type::after {
|
|
67
|
+
border-left: var(--outline);
|
|
68
|
+
}
|
|
69
|
+
&:last-of-type::after {
|
|
70
|
+
border-right: var(--outline);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
&--outline tbody &__td {
|
|
74
|
+
z-index: 2; // ensure border is behind content
|
|
75
|
+
|
|
76
|
+
&:first-of-type::after,
|
|
77
|
+
&:last-of-type::after {
|
|
78
|
+
@include tableBorder();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&:first-of-type::after {
|
|
82
|
+
border-left: var(--outline);
|
|
83
|
+
}
|
|
84
|
+
&:last-of-type::after {
|
|
85
|
+
border-right: var(--outline);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
&--outline tbody &__tr:last-of-type &__td {
|
|
89
|
+
z-index: 2; // ensure border is behind content
|
|
90
|
+
|
|
91
|
+
&::after {
|
|
92
|
+
@include tableBorder();
|
|
93
|
+
|
|
94
|
+
border-bottom: var(--outline);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
&--outline thead &__th:first-of-type {
|
|
98
|
+
&,
|
|
99
|
+
&::after {
|
|
100
|
+
border-radius: 0.5rem 0 0 0;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
&--outline thead &__th:last-of-type {
|
|
104
|
+
&,
|
|
105
|
+
&::after {
|
|
106
|
+
border-radius: 0 0.5rem 0 0;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
&--outline tbody &__tr:last-of-type &__td:first-of-type {
|
|
110
|
+
&,
|
|
111
|
+
&::after {
|
|
112
|
+
border-radius: 0 0 0 0.5rem;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
&--outline tbody &__tr:last-of-type &__td:last-of-type {
|
|
116
|
+
&,
|
|
117
|
+
&::after {
|
|
118
|
+
border-radius: 0 0 0.5rem 0;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// spacing
|
|
123
|
+
&__td--no-spacing,
|
|
124
|
+
td#{&}__td--no-spacing {
|
|
125
|
+
padding: 0;
|
|
126
|
+
}
|
|
127
|
+
&__td--spacing-horizontal,
|
|
128
|
+
td#{&}__td--spacing-horizontal {
|
|
129
|
+
padding-top: 0;
|
|
130
|
+
padding-bottom: 0;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Table component
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
@import './_table-header-buttons.scss';
|
|
7
|
+
|
|
8
|
+
.dnb-table {
|
|
9
|
+
& > tr > th,
|
|
10
|
+
& > thead > tr > th,
|
|
11
|
+
&__th {
|
|
12
|
+
padding: var(--spacing-x-large) var(--spacing-small)
|
|
13
|
+
var(--spacing-x-small);
|
|
14
|
+
|
|
15
|
+
font-weight: var(--font-weight-medium);
|
|
16
|
+
color: var(--color-black);
|
|
17
|
+
|
|
18
|
+
vertical-align: bottom;
|
|
19
|
+
|
|
20
|
+
&:not([align]) {
|
|
21
|
+
text-align: inherit;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@include IS_FF {
|
|
25
|
+
// to get the perfect height of pixles, to this:
|
|
26
|
+
padding-bottom: calc(var(--spacing-x-small) - 0.5px);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
background-color: var(--color-white);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&__th__horizontal {
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: flex-end; // bottom align help-button or other additional elements
|
|
35
|
+
}
|
|
36
|
+
}
|