Skip to content

Commit

Permalink
chore: migrate .shorthands() [teams-prg]
Browse files Browse the repository at this point in the history
  • Loading branch information
layershifter committed May 22, 2024
1 parent 5e68a1a commit d00c916
Show file tree
Hide file tree
Showing 156 changed files with 810 additions and 1,024 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-combobox",
"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-list-preview",
"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-menu",
"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-migration-v0-v9",
"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-popover",
"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-positioning",
"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-table",
"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-tabster",
"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-tag-picker",
"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-tags",
"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-toast",
"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-toolbar",
"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-tree",
"email": "olfedias@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,14 @@
import * as React from 'react';
import {
AriaLiveAnnouncer,
Button,
Field,
Input,
makeStyles,
shorthands,
tokens,
useAnnounce,
} from '@fluentui/react-components';
import { AriaLiveAnnouncer, Button, Field, Input, makeStyles, tokens, useAnnounce } from '@fluentui/react-components';

const useClasses = makeStyles({
container: {
display: 'flex',
flexDirection: 'column',
...shorthands.gap('8px'),
...shorthands.padding('8px'),

...shorthands.border('1px', 'solid', tokens.colorNeutralStroke1),
...shorthands.borderRadius('4px'),
gap: '8px',
padding: '8px',
border: `1px solid ${tokens.colorNeutralStroke1}`,
borderRadius: '4px',
},
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const fieldHeights = {
const useStyles = makeStyles({
root: {
alignItems: 'center',
...shorthands.borderRadius(tokens.borderRadiusMedium),
borderRadius: tokens.borderRadiusMedium,
boxSizing: 'border-box',
columnGap: tokens.spacingHorizontalXXS,
display: 'inline-grid',
Expand All @@ -52,7 +52,7 @@ const useStyles = makeStyles({
height: `max(2px, ${tokens.borderRadiusMedium})`,
borderBottomLeftRadius: tokens.borderRadiusMedium,
borderBottomRightRadius: tokens.borderRadiusMedium,
...shorthands.borderBottom(tokens.strokeWidthThick, 'solid', tokens.colorCompoundBrandStroke),
borderBottom: `${tokens.strokeWidthThick} solid ${tokens.colorCompoundBrandStroke}`,
clipPath: 'inset(calc(100% - 2px) 0 0 0)',
transform: 'scaleX(0)',
transitionProperty: 'transform',
Expand Down Expand Up @@ -82,7 +82,7 @@ const useStyles = makeStyles({

listbox: {
boxShadow: `${tokens.shadow16}`,
...shorthands.borderRadius(tokens.borderRadiusMedium),
borderRadius: tokens.borderRadiusMedium,
maxHeight: '80vh',
boxSizing: 'border-box',
},
Expand Down Expand Up @@ -115,7 +115,7 @@ const useStyles = makeStyles({
// appearance variants
outline: {
backgroundColor: tokens.colorNeutralBackground1,
...shorthands.border(tokens.strokeWidthThin, 'solid', tokens.colorNeutralStroke1),
border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke1}`,
borderBottomColor: tokens.colorNeutralStrokeAccessible,
},

Expand All @@ -132,16 +132,16 @@ const useStyles = makeStyles({
},
underline: {
backgroundColor: tokens.colorTransparentBackground,
...shorthands.borderBottom(tokens.strokeWidthThin, 'solid', tokens.colorNeutralStrokeAccessible),
...shorthands.borderRadius(0),
borderBottom: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStrokeAccessible}`,
borderRadius: '0',
},
'filled-lighter': {
backgroundColor: tokens.colorNeutralBackground1,
...shorthands.border(tokens.strokeWidthThin, 'solid', tokens.colorTransparentStroke),
border: `${tokens.strokeWidthThin} solid ${tokens.colorTransparentStroke}`,
},
'filled-darker': {
backgroundColor: tokens.colorNeutralBackground3,
...shorthands.border(tokens.strokeWidthThin, 'solid', tokens.colorTransparentStroke),
border: `${tokens.strokeWidthThin} solid ${tokens.colorTransparentStroke}`,
},
invalid: {
':not(:focus-within),:hover:not(:focus-within)': {
Expand All @@ -168,7 +168,7 @@ const useInputStyles = makeStyles({
input: {
alignSelf: 'stretch',
backgroundColor: tokens.colorTransparentBackground,
...shorthands.border('0'),
border: 'none',
color: tokens.colorNeutralForeground1,
fontFamily: tokens.fontFamilyBase,

Expand All @@ -185,15 +185,15 @@ const useInputStyles = makeStyles({
// size variants
small: {
...typographyStyles.caption1,
...shorthands.padding(0, 0, 0, `calc(${tokens.spacingHorizontalSNudge} + ${tokens.spacingHorizontalXXS})`),
padding: `0 0 0 ${`calc(${tokens.spacingHorizontalSNudge} + ${tokens.spacingHorizontalXXS})`}`,
},
medium: {
...typographyStyles.body1,
...shorthands.padding(0, 0, 0, `calc(${tokens.spacingHorizontalMNudge} + ${tokens.spacingHorizontalXXS})`),
padding: `0 0 0 ${`calc(${tokens.spacingHorizontalMNudge} + ${tokens.spacingHorizontalXXS})`}`,
},
large: {
...typographyStyles.body2,
...shorthands.padding(0, 0, 0, `calc(${tokens.spacingHorizontalM} + ${tokens.spacingHorizontalSNudge})`),
padding: `0 0 0 ${`calc(${tokens.spacingHorizontalM} + ${tokens.spacingHorizontalSNudge})`}`,
},
disabled: {
color: tokens.colorNeutralForegroundDisabled,
Expand Down Expand Up @@ -225,9 +225,9 @@ const useIconStyles = makeStyles({
visuallyHidden: {
clip: 'rect(0px, 0px, 0px, 0px)',
height: '1px',
...shorthands.margin('-1px'),
...shorthands.overflow('hidden'),
...shorthands.padding('0px'),
margin: '-1px',
overflow: 'hidden',
padding: '0px',
width: '1px',
position: 'absolute',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const dropdownClassNames: SlotClassNames<DropdownSlots> = {
*/
const useStyles = makeStyles({
root: {
...shorthands.borderRadius(tokens.borderRadiusMedium),
borderRadius: tokens.borderRadiusMedium,
boxSizing: 'border-box',
display: 'inline-flex',
minWidth: '250px',
Expand All @@ -42,7 +42,7 @@ const useStyles = makeStyles({
height: `max(${tokens.strokeWidthThick}, ${tokens.borderRadiusMedium})`,
borderBottomLeftRadius: tokens.borderRadiusMedium,
borderBottomRightRadius: tokens.borderRadiusMedium,
...shorthands.borderBottom(tokens.strokeWidthThick, 'solid', tokens.colorCompoundBrandStroke),
borderBottom: `${tokens.strokeWidthThick} solid ${tokens.colorCompoundBrandStroke}`,
clipPath: 'inset(calc(100% - 2px) 0 0 0)',
transform: 'scaleX(0)',
transitionProperty: 'transform',
Expand Down Expand Up @@ -80,7 +80,7 @@ const useStyles = makeStyles({
listbox: {
boxSizing: 'border-box',
boxShadow: `${tokens.shadow16}`,
...shorthands.borderRadius(tokens.borderRadiusMedium),
borderRadius: tokens.borderRadiusMedium,
maxHeight: '80vh',
},

Expand All @@ -97,7 +97,7 @@ const useStyles = makeStyles({
button: {
alignItems: 'center',
backgroundColor: tokens.colorTransparentBackground,
...shorthands.border('0'),
border: 'none',
boxSizing: 'border-box',
color: tokens.colorNeutralForeground1,
columnGap: tokens.spacingHorizontalXXS,
Expand All @@ -121,37 +121,28 @@ const useStyles = makeStyles({
// size variants
small: {
...typographyStyles.caption1,
...shorthands.padding(
'3px',
tokens.spacingHorizontalSNudge,
'3px',
`calc(${tokens.spacingHorizontalSNudge} + ${tokens.spacingHorizontalXXS})`,
),
padding: `3px ${
tokens.spacingHorizontalSNudge
} 3px ${`calc(${tokens.spacingHorizontalSNudge} + ${tokens.spacingHorizontalXXS})`}`,
},
medium: {
...typographyStyles.body1,
...shorthands.padding(
'5px',
tokens.spacingHorizontalMNudge,
'5px',
`calc(${tokens.spacingHorizontalMNudge} + ${tokens.spacingHorizontalXXS})`,
),
padding: `5px ${
tokens.spacingHorizontalMNudge
} 5px ${`calc(${tokens.spacingHorizontalMNudge} + ${tokens.spacingHorizontalXXS})`}`,
},
large: {
columnGap: tokens.spacingHorizontalSNudge,
...typographyStyles.body2,
...shorthands.padding(
'7px',
tokens.spacingHorizontalM,
'7px',
`calc(${tokens.spacingHorizontalM} + ${tokens.spacingHorizontalSNudge})`,
),
padding: `7px ${
tokens.spacingHorizontalM
} 7px ${`calc(${tokens.spacingHorizontalM} + ${tokens.spacingHorizontalSNudge})`}`,
},

// appearance variants
outline: {
backgroundColor: tokens.colorNeutralBackground1,
...shorthands.border(tokens.strokeWidthThin, 'solid', tokens.colorNeutralStroke1),
border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke1}`,
borderBottomColor: tokens.colorNeutralStrokeAccessible,
},
outlineInteractive: {
Expand All @@ -167,16 +158,16 @@ const useStyles = makeStyles({
},
underline: {
backgroundColor: tokens.colorTransparentBackground,
...shorthands.borderBottom(tokens.strokeWidthThin, 'solid', tokens.colorNeutralStrokeAccessible),
...shorthands.borderRadius(0),
borderBottom: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStrokeAccessible}`,
borderRadius: '0',
},
'filled-lighter': {
backgroundColor: tokens.colorNeutralBackground1,
...shorthands.border(tokens.strokeWidthThin, 'solid', 'transparent'),
border: `${tokens.strokeWidthThin} solid transparent`,
},
'filled-darker': {
backgroundColor: tokens.colorNeutralBackground3,
...shorthands.border(tokens.strokeWidthThin, 'solid', 'transparent'),
border: `${tokens.strokeWidthThin} solid transparent`,
},
invalid: {
':not(:focus-within),:hover:not(:focus-within)': {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { tokens } from '@fluentui/react-theme';
import { SlotClassNames } from '@fluentui/react-utilities';
import { makeStyles, mergeClasses, shorthands } from '@griffel/react';
import { makeStyles, mergeClasses } from '@griffel/react';
import type { ListboxSlots, ListboxState } from './Listbox.types';

export const listboxClassNames: SlotClassNames<ListboxSlots> = {
Expand All @@ -18,8 +18,8 @@ const useStyles = makeStyles({
flexDirection: 'column',
minWidth: '160px',
overflowY: 'auto',
...shorthands.outline('1px', 'solid', tokens.colorTransparentStroke),
...shorthands.padding(tokens.spacingHorizontalXS),
outline: `1px solid ${tokens.colorTransparentStroke}`,
padding: tokens.spacingHorizontalXS,
rowGap: tokens.spacingHorizontalXXS,
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ export const optionClassNames: SlotClassNames<OptionSlots> = {
const useStyles = makeStyles({
root: {
alignItems: 'center',
...shorthands.borderRadius(tokens.borderRadiusMedium),
borderRadius: tokens.borderRadiusMedium,
color: tokens.colorNeutralForeground1,
columnGap: tokens.spacingHorizontalXS,
cursor: 'pointer',
display: 'flex',
fontFamily: tokens.fontFamilyBase,
fontSize: tokens.fontSizeBase300,
lineHeight: tokens.lineHeightBase300,
...shorthands.padding(tokens.spacingVerticalSNudge, tokens.spacingHorizontalS),
padding: `${tokens.spacingVerticalSNudge} ${tokens.spacingHorizontalS}`,
position: 'relative',

':hover': {
Expand All @@ -46,10 +46,8 @@ const useStyles = makeStyles({
pointerEvents: 'none',
zIndex: 1,

...shorthands.borderStyle('solid'),
...shorthands.borderWidth('2px'),
...shorthands.borderRadius(tokens.borderRadiusMedium),
...shorthands.borderColor(tokens.colorStrokeFocus2),
border: `2px solid ${tokens.colorStrokeFocus2}`,
borderRadius: tokens.borderRadiusMedium,

top: '-2px',
bottom: '-2px',
Expand Down Expand Up @@ -98,8 +96,8 @@ const useStyles = makeStyles({
},

multiselectCheck: {
...shorthands.border(tokens.strokeWidthThin, 'solid', tokens.colorNeutralStrokeAccessible),
...shorthands.borderRadius(tokens.borderRadiusSmall),
border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStrokeAccessible}`,
borderRadius: tokens.borderRadiusSmall,
boxSizing: 'border-box',

display: 'flex',
Expand Down
Loading

0 comments on commit d00c916

Please sign in to comment.