Skip to content

Commit

Permalink
extend HTMLAttributes type
Browse files Browse the repository at this point in the history
  • Loading branch information
siriwatknp committed Aug 5, 2024
1 parent 69a550a commit b9fcdef
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/pigment-css-react/src/Box.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export type PolymorphicComponentProps<
AsTarget extends React.ElementType | undefined,
AsTargetProps extends object = AsTarget extends React.ElementType
? React.ComponentPropsWithRef<AsTarget>
: BaseDefaultProps,
: React.HTMLAttributes<HTMLElement>,
> = NoInfer<Omit<Substitute<BaseProps, AsTargetProps>, 'as' | 'component'>> & {
/**
* The component used for the root node.
Expand Down Expand Up @@ -37,6 +37,6 @@ export interface PolymorphicComponent<BaseProps extends BaseDefaultProps>
): React.JSX.Element;
}

declare const Box: PolymorphicComponent<{}>;
declare const Box: PolymorphicComponent<React.DetailsHTMLAttributes<HTMLDivElement>>;

export default Box;
4 changes: 3 additions & 1 deletion packages/pigment-css-react/src/Container.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ type ContainerBaseProps = {
maxWidth?: Breakpoint | false;
};

declare const Container: PolymorphicComponent<ContainerBaseProps>;
declare const Container: PolymorphicComponent<
ContainerBaseProps & React.DetailsHTMLAttributes<HTMLDivElement>
>;

export default Container;
4 changes: 3 additions & 1 deletion packages/pigment-css-react/src/Grid.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ type GridBaseProps = {
wrap?: 'nowrap' | 'wrap' | 'wrap-reverse';
};

declare const Grid: PolymorphicComponent<GridBaseProps>;
declare const Grid: PolymorphicComponent<
GridBaseProps & React.DetailsHTMLAttributes<HTMLDivElement>
>;

export default Grid;
4 changes: 3 additions & 1 deletion packages/pigment-css-react/src/Hidden.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ interface HiddenBaseProps extends HiddenUp, HiddenDown {
only?: Breakpoint | Breakpoint[];
}

declare const Hidden: PolymorphicComponent<HiddenBaseProps>;
declare const Hidden: PolymorphicComponent<
HiddenBaseProps & React.DetailsHTMLAttributes<HTMLDivElement>
>;

export default Hidden;
4 changes: 3 additions & 1 deletion packages/pigment-css-react/src/Stack.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ type StackBaseProps = {
className?: string;
};

declare const Stack: PolymorphicComponent<StackBaseProps>;
declare const Stack: PolymorphicComponent<
StackBaseProps & React.DetailsHTMLAttributes<HTMLDivElement>
>;

export default Stack;

0 comments on commit b9fcdef

Please sign in to comment.