|
5 | 5 | * found at http://www.apache.org/licenses/LICENSE-2.0. |
6 | 6 | */ |
7 | 7 |
|
8 | | -import React, { ButtonHTMLAttributes, useState, forwardRef } from 'react'; |
9 | | -import PropTypes from 'prop-types'; |
10 | | -import { composeEventHandlers } from '@zendeskgarden/container-utilities'; |
11 | | -import OverflowStrokeIcon from '@zendeskgarden/svg-icons/src/16/overflow-stroke.svg'; |
12 | | -import { StyledOverflowButton, StyledOverflowButtonIconWrapper } from '../styled'; |
| 8 | +import React, { ButtonHTMLAttributes, forwardRef } from 'react'; |
| 9 | +import OverflowStrokeIcon from '@zendeskgarden/svg-icons/src/16/overflow-vertical-stroke.svg'; |
| 10 | +import { StyledOverflowButton } from '../styled'; |
13 | 11 | import { useTableContext } from '../utils/useTableContext'; |
14 | 12 |
|
15 | | -export interface IOverflowButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> { |
16 | | - /** @ignore Applies hover styling */ |
17 | | - isHovered?: boolean; |
18 | | - /** @ignore Applies active styling */ |
19 | | - isActive?: boolean; |
20 | | - /** @ignore Applies focus styling */ |
21 | | - isFocused?: boolean; |
22 | | -} |
23 | | - |
24 | 13 | /** |
25 | 14 | * @deprecated use `Table.OverflowButton` instead |
26 | 15 | * |
27 | 16 | * @extends ButtonHTMLAttributes<HTMLButtonElement> |
28 | 17 | */ |
29 | | -export const OverflowButton = forwardRef<HTMLButtonElement, IOverflowButtonProps>( |
30 | | - ({ onFocus, onBlur, isFocused: focused, ...other }, ref) => { |
31 | | - const [isFocused, setIsFocused] = useState(false); |
32 | | - const { size } = useTableContext(); |
| 18 | +export const OverflowButton = forwardRef< |
| 19 | + HTMLButtonElement, |
| 20 | + ButtonHTMLAttributes<HTMLButtonElement> |
| 21 | +>((props, ref) => { |
| 22 | + const { size } = useTableContext(); |
33 | 23 |
|
34 | | - return ( |
35 | | - <StyledOverflowButton |
36 | | - onFocus={composeEventHandlers(onFocus, () => { |
37 | | - setIsFocused(true); |
38 | | - })} |
39 | | - onBlur={composeEventHandlers(onBlur, () => { |
40 | | - setIsFocused(false); |
41 | | - })} |
42 | | - size={size} |
43 | | - isFocused={typeof focused === 'undefined' ? isFocused : focused} |
44 | | - ref={ref} |
45 | | - {...other} |
46 | | - > |
47 | | - <StyledOverflowButtonIconWrapper> |
48 | | - <OverflowStrokeIcon /> |
49 | | - </StyledOverflowButtonIconWrapper> |
50 | | - </StyledOverflowButton> |
51 | | - ); |
52 | | - } |
53 | | -); |
| 24 | + return ( |
| 25 | + <StyledOverflowButton type="button" $size={size} ref={ref} {...props} focusInset> |
| 26 | + <OverflowStrokeIcon /> |
| 27 | + </StyledOverflowButton> |
| 28 | + ); |
| 29 | +}); |
54 | 30 |
|
55 | 31 | OverflowButton.displayName = 'OverflowButton'; |
56 | | - |
57 | | -OverflowButton.propTypes = { |
58 | | - isHovered: PropTypes.bool, |
59 | | - isActive: PropTypes.bool, |
60 | | - isFocused: PropTypes.bool |
61 | | -}; |
0 commit comments