-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add correct table component types to the prop tables (#4091)
* add correct table component types to the prop tables * ignore directory from coverage
- Loading branch information
Showing
9 changed files
with
56 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# \_propTableTypes directory | ||
|
||
This directory is a workaround for using compound components like in the table because react-docgen-typescript can't | ||
solve types from compound components. It is used by the script `build-component-props.mjs` to generate the correct type. | ||
Then this type can be used in the props table. | ||
|
||
## File name | ||
|
||
Create a file with the name of the compound component part e.g `Table.Body`. | ||
|
||
## import type | ||
|
||
Import the type which can't be autogenerated. Normally it is the type which belongs to the compound component part | ||
e.g. `Table.Cell = <b>Cell</b>;` | ||
|
||
`import { Cell as ReactAriaCell } from '@react-stately/table';` | ||
|
||
Note: You should use an alias. Name it whatever you want. | ||
|
||
## export type | ||
|
||
Finally export the imported type. | ||
|
||
`export const Cell = ReactAriaCell;` | ||
|
||
## run script | ||
|
||
After creating the file with the content run `pnpm buil-component-props`. Then search for the file name in `props.json` | ||
and you should find the type. | ||
|
||
## using in prop table | ||
|
||
Use the new type in the props table. For this just pass the file name into the component prop e.g. | ||
`<PropsTable component="Table.Cell" />` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { TableBody as ReactAriaTableBody } from '@react-stately/table'; | ||
|
||
export const Body = ReactAriaTableBody; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { Cell as ReactAriaCell } from '@react-stately/table'; | ||
|
||
export const Cell = ReactAriaCell; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { Column as ReactAriaColumn } from '@react-stately/table'; | ||
|
||
export const Column = ReactAriaColumn; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { TableHeader as ReactAriaTableHeader } from '@react-stately/table'; | ||
|
||
export const Header = ReactAriaTableHeader; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { Row as ReactAriaRow } from '@react-stately/table'; | ||
|
||
export const Row = ReactAriaRow; |