Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(button): fix prop types for button #1473

Merged
merged 3 commits into from
May 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion components/button/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type ButtonOpenEventHandler<
Event extends React.SyntheticEvent = React.MouseEvent<HTMLButtonElement>
> = (arg0: ButtonEventPayload & { open: boolean }, event: Event) => void

export interface ButtonProps extends HTMLButtonElement {
export interface BaseButtonProps {
/**
* Component to render inside the button
*/
Expand Down Expand Up @@ -102,6 +102,9 @@ export interface ButtonProps extends HTMLButtonElement {
onKeyDown?: ButtonEventHandler<React.KeyboardEvent<HTMLButtonElement>>
}

export type ButtonProps = BaseButtonProps &
Omit<React.ComponentPropsWithoutRef<'button'>, keyof BaseButtonProps>
Comment on lines +105 to +106
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export type ButtonProps = BaseButtonProps &
Omit<React.ComponentPropsWithoutRef<'button'>, keyof BaseButtonProps>
// For prop types we don't define, use native HTML button props
// See https://github.com/dhis2/ui/pull/1473
export type ButtonProps = BaseButtonProps &
Omit<React.ComponentPropsWithoutRef<'button'>, keyof BaseButtonProps>


export const Button: React.FC<ButtonProps>

export interface ButtonStripProps {
Expand Down
Loading