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
Expand Up @@ -10,7 +10,7 @@ import { makeStyles, mergeClasses, shorthands } from '@griffel/react';
import { useMergedRefs } from '@fluentui/react-utilities';
import { tokens } from '@fluentui/react-theme';
import { storiesOf } from '@storybook/react';
import { useFluent } from '@fluentui/react-shared-contexts';
import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
import Screener from 'screener-storybook/src/screener';

const useStyles = makeStyles({
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "updates import to react-shared-components",
"packageName": "@fluentui/react-accordion",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "updates import to react-shared-components",
"packageName": "@fluentui/react-avatar",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "updates import to react-shared-components",
"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": "updates import to react-shared-components",
"packageName": "@fluentui/react-menu",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "updates import to react-shared-components",
"packageName": "@fluentui/react-popover",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "updates import to react-shared-components",
"packageName": "@fluentui/react-portal",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "updates import to react-shared-components",
"packageName": "@fluentui/react-portal-compat",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "updates import to react-shared-components",
"packageName": "@fluentui/react-positioning",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "updates import to react-shared-components, removes re-export to provider",
"packageName": "@fluentui/react-provider",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "mark context hooks and providers to unstable",
"packageName": "@fluentui/react-shared-contexts",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "updates import to react-shared-components",
"packageName": "@fluentui/react-slider",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "updates import to react-shared-components",
"packageName": "@fluentui/react-tabster",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "updates import to react-shared-components",
"packageName": "@fluentui/react-tooltip",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type { AccordionHeaderProps, AccordionHeaderState } from './AccordionHead
import { useContextSelector } from '@fluentui/react-context-selector';
import { AccordionContext } from '../Accordion/AccordionContext';
import { ChevronRightRegular } from '@fluentui/react-icons';
import { useFluent } from '@fluentui/react-shared-contexts';
import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';

/**
* Returns the props and state required to render the component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getInitials } from '../../utils/index';
import type { AvatarNamedColor, AvatarProps, AvatarState } from './Avatar.types';
import { PersonRegular } from '@fluentui/react-icons';
import { PresenceBadge } from '@fluentui/react-badge';
import { useFluent } from '@fluentui/react-shared-contexts';
import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
import { useMergedEventCallbacks } from '@fluentui/react-utilities';

export const useAvatar_unstable = (props: AvatarProps, ref: React.Ref<HTMLElement>): AvatarState => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ import { useCounterBadge_unstable } from '@fluentui/react-badge';
import { useCounterBadgeStyles_unstable } from '@fluentui/react-badge';
import { useDivider_unstable } from '@fluentui/react-divider';
import { useDividerStyles_unstable } from '@fluentui/react-divider';
import { useFluent } from '@fluentui/react-provider';
import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
import { useFluentProvider_unstable } from '@fluentui/react-provider';
import { useFluentProviderContextValues_unstable } from '@fluentui/react-provider';
import { useFluentProviderStyles_unstable } from '@fluentui/react-provider';
Expand Down Expand Up @@ -509,12 +509,13 @@ import { useText_unstable } from '@fluentui/react-text';
import { useTextarea_unstable } from '@fluentui/react-textarea';
import { useTextareaStyles_unstable } from '@fluentui/react-textarea';
import { useTextStyles_unstable } from '@fluentui/react-text';
import { useThemeClassName } from '@fluentui/react-shared-contexts';
import { useThemeClassName_unstable as useThemeClassName } from '@fluentui/react-shared-contexts';
import { useToggleButton_unstable } from '@fluentui/react-button';
import { useToggleButtonStyles_unstable } from '@fluentui/react-button';
import { useToggleState } from '@fluentui/react-button';
import { useTooltip_unstable } from '@fluentui/react-tooltip';
import { useTooltipStyles_unstable } from '@fluentui/react-tooltip';
import { useTooltipVisibility_unstable as useTooltipVisibility } from '@fluentui/react-shared-contexts';
import { VerticalSpacingTokens } from '@fluentui/react-theme';
import { webDarkTheme } from '@fluentui/react-theme';
import { webLightTheme } from '@fluentui/react-theme';
Expand Down Expand Up @@ -1529,6 +1530,7 @@ export { useTextareaStyles_unstable }

export { useTextStyles_unstable }


export { useThemeClassName }

export { useToggleButton_unstable }
Expand All @@ -1541,6 +1543,8 @@ export { useTooltip_unstable }

export { useTooltipStyles_unstable }

export { useTooltipVisibility }

export { VerticalSpacingTokens }

export { webDarkTheme }
Expand Down
7 changes: 5 additions & 2 deletions packages/react-components/react-components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export {
FluentProvider,
fluentProviderClassNames,
renderFluentProvider_unstable,
useFluent,
useFluentProvider_unstable,
useFluentProviderContextValues_unstable,
useFluentProviderStyles_unstable,
Expand Down Expand Up @@ -105,7 +104,11 @@ export type {
TypographyStyle,
TypographyStyles,
} from '@fluentui/react-theme';
export { useThemeClassName } from '@fluentui/react-shared-contexts';
export {
useFluent_unstable as useFluent,
Copy link
Contributor

Choose a reason for hiding this comment

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

why are we exporting those unstable apis from "stable" package ?

Copy link
Member

Choose a reason for hiding this comment

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

Those are part of react-components public API but we plan to refactor/remove react-shared-contexts - therefore unstable in react-shared-contexts but stable in react-components.
This PR has been created before we discussed @internal exports so we used the unstable pattern.

useTooltipVisibility_unstable as useTooltipVisibility,
useThemeClassName_unstable as useThemeClassName,
} from '@fluentui/react-shared-contexts';
export {
getNativeElementProps,
getPartitionedNativeProps,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { usePositioningMouseTarget, usePositioning, resolvePositioningShorthand } from '@fluentui/react-positioning';
import { useControllableState, useId, useOnClickOutside, useEventCallback } from '@fluentui/react-utilities';
import { useFluent } from '@fluentui/react-shared-contexts';
import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
import { elementContains } from '@fluentui/react-portal';
import { useFocusFinders } from '@fluentui/react-tabster';
import { useMenuContext_unstable } from '../../contexts/menuContext';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
useMergedRefs,
getNativeElementProps,
} from '@fluentui/react-utilities';
import { useFluent } from '@fluentui/react-shared-contexts';
import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
import { useCharacterSearch } from './useCharacterSearch';
import { useMenuTriggerContext_unstable } from '../../contexts/menuTriggerContext';
import { ChevronRightRegular as ChevronRightIcon, ChevronLeftRegular as ChevronLeftIcon } from '@fluentui/react-icons';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getNativeElementProps, useEventCallback, useMergedRefs } from '@fluentu
import { MenuPopoverProps, MenuPopoverState } from './MenuPopover.types';
import { useMenuContext_unstable } from '../../contexts/menuContext';
import { dispatchMenuEnterEvent } from '../../utils/index';
import { useFluent } from '@fluentui/react-shared-contexts';
import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
import { useIsSubmenu } from '../../utils/useIsSubmenu';

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { getNativeElementProps, getRTLSafeKey, useMergedRefs } from '@fluentui/react-utilities';
import { useFocusFinders } from '@fluentui/react-tabster';
import { useFluent } from '@fluentui/react-shared-contexts';
import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
import type { MenuSplitGroupProps, MenuSplitGroupState } from './MenuSplitGroup.types';
import { ArrowRight, ArrowLeft } from '@fluentui/keyboard-keys';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { MenuTriggerChildProps, MenuTriggerProps, MenuTriggerState } from './Men
import { useMenuContext_unstable } from '../../contexts/menuContext';
import { useIsSubmenu } from '../../utils/useIsSubmenu';
import { useFocusFinders } from '@fluentui/react-tabster';
import { useFluent } from '@fluentui/react-shared-contexts';
import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
import { ArrowRight, ArrowLeft, Escape, ArrowDown } from '@fluentui/keyboard-keys';
import {
applyTriggerPropsToChildren,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
useOnClickOutside,
useOnScrollOutside,
} from '@fluentui/react-utilities';
import { useFluent } from '@fluentui/react-shared-contexts';
import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
import {
usePositioning,
resolvePositioningShorthand,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ThemeClassNameContext } from '@fluentui/react-shared-contexts';
import { ThemeClassNameProvider_unstable as ThemeClassNameProvider } from '@fluentui/react-shared-contexts';
import { usePortalCompat } from '@fluentui/react-portal-compat-context';
import { FluentProvider } from '@fluentui/react-provider';
import { resetIdsForTests } from '@fluentui/react-utilities';
Expand Down Expand Up @@ -68,9 +68,9 @@ describe('PortalCompatProvider', () => {
const element = document.createElement('div');
const { result } = renderHook(() => usePortalCompat(), {
wrapper: props => (
<ThemeClassNameContext.Provider value="foo bar baz">
<ThemeClassNameProvider value="foo bar baz">
<PortalCompatProvider>{props.children}</PortalCompatProvider>
</ThemeClassNameContext.Provider>
</ThemeClassNameProvider>
),
});
result.current(element);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import * as React from 'react';
import { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';
import { useThemeClassName, useFluent } from '@fluentui/react-shared-contexts';
import {
useThemeClassName_unstable as useThemeClassName,
useFluent_unstable as useFluent,
} from '@fluentui/react-shared-contexts';
import { useKeyboardNavAttribute } from '@fluentui/react-tabster';

export type UsePortalMountNodeOptions = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEventCallback, useIsomorphicLayoutEffect, useFirstMount, canUseDOM } from '@fluentui/react-utilities';
import { useFluent } from '@fluentui/react-shared-contexts';
import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
import * as PopperJs from '@popperjs/core';
import * as React from 'react';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@
import { ComponentProps } from '@fluentui/react-utilities';
import type { ComponentState } from '@fluentui/react-utilities';
import type { PartialTheme } from '@fluentui/react-theme';
import type { ProviderContextValue } from '@fluentui/react-shared-contexts';
import type { ProviderContextValue_unstable } from '@fluentui/react-shared-contexts';
import * as React_2 from 'react';
import type { Slot } from '@fluentui/react-utilities';
import { SlotClassNames } from '@fluentui/react-utilities';
import { Theme } from '@fluentui/react-theme';
import type { ThemeClassNameContextValue } from '@fluentui/react-shared-contexts';
import type { ThemeContextValue } from '@fluentui/react-shared-contexts';
import type { TooltipContextType } from '@fluentui/react-shared-contexts';
import { useFluent } from '@fluentui/react-shared-contexts';
import type { ThemeClassNameContextValue_unstable } from '@fluentui/react-shared-contexts';
import type { ThemeContextValue_unstable } from '@fluentui/react-shared-contexts';
import type { TooltipVisibilityContextValue_unstable } from '@fluentui/react-shared-contexts';

// @public (undocumented)
export const FluentProvider: React_2.ForwardRefExoticComponent<Omit<ComponentProps<FluentProviderSlots, "root">, "dir"> & {
Expand All @@ -29,10 +28,10 @@ export const fluentProviderClassNames: SlotClassNames<FluentProviderSlots>;

// @public (undocumented)
export type FluentProviderContextValues = Pick<FluentProviderState, 'theme'> & {
provider: ProviderContextValue;
themeClassName: ThemeClassNameContextValue;
provider: ProviderContextValue_unstable;
themeClassName: ThemeClassNameContextValue_unstable;
textDirection: 'ltr' | 'rtl';
tooltip: TooltipContextType;
tooltip: TooltipVisibilityContextValue_unstable;
};

// @public (undocumented)
Expand All @@ -49,15 +48,13 @@ export type FluentProviderSlots = {

// @public (undocumented)
export type FluentProviderState = ComponentState<FluentProviderSlots> & Pick<FluentProviderProps, 'targetDocument'> & Required<Pick<FluentProviderProps, 'dir'>> & {
theme: ThemeContextValue;
theme: ThemeContextValue_unstable;
themeClassName: string;
};

// @public
export const renderFluentProvider_unstable: (state: FluentProviderState, contextValues: FluentProviderContextValues) => JSX.Element;

export { useFluent }

// @public
export const useFluentProvider_unstable: (props: FluentProviderProps, ref: React_2.Ref<HTMLElement>) => FluentProviderState;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type {
ProviderContextValue,
TooltipContextType,
ThemeClassNameContextValue,
ThemeContextValue,
ProviderContextValue_unstable as ProviderContextValue,
TooltipVisibilityContextValue_unstable as TooltipVisibilityContextValue,
ThemeClassNameContextValue_unstable as ThemeClassNameContextValue,
ThemeContextValue_unstable as ThemeContextValue,
} from '@fluentui/react-shared-contexts';
import type { PartialTheme } from '@fluentui/react-theme';
import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
Expand Down Expand Up @@ -32,5 +32,5 @@ export type FluentProviderContextValues = Pick<FluentProviderState, 'theme'> & {
provider: ProviderContextValue;
themeClassName: ThemeClassNameContextValue;
textDirection: 'ltr' | 'rtl';
tooltip: TooltipContextType;
tooltip: TooltipVisibilityContextValue;
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import * as React from 'react';
import { TextDirectionProvider } from '@griffel/react';
import { ProviderContext, TooltipContext, ThemeContext, ThemeClassNameContext } from '@fluentui/react-shared-contexts';
import {
Provider_unstable as Provider,
TooltipVisibilityProvider_unstable as TooltipVisibilityProvider,
ThemeProvider_unstable as ThemeProvider,
ThemeClassNameProvider_unstable as ThemeClassNameProvider,
} from '@fluentui/react-shared-contexts';
import { getSlots } from '@fluentui/react-utilities';
import type { FluentProviderSlots, FluentProviderContextValues, FluentProviderState } from './FluentProvider.types';

Expand All @@ -14,16 +19,16 @@ export const renderFluentProvider_unstable = (
const { slots, slotProps } = getSlots<FluentProviderSlots>(state);

return (
<ProviderContext.Provider value={contextValues.provider}>
<ThemeContext.Provider value={contextValues.theme}>
<ThemeClassNameContext.Provider value={contextValues.themeClassName}>
<TooltipContext.Provider value={contextValues.tooltip}>
<Provider value={contextValues.provider}>
<ThemeProvider value={contextValues.theme}>
<ThemeClassNameProvider value={contextValues.themeClassName}>
<TooltipVisibilityProvider value={contextValues.tooltip}>
<TextDirectionProvider dir={contextValues.textDirection}>
<slots.root {...slotProps.root}>{state.root.children}</slots.root>
</TextDirectionProvider>
</TooltipContext.Provider>
</ThemeClassNameContext.Provider>
</ThemeContext.Provider>
</ProviderContext.Provider>
</TooltipVisibilityProvider>
</ThemeClassNameProvider>
</ThemeProvider>
</Provider>
);
};
Loading