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": "patch",
"comment": "feat: updates internal SpinButton padding",
"packageName": "@fluentui/react-spinbutton",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export const useSpinButton_unstable = (props: SpinButtonProps, ref: React.Ref<HT
ref,
autoComplete: 'off',
role: 'spinbutton',
appearance: appearance,
appearance,
type: 'text',
...nativeProps.primary,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ const useRootStyles = makeStyles({
},
},

small: {
paddingLeft: tokens.spacingHorizontalS,
},

// intentionally empty
medium: {},

outline: {
'::before': {
...shorthands.border('1px', 'solid', tokens.colorNeutralStroke1),
Expand Down Expand Up @@ -198,15 +205,14 @@ const useButtonStyles = makeStyles({
...shorthands.borderRadius(0, tokens.borderRadiusMedium, 0, 0),
},

// TODO: revisit these padding numbers for aligning the icon.
// Padding values aren't perfect.
// The icon doesn't align perfectly with the Figma designs.
// It's set in a 16x16px square but the artwork is inset from that
// so I've had to compute the numbers by handle.
// Padding values numbers don't align with design specs
// but visually the padding aligns.
// The icons are set in a 16x16px square but the artwork is inset from that
// so these padding values are computed by hand.
// Additionally the design uses fractional values so these are
// rounded to the nearest integer.
incrementButtonSmall: {
...shorthands.padding('3px', '5px', '0px', '5px'),
...shorthands.padding('3px', '6px', '0px', '4px'),
},

incrementButtonMedium: {
Expand All @@ -222,7 +228,7 @@ const useButtonStyles = makeStyles({
},

decrementButtonSmall: {
...shorthands.padding('0px', '5px', '3px', '5px'),
...shorthands.padding('0px', '6px', '3px', '4px'),
},

decrementButtonMedium: {
Expand Down Expand Up @@ -433,6 +439,7 @@ export const useSpinButtonStyles_unstable = (state: SpinButtonState): SpinButton
state.root.className, // Get the classes from useInputStyles_unstable
spinButtonClassNames.root,
rootStyles.base,
rootStyles[size],
appearance === 'outline' && rootStyles.outline,
appearance === 'underline' && rootStyles.underline,
filled && rootStyles.filled,
Expand Down