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
7 changes: 5 additions & 2 deletions packages/@react-spectrum/s2/src/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ export const CheckboxContext = createContext<ContextValue<Partial<CheckboxProps>

const field = style({
display: 'grid',
gridTemplateColumns: ['max-content', '1fr'],
gridTemplateColumns: {
default: ['max-content', '1fr'],
isNoVisibleLabel: ['max-content']
},
columnGap: 'text-to-control',
alignContent: 'start',
width: {
Expand Down Expand Up @@ -182,7 +185,7 @@ export const Checkbox = forwardRef(function Checkbox({children, ...props}: Check
ref={domRef}
inputRef={inputRef}
style={props.UNSAFE_style}
className={(props.UNSAFE_className || '') + field({size: props.size || 'M', isInCheckboxGroup}, props.styles)}>
className={(props.UNSAFE_className || '') + field({size: props.size || 'M', isInCheckboxGroup, isNoVisibleLabel: !children}, props.styles)}>
{({isDisabled, isInvalid}) => (<>
<CheckboxButton className={renderProps => wrapper({...renderProps, isInForm, size: props.size || 'M'})}>
{renderProps => {
Expand Down
7 changes: 5 additions & 2 deletions packages/@react-spectrum/s2/src/RadioGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,10 @@ interface RenderProps extends RadioRenderProps, ContextProps {}

const radioField = style({
display: 'grid',
gridTemplateColumns: ['max-content', '1fr'],
gridTemplateColumns: {
default: ['max-content', '1fr'],
isNoVisibleLabel: ['max-content']
},
Comment on lines +178 to +181
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh nvm I forgot this was intentional from https://github.com/adobe/react-spectrum/pull/9877/changes#diff-43aff8e2be0a942e4e38e2dfe84fe8d8037a5408d5b8a135f0a22042941d8e2fR103. We'll probably need to call this out in the next release since there may be people who were relying on the previous behavior who will now need to constrain the width of their group

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I was a little unsure about this...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I was a little unsure about this...

columnGap: 'text-to-control',
alignContent: 'start',
font: controlFont(),
Expand Down Expand Up @@ -277,7 +280,7 @@ export const Radio = /*#__PURE__*/ forwardRef(function Radio(props: RadioProps,
ref={domRef}
inputRef={inputRef}
style={UNSAFE_style}
className={renderProps => UNSAFE_className + radioField({...renderProps, isInForm, size}, allProps.styles)}>
className={renderProps => UNSAFE_className + radioField({...renderProps, isInForm, size, isNoVisibleLabel: !children}, allProps.styles)}>
{renderProps => (
<>
<RadioButton className={renderProps => wrapper({...renderProps, isInForm, size})}>
Expand Down
7 changes: 5 additions & 2 deletions packages/@react-spectrum/s2/src/Switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ export const SwitchContext = createContext<ContextValue<Partial<SwitchProps>, Fo

const field = style({
display: 'grid',
gridTemplateColumns: ['max-content', '1fr'],
gridTemplateColumns: {
default: ['max-content', '1fr'],
isNoVisibleLabel: ['max-content']
},
columnGap: 'text-to-control',
width: 'fit',
font: controlFont(),
Expand Down Expand Up @@ -183,7 +186,7 @@ export const Switch = /*#__PURE__*/ forwardRef(function Switch(props: SwitchProp
ref={domRef}
inputRef={inputRef}
style={UNSAFE_style}
className={renderProps => UNSAFE_className + field({...renderProps, isInForm, size: props.size || 'M'}, props.styles)}>
className={renderProps => UNSAFE_className + field({...renderProps, isInForm, size: props.size || 'M', isNoVisibleLabel: !children}, props.styles)}>
{({isDisabled, isInvalid}) => (<>
<SwitchButton className={renderProps => wrapper({...renderProps, isInForm, size: props.size || 'M'})}>
{renderProps => (
Expand Down
Loading