@pingux/astro 1.14.0-alpha.91 → 1.15.0-alpha.1
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 +20 -0
- package/lib/cjs/components/Breadcrumbs/Breadcrumbs.js +2 -1
- package/lib/cjs/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.js +12 -2
- package/lib/cjs/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.stories.js +4 -4
- package/lib/cjs/components/Messages/Messages.test.js +8 -3
- package/lib/cjs/components/Modal/Modal.js +8 -3
- package/lib/cjs/components/Modal/tests/Modal.unit.test.js +21 -1
- package/lib/cjs/styles/variants/buttons.js +6 -1
- package/lib/components/Breadcrumbs/Breadcrumbs.js +2 -1
- package/lib/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.js +11 -2
- package/lib/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.stories.js +5 -5
- package/lib/components/Messages/Messages.test.js +8 -3
- package/lib/components/Modal/Modal.js +8 -3
- package/lib/components/Modal/tests/Modal.unit.test.js +17 -1
- package/lib/styles/variants/buttons.js +6 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,26 @@
|
|
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.14.0](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.13.0...@pingux/astro@1.14.0) (2022-05-24)
|
7
|
+
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
* [UIP-5430] Popover failed accessibility test ([04ee92e](https://gitlab.corp.pingidentity.com/ux/pingux/commit/04ee92e60560a057da4fe488180146af76623540))
|
12
|
+
|
13
|
+
|
14
|
+
### Features
|
15
|
+
|
16
|
+
* [UIP-5368] IconButton a11y Improvement ([6dc0c33](https://gitlab.corp.pingidentity.com/ux/pingux/commit/6dc0c33cedd347e74f9c5154ccda0ed832945e0f))
|
17
|
+
* [UIP-5402] Allow copying partial text from CopyText ([d2367de](https://gitlab.corp.pingidentity.com/ux/pingux/commit/d2367de2e78d7977363a774be9692bbce9cc33d9))
|
18
|
+
* [UIP-5410] Attribute mapping read only field recipe ([e472b5c](https://gitlab.corp.pingidentity.com/ux/pingux/commit/e472b5c987ab0b4cb4c405df635ba4c7756b39e1))
|
19
|
+
* [UIP-5413] Attributes and PingOne mappings recipe ([1d4d6e5](https://gitlab.corp.pingidentity.com/ux/pingux/commit/1d4d6e5ffddaa41981690c5c4a38e8e275394d8f))
|
20
|
+
* [UIP-5440] Trial exp industry buttons recipe ([35c212b](https://gitlab.corp.pingidentity.com/ux/pingux/commit/35c212bf197f9fd0a15888eda52b190240992584))
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
6
26
|
# [1.13.0](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.12.0...@pingux/astro@1.13.0) (2022-05-17)
|
7
27
|
|
8
28
|
|
@@ -80,7 +80,8 @@ var Breadcrumbs = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
80
80
|
return (0, _react2.jsx)(_index.Box, {
|
81
81
|
isRow: true,
|
82
82
|
sx: {
|
83
|
-
alignItems: 'center'
|
83
|
+
alignItems: 'center',
|
84
|
+
minHeight: 42
|
84
85
|
},
|
85
86
|
as: "li",
|
86
87
|
key: "li-".concat(child.key)
|
@@ -105,6 +105,11 @@ var EnvironmentBreadcrumb = /*#__PURE__*/(0, _react.forwardRef)(function (props,
|
|
105
105
|
searchValue = _useState2[0],
|
106
106
|
setSearchValue = _useState2[1];
|
107
107
|
|
108
|
+
var _useState3 = (0, _react.useState)([]),
|
109
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
110
|
+
selectedKeys = _useState4[0],
|
111
|
+
setSelectedKeys = _useState4[1];
|
112
|
+
|
108
113
|
var breadcrumbsRef = (0, _react.useRef)();
|
109
114
|
|
110
115
|
var overlayRef = _react["default"].useRef();
|
@@ -163,6 +168,7 @@ var EnvironmentBreadcrumb = /*#__PURE__*/(0, _react.forwardRef)(function (props,
|
|
163
168
|
var _selectedItemSet = (0, _slicedToArray2["default"])(selectedItemSet, 1),
|
164
169
|
selectedItemKey = _selectedItemSet[0];
|
165
170
|
|
171
|
+
setSelectedKeys(selectedItemSet);
|
166
172
|
onSelectionChange(selectedItemKey);
|
167
173
|
handlePopoverClose();
|
168
174
|
}, [handlePopoverClose, onSelectionChange]);
|
@@ -172,7 +178,7 @@ var EnvironmentBreadcrumb = /*#__PURE__*/(0, _react.forwardRef)(function (props,
|
|
172
178
|
items: items,
|
173
179
|
filter: imperativeItemsFilter || filterNodesWithChildren,
|
174
180
|
onSelectionChange: handleSelectionChange,
|
175
|
-
selectedKeys:
|
181
|
+
selectedKeys: selectedKeys,
|
176
182
|
selectionMode: 'single',
|
177
183
|
disallowEmptySelection: false
|
178
184
|
};
|
@@ -243,11 +249,15 @@ var EnvironmentBreadcrumb = /*#__PURE__*/(0, _react.forwardRef)(function (props,
|
|
243
249
|
py: 10,
|
244
250
|
px: 15
|
245
251
|
}, emptySearchText);
|
252
|
+
|
253
|
+
var _selectedKeys = (0, _slicedToArray2["default"])(selectedKeys, 1),
|
254
|
+
selectedValue = _selectedKeys[0];
|
255
|
+
|
246
256
|
var ItemsSelect = (0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)(_index.Button, (0, _extends2["default"])({}, triggerProps, {
|
247
257
|
onPress: handlePopoverOpen,
|
248
258
|
ref: triggerRef,
|
249
259
|
variant: "environmentBreadcrumb.current",
|
250
|
-
"aria-label": "".concat(typeof selectedItem === 'string' ? selectedItem : 'Selected Item')
|
260
|
+
"aria-label": "".concat((typeof selectedItem === 'string' ? selectedItem : selectedValue) || 'Selected Item')
|
251
261
|
}), selectedItem, (0, _react2.jsx)(_index.Icon, {
|
252
262
|
icon: popoverState.isOpen ? _ArrowDropUpIcon["default"] : _ArrowDropDownIcon["default"]
|
253
263
|
})), (0, _react2.jsx)(_index.PopoverContainer, (0, _extends2["default"])({}, overlayProps, positionProps, {
|
@@ -159,7 +159,7 @@ var Default = function Default(args) {
|
|
159
159
|
setSelectedEnvironment(_objectSpread({}, envObj));
|
160
160
|
};
|
161
161
|
|
162
|
-
return (0, _react2.jsx)(
|
162
|
+
return (0, _react2.jsx)(_EnvironmentBreadcrumb["default"], (0, _extends2["default"])({}, args, {
|
163
163
|
items: defaultEnvironments,
|
164
164
|
name: "Globochem",
|
165
165
|
selectedItem: envNode,
|
@@ -175,7 +175,7 @@ var Default = function Default(args) {
|
|
175
175
|
variant: "boxes.environmentChip",
|
176
176
|
bg: "neutral.40"
|
177
177
|
}) : null);
|
178
|
-
})
|
178
|
+
});
|
179
179
|
};
|
180
180
|
|
181
181
|
exports.Default = Default;
|
@@ -257,7 +257,7 @@ var WithSections = function WithSections() {
|
|
257
257
|
variant: "boxes.environmentChip",
|
258
258
|
bg: "neutral.40"
|
259
259
|
}) : null);
|
260
|
-
return (0, _react2.jsx)(
|
260
|
+
return (0, _react2.jsx)(_EnvironmentBreadcrumb["default"], {
|
261
261
|
items: environments,
|
262
262
|
name: "Globochem",
|
263
263
|
selectedItem: envNode,
|
@@ -287,7 +287,7 @@ var WithSections = function WithSections() {
|
|
287
287
|
bg: "neutral.40"
|
288
288
|
}) : null));
|
289
289
|
});
|
290
|
-
})
|
290
|
+
});
|
291
291
|
};
|
292
292
|
|
293
293
|
exports.WithSections = WithSections;
|
@@ -42,7 +42,12 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "functi
|
|
42
42
|
|
43
43
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
44
44
|
|
45
|
-
jest.mock('@react-aria/live-announcer')
|
45
|
+
jest.mock('@react-aria/live-announcer', function () {
|
46
|
+
return {
|
47
|
+
announce: jest.fn()
|
48
|
+
};
|
49
|
+
});
|
50
|
+
var mockAnnounce = _liveAnnouncer.announce;
|
46
51
|
var testId = 'test-messages';
|
47
52
|
var defaultProps = {
|
48
53
|
'data-testid': testId
|
@@ -204,7 +209,7 @@ describe('announcements', function () {
|
|
204
209
|
items: items
|
205
210
|
});
|
206
211
|
(0, _forEach["default"])(items).call(items, function (item) {
|
207
|
-
return expect(
|
212
|
+
return expect(mockAnnounce).toHaveBeenCalledWith(item.text, 'polite');
|
208
213
|
});
|
209
214
|
});
|
210
215
|
test('should announce on adding item', function () {
|
@@ -219,7 +224,7 @@ describe('announcements', function () {
|
|
219
224
|
_userEvent["default"].click(button);
|
220
225
|
|
221
226
|
expect(messages.childElementCount).toBe(1);
|
222
|
-
expect(
|
227
|
+
expect(mockAnnounce).toHaveBeenCalledWith('New message 1', 'polite');
|
223
228
|
});
|
224
229
|
});
|
225
230
|
test('should render messages with messagesReducerStory', function () {
|
@@ -58,7 +58,7 @@ var _hooks = require("../../hooks");
|
|
58
58
|
|
59
59
|
var _react2 = require("@emotion/react");
|
60
60
|
|
61
|
-
var _excluded = ["className", "closeButton", "hasCloseButton", "id", "isClosedOnBlur", "isDismissable", "isKeyboardDismissDisabled", "isOpen", "role", "title", "onClose", "shouldCloseOnInteractOutside", "children", "contentProps", "containerProps"];
|
61
|
+
var _excluded = ["className", "closeButton", "hasAutoFocus", "hasCloseButton", "id", "isClosedOnBlur", "isDismissable", "isKeyboardDismissDisabled", "isOpen", "role", "title", "onClose", "shouldCloseOnInteractOutside", "children", "contentProps", "containerProps"];
|
62
62
|
|
63
63
|
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
64
64
|
|
@@ -71,6 +71,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
71
71
|
var Modal = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
72
72
|
var className = props.className,
|
73
73
|
closeButton = props.closeButton,
|
74
|
+
hasAutoFocus = props.hasAutoFocus,
|
74
75
|
hasCloseButton = props.hasCloseButton,
|
75
76
|
id = props.id,
|
76
77
|
isClosedOnBlur = props.isClosedOnBlur,
|
@@ -136,11 +137,12 @@ var Modal = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
136
137
|
}, others, containerProps), (0, _react2.jsx)(_focus.FocusScope, {
|
137
138
|
contain: true,
|
138
139
|
restoreFocus: true,
|
139
|
-
autoFocus:
|
140
|
+
autoFocus: hasAutoFocus
|
140
141
|
}, (0, _react2.jsx)(_Box["default"], (0, _extends2["default"])({
|
141
142
|
variant: "modal.content"
|
142
143
|
}, propsContentProps, overlayProps, dialogProps, modalProps, {
|
143
|
-
ref: modalRef
|
144
|
+
ref: modalRef,
|
145
|
+
"aria-modal": true
|
144
146
|
}), hasCloseButton && (closeButton !== null && closeButton !== void 0 ? closeButton : (0, _react2.jsx)(_IconButton["default"], {
|
145
147
|
"aria-label": "Close modal window",
|
146
148
|
"data-id": "icon-button__close-modal-window",
|
@@ -160,6 +162,9 @@ Modal.propTypes = {
|
|
160
162
|
/** The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id). */
|
161
163
|
id: _propTypes["default"].string,
|
162
164
|
|
165
|
+
/** Whether to auto focus the first focusable element in the focus scope on mount. */
|
166
|
+
hasAutoFocus: _propTypes["default"].bool,
|
167
|
+
|
163
168
|
/** Whether the modal has a visible close button. */
|
164
169
|
hasCloseButton: _propTypes["default"].bool,
|
165
170
|
|
@@ -27,7 +27,8 @@ var getComponent = function getComponent() {
|
|
27
27
|
(0, _testAxe["default"])(getComponent);
|
28
28
|
test('default modal', function () {
|
29
29
|
getComponent();
|
30
|
-
expect(_testWrapper.screen.queryByRole('dialog')).toBeInTheDocument();
|
30
|
+
expect(_testWrapper.screen.queryByRole('dialog')).toBeInTheDocument();
|
31
|
+
expect(_testWrapper.screen.queryByRole('dialog')).toHaveAttribute('aria-modal', 'true'); // Close button not rendered by default
|
31
32
|
|
32
33
|
expect(_testWrapper.screen.queryByRole('button')).not.toBeInTheDocument();
|
33
34
|
});
|
@@ -199,4 +200,23 @@ test('should render a custom close button if hasCloseButton is true and custom b
|
|
199
200
|
});
|
200
201
|
expect(_testWrapper.screen.queryByRole('button')).not.toBeInTheDocument();
|
201
202
|
expect(_testWrapper.screen.queryByTestId('test')).toBeInTheDocument();
|
203
|
+
});
|
204
|
+
test('shouldn\'t auto focus the first tabbable element', function () {
|
205
|
+
getComponent({
|
206
|
+
hasCloseButton: true
|
207
|
+
});
|
208
|
+
|
209
|
+
var button = _testWrapper.screen.queryByRole('button');
|
210
|
+
|
211
|
+
expect(button).not.toHaveFocus();
|
212
|
+
});
|
213
|
+
test('should auto focus the first tabbable element if "hasAutoFocus" is true', function () {
|
214
|
+
getComponent({
|
215
|
+
hasCloseButton: true,
|
216
|
+
hasAutoFocus: true
|
217
|
+
});
|
218
|
+
|
219
|
+
var button = _testWrapper.screen.queryByRole('button');
|
220
|
+
|
221
|
+
expect(button).toHaveFocus();
|
202
222
|
});
|
@@ -537,11 +537,16 @@ var environmentBreadcrumb = {
|
|
537
537
|
color: 'neutral.30',
|
538
538
|
fontSize: 'md',
|
539
539
|
fontWeight: 1,
|
540
|
-
'
|
540
|
+
padding: '4px',
|
541
|
+
'&.is-hovered': {
|
541
542
|
color: 'active',
|
542
543
|
textDecoration: 'none',
|
543
544
|
boxShadow: 'none'
|
544
545
|
},
|
546
|
+
'&.is-focused': {
|
547
|
+
borderRadius: '2px',
|
548
|
+
boxShadow: '0 0 0 1px #4462ED'
|
549
|
+
},
|
545
550
|
'&.is-pressed': {
|
546
551
|
color: 'accent.20',
|
547
552
|
textDecoration: 'none'
|
@@ -55,6 +55,11 @@ var EnvironmentBreadcrumb = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
55
55
|
searchValue = _useState2[0],
|
56
56
|
setSearchValue = _useState2[1];
|
57
57
|
|
58
|
+
var _useState3 = useState([]),
|
59
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
60
|
+
selectedKeys = _useState4[0],
|
61
|
+
setSelectedKeys = _useState4[1];
|
62
|
+
|
58
63
|
var breadcrumbsRef = useRef();
|
59
64
|
var overlayRef = React.useRef();
|
60
65
|
var triggerRef = React.useRef();
|
@@ -111,6 +116,7 @@ var EnvironmentBreadcrumb = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
111
116
|
var _selectedItemSet = _slicedToArray(selectedItemSet, 1),
|
112
117
|
selectedItemKey = _selectedItemSet[0];
|
113
118
|
|
119
|
+
setSelectedKeys(selectedItemSet);
|
114
120
|
onSelectionChange(selectedItemKey);
|
115
121
|
handlePopoverClose();
|
116
122
|
}, [handlePopoverClose, onSelectionChange]);
|
@@ -120,7 +126,7 @@ var EnvironmentBreadcrumb = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
120
126
|
items: items,
|
121
127
|
filter: imperativeItemsFilter || filterNodesWithChildren,
|
122
128
|
onSelectionChange: handleSelectionChange,
|
123
|
-
selectedKeys:
|
129
|
+
selectedKeys: selectedKeys,
|
124
130
|
selectionMode: 'single',
|
125
131
|
disallowEmptySelection: false
|
126
132
|
};
|
@@ -192,11 +198,14 @@ var EnvironmentBreadcrumb = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
192
198
|
px: 15
|
193
199
|
}, emptySearchText);
|
194
200
|
|
201
|
+
var _selectedKeys = _slicedToArray(selectedKeys, 1),
|
202
|
+
selectedValue = _selectedKeys[0];
|
203
|
+
|
195
204
|
var ItemsSelect = ___EmotionJSX(React.Fragment, null, ___EmotionJSX(Button, _extends({}, triggerProps, {
|
196
205
|
onPress: handlePopoverOpen,
|
197
206
|
ref: triggerRef,
|
198
207
|
variant: "environmentBreadcrumb.current",
|
199
|
-
"aria-label": "".concat(typeof selectedItem === 'string' ? selectedItem : 'Selected Item')
|
208
|
+
"aria-label": "".concat((typeof selectedItem === 'string' ? selectedItem : selectedValue) || 'Selected Item')
|
200
209
|
}), selectedItem, ___EmotionJSX(Icon, {
|
201
210
|
icon: popoverState.isOpen ? ArrowDropUpIcon : ArrowDropDownIcon
|
202
211
|
})), ___EmotionJSX(PopoverContainer, _extends({}, overlayProps, positionProps, {
|
@@ -21,7 +21,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
21
21
|
|
22
22
|
import React, { useState } from 'react';
|
23
23
|
import EnvironmentBreadcrumb from './EnvironmentBreadcrumb';
|
24
|
-
import { Item, Section,
|
24
|
+
import { Item, Section, Chip, Box, Text } from '../../index';
|
25
25
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
26
26
|
export default {
|
27
27
|
title: 'EnvironmentBreadcrumb',
|
@@ -118,7 +118,7 @@ export var Default = function Default(args) {
|
|
118
118
|
setSelectedEnvironment(_objectSpread({}, envObj));
|
119
119
|
};
|
120
120
|
|
121
|
-
return ___EmotionJSX(
|
121
|
+
return ___EmotionJSX(EnvironmentBreadcrumb, _extends({}, args, {
|
122
122
|
items: defaultEnvironments,
|
123
123
|
name: "Globochem",
|
124
124
|
selectedItem: envNode,
|
@@ -134,7 +134,7 @@ export var Default = function Default(args) {
|
|
134
134
|
variant: "boxes.environmentChip",
|
135
135
|
bg: "neutral.40"
|
136
136
|
}) : null);
|
137
|
-
})
|
137
|
+
});
|
138
138
|
};
|
139
139
|
export var WithSections = function WithSections() {
|
140
140
|
var _useState3 = useState(environmentsWithSections),
|
@@ -217,7 +217,7 @@ export var WithSections = function WithSections() {
|
|
217
217
|
bg: "neutral.40"
|
218
218
|
}) : null);
|
219
219
|
|
220
|
-
return ___EmotionJSX(
|
220
|
+
return ___EmotionJSX(EnvironmentBreadcrumb, {
|
221
221
|
items: environments,
|
222
222
|
name: "Globochem",
|
223
223
|
selectedItem: envNode,
|
@@ -247,7 +247,7 @@ export var WithSections = function WithSections() {
|
|
247
247
|
bg: "neutral.40"
|
248
248
|
}) : null));
|
249
249
|
});
|
250
|
-
})
|
250
|
+
});
|
251
251
|
};
|
252
252
|
export var OrgLevel = function OrgLevel() {
|
253
253
|
return ___EmotionJSX(EnvironmentBreadcrumb, {
|
@@ -12,7 +12,12 @@ import { render, screen } from '../../utils/testUtils/testWrapper';
|
|
12
12
|
import Messages, { messagesReducerStory, multiMessagesReducerStory } from '.';
|
13
13
|
import Button from '../Button';
|
14
14
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
15
|
-
jest.mock('@react-aria/live-announcer')
|
15
|
+
jest.mock('@react-aria/live-announcer', function () {
|
16
|
+
return {
|
17
|
+
announce: jest.fn()
|
18
|
+
};
|
19
|
+
});
|
20
|
+
var mockAnnounce = announce;
|
16
21
|
var testId = 'test-messages';
|
17
22
|
var defaultProps = {
|
18
23
|
'data-testid': testId
|
@@ -161,7 +166,7 @@ describe('announcements', function () {
|
|
161
166
|
});
|
162
167
|
|
163
168
|
_forEachInstanceProperty(items).call(items, function (item) {
|
164
|
-
return expect(
|
169
|
+
return expect(mockAnnounce).toHaveBeenCalledWith(item.text, 'polite');
|
165
170
|
});
|
166
171
|
});
|
167
172
|
test('should announce on adding item', function () {
|
@@ -171,7 +176,7 @@ describe('announcements', function () {
|
|
171
176
|
var button = screen.getByText('Click me!');
|
172
177
|
userEvent.click(button);
|
173
178
|
expect(messages.childElementCount).toBe(1);
|
174
|
-
expect(
|
179
|
+
expect(mockAnnounce).toHaveBeenCalledWith('New message 1', 'polite');
|
175
180
|
});
|
176
181
|
});
|
177
182
|
test('should render messages with messagesReducerStory', function () {
|
@@ -9,7 +9,7 @@ import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
9
9
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
10
10
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
11
11
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
12
|
-
var _excluded = ["className", "closeButton", "hasCloseButton", "id", "isClosedOnBlur", "isDismissable", "isKeyboardDismissDisabled", "isOpen", "role", "title", "onClose", "shouldCloseOnInteractOutside", "children", "contentProps", "containerProps"];
|
12
|
+
var _excluded = ["className", "closeButton", "hasAutoFocus", "hasCloseButton", "id", "isClosedOnBlur", "isDismissable", "isKeyboardDismissDisabled", "isOpen", "role", "title", "onClose", "shouldCloseOnInteractOutside", "children", "contentProps", "containerProps"];
|
13
13
|
|
14
14
|
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; }
|
15
15
|
|
@@ -30,6 +30,7 @@ import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
30
30
|
var Modal = /*#__PURE__*/forwardRef(function (props, ref) {
|
31
31
|
var className = props.className,
|
32
32
|
closeButton = props.closeButton,
|
33
|
+
hasAutoFocus = props.hasAutoFocus,
|
33
34
|
hasCloseButton = props.hasCloseButton,
|
34
35
|
id = props.id,
|
35
36
|
isClosedOnBlur = props.isClosedOnBlur,
|
@@ -95,11 +96,12 @@ var Modal = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
95
96
|
}, others, containerProps), ___EmotionJSX(FocusScope, {
|
96
97
|
contain: true,
|
97
98
|
restoreFocus: true,
|
98
|
-
autoFocus:
|
99
|
+
autoFocus: hasAutoFocus
|
99
100
|
}, ___EmotionJSX(Box, _extends({
|
100
101
|
variant: "modal.content"
|
101
102
|
}, propsContentProps, overlayProps, dialogProps, modalProps, {
|
102
|
-
ref: modalRef
|
103
|
+
ref: modalRef,
|
104
|
+
"aria-modal": true
|
103
105
|
}), hasCloseButton && (closeButton !== null && closeButton !== void 0 ? closeButton : ___EmotionJSX(IconButton, {
|
104
106
|
"aria-label": "Close modal window",
|
105
107
|
"data-id": "icon-button__close-modal-window",
|
@@ -119,6 +121,9 @@ Modal.propTypes = {
|
|
119
121
|
/** The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id). */
|
120
122
|
id: PropTypes.string,
|
121
123
|
|
124
|
+
/** Whether to auto focus the first focusable element in the focus scope on mount. */
|
125
|
+
hasAutoFocus: PropTypes.bool,
|
126
|
+
|
122
127
|
/** Whether the modal has a visible close button. */
|
123
128
|
hasCloseButton: PropTypes.bool,
|
124
129
|
|
@@ -18,7 +18,8 @@ var getComponent = function getComponent() {
|
|
18
18
|
axeTest(getComponent);
|
19
19
|
test('default modal', function () {
|
20
20
|
getComponent();
|
21
|
-
expect(screen.queryByRole('dialog')).toBeInTheDocument();
|
21
|
+
expect(screen.queryByRole('dialog')).toBeInTheDocument();
|
22
|
+
expect(screen.queryByRole('dialog')).toHaveAttribute('aria-modal', 'true'); // Close button not rendered by default
|
22
23
|
|
23
24
|
expect(screen.queryByRole('button')).not.toBeInTheDocument();
|
24
25
|
});
|
@@ -169,4 +170,19 @@ test('should render a custom close button if hasCloseButton is true and custom b
|
|
169
170
|
});
|
170
171
|
expect(screen.queryByRole('button')).not.toBeInTheDocument();
|
171
172
|
expect(screen.queryByTestId('test')).toBeInTheDocument();
|
173
|
+
});
|
174
|
+
test('shouldn\'t auto focus the first tabbable element', function () {
|
175
|
+
getComponent({
|
176
|
+
hasCloseButton: true
|
177
|
+
});
|
178
|
+
var button = screen.queryByRole('button');
|
179
|
+
expect(button).not.toHaveFocus();
|
180
|
+
});
|
181
|
+
test('should auto focus the first tabbable element if "hasAutoFocus" is true', function () {
|
182
|
+
getComponent({
|
183
|
+
hasCloseButton: true,
|
184
|
+
hasAutoFocus: true
|
185
|
+
});
|
186
|
+
var button = screen.queryByRole('button');
|
187
|
+
expect(button).toHaveFocus();
|
172
188
|
});
|
@@ -517,11 +517,16 @@ var environmentBreadcrumb = {
|
|
517
517
|
color: 'neutral.30',
|
518
518
|
fontSize: 'md',
|
519
519
|
fontWeight: 1,
|
520
|
-
'
|
520
|
+
padding: '4px',
|
521
|
+
'&.is-hovered': {
|
521
522
|
color: 'active',
|
522
523
|
textDecoration: 'none',
|
523
524
|
boxShadow: 'none'
|
524
525
|
},
|
526
|
+
'&.is-focused': {
|
527
|
+
borderRadius: '2px',
|
528
|
+
boxShadow: '0 0 0 1px #4462ED'
|
529
|
+
},
|
525
530
|
'&.is-pressed': {
|
526
531
|
color: 'accent.20',
|
527
532
|
textDecoration: 'none'
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pingux/astro",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.15.0-alpha.1",
|
4
4
|
"description": "PingUX themeable React component library",
|
5
5
|
"author": "ux-development@pingidentity.com",
|
6
6
|
"license": "Apache-2.0",
|
@@ -74,7 +74,7 @@
|
|
74
74
|
"@emotion/jest": "^11.5.0",
|
75
75
|
"@emotion/react": "^11.1.5",
|
76
76
|
"@emotion/styled": "^11.3.0",
|
77
|
-
"@react-aria/accordion": "3.0.0-alpha.
|
77
|
+
"@react-aria/accordion": "3.0.0-alpha.7",
|
78
78
|
"@react-aria/breadcrumbs": "^3.1.4",
|
79
79
|
"@react-aria/button": "^3.2.1",
|
80
80
|
"@react-aria/checkbox": "^3.2.0",
|
@@ -90,7 +90,7 @@
|
|
90
90
|
"@react-aria/listbox": "^3.3.0",
|
91
91
|
"@react-aria/live-announcer": "^3.0.0",
|
92
92
|
"@react-aria/menu": "^3.1.4",
|
93
|
-
"@react-aria/numberfield": "3.1.
|
93
|
+
"@react-aria/numberfield": "~3.1.6",
|
94
94
|
"@react-aria/overlays": "^3.7.0",
|
95
95
|
"@react-aria/progress": "^3.1.1",
|
96
96
|
"@react-aria/radio": "^3.1.1",
|
@@ -107,7 +107,7 @@
|
|
107
107
|
"@react-aria/visually-hidden": "3.2.1",
|
108
108
|
"@react-spectrum/provider": "^3.2.1",
|
109
109
|
"@react-spectrum/utils": "3.6.1",
|
110
|
-
"@react-stately/collections": "
|
110
|
+
"@react-stately/collections": "~3.3.8",
|
111
111
|
"@react-stately/color": "^3.0.0-beta.2",
|
112
112
|
"@react-stately/combobox": "^3.0.0",
|
113
113
|
"@react-stately/data": "^3.4.0",
|
@@ -115,7 +115,7 @@
|
|
115
115
|
"@react-stately/layout": "^3.2.1",
|
116
116
|
"@react-stately/list": "^3.2.1",
|
117
117
|
"@react-stately/menu": "^3.2.1",
|
118
|
-
"@react-stately/numberfield": "3.0.
|
118
|
+
"@react-stately/numberfield": "~3.0.7",
|
119
119
|
"@react-stately/overlays": "^3.1.1",
|
120
120
|
"@react-stately/radio": "^3.2.0",
|
121
121
|
"@react-stately/searchfield": "^3.1.1",
|
@@ -125,7 +125,7 @@
|
|
125
125
|
"@react-stately/toggle": "^3.2.0",
|
126
126
|
"@react-stately/tooltip": "^3.0.4",
|
127
127
|
"@react-stately/tree": "^3.1.2",
|
128
|
-
"@react-stately/utils": "
|
128
|
+
"@react-stately/utils": "~3.4.1",
|
129
129
|
"@rebass/forms": "^4.0.6",
|
130
130
|
"@styled-system/prop-types": "^5.1.5",
|
131
131
|
"@styled-system/props": "^5.1.5",
|