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": "minor",
"comment": "chore: deprecates AvatarSizes in favor of AvatarSize",
"packageName": "@fluentui/react-avatar",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "chore(react-avatar): deprecates AvatarSizes in favor of AvatarSize",
"packageName": "@fluentui/react-components",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "chore(react-table): switch AvatarSizes in favor of AvatarSize",
"packageName": "@fluentui/react-table",
"email": "[email protected]",
"dependentChangeType": "patch"
}
15 changes: 9 additions & 6 deletions packages/react-components/react-avatar/etc/react-avatar.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const AvatarContextProvider: React_2.Provider<AvatarContextValue | undefi
// @internal (undocumented)
export interface AvatarContextValue {
// (undocumented)
size?: AvatarSizes;
size?: AvatarSize;
}

// @public
Expand Down Expand Up @@ -72,7 +72,7 @@ export type AvatarGroupItemSlots = {
export type AvatarGroupItemState = ComponentState<AvatarGroupItemSlots> & {
isOverflowItem?: boolean;
layout: AvatarGroupProps['layout'];
size: AvatarSizes;
size: AvatarSize;
};

// @public
Expand Down Expand Up @@ -101,13 +101,13 @@ export type AvatarGroupPopoverSlots = {
export type AvatarGroupPopoverState = ComponentState<AvatarGroupPopoverSlots> & Required<Pick<AvatarGroupPopoverProps, 'count' | 'indicator'>> & {
popoverOpen: boolean;
layout: AvatarGroupProps['layout'];
size: AvatarSizes;
size: AvatarSize;
};

// @public
export type AvatarGroupProps = ComponentProps<AvatarGroupSlots> & {
layout?: 'spread' | 'stack' | 'pie';
size?: AvatarSizes;
size?: AvatarSize;
};

// @public (undocumented)
Expand All @@ -132,11 +132,14 @@ export type AvatarProps = Omit<ComponentProps<AvatarSlots>, 'color'> & {
idForColor?: string | undefined;
name?: string;
shape?: 'circular' | 'square';
size?: AvatarSizes;
size?: AvatarSize;
};

// @public
export type AvatarSizes = 16 | 20 | 24 | 28 | 32 | 36 | 40 | 48 | 56 | 64 | 72 | 96 | 120 | 128;
export type AvatarSize = 16 | 20 | 24 | 28 | 32 | 36 | 40 | 48 | 56 | 64 | 72 | 96 | 120 | 128;

// @public @deprecated
export type AvatarSizes = AvatarSize;

// @public (undocumented)
export type AvatarSlots = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utili

/**
* Sizes for the avatar
* @deprecated use AvatarSize instead
*/
export type AvatarSizes = 16 | 20 | 24 | 28 | 32 | 36 | 40 | 48 | 56 | 64 | 72 | 96 | 120 | 128;
export type AvatarSizes = AvatarSize;
/**
* Sizes for the avatar
*/
export type AvatarSize = 16 | 20 | 24 | 28 | 32 | 36 | 40 | 48 | 56 | 64 | 72 | 96 | 120 | 128;

export type AvatarSlots = {
root: Slot<'span'>;
Expand Down Expand Up @@ -142,7 +147,7 @@ export type AvatarProps = Omit<ComponentProps<AvatarSlots>, 'color'> & {
*
* @default 32
*/
size?: AvatarSizes;
size?: AvatarSize;
};

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { AvatarSizes } from '../Avatar/Avatar.types';
import type { AvatarSize } from '../Avatar/Avatar.types';
import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';

export type AvatarGroupSlots = {
Expand All @@ -19,7 +19,7 @@ export type AvatarGroupProps = ComponentProps<AvatarGroupSlots> & {
* Size of the AvatarGroupItems.
* @default 32
*/
size?: AvatarSizes;
size?: AvatarSize;
};

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AvatarGroupProps } from '../AvatarGroup/AvatarGroup.types';
import type { Avatar, AvatarSizes } from '../../Avatar';
import type { Avatar, AvatarSize } from '../../Avatar';
import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';

export type AvatarGroupItemSlots = {
Expand Down Expand Up @@ -34,5 +34,5 @@ export type AvatarGroupItemState = ComponentState<AvatarGroupItemSlots> & {
isOverflowItem?: boolean;

layout: AvatarGroupProps['layout'];
size: AvatarSizes;
size: AvatarSize;
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useSizeStyles } from '../../Avatar';
import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
import type { AvatarGroupItemSlots, AvatarGroupItemState } from './AvatarGroupItem.types';
import type { AvatarGroupProps } from '../../AvatarGroup';
import type { AvatarSizes } from '../../Avatar';
import type { AvatarSize } from '../../Avatar';
import type { SlotClassNames } from '@fluentui/react-utilities';

export const avatarGroupItemClassNames: SlotClassNames<AvatarGroupItemSlots> = {
Expand Down Expand Up @@ -228,7 +228,7 @@ export const useAvatarGroupItemStyles_unstable = (state: AvatarGroupItemState):
* Hook for getting the className for the children of AvatarGroup. This hook will provide the spacing and outlines
* needed for each layout.
*/
export const useGroupChildClassName = (layout: AvatarGroupProps['layout'], size: AvatarSizes): string => {
export const useGroupChildClassName = (layout: AvatarGroupProps['layout'], size: AvatarSize): string => {
const stackStyles = useStackStyles();
const spreadStyles = useSpreadStyles();
const layoutClasses = [];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import type { AvatarSizes } from '../Avatar/Avatar.types';
import type { AvatarSize } from '../Avatar/Avatar.types';
import type { AvatarGroupProps } from '../AvatarGroup/AvatarGroup.types';
import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
import type { PopoverProps, PopoverSurface } from '@fluentui/react-popover';
Expand Down Expand Up @@ -58,5 +58,5 @@ export type AvatarGroupPopoverState = ComponentState<AvatarGroupPopoverSlots> &
Required<Pick<AvatarGroupPopoverProps, 'count' | 'indicator'>> & {
popoverOpen: boolean;
layout: AvatarGroupProps['layout'];
size: AvatarSizes;
size: AvatarSize;
};
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import * as React from 'react';
import { AvatarSizes } from '../components/Avatar/Avatar.types';
import { AvatarSize } from '../components/Avatar/Avatar.types';
Copy link
Contributor

Choose a reason for hiding this comment

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

nit:

Suggested change
import { AvatarSize } from '../components/Avatar/Avatar.types';
import type { AvatarSize } from '../components/Avatar/Avatar.types';


const avatarContext = React.createContext<AvatarContextValue | undefined>(undefined);

/**
* @internal
*/
export interface AvatarContextValue {
size?: AvatarSizes;
size?: AvatarSize;
}

const avatarContextDefaultValue: AvatarContextValue = {};
Expand Down
3 changes: 2 additions & 1 deletion packages/react-components/react-avatar/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ export {
useAvatarStyles_unstable,
useAvatar_unstable,
} from './Avatar';
export type { AvatarNamedColor, AvatarProps, AvatarSlots, AvatarState, AvatarSizes } from './Avatar';
// eslint-disable-next-line deprecation/deprecation
export type { AvatarNamedColor, AvatarProps, AvatarSlots, AvatarState, AvatarSizes, AvatarSize } from './Avatar';
export { getInitials, partitionAvatarGroupItems } from './utils/index';
export type { PartitionAvatarGroupItems, PartitionAvatarGroupItemsOptions } from './utils/index';
export {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
makeStyles,
partitionAvatarGroupItems,
} from '@fluentui/react-components';
import type { AvatarSizes } from '@fluentui/react-components';
import type { AvatarSize } from '@fluentui/react-components';

const useStyles = makeStyles({
root: {
Expand All @@ -30,7 +30,7 @@ const names = [
'Elliot Woodward',
];

const sizes: AvatarSizes[] = [16, 20, 24, 28, 32, 36, 40, 48, 56, 64, 72, 96, 120, 128];
const sizes: AvatarSize[] = [16, 20, 24, 28, 32, 36, 40, 48, 56, 64, 72, 96, 120, 128];

export const SizePie = () => {
const styles = useStyles();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
makeStyles,
partitionAvatarGroupItems,
} from '@fluentui/react-components';
import type { AvatarSizes } from '@fluentui/react-components';
import type { AvatarSize } from '@fluentui/react-components';

const useStyles = makeStyles({
root: {
Expand All @@ -30,7 +30,7 @@ const names = [
'Elliot Woodward',
];

const sizes: AvatarSizes[] = [16, 20, 24, 28, 32, 36, 40, 48, 56, 64, 72, 96, 120, 128];
const sizes: AvatarSize[] = [16, 20, 24, 28, 32, 36, 40, 48, 56, 64, 72, 96, 120, 128];

export const SizeSpread = () => {
const styles = useStyles();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
makeStyles,
partitionAvatarGroupItems,
} from '@fluentui/react-components';
import type { AvatarSizes } from '@fluentui/react-components';
import type { AvatarSize } from '@fluentui/react-components';

const useStyles = makeStyles({
root: {
Expand All @@ -30,7 +30,7 @@ const names = [
'Elliot Woodward',
];

const sizes: AvatarSizes[] = [16, 20, 24, 28, 32, 36, 40, 48, 56, 64, 72, 96, 120, 128];
const sizes: AvatarSize[] = [16, 20, 24, 28, 32, 36, 40, 48, 56, 64, 72, 96, 120, 128];

export const SizeStack = () => {
const styles = useStyles();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ import { AvatarGroupSlots } from '@fluentui/react-avatar';
import { AvatarGroupState } from '@fluentui/react-avatar';
import { AvatarNamedColor } from '@fluentui/react-avatar';
import { AvatarProps } from '@fluentui/react-avatar';
import { AvatarSize } from '@fluentui/react-avatar';
import { AvatarSizes } from '@fluentui/react-avatar';
import { AvatarSlots } from '@fluentui/react-avatar';
import { AvatarState } from '@fluentui/react-avatar';
Expand Down Expand Up @@ -817,6 +818,8 @@ export { AvatarNamedColor }

export { AvatarProps }

export { AvatarSize }

export { AvatarSizes }

export { AvatarSlots }
Expand Down
3 changes: 3 additions & 0 deletions packages/react-components/react-components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,10 @@ export {
export type {
AvatarNamedColor,
AvatarProps,
// AvatarSizes is deprecated but removing it would be a breaking change
// eslint-disable-next-line deprecation/deprecation
AvatarSizes,
AvatarSize,
AvatarSlots,
AvatarState,
AvatarGroupProps,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/// <reference types="react" />

import { ARIAButtonSlotProps } from '@fluentui/react-aria';
import type { AvatarSizes } from '@fluentui/react-avatar';
import type { AvatarSize } from '@fluentui/react-avatar';
import type { Checkbox } from '@fluentui/react-checkbox';
import type { CheckboxProps } from '@fluentui/react-checkbox';
import type { ComponentProps } from '@fluentui/react-utilities';
Expand Down Expand Up @@ -302,7 +302,7 @@ export type TableCellLayoutSlots = {

// @public
export type TableCellLayoutState = ComponentState<TableCellLayoutSlots> & Pick<TableCellLayoutProps, 'appearance'> & {
avatarSize: AvatarSizes | undefined;
avatarSize: AvatarSize | undefined;
} & Pick<TableContextValue, 'size'>;

// @public
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
import type { AvatarSizes } from '@fluentui/react-avatar';
import type { AvatarSize } from '@fluentui/react-avatar';
import { TableContextValue } from '../Table/Table.types';

export type TableCellLayoutContextValues = {
avatar: {
size?: AvatarSizes;
size?: AvatarSize;
};
};

Expand Down Expand Up @@ -47,4 +47,4 @@ export type TableCellLayoutProps = ComponentProps<Partial<TableCellLayoutSlots>>
* State used in rendering TableCellLayout
*/
export type TableCellLayoutState = ComponentState<TableCellLayoutSlots> &
Pick<TableCellLayoutProps, 'appearance'> & { avatarSize: AvatarSizes | undefined } & Pick<TableContextValue, 'size'>;
Pick<TableCellLayoutProps, 'appearance'> & { avatarSize: AvatarSize | undefined } & Pick<TableContextValue, 'size'>;
4 changes: 2 additions & 2 deletions packages/react-components/react-tree/etc/react-tree.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/// <reference types="react" />

import type { AvatarContextValue } from '@fluentui/react-avatar';
import type { AvatarSizes } from '@fluentui/react-avatar';
import type { AvatarSize } from '@fluentui/react-avatar';
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 @@ -94,7 +94,7 @@ export type TreeItemPersonaLayoutSlots = {

// @public
export type TreeItemPersonaLayoutState = ComponentState<TreeItemPersonaLayoutSlots> & TreeItemContextValue & {
avatarSize: AvatarSizes;
avatarSize: AvatarSize;
};

// @public
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
import type { AvatarContextValue, AvatarSizes } from '@fluentui/react-avatar';
import type { AvatarContextValue, AvatarSize } from '@fluentui/react-avatar';
import type { TreeItemContextValue } from '../../contexts/treeItemContext';

export type TreeItemPersonaLayoutContextValues = {
Expand Down Expand Up @@ -40,5 +40,5 @@ export type TreeItemPersonaLayoutProps = ComponentProps<Partial<TreeItemPersonaL
*/
export type TreeItemPersonaLayoutState = ComponentState<TreeItemPersonaLayoutSlots> &
TreeItemContextValue & {
avatarSize: AvatarSizes;
avatarSize: AvatarSize;
};