Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react-positioning: Replacing use of functions in makeStyles with direct use of tokens #21051

Merged
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Replacing use of functions in makeStyles with direct use of tokens.",
"packageName": "@fluentui/react-positioning",
"email": "[email protected]",
"dependentChangeType": "patch"
}
5 changes: 2 additions & 3 deletions packages/react-positioning/etc/react-positioning.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@

```ts

import type { MakeStylesStyleRule } from '@fluentui/react-make-styles';
import type { MakeStylesStyle } from '@fluentui/react-make-styles';
import * as PopperJs from '@popperjs/core';
import * as React_2 from 'react';
import type { Theme } from '@fluentui/react-theme';

// @public (undocumented)
export type Alignment = 'top' | 'bottom' | 'start' | 'end' | 'center';
Expand All @@ -19,7 +18,7 @@ export type AutoSize = 'height' | 'height-always' | 'width' | 'width-always' | '
export type Boundary = PopperJs.Boundary | 'scrollParent' | 'window';

// @public
export function createArrowStyles(size?: number): MakeStylesStyleRule<Theme>;
export function createArrowStyles(size?: number): MakeStylesStyle;

// @public
export function createVirtualElementFromClick(nativeEvent: MouseEvent): PopperVirtualElement;
Expand Down
12 changes: 6 additions & 6 deletions packages/react-positioning/src/createArrowStyles.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { shorthands } from '@fluentui/react-make-styles';
import type { MakeStylesStyleRule } from '@fluentui/react-make-styles';
import type { Theme } from '@fluentui/react-theme';
import { tokens } from '@fluentui/react-theme';
import type { MakeStylesStyle } from '@fluentui/react-make-styles';

/**
* Helper that creates a makeStyles rule for an arrow element.
Expand All @@ -26,8 +26,8 @@ import type { Theme } from '@fluentui/react-theme';
*
* @param size - dimensions of the square arrow element in pixels.
*/
export function createArrowStyles(size?: number): MakeStylesStyleRule<Theme> {
return theme => ({
export function createArrowStyles(size?: number): MakeStylesStyle {
return {
position: 'absolute',
backgroundColor: 'inherit',
visibility: 'hidden',
Expand All @@ -46,7 +46,7 @@ export function createArrowStyles(size?: number): MakeStylesStyleRule<Theme> {
height: 'inherit',
backgroundColor: 'inherit',
visibility: 'visible',
borderBottomRightRadius: theme.borderRadiusSmall,
borderBottomRightRadius: tokens.borderRadiusSmall,
transform: 'rotate(var(--angle)) translate(0, 50%) rotate(45deg)',
},

Expand Down Expand Up @@ -76,5 +76,5 @@ export function createArrowStyles(size?: number): MakeStylesStyleRule<Theme> {
right: '0 /* @noflip */',
'--angle': '270deg',
},
});
};
}