Skip to content

Commit 1dd65ff

Browse files
authored
refactor: Generate stable style macro class names between versions (#8118)
* refactor: Generate stable style macro class names between versions * fix chromatic issues
1 parent 63d4359 commit 1dd65ff

File tree

9 files changed

+3180
-373
lines changed

9 files changed

+3180
-373
lines changed

packages/@react-spectrum/s2/src/Card.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ let card = style({
139139
density: {
140140
compact: {
141141
size: {
142-
XS: 6,
142+
XS: space(6),
143143
S: 8,
144144
M: 12,
145145
L: 16,
@@ -647,7 +647,7 @@ export const UserCard = forwardRef(function UserCard(props: CardProps, ref: DOMR
647647
position: 'relative',
648648
marginTop: {
649649
default: 0,
650-
':is([slot=preview] + &)': '[calc(var(--size) / -2)]'
650+
':is([slot=preview] + *)': '[calc(var(--size) / -2)]'
651651
}
652652
}),
653653
isOverBackground: true
@@ -717,7 +717,7 @@ export const ProductCard = forwardRef(function ProductCard(props: ProductCardPro
717717
objectFit: 'cover',
718718
marginTop: {
719719
default: 0,
720-
':is([slot=preview] + &)': '[calc(self(height) / -2)]'
720+
':is([slot=preview] + *)': '[calc(self(height) / -2)]'
721721
},
722722
outlineStyle: 'solid',
723723
outlineWidth: {

packages/@react-spectrum/s2/src/Disclosure.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {CenterBaseline} from './CenterBaseline';
1717
import {centerPadding, getAllowedOverrides, StyleProps, UnsafeStyles} from './style-utils' with { type: 'macro' };
1818
import Chevron from '../ui-icons/Chevron';
1919
import {filterDOMProps} from '@react-aria/utils';
20-
import {focusRing, lightDark, style} from '../style' with { type: 'macro' };
20+
import {focusRing, lightDark, space, style} from '../style' with { type: 'macro' };
2121
import React, {createContext, forwardRef, ReactNode, useContext} from 'react';
2222
import {useDOMRef} from '@react-spectrum/utils';
2323
import {useSpectrumContextProps} from './useSpectrumContextProps';
@@ -307,9 +307,9 @@ const panelStyles = style({
307307
isExpanded: {
308308
size: {
309309
S: 8,
310-
M: 9,
310+
M: space(9),
311311
L: 12,
312-
XL: 15
312+
XL: space(15)
313313
}
314314
}
315315
}

packages/@react-spectrum/s2/src/TableView.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -564,10 +564,7 @@ const sortIcon = style({
564564
default: 8,
565565
isButton: 'text-to-visual'
566566
},
567-
verticalAlign: {
568-
default: 'bottom',
569-
isButton: 0
570-
},
567+
verticalAlign: 'bottom',
571568
'--iconPrimary': {
572569
type: 'fill',
573570
value: 'currentColor'

packages/@react-spectrum/s2/src/style-utils.ts

-2
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,8 @@ const allowedOverrides = [
153153
'alignSelf',
154154
'order',
155155
'gridArea',
156-
'gridRow',
157156
'gridRowStart',
158157
'gridRowEnd',
159-
'gridColumn',
160158
'gridColumnStart',
161159
'gridColumnEnd',
162160
'position',

0 commit comments

Comments
 (0)