@pingux/astro 1.1.0-alpha.0 → 1.1.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.
- package/CHANGELOG.md +44 -0
- package/lib/cjs/components/ComboBoxField/ComboBoxField.js +7 -0
- package/lib/cjs/components/ComboBoxField/ComboBoxField.stories.js +25 -1
- package/lib/cjs/components/ComboBoxField/ComboBoxField.test.js +44 -0
- package/lib/cjs/components/IconButton/IconButton.stories.js +8 -17
- package/lib/cjs/components/ListBox/Option.js +6 -0
- package/lib/cjs/components/ListView/ListView.stories.js +580 -39
- package/lib/cjs/styles/variants/buttons.js +10 -0
- package/lib/components/ComboBoxField/ComboBoxField.js +7 -0
- package/lib/components/ComboBoxField/ComboBoxField.stories.js +21 -0
- package/lib/components/ComboBoxField/ComboBoxField.test.js +35 -0
- package/lib/components/IconButton/IconButton.stories.js +7 -13
- package/lib/components/ListBox/Option.js +6 -0
- package/lib/components/ListView/ListView.stories.js +577 -39
- package/lib/styles/variants/buttons.js +10 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,50 @@
|
|
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.1.0-alpha.4](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.1.0-alpha.3...@pingux/astro@1.1.0-alpha.4) (2022-01-21)
|
7
|
+
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
* [UIP-4992] Fix SelectField Warnings ([dab3f92](https://gitlab.corp.pingidentity.com/ux/pingux/commit/dab3f9254c5d7b1b124ed24616e4ef68f53af7d0))
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
# [1.1.0-alpha.3](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.1.0-alpha.2...@pingux/astro@1.1.0-alpha.3) (2022-01-20)
|
18
|
+
|
19
|
+
|
20
|
+
### Bug Fixes
|
21
|
+
|
22
|
+
* [UIP-5007] ComboBoxField controlled custom input throws an exception ([9651c98](https://gitlab.corp.pingidentity.com/ux/pingux/commit/9651c98da3b3ac158c84f378303a2d331db78cce))
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
# [1.1.0-alpha.2](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.1.0-alpha.1...@pingux/astro@1.1.0-alpha.2) (2022-01-19)
|
29
|
+
|
30
|
+
|
31
|
+
### Bug Fixes
|
32
|
+
|
33
|
+
* [UIP-5039] IconButton Square Variant ([2fecfac](https://gitlab.corp.pingidentity.com/ux/pingux/commit/2fecfac9d39974eb5dc773d210c3a830d1bd9e2a))
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
# [1.1.0-alpha.1](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.1.0-alpha.0...@pingux/astro@1.1.0-alpha.1) (2022-01-19)
|
40
|
+
|
41
|
+
|
42
|
+
### Bug Fixes
|
43
|
+
|
44
|
+
* [UIP-5026] Infinite Loading List requests page 2 instantly ([e6888cf](https://gitlab.corp.pingidentity.com/ux/pingux/commit/e6888cfe91435fae0ab583b0ff22b2c169ba7bcd))
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
|
6
50
|
# [1.1.0-alpha.0](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.0.1...@pingux/astro@1.1.0-alpha.0) (2022-01-19)
|
7
51
|
|
8
52
|
|
@@ -157,6 +157,12 @@ var ComboBoxField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
157
157
|
(0, _react.useImperativeHandle)(ref, function () {
|
158
158
|
return inputRef.current;
|
159
159
|
});
|
160
|
+
/* istanbul ignore next */
|
161
|
+
|
162
|
+
var onSelectionChangeHandler = function onSelectionChangeHandler(key) {
|
163
|
+
var newVal = key || selectedKey || '';
|
164
|
+
if (onSelectionChange) onSelectionChange(newVal);
|
165
|
+
};
|
160
166
|
|
161
167
|
var _useFilter = (0, _i18n.useFilter)({
|
162
168
|
sensitivity: 'base'
|
@@ -164,6 +170,7 @@ var ComboBoxField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
164
170
|
contains = _useFilter.contains;
|
165
171
|
|
166
172
|
var state = (0, _combobox2.useComboBoxState)(_objectSpread(_objectSpread({}, comboBoxOptions), {}, {
|
173
|
+
onSelectionChange: hasCustomValue ? onSelectionChangeHandler : onSelectionChange,
|
167
174
|
defaultFilter: contains
|
168
175
|
}));
|
169
176
|
|
@@ -10,7 +10,7 @@ _Object$defineProperty(exports, "__esModule", {
|
|
10
10
|
value: true
|
11
11
|
});
|
12
12
|
|
13
|
-
exports.WithCustomHeight = exports.WithoutStatusIndicator = exports.Required = exports.HelperText = exports.Disabled = exports.FocusMenuTrigger = exports.DisabledKeys = exports.AllowCustomValue = exports.ControlledFiltering = exports.ControlledSelection = exports.ControlledMenu = exports.ControlledInput = exports.AsyncLoading = exports.WithSections = exports.Default = exports["default"] = void 0;
|
13
|
+
exports.WithCustomHeight = exports.WithoutStatusIndicator = exports.Required = exports.HelperText = exports.Disabled = exports.FocusMenuTrigger = exports.DisabledKeys = exports.AllowCustomValue = exports.ControlledWithCustomValue = exports.ControlledFiltering = exports.ControlledSelection = exports.ControlledMenu = exports.ControlledInput = exports.AsyncLoading = exports.WithSections = exports.Default = exports["default"] = void 0;
|
14
14
|
|
15
15
|
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
16
16
|
|
@@ -383,6 +383,30 @@ var ControlledFiltering = function ControlledFiltering() {
|
|
383
383
|
|
384
384
|
exports.ControlledFiltering = ControlledFiltering;
|
385
385
|
|
386
|
+
var ControlledWithCustomValue = function ControlledWithCustomValue() {
|
387
|
+
var _useState9 = (0, _react.useState)(''),
|
388
|
+
_useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
|
389
|
+
inputValue = _useState10[0],
|
390
|
+
setInputValue = _useState10[1];
|
391
|
+
|
392
|
+
return (0, _react2.jsx)(_index.OverlayProvider, null, (0, _react2.jsx)(_ComboBoxField["default"], (0, _extends2["default"])({
|
393
|
+
label: "Example label",
|
394
|
+
defaultItems: items
|
395
|
+
}, actions, {
|
396
|
+
inputValue: inputValue,
|
397
|
+
selectedKey: inputValue,
|
398
|
+
onInputChange: setInputValue,
|
399
|
+
onSelectionChange: setInputValue,
|
400
|
+
hasCustomValue: true
|
401
|
+
}), function (item) {
|
402
|
+
return (0, _react2.jsx)(_index.Item, {
|
403
|
+
key: item.name
|
404
|
+
}, item.name);
|
405
|
+
}));
|
406
|
+
};
|
407
|
+
|
408
|
+
exports.ControlledWithCustomValue = ControlledWithCustomValue;
|
409
|
+
|
386
410
|
var AllowCustomValue = function AllowCustomValue() {
|
387
411
|
return (0, _react2.jsx)(_index.OverlayProvider, null, (0, _react2.jsx)(_ComboBoxField["default"], (0, _extends2["default"])({
|
388
412
|
label: "Example label",
|
@@ -772,6 +772,50 @@ test('two listbox can not be open at the same time', function () {
|
|
772
772
|
name: 'Tango'
|
773
773
|
})).toBeInTheDocument();
|
774
774
|
});
|
775
|
+
test('should handle selecting custom option', function () {
|
776
|
+
getComponent({
|
777
|
+
hasCustomValue: true
|
778
|
+
});
|
779
|
+
|
780
|
+
var input = _testWrapper.screen.queryByRole('combobox');
|
781
|
+
|
782
|
+
expect(input).toHaveValue(''); // type something
|
783
|
+
|
784
|
+
_userEvent["default"].type(input, 'custom'); // set input value as selected
|
785
|
+
|
786
|
+
|
787
|
+
_userEvent["default"].type(input, '{enter}', {
|
788
|
+
skipClick: true
|
789
|
+
});
|
790
|
+
|
791
|
+
expect(_testWrapper.screen.queryByRole('listbox')).not.toBeInTheDocument();
|
792
|
+
expect(_testWrapper.screen.queryByRole('combobox')).toHaveValue('custom'); // blur input
|
793
|
+
|
794
|
+
_userEvent["default"].tab();
|
795
|
+
|
796
|
+
expect(input).toHaveValue('custom');
|
797
|
+
});
|
798
|
+
test('onSelectionChange works properly with custom value', function () {
|
799
|
+
var onSelectionChange = jest.fn();
|
800
|
+
getComponent({
|
801
|
+
hasCustomValue: true,
|
802
|
+
onSelectionChange: onSelectionChange,
|
803
|
+
onInputChange: onSelectionChange
|
804
|
+
});
|
805
|
+
|
806
|
+
var input = _testWrapper.screen.queryByRole('combobox');
|
807
|
+
|
808
|
+
expect(input).toHaveValue('');
|
809
|
+
expect(onSelectionChange).not.toHaveBeenCalled(); // Should fire when input value was typed, and enter was pressed
|
810
|
+
|
811
|
+
_userEvent["default"].type(input, 'custom{enter}');
|
812
|
+
|
813
|
+
expect(onSelectionChange).toHaveBeenCalledWith('custom'); // Should fire when input is cleared
|
814
|
+
|
815
|
+
_userEvent["default"].type(input, '{selectall}{backspace}{enter}');
|
816
|
+
|
817
|
+
expect(onSelectionChange).toHaveBeenCalledWith('');
|
818
|
+
});
|
775
819
|
test('should have no accessibility violations', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
776
820
|
var _getComponent6, container, results;
|
777
821
|
|
@@ -8,7 +8,7 @@ _Object$defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
9
9
|
});
|
10
10
|
|
11
|
-
exports.Disabled = exports.WithTooltip = exports.
|
11
|
+
exports.Disabled = exports.WithTooltip = exports.Default = exports["default"] = void 0;
|
12
12
|
|
13
13
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
14
14
|
|
@@ -53,8 +53,10 @@ var _default = {
|
|
53
53
|
isDisabled: {},
|
54
54
|
variant: {
|
55
55
|
control: {
|
56
|
-
type: '
|
57
|
-
|
56
|
+
type: 'select',
|
57
|
+
options: ['iconButton', 'inverted', 'square', 'invertedSquare']
|
58
|
+
},
|
59
|
+
defaultValue: 'iconButton'
|
58
60
|
}
|
59
61
|
}
|
60
62
|
};
|
@@ -62,7 +64,7 @@ exports["default"] = _default;
|
|
62
64
|
|
63
65
|
var Default = function Default(args) {
|
64
66
|
return (0, _react2.jsx)(_["default"], (0, _extends2["default"])({
|
65
|
-
"aria-label": "
|
67
|
+
"aria-label": "default icon button"
|
66
68
|
}, args), (0, _react2.jsx)(_Icon["default"], {
|
67
69
|
icon: _CreateIcon["default"]
|
68
70
|
}));
|
@@ -70,20 +72,9 @@ var Default = function Default(args) {
|
|
70
72
|
|
71
73
|
exports.Default = Default;
|
72
74
|
|
73
|
-
var Inverted = function Inverted() {
|
74
|
-
return (0, _react2.jsx)(_["default"], {
|
75
|
-
"aria-label": "my-label",
|
76
|
-
variant: "inverted"
|
77
|
-
}, (0, _react2.jsx)(_Icon["default"], {
|
78
|
-
icon: _CreateIcon["default"]
|
79
|
-
}));
|
80
|
-
};
|
81
|
-
|
82
|
-
exports.Inverted = Inverted;
|
83
|
-
|
84
75
|
var WithTooltip = function WithTooltip() {
|
85
76
|
return (0, _react2.jsx)(_["default"], {
|
86
|
-
"aria-label": "
|
77
|
+
"aria-label": "icon button with tooltip",
|
87
78
|
title: "Edit"
|
88
79
|
}, (0, _react2.jsx)(_Icon["default"], {
|
89
80
|
icon: _CreateIcon["default"]
|
@@ -94,7 +85,7 @@ exports.WithTooltip = WithTooltip;
|
|
94
85
|
|
95
86
|
var Disabled = function Disabled() {
|
96
87
|
return (0, _react2.jsx)(_["default"], {
|
97
|
-
"aria-label": "
|
88
|
+
"aria-label": "disabled icon button",
|
98
89
|
isDisabled: true
|
99
90
|
}, (0, _react2.jsx)(_Icon["default"], {
|
100
91
|
icon: _CreateIcon["default"]
|
@@ -96,7 +96,13 @@ var Option = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
96
96
|
isSelected: isSelected
|
97
97
|
}),
|
98
98
|
classNames = _useStatusClasses.classNames;
|
99
|
+
/* Related to UIP-4992
|
100
|
+
* Need to remove these properties to avoid errors in the console on the external app.
|
101
|
+
* By the way, these properties return "undefined", so it shouldn't create issues */
|
99
102
|
|
103
|
+
|
104
|
+
delete optionProps.onPressStart;
|
105
|
+
delete optionProps.onPressUp;
|
100
106
|
return (0, _react2.jsx)(_Box["default"], (0, _extends2["default"])({
|
101
107
|
as: "li",
|
102
108
|
isRow: true,
|