Fix Avatar types to follow OwnProps pattern
Make AvatarOwnProps the source of truth with inline type definitions, and have AvatarProps extend it. This follows the established pattern used by Button, Checkbox, and Alert components. Export AvatarOwnProps from the package entry point. Signed-off-by: Johan Persson <johanopersson@gmail.com>
This commit is contained in:
@@ -281,12 +281,23 @@ export const AvatarDefinition: {
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export interface AvatarProps extends React.ComponentPropsWithoutRef<'div'> {
|
||||
name: string;
|
||||
purpose?: 'decoration' | 'informative';
|
||||
size?: 'x-small' | 'small' | 'medium' | 'large' | 'x-large';
|
||||
export type AvatarOwnProps = {
|
||||
src: string;
|
||||
}
|
||||
name: string;
|
||||
size?: 'x-small' | 'small' | 'medium' | 'large' | 'x-large';
|
||||
purpose?: 'decoration' | 'informative';
|
||||
children?: React.ReactNode;
|
||||
className?: string;
|
||||
style?: React.CSSProperties;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export interface AvatarProps
|
||||
extends Omit<
|
||||
React.ComponentPropsWithoutRef<'div'>,
|
||||
'children' | 'className' | 'style'
|
||||
>,
|
||||
AvatarOwnProps {}
|
||||
|
||||
// @public (undocumented)
|
||||
export interface BgContextValue {
|
||||
|
||||
@@ -16,4 +16,4 @@
|
||||
|
||||
export { Avatar } from './Avatar';
|
||||
export { AvatarDefinition } from './definition';
|
||||
export type { AvatarProps } from './types';
|
||||
export type { AvatarOwnProps, AvatarProps } from './types';
|
||||
|
||||
@@ -16,17 +16,6 @@
|
||||
|
||||
/** @public */
|
||||
export type AvatarOwnProps = {
|
||||
size?: AvatarProps['size'];
|
||||
purpose?: AvatarProps['purpose'];
|
||||
src: string;
|
||||
name: string;
|
||||
children?: React.ReactNode;
|
||||
className?: string;
|
||||
style?: React.CSSProperties;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export interface AvatarProps extends React.ComponentPropsWithoutRef<'div'> {
|
||||
/**
|
||||
* URL of the image to display
|
||||
*/
|
||||
@@ -50,4 +39,16 @@ export interface AvatarProps extends React.ComponentPropsWithoutRef<'div'> {
|
||||
* @defaultValue 'informative'
|
||||
*/
|
||||
purpose?: 'decoration' | 'informative';
|
||||
}
|
||||
|
||||
children?: React.ReactNode;
|
||||
className?: string;
|
||||
style?: React.CSSProperties;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export interface AvatarProps
|
||||
extends Omit<
|
||||
React.ComponentPropsWithoutRef<'div'>,
|
||||
'children' | 'className' | 'style'
|
||||
>,
|
||||
AvatarOwnProps {}
|
||||
|
||||
Reference in New Issue
Block a user