Skip to content

Commit

Permalink
chore: migrate .shorthands() [cxe-red] (microsoft#31449)
Browse files Browse the repository at this point in the history
Co-authored-by: Sean Monahan <seanmonahan@microsoft.com>
  • Loading branch information
2 people authored and miroslavstastny committed Jun 14, 2024
1 parent 07bcec2 commit 9455bcc
Show file tree
Hide file tree
Showing 111 changed files with 496 additions and 441 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: replace usage of .shorthands() in styles",
"packageName": "@fluentui/react-accordion",
"email": "olfedias@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: replace usage of .shorthands() in styles",
"packageName": "@fluentui/react-avatar",
"email": "olfedias@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: replace usage of .shorthands() in styles",
"packageName": "@fluentui/react-badge",
"email": "olfedias@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: migrate .shorthands() [cxe-red]",
"packageName": "@fluentui/react-button",
"email": "olfedias@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: replace usage of .shorthands() in styles",
"packageName": "@fluentui/react-calendar-compat",
"email": "olfedias@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: replace usage of .shorthands() in styles",
"packageName": "@fluentui/react-checkbox",
"email": "olfedias@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: replace usage of .shorthands() in styles",
"packageName": "@fluentui/react-infolabel",
"email": "olfedias@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: replace usage of .shorthands() in styles",
"packageName": "@fluentui/react-input",
"email": "olfedias@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: replace usage of .shorthands() in styles",
"packageName": "@fluentui/react-link",
"email": "olfedias@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: replace usage of .shorthands() in styles",
"packageName": "@fluentui/react-progress",
"email": "olfedias@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: replace usage of .shorthands() in styles",
"packageName": "@fluentui/react-radio",
"email": "olfedias@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: replace usage of .shorthands() in styles",
"packageName": "@fluentui/react-rating",
"email": "olfedias@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: replace usage of .shorthands() in styles",
"packageName": "@fluentui/react-select",
"email": "olfedias@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: replace usage of .shorthands() in styles",
"packageName": "@fluentui/react-skeleton",
"email": "olfedias@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: replace usage of .shorthands() in styles",
"packageName": "@fluentui/react-slider",
"email": "olfedias@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: replace usage of .shorthands() in styles",
"packageName": "@fluentui/react-spinbutton",
"email": "olfedias@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: replace usage of .shorthands() in styles",
"packageName": "@fluentui/react-switch",
"email": "olfedias@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: replace usage of .shorthands() in styles",
"packageName": "@fluentui/react-tabs",
"email": "olfedias@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: replace usage of .shorthands() in styles",
"packageName": "@fluentui/react-textarea",
"email": "olfedias@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: replace usage of .shorthands() in styles",
"packageName": "@fluentui/react-tooltip",
"email": "olfedias@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ const useStyles = makeStyles({
fontFamily: 'inherit',
fontSize: 'inherit',
lineHeight: 'normal',
...shorthands.overflow('visible'),
...shorthands.padding(0),
overflow: 'visible',
padding: '0',
WebkitAppearance: 'button',
textAlign: 'unset',
},
focusIndicator: createFocusOutlineStyle(),
root: {
color: tokens.colorNeutralForeground1,
backgroundColor: tokens.colorTransparentBackground,
...shorthands.margin(0),
...shorthands.borderRadius(tokens.borderRadiusMedium),
margin: '0',
borderRadius: tokens.borderRadiusMedium,
},
rootDisabled: {
backgroundImage: 'none',
Expand All @@ -43,7 +43,7 @@ const useStyles = makeStyles({
position: 'relative',
width: '100%',
...shorthands.borderWidth('0'),
...shorthands.padding(0, tokens.spacingHorizontalM, 0, tokens.spacingHorizontalMNudge),
padding: `0 ${tokens.spacingHorizontalM} 0 ${tokens.spacingHorizontalMNudge}`,
minHeight: '44px',
display: 'flex',
alignItems: 'center',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { SlotClassNames } from '@fluentui/react-utilities';
import { makeStyles, mergeClasses, shorthands } from '@griffel/react';
import { makeStyles, mergeClasses } from '@griffel/react';
import { tokens } from '@fluentui/react-theme';

import type { AccordionPanelSlots, AccordionPanelState } from './AccordionPanel.types';
Expand All @@ -13,7 +13,7 @@ export const accordionPanelClassNames: SlotClassNames<AccordionPanelSlots> = {
*/
const useStyles = makeStyles({
root: {
...shorthands.margin(0, tokens.spacingHorizontalM),
margin: `0 ${tokens.spacingHorizontalM}`,
},
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { tokens } from '@fluentui/react-theme';
import type { SlotClassNames } from '@fluentui/react-utilities';
import { makeResetStyles, makeStyles, mergeClasses, shorthands } from '@griffel/react';
import { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';
import type { AvatarSlots, AvatarState } from './Avatar.types';

export const avatarClassNames: SlotClassNames<AvatarSlots> = {
Expand Down Expand Up @@ -114,18 +114,10 @@ const useStyles = makeStyles({
textSubtitle1: { fontSize: tokens.fontSizeBase500 },
textTitle3: { fontSize: tokens.fontSizeBase600 },

squareSmall: {
...shorthands.borderRadius(tokens.borderRadiusSmall),
},
squareMedium: {
...shorthands.borderRadius(tokens.borderRadiusMedium),
},
squareLarge: {
...shorthands.borderRadius(tokens.borderRadiusLarge),
},
squareXLarge: {
...shorthands.borderRadius(tokens.borderRadiusXLarge),
},
squareSmall: { borderRadius: tokens.borderRadiusSmall },
squareMedium: { borderRadius: tokens.borderRadiusMedium },
squareLarge: { borderRadius: tokens.borderRadiusLarge },
squareXLarge: { borderRadius: tokens.borderRadiusXLarge },

activeOrInactive: {
transform: 'perspective(1px)', // Work-around for text pixel snapping at the end of the animation
Expand Down Expand Up @@ -178,7 +170,7 @@ const useStyles = makeStyles({
transitionTimingFunction: `${tokens.curveDecelerateMin}, ${tokens.curveLinear}`,

'::before,::after': {
...shorthands.margin(0),
margin: 0,
opacity: 0,
transitionTimingFunction: `${tokens.curveDecelerateMin}, ${tokens.curveLinear}`,
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { makeStyles, mergeClasses, shorthands } from '@griffel/react';
import { makeStyles, mergeClasses } from '@griffel/react';
import { tokens, typographyStyles } from '@fluentui/react-theme';
import { useSizeStyles } from '../../Avatar';
import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
Expand All @@ -25,12 +25,8 @@ const useRootStyles = makeStyles({
flexShrink: 0,
position: 'relative',
},
overflowItem: {
...shorthands.padding(tokens.spacingVerticalXS, tokens.spacingHorizontalXS),
},
nonOverflowItem: {
...shorthands.borderRadius(tokens.borderRadiusCircular),
},
overflowItem: { padding: `${tokens.spacingVerticalXS} ${tokens.spacingHorizontalXS}` },
nonOverflowItem: { borderRadius: tokens.borderRadiusCircular },
});

/**
Expand All @@ -40,9 +36,7 @@ const useAvatarStyles = makeStyles({
nonOverflowItem: {
position: 'absolute',
},
pie: {
...shorthands.borderRadius(0),
},
pie: { borderRadius: '0' },
});

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export const avatarGroupPopoverClassNames: SlotClassNames<AvatarGroupPopoverSlot
const useContentStyles = makeStyles({
base: {
listStyleType: 'none',
...shorthands.margin('0'),
...shorthands.padding('0'),
margin: '0',
padding: '0',
display: 'flex',
flexDirection: 'column',
},
Expand All @@ -34,8 +34,8 @@ const usePopoverSurfaceStyles = makeStyles({
base: {
maxHeight: '220px',
minHeight: '80px',
...shorthands.overflow('hidden', 'scroll'),
...shorthands.padding(tokens.spacingVerticalS, tokens.spacingHorizontalS),
overflow: 'hidden scroll',
padding: `${tokens.spacingVerticalS} ${tokens.spacingHorizontalS}`,
width: '220px',
},
});
Expand All @@ -53,9 +53,9 @@ const useTriggerButtonStyles = makeStyles({
color: tokens.colorNeutralForeground1,
backgroundColor: tokens.colorNeutralBackground1,
...shorthands.borderColor(tokens.colorNeutralStroke1),
...shorthands.borderRadius(tokens.borderRadiusCircular),
borderRadius: tokens.borderRadiusCircular,
...shorthands.borderStyle('solid'),
...shorthands.padding(0),
padding: '0',

// Match color to Avatar's outline color.
'@media (forced-colors: active)': {
Expand All @@ -70,7 +70,7 @@ const useTriggerButtonStyles = makeStyles({
},

focusIndicator: createCustomFocusIndicatorStyle({
...shorthands.border(tokens.strokeWidthThick, 'solid', tokens.colorStrokeFocus2),
border: `${tokens.strokeWidthThick} solid ${tokens.colorStrokeFocus2}`,
outlineStyle: 'none',
}),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,50 +54,43 @@ const useRootStyles = makeStyles({
fontSize: '4px',
lineHeight: '4px',
minWidth: 'unset',
...shorthands.padding('unset'),
padding: 'unset',
},
'extra-small': {
width: '10px',
height: '10px',
fontSize: '6px',
lineHeight: '6px',
minWidth: 'unset',
...shorthands.padding('unset'),
padding: 'unset',
},
small: {
width: '16px',
height: '16px',
...shorthands.padding(0, `calc(${tokens.spacingHorizontalXXS} + ${textPadding})`),
padding: `0 calc(${tokens.spacingHorizontalXXS} + ${textPadding})`,
},
medium: {
// Set by useRootClassName
},
large: {
width: '24px',
height: '24px',
...shorthands.padding(0, `calc(${tokens.spacingHorizontalXS} + ${textPadding})`),
padding: `0 calc(${tokens.spacingHorizontalXS} + ${textPadding})`,
},
'extra-large': {
width: '32px',
height: '32px',
...shorthands.padding(0, `calc(${tokens.spacingHorizontalSNudge} + ${textPadding})`),
padding: `0 calc(${tokens.spacingHorizontalSNudge} + ${textPadding})`,
},

// shape

square: {
...shorthands.borderRadius(tokens.borderRadiusNone),
},
rounded: {
...shorthands.borderRadius(tokens.borderRadiusMedium),
},
roundedSmallToTiny: {
...shorthands.borderRadius(tokens.borderRadiusSmall),
},
square: { borderRadius: tokens.borderRadiusNone },
rounded: { borderRadius: tokens.borderRadiusMedium },
roundedSmallToTiny: { borderRadius: tokens.borderRadiusSmall },
circular: {
// Set by useRootClassName
},

// hide the boder when appearance is "ghost"

borderGhost: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { shorthands, mergeClasses, makeStyles } from '@griffel/react';
import { mergeClasses, makeStyles } from '@griffel/react';
import { useBadgeStyles_unstable } from '../Badge/useBadgeStyles.styles';
import type { SlotClassNames } from '@fluentui/react-utilities';
import type { BadgeSlots } from '../Badge/Badge.types';
Expand All @@ -14,7 +14,7 @@ const useStyles = makeStyles({
minWidth: 'auto',
width: '6px',
height: '6px',
...shorthands.padding('0'),
padding: '0',
},
hide: {
display: 'none',
Expand Down
Loading

0 comments on commit 9455bcc

Please sign in to comment.