@pingux/astro 1.32.1-alpha.6 → 1.32.1-alpha.7
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/lib/cjs/components/ComboBox/ComboBoxInput.js +15 -8
- package/lib/cjs/components/ComboBoxField/ComboBoxField.js +7 -12
- package/lib/cjs/components/ComboBoxField/ComboBoxField.test.js +28 -6
- package/lib/cjs/components/ImageUploadField/ImageUploadField.test.js +14 -16
- package/lib/cjs/components/MultivaluesField/MultivaluesField.js +3 -1
- package/lib/cjs/components/MultivaluesField/MultivaluesField.test.js +54 -11
- package/lib/cjs/components/PopoverContainer/PopoverContainer.js +1 -1
- package/lib/cjs/components/SelectFieldBase/SelectFieldBase.test.js +21 -1
- package/lib/cjs/hooks/useSelectField/useSelectField.js +6 -6
- package/lib/cjs/recipes/AttributesAndPingOneMapping.stories.js +1 -5
- package/lib/components/ComboBox/ComboBoxInput.js +15 -9
- package/lib/components/ComboBoxField/ComboBoxField.js +7 -12
- package/lib/components/ComboBoxField/ComboBoxField.test.js +24 -6
- package/lib/components/ImageUploadField/ImageUploadField.test.js +16 -16
- package/lib/components/MultivaluesField/MultivaluesField.js +3 -1
- package/lib/components/MultivaluesField/MultivaluesField.test.js +37 -11
- package/lib/components/PopoverContainer/PopoverContainer.js +1 -1
- package/lib/components/SelectFieldBase/SelectFieldBase.test.js +16 -1
- package/lib/hooks/useSelectField/useSelectField.js +6 -6
- package/lib/recipes/AttributesAndPingOneMapping.stories.js +1 -5
- package/package.json +1 -1
@@ -48,6 +48,8 @@ var _focus = require("@react-aria/focus");
|
|
48
48
|
|
49
49
|
var _interactions = require("@react-aria/interactions");
|
50
50
|
|
51
|
+
var _utils = require("@react-aria/utils");
|
52
|
+
|
51
53
|
var _MenuDownIcon = _interopRequireDefault(require("mdi-react/MenuDownIcon"));
|
52
54
|
|
53
55
|
var _ = require("../../");
|
@@ -94,10 +96,16 @@ var ComboBoxInput = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
94
96
|
wrapperProps = props.wrapperProps,
|
95
97
|
others = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
96
98
|
|
97
|
-
var textFieldProps = _objectSpread(
|
99
|
+
var textFieldProps = _objectSpread({
|
98
100
|
isDisabled: isDisabled,
|
99
|
-
isReadOnly: isReadOnly
|
100
|
-
|
101
|
+
isReadOnly: isReadOnly,
|
102
|
+
containerProps: containerProps
|
103
|
+
}, (0, _utils.mergeProps)(inputProps, others)); // istanbul ignore next
|
104
|
+
|
105
|
+
|
106
|
+
(0, _react.useImperativeHandle)(ref, function () {
|
107
|
+
return inputRef.current;
|
108
|
+
});
|
101
109
|
|
102
110
|
var _useHover = (0, _interactions.useHover)({}),
|
103
111
|
hoverProps = _useHover.hoverProps,
|
@@ -167,11 +175,13 @@ var ComboBoxInput = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
167
175
|
focusRingClass: "focus-ring",
|
168
176
|
autoFocus: hasAutoFocus
|
169
177
|
}, (0, _react2.jsx)(_.Box, (0, _extends2["default"])({
|
170
|
-
ref: ref,
|
171
178
|
isRow: true,
|
172
179
|
style: style,
|
173
180
|
variant: "forms.comboBox.container"
|
174
|
-
}, hoverProps, wrapperProps), (0, _react2.jsx)(_.TextField, (0, _extends2["default"])({},
|
181
|
+
}, hoverProps, wrapperProps), (0, _react2.jsx)(_.TextField, (0, _extends2["default"])({}, textFieldProps, {
|
182
|
+
wrapperProps: {
|
183
|
+
ref: inputWrapperRef
|
184
|
+
},
|
175
185
|
controlProps: _objectSpread({
|
176
186
|
variant: 'forms.comboBox.input'
|
177
187
|
}, controlProps),
|
@@ -181,9 +191,6 @@ var ComboBoxInput = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
181
191
|
ref: inputRef,
|
182
192
|
slots: {
|
183
193
|
inContainer: button
|
184
|
-
},
|
185
|
-
wrapperProps: {
|
186
|
-
ref: inputWrapperRef
|
187
194
|
}
|
188
195
|
}))));
|
189
196
|
});
|
@@ -247,11 +247,6 @@ var ComboBoxField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
247
247
|
});
|
248
248
|
(0, _utils.useLayoutEffect)(onResize, [onResize]);
|
249
249
|
|
250
|
-
var handleInputOpen = function handleInputOpen(e) {
|
251
|
-
if (!state.isOpen && menuTrigger === 'focus') buttonRef.current.click();
|
252
|
-
if (controlProps !== null && controlProps !== void 0 && controlProps.onClick) controlProps.onClick(e);
|
253
|
-
};
|
254
|
-
|
255
250
|
var style = _objectSpread(_objectSpread({}, overlayProps.style), {}, {
|
256
251
|
width: menuWidth,
|
257
252
|
minWidth: menuWidth
|
@@ -282,16 +277,16 @@ var ComboBoxField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
282
277
|
inputRef: inputRef,
|
283
278
|
triggerProps: buttonProps,
|
284
279
|
triggerRef: buttonRef,
|
285
|
-
controlProps:
|
286
|
-
onClick: handleInputOpen
|
287
|
-
})
|
280
|
+
controlProps: controlProps
|
288
281
|
})), (0, _react2.jsx)(_PopoverContainer["default"], {
|
282
|
+
hasNoArrow: true,
|
283
|
+
isDismissable: true,
|
284
|
+
isNonModal: true,
|
289
285
|
isOpen: state.isOpen,
|
290
|
-
|
286
|
+
onClose: state.close,
|
291
287
|
placement: placement,
|
292
|
-
|
293
|
-
style: style
|
294
|
-
isNonModal: true
|
288
|
+
ref: popoverRef,
|
289
|
+
style: style
|
295
290
|
}, listbox));
|
296
291
|
});
|
297
292
|
ComboBoxField.propTypes = _objectSpread({
|
@@ -354,7 +354,7 @@ test('should open list on focus when menuTrigger is set to use focus', function
|
|
354
354
|
expect(_testWrapper.screen.queryByRole('listbox')).toBeInTheDocument();
|
355
355
|
expect(_testWrapper.screen.queryAllByRole('option')).toHaveLength(items.length);
|
356
356
|
});
|
357
|
-
test('should open list on
|
357
|
+
test('should open list on click after selection when menuTrigger is set to use focus', function () {
|
358
358
|
getComponent({
|
359
359
|
menuTrigger: 'focus'
|
360
360
|
});
|
@@ -370,7 +370,9 @@ test('should open list on focus on click after selection when menuTrigger is set
|
|
370
370
|
_userEvent["default"].click(_testWrapper.screen.queryAllByRole('option')[0]);
|
371
371
|
|
372
372
|
expect(_testWrapper.screen.queryByRole('listbox')).not.toBeInTheDocument();
|
373
|
-
expect(input).toHaveFocus();
|
373
|
+
expect(input).toHaveFocus(); // Need to click away first, then click back
|
374
|
+
|
375
|
+
_userEvent["default"].click(document.body);
|
374
376
|
|
375
377
|
_userEvent["default"].click(input);
|
376
378
|
|
@@ -498,7 +500,7 @@ test('should invoke onSelectionChange when selection is made', function () {
|
|
498
500
|
|
499
501
|
expect(onSelectionChange).toHaveBeenNthCalledWith(1, items[2].id); // Should fire when input is cleared
|
500
502
|
|
501
|
-
_userEvent["default"].
|
503
|
+
_userEvent["default"].clear(input);
|
502
504
|
|
503
505
|
expect(onSelectionChange).toHaveBeenNthCalledWith(2, null); // Should fire on keyboard interaction
|
504
506
|
|
@@ -1008,9 +1010,9 @@ test('two listbox can not be open at the same time', function () {
|
|
1008
1010
|
expect(_testWrapper.screen.queryAllByRole('option')).toHaveLength(3);
|
1009
1011
|
expect(_testWrapper.screen.queryByRole('option', {
|
1010
1012
|
name: 'Aardvark'
|
1011
|
-
})).toBeInTheDocument();
|
1013
|
+
})).toBeInTheDocument(); // first click closes first popover, second click opens the second popover
|
1012
1014
|
|
1013
|
-
_userEvent["default"].
|
1015
|
+
_userEvent["default"].dblClick(button2);
|
1014
1016
|
|
1015
1017
|
expect(_testWrapper.screen.queryByRole('listbox')).toBeInTheDocument();
|
1016
1018
|
expect(_testWrapper.screen.queryAllByRole('option')).toHaveLength(2);
|
@@ -1130,4 +1132,24 @@ test('should have no accessibility violations', /*#__PURE__*/(0, _asyncToGenerat
|
|
1130
1132
|
}
|
1131
1133
|
}
|
1132
1134
|
}, _callee5);
|
1133
|
-
})));
|
1135
|
+
})));
|
1136
|
+
test('popover closes on input blur', function () {
|
1137
|
+
getComponent();
|
1138
|
+
expect(_testWrapper.screen.queryByRole('listbox')).not.toBeInTheDocument();
|
1139
|
+
expect(_testWrapper.screen.queryByRole('option')).not.toBeInTheDocument();
|
1140
|
+
|
1141
|
+
var input = _testWrapper.screen.getByRole('combobox');
|
1142
|
+
|
1143
|
+
_userEvent["default"].click(input);
|
1144
|
+
|
1145
|
+
expect(_testWrapper.screen.queryByRole('listbox')).toBeInTheDocument();
|
1146
|
+
expect(_testWrapper.screen.queryAllByRole('option')).toHaveLength(3);
|
1147
|
+
expect(_testWrapper.screen.queryByRole('option', {
|
1148
|
+
name: 'Aardvark'
|
1149
|
+
})).toBeInTheDocument();
|
1150
|
+
|
1151
|
+
_userEvent["default"].click(document.body);
|
1152
|
+
|
1153
|
+
expect(_testWrapper.screen.queryByRole('listbox')).not.toBeInTheDocument();
|
1154
|
+
expect(_testWrapper.screen.queryByRole('option')).not.toBeInTheDocument();
|
1155
|
+
});
|
@@ -159,14 +159,13 @@ test('should upload a file if label clicked', /*#__PURE__*/(0, _asyncToGenerator
|
|
159
159
|
}
|
160
160
|
}, _callee2);
|
161
161
|
})));
|
162
|
-
test('should show the menu if
|
163
|
-
var
|
162
|
+
test('should show the menu if image preview is clicked when preview image exists', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
163
|
+
var imagePreview;
|
164
164
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
165
165
|
while (1) {
|
166
166
|
switch (_context3.prev = _context3.next) {
|
167
167
|
case 0:
|
168
168
|
getComponent();
|
169
|
-
imageUploadLabel = _testWrapper.screen.getByText(testLabel);
|
170
169
|
|
171
170
|
_react2.fireEvent.change(_testWrapper.screen.getByTestId('image-upload-input'), {
|
172
171
|
target: {
|
@@ -174,20 +173,20 @@ test('should show the menu if label clicked when preview image exists', /*#__PUR
|
|
174
173
|
}
|
175
174
|
});
|
176
175
|
|
177
|
-
_context3.next =
|
176
|
+
_context3.next = 4;
|
178
177
|
return _testWrapper.screen.findByTestId(imageUploadImagePreview);
|
179
178
|
|
180
|
-
case
|
179
|
+
case 4:
|
181
180
|
imagePreview = _context3.sent;
|
182
181
|
expect(imagePreview).toBeInTheDocument();
|
183
|
-
expect(imagePreview).toHaveAttribute('src');
|
182
|
+
expect(imagePreview).toHaveAttribute('src'); // Click on the image preview button
|
184
183
|
|
185
|
-
_userEvent["default"].click(
|
184
|
+
_userEvent["default"].click(_testWrapper.screen.getByRole('button'));
|
186
185
|
|
187
186
|
expect(_testWrapper.screen.getByText('Upload New Image')).toBeInTheDocument();
|
188
187
|
expect(_testWrapper.screen.getByText('Remove Image')).toBeInTheDocument();
|
189
188
|
|
190
|
-
case
|
189
|
+
case 10:
|
191
190
|
case "end":
|
192
191
|
return _context3.stop();
|
193
192
|
}
|
@@ -404,8 +403,8 @@ test('loader size can be changed via the prop', function () {
|
|
404
403
|
'font-size': "".concat(testLoaderSize, "px")
|
405
404
|
});
|
406
405
|
});
|
407
|
-
test('should show the menu if label clicked when preview image exists', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
408
|
-
var customUploadProp, customRemoveProp,
|
406
|
+
test('should show the menu if label clicked when preview image exists with custom uploads', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
407
|
+
var customUploadProp, customRemoveProp, imagePreview;
|
409
408
|
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
410
409
|
while (1) {
|
411
410
|
switch (_context6.prev = _context6.next) {
|
@@ -416,7 +415,6 @@ test('should show the menu if label clicked when preview image exists', /*#__PUR
|
|
416
415
|
uploadItemText: customUploadProp,
|
417
416
|
removeItemText: customRemoveProp
|
418
417
|
});
|
419
|
-
imageUploadLabel = _testWrapper.screen.getByText(testLabel);
|
420
418
|
|
421
419
|
_react2.fireEvent.change(_testWrapper.screen.getByTestId('image-upload-input'), {
|
422
420
|
target: {
|
@@ -424,20 +422,20 @@ test('should show the menu if label clicked when preview image exists', /*#__PUR
|
|
424
422
|
}
|
425
423
|
});
|
426
424
|
|
427
|
-
_context6.next =
|
425
|
+
_context6.next = 6;
|
428
426
|
return _testWrapper.screen.findByTestId(imageUploadImagePreview);
|
429
427
|
|
430
|
-
case
|
428
|
+
case 6:
|
431
429
|
imagePreview = _context6.sent;
|
432
430
|
expect(imagePreview).toBeInTheDocument();
|
433
|
-
expect(imagePreview).toHaveAttribute('src');
|
431
|
+
expect(imagePreview).toHaveAttribute('src'); // Click on the image preview button
|
434
432
|
|
435
|
-
_userEvent["default"].click(
|
433
|
+
_userEvent["default"].click(_testWrapper.screen.getByRole('button'));
|
436
434
|
|
437
435
|
expect(_testWrapper.screen.getByText(customUploadProp)).toBeInTheDocument();
|
438
436
|
expect(_testWrapper.screen.getByText(customRemoveProp)).toBeInTheDocument();
|
439
437
|
|
440
|
-
case
|
438
|
+
case 12:
|
441
439
|
case "end":
|
442
440
|
return _context6.stop();
|
443
441
|
}
|
@@ -480,11 +480,13 @@ var MultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
480
480
|
}, ariaProps, inputProps)), helperText && (0, _react2.jsx)(_.FieldHelperText, {
|
481
481
|
status: status
|
482
482
|
}, helperText), (0, _react2.jsx)(_.PopoverContainer, {
|
483
|
-
ref: popoverRef,
|
484
483
|
hasNoArrow: true,
|
484
|
+
isDismissable: true,
|
485
485
|
isNonModal: true,
|
486
486
|
isOpen: isOpen,
|
487
|
+
onClose: close,
|
487
488
|
placement: placement,
|
489
|
+
ref: popoverRef,
|
488
490
|
style: style
|
489
491
|
}, listbox));
|
490
492
|
});
|
@@ -95,7 +95,9 @@ test('opens listbox on focus and fires "onFocus', function () {
|
|
95
95
|
|
96
96
|
var input = _testWrapper.screen.getByRole('combobox');
|
97
97
|
|
98
|
-
|
98
|
+
_userEvent["default"].tab();
|
99
|
+
|
100
|
+
expect(input).toHaveFocus();
|
99
101
|
expect(_testWrapper.screen.getByRole('listbox')).toBeInTheDocument();
|
100
102
|
|
101
103
|
var options = _testWrapper.screen.getAllByRole('option');
|
@@ -112,7 +114,9 @@ test('closes listbox on blur and fires "onBlur"', function () {
|
|
112
114
|
|
113
115
|
var input = _testWrapper.screen.getByRole('combobox');
|
114
116
|
|
115
|
-
|
117
|
+
_userEvent["default"].tab();
|
118
|
+
|
119
|
+
expect(input).toHaveFocus();
|
116
120
|
expect(_testWrapper.screen.queryByRole('listbox')).toBeInTheDocument();
|
117
121
|
input.blur();
|
118
122
|
expect(_testWrapper.screen.queryByRole('listbox')).not.toBeInTheDocument();
|
@@ -126,7 +130,9 @@ test('opening and closing listbox fires "onOpenChange"', function () {
|
|
126
130
|
|
127
131
|
var input = _testWrapper.screen.getByRole('combobox');
|
128
132
|
|
129
|
-
|
133
|
+
_userEvent["default"].tab();
|
134
|
+
|
135
|
+
expect(input).toHaveFocus();
|
130
136
|
expect(_testWrapper.screen.queryByRole('listbox')).toBeInTheDocument();
|
131
137
|
expect(onOpenChange).toHaveBeenCalledWith(true);
|
132
138
|
input.blur();
|
@@ -138,7 +144,9 @@ test('multiple selection is enabled, option disappears after selection', functio
|
|
138
144
|
|
139
145
|
var input = _testWrapper.screen.getByRole('combobox');
|
140
146
|
|
141
|
-
|
147
|
+
_userEvent["default"].tab();
|
148
|
+
|
149
|
+
expect(input).toHaveFocus();
|
142
150
|
|
143
151
|
var listbox = _testWrapper.screen.getByRole('listbox');
|
144
152
|
|
@@ -156,7 +164,9 @@ test('clicking an option renders chip with option name', function () {
|
|
156
164
|
|
157
165
|
var input = _testWrapper.screen.getByRole('combobox');
|
158
166
|
|
159
|
-
|
167
|
+
_userEvent["default"].tab();
|
168
|
+
|
169
|
+
expect(input).toHaveFocus();
|
160
170
|
|
161
171
|
var options = _testWrapper.screen.getAllByRole('option');
|
162
172
|
|
@@ -175,7 +185,9 @@ test('clicking on delete button deletes selection, and re-adds option to list',
|
|
175
185
|
|
176
186
|
var input = _testWrapper.screen.getByRole('combobox');
|
177
187
|
|
178
|
-
|
188
|
+
_userEvent["default"].tab();
|
189
|
+
|
190
|
+
expect(input).toHaveFocus();
|
179
191
|
|
180
192
|
var options = _testWrapper.screen.getAllByRole('option');
|
181
193
|
|
@@ -189,7 +201,10 @@ test('clicking on delete button deletes selection, and re-adds option to list',
|
|
189
201
|
var deleteButton = chip.nextSibling;
|
190
202
|
deleteButton.click();
|
191
203
|
expect(chip).not.toBeInTheDocument();
|
192
|
-
|
204
|
+
|
205
|
+
_userEvent["default"].tab();
|
206
|
+
|
207
|
+
expect(input).toHaveFocus();
|
193
208
|
|
194
209
|
var updatedOptions = _testWrapper.screen.getAllByRole('option');
|
195
210
|
|
@@ -204,7 +219,9 @@ test('clicking an option fires "onSelectionChange"', function () {
|
|
204
219
|
|
205
220
|
var input = _testWrapper.screen.getByRole('combobox');
|
206
221
|
|
207
|
-
|
222
|
+
_userEvent["default"].tab();
|
223
|
+
|
224
|
+
expect(input).toHaveFocus();
|
208
225
|
|
209
226
|
var listbox = _testWrapper.screen.getByRole('listbox');
|
210
227
|
|
@@ -335,7 +352,9 @@ test('in non-restrictive mode the value that was already selected using the list
|
|
335
352
|
|
336
353
|
var input = _testWrapper.screen.getByRole('combobox');
|
337
354
|
|
338
|
-
|
355
|
+
_userEvent["default"].tab();
|
356
|
+
|
357
|
+
expect(input).toHaveFocus();
|
339
358
|
|
340
359
|
var listbox = _testWrapper.screen.getByRole('listbox');
|
341
360
|
|
@@ -357,7 +376,9 @@ test('options can be focused via keyboard', function () {
|
|
357
376
|
|
358
377
|
var input = _testWrapper.screen.getByRole('combobox');
|
359
378
|
|
360
|
-
|
379
|
+
_userEvent["default"].tab();
|
380
|
+
|
381
|
+
expect(input).toHaveFocus();
|
361
382
|
|
362
383
|
var listbox = _testWrapper.screen.getByRole('listbox');
|
363
384
|
|
@@ -381,7 +402,9 @@ test('options can be selected via keyboard', function () {
|
|
381
402
|
|
382
403
|
var input = _testWrapper.screen.getByRole('combobox');
|
383
404
|
|
384
|
-
|
405
|
+
_userEvent["default"].tab();
|
406
|
+
|
407
|
+
expect(input).toHaveFocus();
|
385
408
|
|
386
409
|
var listbox = _testWrapper.screen.getByRole('listbox');
|
387
410
|
|
@@ -527,4 +550,24 @@ test('read only keys with read only field', function () {
|
|
527
550
|
|
528
551
|
expect(textArea).toHaveClass('is-read-only');
|
529
552
|
expect(_testWrapper.screen.queryByRole('option')).not.toBeInTheDocument();
|
553
|
+
});
|
554
|
+
test('popover closes on input blur', function () {
|
555
|
+
getComponent();
|
556
|
+
expect(_testWrapper.screen.queryByRole('listbox')).not.toBeInTheDocument();
|
557
|
+
expect(_testWrapper.screen.queryByRole('option')).not.toBeInTheDocument();
|
558
|
+
|
559
|
+
var input = _testWrapper.screen.getByRole('combobox');
|
560
|
+
|
561
|
+
_userEvent["default"].click(input);
|
562
|
+
|
563
|
+
expect(_testWrapper.screen.queryByRole('listbox')).toBeInTheDocument();
|
564
|
+
expect(_testWrapper.screen.queryAllByRole('option')).toHaveLength(3);
|
565
|
+
expect(_testWrapper.screen.queryByRole('option', {
|
566
|
+
name: 'Aardvark'
|
567
|
+
})).toBeInTheDocument();
|
568
|
+
|
569
|
+
_userEvent["default"].click(document.body);
|
570
|
+
|
571
|
+
expect(_testWrapper.screen.queryByRole('listbox')).not.toBeInTheDocument();
|
572
|
+
expect(_testWrapper.screen.queryByRole('option')).not.toBeInTheDocument();
|
530
573
|
});
|
@@ -129,7 +129,7 @@ var PopoverWrapper = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
129
129
|
});
|
130
130
|
|
131
131
|
var _useOverlay = (0, _overlays.useOverlay)(_objectSpread(_objectSpread({}, props), {}, {
|
132
|
-
|
132
|
+
shouldCloseOnBlur: !isNotClosedOnBlur
|
133
133
|
}), popoverRef),
|
134
134
|
overlayProps = _useOverlay.overlayProps;
|
135
135
|
|
@@ -494,4 +494,24 @@ test('should have no accessibility violations', /*#__PURE__*/(0, _asyncToGenerat
|
|
494
494
|
}
|
495
495
|
}
|
496
496
|
}, _callee);
|
497
|
-
})));
|
497
|
+
})));
|
498
|
+
test('popover closes on button blur', function () {
|
499
|
+
getComponent();
|
500
|
+
expect(_testWrapper.screen.queryByRole('listbox')).not.toBeInTheDocument();
|
501
|
+
expect(_testWrapper.screen.queryByRole('option')).not.toBeInTheDocument();
|
502
|
+
|
503
|
+
var button = _testWrapper.screen.getByRole('button');
|
504
|
+
|
505
|
+
_userEvent["default"].click(button);
|
506
|
+
|
507
|
+
expect(_testWrapper.screen.queryByRole('listbox')).toBeInTheDocument();
|
508
|
+
expect(_testWrapper.screen.queryAllByRole('option')).toHaveLength(3);
|
509
|
+
expect(_testWrapper.screen.queryByRole('option', {
|
510
|
+
name: 'a'
|
511
|
+
})).toBeInTheDocument();
|
512
|
+
|
513
|
+
_userEvent["default"].click(document.body);
|
514
|
+
|
515
|
+
expect(_testWrapper.screen.queryByRole('listbox')).not.toBeInTheDocument();
|
516
|
+
expect(_testWrapper.screen.queryByRole('option')).not.toBeInTheDocument();
|
517
|
+
});
|
@@ -240,14 +240,14 @@ var useSelectField = function useSelectField(props, ref) {
|
|
240
240
|
}
|
241
241
|
}));
|
242
242
|
var overlay = (0, _react2.jsx)(_PopoverContainer["default"], {
|
243
|
-
isOpen: state.isOpen,
|
244
|
-
ref: popoverRef,
|
245
|
-
placement: placement,
|
246
243
|
hasNoArrow: true,
|
247
|
-
|
248
|
-
style: style,
|
244
|
+
isDismissable: true,
|
249
245
|
isNonModal: true,
|
250
|
-
|
246
|
+
isOpen: state.isOpen,
|
247
|
+
onClose: state.close,
|
248
|
+
placement: placement,
|
249
|
+
ref: popoverRef,
|
250
|
+
style: style
|
251
251
|
}, (0, _react2.jsx)(_ScrollBox["default"], scrollBoxProps, listbox));
|
252
252
|
return {
|
253
253
|
columnStyleProps: columnStyleProps,
|
@@ -170,12 +170,8 @@ var Row = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
170
170
|
sx: sx.comboBoxField
|
171
171
|
},
|
172
172
|
containerProps: {
|
173
|
-
'aria-label': 'selection field',
|
174
173
|
width: '100%',
|
175
|
-
maxWidth: '310px'
|
176
|
-
sx: {
|
177
|
-
width: '100%'
|
178
|
-
}
|
174
|
+
maxWidth: '310px'
|
179
175
|
},
|
180
176
|
inputValue: inputValue,
|
181
177
|
onInputChange: setInputValue
|
@@ -18,10 +18,11 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (
|
|
18
18
|
|
19
19
|
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; }
|
20
20
|
|
21
|
-
import React, { forwardRef, useEffect, useRef, useState } from 'react';
|
21
|
+
import React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
22
22
|
import PropTypes from 'prop-types';
|
23
23
|
import { FocusRing } from '@react-aria/focus';
|
24
24
|
import { PressResponder, useHover } from '@react-aria/interactions';
|
25
|
+
import { mergeProps } from '@react-aria/utils';
|
25
26
|
import MenuDown from 'mdi-react/MenuDownIcon';
|
26
27
|
import { Box, Button, Icon, Loader, TextField } from '../../';
|
27
28
|
import { ariaAttributesBasePropTypes } from '../../utils/devUtils/props/ariaAttributes';
|
@@ -51,10 +52,16 @@ var ComboBoxInput = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
51
52
|
wrapperProps = props.wrapperProps,
|
52
53
|
others = _objectWithoutProperties(props, _excluded);
|
53
54
|
|
54
|
-
var textFieldProps = _objectSpread(
|
55
|
+
var textFieldProps = _objectSpread({
|
55
56
|
isDisabled: isDisabled,
|
56
|
-
isReadOnly: isReadOnly
|
57
|
-
|
57
|
+
isReadOnly: isReadOnly,
|
58
|
+
containerProps: containerProps
|
59
|
+
}, mergeProps(inputProps, others)); // istanbul ignore next
|
60
|
+
|
61
|
+
|
62
|
+
useImperativeHandle(ref, function () {
|
63
|
+
return inputRef.current;
|
64
|
+
});
|
58
65
|
|
59
66
|
var _useHover = useHover({}),
|
60
67
|
hoverProps = _useHover.hoverProps,
|
@@ -126,11 +133,13 @@ var ComboBoxInput = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
126
133
|
focusRingClass: "focus-ring",
|
127
134
|
autoFocus: hasAutoFocus
|
128
135
|
}, ___EmotionJSX(Box, _extends({
|
129
|
-
ref: ref,
|
130
136
|
isRow: true,
|
131
137
|
style: style,
|
132
138
|
variant: "forms.comboBox.container"
|
133
|
-
}, hoverProps, wrapperProps), ___EmotionJSX(TextField, _extends({},
|
139
|
+
}, hoverProps, wrapperProps), ___EmotionJSX(TextField, _extends({}, textFieldProps, {
|
140
|
+
wrapperProps: {
|
141
|
+
ref: inputWrapperRef
|
142
|
+
},
|
134
143
|
controlProps: _objectSpread({
|
135
144
|
variant: 'forms.comboBox.input'
|
136
145
|
}, controlProps),
|
@@ -140,9 +149,6 @@ var ComboBoxInput = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
140
149
|
ref: inputRef,
|
141
150
|
slots: {
|
142
151
|
inContainer: button
|
143
|
-
},
|
144
|
-
wrapperProps: {
|
145
|
-
ref: inputWrapperRef
|
146
152
|
}
|
147
153
|
}))));
|
148
154
|
});
|
@@ -199,11 +199,6 @@ var ComboBoxField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
199
199
|
});
|
200
200
|
useLayoutEffect(onResize, [onResize]);
|
201
201
|
|
202
|
-
var handleInputOpen = function handleInputOpen(e) {
|
203
|
-
if (!state.isOpen && menuTrigger === 'focus') buttonRef.current.click();
|
204
|
-
if (controlProps !== null && controlProps !== void 0 && controlProps.onClick) controlProps.onClick(e);
|
205
|
-
};
|
206
|
-
|
207
202
|
var style = _objectSpread(_objectSpread({}, overlayProps.style), {}, {
|
208
203
|
width: menuWidth,
|
209
204
|
minWidth: menuWidth
|
@@ -235,16 +230,16 @@ var ComboBoxField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
235
230
|
inputRef: inputRef,
|
236
231
|
triggerProps: buttonProps,
|
237
232
|
triggerRef: buttonRef,
|
238
|
-
controlProps:
|
239
|
-
onClick: handleInputOpen
|
240
|
-
})
|
233
|
+
controlProps: controlProps
|
241
234
|
})), ___EmotionJSX(PopoverContainer, {
|
235
|
+
hasNoArrow: true,
|
236
|
+
isDismissable: true,
|
237
|
+
isNonModal: true,
|
242
238
|
isOpen: state.isOpen,
|
243
|
-
|
239
|
+
onClose: state.close,
|
244
240
|
placement: placement,
|
245
|
-
|
246
|
-
style: style
|
247
|
-
isNonModal: true
|
241
|
+
ref: popoverRef,
|
242
|
+
style: style
|
248
243
|
}, listbox));
|
249
244
|
});
|
250
245
|
ComboBoxField.propTypes = _objectSpread({
|
@@ -278,7 +278,7 @@ test('should open list on focus when menuTrigger is set to use focus', function
|
|
278
278
|
expect(screen.queryByRole('listbox')).toBeInTheDocument();
|
279
279
|
expect(screen.queryAllByRole('option')).toHaveLength(items.length);
|
280
280
|
});
|
281
|
-
test('should open list on
|
281
|
+
test('should open list on click after selection when menuTrigger is set to use focus', function () {
|
282
282
|
getComponent({
|
283
283
|
menuTrigger: 'focus'
|
284
284
|
});
|
@@ -288,7 +288,9 @@ test('should open list on focus on click after selection when menuTrigger is set
|
|
288
288
|
expect(screen.queryByRole('listbox')).toBeInTheDocument();
|
289
289
|
userEvent.click(screen.queryAllByRole('option')[0]);
|
290
290
|
expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
|
291
|
-
expect(input).toHaveFocus();
|
291
|
+
expect(input).toHaveFocus(); // Need to click away first, then click back
|
292
|
+
|
293
|
+
userEvent.click(document.body);
|
292
294
|
userEvent.click(input);
|
293
295
|
expect(screen.queryByRole('listbox')).toBeInTheDocument();
|
294
296
|
});
|
@@ -385,7 +387,7 @@ test('should invoke onSelectionChange when selection is made', function () {
|
|
385
387
|
userEvent.click(screen.queryAllByRole('option')[2]);
|
386
388
|
expect(onSelectionChange).toHaveBeenNthCalledWith(1, items[2].id); // Should fire when input is cleared
|
387
389
|
|
388
|
-
userEvent.
|
390
|
+
userEvent.clear(input);
|
389
391
|
expect(onSelectionChange).toHaveBeenNthCalledWith(2, null); // Should fire on keyboard interaction
|
390
392
|
|
391
393
|
userEvent.type(input, '{arrowdown}{enter}');
|
@@ -835,8 +837,9 @@ test('two listbox can not be open at the same time', function () {
|
|
835
837
|
expect(screen.queryAllByRole('option')).toHaveLength(3);
|
836
838
|
expect(screen.queryByRole('option', {
|
837
839
|
name: 'Aardvark'
|
838
|
-
})).toBeInTheDocument();
|
839
|
-
|
840
|
+
})).toBeInTheDocument(); // first click closes first popover, second click opens the second popover
|
841
|
+
|
842
|
+
userEvent.dblClick(button2);
|
840
843
|
expect(screen.queryByRole('listbox')).toBeInTheDocument();
|
841
844
|
expect(screen.queryAllByRole('option')).toHaveLength(2);
|
842
845
|
expect(screen.queryByRole('option', {
|
@@ -931,4 +934,19 @@ test('should have no accessibility violations', /*#__PURE__*/_asyncToGenerator(
|
|
931
934
|
}
|
932
935
|
}
|
933
936
|
}, _callee5);
|
934
|
-
})));
|
937
|
+
})));
|
938
|
+
test('popover closes on input blur', function () {
|
939
|
+
getComponent();
|
940
|
+
expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
|
941
|
+
expect(screen.queryByRole('option')).not.toBeInTheDocument();
|
942
|
+
var input = screen.getByRole('combobox');
|
943
|
+
userEvent.click(input);
|
944
|
+
expect(screen.queryByRole('listbox')).toBeInTheDocument();
|
945
|
+
expect(screen.queryAllByRole('option')).toHaveLength(3);
|
946
|
+
expect(screen.queryByRole('option', {
|
947
|
+
name: 'Aardvark'
|
948
|
+
})).toBeInTheDocument();
|
949
|
+
userEvent.click(document.body);
|
950
|
+
expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
|
951
|
+
expect(screen.queryByRole('option')).not.toBeInTheDocument();
|
952
|
+
});
|
@@ -131,31 +131,31 @@ test('should upload a file if label clicked', /*#__PURE__*/_asyncToGenerator( /*
|
|
131
131
|
}
|
132
132
|
}, _callee2);
|
133
133
|
})));
|
134
|
-
test('should show the menu if
|
135
|
-
var
|
134
|
+
test('should show the menu if image preview is clicked when preview image exists', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
135
|
+
var imagePreview;
|
136
136
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
137
137
|
while (1) {
|
138
138
|
switch (_context3.prev = _context3.next) {
|
139
139
|
case 0:
|
140
140
|
getComponent();
|
141
|
-
imageUploadLabel = screen.getByText(testLabel);
|
142
141
|
fireEvent.change(screen.getByTestId('image-upload-input'), {
|
143
142
|
target: {
|
144
143
|
files: [file]
|
145
144
|
}
|
146
145
|
});
|
147
|
-
_context3.next =
|
146
|
+
_context3.next = 4;
|
148
147
|
return screen.findByTestId(imageUploadImagePreview);
|
149
148
|
|
150
|
-
case
|
149
|
+
case 4:
|
151
150
|
imagePreview = _context3.sent;
|
152
151
|
expect(imagePreview).toBeInTheDocument();
|
153
|
-
expect(imagePreview).toHaveAttribute('src');
|
154
|
-
|
152
|
+
expect(imagePreview).toHaveAttribute('src'); // Click on the image preview button
|
153
|
+
|
154
|
+
userEvent.click(screen.getByRole('button'));
|
155
155
|
expect(screen.getByText('Upload New Image')).toBeInTheDocument();
|
156
156
|
expect(screen.getByText('Remove Image')).toBeInTheDocument();
|
157
157
|
|
158
|
-
case
|
158
|
+
case 10:
|
159
159
|
case "end":
|
160
160
|
return _context3.stop();
|
161
161
|
}
|
@@ -352,8 +352,8 @@ test('loader size can be changed via the prop', function () {
|
|
352
352
|
'font-size': "".concat(testLoaderSize, "px")
|
353
353
|
});
|
354
354
|
});
|
355
|
-
test('should show the menu if label clicked when preview image exists', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
356
|
-
var customUploadProp, customRemoveProp,
|
355
|
+
test('should show the menu if label clicked when preview image exists with custom uploads', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
356
|
+
var customUploadProp, customRemoveProp, imagePreview;
|
357
357
|
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
358
358
|
while (1) {
|
359
359
|
switch (_context6.prev = _context6.next) {
|
@@ -364,24 +364,24 @@ test('should show the menu if label clicked when preview image exists', /*#__PUR
|
|
364
364
|
uploadItemText: customUploadProp,
|
365
365
|
removeItemText: customRemoveProp
|
366
366
|
});
|
367
|
-
imageUploadLabel = screen.getByText(testLabel);
|
368
367
|
fireEvent.change(screen.getByTestId('image-upload-input'), {
|
369
368
|
target: {
|
370
369
|
files: [file]
|
371
370
|
}
|
372
371
|
});
|
373
|
-
_context6.next =
|
372
|
+
_context6.next = 6;
|
374
373
|
return screen.findByTestId(imageUploadImagePreview);
|
375
374
|
|
376
|
-
case
|
375
|
+
case 6:
|
377
376
|
imagePreview = _context6.sent;
|
378
377
|
expect(imagePreview).toBeInTheDocument();
|
379
|
-
expect(imagePreview).toHaveAttribute('src');
|
380
|
-
|
378
|
+
expect(imagePreview).toHaveAttribute('src'); // Click on the image preview button
|
379
|
+
|
380
|
+
userEvent.click(screen.getByRole('button'));
|
381
381
|
expect(screen.getByText(customUploadProp)).toBeInTheDocument();
|
382
382
|
expect(screen.getByText(customRemoveProp)).toBeInTheDocument();
|
383
383
|
|
384
|
-
case
|
384
|
+
case 12:
|
385
385
|
case "end":
|
386
386
|
return _context6.stop();
|
387
387
|
}
|
@@ -431,11 +431,13 @@ var MultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
431
431
|
}, ariaProps, inputProps)), helperText && ___EmotionJSX(FieldHelperText, {
|
432
432
|
status: status
|
433
433
|
}, helperText), ___EmotionJSX(PopoverContainer, {
|
434
|
-
ref: popoverRef,
|
435
434
|
hasNoArrow: true,
|
435
|
+
isDismissable: true,
|
436
436
|
isNonModal: true,
|
437
437
|
isOpen: isOpen,
|
438
|
+
onClose: close,
|
438
439
|
placement: placement,
|
440
|
+
ref: popoverRef,
|
439
441
|
style: style
|
440
442
|
}, listbox));
|
441
443
|
});
|
@@ -76,7 +76,8 @@ test('opens listbox on focus and fires "onFocus', function () {
|
|
76
76
|
onFocus: onFocus
|
77
77
|
});
|
78
78
|
var input = screen.getByRole('combobox');
|
79
|
-
|
79
|
+
userEvent.tab();
|
80
|
+
expect(input).toHaveFocus();
|
80
81
|
expect(screen.getByRole('listbox')).toBeInTheDocument();
|
81
82
|
var options = screen.getAllByRole('option');
|
82
83
|
expect(options.length).toBe(items.length);
|
@@ -89,7 +90,8 @@ test('closes listbox on blur and fires "onBlur"', function () {
|
|
89
90
|
onBlur: onBlur
|
90
91
|
});
|
91
92
|
var input = screen.getByRole('combobox');
|
92
|
-
|
93
|
+
userEvent.tab();
|
94
|
+
expect(input).toHaveFocus();
|
93
95
|
expect(screen.queryByRole('listbox')).toBeInTheDocument();
|
94
96
|
input.blur();
|
95
97
|
expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
|
@@ -101,7 +103,8 @@ test('opening and closing listbox fires "onOpenChange"', function () {
|
|
101
103
|
onOpenChange: onOpenChange
|
102
104
|
});
|
103
105
|
var input = screen.getByRole('combobox');
|
104
|
-
|
106
|
+
userEvent.tab();
|
107
|
+
expect(input).toHaveFocus();
|
105
108
|
expect(screen.queryByRole('listbox')).toBeInTheDocument();
|
106
109
|
expect(onOpenChange).toHaveBeenCalledWith(true);
|
107
110
|
input.blur();
|
@@ -111,7 +114,8 @@ test('opening and closing listbox fires "onOpenChange"', function () {
|
|
111
114
|
test('multiple selection is enabled, option disappears after selection', function () {
|
112
115
|
getComponent();
|
113
116
|
var input = screen.getByRole('combobox');
|
114
|
-
|
117
|
+
userEvent.tab();
|
118
|
+
expect(input).toHaveFocus();
|
115
119
|
var listbox = screen.getByRole('listbox');
|
116
120
|
expect(listbox).toHaveAttribute('aria-multiselectable', 'true');
|
117
121
|
var options = within(listbox).getAllByRole('option');
|
@@ -125,7 +129,8 @@ test('multiple selection is enabled, option disappears after selection', functio
|
|
125
129
|
test('clicking an option renders chip with option name', function () {
|
126
130
|
getComponent();
|
127
131
|
var input = screen.getByRole('combobox');
|
128
|
-
|
132
|
+
userEvent.tab();
|
133
|
+
expect(input).toHaveFocus();
|
129
134
|
var options = screen.getAllByRole('option');
|
130
135
|
var firstOption = options[0];
|
131
136
|
firstOption.click();
|
@@ -138,7 +143,8 @@ test('clicking an option renders chip with option name', function () {
|
|
138
143
|
test('clicking on delete button deletes selection, and re-adds option to list', function () {
|
139
144
|
getComponent();
|
140
145
|
var input = screen.getByRole('combobox');
|
141
|
-
|
146
|
+
userEvent.tab();
|
147
|
+
expect(input).toHaveFocus();
|
142
148
|
var options = screen.getAllByRole('option');
|
143
149
|
var firstOption = options[0];
|
144
150
|
firstOption.click();
|
@@ -148,7 +154,8 @@ test('clicking on delete button deletes selection, and re-adds option to list',
|
|
148
154
|
var deleteButton = chip.nextSibling;
|
149
155
|
deleteButton.click();
|
150
156
|
expect(chip).not.toBeInTheDocument();
|
151
|
-
|
157
|
+
userEvent.tab();
|
158
|
+
expect(input).toHaveFocus();
|
152
159
|
var updatedOptions = screen.getAllByRole('option');
|
153
160
|
expect(updatedOptions[0]).toBeInTheDocument();
|
154
161
|
expect(updatedOptions[0]).toHaveTextContent(items[0].name);
|
@@ -159,7 +166,8 @@ test('clicking an option fires "onSelectionChange"', function () {
|
|
159
166
|
onSelectionChange: onSelectionChange
|
160
167
|
});
|
161
168
|
var input = screen.getByRole('combobox');
|
162
|
-
|
169
|
+
userEvent.tab();
|
170
|
+
expect(input).toHaveFocus();
|
163
171
|
var listbox = screen.getByRole('listbox');
|
164
172
|
var options = within(listbox).getAllByRole('option');
|
165
173
|
var firstOption = options[0];
|
@@ -253,7 +261,8 @@ test('in non-restrictive mode the value that was already selected using the list
|
|
253
261
|
onSelectionChange: onSelectionChange
|
254
262
|
});
|
255
263
|
var input = screen.getByRole('combobox');
|
256
|
-
|
264
|
+
userEvent.tab();
|
265
|
+
expect(input).toHaveFocus();
|
257
266
|
var listbox = screen.getByRole('listbox');
|
258
267
|
var options = within(listbox).getAllByRole('option');
|
259
268
|
var firstOption = options[0];
|
@@ -268,7 +277,8 @@ test('in non-restrictive mode the value that was already selected using the list
|
|
268
277
|
test('options can be focused via keyboard', function () {
|
269
278
|
getComponent();
|
270
279
|
var input = screen.getByRole('combobox');
|
271
|
-
|
280
|
+
userEvent.tab();
|
281
|
+
expect(input).toHaveFocus();
|
272
282
|
var listbox = screen.getByRole('listbox');
|
273
283
|
expect(listbox).toBeInTheDocument();
|
274
284
|
var options = within(listbox).getAllByRole('option');
|
@@ -284,7 +294,8 @@ test('options can be focused via keyboard', function () {
|
|
284
294
|
test('options can be selected via keyboard', function () {
|
285
295
|
getComponent();
|
286
296
|
var input = screen.getByRole('combobox');
|
287
|
-
|
297
|
+
userEvent.tab();
|
298
|
+
expect(input).toHaveFocus();
|
288
299
|
var listbox = screen.getByRole('listbox');
|
289
300
|
expect(listbox).toBeInTheDocument();
|
290
301
|
var options = within(listbox).getAllByRole('option');
|
@@ -394,4 +405,19 @@ test('read only keys with read only field', function () {
|
|
394
405
|
var textArea = screen.getByLabelText(defaultProps.label);
|
395
406
|
expect(textArea).toHaveClass('is-read-only');
|
396
407
|
expect(screen.queryByRole('option')).not.toBeInTheDocument();
|
408
|
+
});
|
409
|
+
test('popover closes on input blur', function () {
|
410
|
+
getComponent();
|
411
|
+
expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
|
412
|
+
expect(screen.queryByRole('option')).not.toBeInTheDocument();
|
413
|
+
var input = screen.getByRole('combobox');
|
414
|
+
userEvent.click(input);
|
415
|
+
expect(screen.queryByRole('listbox')).toBeInTheDocument();
|
416
|
+
expect(screen.queryAllByRole('option')).toHaveLength(3);
|
417
|
+
expect(screen.queryByRole('option', {
|
418
|
+
name: 'Aardvark'
|
419
|
+
})).toBeInTheDocument();
|
420
|
+
userEvent.click(document.body);
|
421
|
+
expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
|
422
|
+
expect(screen.queryByRole('option')).not.toBeInTheDocument();
|
397
423
|
});
|
@@ -96,7 +96,7 @@ export var PopoverWrapper = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
96
96
|
});
|
97
97
|
|
98
98
|
var _useOverlay = useOverlay(_objectSpread(_objectSpread({}, props), {}, {
|
99
|
-
|
99
|
+
shouldCloseOnBlur: !isNotClosedOnBlur
|
100
100
|
}), popoverRef),
|
101
101
|
overlayProps = _useOverlay.overlayProps;
|
102
102
|
|
@@ -391,4 +391,19 @@ test('should have no accessibility violations', /*#__PURE__*/_asyncToGenerator(
|
|
391
391
|
}
|
392
392
|
}
|
393
393
|
}, _callee);
|
394
|
-
})));
|
394
|
+
})));
|
395
|
+
test('popover closes on button blur', function () {
|
396
|
+
getComponent();
|
397
|
+
expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
|
398
|
+
expect(screen.queryByRole('option')).not.toBeInTheDocument();
|
399
|
+
var button = screen.getByRole('button');
|
400
|
+
userEvent.click(button);
|
401
|
+
expect(screen.queryByRole('listbox')).toBeInTheDocument();
|
402
|
+
expect(screen.queryAllByRole('option')).toHaveLength(3);
|
403
|
+
expect(screen.queryByRole('option', {
|
404
|
+
name: 'a'
|
405
|
+
})).toBeInTheDocument();
|
406
|
+
userEvent.click(document.body);
|
407
|
+
expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
|
408
|
+
expect(screen.queryByRole('option')).not.toBeInTheDocument();
|
409
|
+
});
|
@@ -201,14 +201,14 @@ var useSelectField = function useSelectField(props, ref) {
|
|
201
201
|
}));
|
202
202
|
|
203
203
|
var overlay = ___EmotionJSX(PopoverContainer, {
|
204
|
-
isOpen: state.isOpen,
|
205
|
-
ref: popoverRef,
|
206
|
-
placement: placement,
|
207
204
|
hasNoArrow: true,
|
208
|
-
|
209
|
-
style: style,
|
205
|
+
isDismissable: true,
|
210
206
|
isNonModal: true,
|
211
|
-
|
207
|
+
isOpen: state.isOpen,
|
208
|
+
onClose: state.close,
|
209
|
+
placement: placement,
|
210
|
+
ref: popoverRef,
|
211
|
+
style: style
|
212
212
|
}, ___EmotionJSX(ScrollBox, scrollBoxProps, listbox));
|
213
213
|
|
214
214
|
return {
|
@@ -136,12 +136,8 @@ var Row = /*#__PURE__*/memo(function (props) {
|
|
136
136
|
sx: sx.comboBoxField
|
137
137
|
},
|
138
138
|
containerProps: {
|
139
|
-
'aria-label': 'selection field',
|
140
139
|
width: '100%',
|
141
|
-
maxWidth: '310px'
|
142
|
-
sx: {
|
143
|
-
width: '100%'
|
144
|
-
}
|
140
|
+
maxWidth: '310px'
|
145
141
|
},
|
146
142
|
inputValue: inputValue,
|
147
143
|
onInputChange: setInputValue
|