@pingux/astro 1.41.0-alpha.0 → 1.41.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
CHANGED
@@ -3,6 +3,19 @@
|
|
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.40.1](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.40.0...@pingux/astro@1.40.1) (2023-01-26)
|
7
|
+
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
* [UIP-5926] CopyText: respect parent width ([6be0ee9](https://gitlab.corp.pingidentity.com/ux/pingux/commit/6be0ee9f68f10659ac4fc70229dbdbed5ded4201))
|
12
|
+
* [UIP-5951] Remove empty sections in search results for EnvironmentBreadcrumb ([5d4563a](https://gitlab.corp.pingidentity.com/ux/pingux/commit/5d4563a293279d056918c8fbfe72f32ca505043e))
|
13
|
+
* [UIP-5985][UIP-5989] Astro Accordion Fixes ([c4c6d1e](https://gitlab.corp.pingidentity.com/ux/pingux/commit/c4c6d1e1ae5f407010ddd1227865a5eb812e20a0))
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
|
6
19
|
# [1.40.0](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.39.2...@pingux/astro@1.40.0) (2023-01-17)
|
7
20
|
|
8
21
|
|
@@ -40,6 +40,8 @@ var _checkbox = require("@react-aria/checkbox");
|
|
40
40
|
|
41
41
|
var _toggle = require("@react-stately/toggle");
|
42
42
|
|
43
|
+
var _interactions = require("@react-aria/interactions");
|
44
|
+
|
43
45
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
44
46
|
|
45
47
|
var _uuid = require("uuid");
|
@@ -84,6 +86,9 @@ var CheckboxField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
84
86
|
defaultSelected: isDefaultSelected || controlProps.isDefaultSelected
|
85
87
|
}, props), controlProps);
|
86
88
|
|
89
|
+
var _usePress = (0, _interactions.usePress)(props),
|
90
|
+
containerPressProps = _usePress.pressProps;
|
91
|
+
|
87
92
|
var state = (0, _toggle.useToggleState)(checkboxProps);
|
88
93
|
var checkboxRef = (0, _react.useRef)();
|
89
94
|
(0, _hooks.usePropWarning)(props, 'disabled', 'isDisabled');
|
@@ -103,7 +108,7 @@ var CheckboxField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
103
108
|
var _useCheckbox = (0, _checkbox.useCheckbox)(checkboxProps, state, checkboxRef),
|
104
109
|
inputProps = _useCheckbox.inputProps;
|
105
110
|
|
106
|
-
var _useField = (0, _hooks.useField)(_objectSpread(_objectSpread({}, props), {}, {
|
111
|
+
var _useField = (0, _hooks.useField)(_objectSpread(_objectSpread(_objectSpread({}, containerPressProps), props), {}, {
|
107
112
|
statusClasses: {
|
108
113
|
isIndeterminate: isIndeterminate
|
109
114
|
},
|
@@ -26,6 +26,8 @@ var _loadingStates = _interopRequireDefault(require("../../utils/devUtils/consta
|
|
26
26
|
|
27
27
|
var _ListView = _interopRequireDefault(require("./ListView"));
|
28
28
|
|
29
|
+
var _CheckboxField = _interopRequireDefault(require("../CheckboxField"));
|
30
|
+
|
29
31
|
var _react2 = require("@emotion/react");
|
30
32
|
|
31
33
|
var items = [{
|
@@ -104,6 +106,31 @@ var getComponentEmpty = function getComponentEmpty() {
|
|
104
106
|
}, (0, _react2.jsx)(_ListView["default"], (0, _extends2["default"])({}, defaultProps, props))));
|
105
107
|
};
|
106
108
|
|
109
|
+
var getComponentWithCheckbox = function getComponentWithCheckbox() {
|
110
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
111
|
+
|
112
|
+
var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
113
|
+
_ref3$renderFn = _ref3.renderFn,
|
114
|
+
renderFn = _ref3$renderFn === void 0 ? _testWrapper.render : _ref3$renderFn;
|
115
|
+
|
116
|
+
return renderFn((0, _react2.jsx)(_focus.FocusScope, {
|
117
|
+
restoreFocus: true
|
118
|
+
}, (0, _react2.jsx)(_ListView["default"], (0, _extends2["default"])({}, defaultProps, props, {
|
119
|
+
items: items
|
120
|
+
}), function (item) {
|
121
|
+
return (0, _react2.jsx)(_collections.Item, {
|
122
|
+
key: item.key,
|
123
|
+
textValue: item.name,
|
124
|
+
"data-id": item.key
|
125
|
+
}, (0, _react2.jsx)(_CheckboxField["default"], {
|
126
|
+
label: item.name,
|
127
|
+
containerProps: {
|
128
|
+
'data-testid': 'TestID'
|
129
|
+
}
|
130
|
+
}));
|
131
|
+
})));
|
132
|
+
};
|
133
|
+
|
107
134
|
test('renders listview component', function () {
|
108
135
|
getComponent();
|
109
136
|
|
@@ -354,4 +381,15 @@ test('when user navigates with tab and arrows keys, onFocus is called and the is
|
|
354
381
|
}
|
355
382
|
}
|
356
383
|
}, _callee7);
|
357
|
-
})));
|
384
|
+
})));
|
385
|
+
test('list view not receive focus when click on checkbox', function () {
|
386
|
+
getComponentWithCheckbox();
|
387
|
+
|
388
|
+
var listItem = _testWrapper.screen.getAllByRole('gridcell');
|
389
|
+
|
390
|
+
var checkbox = _testWrapper.screen.getAllByTestId('TestID');
|
391
|
+
|
392
|
+
expect(listItem[0]).not.toHaveClass('is-focused');
|
393
|
+
checkbox[0].click();
|
394
|
+
expect(listItem[0]).not.toHaveClass('is-focused');
|
395
|
+
});
|
@@ -17,6 +17,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
17
17
|
import React, { forwardRef, useRef, useImperativeHandle, useEffect } from 'react';
|
18
18
|
import { useCheckbox } from '@react-aria/checkbox';
|
19
19
|
import { useToggleState } from '@react-stately/toggle';
|
20
|
+
import { usePress } from '@react-aria/interactions';
|
20
21
|
import PropTypes from 'prop-types';
|
21
22
|
import { v4 as uuid } from 'uuid';
|
22
23
|
import { Box, Checkbox, FieldHelperText, Label } from '../../';
|
@@ -47,6 +48,9 @@ var CheckboxField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
47
48
|
defaultSelected: isDefaultSelected || controlProps.isDefaultSelected
|
48
49
|
}, props), controlProps);
|
49
50
|
|
51
|
+
var _usePress = usePress(props),
|
52
|
+
containerPressProps = _usePress.pressProps;
|
53
|
+
|
50
54
|
var state = useToggleState(checkboxProps);
|
51
55
|
var checkboxRef = useRef();
|
52
56
|
usePropWarning(props, 'disabled', 'isDisabled');
|
@@ -66,7 +70,7 @@ var CheckboxField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
66
70
|
var _useCheckbox = useCheckbox(checkboxProps, state, checkboxRef),
|
67
71
|
inputProps = _useCheckbox.inputProps;
|
68
72
|
|
69
|
-
var _useField = useField(_objectSpread(_objectSpread({}, props), {}, {
|
73
|
+
var _useField = useField(_objectSpread(_objectSpread(_objectSpread({}, containerPressProps), props), {}, {
|
70
74
|
statusClasses: {
|
71
75
|
isIndeterminate: isIndeterminate
|
72
76
|
},
|
@@ -10,6 +10,7 @@ import { Item } from '@react-stately/collections';
|
|
10
10
|
import { render, screen } from '../../utils/testUtils/testWrapper';
|
11
11
|
import loadingStates from '../../utils/devUtils/constants/loadingStates';
|
12
12
|
import ListView from './ListView';
|
13
|
+
import CheckboxField from '../CheckboxField';
|
13
14
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
14
15
|
var items = [{
|
15
16
|
key: 'Aardvark',
|
@@ -87,6 +88,31 @@ var getComponentEmpty = function getComponentEmpty() {
|
|
87
88
|
}, ___EmotionJSX(ListView, _extends({}, defaultProps, props))));
|
88
89
|
};
|
89
90
|
|
91
|
+
var getComponentWithCheckbox = function getComponentWithCheckbox() {
|
92
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
93
|
+
|
94
|
+
var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
95
|
+
_ref3$renderFn = _ref3.renderFn,
|
96
|
+
renderFn = _ref3$renderFn === void 0 ? render : _ref3$renderFn;
|
97
|
+
|
98
|
+
return renderFn(___EmotionJSX(FocusScope, {
|
99
|
+
restoreFocus: true
|
100
|
+
}, ___EmotionJSX(ListView, _extends({}, defaultProps, props, {
|
101
|
+
items: items
|
102
|
+
}), function (item) {
|
103
|
+
return ___EmotionJSX(Item, {
|
104
|
+
key: item.key,
|
105
|
+
textValue: item.name,
|
106
|
+
"data-id": item.key
|
107
|
+
}, ___EmotionJSX(CheckboxField, {
|
108
|
+
label: item.name,
|
109
|
+
containerProps: {
|
110
|
+
'data-testid': 'TestID'
|
111
|
+
}
|
112
|
+
}));
|
113
|
+
})));
|
114
|
+
};
|
115
|
+
|
90
116
|
test('renders listview component', function () {
|
91
117
|
getComponent();
|
92
118
|
var listView = screen.getByTestId(testId);
|
@@ -309,4 +335,12 @@ test('when user navigates with tab and arrows keys, onFocus is called and the is
|
|
309
335
|
}
|
310
336
|
}
|
311
337
|
}, _callee7);
|
312
|
-
})));
|
338
|
+
})));
|
339
|
+
test('list view not receive focus when click on checkbox', function () {
|
340
|
+
getComponentWithCheckbox();
|
341
|
+
var listItem = screen.getAllByRole('gridcell');
|
342
|
+
var checkbox = screen.getAllByTestId('TestID');
|
343
|
+
expect(listItem[0]).not.toHaveClass('is-focused');
|
344
|
+
checkbox[0].click();
|
345
|
+
expect(listItem[0]).not.toHaveClass('is-focused');
|
346
|
+
});
|