diff --git a/packages/bumbag/src/Autosuggest/Autosuggest.tsx b/packages/bumbag/src/Autosuggest/Autosuggest.tsx index 84c3a97b6..91221b83b 100644 --- a/packages/bumbag/src/Autosuggest/Autosuggest.tsx +++ b/packages/bumbag/src/Autosuggest/Autosuggest.tsx @@ -10,7 +10,7 @@ import { Input, InputProps } from '../Input'; import { DropdownMenu, DropdownMenuPopover, - DropdownMenuDisclosure, + DropdownMenuButton, DropdownMenuPopoverProps, DropdownMenuItemProps, DropdownMenuInitialState, @@ -252,7 +252,7 @@ const useProps = createHook( gutter: 4, ...dropdownMenuInitialState, }); - const dropdownMenuDisclosureProps = DropdownMenuDisclosure.useProps(dropdownMenu); + const dropdownMenuButtonProps = DropdownMenuButton.useProps(dropdownMenu); ////////////////////////////////////////////////// @@ -584,7 +584,7 @@ const useProps = createHook( return { ...boxProps, - 'aria-expanded': dropdownMenuDisclosureProps['aria-expanded'], + 'aria-expanded': dropdownMenuButtonProps['aria-expanded'], 'aria-haspopup': 'listbox', 'aria-owns': dropdownMenu.baseId, role: 'combobox', @@ -592,13 +592,12 @@ const useProps = createHook( children: ( } aria-autocomplete="list" aria-activedescendant={dropdownMenu?.items?.[highlightedIndex]?.id} className={inputClassName} disabled={disabled} - elementRef={dropdownMenuDisclosureProps.ref} isLoading={isInputLoading} onBlur={handleBlurInput} onClick={handleClickInput} diff --git a/packages/bumbag/src/DropdownMenu/DropdownMenuDisclosure.tsx b/packages/bumbag/src/DropdownMenu/DropdownMenuDisclosure.tsx deleted file mode 100644 index d3948fc66..000000000 --- a/packages/bumbag/src/DropdownMenu/DropdownMenuDisclosure.tsx +++ /dev/null @@ -1,90 +0,0 @@ -import { - Box as ReakitBox, - useMenuButton as useReakitMenuDisclosure, - MenuButtonProps as ReakitMenuDisclosureProps, -} from 'reakit'; - -import { useClassName, createComponent, createElement, createHook } from '../utils'; -import { Box, BoxProps } from '../Box'; - -import * as styles from './styles'; - -export type LocalDropdownMenuDisclosureProps = {}; -export type DropdownMenuDisclosureProps = BoxProps & ReakitMenuDisclosureProps & LocalDropdownMenuDisclosureProps; - -const useProps = createHook( - (props, { themeKey, themeKeyOverride }) => { - const { - baseId, - currentId, - disabled, - first, - focusable, - hide, - move, - last, - placement, - show, - toggle, - visible, - unstable_arrowStyles, - unstable_clickOnEnter, - unstable_clickOnSpace, - unstable_disclosureRef, - unstable_popoverStyles, - unstable_moves, - unstable_referenceRef, - ...restProps - } = props; - const dropdownMenuDisclosureProps = useReakitMenuDisclosure( - { - baseId, - currentId, - disabled, - first, - focusable, - hide, - move, - last, - placement, - show, - toggle, - visible, - unstable_arrowStyles, - unstable_clickOnEnter, - unstable_clickOnSpace, - unstable_disclosureRef, - unstable_popoverStyles, - unstable_moves, - unstable_referenceRef, - }, - restProps - ); - const boxProps = Box.useProps({ ...restProps, ...dropdownMenuDisclosureProps }); - - const className = useClassName({ - style: styles.DropdownMenuDisclosure, - styleProps: props, - themeKey, - themeKeyOverride, - prevClassName: boxProps.className, - }); - - return { ...boxProps, className }; - }, - { themeKey: 'DropdownMenu.Disclosure' } -); - -export const DropdownMenuDisclosure = createComponent( - (props) => { - const textProps = useProps(props); - return createElement({ children: props.children, component: ReakitBox, use: props.use, htmlProps: textProps }); - }, - { - attach: { - useProps, - displayName: 'DropdownMenu.Disclosure', - }, - themeKey: 'DropdownMenu.Disclosure', - } -); diff --git a/packages/bumbag/src/DropdownMenu/DropdownMenuPopover.tsx b/packages/bumbag/src/DropdownMenu/DropdownMenuPopover.tsx index 54e57b249..6214da4c3 100644 --- a/packages/bumbag/src/DropdownMenu/DropdownMenuPopover.tsx +++ b/packages/bumbag/src/DropdownMenu/DropdownMenuPopover.tsx @@ -31,6 +31,7 @@ const useProps = createHook( items, setCurrentId, wrap, + unstable_disclosureRef, unstable_initialFocusRef, unstable_finalFocusRef, unstable_popoverRef, @@ -65,6 +66,7 @@ const useProps = createHook( items, setCurrentId, wrap, + unstable_disclosureRef, unstable_initialFocusRef, unstable_finalFocusRef, unstable_popoverRef, diff --git a/packages/bumbag/src/DropdownMenu/index.ts b/packages/bumbag/src/DropdownMenu/index.ts index 70dc63439..f0aac7c1d 100644 --- a/packages/bumbag/src/DropdownMenu/index.ts +++ b/packages/bumbag/src/DropdownMenu/index.ts @@ -3,7 +3,6 @@ import { DropdownMenu as _DropdownMenu } from './DropdownMenu'; import { DropdownMenuPopover } from './DropdownMenuPopover'; import { DropdownMenuItem } from './DropdownMenuItem'; import { DropdownMenuButton } from './DropdownMenuButton'; -import { DropdownMenuDisclosure } from './DropdownMenuDisclosure'; import { DropdownMenuDivider } from './DropdownMenuDivider'; import { DropdownMenuGroup } from './DropdownMenuGroup'; import { useDropdownMenuState, DropdownMenuState } from './DropdownMenuState'; @@ -11,7 +10,6 @@ import { useDropdownMenuState, DropdownMenuState } from './DropdownMenuState'; export * from './DropdownMenu'; export * from './DropdownMenuItem'; export * from './DropdownMenuButton'; -export * from './DropdownMenuDisclosure'; export * from './DropdownMenuPopover'; export * from './DropdownMenuGroup'; export * from './DropdownMenuDivider'; @@ -19,7 +17,6 @@ export * from './DropdownMenuState'; export const DropdownMenu = Object.assign(_DropdownMenu, { Popover: DropdownMenuPopover, Button: DropdownMenuButton, - Disclosure: DropdownMenuDisclosure, Item: DropdownMenuItem, Divider: DropdownMenuDivider, Group: DropdownMenuGroup,