@pingux/astro 1.1.0-alpha.1 → 1.1.0-alpha.5
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/AccordionGridItem/AccordionGridItemBody.js +1 -1
- package/lib/cjs/components/AccordionGridItem/AccordionGridItemHeader.js +1 -1
- package/lib/cjs/components/AccordionGroup/AccordionGroup.test.js +6 -3
- package/lib/cjs/components/AccordionItem/AccordionItem.js +1 -2
- package/lib/cjs/components/Button/Button.js +1 -2
- package/lib/cjs/components/Button/Button.stories.js +2 -1
- package/lib/cjs/components/Button/Button.test.js +2 -1
- package/lib/cjs/components/ColorField/ColorField.js +1 -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.js +1 -1
- package/lib/cjs/components/IconButton/IconButton.stories.js +8 -17
- package/lib/cjs/components/IconButton/IconButton.test.js +4 -5
- package/lib/cjs/components/ImageUploadField/ImagePreviewButton.js +2 -1
- package/lib/cjs/components/ListBox/ListBox.js +3 -6
- package/lib/cjs/components/ListBox/ListBox.test.js +2 -0
- package/lib/cjs/components/ListBox/Option.js +6 -0
- package/lib/cjs/components/MultivaluesField/MultivaluesField.js +2 -1
- package/lib/cjs/styles/variants/buttons.js +10 -0
- package/lib/components/AccordionGridItem/AccordionGridItemBody.js +1 -1
- package/lib/components/AccordionGridItem/AccordionGridItemHeader.js +1 -1
- package/lib/components/AccordionGroup/AccordionGroup.test.js +6 -3
- package/lib/components/AccordionItem/AccordionItem.js +2 -3
- package/lib/components/Button/Button.js +2 -3
- package/lib/components/Button/Button.stories.js +2 -1
- package/lib/components/Button/Button.test.js +2 -1
- package/lib/components/ColorField/ColorField.js +1 -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.js +1 -1
- package/lib/components/IconButton/IconButton.stories.js +7 -13
- package/lib/components/IconButton/IconButton.test.js +4 -5
- package/lib/components/ImageUploadField/ImagePreviewButton.js +2 -1
- package/lib/components/ListBox/ListBox.js +3 -5
- package/lib/components/ListBox/ListBox.test.js +2 -0
- package/lib/components/ListBox/Option.js +6 -0
- package/lib/components/MultivaluesField/MultivaluesField.js +2 -1
- 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.5](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.1.0-alpha.4...@pingux/astro@1.1.0-alpha.5) (2022-01-21)
|
7
|
+
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
* [UIP-5030] Components shouldn't have a default aria-label ([8927951](https://gitlab.corp.pingidentity.com/ux/pingux/commit/8927951339ef49faa03f5654d9e8f357b136430a))
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
# [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)
|
18
|
+
|
19
|
+
|
20
|
+
### Bug Fixes
|
21
|
+
|
22
|
+
* [UIP-4992] Fix SelectField Warnings ([dab3f92](https://gitlab.corp.pingidentity.com/ux/pingux/commit/dab3f9254c5d7b1b124ed24616e4ef68f53af7d0))
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
# [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)
|
29
|
+
|
30
|
+
|
31
|
+
### Bug Fixes
|
32
|
+
|
33
|
+
* [UIP-5007] ComboBoxField controlled custom input throws an exception ([9651c98](https://gitlab.corp.pingidentity.com/ux/pingux/commit/9651c98da3b3ac158c84f378303a2d331db78cce))
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
# [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)
|
40
|
+
|
41
|
+
|
42
|
+
### Bug Fixes
|
43
|
+
|
44
|
+
* [UIP-5039] IconButton Square Variant ([2fecfac](https://gitlab.corp.pingidentity.com/ux/pingux/commit/2fecfac9d39974eb5dc773d210c3a830d1bd9e2a))
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
|
6
50
|
# [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)
|
7
51
|
|
8
52
|
|
@@ -77,7 +77,7 @@ var AccordionGridItemBody = /*#__PURE__*/(0, _react.forwardRef)(function (props,
|
|
77
77
|
}, mergedProps, {
|
78
78
|
isSelected: isSelected,
|
79
79
|
className: classNames,
|
80
|
-
"aria-label": ariaLabel
|
80
|
+
"aria-label": ariaLabel
|
81
81
|
}), children);
|
82
82
|
});
|
83
83
|
AccordionGridItemBody.propTypes = {
|
@@ -106,7 +106,7 @@ var AccordionGridItemHeader = /*#__PURE__*/(0, _react.forwardRef)(function (prop
|
|
106
106
|
isSelected: isSelected,
|
107
107
|
className: classNames
|
108
108
|
}, others, {
|
109
|
-
"aria-label": ariaLabel
|
109
|
+
"aria-label": ariaLabel
|
110
110
|
}), (0, _react2.jsx)(_Box["default"], {
|
111
111
|
isRow: true
|
112
112
|
}, children, (0, _react2.jsx)(_Box["default"], {
|
@@ -32,15 +32,18 @@ var getComponent = function getComponent() {
|
|
32
32
|
return (0, _testWrapper.render)((0, _react2.jsx)(_AccordionGroup["default"], (0, _extends2["default"])({}, defaultProps, props), (0, _react2.jsx)(_collections.Item, {
|
33
33
|
key: "first",
|
34
34
|
textValue: "Duplicate",
|
35
|
-
"data-id": "first"
|
35
|
+
"data-id": "first",
|
36
|
+
label: "Accordion item"
|
36
37
|
}, (0, _react2.jsx)(_Text["default"], null, "Render me!")), (0, _react2.jsx)(_collections.Item, {
|
37
38
|
key: "second",
|
38
39
|
textValue: "Duplicate",
|
39
|
-
"data-id": "second"
|
40
|
+
"data-id": "second",
|
41
|
+
label: "Accordion item"
|
40
42
|
}, (0, _react2.jsx)(_Text["default"], null, "Render me!")), (0, _react2.jsx)(_collections.Item, {
|
41
43
|
key: "third",
|
42
44
|
textValue: "Duplicate",
|
43
|
-
"data-id": "third"
|
45
|
+
"data-id": "third",
|
46
|
+
label: "Accordion item"
|
44
47
|
}, (0, _react2.jsx)(_Text["default"], null, "Render me!"))));
|
45
48
|
}; // Need to be added to each test file to test accessibility using axe.
|
46
49
|
|
@@ -100,12 +100,11 @@ var AccordionItem = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
100
100
|
buttonClasses = _useStatusClasses2.classNames;
|
101
101
|
|
102
102
|
var ariaLabel = props['aria-label'] || item.props.label;
|
103
|
-
(0, _hooks.useAriaLabelWarning)('AccordionItem', ariaLabel);
|
104
103
|
return (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({
|
105
104
|
variant: "accordion.accordion",
|
106
105
|
className: itemClasses
|
107
106
|
}, others, containerProps), (0, _react2.jsx)(_themeUi.Button, (0, _extends2["default"])({
|
108
|
-
"aria-label": ariaLabel
|
107
|
+
"aria-label": ariaLabel,
|
109
108
|
ref: buttonRef,
|
110
109
|
sx: {
|
111
110
|
display: 'flex',
|
@@ -103,9 +103,8 @@ var Button = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
103
103
|
classNames = _useStatusClasses.classNames;
|
104
104
|
|
105
105
|
var ariaLabel = props['aria-label'];
|
106
|
-
(0, _hooks.useAriaLabelWarning)('Button', ariaLabel);
|
107
106
|
return (0, _react2.jsx)(_themeUi.Button, (0, _extends2["default"])({
|
108
|
-
"aria-label": ariaLabel
|
107
|
+
"aria-label": ariaLabel,
|
109
108
|
ref: buttonRef,
|
110
109
|
className: classNames,
|
111
110
|
role: "button",
|
@@ -93,7 +93,8 @@ exports.TextIconButton = TextIconButton;
|
|
93
93
|
var TextButton = function TextButton() {
|
94
94
|
return (0, _react2.jsx)(_["default"], {
|
95
95
|
mb: "sm",
|
96
|
-
variant: "text"
|
96
|
+
variant: "text",
|
97
|
+
"aria-label": "Add option"
|
97
98
|
}, (0, _react2.jsx)(_Text["default"], {
|
98
99
|
variant: "label",
|
99
100
|
color: "active"
|
@@ -149,6 +149,7 @@ var ColorField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
149
149
|
return (0, _concat["default"])(_context2 = (0, _concat["default"])(_context3 = (0, _concat["default"])(_context4 = "rgba(".concat(colorValue === null || colorValue === void 0 ? void 0 : colorValue.red, ", ")).call(_context4, colorValue === null || colorValue === void 0 ? void 0 : colorValue.green, ", ")).call(_context3, colorValue === null || colorValue === void 0 ? void 0 : colorValue.blue, ", ")).call(_context2, colorValue === null || colorValue === void 0 ? void 0 : colorValue.alpha, ")");
|
150
150
|
}, []);
|
151
151
|
return (0, _react2.jsx)(_index.Box, fieldContainerProps, label && (0, _react2.jsx)(_index.Label, fieldLabelProps), (0, _react2.jsx)(_index.Button, (0, _extends2["default"])({
|
152
|
+
"aria-label": "Select color",
|
152
153
|
bg: getRgbaFromState(state),
|
153
154
|
onPress: handleButtonPress,
|
154
155
|
ref: triggerRef,
|
@@ -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
|
|
@@ -115,7 +115,7 @@ var IconButton = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
115
115
|
tabIndex: 0,
|
116
116
|
ref: buttonRef,
|
117
117
|
className: classNames,
|
118
|
-
"aria-label": ariaLabel
|
118
|
+
"aria-label": ariaLabel,
|
119
119
|
sx: chipBg && isHovered && {
|
120
120
|
'path': {
|
121
121
|
fill: chipBg
|
@@ -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"]
|
@@ -29,7 +29,8 @@ var Icon = function Icon(props) {
|
|
29
29
|
var testId = 'test-button';
|
30
30
|
var defaultProps = {
|
31
31
|
'data-testid': testId,
|
32
|
-
icon: Icon
|
32
|
+
icon: Icon,
|
33
|
+
'aria-label': 'Create'
|
33
34
|
};
|
34
35
|
|
35
36
|
var getComponent = function getComponent() {
|
@@ -162,10 +163,8 @@ test('tooltip is not shown on hover or focus when prop is not passed', function
|
|
162
163
|
expect(_testWrapper.screen.queryByRole('tooltip')).not.toBeInTheDocument();
|
163
164
|
});
|
164
165
|
test('the button should be getting aria label attribute', function () {
|
165
|
-
var testLabel = '
|
166
|
-
getComponent(
|
167
|
-
'aria-label': testLabel
|
168
|
-
});
|
166
|
+
var testLabel = defaultProps['aria-label'];
|
167
|
+
getComponent();
|
169
168
|
expect(_testWrapper.screen.getByLabelText(testLabel)).toBeInTheDocument();
|
170
169
|
});
|
171
170
|
test('show button isDisabled status', function () {
|
@@ -113,7 +113,8 @@ var ImagePreviewButton = /*#__PURE__*/(0, _react.forwardRef)(function (props, re
|
|
113
113
|
ref: buttonRef,
|
114
114
|
variant: "imageUpload",
|
115
115
|
sx: widthHeightSx,
|
116
|
-
"data-testid": "image-preview-button"
|
116
|
+
"data-testid": "image-preview-button",
|
117
|
+
"aria-label": "Image preview"
|
117
118
|
}, (0, _utils.mergeProps)(focusProps, others)), previewImage && isImageType ? imagePreview : noImagePreview, isLoading && loadingPreview, (isHovered || isFocusVisible) && !isLoading && hoveredPreview));
|
118
119
|
});
|
119
120
|
ImagePreviewButton.propTypes = {
|
@@ -55,8 +55,6 @@ var _ListBoxContext = require("./ListBoxContext");
|
|
55
55
|
|
56
56
|
var _index = require("./index.js");
|
57
57
|
|
58
|
-
var _hooks = require("../../hooks");
|
59
|
-
|
60
58
|
var _isIterable = require("../../utils/devUtils/props/isIterable");
|
61
59
|
|
62
60
|
var _Loader = _interopRequireDefault(require("../Loader"));
|
@@ -120,12 +118,11 @@ var ListBox = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
120
118
|
selectedKeys = props.selectedKeys,
|
121
119
|
selectionMode = props.selectionMode,
|
122
120
|
state = props.state,
|
121
|
+
ariaLabel = props['aria-label'],
|
123
122
|
ariaLabelledby = props['aria-labelledby'],
|
124
123
|
ariaDescribedby = props['aria-describedby'],
|
125
124
|
ariaDetails = props['aria-details'],
|
126
|
-
others = (0, _objectWithoutProperties2["default"])(props, ["defaultSelectedKeys", "disabledKeys", "hasAutoFocus", "hasFocusWrap", "hasNoEmptySelection", "hasVirtualFocus", "id", "isLoading", "isFocusedOnHover", "isSelectedOnPressUp", "isVirtualized", "items", "keyboardDelegate", "label", "onLoadMore", "onScroll", "onSelectionChange", "renderEmptyState", "selectedKeys", "selectionMode", "state", "aria-labelledby", "aria-describedby", "aria-details"]);
|
127
|
-
var ariaLabel = props['aria-label'];
|
128
|
-
(0, _hooks.useAriaLabelWarning)('ListBox', ariaLabel);
|
125
|
+
others = (0, _objectWithoutProperties2["default"])(props, ["defaultSelectedKeys", "disabledKeys", "hasAutoFocus", "hasFocusWrap", "hasNoEmptySelection", "hasVirtualFocus", "id", "isLoading", "isFocusedOnHover", "isSelectedOnPressUp", "isVirtualized", "items", "keyboardDelegate", "label", "onLoadMore", "onScroll", "onSelectionChange", "renderEmptyState", "selectedKeys", "selectionMode", "state", "aria-label", "aria-labelledby", "aria-describedby", "aria-details"]);
|
129
126
|
var focusStrategy = state.focusStrategy; // Object matching React Aria API with all options
|
130
127
|
|
131
128
|
var listBoxOptions = {
|
@@ -149,7 +146,7 @@ var ListBox = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
149
146
|
shouldFocusWrap: hasFocusWrap,
|
150
147
|
shouldSelectOnPressUp: isSelectedOnPressUp,
|
151
148
|
shouldUseVirtualFocus: hasVirtualFocus,
|
152
|
-
'aria-label': ariaLabel
|
149
|
+
'aria-label': ariaLabel,
|
153
150
|
'aria-labelledby': ariaLabelledby,
|
154
151
|
'aria-describedby': ariaDescribedby,
|
155
152
|
'aria-details': ariaDetails
|
@@ -44,11 +44,13 @@ var itemsWithSections = [{
|
|
44
44
|
}];
|
45
45
|
var defaultProps = {
|
46
46
|
'data-testid': testId,
|
47
|
+
'aria-label': 'listbox',
|
47
48
|
'aria-labelledby': 'label',
|
48
49
|
items: items
|
49
50
|
};
|
50
51
|
var defaultWithSectionsProps = {
|
51
52
|
'data-testid': testId,
|
53
|
+
'aria-label': 'listbox',
|
52
54
|
'aria-labelledby': 'label',
|
53
55
|
items: itemsWithSections
|
54
56
|
};
|
@@ -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,
|
@@ -352,7 +352,8 @@ var MultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
352
352
|
hasAutoFocus: hasAutoFocus,
|
353
353
|
hasVirtualFocus: true,
|
354
354
|
hasNoEmptySelection: true,
|
355
|
-
state: state
|
355
|
+
state: state,
|
356
|
+
"aria-label": "List of options"
|
356
357
|
})), (0, _react2.jsx)(_overlays.DismissButton, {
|
357
358
|
onDismiss: close
|
358
359
|
}));
|
@@ -104,6 +104,10 @@ var iconButton = {
|
|
104
104
|
}
|
105
105
|
};
|
106
106
|
|
107
|
+
var square = _objectSpread(_objectSpread({}, iconButton), {}, {
|
108
|
+
borderRadius: '2px'
|
109
|
+
});
|
110
|
+
|
107
111
|
var modalCloseButton = _objectSpread(_objectSpread({}, iconButton), {}, {
|
108
112
|
position: 'absolute',
|
109
113
|
top: 14,
|
@@ -241,6 +245,10 @@ var inverted = _objectSpread(_objectSpread({}, iconButton), {}, {
|
|
241
245
|
}
|
242
246
|
});
|
243
247
|
|
248
|
+
var invertedSquare = _objectSpread(_objectSpread({}, inverted), {}, {
|
249
|
+
borderRadius: '2px'
|
250
|
+
});
|
251
|
+
|
244
252
|
var applicationPortal = _objectSpread(_objectSpread({}, iconButton), {}, {
|
245
253
|
background: 'transparent',
|
246
254
|
'&.is-focused': _objectSpread({}, defaultFocus),
|
@@ -532,6 +540,8 @@ var _default = {
|
|
532
540
|
modalCloseButton: modalCloseButton,
|
533
541
|
applicationPortalPinned: applicationPortalPinned,
|
534
542
|
applicationPortal: applicationPortal,
|
543
|
+
square: square,
|
544
|
+
invertedSquare: invertedSquare,
|
535
545
|
tooltipChip: tooltipChip,
|
536
546
|
tooltipIconButton: tooltipIconButton,
|
537
547
|
tooltipInline: tooltipInline
|
@@ -52,7 +52,7 @@ var AccordionGridItemBody = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
52
52
|
}, mergedProps, {
|
53
53
|
isSelected: isSelected,
|
54
54
|
className: classNames,
|
55
|
-
"aria-label": ariaLabel
|
55
|
+
"aria-label": ariaLabel
|
56
56
|
}), children);
|
57
57
|
});
|
58
58
|
AccordionGridItemBody.propTypes = {
|
@@ -76,7 +76,7 @@ var AccordionGridItemHeader = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
76
76
|
isSelected: isSelected,
|
77
77
|
className: classNames
|
78
78
|
}, others, {
|
79
|
-
"aria-label": ariaLabel
|
79
|
+
"aria-label": ariaLabel
|
80
80
|
}), ___EmotionJSX(Box, {
|
81
81
|
isRow: true
|
82
82
|
}, children, ___EmotionJSX(Box, {
|
@@ -18,15 +18,18 @@ var getComponent = function getComponent() {
|
|
18
18
|
return render(___EmotionJSX(AccordionGroup, _extends({}, defaultProps, props), ___EmotionJSX(Item, {
|
19
19
|
key: "first",
|
20
20
|
textValue: "Duplicate",
|
21
|
-
"data-id": "first"
|
21
|
+
"data-id": "first",
|
22
|
+
label: "Accordion item"
|
22
23
|
}, ___EmotionJSX(Text, null, "Render me!")), ___EmotionJSX(Item, {
|
23
24
|
key: "second",
|
24
25
|
textValue: "Duplicate",
|
25
|
-
"data-id": "second"
|
26
|
+
"data-id": "second",
|
27
|
+
label: "Accordion item"
|
26
28
|
}, ___EmotionJSX(Text, null, "Render me!")), ___EmotionJSX(Item, {
|
27
29
|
key: "third",
|
28
30
|
textValue: "Duplicate",
|
29
|
-
"data-id": "third"
|
31
|
+
"data-id": "third",
|
32
|
+
label: "Accordion item"
|
30
33
|
}, ___EmotionJSX(Text, null, "Render me!"))));
|
31
34
|
}; // Need to be added to each test file to test accessibility using axe.
|
32
35
|
|
@@ -11,7 +11,7 @@ import { useAccordionItem } from '@react-aria/accordion';
|
|
11
11
|
import { useButton } from '@react-aria/button';
|
12
12
|
import { useFocusRing } from '@react-aria/focus';
|
13
13
|
import { Text, Icon, Box } from '../../index';
|
14
|
-
import {
|
14
|
+
import { useStatusClasses } from '../../hooks';
|
15
15
|
import { AccordionContext } from '../../context/AccordionContext';
|
16
16
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
17
17
|
var AccordionItem = /*#__PURE__*/forwardRef(function (props, ref) {
|
@@ -72,12 +72,11 @@ var AccordionItem = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
72
72
|
buttonClasses = _useStatusClasses2.classNames;
|
73
73
|
|
74
74
|
var ariaLabel = props['aria-label'] || item.props.label;
|
75
|
-
useAriaLabelWarning('AccordionItem', ariaLabel);
|
76
75
|
return ___EmotionJSX(Box, _extends({
|
77
76
|
variant: "accordion.accordion",
|
78
77
|
className: itemClasses
|
79
78
|
}, others, containerProps), ___EmotionJSX(ThemeUIButton, _extends({
|
80
|
-
"aria-label": ariaLabel
|
79
|
+
"aria-label": ariaLabel,
|
81
80
|
ref: buttonRef,
|
82
81
|
sx: {
|
83
82
|
display: 'flex',
|
@@ -21,7 +21,7 @@ import { useButton } from '@react-aria/button';
|
|
21
21
|
import { useHover } from '@react-aria/interactions';
|
22
22
|
import { useFocusRing } from '@react-aria/focus';
|
23
23
|
import { mergeProps } from '@react-aria/utils';
|
24
|
-
import {
|
24
|
+
import { useStatusClasses, usePropWarning } from '../../hooks';
|
25
25
|
import Loader from '../Loader';
|
26
26
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
27
27
|
var Button = /*#__PURE__*/forwardRef(function (props, ref) {
|
@@ -70,9 +70,8 @@ var Button = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
70
70
|
classNames = _useStatusClasses.classNames;
|
71
71
|
|
72
72
|
var ariaLabel = props['aria-label'];
|
73
|
-
useAriaLabelWarning('Button', ariaLabel);
|
74
73
|
return ___EmotionJSX(ThemeUIButton, _extends({
|
75
|
-
"aria-label": ariaLabel
|
74
|
+
"aria-label": ariaLabel,
|
76
75
|
ref: buttonRef,
|
77
76
|
className: classNames,
|
78
77
|
role: "button",
|
@@ -62,7 +62,8 @@ export var TextIconButton = function TextIconButton() {
|
|
62
62
|
export var TextButton = function TextButton() {
|
63
63
|
return ___EmotionJSX(Button, {
|
64
64
|
mb: "sm",
|
65
|
-
variant: "text"
|
65
|
+
variant: "text",
|
66
|
+
"aria-label": "Add option"
|
66
67
|
}, ___EmotionJSX(Text, {
|
67
68
|
variant: "label",
|
68
69
|
color: "active"
|
@@ -7,7 +7,8 @@ import Button from '.';
|
|
7
7
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
8
8
|
var testId = 'test-button';
|
9
9
|
var defaultProps = {
|
10
|
-
'data-testid': testId
|
10
|
+
'data-testid': testId,
|
11
|
+
'aria-label': 'Test button'
|
11
12
|
};
|
12
13
|
|
13
14
|
var getComponent = function getComponent() {
|
@@ -108,6 +108,7 @@ var ColorField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
108
108
|
return _concatInstanceProperty(_context2 = _concatInstanceProperty(_context3 = _concatInstanceProperty(_context4 = "rgba(".concat(colorValue === null || colorValue === void 0 ? void 0 : colorValue.red, ", ")).call(_context4, colorValue === null || colorValue === void 0 ? void 0 : colorValue.green, ", ")).call(_context3, colorValue === null || colorValue === void 0 ? void 0 : colorValue.blue, ", ")).call(_context2, colorValue === null || colorValue === void 0 ? void 0 : colorValue.alpha, ")");
|
109
109
|
}, []);
|
110
110
|
return ___EmotionJSX(Box, fieldContainerProps, label && ___EmotionJSX(Label, fieldLabelProps), ___EmotionJSX(Button, _extends({
|
111
|
+
"aria-label": "Select color",
|
111
112
|
bg: getRgbaFromState(state),
|
112
113
|
onPress: handleButtonPress,
|
113
114
|
ref: triggerRef,
|
@@ -116,6 +116,12 @@ var ComboBoxField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
116
116
|
useImperativeHandle(ref, function () {
|
117
117
|
return inputRef.current;
|
118
118
|
});
|
119
|
+
/* istanbul ignore next */
|
120
|
+
|
121
|
+
var onSelectionChangeHandler = function onSelectionChangeHandler(key) {
|
122
|
+
var newVal = key || selectedKey || '';
|
123
|
+
if (onSelectionChange) onSelectionChange(newVal);
|
124
|
+
};
|
119
125
|
|
120
126
|
var _useFilter = useFilter({
|
121
127
|
sensitivity: 'base'
|
@@ -123,6 +129,7 @@ var ComboBoxField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
123
129
|
contains = _useFilter.contains;
|
124
130
|
|
125
131
|
var state = useComboBoxState(_objectSpread(_objectSpread({}, comboBoxOptions), {}, {
|
132
|
+
onSelectionChange: hasCustomValue ? onSelectionChangeHandler : onSelectionChange,
|
126
133
|
defaultFilter: contains
|
127
134
|
}));
|
128
135
|
|
@@ -330,6 +330,27 @@ export var ControlledFiltering = function ControlledFiltering() {
|
|
330
330
|
}, item.name);
|
331
331
|
}));
|
332
332
|
};
|
333
|
+
export var ControlledWithCustomValue = function ControlledWithCustomValue() {
|
334
|
+
var _useState9 = useState(''),
|
335
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
336
|
+
inputValue = _useState10[0],
|
337
|
+
setInputValue = _useState10[1];
|
338
|
+
|
339
|
+
return ___EmotionJSX(OverlayProvider, null, ___EmotionJSX(ComboBoxField, _extends({
|
340
|
+
label: "Example label",
|
341
|
+
defaultItems: items
|
342
|
+
}, actions, {
|
343
|
+
inputValue: inputValue,
|
344
|
+
selectedKey: inputValue,
|
345
|
+
onInputChange: setInputValue,
|
346
|
+
onSelectionChange: setInputValue,
|
347
|
+
hasCustomValue: true
|
348
|
+
}), function (item) {
|
349
|
+
return ___EmotionJSX(Item, {
|
350
|
+
key: item.name
|
351
|
+
}, item.name);
|
352
|
+
}));
|
353
|
+
};
|
333
354
|
export var AllowCustomValue = function AllowCustomValue() {
|
334
355
|
return ___EmotionJSX(OverlayProvider, null, ___EmotionJSX(ComboBoxField, _extends({
|
335
356
|
label: "Example label",
|
@@ -639,6 +639,41 @@ test('two listbox can not be open at the same time', function () {
|
|
639
639
|
name: 'Tango'
|
640
640
|
})).toBeInTheDocument();
|
641
641
|
});
|
642
|
+
test('should handle selecting custom option', function () {
|
643
|
+
getComponent({
|
644
|
+
hasCustomValue: true
|
645
|
+
});
|
646
|
+
var input = screen.queryByRole('combobox');
|
647
|
+
expect(input).toHaveValue(''); // type something
|
648
|
+
|
649
|
+
userEvent.type(input, 'custom'); // set input value as selected
|
650
|
+
|
651
|
+
userEvent.type(input, '{enter}', {
|
652
|
+
skipClick: true
|
653
|
+
});
|
654
|
+
expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
|
655
|
+
expect(screen.queryByRole('combobox')).toHaveValue('custom'); // blur input
|
656
|
+
|
657
|
+
userEvent.tab();
|
658
|
+
expect(input).toHaveValue('custom');
|
659
|
+
});
|
660
|
+
test('onSelectionChange works properly with custom value', function () {
|
661
|
+
var onSelectionChange = jest.fn();
|
662
|
+
getComponent({
|
663
|
+
hasCustomValue: true,
|
664
|
+
onSelectionChange: onSelectionChange,
|
665
|
+
onInputChange: onSelectionChange
|
666
|
+
});
|
667
|
+
var input = screen.queryByRole('combobox');
|
668
|
+
expect(input).toHaveValue('');
|
669
|
+
expect(onSelectionChange).not.toHaveBeenCalled(); // Should fire when input value was typed, and enter was pressed
|
670
|
+
|
671
|
+
userEvent.type(input, 'custom{enter}');
|
672
|
+
expect(onSelectionChange).toHaveBeenCalledWith('custom'); // Should fire when input is cleared
|
673
|
+
|
674
|
+
userEvent.type(input, '{selectall}{backspace}{enter}');
|
675
|
+
expect(onSelectionChange).toHaveBeenCalledWith('');
|
676
|
+
});
|
642
677
|
test('should have no accessibility violations', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
643
678
|
var _getComponent6, container, results;
|
644
679
|
|
@@ -35,29 +35,23 @@ export default {
|
|
35
35
|
isDisabled: {},
|
36
36
|
variant: {
|
37
37
|
control: {
|
38
|
-
type: '
|
39
|
-
|
38
|
+
type: 'select',
|
39
|
+
options: ['iconButton', 'inverted', 'square', 'invertedSquare']
|
40
|
+
},
|
41
|
+
defaultValue: 'iconButton'
|
40
42
|
}
|
41
43
|
}
|
42
44
|
};
|
43
45
|
export var Default = function Default(args) {
|
44
46
|
return ___EmotionJSX(IconButton, _extends({
|
45
|
-
"aria-label": "
|
47
|
+
"aria-label": "default icon button"
|
46
48
|
}, args), ___EmotionJSX(Icon, {
|
47
49
|
icon: CreateIcon
|
48
50
|
}));
|
49
51
|
};
|
50
|
-
export var Inverted = function Inverted() {
|
51
|
-
return ___EmotionJSX(IconButton, {
|
52
|
-
"aria-label": "my-label",
|
53
|
-
variant: "inverted"
|
54
|
-
}, ___EmotionJSX(Icon, {
|
55
|
-
icon: CreateIcon
|
56
|
-
}));
|
57
|
-
};
|
58
52
|
export var WithTooltip = function WithTooltip() {
|
59
53
|
return ___EmotionJSX(IconButton, {
|
60
|
-
"aria-label": "
|
54
|
+
"aria-label": "icon button with tooltip",
|
61
55
|
title: "Edit"
|
62
56
|
}, ___EmotionJSX(Icon, {
|
63
57
|
icon: CreateIcon
|
@@ -65,7 +59,7 @@ export var WithTooltip = function WithTooltip() {
|
|
65
59
|
};
|
66
60
|
export var Disabled = function Disabled() {
|
67
61
|
return ___EmotionJSX(IconButton, {
|
68
|
-
"aria-label": "
|
62
|
+
"aria-label": "disabled icon button",
|
69
63
|
isDisabled: true
|
70
64
|
}, ___EmotionJSX(Icon, {
|
71
65
|
icon: CreateIcon
|
@@ -17,7 +17,8 @@ var Icon = function Icon(props) {
|
|
17
17
|
var testId = 'test-button';
|
18
18
|
var defaultProps = {
|
19
19
|
'data-testid': testId,
|
20
|
-
icon: Icon
|
20
|
+
icon: Icon,
|
21
|
+
'aria-label': 'Create'
|
21
22
|
};
|
22
23
|
|
23
24
|
var getComponent = function getComponent() {
|
@@ -115,10 +116,8 @@ test('tooltip is not shown on hover or focus when prop is not passed', function
|
|
115
116
|
expect(screen.queryByRole('tooltip')).not.toBeInTheDocument();
|
116
117
|
});
|
117
118
|
test('the button should be getting aria label attribute', function () {
|
118
|
-
var testLabel = '
|
119
|
-
getComponent(
|
120
|
-
'aria-label': testLabel
|
121
|
-
});
|
119
|
+
var testLabel = defaultProps['aria-label'];
|
120
|
+
getComponent();
|
122
121
|
expect(screen.getByLabelText(testLabel)).toBeInTheDocument();
|
123
122
|
});
|
124
123
|
test('show button isDisabled status', function () {
|
@@ -92,7 +92,8 @@ var ImagePreviewButton = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
92
92
|
ref: buttonRef,
|
93
93
|
variant: "imageUpload",
|
94
94
|
sx: widthHeightSx,
|
95
|
-
"data-testid": "image-preview-button"
|
95
|
+
"data-testid": "image-preview-button",
|
96
|
+
"aria-label": "Image preview"
|
96
97
|
}, mergeProps(focusProps, others)), previewImage && isImageType ? imagePreview : noImagePreview, isLoading && loadingPreview, (isHovered || isFocusVisible) && !isLoading && hoveredPreview));
|
97
98
|
});
|
98
99
|
ImagePreviewButton.propTypes = {
|
@@ -24,7 +24,6 @@ import { useCollator } from '@react-aria/i18n';
|
|
24
24
|
import { ListLayout } from '@react-stately/layout';
|
25
25
|
import { ListBoxContext } from './ListBoxContext';
|
26
26
|
import { Option } from './index.js';
|
27
|
-
import { useAriaLabelWarning } from '../../hooks';
|
28
27
|
import { isIterableProp } from '../../utils/devUtils/props/isIterable';
|
29
28
|
import Loader from '../Loader';
|
30
29
|
import ListBoxSection from './ListBoxSection';
|
@@ -77,13 +76,12 @@ var ListBox = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
77
76
|
selectedKeys = props.selectedKeys,
|
78
77
|
selectionMode = props.selectionMode,
|
79
78
|
state = props.state,
|
79
|
+
ariaLabel = props['aria-label'],
|
80
80
|
ariaLabelledby = props['aria-labelledby'],
|
81
81
|
ariaDescribedby = props['aria-describedby'],
|
82
82
|
ariaDetails = props['aria-details'],
|
83
|
-
others = _objectWithoutProperties(props, ["defaultSelectedKeys", "disabledKeys", "hasAutoFocus", "hasFocusWrap", "hasNoEmptySelection", "hasVirtualFocus", "id", "isLoading", "isFocusedOnHover", "isSelectedOnPressUp", "isVirtualized", "items", "keyboardDelegate", "label", "onLoadMore", "onScroll", "onSelectionChange", "renderEmptyState", "selectedKeys", "selectionMode", "state", "aria-labelledby", "aria-describedby", "aria-details"]);
|
83
|
+
others = _objectWithoutProperties(props, ["defaultSelectedKeys", "disabledKeys", "hasAutoFocus", "hasFocusWrap", "hasNoEmptySelection", "hasVirtualFocus", "id", "isLoading", "isFocusedOnHover", "isSelectedOnPressUp", "isVirtualized", "items", "keyboardDelegate", "label", "onLoadMore", "onScroll", "onSelectionChange", "renderEmptyState", "selectedKeys", "selectionMode", "state", "aria-label", "aria-labelledby", "aria-describedby", "aria-details"]);
|
84
84
|
|
85
|
-
var ariaLabel = props['aria-label'];
|
86
|
-
useAriaLabelWarning('ListBox', ariaLabel);
|
87
85
|
var focusStrategy = state.focusStrategy; // Object matching React Aria API with all options
|
88
86
|
|
89
87
|
var listBoxOptions = {
|
@@ -107,7 +105,7 @@ var ListBox = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
107
105
|
shouldFocusWrap: hasFocusWrap,
|
108
106
|
shouldSelectOnPressUp: isSelectedOnPressUp,
|
109
107
|
shouldUseVirtualFocus: hasVirtualFocus,
|
110
|
-
'aria-label': ariaLabel
|
108
|
+
'aria-label': ariaLabel,
|
111
109
|
'aria-labelledby': ariaLabelledby,
|
112
110
|
'aria-describedby': ariaDescribedby,
|
113
111
|
'aria-details': ariaDetails
|
@@ -29,11 +29,13 @@ var itemsWithSections = [{
|
|
29
29
|
}];
|
30
30
|
var defaultProps = {
|
31
31
|
'data-testid': testId,
|
32
|
+
'aria-label': 'listbox',
|
32
33
|
'aria-labelledby': 'label',
|
33
34
|
items: items
|
34
35
|
};
|
35
36
|
var defaultWithSectionsProps = {
|
36
37
|
'data-testid': testId,
|
38
|
+
'aria-label': 'listbox',
|
37
39
|
'aria-labelledby': 'label',
|
38
40
|
items: itemsWithSections
|
39
41
|
};
|
@@ -63,7 +63,13 @@ var Option = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
63
63
|
isSelected: isSelected
|
64
64
|
}),
|
65
65
|
classNames = _useStatusClasses.classNames;
|
66
|
+
/* Related to UIP-4992
|
67
|
+
* Need to remove these properties to avoid errors in the console on the external app.
|
68
|
+
* By the way, these properties return "undefined", so it shouldn't create issues */
|
66
69
|
|
70
|
+
|
71
|
+
delete optionProps.onPressStart;
|
72
|
+
delete optionProps.onPressUp;
|
67
73
|
return ___EmotionJSX(Box, _extends({
|
68
74
|
as: "li",
|
69
75
|
isRow: true,
|
@@ -311,7 +311,8 @@ var MultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
311
311
|
hasAutoFocus: hasAutoFocus,
|
312
312
|
hasVirtualFocus: true,
|
313
313
|
hasNoEmptySelection: true,
|
314
|
-
state: state
|
314
|
+
state: state,
|
315
|
+
"aria-label": "List of options"
|
315
316
|
})), ___EmotionJSX(DismissButton, {
|
316
317
|
onDismiss: close
|
317
318
|
}));
|
@@ -82,6 +82,10 @@ var iconButton = {
|
|
82
82
|
}
|
83
83
|
};
|
84
84
|
|
85
|
+
var square = _objectSpread(_objectSpread({}, iconButton), {}, {
|
86
|
+
borderRadius: '2px'
|
87
|
+
});
|
88
|
+
|
85
89
|
var modalCloseButton = _objectSpread(_objectSpread({}, iconButton), {}, {
|
86
90
|
position: 'absolute',
|
87
91
|
top: 14,
|
@@ -219,6 +223,10 @@ var inverted = _objectSpread(_objectSpread({}, iconButton), {}, {
|
|
219
223
|
}
|
220
224
|
});
|
221
225
|
|
226
|
+
var invertedSquare = _objectSpread(_objectSpread({}, inverted), {}, {
|
227
|
+
borderRadius: '2px'
|
228
|
+
});
|
229
|
+
|
222
230
|
var applicationPortal = _objectSpread(_objectSpread({}, iconButton), {}, {
|
223
231
|
background: 'transparent',
|
224
232
|
'&.is-focused': _objectSpread({}, defaultFocus),
|
@@ -510,6 +518,8 @@ export default {
|
|
510
518
|
modalCloseButton: modalCloseButton,
|
511
519
|
applicationPortalPinned: applicationPortalPinned,
|
512
520
|
applicationPortal: applicationPortal,
|
521
|
+
square: square,
|
522
|
+
invertedSquare: invertedSquare,
|
513
523
|
tooltipChip: tooltipChip,
|
514
524
|
tooltipIconButton: tooltipIconButton,
|
515
525
|
tooltipInline: tooltipInline
|