Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "fix(react-infobutton): Making InfoButton's PopoverSurface inline by default.",
"packageName": "@fluentui/react-infobutton",
"email": "esteban.230@hotmail.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const infoButtonClassNames: SlotClassNames<InfoButtonSlots>;
// @public
export type InfoButtonProps = Omit<ComponentProps<Partial<InfoButtonSlots>>, 'disabled'> & {
size?: 'small' | 'medium' | 'large';
inline?: boolean;
};

// @public (undocumented)
Expand All @@ -35,7 +36,7 @@ export type InfoButtonSlots = {
};

// @public
export type InfoButtonState = ComponentState<InfoButtonSlots> & Required<Pick<InfoButtonProps, 'size'>>;
export type InfoButtonState = ComponentState<InfoButtonSlots> & Required<Pick<InfoButtonProps, 'inline' | 'size'>>;

// @public
export const InfoLabel: ForwardRefComponent<InfoLabelProps>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,16 @@ export type InfoButtonProps = Omit<ComponentProps<Partial<InfoButtonSlots>>, 'di
* @default medium
*/
size?: 'small' | 'medium' | 'large';

/**
* Whether the InfoButton should be rendered inline or on a Portal.
*
* @default true
*/
inline?: boolean;
};

/**
* State used in rendering InfoButton
*/
export type InfoButtonState = ComponentState<InfoButtonSlots> & Required<Pick<InfoButtonProps, 'size'>>;
export type InfoButtonState = ComponentState<InfoButtonSlots> & Required<Pick<InfoButtonProps, 'inline' | 'size'>>;
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ const popoverSizeMap = {
* @param ref - reference to root HTMLElement of InfoButton
*/
export const useInfoButton_unstable = (props: InfoButtonProps, ref: React.Ref<HTMLElement>): InfoButtonState => {
const { size = 'medium' } = props;
const { size = 'medium', inline = true } = props;

const state: InfoButtonState = {
inline,
size,

components: {
Expand All @@ -50,6 +51,7 @@ export const useInfoButton_unstable = (props: InfoButtonProps, ref: React.Ref<HT
),
popover: slot.always(props.popover, {
defaultProps: {
inline,
positioning: 'above-start',
size: popoverSizeMap[size],
withArrow: true,
Expand Down