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
1 change: 1 addition & 0 deletions packages/@react-spectrum/s2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
},
"./page.css": {
"source": "./src/page.ts",
"types": "./dist/types/src/page.d.ts",
"default": "./page.css"
},
"./style": {
Expand Down
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']
},
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