@dbcdk/react-components 0.0.106 → 0.0.107
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/dist/components/card/Card.module.css +2 -0
- package/dist/components/circle/Circle.cjs +7 -1
- package/dist/components/circle/Circle.d.ts +2 -1
- package/dist/components/circle/Circle.js +7 -1
- package/dist/components/forms/input/Input.cjs +2 -1
- package/dist/components/forms/input/Input.js +2 -1
- package/dist/components/forms/text-area/Textarea.cjs +2 -0
- package/dist/components/forms/text-area/Textarea.js +2 -0
- package/dist/components/headline/Headline.module.css +3 -1
- package/dist/components/metric-tile/MetricTile.cjs +26 -0
- package/dist/components/metric-tile/MetricTile.d.ts +13 -0
- package/dist/components/metric-tile/MetricTile.js +20 -0
- package/dist/components/metric-tile/MetricTile.module.css +95 -0
- package/dist/components/pagination/Pagination.cjs +3 -2
- package/dist/components/pagination/Pagination.d.ts +2 -1
- package/dist/components/pagination/Pagination.js +3 -2
- package/dist/components/table/Table.cjs +5 -1
- package/dist/components/table/Table.d.ts +1 -1
- package/dist/components/table/Table.js +5 -1
- package/dist/components/table/Table.module.css +58 -17
- package/dist/components/table/Table.types.d.ts +2 -0
- package/dist/components/table/TanstackTable.cjs +11 -1
- package/dist/components/table/TanstackTable.js +11 -1
- package/dist/components/table/tanstackTable.utils.cjs +9 -2
- package/dist/components/table/tanstackTable.utils.js +9 -2
- package/dist/index.cjs +7 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var Tooltip = require('../../components/overlay/tooltip/Tooltip');
|
|
4
5
|
var styles = require('./Circle.module.css');
|
|
5
6
|
|
|
6
7
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -10,12 +11,13 @@ var styles__default = /*#__PURE__*/_interopDefault(styles);
|
|
|
10
11
|
function Circle({
|
|
11
12
|
severity,
|
|
12
13
|
children,
|
|
14
|
+
tooltip,
|
|
13
15
|
glow,
|
|
14
16
|
muted,
|
|
15
17
|
pulse,
|
|
16
18
|
size = "sm"
|
|
17
19
|
}) {
|
|
18
|
-
|
|
20
|
+
const inner = /* @__PURE__ */ jsxRuntime.jsxs("span", { className: styles__default.default.container, "data-size": size, children: [
|
|
19
21
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
20
22
|
"span",
|
|
21
23
|
{
|
|
@@ -28,6 +30,10 @@ function Circle({
|
|
|
28
30
|
),
|
|
29
31
|
children
|
|
30
32
|
] });
|
|
33
|
+
if (tooltip) {
|
|
34
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Tooltip.Tooltip, { content: tooltip, children: inner });
|
|
35
|
+
}
|
|
36
|
+
return inner;
|
|
31
37
|
}
|
|
32
38
|
|
|
33
39
|
exports.Circle = Circle;
|
|
@@ -4,10 +4,11 @@ type CircleSize = '2xs' | 'xs' | 'sm' | 'md' | 'lg';
|
|
|
4
4
|
interface CircleProps {
|
|
5
5
|
severity: Severity;
|
|
6
6
|
children?: ReactNode;
|
|
7
|
+
tooltip?: ReactNode;
|
|
7
8
|
glow?: boolean;
|
|
8
9
|
muted?: boolean;
|
|
9
10
|
pulse?: boolean;
|
|
10
11
|
size?: CircleSize;
|
|
11
12
|
}
|
|
12
|
-
export declare function Circle({ severity, children, glow, muted, pulse, size, }: CircleProps): JSX.Element;
|
|
13
|
+
export declare function Circle({ severity, children, tooltip, glow, muted, pulse, size, }: CircleProps): JSX.Element;
|
|
13
14
|
export {};
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Tooltip } from '../../components/overlay/tooltip/Tooltip';
|
|
2
3
|
import styles from './Circle.module.css';
|
|
3
4
|
|
|
4
5
|
function Circle({
|
|
5
6
|
severity,
|
|
6
7
|
children,
|
|
8
|
+
tooltip,
|
|
7
9
|
glow,
|
|
8
10
|
muted,
|
|
9
11
|
pulse,
|
|
10
12
|
size = "sm"
|
|
11
13
|
}) {
|
|
12
|
-
|
|
14
|
+
const inner = /* @__PURE__ */ jsxs("span", { className: styles.container, "data-size": size, children: [
|
|
13
15
|
/* @__PURE__ */ jsx(
|
|
14
16
|
"span",
|
|
15
17
|
{
|
|
@@ -22,6 +24,10 @@ function Circle({
|
|
|
22
24
|
),
|
|
23
25
|
children
|
|
24
26
|
] });
|
|
27
|
+
if (tooltip) {
|
|
28
|
+
return /* @__PURE__ */ jsx(Tooltip, { content: tooltip, children: inner });
|
|
29
|
+
}
|
|
30
|
+
return inner;
|
|
25
31
|
}
|
|
26
32
|
|
|
27
33
|
export { Circle };
|
|
@@ -24,6 +24,7 @@ function mergeRefs(...refs) {
|
|
|
24
24
|
}
|
|
25
25
|
const Input = react.forwardRef(function Input2({
|
|
26
26
|
label,
|
|
27
|
+
labelAction,
|
|
27
28
|
error,
|
|
28
29
|
helpText,
|
|
29
30
|
orientation = "vertical",
|
|
@@ -90,7 +91,7 @@ const Input = react.forwardRef(function Input2({
|
|
|
90
91
|
InputContainer.InputContainer,
|
|
91
92
|
{
|
|
92
93
|
label,
|
|
93
|
-
labelAction
|
|
94
|
+
labelAction,
|
|
94
95
|
htmlFor: inputId,
|
|
95
96
|
fullWidth,
|
|
96
97
|
error,
|
|
@@ -18,6 +18,7 @@ function mergeRefs(...refs) {
|
|
|
18
18
|
}
|
|
19
19
|
const Input = forwardRef(function Input2({
|
|
20
20
|
label,
|
|
21
|
+
labelAction,
|
|
21
22
|
error,
|
|
22
23
|
helpText,
|
|
23
24
|
orientation = "vertical",
|
|
@@ -84,7 +85,7 @@ const Input = forwardRef(function Input2({
|
|
|
84
85
|
InputContainer,
|
|
85
86
|
{
|
|
86
87
|
label,
|
|
87
|
-
labelAction
|
|
88
|
+
labelAction,
|
|
88
89
|
htmlFor: inputId,
|
|
89
90
|
fullWidth,
|
|
90
91
|
error,
|
|
@@ -32,6 +32,7 @@ const Textarea = function Textarea2({
|
|
|
32
32
|
labelWidth = "160px",
|
|
33
33
|
fullWidth = false,
|
|
34
34
|
required,
|
|
35
|
+
labelAction,
|
|
35
36
|
// Native textarea props
|
|
36
37
|
className,
|
|
37
38
|
...rest
|
|
@@ -101,6 +102,7 @@ const Textarea = function Textarea2({
|
|
|
101
102
|
labelWidth,
|
|
102
103
|
fullWidth,
|
|
103
104
|
required,
|
|
105
|
+
labelAction,
|
|
104
106
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
105
107
|
"div",
|
|
106
108
|
{
|
|
@@ -26,6 +26,7 @@ const Textarea = function Textarea2({
|
|
|
26
26
|
labelWidth = "160px",
|
|
27
27
|
fullWidth = false,
|
|
28
28
|
required,
|
|
29
|
+
labelAction,
|
|
29
30
|
// Native textarea props
|
|
30
31
|
className,
|
|
31
32
|
...rest
|
|
@@ -95,6 +96,7 @@ const Textarea = function Textarea2({
|
|
|
95
96
|
labelWidth,
|
|
96
97
|
fullWidth,
|
|
97
98
|
required,
|
|
99
|
+
labelAction,
|
|
98
100
|
children: /* @__PURE__ */ jsx(
|
|
99
101
|
"div",
|
|
100
102
|
{
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
.headlineContainer {
|
|
2
2
|
display: flex;
|
|
3
|
+
flex: 1 1 auto;
|
|
3
4
|
align-items: flex-start;
|
|
4
5
|
gap: var(--spacing-lg);
|
|
5
6
|
max-width: 100%;
|
|
@@ -25,6 +26,7 @@
|
|
|
25
26
|
.headline {
|
|
26
27
|
position: relative;
|
|
27
28
|
display: inline-flex;
|
|
29
|
+
flex: 1 1 auto;
|
|
28
30
|
align-items: center;
|
|
29
31
|
gap: var(--spacing-xs);
|
|
30
32
|
margin-block: var(--spacing-xs);
|
|
@@ -131,7 +133,7 @@
|
|
|
131
133
|
|
|
132
134
|
.addition {
|
|
133
135
|
display: flex;
|
|
134
|
-
flex:
|
|
136
|
+
flex: 0 0 auto;
|
|
135
137
|
min-width: 0;
|
|
136
138
|
align-items: center;
|
|
137
139
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var client = require('../../client');
|
|
5
|
+
var styles = require('./MetricTile.module.css');
|
|
6
|
+
|
|
7
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
|
+
|
|
9
|
+
var styles__default = /*#__PURE__*/_interopDefault(styles);
|
|
10
|
+
|
|
11
|
+
function MetricTile({
|
|
12
|
+
severity,
|
|
13
|
+
label,
|
|
14
|
+
value,
|
|
15
|
+
tooltip,
|
|
16
|
+
size = "md",
|
|
17
|
+
width
|
|
18
|
+
}) {
|
|
19
|
+
const style = width != null ? { width: typeof width === "number" ? `${width}px` : width } : void 0;
|
|
20
|
+
return /* @__PURE__ */ jsxRuntime.jsx(client.Tooltip, { content: tooltip, placement: "bottom", children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: styles__default.default.tile, "data-severity": severity, "data-size": size, style, children: [
|
|
21
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.label, children: label }),
|
|
22
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.value, children: value })
|
|
23
|
+
] }) });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
exports.MetricTile = MetricTile;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ReactNode, JSX } from 'react';
|
|
2
|
+
import { Severity } from '../../constants/severity.types';
|
|
3
|
+
type MetricTileSize = 'sm' | 'md' | 'lg';
|
|
4
|
+
interface MetricTileProps {
|
|
5
|
+
severity: Severity;
|
|
6
|
+
label: string;
|
|
7
|
+
value: string | number;
|
|
8
|
+
tooltip?: ReactNode;
|
|
9
|
+
size?: MetricTileSize;
|
|
10
|
+
width?: number | string;
|
|
11
|
+
}
|
|
12
|
+
export declare function MetricTile({ severity, label, value, tooltip, size, width, }: MetricTileProps): JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { Tooltip } from '../../client';
|
|
3
|
+
import styles from './MetricTile.module.css';
|
|
4
|
+
|
|
5
|
+
function MetricTile({
|
|
6
|
+
severity,
|
|
7
|
+
label,
|
|
8
|
+
value,
|
|
9
|
+
tooltip,
|
|
10
|
+
size = "md",
|
|
11
|
+
width
|
|
12
|
+
}) {
|
|
13
|
+
const style = width != null ? { width: typeof width === "number" ? `${width}px` : width } : void 0;
|
|
14
|
+
return /* @__PURE__ */ jsx(Tooltip, { content: tooltip, placement: "bottom", children: /* @__PURE__ */ jsxs("span", { className: styles.tile, "data-severity": severity, "data-size": size, style, children: [
|
|
15
|
+
/* @__PURE__ */ jsx("span", { className: styles.label, children: label }),
|
|
16
|
+
/* @__PURE__ */ jsx("span", { className: styles.value, children: value })
|
|
17
|
+
] }) });
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { MetricTile };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
.tile {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
gap: var(--spacing-2xs);
|
|
7
|
+
padding: var(--spacing-sm) var(--spacing-md);
|
|
8
|
+
min-width: 72px;
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
border-radius: var(--border-radius-md);
|
|
12
|
+
font-family: var(--font-family);
|
|
13
|
+
cursor: default;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.tile[data-size='sm'] {
|
|
17
|
+
padding: var(--spacing-xs) var(--spacing-sm);
|
|
18
|
+
min-width: 56px;
|
|
19
|
+
border-radius: var(--border-radius-sm);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.tile[data-size='lg'] {
|
|
23
|
+
padding: var(--spacing-md) var(--spacing-lg);
|
|
24
|
+
min-width: 96px;
|
|
25
|
+
border-radius: var(--border-radius-lg);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.tile[data-severity='success'] {
|
|
29
|
+
background-color: var(--color-status-success-bg);
|
|
30
|
+
color: var(--color-status-success-fg);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.tile[data-severity='error'] {
|
|
34
|
+
background-color: var(--color-status-error-bg);
|
|
35
|
+
color: var(--color-status-error-fg);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.tile[data-severity='warning'] {
|
|
39
|
+
background-color: var(--color-status-warning-bg);
|
|
40
|
+
color: var(--color-status-warning-fg);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.tile[data-severity='info'] {
|
|
44
|
+
background-color: var(--color-status-info-bg);
|
|
45
|
+
color: var(--color-status-info-fg);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.tile[data-severity='neutral'] {
|
|
49
|
+
background-color: var(--color-bg-toolbar);
|
|
50
|
+
color: var(--color-fg-default);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.tile[data-severity='brand'] {
|
|
54
|
+
background-color: var(--color-brand);
|
|
55
|
+
color: var(--color-fg-on-brand);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.label {
|
|
59
|
+
font-size: var(--font-size-xs);
|
|
60
|
+
font-weight: var(--font-weight-medium);
|
|
61
|
+
text-transform: uppercase;
|
|
62
|
+
letter-spacing: var(--letter-spacing-wide);
|
|
63
|
+
line-height: 1;
|
|
64
|
+
opacity: 0.85;
|
|
65
|
+
max-width: 100%;
|
|
66
|
+
overflow: hidden;
|
|
67
|
+
white-space: nowrap;
|
|
68
|
+
text-overflow: ellipsis;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.value {
|
|
72
|
+
font-size: var(--font-size-lg);
|
|
73
|
+
font-weight: var(--font-weight-bold);
|
|
74
|
+
line-height: 1;
|
|
75
|
+
max-width: 100%;
|
|
76
|
+
overflow: hidden;
|
|
77
|
+
white-space: nowrap;
|
|
78
|
+
text-overflow: ellipsis;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.tile[data-size='sm'] .label {
|
|
82
|
+
font-size: var(--font-size-sm);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.tile[data-size='sm'] .value {
|
|
86
|
+
font-size: var(--font-size-sm);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.tile[data-size='lg'] .label {
|
|
90
|
+
font-size: var(--font-size-sm);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.tile[data-size='lg'] .value {
|
|
94
|
+
font-size: var(--font-size-xl);
|
|
95
|
+
}
|
|
@@ -22,7 +22,8 @@ function Pagination({
|
|
|
22
22
|
onPageChange,
|
|
23
23
|
pageSizeOptions = DEFAULT_PAGE_SIZE_OPTIONS,
|
|
24
24
|
showFirstLast = true,
|
|
25
|
-
showGoToPage = true
|
|
25
|
+
showGoToPage = true,
|
|
26
|
+
showPageSize = true
|
|
26
27
|
}) {
|
|
27
28
|
const popoverRef = react.useRef(null);
|
|
28
29
|
const pageSizeRef = react.useRef(null);
|
|
@@ -131,7 +132,7 @@ function Pagination({
|
|
|
131
132
|
) }, page)) })
|
|
132
133
|
}
|
|
133
134
|
),
|
|
134
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
135
|
+
showPageSize && /* @__PURE__ */ jsxRuntime.jsx(
|
|
135
136
|
Popover.Popover,
|
|
136
137
|
{
|
|
137
138
|
ref: pageSizeRef,
|
|
@@ -15,6 +15,7 @@ interface PaginationProps {
|
|
|
15
15
|
pageSizeOptions?: number[];
|
|
16
16
|
showFirstLast?: boolean;
|
|
17
17
|
showGoToPage?: boolean;
|
|
18
|
+
showPageSize?: boolean;
|
|
18
19
|
}
|
|
19
|
-
export declare function Pagination({ itemsCount, skip, take, onPageChange, pageSizeOptions, showFirstLast, showGoToPage, }: PaginationProps): ReactNode;
|
|
20
|
+
export declare function Pagination({ itemsCount, skip, take, onPageChange, pageSizeOptions, showFirstLast, showGoToPage, showPageSize, }: PaginationProps): ReactNode;
|
|
20
21
|
export {};
|
|
@@ -16,7 +16,8 @@ function Pagination({
|
|
|
16
16
|
onPageChange,
|
|
17
17
|
pageSizeOptions = DEFAULT_PAGE_SIZE_OPTIONS,
|
|
18
18
|
showFirstLast = true,
|
|
19
|
-
showGoToPage = true
|
|
19
|
+
showGoToPage = true,
|
|
20
|
+
showPageSize = true
|
|
20
21
|
}) {
|
|
21
22
|
const popoverRef = useRef(null);
|
|
22
23
|
const pageSizeRef = useRef(null);
|
|
@@ -125,7 +126,7 @@ function Pagination({
|
|
|
125
126
|
) }, page)) })
|
|
126
127
|
}
|
|
127
128
|
),
|
|
128
|
-
/* @__PURE__ */ jsx(
|
|
129
|
+
showPageSize && /* @__PURE__ */ jsx(
|
|
129
130
|
Popover,
|
|
130
131
|
{
|
|
131
132
|
ref: pageSizeRef,
|
|
@@ -46,6 +46,8 @@ function Table({
|
|
|
46
46
|
totalItemsCount,
|
|
47
47
|
paginationPlacement = "bottom",
|
|
48
48
|
showFirstLast = false,
|
|
49
|
+
showGoToPage,
|
|
50
|
+
showPageSize,
|
|
49
51
|
pageSizeOptions,
|
|
50
52
|
getRowSeverity,
|
|
51
53
|
onRowClick,
|
|
@@ -116,6 +118,8 @@ function Table({
|
|
|
116
118
|
skip,
|
|
117
119
|
onPageChange: handlePageChange,
|
|
118
120
|
showFirstLast,
|
|
121
|
+
showGoToPage,
|
|
122
|
+
showPageSize,
|
|
119
123
|
pageSizeOptions
|
|
120
124
|
}
|
|
121
125
|
)
|
|
@@ -199,7 +203,7 @@ function Table({
|
|
|
199
203
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
200
204
|
"div",
|
|
201
205
|
{
|
|
202
|
-
className: "dbc-flex dbc-flex-column dbc-gap-md",
|
|
206
|
+
className: "dbc-flex dbc-flex-column dbc-gap-md dbc-flex-grow",
|
|
203
207
|
style: {
|
|
204
208
|
flexFlow: paginationPlacement === "top" ? "column-reverse" : "column",
|
|
205
209
|
position: "relative"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { JSX } from 'react';
|
|
2
2
|
import type { TableProps } from './Table.types';
|
|
3
|
-
export declare function Table<T extends Record<string, any>>({ data, dataKey, columns, selectedRows, selectionMode, allRowsSelected, sortById, sortDirection, loading, emptyConfig, variant, size, viewMode, striped, fillViewport, fillViewportBottomOffset, containScrolling, stickyHeader, tableWidth, tableRootRef, measuringLayout, toolbar, headerExtras, take, skip, totalItemsCount, paginationPlacement, showFirstLast, pageSizeOptions, getRowSeverity, onRowClick, onRowMouseEnter, onRowSelect, onSelectAllRows, onSortChange, onPageChange, ...rest }: TableProps<T>): JSX.Element;
|
|
3
|
+
export declare function Table<T extends Record<string, any>>({ data, dataKey, columns, selectedRows, selectionMode, allRowsSelected, sortById, sortDirection, loading, emptyConfig, variant, size, viewMode, striped, fillViewport, fillViewportBottomOffset, containScrolling, stickyHeader, tableWidth, tableRootRef, measuringLayout, toolbar, headerExtras, take, skip, totalItemsCount, paginationPlacement, showFirstLast, showGoToPage, showPageSize, pageSizeOptions, getRowSeverity, onRowClick, onRowMouseEnter, onRowSelect, onSelectAllRows, onSortChange, onPageChange, ...rest }: TableProps<T>): JSX.Element;
|
|
4
4
|
export type { ColumnItem } from './Table.types';
|
|
@@ -40,6 +40,8 @@ function Table({
|
|
|
40
40
|
totalItemsCount,
|
|
41
41
|
paginationPlacement = "bottom",
|
|
42
42
|
showFirstLast = false,
|
|
43
|
+
showGoToPage,
|
|
44
|
+
showPageSize,
|
|
43
45
|
pageSizeOptions,
|
|
44
46
|
getRowSeverity,
|
|
45
47
|
onRowClick,
|
|
@@ -110,6 +112,8 @@ function Table({
|
|
|
110
112
|
skip,
|
|
111
113
|
onPageChange: handlePageChange,
|
|
112
114
|
showFirstLast,
|
|
115
|
+
showGoToPage,
|
|
116
|
+
showPageSize,
|
|
113
117
|
pageSizeOptions
|
|
114
118
|
}
|
|
115
119
|
)
|
|
@@ -193,7 +197,7 @@ function Table({
|
|
|
193
197
|
return /* @__PURE__ */ jsxs(
|
|
194
198
|
"div",
|
|
195
199
|
{
|
|
196
|
-
className: "dbc-flex dbc-flex-column dbc-gap-md",
|
|
200
|
+
className: "dbc-flex dbc-flex-column dbc-gap-md dbc-flex-grow",
|
|
197
201
|
style: {
|
|
198
202
|
flexFlow: paginationPlacement === "top" ? "column-reverse" : "column",
|
|
199
203
|
position: "relative"
|
|
@@ -46,6 +46,19 @@
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
.tableRoot {
|
|
49
|
+
--table-component-header-bg: var(--table-header-bg);
|
|
50
|
+
--table-component-header-fg: var(--table-header-fg);
|
|
51
|
+
--table-component-header-border: var(--table-border-header);
|
|
52
|
+
--table-component-header-font-weight: var(--font-weight-medium);
|
|
53
|
+
--table-component-row-bg: var(--table-row-bg);
|
|
54
|
+
--table-component-row-bg-alt: var(--table-row-bg-alt);
|
|
55
|
+
--table-component-row-bg-hover: var(--table-row-bg-hover);
|
|
56
|
+
--table-component-row-bg-selected: var(--table-row-bg-selected);
|
|
57
|
+
--table-component-row-bg-selected-hover: var(--table-row-bg-selected-hover);
|
|
58
|
+
--table-component-cell-fg: var(--table-cell-fg);
|
|
59
|
+
--table-component-cell-border: var(--table-border-subtle);
|
|
60
|
+
--table-component-divider: var(--table-divider);
|
|
61
|
+
|
|
49
62
|
display: flex;
|
|
50
63
|
flex-direction: column;
|
|
51
64
|
flex: 1 1 auto;
|
|
@@ -55,6 +68,35 @@
|
|
|
55
68
|
max-inline-size: 100%;
|
|
56
69
|
}
|
|
57
70
|
|
|
71
|
+
.primary {
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.embedded {
|
|
75
|
+
--table-component-header-bg: transparent;
|
|
76
|
+
--table-component-header-fg: var(--color-fg-subtle);
|
|
77
|
+
--table-component-header-border: transparent;
|
|
78
|
+
--table-component-header-font-weight: var(--font-weight-default);
|
|
79
|
+
--table-component-row-bg: transparent;
|
|
80
|
+
--table-component-row-bg-alt: color-mix(
|
|
81
|
+
in srgb,
|
|
82
|
+
var(--color-bg-contextual-subtle) 55%,
|
|
83
|
+
transparent
|
|
84
|
+
);
|
|
85
|
+
--table-component-row-bg-hover: var(--color-bg-contextual-subtle);
|
|
86
|
+
--table-component-row-bg-selected: color-mix(
|
|
87
|
+
in srgb,
|
|
88
|
+
var(--color-bg-selected) 55%,
|
|
89
|
+
transparent
|
|
90
|
+
);
|
|
91
|
+
--table-component-row-bg-selected-hover: color-mix(
|
|
92
|
+
in srgb,
|
|
93
|
+
var(--color-bg-selected-hover) 60%,
|
|
94
|
+
transparent
|
|
95
|
+
);
|
|
96
|
+
--table-component-cell-border: color-mix(in srgb, var(--table-border-subtle) 65%, transparent);
|
|
97
|
+
--table-component-divider: color-mix(in srgb, var(--table-divider) 75%, transparent);
|
|
98
|
+
}
|
|
99
|
+
|
|
58
100
|
.measuringLayout {
|
|
59
101
|
visibility: hidden;
|
|
60
102
|
}
|
|
@@ -64,20 +106,19 @@
|
|
|
64
106
|
min-block-size: 0;
|
|
65
107
|
min-inline-size: 0;
|
|
66
108
|
overflow: auto;
|
|
67
|
-
background: var(--table-row-bg);
|
|
109
|
+
background: var(--table-component-row-bg);
|
|
68
110
|
-webkit-overflow-scrolling: touch;
|
|
69
111
|
}
|
|
70
112
|
|
|
71
113
|
.tableElement {
|
|
72
114
|
inline-size: 100%;
|
|
73
|
-
min-inline-size: 100%;
|
|
74
115
|
border-collapse: separate;
|
|
75
116
|
border-spacing: 0;
|
|
76
117
|
table-layout: fixed;
|
|
77
118
|
font-family: var(--font-family);
|
|
78
119
|
font-size: var(--font-size-sm);
|
|
79
|
-
color: var(--table-cell-fg);
|
|
80
|
-
background: var(--table-row-bg);
|
|
120
|
+
color: var(--table-component-cell-fg);
|
|
121
|
+
background: var(--table-component-row-bg);
|
|
81
122
|
}
|
|
82
123
|
|
|
83
124
|
.header {
|
|
@@ -102,7 +143,7 @@
|
|
|
102
143
|
}
|
|
103
144
|
|
|
104
145
|
.body .row:first-child .cell {
|
|
105
|
-
border-block-start: var(--spacing-xs) solid var(--table-row-bg);
|
|
146
|
+
border-block-start: var(--spacing-xs) solid var(--table-component-row-bg);
|
|
106
147
|
}
|
|
107
148
|
|
|
108
149
|
.headerCell,
|
|
@@ -116,15 +157,15 @@
|
|
|
116
157
|
|
|
117
158
|
.headerCell {
|
|
118
159
|
vertical-align: middle;
|
|
119
|
-
background-color: var(--table-header-bg);
|
|
120
|
-
border-block-end: 1px solid var(--table-
|
|
160
|
+
background-color: var(--table-component-header-bg);
|
|
161
|
+
border-block-end: 1px solid var(--table-component-header-border);
|
|
121
162
|
padding-block: var(--spacing-xxs);
|
|
122
163
|
padding-inline: var(--spacing-sm);
|
|
123
164
|
font-size: var(--font-size-xs);
|
|
124
|
-
font-weight: var(--font-weight
|
|
165
|
+
font-weight: var(--table-component-header-font-weight);
|
|
125
166
|
letter-spacing: var(--letter-spacing-wide);
|
|
126
167
|
text-transform: uppercase;
|
|
127
|
-
color: var(--table-header-fg);
|
|
168
|
+
color: var(--table-component-header-fg);
|
|
128
169
|
white-space: nowrap;
|
|
129
170
|
}
|
|
130
171
|
|
|
@@ -137,8 +178,8 @@
|
|
|
137
178
|
.cell {
|
|
138
179
|
padding-block: 6px;
|
|
139
180
|
padding-inline: var(--spacing-sm);
|
|
140
|
-
border-block-end: 1px solid var(--table-border
|
|
141
|
-
background: var(--table-row-bg);
|
|
181
|
+
border-block-end: 1px solid var(--table-component-cell-border);
|
|
182
|
+
background: var(--table-component-row-bg);
|
|
142
183
|
overflow: hidden;
|
|
143
184
|
line-height: 20px;
|
|
144
185
|
}
|
|
@@ -242,19 +283,19 @@
|
|
|
242
283
|
}
|
|
243
284
|
|
|
244
285
|
.row:hover > .cell {
|
|
245
|
-
background-color: var(--table-row-bg-hover);
|
|
286
|
+
background-color: var(--table-component-row-bg-hover);
|
|
246
287
|
}
|
|
247
288
|
|
|
248
289
|
.selectedRow > .cell {
|
|
249
|
-
background-color: var(--table-row-bg-selected);
|
|
290
|
+
background-color: var(--table-component-row-bg-selected);
|
|
250
291
|
}
|
|
251
292
|
|
|
252
293
|
.selectedRow:hover > .cell {
|
|
253
|
-
background-color: var(--table-row-bg-selected-hover);
|
|
294
|
+
background-color: var(--table-component-row-bg-selected-hover);
|
|
254
295
|
}
|
|
255
296
|
|
|
256
297
|
.striped > .row:nth-child(even):not(.selectedRow):not(:hover) > .cell {
|
|
257
|
-
background-color: var(--table-row-bg-alt);
|
|
298
|
+
background-color: var(--table-component-row-bg-alt);
|
|
258
299
|
}
|
|
259
300
|
|
|
260
301
|
.row:focus-within > .cell {
|
|
@@ -520,7 +561,7 @@
|
|
|
520
561
|
top: 8px;
|
|
521
562
|
bottom: 8px;
|
|
522
563
|
width: 1px;
|
|
523
|
-
background: var(--table-divider);
|
|
564
|
+
background: var(--table-component-divider);
|
|
524
565
|
}
|
|
525
566
|
|
|
526
567
|
.dividerRight::after {
|
|
@@ -530,5 +571,5 @@
|
|
|
530
571
|
top: 8px;
|
|
531
572
|
bottom: 8px;
|
|
532
573
|
width: 1px;
|
|
533
|
-
background: var(--table-divider);
|
|
574
|
+
background: var(--table-component-divider);
|
|
534
575
|
}
|
|
@@ -56,6 +56,8 @@ export type TableProps<T extends Record<string, any>> = Omit<HTMLAttributes<HTML
|
|
|
56
56
|
totalItemsCount?: number;
|
|
57
57
|
paginationPlacement?: 'top' | 'bottom';
|
|
58
58
|
showFirstLast?: boolean;
|
|
59
|
+
showGoToPage?: boolean;
|
|
60
|
+
showPageSize?: boolean;
|
|
59
61
|
pageSizeOptions?: number[];
|
|
60
62
|
getRowSeverity?: (row: T) => Severity | undefined;
|
|
61
63
|
onRowClick?: (row: T) => void;
|
|
@@ -97,7 +97,17 @@ function TanstackTable(props) {
|
|
|
97
97
|
window.addEventListener("resize", updateWidth);
|
|
98
98
|
return () => window.removeEventListener("resize", updateWidth);
|
|
99
99
|
}
|
|
100
|
-
const observer = new ResizeObserver(() =>
|
|
100
|
+
const observer = new ResizeObserver((entries) => {
|
|
101
|
+
var _a, _b, _c;
|
|
102
|
+
const entry = entries[0];
|
|
103
|
+
if (!entry) {
|
|
104
|
+
updateWidth();
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const contentWidth = (_c = (_b = (_a = entry.contentBoxSize) == null ? void 0 : _a[0]) == null ? void 0 : _b.inlineSize) != null ? _c : entry.contentRect.width;
|
|
108
|
+
const next = Math.floor(contentWidth);
|
|
109
|
+
setAvailableWidth(next > 0 ? next : void 0);
|
|
110
|
+
});
|
|
101
111
|
observer.observe(el);
|
|
102
112
|
return () => observer.disconnect();
|
|
103
113
|
}, []);
|
|
@@ -72,7 +72,17 @@ function TanstackTable(props) {
|
|
|
72
72
|
window.addEventListener("resize", updateWidth);
|
|
73
73
|
return () => window.removeEventListener("resize", updateWidth);
|
|
74
74
|
}
|
|
75
|
-
const observer = new ResizeObserver(() =>
|
|
75
|
+
const observer = new ResizeObserver((entries) => {
|
|
76
|
+
var _a, _b, _c;
|
|
77
|
+
const entry = entries[0];
|
|
78
|
+
if (!entry) {
|
|
79
|
+
updateWidth();
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const contentWidth = (_c = (_b = (_a = entry.contentBoxSize) == null ? void 0 : _a[0]) == null ? void 0 : _b.inlineSize) != null ? _c : entry.contentRect.width;
|
|
83
|
+
const next = Math.floor(contentWidth);
|
|
84
|
+
setAvailableWidth(next > 0 ? next : void 0);
|
|
85
|
+
});
|
|
76
86
|
observer.observe(el);
|
|
77
87
|
return () => observer.disconnect();
|
|
78
88
|
}, []);
|
|
@@ -148,9 +148,16 @@ function buildDistributedColumnWidths(args) {
|
|
|
148
148
|
active = nextActive;
|
|
149
149
|
}
|
|
150
150
|
const floatTrackTotal = tracks.reduce((sum, track) => sum + track.width, 0);
|
|
151
|
-
const
|
|
151
|
+
const maxTrackWidth = availableWidth - selectionWidth;
|
|
152
|
+
const targetTrackWidth = Math.min(
|
|
153
|
+
floatTrackTotal <= maxTrackWidth ? Math.floor(floatTrackTotal) : Math.ceil(floatTrackTotal),
|
|
154
|
+
maxTrackWidth
|
|
155
|
+
);
|
|
152
156
|
const widths = toIntegerTrackWidths(tracks, targetTrackWidth);
|
|
153
|
-
const totalWidth =
|
|
157
|
+
const totalWidth = Math.min(
|
|
158
|
+
selectionWidth + Object.values(widths).reduce((sum, width) => sum + width, 0),
|
|
159
|
+
availableWidth
|
|
160
|
+
);
|
|
154
161
|
return {
|
|
155
162
|
selectionWidth: hasSelection ? table_utils.SELECTION_COLUMN_PX : void 0,
|
|
156
163
|
widths,
|
|
@@ -146,9 +146,16 @@ function buildDistributedColumnWidths(args) {
|
|
|
146
146
|
active = nextActive;
|
|
147
147
|
}
|
|
148
148
|
const floatTrackTotal = tracks.reduce((sum, track) => sum + track.width, 0);
|
|
149
|
-
const
|
|
149
|
+
const maxTrackWidth = availableWidth - selectionWidth;
|
|
150
|
+
const targetTrackWidth = Math.min(
|
|
151
|
+
floatTrackTotal <= maxTrackWidth ? Math.floor(floatTrackTotal) : Math.ceil(floatTrackTotal),
|
|
152
|
+
maxTrackWidth
|
|
153
|
+
);
|
|
150
154
|
const widths = toIntegerTrackWidths(tracks, targetTrackWidth);
|
|
151
|
-
const totalWidth =
|
|
155
|
+
const totalWidth = Math.min(
|
|
156
|
+
selectionWidth + Object.values(widths).reduce((sum, width) => sum + width, 0),
|
|
157
|
+
availableWidth
|
|
158
|
+
);
|
|
152
159
|
return {
|
|
153
160
|
selectionWidth: hasSelection ? SELECTION_COLUMN_PX : void 0,
|
|
154
161
|
widths,
|
package/dist/index.cjs
CHANGED
|
@@ -24,6 +24,7 @@ var FadeOverlay = require('./components/overlay/fade-overlay/FadeOverlay');
|
|
|
24
24
|
var InputContainer = require('./components/forms/input-container/InputContainer');
|
|
25
25
|
var Divider = require('./components/divider/Divider');
|
|
26
26
|
var Grid = require('./components/grid/Grid');
|
|
27
|
+
var MetricTile = require('./components/metric-tile/MetricTile');
|
|
27
28
|
|
|
28
29
|
|
|
29
30
|
|
|
@@ -171,3 +172,9 @@ Object.keys(Grid).forEach(function (k) {
|
|
|
171
172
|
get: function () { return Grid[k]; }
|
|
172
173
|
});
|
|
173
174
|
});
|
|
175
|
+
Object.keys(MetricTile).forEach(function (k) {
|
|
176
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
177
|
+
enumerable: true,
|
|
178
|
+
get: function () { return MetricTile[k]; }
|
|
179
|
+
});
|
|
180
|
+
});
|
package/dist/index.css
CHANGED
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
@import './components/media-card/MediaCard.module.css';
|
|
39
39
|
@import './components/menu/Menu.module.css';
|
|
40
40
|
@import './components/meta-bar/MetaBar.module.css';
|
|
41
|
+
@import './components/metric-tile/MetricTile.module.css';
|
|
41
42
|
@import './components/nav-bar/NavBar.module.css';
|
|
42
43
|
@import './components/overlay/fade-overlay/FadeOverlay.module.css';
|
|
43
44
|
@import './components/overlay/modal/Modal.module.css';
|
package/dist/index.d.ts
CHANGED
|
@@ -22,3 +22,4 @@ export * from './components/overlay/fade-overlay/FadeOverlay';
|
|
|
22
22
|
export * from './components/forms/input-container/InputContainer';
|
|
23
23
|
export * from './components/divider/Divider';
|
|
24
24
|
export * from './components/grid/Grid';
|
|
25
|
+
export * from './components/metric-tile/MetricTile';
|
package/dist/index.js
CHANGED
|
@@ -22,3 +22,4 @@ export * from './components/overlay/fade-overlay/FadeOverlay';
|
|
|
22
22
|
export * from './components/forms/input-container/InputContainer';
|
|
23
23
|
export * from './components/divider/Divider';
|
|
24
24
|
export * from './components/grid/Grid';
|
|
25
|
+
export * from './components/metric-tile/MetricTile';
|