-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(typescript): add various typescript typings (#13234)
* feat(TableToolbar): add typescript typings * feat(TableToolbarAction): add typescript typings * feat(TableToolbarContent): change to `tsx` * feat(TableToolbarMenu): add typescript typings * feat(OverflowMenuItem): add typescript typings * fix: format --------- Co-authored-by: Francine Lucca <[email protected]> Co-authored-by: Francine Lucca <[email protected]>
- Loading branch information
1 parent
af37b74
commit 36f1bbb
Showing
7 changed files
with
346 additions
and
215 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
23 changes: 0 additions & 23 deletions
23
packages/react/src/components/DataTable/TableToolbarAction.js
This file was deleted.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
packages/react/src/components/DataTable/TableToolbarAction.tsx
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,44 @@ | ||
/** | ||
* Copyright IBM Corp. 2016, 2023 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
import OverflowMenuItem from '../OverflowMenuItem'; | ||
import { ForwardRefReturn } from '../../types/common'; | ||
|
||
export interface TableToolbarActionProps | ||
extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick'> { | ||
/** | ||
* Pass in the children that will be rendered inside the TableToolbarAction | ||
*/ | ||
children?: React.ReactNode; | ||
|
||
/** | ||
* onClick handler for the TableToolbarAction | ||
*/ | ||
onClick: (event: React.MouseEvent<HTMLDivElement>) => void; | ||
} | ||
|
||
export type TableToolbarActionComponent = ForwardRefReturn< | ||
HTMLDivElement, | ||
TableToolbarActionProps | ||
>; | ||
|
||
const TableToolbarAction: TableToolbarActionComponent = React.forwardRef( | ||
({ children, ...rest }, ref) => { | ||
return <OverflowMenuItem ref={ref} itemText={children} {...rest} />; | ||
} | ||
); | ||
|
||
TableToolbarAction.displayName = 'TableToolbarAction'; | ||
TableToolbarAction.propTypes = { | ||
children: PropTypes.node, | ||
className: PropTypes.string, | ||
onClick: PropTypes.func.isRequired, | ||
}; | ||
|
||
export default TableToolbarAction; |
File renamed without changes.
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
187 changes: 0 additions & 187 deletions
187
packages/react/src/components/OverflowMenuItem/OverflowMenuItem.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.