wca-designsystem 1.0.76 → 1.0.77

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.76",
2
+ "version": "1.0.77",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -12,7 +12,7 @@ export default {
12
12
  const generateData = () => {
13
13
  const data = []
14
14
 
15
- for (let i = 1; i <= 3; i++) {
15
+ for (let i = 1; i <= 1; i++) {
16
16
  const children = [
17
17
  {
18
18
  id: `${i}-1`,
@@ -42,9 +42,12 @@ function BodyTable<
42
42
  } = props;
43
43
 
44
44
  const tableBodyRef = useRef<HTMLTableSectionElement | null>(null);
45
- const [expandedRows, setExpandedRows] = useState<Set<number | string>>(
46
- new Set()
47
- );
45
+ const [expandedRows, setExpandedRows] = useState<Set<number | string>>(() => {
46
+ if (data.length === 1) {
47
+ return new Set([data[0].id]);
48
+ }
49
+ return new Set();
50
+ });
48
51
 
49
52
  const handleRowSelect = useCallback(
50
53
  (item: T, checked: boolean) => {
@@ -61,6 +64,7 @@ function BodyTable<
61
64
  [rowSelection, setRowSelection]
62
65
  );
63
66
 
67
+
64
68
  const toggleExpandRow = useCallback((rowId: string | number) => {
65
69
  setExpandedRows(prev => {
66
70
  const newSet = new Set(prev);
@@ -88,6 +92,7 @@ function BodyTable<
88
92
  ): JSX.Element[] {
89
93
  const isSelected = rowSelection?.some(row => row.id === item.id);
90
94
  const hasChildren = item.children && item.children.length > 0;
95
+
91
96
  return [
92
97
  <tr
93
98
  key={`row-${item.id}`}