Skip to content

Commit

Permalink
Omitting compact Button prop when passing through props
Browse files Browse the repository at this point in the history
  • Loading branch information
kraenhansen committed Nov 1, 2024
1 parent 51f85c2 commit 7a8b60c
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 14 deletions.
10 changes: 10 additions & 0 deletions .changeset/mean-gorillas-dance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'@leafygreen-ui/confirmation-modal': patch
'@lg-chat/message-feedback': patch
'@leafygreen-ui/number-input': patch
'@leafygreen-ui/split-button': patch
'@leafygreen-ui/form-footer': patch
'@leafygreen-ui/code': patch
---

Omitting `compact` Button prop when passing through props
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export type InlineMessageFeedbackProps = Required<
/**
* Override props for the cancel Button
*/
cancelButtonProps?: ButtonProps;
cancelButtonProps?: Omit<ButtonProps, 'compact'>;

/**
* Text displayed inside the submit Button
Expand All @@ -35,7 +35,7 @@ export type InlineMessageFeedbackProps = Required<
/**
* Override props for the submit Button
*/
submitButtonProps?: ButtonProps;
submitButtonProps?: Omit<ButtonProps, 'compact'>;

/**
* Event handler called when the form is submitted
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ import Button, { ButtonProps } from '@leafygreen-ui/button';
* @internal
*/
export const CustomSelectMenuButton = React.forwardRef(
({ children, ...props }: ButtonProps, ref) => (
<Button {...props} ref={ref}>
{children}
</Button>
(props: ButtonProps, ref) => (
<Button {...props} ref={ref} />
),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ export type Variant = (typeof Variant)[keyof typeof Variant];
interface CustomButtonOnClick {
onClick?: () => void;
}
type CustomConfirmButtonProps = Omit<ButtonProps, 'variant' | 'onClick'> &
type CustomConfirmButtonProps = Omit<ButtonProps, 'variant' | 'onClick' | 'compact'> &
CustomButtonOnClick;
type CustomCancelButtonProps = Omit<ButtonProps, 'onClick' | 'children'> &
type CustomCancelButtonProps = Omit<ButtonProps, 'onClick' | 'children' | 'compact'> &
CustomButtonOnClick;

export interface ConfirmationModalProps extends Omit<ModalProps, 'size'> {
Expand Down
8 changes: 4 additions & 4 deletions packages/form-footer/src/FormFooter.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { DarkModeProps, HTMLElementProps } from '@leafygreen-ui/lib';

import { PrimaryButtonProps } from './PrimaryButton';

type ButtonPropsOmittingVariant = Omit<ButtonProps, 'variant'>;
type ButtonPropsOmittingVariantAndCompact = Omit<ButtonProps, 'variant' | 'compact'>;
type ButtonPropsWithRequiredChildren = Required<Pick<ButtonProps, 'children'>>;

export type CustomCancelButtonProps = ButtonPropsOmittingVariant;
export type CustomBackButtonProps = ButtonPropsOmittingVariant & {
export type CustomCancelButtonProps = ButtonPropsOmittingVariantAndCompact;
export type CustomBackButtonProps = ButtonPropsOmittingVariantAndCompact & {
variant?: Extract<Variant, 'default' | 'dangerOutline'>;
};
export type CustomPrimaryButtonProps = ButtonPropsOmittingVariant &
export type CustomPrimaryButtonProps = ButtonPropsOmittingVariantAndCompact &
ButtonPropsWithRequiredChildren & {
variant?: Extract<Variant, 'primary' | 'danger'>;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ export type UnitSelectButtonProps = {
* The select option that is shown in the select menu button.
*/
displayName?: string;
} & ButtonProps &
} & Omit<ButtonProps, 'compact'> &
PopoverProps;
2 changes: 1 addition & 1 deletion packages/split-button/src/SplitButton/SplitButton.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export interface MenuProps extends SelectedMenuProps {

export interface SplitButtonProps
extends DarkModeProps,
ButtonProps,
Omit<ButtonProps, 'compact'>,
MenuProps {
/**
* Sets the variant for both Buttons.
Expand Down

0 comments on commit 7a8b60c

Please sign in to comment.