Skip to content

Commit 49b97ec

Browse files
git-nandorclaude
andcommitted
fix(ui-flex): resolve general.* spacing tokens for the gap prop
Flex v2 resolved `gap` with getShorthandPropValue, which only handles the flat legacy keyword scale. The current general.* tokens are nested (sharedTokens.spacing.general.spaceXl), so `gap="general.spaceXl"` was not found and silently fell back to `0` (no gap). Resolve `gap` with calcSpacingFromShorthand instead -- the same helper View uses for margin/padding -- which supports both the general.* dot-path and the legacy keyword scale. INSTUI-5125 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent ecd9aeb commit 49b97ec

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

packages/ui-flex/src/Flex/v2/styles.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* SOFTWARE.
2323
*/
2424

25-
import { getShorthandPropValue, makeThemeVars } from '@instructure/emotion'
25+
import { calcSpacingFromShorthand } from '@instructure/emotion'
2626
import type { NewComponentTypes, SharedTokens } from '@instructure/ui-themes'
2727
import type { FlexProps, FlexStyle } from './props'
2828

@@ -87,14 +87,6 @@ const generateStyle = (
8787
'row-reverse': 'row-reverse'
8888
}
8989

90-
// gap css prop
91-
const gapValues = makeThemeVars('gap', {
92-
...sharedTokens.spacing,
93-
...sharedTokens.legacy.spacing
94-
})
95-
const getGapValue = (gap: FlexProps['gap'], values: Record<string, string>) =>
96-
getShorthandPropValue('Flex', values, gap, 'gap')
97-
9890
return {
9991
flex: {
10092
label: 'flex',
@@ -104,7 +96,10 @@ const generateStyle = (
10496
justifyContent: justifyItemsValues[justifyItems!],
10597
flexWrap: wrapValues[wrap!],
10698
flexDirection: flexDirectionValues[direction!],
107-
gap: getGapValue(gap!, gapValues)
99+
gap: calcSpacingFromShorthand(gap, {
100+
...sharedTokens.spacing,
101+
...sharedTokens.legacy.spacing
102+
})
108103
}
109104
}
110105
}

0 commit comments

Comments
 (0)