Skip to content
Open
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 @@
{
Copy link

@github-actions github-actions bot Mar 25, 2026

Choose a reason for hiding this comment

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

🕵🏾‍♀️ visual changes to review in the Visual Change Report

vr-tests-react-components/CalendarCompat 4 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/CalendarCompat.multiDayView.default.chromium_1.png 481 Changed
vr-tests-react-components/CalendarCompat.multiDayView - High Contrast.default.chromium.png 1201 Changed
vr-tests-react-components/CalendarCompat.multiDayView - Dark Mode.default.chromium.png 1099 Changed
vr-tests-react-components/CalendarCompat.multiDayView - RTL.default.chromium.png 481 Changed
vr-tests-react-components/Charts-DonutChart 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Charts-DonutChart.Dynamic.default.chromium.png 5581 Changed
vr-tests-react-components/Menu Converged - submenuIndicator slotted content 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Menu Converged - submenuIndicator slotted content.default - RTL.submenus open.chromium.png 404 Changed
vr-tests-react-components/Positioning 2 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Positioning.Positioning end.chromium.png 856 Changed
vr-tests-react-components/Positioning.Positioning end.updated 2 times.chromium.png 131 Changed
vr-tests-react-components/Skeleton converged 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Skeleton converged.Opaque Skeleton with rectangle - Dark Mode.default.chromium.png 9 Changed
vr-tests-react-components/TagPicker 3 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/TagPicker.disabled - High Contrast.disabled input hover.chromium.png 1319 Changed
vr-tests-react-components/TagPicker.disabled - Dark Mode.disabled input hover.chromium.png 658 Changed
vr-tests-react-components/TagPicker.disabled - RTL.disabled input hover.chromium.png 635 Changed

There were 4 duplicate changes discarded. Check the build logs for more information.

"type": "minor",
"comment": "feat(react-message-bar): add useMessageBarBase_unstable hook",
"packageName": "@fluentui/react-message-bar",
"email": "dmytrokirpa@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import type { ButtonContextValue } from '@fluentui/react-button';
import type { ComponentProps } from '@fluentui/react-utilities';
import type { ComponentState } from '@fluentui/react-utilities';
import type { DistributiveOmit } from '@fluentui/react-utilities';
import type { ForwardRefComponent } from '@fluentui/react-utilities';
import type { JSXElement } from '@fluentui/react-utilities';
import * as React_2 from 'react';
Expand Down Expand Up @@ -41,6 +42,12 @@ export type MessageBarActionsState = ComponentState<MessageBarActionsSlots> & Pi
hasActions: boolean;
};

// @public (undocumented)
export type MessageBarBaseProps = DistributiveOmit<MessageBarProps, 'shape'>;

// @public (undocumented)
export type MessageBarBaseState = DistributiveOmit<MessageBarState, 'shape'>;

// @public
export const MessageBarBody: ForwardRefComponent<MessageBarBodyProps>;

Expand Down Expand Up @@ -156,7 +163,7 @@ export type MessageBarTransitionContextValue = {
};

// @public
export const renderMessageBar_unstable: (state: MessageBarState, contexts: MessageBarContextValues) => JSXElement;
export const renderMessageBar_unstable: (state: MessageBarBaseState, contexts: MessageBarContextValues) => JSXElement;

// @public
export const renderMessageBarActions_unstable: (state: MessageBarActionsState, contexts: MessageBarActionsContextValues) => JSXElement;
Expand All @@ -182,6 +189,9 @@ export function useMessageBarActionsContextValue_unstable(): MessageBarActionsCo
// @public
export const useMessageBarActionsStyles_unstable: (state: MessageBarActionsState) => MessageBarActionsState;

// @public
export const useMessageBarBase_unstable: (props: MessageBarBaseProps, ref: React_2.Ref<HTMLDivElement>) => MessageBarBaseState;

