@pingux/astro 2.5.4-alpha.8 → 2.5.5-alpha.0
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,18 @@
|
|
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
|
+
## [2.5.4](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@2.5.3...@pingux/astro@2.5.4) (2023-06-15)
|
7
|
+
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
* [6099] Astro LinkedListView fix story name ([e1e5ce5](https://gitlab.corp.pingidentity.com/ux/pingux/commit/e1e5ce580b2b2256d7f96c14ab45ff9f75eebe59))
|
12
|
+
* [UIP-6322] Nav items and buttons right-padding 15px (md) ([6c9a4cd](https://gitlab.corp.pingidentity.com/ux/pingux/commit/6c9a4cdc60d9c0289984a7c219c7f979c5b6530f))
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
|
6
18
|
## [2.5.3](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@2.5.2...@pingux/astro@2.5.3) (2023-06-06)
|
7
19
|
|
8
20
|
|
@@ -20,6 +20,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/he
|
|
20
20
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
|
21
21
|
var _react = _interopRequireWildcard(require("react"));
|
22
22
|
var _reactAria = require("react-aria");
|
23
|
+
var _overlays = require("@react-aria/overlays");
|
23
24
|
var _CloseIcon = _interopRequireDefault(require("mdi-react/CloseIcon"));
|
24
25
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
25
26
|
var _hooks = require("../../hooks");
|
@@ -71,21 +72,22 @@ var Modal = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
71
72
|
shouldCloseOnInteractOutside: shouldCloseOnInteractOutside,
|
72
73
|
children: children
|
73
74
|
}, propsContentProps);
|
75
|
+
var modalState = {
|
76
|
+
isOpen: isOpen,
|
77
|
+
close: onClose
|
78
|
+
};
|
74
79
|
var modalRef = (0, _react.useRef)();
|
75
80
|
/* istanbul ignore next */
|
76
81
|
(0, _react.useImperativeHandle)(ref, function () {
|
77
82
|
return modalRef.current;
|
78
83
|
});
|
79
84
|
// Handle interacting outside the dialog and pressing
|
80
|
-
// the Escape key to close the modal
|
81
|
-
|
82
|
-
overlayProps = _useOverlay.overlayProps;
|
83
|
-
|
84
|
-
// Prevent scrolling while the modal is open, and hide content
|
85
|
+
// the Escape key to close the modal,
|
86
|
+
// prevent scrolling while the modal is open, and hide content
|
85
87
|
// outside the modal from screen readers.
|
86
|
-
(0,
|
87
|
-
|
88
|
-
|
88
|
+
var _useModalOverlay = (0, _overlays.useModalOverlay)(contentProps, modalState, modalRef),
|
89
|
+
modalProps = _useModalOverlay.modalProps,
|
90
|
+
underlayProps = _useModalOverlay.underlayProps;
|
89
91
|
|
90
92
|
// Get props for the dialog and its title
|
91
93
|
var _useDialog = (0, _reactAria.useDialog)(contentProps, modalRef),
|
@@ -95,14 +97,14 @@ var Modal = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
95
97
|
classNames = _useStatusClasses.classNames;
|
96
98
|
return (0, _react2.jsx)(_reactAria.OverlayContainer, null, (0, _react2.jsx)(_Box["default"], (0, _extends2["default"])({
|
97
99
|
variant: "modal.container"
|
98
|
-
},
|
100
|
+
}, (0, _reactAria.mergeProps)(containerProps, underlayProps, others)), (0, _react2.jsx)(_reactAria.FocusScope, {
|
99
101
|
contain: true,
|
100
102
|
restoreFocus: true,
|
101
103
|
autoFocus: hasAutoFocus
|
102
104
|
}, (0, _react2.jsx)(_Box["default"], (0, _extends2["default"])({
|
103
105
|
variant: "modal.content",
|
104
106
|
className: classNames
|
105
|
-
}, propsContentProps,
|
107
|
+
}, propsContentProps, dialogProps, modalProps, {
|
106
108
|
ref: modalRef,
|
107
109
|
"aria-modal": true
|
108
110
|
}), hasCloseButton && (closeButton !== null && closeButton !== void 0 ? closeButton : (0, _react2.jsx)(_IconButton["default"], {
|
@@ -59,7 +59,7 @@ test('close button should close the modal', function () {
|
|
59
59
|
});
|
60
60
|
|
61
61
|
// Target the close button
|
62
|
-
_userEvent["default"].click(_testWrapper.screen.queryAllByRole('button')[
|
62
|
+
_userEvent["default"].click(_testWrapper.screen.queryAllByRole('button')[0]);
|
63
63
|
expect(_testWrapper.screen.queryByRole('dialog')).not.toBeInTheDocument();
|
64
64
|
});
|
65
65
|
test('keyboard interactions on the close button should close the modal', function () {
|
@@ -68,13 +68,23 @@ test('keyboard interactions on the close button should close the modal', functio
|
|
68
68
|
});
|
69
69
|
|
70
70
|
// Target the close button
|
71
|
-
_testWrapper.fireEvent.keyDown(_testWrapper.screen.queryAllByRole('button')[
|
71
|
+
_testWrapper.fireEvent.keyDown(_testWrapper.screen.queryAllByRole('button')[0], {
|
72
72
|
key: 'Enter',
|
73
73
|
code: 13
|
74
74
|
});
|
75
|
-
_testWrapper.fireEvent.keyUp(_testWrapper.screen.queryAllByRole('button')[
|
75
|
+
_testWrapper.fireEvent.keyUp(_testWrapper.screen.queryAllByRole('button')[0], {
|
76
76
|
key: 'Enter',
|
77
77
|
code: 13
|
78
78
|
});
|
79
79
|
expect(_testWrapper.screen.queryByRole('dialog')).not.toBeInTheDocument();
|
80
|
+
});
|
81
|
+
test('assign aria-hidden to elements outside the modal when the modal is opened', function () {
|
82
|
+
getComposedComponent();
|
83
|
+
var button = _testWrapper.screen.queryByRole('button');
|
84
|
+
var buttonParent = button.closest('div');
|
85
|
+
expect(buttonParent).not.toHaveAttribute('aria-hidden');
|
86
|
+
|
87
|
+
// Open the modal
|
88
|
+
_userEvent["default"].click(_testWrapper.screen.queryByRole('button'));
|
89
|
+
expect(buttonParent).toHaveAttribute('aria-hidden');
|
80
90
|
});
|
@@ -13,7 +13,8 @@ var _excluded = ["className", "closeButton", "hasAutoFocus", "hasCloseButton", "
|
|
13
13
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
14
14
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
15
15
|
import React, { forwardRef, useImperativeHandle, useRef } from 'react';
|
16
|
-
import { FocusScope, OverlayContainer, useDialog
|
16
|
+
import { FocusScope, mergeProps, OverlayContainer, useDialog } from 'react-aria';
|
17
|
+
import { useModalOverlay } from '@react-aria/overlays';
|
17
18
|
import CloseIcon from 'mdi-react/CloseIcon';
|
18
19
|
import PropTypes from 'prop-types';
|
19
20
|
import { useStatusClasses } from '../../hooks';
|
@@ -60,21 +61,22 @@ var Modal = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
60
61
|
shouldCloseOnInteractOutside: shouldCloseOnInteractOutside,
|
61
62
|
children: children
|
62
63
|
}, propsContentProps);
|
64
|
+
var modalState = {
|
65
|
+
isOpen: isOpen,
|
66
|
+
close: onClose
|
67
|
+
};
|
63
68
|
var modalRef = useRef();
|
64
69
|
/* istanbul ignore next */
|
65
70
|
useImperativeHandle(ref, function () {
|
66
71
|
return modalRef.current;
|
67
72
|
});
|
68
73
|
// Handle interacting outside the dialog and pressing
|
69
|
-
// the Escape key to close the modal
|
70
|
-
|
71
|
-
overlayProps = _useOverlay.overlayProps;
|
72
|
-
|
73
|
-
// Prevent scrolling while the modal is open, and hide content
|
74
|
+
// the Escape key to close the modal,
|
75
|
+
// prevent scrolling while the modal is open, and hide content
|
74
76
|
// outside the modal from screen readers.
|
75
|
-
|
76
|
-
|
77
|
-
|
77
|
+
var _useModalOverlay = useModalOverlay(contentProps, modalState, modalRef),
|
78
|
+
modalProps = _useModalOverlay.modalProps,
|
79
|
+
underlayProps = _useModalOverlay.underlayProps;
|
78
80
|
|
79
81
|
// Get props for the dialog and its title
|
80
82
|
var _useDialog = useDialog(contentProps, modalRef),
|
@@ -84,14 +86,14 @@ var Modal = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
84
86
|
classNames = _useStatusClasses.classNames;
|
85
87
|
return ___EmotionJSX(OverlayContainer, null, ___EmotionJSX(Box, _extends({
|
86
88
|
variant: "modal.container"
|
87
|
-
},
|
89
|
+
}, mergeProps(containerProps, underlayProps, others)), ___EmotionJSX(FocusScope, {
|
88
90
|
contain: true,
|
89
91
|
restoreFocus: true,
|
90
92
|
autoFocus: hasAutoFocus
|
91
93
|
}, ___EmotionJSX(Box, _extends({
|
92
94
|
variant: "modal.content",
|
93
95
|
className: classNames
|
94
|
-
}, propsContentProps,
|
96
|
+
}, propsContentProps, dialogProps, modalProps, {
|
95
97
|
ref: modalRef,
|
96
98
|
"aria-modal": true
|
97
99
|
}), hasCloseButton && (closeButton !== null && closeButton !== void 0 ? closeButton : ___EmotionJSX(IconButton, {
|
@@ -57,7 +57,7 @@ test('close button should close the modal', function () {
|
|
57
57
|
});
|
58
58
|
|
59
59
|
// Target the close button
|
60
|
-
userEvent.click(screen.queryAllByRole('button')[
|
60
|
+
userEvent.click(screen.queryAllByRole('button')[0]);
|
61
61
|
expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
|
62
62
|
});
|
63
63
|
test('keyboard interactions on the close button should close the modal', function () {
|
@@ -66,13 +66,23 @@ test('keyboard interactions on the close button should close the modal', functio
|
|
66
66
|
});
|
67
67
|
|
68
68
|
// Target the close button
|
69
|
-
fireEvent.keyDown(screen.queryAllByRole('button')[
|
69
|
+
fireEvent.keyDown(screen.queryAllByRole('button')[0], {
|
70
70
|
key: 'Enter',
|
71
71
|
code: 13
|
72
72
|
});
|
73
|
-
fireEvent.keyUp(screen.queryAllByRole('button')[
|
73
|
+
fireEvent.keyUp(screen.queryAllByRole('button')[0], {
|
74
74
|
key: 'Enter',
|
75
75
|
code: 13
|
76
76
|
});
|
77
77
|
expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
|
78
|
+
});
|
79
|
+
test('assign aria-hidden to elements outside the modal when the modal is opened', function () {
|
80
|
+
getComposedComponent();
|
81
|
+
var button = screen.queryByRole('button');
|
82
|
+
var buttonParent = button.closest('div');
|
83
|
+
expect(buttonParent).not.toHaveAttribute('aria-hidden');
|
84
|
+
|
85
|
+
// Open the modal
|
86
|
+
userEvent.click(screen.queryByRole('button'));
|
87
|
+
expect(buttonParent).toHaveAttribute('aria-hidden');
|
78
88
|
});
|