@pingux/astro 2.27.0-alpha.3 → 2.27.0-alpha.4

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.
@@ -74,11 +74,11 @@ var HelpHint = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
74
74
  focusProps = _useFocusRing.focusProps,
75
75
  isFocusVisible = _useFocusRing.isFocusVisible;
76
76
  var _useHover = (0, _interactions.useHover)({}),
77
- hoverProps = _useHover.hoverProps,
78
- isHovered = _useHover.isHovered;
77
+ overlayHoverProps = _useHover.hoverProps,
78
+ isOverlayHovered = _useHover.isHovered;
79
79
  var _useHover2 = (0, _interactions.useHover)({}),
80
- overlayHoverProps = _useHover2.hoverProps,
81
- isOverlayHovered = _useHover2.isHovered;
80
+ hoverProps = _useHover2.hoverProps,
81
+ isTriggerHovered = _useHover2.isHovered;
82
82
  var popoverState = (0, _reactStately.useOverlayTriggerState)({});
83
83
  var open = popoverState.open,
84
84
  close = popoverState.close,
@@ -98,15 +98,16 @@ var HelpHint = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
98
98
  // but keep it open if the trigger or overlay are hovered again before it closes.
99
99
  (0, _react.useEffect)(function () {
100
100
  var timeout;
101
- if (isHovered || isOverlayHovered || isFocusWithinOverlay) {
101
+ var isHovered = isTriggerHovered || isOverlayHovered;
102
+ if (isHovered || isFocusWithinOverlay) {
102
103
  open();
103
- } else {
104
+ } else if (!isFocusWithinOverlay && !isFocusVisible && !isHovered) {
104
105
  timeout = (0, _setTimeout2["default"])(close, closeDelay || 1000);
105
106
  }
106
107
  return function () {
107
108
  clearTimeout(timeout);
108
109
  };
109
- }, [isHovered, isOverlayHovered, isFocusWithinOverlay, open, close, closeDelay]);
110
+ }, [isFocusWithinOverlay, isFocusVisible, isOverlayHovered, isTriggerHovered]);
110
111
  (0, _react.useEffect)(function () {
111
112
  if (isOpen) {
112
113
  return triggerRef === null || triggerRef === void 0 ? void 0 : triggerRef.current.setAttribute('aria-expanded', 'true');
@@ -170,7 +171,8 @@ var HelpHint = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
170
171
  restoreFocus: true,
171
172
  autoFocus: isFocusVisible
172
173
  }, (0, _react2.jsx)(_.Box, {
173
- variant: "helpHint.popoverContainer"
174
+ variant: "helpHint.popoverContainer",
175
+ role: "status"
174
176
  }, _safariAgent.isSafari ? addIsSafariCompatiblePropToLinkChildren(children) : children))));
175
177
  });
176
178
  HelpHint.propTypes = {
@@ -87,7 +87,7 @@ test('keeps the popover open if the popover is hovered', /*#__PURE__*/(0, _async
87
87
  }
88
88
  }, _callee2);
89
89
  })));
