@digigov/react-core 2.1.0 → 2.1.1-platform-238.29-04-26-11-16
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 +11 -2
- package/TableDataCell/index.d.ts +1 -0
- package/TableDataCell/index.js +6 -3
- package/index.js +1 -1
- package/package.json +3 -3
- package/src/Table/__snapshots__/index.test.tsx.snap +70 -0
- package/src/Table/index.test.tsx +51 -2
- package/src/TableDataCell/__snapshots__/index.test.tsx.snap +28 -0
- package/src/TableDataCell/index.test.tsx +13 -0
- package/src/TableDataCell/index.tsx +24 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
# Change Log - @digigov/react-core
|
|
2
2
|
|
|
3
|
-
This log was last generated on Wed,
|
|
3
|
+
<!-- This log was last generated on Wed, 29 Apr 2026 11:16:37 GMT and should not be manually modified. -->
|
|
4
|
+
|
|
5
|
+
<!-- Start content -->
|
|
6
|
+
|
|
7
|
+
## 2.1.1-platform-238.29-04-26-11-16
|
|
8
|
+
|
|
9
|
+
Wed, 29 Apr 2026 11:16:37 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- feat(TableDataCell): add maxWidthWithOverflow prop, new stories, updated tests (kbrani@admin.grnet.gr)
|
|
4
14
|
|
|
5
15
|
## 2.0.8
|
|
6
16
|
Wed, 11 Feb 2026 14:46:37 GMT
|
|
@@ -701,4 +711,3 @@ Fri, 05 Nov 2021 12:24:20 GMT
|
|
|
701
711
|
### Minor changes
|
|
702
712
|
|
|
703
713
|
- test and adjust core components
|
|
704
|
-
|
package/TableDataCell/index.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export interface TableDataCellProps extends BaseProps<'td'> {
|
|
|
32
32
|
*/
|
|
33
33
|
highlight?: 'warning' | 'error';
|
|
34
34
|
highlightAssistiveText?: string;
|
|
35
|
+
maxWidthWithOverflow?: boolean;
|
|
35
36
|
}
|
|
36
37
|
/**
|
|
37
38
|
* Use TableDataCell inside the Table component to fill the data of a cell in a table.
|
package/TableDataCell/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import react from "react";
|
|
|
2
2
|
import clsx from "clsx";
|
|
3
3
|
import Base from "../Base/index.js";
|
|
4
4
|
import VisuallyHidden from "../VisuallyHidden/index.js";
|
|
5
|
-
const TableDataCell_TableDataCell = /*#__PURE__*/ react.forwardRef(function({ dataType = 'text', variant = 'border', wordBreak = 'none', highlight, highlightAssistiveText, className, children, ...props }, ref) {
|
|
5
|
+
const TableDataCell_TableDataCell = /*#__PURE__*/ react.forwardRef(function({ dataType = 'text', variant = 'border', wordBreak = 'none', highlight, highlightAssistiveText, maxWidthWithOverflow = false, className, children, ...props }, ref) {
|
|
6
6
|
const calculatedHighlightAssistiveText = highlightAssistiveText || ('warning' === highlight ? 'Προσοχή' : 'error' === highlight ? 'Λανθασμένο πεδίο' : void 0);
|
|
7
7
|
return /*#__PURE__*/ react.createElement(Base, {
|
|
8
8
|
as: "td",
|
|
@@ -13,10 +13,13 @@ const TableDataCell_TableDataCell = /*#__PURE__*/ react.forwardRef(function({ da
|
|
|
13
13
|
'ds-table__cell--break-all': 'break-all' === wordBreak,
|
|
14
14
|
'ds-table__cell--numeric': 'numeric' === dataType,
|
|
15
15
|
'ds-table__cell--warning': 'warning' === highlight,
|
|
16
|
-
'ds-table__cell--error': 'error' === highlight
|
|
16
|
+
'ds-table__cell--error': 'error' === highlight,
|
|
17
|
+
'ds-table__cell--max-w': true === maxWidthWithOverflow
|
|
17
18
|
}),
|
|
18
19
|
...props
|
|
19
|
-
},
|
|
20
|
+
}, maxWidthWithOverflow ? /*#__PURE__*/ react.createElement("div", {
|
|
21
|
+
className: "ds-table__cell__content"
|
|
22
|
+
}, calculatedHighlightAssistiveText && /*#__PURE__*/ react.createElement(VisuallyHidden, null, calculatedHighlightAssistiveText), children) : /*#__PURE__*/ react.createElement(react.Fragment, null, calculatedHighlightAssistiveText && /*#__PURE__*/ react.createElement(VisuallyHidden, null, calculatedHighlightAssistiveText), children));
|
|
20
23
|
});
|
|
21
24
|
const src_TableDataCell = TableDataCell_TableDataCell;
|
|
22
25
|
export { TableDataCell_TableDataCell as TableDataCell, src_TableDataCell as default };
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digigov/react-core",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1-platform-238.29-04-26-11-16",
|
|
4
4
|
"description": "@digigov react core components",
|
|
5
5
|
"author": "GRNET Developers <devs@lists.grnet.gr>",
|
|
6
6
|
"license": "BSD-2-Clause",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"react-native-svg": "^15.2.0",
|
|
18
18
|
"expo-router": "^3.5.14",
|
|
19
19
|
"nativewind": "^4.1.1",
|
|
20
|
-
"@digigov/css": "2.1.
|
|
21
|
-
"@digigov/react-icons": "2.1.
|
|
20
|
+
"@digigov/css": "2.1.1-platform-238.29-04-26-11-16",
|
|
21
|
+
"@digigov/react-icons": "2.1.1-platform-238.29-04-26-11-16"
|
|
22
22
|
},
|
|
23
23
|
"peerDependenciesMeta": {
|
|
24
24
|
"react-native": {
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
2
|
|
|
3
|
+
exports[`renders the Table with always stacked prop 1`] = `
|
|
4
|
+
<body>
|
|
5
|
+
<div>
|
|
6
|
+
<table
|
|
7
|
+
class="ds-table ds-table--stacked-always"
|
|
8
|
+
>
|
|
9
|
+
<tbody
|
|
10
|
+
class="ds-table__body"
|
|
11
|
+
/>
|
|
12
|
+
</table>
|
|
13
|
+
</div>
|
|
14
|
+
</body>
|
|
15
|
+
`;
|
|
16
|
+
|
|
3
17
|
exports[`renders the Table with dark headerVariant prop 1`] = `
|
|
4
18
|
<body>
|
|
5
19
|
<div>
|
|
@@ -14,6 +28,20 @@ exports[`renders the Table with dark headerVariant prop 1`] = `
|
|
|
14
28
|
</body>
|
|
15
29
|
`;
|
|
16
30
|
|
|
31
|
+
exports[`renders the Table with dense prop 1`] = `
|
|
32
|
+
<body>
|
|
33
|
+
<div>
|
|
34
|
+
<table
|
|
35
|
+
class="ds-table ds-table--dense"
|
|
36
|
+
>
|
|
37
|
+
<tbody
|
|
38
|
+
class="ds-table__body"
|
|
39
|
+
/>
|
|
40
|
+
</table>
|
|
41
|
+
</div>
|
|
42
|
+
</body>
|
|
43
|
+
`;
|
|
44
|
+
|
|
17
45
|
exports[`renders the Table with light headerVariant prop 1`] = `
|
|
18
46
|
<body>
|
|
19
47
|
<div>
|
|
@@ -28,6 +56,34 @@ exports[`renders the Table with light headerVariant prop 1`] = `
|
|
|
28
56
|
</body>
|
|
29
57
|
`;
|
|
30
58
|
|
|
59
|
+
exports[`renders the Table with md stacked prop 1`] = `
|
|
60
|
+
<body>
|
|
61
|
+
<div>
|
|
62
|
+
<table
|
|
63
|
+
class="ds-table ds-table--stacked-md"
|
|
64
|
+
>
|
|
65
|
+
<tbody
|
|
66
|
+
class="ds-table__body"
|
|
67
|
+
/>
|
|
68
|
+
</table>
|
|
69
|
+
</div>
|
|
70
|
+
</body>
|
|
71
|
+
`;
|
|
72
|
+
|
|
73
|
+
exports[`renders the Table with middle vertical align prop 1`] = `
|
|
74
|
+
<body>
|
|
75
|
+
<div>
|
|
76
|
+
<table
|
|
77
|
+
class="ds-table"
|
|
78
|
+
>
|
|
79
|
+
<tbody
|
|
80
|
+
class="ds-table__body"
|
|
81
|
+
/>
|
|
82
|
+
</table>
|
|
83
|
+
</div>
|
|
84
|
+
</body>
|
|
85
|
+
`;
|
|
86
|
+
|
|
31
87
|
exports[`renders the Table with no props 1`] = `
|
|
32
88
|
<body>
|
|
33
89
|
<div>
|
|
@@ -42,6 +98,20 @@ exports[`renders the Table with no props 1`] = `
|
|
|
42
98
|
</body>
|
|
43
99
|
`;
|
|
44
100
|
|
|
101
|
+
exports[`renders the Table with top vertical align prop 1`] = `
|
|
102
|
+
<body>
|
|
103
|
+
<div>
|
|
104
|
+
<table
|
|
105
|
+
class="ds-table ds-table--align-top"
|
|
106
|
+
>
|
|
107
|
+
<tbody
|
|
108
|
+
class="ds-table__body"
|
|
109
|
+
/>
|
|
110
|
+
</table>
|
|
111
|
+
</div>
|
|
112
|
+
</body>
|
|
113
|
+
`;
|
|
114
|
+
|
|
45
115
|
exports[`renders the Table with verticalBorders prop 1`] = `
|
|
46
116
|
<body>
|
|
47
117
|
<div>
|
package/src/Table/index.test.tsx
CHANGED
|
@@ -34,10 +34,10 @@ it('renders the Table with light headerVariant prop', () => {
|
|
|
34
34
|
).toMatchSnapshot();
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
-
it('renders the Table with
|
|
37
|
+
it('renders the Table with dense prop', () => {
|
|
38
38
|
expect(
|
|
39
39
|
render(
|
|
40
|
-
<Table
|
|
40
|
+
<Table dense>
|
|
41
41
|
<TableBody></TableBody>
|
|
42
42
|
</Table>
|
|
43
43
|
).baseElement
|
|
@@ -53,3 +53,52 @@ it('renders the Table with verticalBorders prop', () => {
|
|
|
53
53
|
).baseElement
|
|
54
54
|
).toMatchSnapshot();
|
|
55
55
|
});
|
|
56
|
+
it('renders the Table with always stacked prop', () => {
|
|
57
|
+
expect(
|
|
58
|
+
render(
|
|
59
|
+
<Table stacked="always">
|
|
60
|
+
<TableBody></TableBody>
|
|
61
|
+
</Table>
|
|
62
|
+
).baseElement
|
|
63
|
+
).toMatchSnapshot();
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('renders the Table with md stacked prop', () => {
|
|
67
|
+
expect(
|
|
68
|
+
render(
|
|
69
|
+
<Table stacked="md">
|
|
70
|
+
<TableBody></TableBody>
|
|
71
|
+
</Table>
|
|
72
|
+
).baseElement
|
|
73
|
+
).toMatchSnapshot();
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it('renders the Table with zebra prop', () => {
|
|
77
|
+
expect(
|
|
78
|
+
render(
|
|
79
|
+
<Table variant="zebra">
|
|
80
|
+
<TableBody></TableBody>
|
|
81
|
+
</Table>
|
|
82
|
+
).baseElement
|
|
83
|
+
).toMatchSnapshot();
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it('renders the Table with top vertical align prop', () => {
|
|
87
|
+
expect(
|
|
88
|
+
render(
|
|
89
|
+
<Table verticalAlign="top">
|
|
90
|
+
<TableBody></TableBody>
|
|
91
|
+
</Table>
|
|
92
|
+
).baseElement
|
|
93
|
+
).toMatchSnapshot();
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('renders the Table with middle vertical align prop', () => {
|
|
97
|
+
expect(
|
|
98
|
+
render(
|
|
99
|
+
<Table verticalAlign="middle">
|
|
100
|
+
<TableBody></TableBody>
|
|
101
|
+
</Table>
|
|
102
|
+
).baseElement
|
|
103
|
+
).toMatchSnapshot();
|
|
104
|
+
});
|
|
@@ -53,6 +53,34 @@ exports[`renders the Table with highlight warning prop 1`] = `
|
|
|
53
53
|
</body>
|
|
54
54
|
`;
|
|
55
55
|
|
|
56
|
+
exports[`renders the Table with maxWidthWithOverflow prop 1`] = `
|
|
57
|
+
<body>
|
|
58
|
+
<div>
|
|
59
|
+
<table
|
|
60
|
+
class="ds-table"
|
|
61
|
+
>
|
|
62
|
+
<tbody
|
|
63
|
+
class="ds-table__body"
|
|
64
|
+
>
|
|
65
|
+
<tr
|
|
66
|
+
class="ds-table__row"
|
|
67
|
+
>
|
|
68
|
+
<td
|
|
69
|
+
class="ds-table__cell ds-table__cell--border ds-table__cell--max-w"
|
|
70
|
+
>
|
|
71
|
+
<div
|
|
72
|
+
class="ds-table__cell__content"
|
|
73
|
+
>
|
|
74
|
+
hello
|
|
75
|
+
</div>
|
|
76
|
+
</td>
|
|
77
|
+
</tr>
|
|
78
|
+
</tbody>
|
|
79
|
+
</table>
|
|
80
|
+
</div>
|
|
81
|
+
</body>
|
|
82
|
+
`;
|
|
83
|
+
|
|
56
84
|
exports[`renders the Table with no props 1`] = `
|
|
57
85
|
<body>
|
|
58
86
|
<div>
|
|
@@ -75,3 +75,16 @@ it('renders the Table with highlight warning prop', () => {
|
|
|
75
75
|
).baseElement
|
|
76
76
|
).toMatchSnapshot();
|
|
77
77
|
});
|
|
78
|
+
it('renders the Table with maxWidthWithOverflow prop', () => {
|
|
79
|
+
expect(
|
|
80
|
+
render(
|
|
81
|
+
<Table>
|
|
82
|
+
<TableBody>
|
|
83
|
+
<TableRow>
|
|
84
|
+
<TableDataCell maxWidthWithOverflow={true}>hello</TableDataCell>
|
|
85
|
+
</TableRow>
|
|
86
|
+
</TableBody>
|
|
87
|
+
</Table>
|
|
88
|
+
).baseElement
|
|
89
|
+
).toMatchSnapshot();
|
|
90
|
+
});
|
|
@@ -44,6 +44,14 @@ export interface TableDataCellProps extends BaseProps<'td'> {
|
|
|
44
44
|
* @default undefined
|
|
45
45
|
*/
|
|
46
46
|
highlightAssistiveText?: string;
|
|
47
|
+
|
|
48
|
+
/*
|
|
49
|
+
* maxWidthWithOverflow is optional.
|
|
50
|
+
* Use this prop to set max-width of the cell and allow overflow when the content is too long.
|
|
51
|
+
* This is used in combination with the TableFloatingScroll component to allow horizontal scrolling of the table when there are cells with long content.
|
|
52
|
+
* @default false
|
|
53
|
+
*/
|
|
54
|
+
maxWidthWithOverflow?: boolean;
|
|
47
55
|
}
|
|
48
56
|
/**
|
|
49
57
|
* Use TableDataCell inside the Table component to fill the data of a cell in a table.
|
|
@@ -58,6 +66,7 @@ export const TableDataCell = React.forwardRef<
|
|
|
58
66
|
wordBreak = 'none',
|
|
59
67
|
highlight,
|
|
60
68
|
highlightAssistiveText,
|
|
69
|
+
maxWidthWithOverflow = false,
|
|
61
70
|
className,
|
|
62
71
|
children,
|
|
63
72
|
...props
|
|
@@ -83,13 +92,25 @@ export const TableDataCell = React.forwardRef<
|
|
|
83
92
|
'ds-table__cell--numeric': dataType === 'numeric',
|
|
84
93
|
'ds-table__cell--warning': highlight === 'warning',
|
|
85
94
|
'ds-table__cell--error': highlight === 'error',
|
|
95
|
+
'ds-table__cell--max-w': maxWidthWithOverflow === true,
|
|
86
96
|
})}
|
|
87
97
|
{...props}
|
|
88
98
|
>
|
|
89
|
-
{
|
|
90
|
-
<
|
|
99
|
+
{maxWidthWithOverflow ? (
|
|
100
|
+
<div className="ds-table__cell__content">
|
|
101
|
+
{calculatedHighlightAssistiveText && (
|
|
102
|
+
<VisuallyHidden>{calculatedHighlightAssistiveText}</VisuallyHidden>
|
|
103
|
+
)}
|
|
104
|
+
{children}
|
|
105
|
+
</div>
|
|
106
|
+
) : (
|
|
107
|
+
<>
|
|
108
|
+
{calculatedHighlightAssistiveText && (
|
|
109
|
+
<VisuallyHidden>{calculatedHighlightAssistiveText}</VisuallyHidden>
|
|
110
|
+
)}
|
|
111
|
+
{children}
|
|
112
|
+
</>
|
|
91
113
|
)}
|
|
92
|
-
{children}
|
|
93
114
|
</Base>
|
|
94
115
|
);
|
|
95
116
|
});
|