@pingux/astro 1.0.0-alpha.17 → 1.0.0-alpha.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,17 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
# [1.0.0-alpha.18](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.0.0-alpha.17...@pingux/astro@1.0.0-alpha.18) (2022-01-13)
|
7
|
+
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
* [UIP-5107] IconButton - no focus in disabled state ([f301f6d](https://gitlab.corp.pingidentity.com/ux/pingux/commit/f301f6d0cdc8271c992eb3384094cafbd59fa0d5))
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
6
17
|
# [1.0.0-alpha.17](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.0.0-alpha.16...@pingux/astro@1.0.0-alpha.17) (2022-01-13)
|
7
18
|
|
8
19
|
|
@@ -40,6 +40,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
40
40
|
|
41
41
|
var _themeUi = require("theme-ui");
|
42
42
|
|
43
|
+
var _button = require("@react-aria/button");
|
44
|
+
|
43
45
|
var _focus = require("@react-aria/focus");
|
44
46
|
|
45
47
|
var _interactions = require("@react-aria/interactions");
|
@@ -84,15 +86,13 @@ var IconButton = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
84
86
|
return buttonRef.current;
|
85
87
|
});
|
86
88
|
|
89
|
+
var _useButton = (0, _button.useButton)(_objectSpread({}, props), buttonRef),
|
90
|
+
buttonProps = _useButton.buttonProps,
|
91
|
+
isPressed = _useButton.isPressed;
|
92
|
+
|
87
93
|
var _useContext = (0, _react.useContext)(_ChipContext.ChipContext),
|
88
94
|
chipBg = _useContext.bg;
|
89
95
|
|
90
|
-
var _usePress = (0, _interactions.usePress)(_objectSpread({
|
91
|
-
ref: buttonRef
|
92
|
-
}, props)),
|
93
|
-
isPressed = _usePress.isPressed,
|
94
|
-
pressProps = _usePress.pressProps;
|
95
|
-
|
96
96
|
var _useHover = (0, _interactions.useHover)(props),
|
97
97
|
hoverProps = _useHover.hoverProps,
|
98
98
|
isHovered = _useHover.isHovered;
|
@@ -121,7 +121,7 @@ var IconButton = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
121
121
|
fill: chipBg
|
122
122
|
}
|
123
123
|
}
|
124
|
-
},
|
124
|
+
}, (0, _utils.mergeProps)(hoverProps, focusProps, buttonProps, others)), children);
|
125
125
|
|
126
126
|
if (title) {
|
127
127
|
return (0, _react2.jsx)(_TooltipTrigger["default"], {
|
@@ -46,7 +46,6 @@ test('default icon button', function () {
|
|
46
46
|
|
47
47
|
expect(button).toHaveAttribute('data-testid', testId);
|
48
48
|
expect(button).toBeInstanceOf(HTMLButtonElement);
|
49
|
-
expect(button).toHaveAttribute('tabindex', '0');
|
50
49
|
expect(button).toBeInTheDocument();
|
51
50
|
});
|
52
51
|
test('icon button hover', function () {
|
@@ -17,8 +17,9 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
17
17
|
import React, { forwardRef, useRef, useImperativeHandle, useContext } from 'react';
|
18
18
|
import PropTypes from 'prop-types';
|
19
19
|
import { IconButton as ThemeUIIconButton } from 'theme-ui';
|
20
|
+
import { useButton } from '@react-aria/button';
|
20
21
|
import { useFocusRing } from '@react-aria/focus';
|
21
|
-
import { Pressable, useHover
|
22
|
+
import { Pressable, useHover } from '@react-aria/interactions';
|
22
23
|
import { mergeProps } from '@react-aria/utils';
|
23
24
|
import { useAriaLabelWarning, useStatusClasses } from '../../hooks';
|
24
25
|
import { ChipContext } from '../Chip/ChipContext';
|
@@ -52,15 +53,13 @@ var IconButton = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
52
53
|
return buttonRef.current;
|
53
54
|
});
|
54
55
|
|
56
|
+
var _useButton = useButton(_objectSpread({}, props), buttonRef),
|
57
|
+
buttonProps = _useButton.buttonProps,
|
58
|
+
isPressed = _useButton.isPressed;
|
59
|
+
|
55
60
|
var _useContext = useContext(ChipContext),
|
56
61
|
chipBg = _useContext.bg;
|
57
62
|
|
58
|
-
var _usePress = usePress(_objectSpread({
|
59
|
-
ref: buttonRef
|
60
|
-
}, props)),
|
61
|
-
isPressed = _usePress.isPressed,
|
62
|
-
pressProps = _usePress.pressProps;
|
63
|
-
|
64
63
|
var _useHover = useHover(props),
|
65
64
|
hoverProps = _useHover.hoverProps,
|
66
65
|
isHovered = _useHover.isHovered;
|
@@ -90,7 +89,7 @@ var IconButton = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
90
89
|
fill: chipBg
|
91
90
|
}
|
92
91
|
}
|
93
|
-
},
|
92
|
+
}, mergeProps(hoverProps, focusProps, buttonProps, others)), children);
|
94
93
|
|
95
94
|
if (title) {
|
96
95
|
return ___EmotionJSX(TooltipTrigger, {
|
@@ -32,7 +32,6 @@ test('default icon button', function () {
|
|
32
32
|
var button = screen.getByRole('button');
|
33
33
|
expect(button).toHaveAttribute('data-testid', testId);
|
34
34
|
expect(button).toBeInstanceOf(HTMLButtonElement);
|
35
|
-
expect(button).toHaveAttribute('tabindex', '0');
|
36
35
|
expect(button).toBeInTheDocument();
|
37
36
|
});
|
38
37
|
test('icon button hover', function () {
|