@moneyforward/mfui-components 3.6.0 → 3.8.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/dist/src/DataGrid/index.d.ts +16 -8
- package/dist/src/DataGrid/index.js +9 -1
- package/dist/src/{DataGrid/DataGrid.d.ts → DataTable/DataTable.d.ts} +94 -82
- package/dist/src/{DataGrid/DataGrid.js → DataTable/DataTable.js} +120 -97
- package/dist/src/{DataGrid/DataGrid.types.d.ts → DataTable/DataTable.types.d.ts} +11 -11
- package/dist/src/DataTable/DataTableBody/DataTableBody.d.ts +1 -0
- package/dist/src/DataTable/DataTableBody/DataTableBody.js +19 -0
- package/dist/src/{DataGrid/DataGridBody/DataGridBody.types.d.ts → DataTable/DataTableBody/DataTableBody.types.d.ts} +2 -2
- package/dist/src/DataTable/DataTableBody/index.d.ts +2 -0
- package/dist/src/DataTable/DataTableBody/index.js +1 -0
- package/dist/src/DataTable/DataTableCell/DataTableCell.d.ts +2 -0
- package/dist/src/{DataGrid/DataGridCell/DataGridCell.js → DataTable/DataTableCell/DataTableCell.js} +20 -13
- package/dist/src/{DataGrid/DataGridCell/DataGridCell.types.d.ts → DataTable/DataTableCell/DataTableCell.types.d.ts} +8 -8
- package/dist/src/DataTable/DataTableCell/index.d.ts +2 -0
- package/dist/src/DataTable/DataTableCell/index.js +1 -0
- package/dist/src/DataTable/DataTableHeader/DataTableHeader.d.ts +1 -0
- package/dist/src/DataTable/DataTableHeader/DataTableHeader.js +12 -0
- package/dist/src/{DataGrid/DataGridHeader/DataGridHeader.types.d.ts → DataTable/DataTableHeader/DataTableHeader.types.d.ts} +2 -2
- package/dist/src/DataTable/DataTableHeader/index.d.ts +2 -0
- package/dist/src/DataTable/DataTableHeader/index.js +1 -0
- package/dist/src/DataTable/DataTableHeaderCell/DataTableHeaderCell.d.ts +2 -0
- package/dist/src/DataTable/DataTableHeaderCell/DataTableHeaderCell.js +58 -0
- package/dist/src/{DataGrid/DataGridHeaderCell/DataGridHeaderCell.types.d.ts → DataTable/DataTableHeaderCell/DataTableHeaderCell.types.d.ts} +6 -6
- package/dist/src/DataTable/DataTableHeaderCell/index.d.ts +2 -0
- package/dist/src/DataTable/DataTableHeaderCell/index.js +1 -0
- package/dist/src/DataTable/DataTableHeaderRow/DataTableHeaderRow.d.ts +2 -0
- package/dist/src/DataTable/DataTableHeaderRow/DataTableHeaderRow.js +31 -0
- package/dist/src/{DataGrid/DataGridHeaderRow/DataGridHeaderRow.types.d.ts → DataTable/DataTableHeaderRow/DataTableHeaderRow.types.d.ts} +3 -3
- package/dist/src/DataTable/DataTableHeaderRow/index.d.ts +2 -0
- package/dist/src/DataTable/DataTableHeaderRow/index.js +1 -0
- package/dist/src/DataTable/DataTableProvider.d.ts +27 -0
- package/dist/src/{DataGrid/DataGridProvider.js → DataTable/DataTableProvider.js} +9 -9
- package/dist/src/DataTable/DataTableRow/DataTableRow.d.ts +2 -0
- package/dist/src/{DataGrid/DataGridRow/DataGridRow.js → DataTable/DataTableRow/DataTableRow.js} +11 -10
- package/dist/src/{DataGrid/DataGridRow/DataGridRow.types.d.ts → DataTable/DataTableRow/DataTableRow.types.d.ts} +5 -5
- package/dist/src/DataTable/DataTableRow/index.d.ts +2 -0
- package/dist/src/DataTable/DataTableRow/index.js +1 -0
- package/dist/src/DataTable/index.d.ts +8 -0
- package/dist/src/DataTable/index.js +1 -0
- package/dist/src/MainNavigation/BaseMainNavigation.js +25 -10
- package/dist/src/MainNavigation/MainNavigation.types.d.ts +49 -1
- package/dist/src/MainNavigation/NarrowViewportMainNavigation.js +17 -2
- package/dist/src/StatusLabel/StatusLabel.d.ts +1 -0
- package/dist/src/StatusLabel/StatusLabel.js +2 -2
- package/dist/src/StatusLabel/StatusLabel.types.d.ts +6 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/utilities/dom/useFixedColumns.d.ts +1 -1
- package/dist/src/utilities/dom/useFixedColumns.js +1 -1
- package/dist/src/utilities/react/isComponentOrWrapped.d.ts +7 -7
- package/dist/src/utilities/react/isComponentOrWrapped.js +7 -7
- package/dist/styled-system/jsx/is-valid-prop.js +1 -1
- package/dist/styled-system/patterns/divider.d.ts +1 -1
- package/dist/styled-system/patterns/float.d.ts +1 -1
- package/dist/styled-system/recipes/base-main-navigation-slot-recipe.d.ts +1 -1
- package/dist/styled-system/recipes/base-main-navigation-slot-recipe.js +12 -0
- package/dist/styled-system/recipes/data-table-body-slot-recipe.d.ts +33 -0
- package/dist/styled-system/recipes/data-table-body-slot-recipe.js +28 -0
- package/dist/styled-system/recipes/data-table-cell-slot-recipe.d.ts +38 -0
- package/dist/styled-system/recipes/data-table-cell-slot-recipe.js +77 -0
- package/dist/styled-system/recipes/data-table-header-cell-slot-recipe.d.ts +37 -0
- package/dist/styled-system/recipes/data-table-header-cell-slot-recipe.js +73 -0
- package/dist/styled-system/recipes/data-table-header-row-slot-recipe.d.ts +33 -0
- package/dist/styled-system/recipes/data-table-header-row-slot-recipe.js +28 -0
- package/dist/styled-system/recipes/data-table-header-slot-recipe.d.ts +33 -0
- package/dist/styled-system/recipes/data-table-header-slot-recipe.js +35 -0
- package/dist/styled-system/recipes/data-table-row-slot-recipe.d.ts +36 -0
- package/dist/styled-system/recipes/{data-grid-row-slot-recipe.js → data-table-row-slot-recipe.js} +13 -13
- package/dist/styled-system/recipes/data-table-slot-recipe.d.ts +36 -0
- package/dist/styled-system/recipes/data-table-slot-recipe.js +45 -0
- package/dist/styled-system/recipes/index.d.ts +7 -7
- package/dist/styled-system/recipes/index.js +7 -7
- package/dist/styled-system/recipes/narrow-viewport-main-navigation-slot-recipe.d.ts +1 -1
- package/dist/styled-system/recipes/narrow-viewport-main-navigation-slot-recipe.js +12 -0
- package/dist/styled-system/recipes/status-label-slot-recipe.d.ts +4 -0
- package/dist/styled-system/recipes/status-label-slot-recipe.js +9 -1
- package/dist/styled-system/tokens/index.js +117 -117
- package/dist/styled-system/tokens/tokens.d.ts +2 -2
- package/dist/styled-system/types/csstype.d.ts +6405 -5133
- package/dist/styled-system/types/style-props.d.ts +2748 -2163
- package/dist/styled-system/types/system-types.d.ts +14 -132
- package/dist/styles.css +222 -515
- package/dist/theme-orange.css +3 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/dist/src/DataGrid/DataGridBody/DataGridBody.d.ts +0 -1
- package/dist/src/DataGrid/DataGridBody/DataGridBody.js +0 -17
- package/dist/src/DataGrid/DataGridBody/index.d.ts +0 -2
- package/dist/src/DataGrid/DataGridBody/index.js +0 -1
- package/dist/src/DataGrid/DataGridCell/DataGridCell.d.ts +0 -2
- package/dist/src/DataGrid/DataGridCell/index.d.ts +0 -2
- package/dist/src/DataGrid/DataGridCell/index.js +0 -1
- package/dist/src/DataGrid/DataGridHeader/DataGridHeader.d.ts +0 -1
- package/dist/src/DataGrid/DataGridHeader/DataGridHeader.js +0 -11
- package/dist/src/DataGrid/DataGridHeader/index.d.ts +0 -2
- package/dist/src/DataGrid/DataGridHeader/index.js +0 -1
- package/dist/src/DataGrid/DataGridHeaderCell/DataGridHeaderCell.d.ts +0 -2
- package/dist/src/DataGrid/DataGridHeaderCell/DataGridHeaderCell.js +0 -50
- package/dist/src/DataGrid/DataGridHeaderCell/index.d.ts +0 -2
- package/dist/src/DataGrid/DataGridHeaderCell/index.js +0 -1
- package/dist/src/DataGrid/DataGridHeaderRow/DataGridHeaderRow.d.ts +0 -2
- package/dist/src/DataGrid/DataGridHeaderRow/DataGridHeaderRow.js +0 -30
- package/dist/src/DataGrid/DataGridHeaderRow/index.d.ts +0 -2
- package/dist/src/DataGrid/DataGridHeaderRow/index.js +0 -1
- package/dist/src/DataGrid/DataGridProvider.d.ts +0 -27
- package/dist/src/DataGrid/DataGridRow/DataGridRow.d.ts +0 -2
- package/dist/src/DataGrid/DataGridRow/index.d.ts +0 -2
- package/dist/src/DataGrid/DataGridRow/index.js +0 -1
- package/dist/styled-system/recipes/data-grid-body-slot-recipe.d.ts +0 -33
- package/dist/styled-system/recipes/data-grid-body-slot-recipe.js +0 -28
- package/dist/styled-system/recipes/data-grid-cell-slot-recipe.d.ts +0 -38
- package/dist/styled-system/recipes/data-grid-cell-slot-recipe.js +0 -77
- package/dist/styled-system/recipes/data-grid-header-cell-slot-recipe.d.ts +0 -37
- package/dist/styled-system/recipes/data-grid-header-cell-slot-recipe.js +0 -73
- package/dist/styled-system/recipes/data-grid-header-row-slot-recipe.d.ts +0 -33
- package/dist/styled-system/recipes/data-grid-header-row-slot-recipe.js +0 -28
- package/dist/styled-system/recipes/data-grid-header-slot-recipe.d.ts +0 -33
- package/dist/styled-system/recipes/data-grid-header-slot-recipe.js +0 -35
- package/dist/styled-system/recipes/data-grid-row-slot-recipe.d.ts +0 -36
- package/dist/styled-system/recipes/data-grid-slot-recipe.d.ts +0 -36
- package/dist/styled-system/recipes/data-grid-slot-recipe.js +0 -45
- /package/dist/src/{DataGrid/DataGrid.types.js → DataTable/DataTable.types.js} +0 -0
- /package/dist/src/{DataGrid/DataGridBody/DataGridBody.types.js → DataTable/DataTableBody/DataTableBody.types.js} +0 -0
- /package/dist/src/{DataGrid/DataGridCell/DataGridCell.types.js → DataTable/DataTableCell/DataTableCell.types.js} +0 -0
- /package/dist/src/{DataGrid/DataGridHeader/DataGridHeader.types.js → DataTable/DataTableHeader/DataTableHeader.types.js} +0 -0
- /package/dist/src/{DataGrid/DataGridHeaderCell/DataGridHeaderCell.types.js → DataTable/DataTableHeaderCell/DataTableHeaderCell.types.js} +0 -0
- /package/dist/src/{DataGrid/DataGridHeaderRow/DataGridHeaderRow.types.js → DataTable/DataTableHeaderRow/DataTableHeaderRow.types.js} +0 -0
- /package/dist/src/{DataGrid/DataGridRow/DataGridRow.types.js → DataTable/DataTableRow/DataTableRow.types.js} +0 -0
- /package/dist/src/{DataGrid → DataTable}/utils/handleCheckbox.d.ts +0 -0
- /package/dist/src/{DataGrid → DataTable}/utils/handleCheckbox.js +0 -0
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
/**
|
|
2
|
+
* DataGrid backward compatibility re-exports.
|
|
3
|
+
*
|
|
4
|
+
* DataGrid has been renamed to DataTable.
|
|
5
|
+
* Please migrate to DataTable. DataGrid will be removed in a future major version (v5.0.0).
|
|
6
|
+
*
|
|
7
|
+
* @see DataTable
|
|
8
|
+
*/
|
|
9
|
+
export { DataTable as DataGrid } from '../DataTable';
|
|
10
|
+
export type { DataTableProps as DataGridProps } from '../DataTable';
|
|
11
|
+
export type { DataTableBodyProps as DataGridBodyProps } from '../DataTable';
|
|
12
|
+
export type { DataTableCellProps as DataGridCellProps } from '../DataTable';
|
|
13
|
+
export type { DataTableHeaderProps as DataGridHeaderProps } from '../DataTable';
|
|
14
|
+
export type { DataTableHeaderCellProps as DataGridHeaderCellProps } from '../DataTable';
|
|
15
|
+
export type { DataTableHeaderRowProps as DataGridHeaderRowProps } from '../DataTable';
|
|
16
|
+
export type { DataTableRowProps as DataGridRowProps } from '../DataTable';
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* DataGrid backward compatibility re-exports.
|
|
3
|
+
*
|
|
4
|
+
* DataGrid has been renamed to DataTable.
|
|
5
|
+
* Please migrate to DataTable. DataGrid will be removed in a future major version (v5.0.0).
|
|
6
|
+
*
|
|
7
|
+
* @see DataTable
|
|
8
|
+
*/
|
|
9
|
+
export { DataTable as DataGrid } from '../DataTable';
|
|
@@ -1,43 +1,47 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type DataTableProps } from './DataTable.types';
|
|
2
2
|
/**
|
|
3
|
-
* The `
|
|
3
|
+
* The `DataTable` component.
|
|
4
4
|
*
|
|
5
5
|
* It renders a `table` element.
|
|
6
6
|
*
|
|
7
|
-
* This component should be used as a wrapper for all
|
|
8
|
-
* The composition components are provided as sub-components of
|
|
7
|
+
* This component should be used as a wrapper for all DataTable composition components.
|
|
8
|
+
* The composition components are provided as sub-components of DataTable.
|
|
9
|
+
*
|
|
10
|
+
* > **Migration note**: `DataGrid` has been renamed to `DataTable`.
|
|
11
|
+
* > Please migrate to `DataTable`. `DataGrid` will be removed in a future major version (v5.0.0).
|
|
12
|
+
*
|
|
9
13
|
* You can use them as follows:
|
|
10
14
|
*
|
|
11
15
|
* @example
|
|
12
16
|
* ```jsx
|
|
13
|
-
* <
|
|
14
|
-
* <
|
|
15
|
-
* <
|
|
16
|
-
* <
|
|
17
|
-
* </
|
|
18
|
-
* </
|
|
19
|
-
* <
|
|
20
|
-
* <
|
|
21
|
-
* <
|
|
22
|
-
* </
|
|
23
|
-
* </
|
|
24
|
-
* </
|
|
17
|
+
* <DataTable>
|
|
18
|
+
* <DataTable.Header>
|
|
19
|
+
* <DataTable.HeaderRow>
|
|
20
|
+
* <DataTable.HeaderCell>Header 1</DataTable.HeaderCell>
|
|
21
|
+
* </DataTable.HeaderRow>
|
|
22
|
+
* </DataTable.Header>
|
|
23
|
+
* <DataTable.Body>
|
|
24
|
+
* <DataTable.Row>
|
|
25
|
+
* <DataTable.Cell>Cell 1</DataTable.Cell>
|
|
26
|
+
* </DataTable.Row>
|
|
27
|
+
* </DataTable.Body>
|
|
28
|
+
* </DataTable>
|
|
25
29
|
* ```
|
|
26
30
|
*/
|
|
27
|
-
export declare const
|
|
31
|
+
export declare const DataTable: import("react").ForwardRefExoticComponent<Omit<DataTableProps, "ref"> & import("react").RefAttributes<HTMLTableElement>> & {
|
|
28
32
|
/**
|
|
29
|
-
* The `
|
|
30
|
-
* This component should be used inside the `
|
|
33
|
+
* The `DataTableBody` component.
|
|
34
|
+
* This component should be used inside the `DataTable` component.
|
|
31
35
|
*
|
|
32
36
|
* It renders and extends the props of `tbody` element.
|
|
33
37
|
*
|
|
34
|
-
* **Important**: When wrapping this component with a custom component, you must inherit `
|
|
38
|
+
* **Important**: When wrapping this component with a custom component, you must inherit `DataTableBodyProps` to ensure proper type checking.
|
|
35
39
|
* The parent component uses type checking to identify this component, and wrapping without proper props inheritance may cause issues.
|
|
36
40
|
*
|
|
37
41
|
* **CRITICAL: When wrapping with React hooks, you MUST set displayName:**
|
|
38
42
|
*
|
|
39
43
|
* If you create a wrapper component that uses React hooks (useState, useEffect, etc.),
|
|
40
|
-
* you must set `displayName = '
|
|
44
|
+
* you must set `displayName = 'DataTableBody'` to prevent React Rules of Hooks violations.
|
|
41
45
|
*
|
|
42
46
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tbody
|
|
43
47
|
*
|
|
@@ -46,41 +50,45 @@ export declare const DataGrid: import("react").ForwardRefExoticComponent<Omit<Da
|
|
|
46
50
|
* @example
|
|
47
51
|
*
|
|
48
52
|
* ```tsx
|
|
49
|
-
* // ✅ Correct: Inherit
|
|
50
|
-
* const CustomBody = (props:
|
|
53
|
+
* // ✅ Correct: Inherit DataTableBodyProps
|
|
54
|
+
* const CustomBody = (props: DataTableBodyProps) => <DataTable.Body {...props} />;
|
|
51
55
|
*
|
|
52
|
-
* // ❌ Incorrect: Not inheriting
|
|
53
|
-
* const CustomBody = (props: ComponentPropsWithRef<'tbody'>) => <
|
|
56
|
+
* // ❌ Incorrect: Not inheriting DataTableBodyProps
|
|
57
|
+
* const CustomBody = (props: ComponentPropsWithRef<'tbody'>) => <DataTable.Body {...props} />;
|
|
54
58
|
*
|
|
55
59
|
* // ✅ CORRECT: Wrapper with hooks must set displayName
|
|
56
60
|
* const Body = ({ data }: BodyProps) => {
|
|
57
61
|
* const { user } = useUser(); // Using hooks
|
|
58
|
-
* return <
|
|
62
|
+
* return <DataTable.Body>{data.map(...)}</DataTable.Body>;
|
|
59
63
|
* };
|
|
60
|
-
* Body.displayName = '
|
|
64
|
+
* Body.displayName = 'DataTableBody'; // MUST match 'DataTableBody' exactly
|
|
65
|
+
*
|
|
66
|
+
* // ⚠️ Migration: 'DataGridBody' is still accepted but will stop working in v5.0.0.
|
|
67
|
+
* // Please update to 'DataTableBody'.
|
|
68
|
+
* Body.displayName = 'DataGridBody'; // TODO: Migrate to 'DataTableBody'
|
|
61
69
|
*
|
|
62
70
|
* // ❌ WRONG: Don't use custom names
|
|
63
71
|
* Body.displayName = 'MyBody'; // Will cause hooks violation
|
|
64
|
-
* Body.displayName = '
|
|
72
|
+
* Body.displayName = 'CustomDataTableBody'; // Will cause hooks violation
|
|
65
73
|
* ```
|
|
66
74
|
*/
|
|
67
75
|
Body: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, "ref"> & import("react").RefAttributes<HTMLTableSectionElement>>;
|
|
68
76
|
/**
|
|
69
|
-
* The `
|
|
70
|
-
* This component should be used inside the `
|
|
77
|
+
* The `DataTableCell` component.
|
|
78
|
+
* This component should be used inside the `DataTable` component.
|
|
71
79
|
*
|
|
72
80
|
* It renders and extends the props of `td` element.
|
|
73
81
|
*
|
|
74
82
|
* When the `onClickCell` prop is provided, the cell is rendered as an interactive cell.
|
|
75
83
|
* Otherwise, the cell is rendered as a default cell.
|
|
76
84
|
*
|
|
77
|
-
* **Important**: When wrapping this component with a custom component, you must inherit `
|
|
85
|
+
* **Important**: When wrapping this component with a custom component, you must inherit `DataTableCellProps` to ensure proper type checking.
|
|
78
86
|
* The parent component uses type checking to identify this component, and wrapping without proper props inheritance may cause issues.
|
|
79
87
|
*
|
|
80
88
|
* **CRITICAL: When wrapping with React hooks, you MUST set displayName:**
|
|
81
89
|
*
|
|
82
90
|
* If you create a wrapper component that uses React hooks (useState, useEffect, etc.),
|
|
83
|
-
* you must set `displayName = '
|
|
91
|
+
* you must set `displayName = 'DataTableCell'` to prevent React Rules of Hooks violations.
|
|
84
92
|
*
|
|
85
93
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td
|
|
86
94
|
*
|
|
@@ -89,37 +97,37 @@ export declare const DataGrid: import("react").ForwardRefExoticComponent<Omit<Da
|
|
|
89
97
|
* @example
|
|
90
98
|
*
|
|
91
99
|
* ```tsx
|
|
92
|
-
* // ✅ Correct: Inherit
|
|
93
|
-
* const CustomCell = (props:
|
|
100
|
+
* // ✅ Correct: Inherit DataTableCellProps
|
|
101
|
+
* const CustomCell = (props: DataTableCellProps) => <DataTable.Cell {...props} />;
|
|
94
102
|
*
|
|
95
|
-
* // ❌ Incorrect: Not inheriting
|
|
96
|
-
* const CustomCell = (props: ComponentPropsWithRef<'td'>) => <
|
|
103
|
+
* // ❌ Incorrect: Not inheriting DataTableCellProps
|
|
104
|
+
* const CustomCell = (props: ComponentPropsWithRef<'td'>) => <DataTable.Cell {...props} />;
|
|
97
105
|
*
|
|
98
106
|
* // ✅ CORRECT: Wrapper with hooks must set displayName
|
|
99
107
|
* const Cell = ({ value }: CellProps) => {
|
|
100
108
|
* const { formatter } = useFormatter(); // Using hooks
|
|
101
|
-
* return <
|
|
109
|
+
* return <DataTable.Cell>{formatter(value)}</DataTable.Cell>;
|
|
102
110
|
* };
|
|
103
|
-
* Cell.displayName = '
|
|
111
|
+
* Cell.displayName = 'DataTableCell'; // MUST match 'DataTableCell' exactly
|
|
104
112
|
*
|
|
105
113
|
* // ❌ WRONG: Don't use custom names
|
|
106
114
|
* Cell.displayName = 'MyCell'; // Will cause hooks violation
|
|
107
|
-
* Cell.displayName = '
|
|
115
|
+
* Cell.displayName = 'CustomDataTableCell'; // Will cause hooks violation
|
|
108
116
|
* ```
|
|
109
117
|
*/
|
|
110
|
-
Cell: import("react").ForwardRefExoticComponent<Omit<import("./
|
|
118
|
+
Cell: import("react").ForwardRefExoticComponent<Omit<import("./DataTableCell").DataTableCellProps, "ref"> & import("react").RefAttributes<HTMLTableCellElement>>;
|
|
111
119
|
/**
|
|
112
|
-
* The `
|
|
113
|
-
* This component should be used inside the `
|
|
120
|
+
* The `DataTableHeader` component.
|
|
121
|
+
* This component should be used inside the `DataTable` component.
|
|
114
122
|
*
|
|
115
123
|
* It renders and extends the props of `thead` element.
|
|
116
124
|
*
|
|
117
|
-
* If the `fixedHeader` prop of the `
|
|
125
|
+
* If the `fixedHeader` prop of the `DataTable` component is `true`, it will be sticky on the top of the table while scrolling.
|
|
118
126
|
*
|
|
119
127
|
* **CRITICAL: When wrapping with React hooks, you MUST set displayName:**
|
|
120
128
|
*
|
|
121
129
|
* If you create a wrapper component that uses React hooks (useState, useEffect, etc.),
|
|
122
|
-
* you must set `displayName = '
|
|
130
|
+
* you must set `displayName = 'DataTableHeader'` to prevent React Rules of Hooks violations.
|
|
123
131
|
*
|
|
124
132
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/thead
|
|
125
133
|
*
|
|
@@ -131,19 +139,19 @@ export declare const DataGrid: import("react").ForwardRefExoticComponent<Omit<Da
|
|
|
131
139
|
* // ✅ CORRECT: Wrapper with hooks must set displayName
|
|
132
140
|
* const Header = ({ columns }: HeaderProps) => {
|
|
133
141
|
* const { sortConfig } = useSortConfig(); // Using hooks
|
|
134
|
-
* return <
|
|
142
|
+
* return <DataTable.Header>{columns.map(...)}</DataTable.Header>;
|
|
135
143
|
* };
|
|
136
|
-
* Header.displayName = '
|
|
144
|
+
* Header.displayName = 'DataTableHeader'; // MUST match 'DataTableHeader' exactly
|
|
137
145
|
*
|
|
138
146
|
* // ❌ WRONG: Don't use custom names
|
|
139
147
|
* Header.displayName = 'MyHeader'; // Will cause hooks violation
|
|
140
|
-
* Header.displayName = '
|
|
148
|
+
* Header.displayName = 'CustomDataTableHeader'; // Will cause hooks violation
|
|
141
149
|
* ```
|
|
142
150
|
*/
|
|
143
151
|
Header: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, "ref"> & import("react").RefAttributes<HTMLTableSectionElement>>;
|
|
144
152
|
/**
|
|
145
|
-
* The `
|
|
146
|
-
* This component should be used inside the `
|
|
153
|
+
* The `DataTableHeaderCell` component.
|
|
154
|
+
* This component should be used inside the `DataTable` component.
|
|
147
155
|
*
|
|
148
156
|
* It renders and extends the props of `th` element.
|
|
149
157
|
*
|
|
@@ -153,13 +161,13 @@ export declare const DataGrid: import("react").ForwardRefExoticComponent<Omit<Da
|
|
|
153
161
|
* When the `sortButtonProps.onClick` prop is provided, it renders a sort button.
|
|
154
162
|
* It renders `SortAscending` or `SortDescending` icon based on the `sortOrder` prop.
|
|
155
163
|
*
|
|
156
|
-
* **Important**: When wrapping this component with a custom component, you must inherit `
|
|
164
|
+
* **Important**: When wrapping this component with a custom component, you must inherit `DataTableHeaderCellProps` to ensure proper type checking.
|
|
157
165
|
* The parent component uses type checking to identify this component, and wrapping without proper props inheritance may cause issues.
|
|
158
166
|
*
|
|
159
167
|
* **CRITICAL: When wrapping with React hooks, you MUST set displayName:**
|
|
160
168
|
*
|
|
161
169
|
* If you create a wrapper component that uses React hooks (useState, useEffect, etc.),
|
|
162
|
-
* you must set `displayName = '
|
|
170
|
+
* you must set `displayName = 'DataTableHeaderCell'` to prevent React Rules of Hooks violations.
|
|
163
171
|
*
|
|
164
172
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th
|
|
165
173
|
*
|
|
@@ -168,40 +176,40 @@ export declare const DataGrid: import("react").ForwardRefExoticComponent<Omit<Da
|
|
|
168
176
|
* @example
|
|
169
177
|
*
|
|
170
178
|
* ```tsx
|
|
171
|
-
* // ✅ Correct: Inherit
|
|
172
|
-
* const CustomHeaderCell = (props:
|
|
179
|
+
* // ✅ Correct: Inherit DataTableHeaderCellProps
|
|
180
|
+
* const CustomHeaderCell = (props: DataTableHeaderCellProps) => <DataTable.HeaderCell {...props} />;
|
|
173
181
|
*
|
|
174
|
-
* // ❌ Incorrect: Not inheriting
|
|
175
|
-
* const CustomHeaderCell = (props: ComponentPropsWithRef<'th'>) => <
|
|
182
|
+
* // ❌ Incorrect: Not inheriting DataTableHeaderCellProps
|
|
183
|
+
* const CustomHeaderCell = (props: ComponentPropsWithRef<'th'>) => <DataTable.HeaderCell {...props} />;
|
|
176
184
|
*
|
|
177
185
|
* // ✅ CORRECT: Wrapper with hooks must set displayName
|
|
178
186
|
* const HeaderCell = ({ label }: HeaderCellProps) => {
|
|
179
187
|
* const { sortOrder } = useSorting(); // Using hooks
|
|
180
|
-
* return <
|
|
188
|
+
* return <DataTable.HeaderCell sortOrder={sortOrder}>{label}</DataTable.HeaderCell>;
|
|
181
189
|
* };
|
|
182
|
-
* HeaderCell.displayName = '
|
|
190
|
+
* HeaderCell.displayName = 'DataTableHeaderCell'; // MUST match 'DataTableHeaderCell' exactly
|
|
183
191
|
*
|
|
184
192
|
* // ❌ WRONG: Don't use custom names
|
|
185
193
|
* HeaderCell.displayName = 'MyHeaderCell'; // Will cause hooks violation
|
|
186
194
|
* HeaderCell.displayName = 'CustomCell'; // Will cause hooks violation
|
|
187
195
|
* ```
|
|
188
196
|
*/
|
|
189
|
-
HeaderCell: import("react").ForwardRefExoticComponent<Omit<import("./
|
|
197
|
+
HeaderCell: import("react").ForwardRefExoticComponent<Omit<import("./DataTableHeaderCell").DataTableHeaderCellProps, "ref"> & import("react").RefAttributes<HTMLTableCellElement>>;
|
|
190
198
|
/**
|
|
191
|
-
* The `
|
|
192
|
-
* This component should be used inside the `
|
|
199
|
+
* The `DataTableHeaderRow` component.
|
|
200
|
+
* This component should be used inside the `DataTable` component.
|
|
193
201
|
*
|
|
194
202
|
* It renders and extends the props of `tr` element.
|
|
195
203
|
*
|
|
196
|
-
* If the `selectable` prop of the `
|
|
204
|
+
* If the `selectable` prop of the `DataTable` component is `true`, it renders a `Checkbox` component inside the first cell.
|
|
197
205
|
*
|
|
198
|
-
* **Important**: When wrapping this component with a custom component, you must inherit `
|
|
206
|
+
* **Important**: When wrapping this component with a custom component, you must inherit `DataTableHeaderRowProps` to ensure proper type checking.
|
|
199
207
|
* The parent component uses type checking to identify this component, and wrapping without proper props inheritance may cause issues.
|
|
200
208
|
*
|
|
201
209
|
* **CRITICAL: When wrapping with React hooks, you MUST set displayName:**
|
|
202
210
|
*
|
|
203
211
|
* If you create a wrapper component that uses React hooks (useState, useEffect, etc.),
|
|
204
|
-
* you must set `displayName = '
|
|
212
|
+
* you must set `displayName = 'DataTableHeaderRow'` to prevent React Rules of Hooks violations.
|
|
205
213
|
*
|
|
206
214
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tr
|
|
207
215
|
*
|
|
@@ -210,38 +218,38 @@ export declare const DataGrid: import("react").ForwardRefExoticComponent<Omit<Da
|
|
|
210
218
|
* @example
|
|
211
219
|
*
|
|
212
220
|
* ```tsx
|
|
213
|
-
* // ✅ Correct: Inherit
|
|
214
|
-
* const CustomHeaderRow = (props:
|
|
221
|
+
* // ✅ Correct: Inherit DataTableHeaderRowProps
|
|
222
|
+
* const CustomHeaderRow = (props: DataTableHeaderRowProps) => <DataTable.HeaderRow {...props} />;
|
|
215
223
|
*
|
|
216
|
-
* // ❌ Incorrect: Not inheriting
|
|
217
|
-
* const CustomHeaderRow = (props: ComponentPropsWithRef<'tr'>) => <
|
|
224
|
+
* // ❌ Incorrect: Not inheriting DataTableHeaderRowProps
|
|
225
|
+
* const CustomHeaderRow = (props: ComponentPropsWithRef<'tr'>) => <DataTable.HeaderRow {...props} />;
|
|
218
226
|
*
|
|
219
227
|
* // ✅ CORRECT: Wrapper with hooks must set displayName
|
|
220
228
|
* const HeaderRow = ({ columns }: HeaderRowProps) => {
|
|
221
229
|
* const { visibleColumns } = useColumns(); // Using hooks
|
|
222
|
-
* return <
|
|
230
|
+
* return <DataTable.HeaderRow>{visibleColumns.map(...)}</DataTable.HeaderRow>;
|
|
223
231
|
* };
|
|
224
|
-
* HeaderRow.displayName = '
|
|
232
|
+
* HeaderRow.displayName = 'DataTableHeaderRow'; // MUST match 'DataTableHeaderRow' exactly
|
|
225
233
|
*
|
|
226
234
|
* // ❌ WRONG: Don't use custom names
|
|
227
235
|
* HeaderRow.displayName = 'MyHeaderRow'; // Will cause hooks violation
|
|
228
236
|
* HeaderRow.displayName = 'CustomRow'; // Will cause hooks violation
|
|
229
237
|
* ```
|
|
230
238
|
*/
|
|
231
|
-
HeaderRow: import("react").ForwardRefExoticComponent<Omit<import("./
|
|
239
|
+
HeaderRow: import("react").ForwardRefExoticComponent<Omit<import("./DataTableHeaderRow").DataTableHeaderRowProps, "ref"> & import("react").RefAttributes<HTMLTableRowElement>>;
|
|
232
240
|
/**
|
|
233
|
-
* The `
|
|
234
|
-
* This component should be used inside the `
|
|
241
|
+
* The `DataTableRow` component.
|
|
242
|
+
* This component should be used inside the `DataTable` component.
|
|
235
243
|
*
|
|
236
244
|
* It renders and extends the props of `tr` element.
|
|
237
245
|
*
|
|
238
|
-
* **Important**: When wrapping this component with a custom component, you must inherit `
|
|
246
|
+
* **Important**: When wrapping this component with a custom component, you must inherit `DataTableRowProps` to ensure proper type checking.
|
|
239
247
|
* The parent component uses type checking to identify this component, and wrapping without proper props inheritance may cause issues.
|
|
240
248
|
*
|
|
241
249
|
* **CRITICAL: When wrapping with React hooks, you MUST set displayName:**
|
|
242
250
|
*
|
|
243
251
|
* If you create a wrapper component that uses React hooks (useState, useEffect, etc.),
|
|
244
|
-
* you must set `displayName = '
|
|
252
|
+
* you must set `displayName = 'DataTableRow'` to prevent React Rules of Hooks violations.
|
|
245
253
|
*
|
|
246
254
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tr
|
|
247
255
|
*
|
|
@@ -250,23 +258,27 @@ export declare const DataGrid: import("react").ForwardRefExoticComponent<Omit<Da
|
|
|
250
258
|
* @example
|
|
251
259
|
*
|
|
252
260
|
* ```tsx
|
|
253
|
-
* // ✅ Correct: Inherit
|
|
254
|
-
* const CustomRow = (props:
|
|
261
|
+
* // ✅ Correct: Inherit DataTableRowProps
|
|
262
|
+
* const CustomRow = (props: DataTableRowProps) => <DataTable.Row {...props} />;
|
|
255
263
|
*
|
|
256
|
-
* // ❌ Incorrect: Not inheriting
|
|
257
|
-
* const CustomRow = (props: ComponentPropsWithRef<'tr'>) => <
|
|
264
|
+
* // ❌ Incorrect: Not inheriting DataTableRowProps
|
|
265
|
+
* const CustomRow = (props: ComponentPropsWithRef<'tr'>) => <DataTable.Row {...props} />;
|
|
258
266
|
*
|
|
259
267
|
* // ✅ CORRECT: Wrapper with hooks must set displayName
|
|
260
268
|
* const Row = ({ item }: RowProps) => {
|
|
261
269
|
* const { isSelected } = useSelection(item.id); // Using hooks
|
|
262
|
-
* return <
|
|
270
|
+
* return <DataTable.Row selected={isSelected}>...</DataTable.Row>;
|
|
263
271
|
* };
|
|
264
|
-
* Row.displayName = '
|
|
272
|
+
* Row.displayName = 'DataTableRow'; // MUST match 'DataTableRow' exactly
|
|
273
|
+
*
|
|
274
|
+
* // ⚠️ Migration: 'DataGridRow' is still accepted but will stop working in v5.0.0.
|
|
275
|
+
* // Please update to 'DataTableRow'.
|
|
276
|
+
* Row.displayName = 'DataGridRow'; // TODO: Migrate to 'DataTableRow'
|
|
265
277
|
*
|
|
266
278
|
* // ❌ WRONG: Don't use custom names
|
|
267
279
|
* Row.displayName = 'MyRow'; // Will cause hooks violation
|
|
268
|
-
* Row.displayName = '
|
|
280
|
+
* Row.displayName = 'CustomDataTableRow'; // Will cause hooks violation
|
|
269
281
|
* ```
|
|
270
282
|
*/
|
|
271
|
-
Row: import("react").ForwardRefExoticComponent<Omit<import("./
|
|
283
|
+
Row: import("react").ForwardRefExoticComponent<Omit<import("./DataTableRow").DataTableRowProps, "ref"> & import("react").RefAttributes<HTMLTableRowElement>>;
|
|
272
284
|
};
|