diff --git a/packages/@react-spectrum/s2/src/ComboBox.tsx b/packages/@react-spectrum/s2/src/ComboBox.tsx index 37852d87315..4329e09bf0c 100644 --- a/packages/@react-spectrum/s2/src/ComboBox.tsx +++ b/packages/@react-spectrum/s2/src/ComboBox.tsx @@ -42,7 +42,7 @@ import CheckmarkIcon from '../ui-icons/Checkmark'; import ChevronIcon from '../ui-icons/Chevron'; import {createContext, CSSProperties, forwardRef, ReactNode, useCallback, useContext, useImperativeHandle, useRef, useState} from 'react'; import {createFocusableRef, useFocusableRef} from '@react-spectrum/utils'; -import {field, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'}; +import {field, fieldInput, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'}; import {FieldErrorIcon, FieldGroup, FieldLabel, HelpText, Input} from './Field'; import {FocusableRef, HelpTextProps, SpectrumLabelableProps} from '@react-types/shared'; import {FormContext, useFormProps} from './Form'; @@ -240,19 +240,12 @@ function ComboBox(props: ComboBoxProps, ref: FocusableRef {ctx => ( diff --git a/packages/@react-spectrum/s2/src/NumberField.tsx b/packages/@react-spectrum/s2/src/NumberField.tsx index 704a377337c..2548e7d6568 100644 --- a/packages/@react-spectrum/s2/src/NumberField.tsx +++ b/packages/@react-spectrum/s2/src/NumberField.tsx @@ -25,7 +25,7 @@ import ChevronIcon from '../ui-icons/Chevron'; import {createFocusableRef, useFocusableRef} from '@react-spectrum/utils'; import {CSSProperties, ForwardedRef, forwardRef, ReactNode, useContext, useImperativeHandle, useMemo, useRef} from 'react'; import Dash from '../ui-icons/Dash'; -import {field, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'}; +import {field, fieldInput, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'}; import {FieldErrorIcon, FieldGroup, FieldLabel, HelpText, Input} from './Field'; import {filterDOMProps, mergeProps, mergeRefs} from '@react-aria/utils'; import {FocusableRef, HelpTextProps, SpectrumLabelableProps} from '@react-types/shared'; @@ -284,19 +284,11 @@ function NumberField(props: NumberFieldProps, ref: FocusableRef) isInvalid={isInvalid} size={size} styles={style({ + ...fieldInput(), paddingStart: 'edge-to-text', paddingEnd: 0, - width: { - default: 'full', - size: { - S: 192, - M: 208, - L: 224, - XL: 240 - } - }, cursor: 'default' - })({size, isCollapsed})}> + })({size})}> {ctx => ( diff --git a/packages/@react-spectrum/s2/stories/ComboBox.stories.tsx b/packages/@react-spectrum/s2/stories/ComboBox.stories.tsx index 056ed5a2031..78a39ebbe96 100644 --- a/packages/@react-spectrum/s2/stories/ComboBox.stories.tsx +++ b/packages/@react-spectrum/s2/stories/ComboBox.stories.tsx @@ -12,9 +12,11 @@ import {Button, ComboBox, ComboBoxItem, ComboBoxSection, Content, ContextualHelp, Footer, Form, Header, Heading, Link, Text} from '../src'; import {categorizeArgTypes} from './utils'; +import {ComboBoxProps} from 'react-aria-components'; import DeviceDesktopIcon from '../s2wf-icons/S2_Icon_DeviceDesktop_20_N.svg'; import DeviceTabletIcon from '../s2wf-icons/S2_Icon_DeviceTablet_20_N.svg'; import type {Meta, StoryObj} from '@storybook/react'; +import {style} from '../style/spectrum-theme' with {type: 'macro'}; const meta: Meta> = { component: ComboBox, @@ -30,19 +32,18 @@ const meta: Meta> = { export default meta; type Story = StoryObj>; -export const Example: Story = { - render: (args) => ( - - Chocolate - Mint - Strawberry - Vanilla - Chocolate Chip Cookie Dough - - ), - args: { - label: 'Ice cream flavor' - } +export const Example = (args: ComboBoxProps) => ( + + Chocolate + Mint + Strawberry + Vanilla + Chocolate Chip Cookie Dough + +); + +Example.args = { + label: 'Ice cream flavor' }; export const Sections: Story = { @@ -210,3 +211,11 @@ ContextualHelpExample.parameters = { } } }; + +export const CustomWidth = (args: any) => ; +CustomWidth.args = Example.args; +CustomWidth.parameters = { + docs: { + disable: true + } +};