Skip to content
Draft
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
Expand Up @@ -6,6 +6,7 @@

Copy link
Copy Markdown

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/Charts-DonutChart 3 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Charts-DonutChart.Dynamic - RTL.default.chromium.png 5570 Changed
vr-tests-react-components/Charts-DonutChart.Dynamic - Dark Mode.default.chromium.png 7530 Changed
vr-tests-react-components/Charts-DonutChart.Dynamic.default.chromium.png 5581 Changed
vr-tests-react-components/Dialog 4 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Dialog.title custom action - Dark Mode.chromium.png 98 Changed
vr-tests-react-components/Dialog.title custom action - High Contrast.chromium.png 145 Changed
vr-tests-react-components/Dialog.non-modal - High Contrast.chromium.png 53 Changed
vr-tests-react-components/Dialog.title custom action.chromium.png 107 Changed
vr-tests-react-components/Menu Converged - submenuIndicator slotted content 2 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/Menu Converged - submenuIndicator slotted content.default.submenus open.chromium.png 413 Changed
vr-tests-react-components/Positioning 2 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Positioning.Positioning end.chromium.png 515 Changed
vr-tests-react-components/Positioning.Positioning end.updated 2 times.chromium.png 731 Changed
vr-tests-react-components/ProgressBar converged 3 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/ProgressBar converged.Indeterminate + thickness - Dark Mode.default.chromium.png 103 Changed
vr-tests-react-components/ProgressBar converged.Indeterminate + thickness - High Contrast.default.chromium.png 116 Changed
vr-tests-react-components/ProgressBar converged.Indeterminate + thickness.default.chromium.png 37 Changed
vr-tests-react-components/TagPicker 3 screenshots
Image Name Diff(in Pixels) Image Type
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
vr-tests-react-components/TagPicker.disabled.chromium.png 677 Changed

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

import { ARIAButtonResultProps } from '@fluentui/react-aria';
import { ARIAButtonType } from '@fluentui/react-aria';
import type { ButtonProps } from '@fluentui/react-button';
import type { ComponentProps } from '@fluentui/react-utilities';
import type { ComponentState } from '@fluentui/react-utilities';
import { ContextSelector } from '@fluentui/react-context-selector';
Expand Down Expand Up @@ -213,7 +214,9 @@ export const DialogTitle: ForwardRefComponent<DialogTitleProps>;
export const dialogTitleClassNames: SlotClassNames<DialogTitleSlots>;

// @public
export type DialogTitleProps = ComponentProps<DialogTitleSlots>;
export type DialogTitleProps = ComponentProps<DialogTitleSlots> & {
closeButton?: ButtonProps;
};

// @public (undocumented)
export type DialogTitleSlots = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
import type { ButtonProps } from '@fluentui/react-button';

export type DialogTitleSlots = {
/**
Expand All @@ -15,7 +16,14 @@ export type DialogTitleSlots = {
/**
* DialogTitle Props
*/
export type DialogTitleProps = ComponentProps<DialogTitleSlots>;
export type DialogTitleProps = ComponentProps<DialogTitleSlots> & {
/**
* Props to customise the default close button rendered in the `action` slot
* for non-modal dialogs. Has no effect when `action` is explicitly provided.
* Use `action` to replace close button with other action element.
*/
closeButton?: ButtonProps;
};

/**
* State used in rendering DialogTitle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import * as React from 'react';
import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';
import type { DialogTitleProps, DialogTitleState } from './DialogTitle.types';
import { useDialogContext_unstable } from '../../contexts/dialogContext';
import { Dismiss20Regular } from '@fluentui/react-icons';
import { Dismiss16Regular } from '@fluentui/react-icons';
import { Button } from '@fluentui/react-button';
import { DialogTrigger } from '../DialogTrigger/DialogTrigger';
import { useDialogTitleInternalStyles } from './useDialogTitleStyles.styles';

/**
* Create the state required to render DialogTitle.
Expand All @@ -18,9 +18,8 @@ import { useDialogTitleInternalStyles } from './useDialogTitleStyles.styles';
* @param ref - reference to root HTMLElement of DialogTitle
*/
export const useDialogTitle_unstable = (props: DialogTitleProps, ref: React.Ref<HTMLDivElement>): DialogTitleState => {
const { action } = props;
const { action, closeButton: closeButtonProps, ...restProps } = props;
const modalType = useDialogContext_unstable(ctx => ctx.modalType);
const internalStyles = useDialogTitleInternalStyles();

return {
components: {
Expand All @@ -31,7 +30,7 @@ export const useDialogTitle_unstable = (props: DialogTitleProps, ref: React.Ref<
getIntrinsicElementProps('h2', {
ref,
id: useDialogContext_unstable(ctx => ctx.dialogTitleId),
...props,
...restProps,
}),
{ elementType: 'h2' },
),
Expand All @@ -40,14 +39,13 @@ export const useDialogTitle_unstable = (props: DialogTitleProps, ref: React.Ref<
defaultProps: {
children: (
<DialogTrigger disableButtonEnhancement action="close">
<button
type="button"
className={internalStyles}
// TODO: find a better way to add internal labels
<Button
appearance="transparent"
aria-label="close"
>
<Dismiss20Regular />
</button>
icon={<Dismiss16Regular />}
size="small"
{...closeButtonProps}
/>
</DialogTrigger>
),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ const useStyles = makeStyles({
rootWithoutAction: {
gridColumnEnd: 4,
},
action: {
// Aligns the dismiss icon within the close button to the right edge of the body container.
// This only applies to the dismiss icon with close button in size small.
// Custom styling may be needed for other icons or sizes.
marginRight: '-8px',
},
});

/**
Expand Down Expand Up @@ -79,7 +85,12 @@ export const useDialogTitleStyles_unstable = (state: DialogTitleState): DialogTi
);

if (state.action) {
state.action.className = mergeClasses(dialogTitleClassNames.action, actionResetStyles, state.action.className);
state.action.className = mergeClasses(
dialogTitleClassNames.action,
actionResetStyles,
styles.action,
state.action.className,
);
}

return state;
Expand Down
Loading