Skip to content

Commit 4a46c6e

Browse files
authored
fix undefined classNames in s2 (#8074)
1 parent a61f4f8 commit 4a46c6e

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ export interface CardPreviewProps extends UnsafeStyles, DOMProps {
501501

502502
export const CardPreview = forwardRef(function CardPreview(props: CardPreviewProps, ref: DOMRef<HTMLDivElement>) {
503503
let {size, isQuiet, isHovered, isFocusVisible, isSelected, isPressed, isCheckboxSelection} = useContext(InternalCardContext);
504-
let {UNSAFE_className, UNSAFE_style} = props;
504+
let {UNSAFE_className = '', UNSAFE_style} = props;
505505
let domRef = useDOMRef(ref);
506506
return (
507507
<div

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export const ColorSwatchPicker = forwardRef(function ColorSwatchPicker(props: Co
5050
density = 'regular',
5151
size = 'M',
5252
rounding = 'none',
53+
UNSAFE_className = '',
5354
...otherProps
5455
} = props;
5556
let domRef = useDOMRef(ref);
@@ -58,7 +59,7 @@ export const ColorSwatchPicker = forwardRef(function ColorSwatchPicker(props: Co
5859
<AriaColorSwatchPicker
5960
{...otherProps}
6061
ref={domRef}
61-
className={props.UNSAFE_className + style({
62+
className={UNSAFE_className + style({
6263
display: 'flex',
6364
flexWrap: 'wrap',
6465
gap: {

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const Heading = forwardRef(// Wrapper around RAC Heading to unmount when
3737
function Heading(props: HeadingProps, ref: DOMRef<HTMLHeadingElement>) {
3838
[props, ref] = useSpectrumContextProps(props, ref, HeadingContext);
3939
let domRef = useDOMRef(ref);
40-
let {UNSAFE_className = '', UNSAFE_style, styles, isHidden, slot, ...otherProps} = props;
40+
let {UNSAFE_className = '', UNSAFE_style, styles = '', isHidden, slot, ...otherProps} = props;
4141
if (isHidden) {
4242
return null;
4343
}
@@ -57,7 +57,7 @@ export const HeaderContext = createContext<ContextValue<Partial<ContentProps>, D
5757
export const Header = forwardRef(function Header(props: ContentProps, ref: DOMRef) {
5858
[props, ref] = useSpectrumContextProps(props, ref, HeaderContext);
5959
let domRef = useDOMRef(ref);
60-
let {UNSAFE_className = '', UNSAFE_style, styles, isHidden, slot, ...otherProps} = props;
60+
let {UNSAFE_className = '', UNSAFE_style, styles = '', isHidden, slot, ...otherProps} = props;
6161
if (isHidden) {
6262
return null;
6363
}
@@ -77,7 +77,7 @@ export const ContentContext = createContext<ContextValue<Partial<ContentProps>,
7777
export const Content = forwardRef(function Content(props: ContentProps, ref: DOMRef<HTMLDivElement>) {
7878
[props, ref] = useSpectrumContextProps(props, ref, ContentContext);
7979
let domRef = useDOMRef(ref);
80-
let {UNSAFE_className = '', UNSAFE_style, styles, isHidden, slot, ...otherProps} = props;
80+
let {UNSAFE_className = '', UNSAFE_style, styles = '', isHidden, slot, ...otherProps} = props;
8181
if (isHidden) {
8282
return null;
8383
}
@@ -96,7 +96,7 @@ export const TextContext = createContext<ContextValue<Partial<ContentProps>, DOM
9696
export const Text = forwardRef(function Text(props: ContentProps, ref: DOMRef) {
9797
[props, ref] = useSpectrumContextProps(props, ref, TextContext);
9898
let domRef = useDOMRef(ref);
99-
let {UNSAFE_className = '', UNSAFE_style, styles, isHidden, slot, children, ...otherProps} = props;
99+
let {UNSAFE_className = '', UNSAFE_style, styles = '', isHidden, slot, children, ...otherProps} = props;
100100
let racContext = useContext(RACTextContext);
101101
let isSkeleton = useIsSkeleton();
102102
[children, UNSAFE_style] = useSkeletonText(children, UNSAFE_style);
@@ -130,7 +130,7 @@ export const KeyboardContext = createContext<ContextValue<Partial<ContentProps>,
130130
export const Keyboard = forwardRef(function Keyboard(props: ContentProps, ref: DOMRef) {
131131
[props, ref] = useSpectrumContextProps(props, ref, KeyboardContext);
132132
let domRef = useDOMRef(ref);
133-
let {UNSAFE_className = '', UNSAFE_style, styles, isHidden, slot, ...otherProps} = props;
133+
let {UNSAFE_className = '', UNSAFE_style, styles = '', isHidden, slot, ...otherProps} = props;
134134
if (isHidden) {
135135
return null;
136136
}
@@ -149,7 +149,7 @@ export const FooterContext = createContext<ContextValue<Partial<ContentProps>, D
149149
export const Footer = forwardRef(function Footer(props: ContentProps, ref: DOMRef) {
150150
[props, ref] = useSpectrumContextProps(props, ref, FooterContext);
151151
let domRef = useDOMRef(ref);
152-
let {UNSAFE_className = '', UNSAFE_style, styles, isHidden, slot, ...otherProps} = props;
152+
let {UNSAFE_className = '', UNSAFE_style, styles = '', isHidden, slot, ...otherProps} = props;
153153
if (isHidden) {
154154
return null;
155155
}

0 commit comments

Comments
 (0)