90
- test('popover without focusable children should open onPress and disappear in 1000ms', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
90
+ test('popover without focusable children should open onPress and disappear in 1000ms after blur', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
91
91
  var helpHintButton;
92
92
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
93
93
  while (1) switch (_context3.prev = _context3.next) {
@@ -99,20 +99,21 @@ test('popover without focusable children should open onPress and disappear in 10
99
99
  _userEvent["default"].type(helpHintButton, '{enter}', {
100
100
  skipClick: true
101
101
  });
102
- _context3.next = 7;
102
+ _userEvent["default"].tab();
103
+ _context3.next = 8;
103
104
  return (0, _testWrapper.waitFor)(function () {
104
105
  expect(_testWrapper.screen.queryByRole('presentation')).toBeInTheDocument();
105
106
  }, {
106
107
  timeout: 500
107
108
  });
108
- case 7:
109
- _context3.next = 9;
109
+ case 8:
110
+ _context3.next = 10;
110
111
  return (0, _testWrapper.waitFor)(function () {
111
112
  expect(_testWrapper.screen.queryByRole('presentation')).not.toBeInTheDocument();
112
113
  }, {
113
114
  timeout: 1100
114
115
  });
115
- case 9:
116
+ case 10:
116
117
  case "end":
117
118
  return _context3.stop();
118
119
  }
@@ -61,11 +61,11 @@ var HelpHint = /*#__PURE__*/forwardRef(function (props, ref) {
61
61
  focusProps = _useFocusRing.focusProps,
62
62
  isFocusVisible = _useFocusRing.isFocusVisible;
63
63
  var _useHover = useHover({}),
64
- hoverProps = _useHover.hoverProps,
65
- isHovered = _useHover.isHovered;
64
+ overlayHoverProps = _useHover.hoverProps,
65
+ isOverlayHovered = _useHover.isHovered;
66
66
  var _useHover2 = useHover({}),
67
- overlayHoverProps = _useHover2.hoverProps,
68
- isOverlayHovered = _useHover2.isHovered;
67
+ hoverProps = _useHover2.hoverProps,
68
+ isTriggerHovered = _useHover2.isHovered;
69
69
  var popoverState = useOverlayTriggerState({});
70
70
  var open = popoverState.open,
71
71
  close = popoverState.close,
@@ -85,15 +85,16 @@ var HelpHint = /*#__PURE__*/forwardRef(function (props, ref) {
85
85
  // but keep it open if the trigger or overlay are hovered again before it closes.
86
86
  useEffect(function () {
87
87
  var timeout;
88
- if (isHovered || isOverlayHovered || isFocusWithinOverlay) {
88
+ var isHovered = isTriggerHovered || isOverlayHovered;
89
+ if (isHovered || isFocusWithinOverlay) {
89
90
  open();
90
- } else {
91
+ } else if (!isFocusWithinOverlay && !isFocusVisible && !isHovered) {
91
92
  timeout = _setTimeout(close, closeDelay || 1000);
92
93
  }
93
94
  return function () {
94
95
  clearTimeout(timeout);
95
96
  };
96
- }, [isHovered, isOverlayHovered, isFocusWithinOverlay, open, close, closeDelay]);
97
+ }, [isFocusWithinOverlay, isFocusVisible, isOverlayHovered, isTriggerHovered]);
97
98
  useEffect(function () {
98
99
  if (isOpen) {
99
100
  return triggerRef === null || triggerRef === void 0 ? void 0 : triggerRef.current.setAttribute('aria-expanded', 'true');
@@ -157,7 +158,8 @@ var HelpHint = /*#__PURE__*/forwardRef(function (props, ref) {
157
158
  restoreFocus: true,
158
159
  autoFocus: isFocusVisible
159
160
  }, ___EmotionJSX(Box, {
160
- variant: "helpHint.popoverContainer"
161
+ variant: "helpHint.popoverContainer",
162
+ role: "status"
161
163
  }, isSafari ? addIsSafariCompatiblePropToLinkChildren(children) : children))));
162
164
  });
163
165
  HelpHint.propTypes = {
@@ -84,7 +84,7 @@ test('keeps the popover open if the popover is hovered', /*#__PURE__*/_asyncToGe
84
84
  }
85
85
  }, _callee2);
86
86
  })));
87
- test('popover without focusable children should open onPress and disappear in 1000ms', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
87
+ test('popover without focusable children should open onPress and disappear in 1000ms after blur', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
88
88
  var helpHintButton;
89
89
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
90
90
  while (1) switch (_context3.prev = _context3.next) {
@@ -96,20 +96,21 @@ test('popover without focusable children should open onPress and disappear in 10
96
96
  userEvent.type(helpHintButton, '{enter}', {
97
97
  skipClick: true
98
98
  });
99
- _context3.next = 7;
99
+ userEvent.tab();
100
+ _context3.next = 8;
100
101
  return waitFor(function () {
101
102
  expect(screen.queryByRole('presentation')).toBeInTheDocument();
102
103
  }, {
103
104
  timeout: 500
104
105
  });
105
- case 7:
106
- _context3.next = 9;
106
+ case 8:
107
+ _context3.next = 10;
107
108
  return waitFor(function () {
108
109
  expect(screen.queryByRole('presentation')).not.toBeInTheDocument();
109
110
  }, {
110
111
  timeout: 1100
111
112
  });
112
- case 9:
113
+ case 10:
113
114
  case "end":
114
115
  return _context3.stop();
115
116
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "2.27.0-alpha.3",
3
+ "version": "2.27.0-alpha.4",
4
4
  "description": "React component library for Ping Identity's design system",
5
5
  "repository": {
6
6
  "type": "git",