diff --git a/packages/@react-spectrum/s2/src/ComboBox.tsx b/packages/@react-spectrum/s2/src/ComboBox.tsx index d58621974b1..b05771b8d73 100644 --- a/packages/@react-spectrum/s2/src/ComboBox.tsx +++ b/packages/@react-spectrum/s2/src/ComboBox.tsx @@ -45,7 +45,7 @@ import ChevronIcon from '../ui-icons/Chevron'; import {Collection} from 'react-aria/Collection'; import {ContextValue, Provider} from 'react-aria-components/slots'; import {control, controlBorderRadius, controlFont, controlSize, field, fieldInput, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'}; -import {createContext, CSSProperties, ForwardedRef, forwardRef, ReactNode, Ref, useCallback, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState} from 'react'; +import {createContext, CSSProperties, ForwardedRef, forwardRef, ReactNode, Ref, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState} from 'react'; import {createFocusableRef} from './useDOMRef'; import {createLeafComponent} from 'react-aria/CollectionBuilder'; import {edgeToText} from '../style/spectrum-theme' with {type: 'macro'}; @@ -55,17 +55,16 @@ import {forwardRefType} from './types'; import {HeaderContext, HeadingContext, Text, TextContext} from './Content'; import {IconContext} from './Icon'; import {InputContext, InputProps} from 'react-aria-components/Input'; +// @ts-ignore import intlMessages from '../intl/*.json'; import {ListLayout} from 'react-stately/useVirtualizerState'; import {mergeRefs} from 'react-aria/mergeRefs'; -// @ts-ignore import {Node} from '@react-types/shared'; import {Popover} from './Popover'; import {pressScale} from './pressScale'; import {ProgressCircle} from './ProgressCircle'; import {TextFieldRef} from './TextField'; import {useLocalizedStringFormatter} from 'react-aria/useLocalizedStringFormatter'; -import {useResizeObserver} from 'react-aria/private/utils/useResizeObserver'; import {useScale} from './utils'; import {useSlotId} from 'react-aria/private/utils/useId'; import {useSpectrumContextProps} from './useSpectrumContextProps'; @@ -500,23 +499,6 @@ const ComboboxInner = forwardRef(function ComboboxInner(props: ComboBoxProps(null); - // Make menu width match input + button - let [triggerWidth, setTriggerWidth] = useState(null); - let onResize = useCallback(() => { - if (triggerRef.current) { - let inputRect = triggerRef.current.getBoundingClientRect(); - let minX = inputRect.left; - let maxX = inputRect.right; - setTriggerWidth((maxX - minX) + 'px'); - } - }, [triggerRef, setTriggerWidth]); - - useResizeObserver({ - ref: triggerRef, - onResize: onResize - }); - let state = useContext(ComboBoxStateContext); let timeout = useRef | null>(null); let [showLoading, setShowLoading] = useState(false); @@ -614,7 +596,6 @@ const ComboboxInner = forwardRef(function ComboboxInner(props: ComboBoxProps -```tsx links={{ComboBox: '#combobox', ComboBoxValue: '#comboboxvalue', Button: 'Button', Popover: 'Popover', ListBox: 'ListBox'}} +```tsx links={{ComboBox: '#combobox', ComboBoxValue: '#comboboxvalue', Group: 'Group', Button: 'Button', Popover: 'Popover', ListBox: 'ListBox'}}