// @public
export const useMessageBarBody_unstable: (props: MessageBarBodyProps, ref: React_2.Ref<HTMLDivElement>) => MessageBarBodyState;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export type {
MessageBarBaseProps,
MessageBarBaseState,
MessageBarContextValues,
MessageBarIntent,
MessageBarProps,
Expand All @@ -11,5 +13,6 @@ export {
renderMessageBar_unstable,
useMessageBarContextValue_unstable,
useMessageBarStyles_unstable,
useMessageBarBase_unstable,
useMessageBar_unstable,
} from './components/MessageBar/index';
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
import type { ComponentProps, ComponentState, DistributiveOmit, Slot } from '@fluentui/react-utilities';
import type { MessageBarContextValue } from '../../contexts/messageBarContext';

export type MessageBarSlots = {
Expand Down Expand Up @@ -53,3 +53,6 @@ export type MessageBarState = ComponentState<MessageBarSlots> &
*/
transitionClassName: string;
};

export type MessageBarBaseProps = DistributiveOmit<MessageBarProps, 'shape'>;
export type MessageBarBaseState = DistributiveOmit<MessageBarState, 'shape'>;
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
export { MessageBar } from './MessageBar';
export type {
MessageBarBaseProps,
MessageBarBaseState,
MessageBarContextValues,
MessageBarIntent,
MessageBarProps,
MessageBarSlots,
MessageBarState,
} from './MessageBar.types';
export { renderMessageBar_unstable } from './renderMessageBar';
export { useMessageBar_unstable } from './useMessageBar';
export { useMessageBarBase_unstable, useMessageBar_unstable } from './useMessageBar';
export { messageBarClassNames, useMessageBarStyles_unstable } from './useMessageBarStyles.styles';
export { useMessageBarContextValue_unstable } from './useMessageBarContextValues';
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@

import { assertSlots } from '@fluentui/react-utilities';
import type { JSXElement } from '@fluentui/react-utilities';
import type { MessageBarState, MessageBarSlots, MessageBarContextValues } from './MessageBar.types';
import type { MessageBarBaseState, MessageBarSlots, MessageBarContextValues } from './MessageBar.types';
import { MessageBarContextProvider } from '../../contexts/messageBarContext';

/**
* Render the final JSX of MessageBar
*/
export const renderMessageBar_unstable = (state: MessageBarState, contexts: MessageBarContextValues): JSXElement => {
export const renderMessageBar_unstable = (
state: MessageBarBaseState,
contexts: MessageBarContextValues,
): JSXElement => {
assertSlots<MessageBarSlots>(state);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
import * as React from 'react';
import { getIntrinsicElementProps, slot, useId, useMergedRefs } from '@fluentui/react-utilities';
import { useAnnounce } from '@fluentui/react-shared-contexts';
import type { MessageBarProps, MessageBarState } from './MessageBar.types';
import type { MessageBarBaseProps, MessageBarBaseState, MessageBarProps, MessageBarState } from './MessageBar.types';
import { getIntentIcon } from './getIntentIcon';
import { useMessageBarReflow } from './useMessageBarReflow';
import { useMessageBarTransitionContext } from '../../contexts/messageBarTransitionContext';
import { useMotionForwardedRef } from '@fluentui/react-motion';

/**
* Create the state required to render MessageBar.
*
* The returned state can be modified with hooks such as useMessageBarStyles_unstable,
* before being passed to renderMessageBar_unstable.
* Create the base state required to render MessageBar without design-specific props.
*
* @param props - props from this instance of MessageBar
* @param props - props from this instance of MessageBar (without shape)
* @param ref - reference to root HTMLElement of MessageBar
*/
export const useMessageBar_unstable = (props: MessageBarProps, ref: React.Ref<HTMLDivElement>): MessageBarState => {
const { layout = 'auto', intent = 'info', politeness, shape = 'rounded' } = props;
export const useMessageBarBase_unstable = (
props: MessageBarBaseProps,
ref: React.Ref<HTMLDivElement>,
): MessageBarBaseState => {
const { layout = 'auto', intent = 'info', politeness } = props;
const computedPoliteness = politeness ?? intent === 'info' ? 'polite' : 'assertive';
const autoReflow = layout === 'auto';
const { ref: reflowRef, reflowing } = useMessageBarReflow(autoReflow);
Expand Down Expand Up @@ -57,11 +57,9 @@ export const useMessageBar_unstable = (props: MessageBarProps, ref: React.Ref<HT
}),
{ elementType: 'div' },
),

icon: slot.optional(props.icon, {
renderByDefault: true,
elementType: 'div',
defaultProps: { children: getIntentIcon(intent) },
}),
bottomReflowSpacer: slot.optional(props.bottomReflowSpacer, {
renderByDefault: computedLayout === 'multiline',
Expand All @@ -73,6 +71,26 @@ export const useMessageBar_unstable = (props: MessageBarProps, ref: React.Ref<HT
actionsRef,
bodyRef,
titleId,
shape,
};
};

/**
* Create the state required to render MessageBar.
*
* The returned state can be modified with hooks such as useMessageBarStyles_unstable,
* before being passed to renderMessageBar_unstable.
*
* @param props - props from this instance of MessageBar
* @param ref - reference to root HTMLElement of MessageBar
*/
export const useMessageBar_unstable = (props: MessageBarProps, ref: React.Ref<HTMLDivElement>): MessageBarState => {
const { shape = 'rounded', ...baseProps } = props;

const state = useMessageBarBase_unstable(baseProps, ref);

if (state.icon) {
state.icon.children ??= getIntentIcon(state.intent);
}

return { ...state, shape };
};
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
export {
MessageBar,
useMessageBarStyles_unstable,
useMessageBarBase_unstable,
useMessageBar_unstable,
useMessageBarContextValue_unstable,
renderMessageBar_unstable,
messageBarClassNames,
} from './MessageBar';

export type {
MessageBarBaseProps,
MessageBarBaseState,
MessageBarProps,
MessageBarSlots,
MessageBarState,
Expand Down
Loading