@pingux/astro 1.36.2-alpha.3 → 1.36.3-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 +14 -0
- package/lib/cjs/components/AccordionGridGroup/AccordionGridGroup.stories.js +3 -3
- package/lib/cjs/components/AccordionGroup/AccordionGroup.js +9 -2
- package/lib/cjs/components/AccordionGroup/AccordionGroup.test.js +30 -0
- package/lib/components/AccordionGridGroup/AccordionGridGroup.stories.js +3 -3
- package/lib/components/AccordionGroup/AccordionGroup.js +10 -3
- package/lib/components/AccordionGroup/AccordionGroup.test.js +26 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,20 @@
|
|
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.36.2](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.36.1...@pingux/astro@1.36.2) (2022-11-29)
|
7
|
+
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
* [UIP-5721] Image upload EA fixes ([cb0452e](https://gitlab.corp.pingidentity.com/ux/pingux/commit/cb0452e91a81dcd5bb07bef888557256d4809859))
|
12
|
+
* [UIP-5743] Adding error announcement to all field components ([fd59ec4](https://gitlab.corp.pingidentity.com/ux/pingux/commit/fd59ec4d7a55c7bb4d5f5784bce6f8a6ef9640a2))
|
13
|
+
* [UIP-5863] ColorField overlay accessibility fix ([506ba3d](https://gitlab.corp.pingidentity.com/ux/pingux/commit/506ba3d71843fc0ba33bc7e80f0adb82595a18ba))
|
14
|
+
* [UIP-5896] Add data ids to EnvironmentBreadcrumb ([cb7bee4](https://gitlab.corp.pingidentity.com/ux/pingux/commit/cb7bee4232ec9f3bb3e05cdc72c1f663b4798943))
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
6
20
|
## [1.36.1](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.36.0...@pingux/astro@1.36.1) (2022-11-17)
|
7
21
|
|
8
22
|
|
@@ -324,11 +324,11 @@ exports.Controlled = Controlled;
|
|
324
324
|
|
325
325
|
var AccordionWithInputs = function AccordionWithInputs() {
|
326
326
|
return (0, _react2.jsx)(_AccordionGridGroup["default"], {
|
327
|
-
items: data
|
327
|
+
items: data,
|
328
|
+
defaultSelectedKeys: ['Organization']
|
328
329
|
}, function (item) {
|
329
330
|
return (0, _react2.jsx)(_collections.Item, {
|
330
|
-
key: item.key
|
331
|
-
textValue: item.name
|
331
|
+
key: item.key
|
332
332
|
}, (0, _react2.jsx)(_index.Text, {
|
333
333
|
sx: {
|
334
334
|
fontWeight: 3,
|
@@ -42,7 +42,7 @@ var _isIterable = require("../../utils/devUtils/props/isIterable");
|
|
42
42
|
|
43
43
|
var _react2 = require("@emotion/react");
|
44
44
|
|
45
|
-
var _excluded = ["onExpandedChange"];
|
45
|
+
var _excluded = ["defaultExpandedKeys", "expandedKeys", "onExpandedChange"];
|
46
46
|
|
47
47
|
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); }
|
48
48
|
|
@@ -59,7 +59,9 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
59
59
|
var AccordionGroup = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
60
60
|
var _context;
|
61
61
|
|
62
|
-
var
|
62
|
+
var defaultExpandedKeys = props.defaultExpandedKeys,
|
63
|
+
expandedKeys = props.expandedKeys,
|
64
|
+
onExpandedChange = props.onExpandedChange,
|
63
65
|
others = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
64
66
|
var state = (0, _tree.useTreeState)(props);
|
65
67
|
var accordionRef = (0, _react.useRef)();
|
@@ -73,6 +75,11 @@ var AccordionGroup = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
73
75
|
(0, _react.useImperativeHandle)(ref, function () {
|
74
76
|
return accordionRef.current;
|
75
77
|
});
|
78
|
+
(0, _react.useEffect)(function () {
|
79
|
+
if (expandedKeys || defaultExpandedKeys) {
|
80
|
+
state.selectionManager.setFocused(true);
|
81
|
+
}
|
82
|
+
}, [defaultExpandedKeys, expandedKeys, state.selectionManager]);
|
76
83
|
return (0, _react2.jsx)(_AccordionContext.AccordionContext.Provider, {
|
77
84
|
value: state
|
78
85
|
}, (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({
|
@@ -70,6 +70,23 @@ var getComponentInOverlayPanel = function getComponentInOverlayPanel() {
|
|
70
70
|
textValue: "Duplicate",
|
71
71
|
"data-id": "third"
|
72
72
|
}, (0, _react2.jsx)(_Text["default"], null, "Render me!")))));
|
73
|
+
};
|
74
|
+
|
75
|
+
var getComponentWithInput = function getComponentWithInput() {
|
76
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
77
|
+
return (0, _testWrapper.render)((0, _react2.jsx)(_AccordionGroup["default"], (0, _extends2["default"])({}, defaultProps, props), (0, _react2.jsx)(_collections.Item, {
|
78
|
+
key: "first",
|
79
|
+
textValue: "Duplicate",
|
80
|
+
"data-id": "first",
|
81
|
+
label: "Accordion item"
|
82
|
+
}, (0, _react2.jsx)(_Text["default"], null, "Render me!")), (0, _react2.jsx)(_collections.Item, {
|
83
|
+
key: "second",
|
84
|
+
textValue: "Duplicate",
|
85
|
+
"data-id": "second",
|
86
|
+
label: "Accordion item"
|
87
|
+
}, (0, _react2.jsx)("input", {
|
88
|
+
"data-testid": "testInput"
|
89
|
+
}))));
|
73
90
|
}; // Need to be added to each test file to test accessibility using axe.
|
74
91
|
|
75
92
|
|
@@ -268,6 +285,19 @@ test('expanded keys expands an accordion item', function () {
|
|
268
285
|
var selectedItem = buttons[0];
|
269
286
|
expect(selectedItem).toHaveAttribute('aria-expanded', 'true');
|
270
287
|
});
|
288
|
+
test('input recives focus in expanded accordion item when click', function () {
|
289
|
+
getComponentWithInput({
|
290
|
+
expandedKeys: ['second']
|
291
|
+
});
|
292
|
+
|
293
|
+
var input = _testWrapper.screen.getByTestId('testInput');
|
294
|
+
|
295
|
+
expect(input).not.toHaveFocus();
|
296
|
+
|
297
|
+
_userEvent["default"].click(input);
|
298
|
+
|
299
|
+
expect(input).toHaveFocus();
|
300
|
+
});
|
271
301
|
test('able to click a textfield that is the rendered child of an accordion', function () {
|
272
302
|
getComponent({
|
273
303
|
expandedKeys: ['third']
|
@@ -286,11 +286,11 @@ export var Controlled = function Controlled() {
|
|
286
286
|
|
287
287
|
export var AccordionWithInputs = function AccordionWithInputs() {
|
288
288
|
return ___EmotionJSX(AccordionGridGroup, {
|
289
|
-
items: data
|
289
|
+
items: data,
|
290
|
+
defaultSelectedKeys: ['Organization']
|
290
291
|
}, function (item) {
|
291
292
|
return ___EmotionJSX(Item, {
|
292
|
-
key: item.key
|
293
|
-
textValue: item.name
|
293
|
+
key: item.key
|
294
294
|
}, ___EmotionJSX(Text, {
|
295
295
|
sx: {
|
296
296
|
fontWeight: 3,
|
@@ -2,8 +2,8 @@ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
|
2
2
|
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
3
3
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
4
4
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
5
|
-
var _excluded = ["onExpandedChange"];
|
6
|
-
import React, { forwardRef, useRef, useImperativeHandle } from 'react';
|
5
|
+
var _excluded = ["defaultExpandedKeys", "expandedKeys", "onExpandedChange"];
|
6
|
+
import React, { forwardRef, useRef, useImperativeHandle, useEffect } from 'react';
|
7
7
|
import { useAccordion } from '@react-aria/accordion';
|
8
8
|
import { useTreeState } from '@react-stately/tree';
|
9
9
|
import PropTypes from 'prop-types';
|
@@ -24,7 +24,9 @@ import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
24
24
|
var AccordionGroup = /*#__PURE__*/forwardRef(function (props, ref) {
|
25
25
|
var _context;
|
26
26
|
|
27
|
-
var
|
27
|
+
var defaultExpandedKeys = props.defaultExpandedKeys,
|
28
|
+
expandedKeys = props.expandedKeys,
|
29
|
+
onExpandedChange = props.onExpandedChange,
|
28
30
|
others = _objectWithoutProperties(props, _excluded);
|
29
31
|
|
30
32
|
var state = useTreeState(props);
|
@@ -39,6 +41,11 @@ var AccordionGroup = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
39
41
|
useImperativeHandle(ref, function () {
|
40
42
|
return accordionRef.current;
|
41
43
|
});
|
44
|
+
useEffect(function () {
|
45
|
+
if (expandedKeys || defaultExpandedKeys) {
|
46
|
+
state.selectionManager.setFocused(true);
|
47
|
+
}
|
48
|
+
}, [defaultExpandedKeys, expandedKeys, state.selectionManager]);
|
42
49
|
return ___EmotionJSX(AccordionContext.Provider, {
|
43
50
|
value: state
|
44
51
|
}, ___EmotionJSX(Box, _extends({
|
@@ -55,6 +55,23 @@ var getComponentInOverlayPanel = function getComponentInOverlayPanel() {
|
|
55
55
|
textValue: "Duplicate",
|
56
56
|
"data-id": "third"
|
57
57
|
}, ___EmotionJSX(Text, null, "Render me!")))));
|
58
|
+
};
|
59
|
+
|
60
|
+
var getComponentWithInput = function getComponentWithInput() {
|
61
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
62
|
+
return render(___EmotionJSX(AccordionGroup, _extends({}, defaultProps, props), ___EmotionJSX(Item, {
|
63
|
+
key: "first",
|
64
|
+
textValue: "Duplicate",
|
65
|
+
"data-id": "first",
|
66
|
+
label: "Accordion item"
|
67
|
+
}, ___EmotionJSX(Text, null, "Render me!")), ___EmotionJSX(Item, {
|
68
|
+
key: "second",
|
69
|
+
textValue: "Duplicate",
|
70
|
+
"data-id": "second",
|
71
|
+
label: "Accordion item"
|
72
|
+
}, ___EmotionJSX("input", {
|
73
|
+
"data-testid": "testInput"
|
74
|
+
}))));
|
58
75
|
}; // Need to be added to each test file to test accessibility using axe.
|
59
76
|
|
60
77
|
|
@@ -205,6 +222,15 @@ test('expanded keys expands an accordion item', function () {
|
|
205
222
|
var selectedItem = buttons[0];
|
206
223
|
expect(selectedItem).toHaveAttribute('aria-expanded', 'true');
|
207
224
|
});
|
225
|
+
test('input recives focus in expanded accordion item when click', function () {
|
226
|
+
getComponentWithInput({
|
227
|
+
expandedKeys: ['second']
|
228
|
+
});
|
229
|
+
var input = screen.getByTestId('testInput');
|
230
|
+
expect(input).not.toHaveFocus();
|
231
|
+
userEvent.click(input);
|
232
|
+
expect(input).toHaveFocus();
|
233
|
+
});
|
208
234
|
test('able to click a textfield that is the rendered child of an accordion', function () {
|
209
235
|
getComponent({
|
210
236
|
expandedKeys: ['third']
|