@pingux/astro 1.1.0-alpha.4 → 1.1.0-alpha.8
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/AccordionGridGroup/AccordionGridGroup.test.js +24 -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 +33 -1
- package/lib/cjs/components/AccordionItem/AccordionItem.js +5 -4
- 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/IconButton/IconButton.js +1 -1
- 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/Messages/Message.js +2 -2
- package/lib/cjs/components/MultivaluesField/MultivaluesField.js +2 -1
- package/lib/cjs/components/OverlayPanel/OverlayPanel.stories.js +15 -14
- package/lib/cjs/components/PopoverContainer/PopoverContainer.test.js +15 -0
- package/lib/cjs/components/TextArea/TextArea.js +5 -1
- package/lib/cjs/styles/variants/accordion.js +2 -2
- package/lib/components/AccordionGridGroup/AccordionGridGroup.test.js +23 -1
- package/lib/components/AccordionGridItem/AccordionGridItemBody.js +1 -1
- package/lib/components/AccordionGridItem/AccordionGridItemHeader.js +1 -1
- package/lib/components/AccordionGroup/AccordionGroup.test.js +30 -1
- package/lib/components/AccordionItem/AccordionItem.js +6 -5
- 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/IconButton/IconButton.js +1 -1
- 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/Messages/Message.js +2 -2
- package/lib/components/MultivaluesField/MultivaluesField.js +2 -1
- package/lib/components/OverlayPanel/OverlayPanel.stories.js +7 -5
- package/lib/components/PopoverContainer/PopoverContainer.test.js +16 -1
- package/lib/components/TextArea/TextArea.js +5 -1
- package/lib/styles/variants/accordion.js +2 -2
- 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.8](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.1.0-alpha.7...@pingux/astro@1.1.0-alpha.8) (2022-01-24)
|
7
|
+
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
* [UIP-4995] TextArea Safari resize issue ([33c8af3](https://gitlab.corp.pingidentity.com/ux/pingux/commit/33c8af35fbe82820427b87bdd9ab0744039a6c18))
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
# [1.1.0-alpha.7](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.1.0-alpha.6...@pingux/astro@1.1.0-alpha.7) (2022-01-21)
|
18
|
+
|
19
|
+
|
20
|
+
### Bug Fixes
|
21
|
+
|
22
|
+
* [UIP-5109] AccordionGroup OverlayPanel Compatibility Fix ([6a78b76](https://gitlab.corp.pingidentity.com/ux/pingux/commit/6a78b76a3c3ab7b9ac78a7dcd6ca74a6449d63c2))
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
# [1.1.0-alpha.6](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.1.0-alpha.5...@pingux/astro@1.1.0-alpha.6) (2022-01-21)
|
29
|
+
|
30
|
+
|
31
|
+
### Bug Fixes
|
32
|
+
|
33
|
+
* [UIP-5070] Icons for warning and error messages are reversed ([36f0d6e](https://gitlab.corp.pingidentity.com/ux/pingux/commit/36f0d6e1b65662b3c64aa1599012a2967b59e56d))
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
# [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)
|
40
|
+
|
41
|
+
|
42
|
+
### Bug Fixes
|
43
|
+
|
44
|
+
* [UIP-5030] Components shouldn't have a default aria-label ([8927951](https://gitlab.corp.pingidentity.com/ux/pingux/commit/8927951339ef49faa03f5654d9e8f357b136430a))
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
|
6
50
|
# [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
51
|
|
8
52
|
|
@@ -39,6 +39,22 @@ var getComponent = function getComponent() {
|
|
39
39
|
}, (0, _react2.jsx)(_index.Box, null, (0, _react2.jsx)(_index.Link, null, "Header Button"), (0, _react2.jsx)(_index.Link, null, "Second Header Button")), (0, _react2.jsx)(_index.Box, null, (0, _react2.jsx)(_index.Link, null, "Body Button"), (0, _react2.jsx)(_index.Link, null, "Second Body Button")))));
|
40
40
|
};
|
41
41
|
|
42
|
+
var getComponentInOverlayPanel = function getComponentInOverlayPanel() {
|
43
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
44
|
+
return (0, _testWrapper.render)((0, _react2.jsx)(_index.OverlayPanel, {
|
45
|
+
isOpen: true
|
46
|
+
}, (0, _react2.jsx)(_AccordionGridGroup["default"], (0, _extends2["default"])({}, defaultProps, props), (0, _react2.jsx)(_collections.Item, {
|
47
|
+
key: "first",
|
48
|
+
textValue: "Duplicate"
|
49
|
+
}, (0, _react2.jsx)(_index.Box, null, (0, _react2.jsx)(_index.Link, null, "Header Button"), (0, _react2.jsx)(_index.Link, null, "Second Header Button")), (0, _react2.jsx)(_index.Box, null, (0, _react2.jsx)(_index.Link, null, "Body Button"), (0, _react2.jsx)(_index.Link, null, "Second Body Button"))), (0, _react2.jsx)(_collections.Item, {
|
50
|
+
key: "second",
|
51
|
+
textValue: "Duplicate"
|
52
|
+
}, (0, _react2.jsx)(_index.Box, null, (0, _react2.jsx)(_index.Link, null, "Header Button"), (0, _react2.jsx)(_index.Link, null, "Second Header Button")), (0, _react2.jsx)(_index.Box, null, (0, _react2.jsx)(_index.Link, null, "Body Button"), (0, _react2.jsx)(_index.Link, null, "Second Body Button"))), (0, _react2.jsx)(_collections.Item, {
|
53
|
+
key: "third",
|
54
|
+
textValue: "Duplicate"
|
55
|
+
}, (0, _react2.jsx)(_index.Box, null, (0, _react2.jsx)(_index.Link, null, "Header Button"), (0, _react2.jsx)(_index.Link, null, "Second Header Button")), (0, _react2.jsx)(_index.Box, null, (0, _react2.jsx)(_index.Link, null, "Body Button"), (0, _react2.jsx)(_index.Link, null, "Second Body Button"))))));
|
56
|
+
};
|
57
|
+
|
42
58
|
(0, _testAxe["default"])(getComponent, {
|
43
59
|
// landmark-unique rule conflicts with react-aria role definition
|
44
60
|
rules: {
|
@@ -230,4 +246,12 @@ test('default expanded keys expands an accordion item', function () {
|
|
230
246
|
|
231
247
|
var selectedRow = row[0];
|
232
248
|
expect(selectedRow).toHaveAttribute('aria-selected', 'true');
|
249
|
+
});
|
250
|
+
test('items do not automatically expand if wrapped in an open OverlayPanel', function () {
|
251
|
+
getComponentInOverlayPanel();
|
252
|
+
|
253
|
+
var row = _testWrapper.screen.getAllByRole('row');
|
254
|
+
|
255
|
+
var selectedRow = row[0];
|
256
|
+
expect(selectedRow).not.toHaveAttribute('aria-selected', 'true');
|
233
257
|
});
|
@@ -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"], {
|
@@ -20,6 +20,8 @@ var _Text = _interopRequireDefault(require("../Text"));
|
|
20
20
|
|
21
21
|
var _AccordionGroup = _interopRequireDefault(require("../AccordionGroup"));
|
22
22
|
|
23
|
+
var _index = require("../../index");
|
24
|
+
|
23
25
|
var _react2 = require("@emotion/react");
|
24
26
|
|
25
27
|
var testId = 'test-accordion';
|
@@ -30,6 +32,28 @@ var defaultProps = {
|
|
30
32
|
var getComponent = function getComponent() {
|
31
33
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
32
34
|
return (0, _testWrapper.render)((0, _react2.jsx)(_AccordionGroup["default"], (0, _extends2["default"])({}, defaultProps, props), (0, _react2.jsx)(_collections.Item, {
|
35
|
+
key: "first",
|
36
|
+
textValue: "Duplicate",
|
37
|
+
"data-id": "first",
|
38
|
+
label: "Accordion item"
|
39
|
+
}, (0, _react2.jsx)(_Text["default"], null, "Render me!")), (0, _react2.jsx)(_collections.Item, {
|
40
|
+
key: "second",
|
41
|
+
textValue: "Duplicate",
|
42
|
+
"data-id": "second",
|
43
|
+
label: "Accordion item"
|
44
|
+
}, (0, _react2.jsx)(_Text["default"], null, "Render me!")), (0, _react2.jsx)(_collections.Item, {
|
45
|
+
key: "third",
|
46
|
+
textValue: "Duplicate",
|
47
|
+
"data-id": "third",
|
48
|
+
label: "Accordion item"
|
49
|
+
}, (0, _react2.jsx)(_Text["default"], null, "Render me!"))));
|
50
|
+
};
|
51
|
+
|
52
|
+
var getComponentInOverlayPanel = function getComponentInOverlayPanel() {
|
53
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
54
|
+
return (0, _testWrapper.render)((0, _react2.jsx)(_index.OverlayPanel, {
|
55
|
+
isOpen: true
|
56
|
+
}, (0, _react2.jsx)(_AccordionGroup["default"], (0, _extends2["default"])({}, defaultProps, props), (0, _react2.jsx)(_collections.Item, {
|
33
57
|
key: "first",
|
34
58
|
textValue: "Duplicate",
|
35
59
|
"data-id": "first"
|
@@ -41,7 +65,7 @@ var getComponent = function getComponent() {
|
|
41
65
|
key: "third",
|
42
66
|
textValue: "Duplicate",
|
43
67
|
"data-id": "third"
|
44
|
-
}, (0, _react2.jsx)(_Text["default"], null, "Render me!"))));
|
68
|
+
}, (0, _react2.jsx)(_Text["default"], null, "Render me!")))));
|
45
69
|
}; // Need to be added to each test file to test accessibility using axe.
|
46
70
|
|
47
71
|
|
@@ -264,4 +288,12 @@ test('Item accepts a data-id and the data-id can be found in the DOM', function
|
|
264
288
|
var selectedItem = buttons[0];
|
265
289
|
var parentElement = selectedItem.parentElement;
|
266
290
|
expect(parentElement).toHaveAttribute('data-id', 'first');
|
291
|
+
});
|
292
|
+
test('items do not automatically expand if wrapped in an open OverlayPanel', function () {
|
293
|
+
getComponentInOverlayPanel();
|
294
|
+
|
295
|
+
var buttons = _testWrapper.screen.getAllByRole('button');
|
296
|
+
|
297
|
+
var selectedItem = buttons[0];
|
298
|
+
expect(selectedItem).not.toHaveAttribute('aria-expanded', 'true');
|
267
299
|
});
|
@@ -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',
|
@@ -122,9 +121,11 @@ var AccordionItem = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
122
121
|
ml: "5px"
|
123
122
|
}, (0, _react2.jsx)(_index.Icon, {
|
124
123
|
icon: isOpen ? _MenuUpIcon["default"] : _MenuDownIcon["default"]
|
125
|
-
}))), (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({
|
124
|
+
}))), isOpen && (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({
|
126
125
|
variant: "accordion.accordionBody"
|
127
|
-
}, accordionRegionProps, regionProps
|
126
|
+
}, accordionRegionProps, regionProps, {
|
127
|
+
className: itemClasses
|
128
|
+
}), item.rendered));
|
128
129
|
});
|
129
130
|
AccordionItem.propTypes = {
|
130
131
|
'aria-label': _propTypes["default"].string,
|
@@ -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,
|
@@ -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
|
@@ -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
|
};
|
@@ -53,8 +53,8 @@ var _react2 = require("@emotion/react");
|
|
53
53
|
var icons = {
|
54
54
|
"default": _AlertCircleOutlineIcon["default"],
|
55
55
|
success: _CheckCircleIcon["default"],
|
56
|
-
error:
|
57
|
-
warning:
|
56
|
+
error: _AlertCircleIcon["default"],
|
57
|
+
warning: _AlertCircleOutlineIcon["default"]
|
58
58
|
};
|
59
59
|
exports.icons = icons;
|
60
60
|
|
@@ -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
|
}));
|
@@ -22,8 +22,6 @@ var _collections = require("@react-stately/collections");
|
|
22
22
|
|
23
23
|
var _hooks = require("../../hooks");
|
24
24
|
|
25
|
-
var _Button = _interopRequireDefault(require("../Button/Button"));
|
26
|
-
|
27
25
|
var _OverlayPanel = _interopRequireDefault(require("./OverlayPanel"));
|
28
26
|
|
29
27
|
var _index = require("../../index");
|
@@ -66,15 +64,18 @@ var Default = function Default(_ref) {
|
|
66
64
|
var state = (0, _hooks.useOverlayPanelState)();
|
67
65
|
return (// Application must be wrapped in an OverlayProvider so that it can be hidden from screen
|
68
66
|
// readers when an overlay opens.
|
69
|
-
(0, _react2.jsx)(_index.OverlayProvider, null, (0, _react2.jsx)(_index.Text, null, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur."), (0, _react2.jsx)("br", null), (0, _react2.jsx)(
|
67
|
+
(0, _react2.jsx)(_index.OverlayProvider, null, (0, _react2.jsx)(_index.Text, null, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur."), (0, _react2.jsx)("br", null), (0, _react2.jsx)(_index.Button, {
|
70
68
|
onPress: state.open
|
71
69
|
}, "Open Panel"), (0, _react2.jsx)(_OverlayPanel["default"], (0, _extends2["default"])({
|
72
70
|
isOpen: state.isOpen
|
73
|
-
}, args), (0, _react2.jsx)(_index.Box, null, (0, _react2.jsx)(
|
71
|
+
}, args), (0, _react2.jsx)(_index.Box, null, (0, _react2.jsx)(_index.Button, {
|
74
72
|
onPress: state.close
|
75
|
-
}, "Close Panel"), (0, _react2.jsx)(_index.
|
76
|
-
|
77
|
-
|
73
|
+
}, "Close Panel"), (0, _react2.jsx)(_index.AccordionGroup, args, (0, _react2.jsx)(_collections.Item, {
|
74
|
+
key: "accordionKey",
|
75
|
+
textValue: "accordionKey",
|
76
|
+
label: "Accordion Label",
|
77
|
+
"data-id": "accordionItem"
|
78
|
+
}, (0, _react2.jsx)(_index.Text, null, "Render me!"))))))
|
78
79
|
);
|
79
80
|
};
|
80
81
|
|
@@ -106,7 +107,7 @@ var InnerPanel = function InnerPanel(_ref2) {
|
|
106
107
|
variant: "overlayPanel.overlayPanelInner" // applies higher z-index
|
107
108
|
,
|
108
109
|
isOpen: innerState.isOpen
|
109
|
-
}, args), (0, _react2.jsx)(_index.Box, null, (0, _react2.jsx)(
|
110
|
+
}, args), (0, _react2.jsx)(_index.Box, null, (0, _react2.jsx)(_index.Button, {
|
110
111
|
onPress: innerState.close
|
111
112
|
}, "Close Inner Panel"), (0, _react2.jsx)(_index.Text, {
|
112
113
|
pt: "md"
|
@@ -121,7 +122,7 @@ var InnerPanel = function InnerPanel(_ref2) {
|
|
121
122
|
sx: {
|
122
123
|
p: '12px'
|
123
124
|
}
|
124
|
-
}, (0, _react2.jsx)(
|
125
|
+
}, (0, _react2.jsx)(_index.Button, {
|
125
126
|
onPress: closeOuterPanel
|
126
127
|
}, "Close Panel"), (0, _react2.jsx)(_index.Text, {
|
127
128
|
pt: "md",
|
@@ -164,14 +165,14 @@ var InnerPanel = function InnerPanel(_ref2) {
|
|
164
165
|
mr: "auto"
|
165
166
|
}, "Form 5")), (0, _react2.jsx)(_index.Separator, {
|
166
167
|
margin: "0"
|
167
|
-
})), (0, _react2.jsx)("br", null), (0, _react2.jsx)(
|
168
|
+
})), (0, _react2.jsx)("br", null), (0, _react2.jsx)(_index.Button, {
|
168
169
|
onPress: toggleMessagesOpen
|
169
|
-
}, "Toggle Messages"), (0, _react2.jsx)("br", null), (0, _react2.jsx)(
|
170
|
+
}, "Toggle Messages"), (0, _react2.jsx)("br", null), (0, _react2.jsx)(_index.Button, {
|
170
171
|
onPress: innerState.open
|
171
172
|
}, "Open Inner Panel"), inner)));
|
172
173
|
return (// Application must be wrapped in an OverlayProvider so that it can be hidden from screen
|
173
174
|
// readers when an overlay opens.
|
174
|
-
(0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)(_index.OverlayProvider, null, (0, _react2.jsx)(
|
175
|
+
(0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)(_index.OverlayProvider, null, (0, _react2.jsx)(_index.Button, {
|
175
176
|
onPress: state.open
|
176
177
|
}, "Open Panel"), outer), messagesOpen && (0, _react2.jsx)(_index.Messages, {
|
177
178
|
sx: {
|
@@ -192,14 +193,14 @@ var CustomWidth = function CustomWidth() {
|
|
192
193
|
// readers when an overlay opens.
|
193
194
|
//
|
194
195
|
// For a custom width, provide the width via the 'sx' prop
|
195
|
-
(0, _react2.jsx)(_index.OverlayProvider, null, (0, _react2.jsx)(_index.Text, null, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur."), (0, _react2.jsx)("br", null), (0, _react2.jsx)(
|
196
|
+
(0, _react2.jsx)(_index.OverlayProvider, null, (0, _react2.jsx)(_index.Text, null, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur."), (0, _react2.jsx)("br", null), (0, _react2.jsx)(_index.Button, {
|
196
197
|
onPress: state.open
|
197
198
|
}, "Open Panel"), (0, _react2.jsx)(_OverlayPanel["default"], {
|
198
199
|
isOpen: state.isOpen,
|
199
200
|
sx: {
|
200
201
|
width: '720px'
|
201
202
|
}
|
202
|
-
}, (0, _react2.jsx)(_index.Box, null, (0, _react2.jsx)(
|
203
|
+
}, (0, _react2.jsx)(_index.Box, null, (0, _react2.jsx)(_index.Button, {
|
203
204
|
onPress: state.close
|
204
205
|
}, "Close Panel"), (0, _react2.jsx)(_index.Text, {
|
205
206
|
pt: "md"
|
@@ -17,6 +17,13 @@ var _react2 = require("@emotion/react");
|
|
17
17
|
var getComponent = function getComponent() {
|
18
18
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
19
19
|
return (0, _testWrapper.render)((0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)(_PopoverContainer["default"], props, (0, _react2.jsx)(_index.Box, null, "I am in a popover"))));
|
20
|
+
};
|
21
|
+
|
22
|
+
var getComponentInOverlayPanel = function getComponentInOverlayPanel() {
|
23
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
24
|
+
return (0, _testWrapper.render)((0, _react2.jsx)(_index.OverlayPanel, {
|
25
|
+
isOpen: true
|
26
|
+
}, (0, _react2.jsx)(_PopoverContainer["default"], props, (0, _react2.jsx)(_index.Box, null, "I am in a popover"))));
|
20
27
|
}; // Need to be added to each test file to test accessibility using axe.
|
21
28
|
|
22
29
|
|
@@ -39,4 +46,12 @@ test('should render a popover with no arrow', function () {
|
|
39
46
|
var arrow = _testWrapper.screen.queryByTestId('popover-arrow');
|
40
47
|
|
41
48
|
expect(arrow).not.toBeInTheDocument();
|
49
|
+
});
|
50
|
+
test('popover will not open if wrapped in an overlayPanel', function () {
|
51
|
+
getComponentInOverlayPanel({
|
52
|
+
popoverProps: {
|
53
|
+
'data-test-id': 'popover-test'
|
54
|
+
}
|
55
|
+
});
|
56
|
+
expect(_testWrapper.screen.queryByTestId('popover-test')).not.toBeInTheDocument();
|
42
57
|
});
|
@@ -29,7 +29,11 @@ var _react2 = require("@emotion/react");
|
|
29
29
|
*/
|
30
30
|
var TextArea = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
31
31
|
return (0, _react2.jsx)(_themeUi.Textarea, (0, _extends2["default"])({
|
32
|
-
ref: ref
|
32
|
+
ref: ref // this requires to fix safari resizing issue (UIP-4995)
|
33
|
+
,
|
34
|
+
sx: {
|
35
|
+
position: 'relative'
|
36
|
+
}
|
33
37
|
}, props));
|
34
38
|
});
|
35
39
|
TextArea.displayName = 'TextArea';
|
@@ -27,11 +27,11 @@ var accordion = {
|
|
27
27
|
alignItems: 'flex-start'
|
28
28
|
};
|
29
29
|
var accordionBody = {
|
30
|
-
display: 'none
|
30
|
+
display: 'none',
|
31
31
|
pt: 'md',
|
32
32
|
width: '100%',
|
33
33
|
'.is-open &': {
|
34
|
-
display: 'flex
|
34
|
+
display: 'flex'
|
35
35
|
}
|
36
36
|
};
|
37
37
|
var accordionGridHeader = {
|
@@ -4,7 +4,7 @@ import { Item } from '@react-stately/collections';
|
|
4
4
|
import userEvent from '@testing-library/user-event';
|
5
5
|
import axeTest from '../../utils/testUtils/testAxe';
|
6
6
|
import { act, fireEvent, render, screen } from '../../utils/testUtils/testWrapper';
|
7
|
-
import { Link, Box } from '../../index';
|
7
|
+
import { Link, Box, OverlayPanel } from '../../index';
|
8
8
|
import AccordionGridGroup from '../AccordionGridGroup';
|
9
9
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
10
10
|
var testId = 'test-accordion';
|
@@ -26,6 +26,22 @@ var getComponent = function getComponent() {
|
|
26
26
|
}, ___EmotionJSX(Box, null, ___EmotionJSX(Link, null, "Header Button"), ___EmotionJSX(Link, null, "Second Header Button")), ___EmotionJSX(Box, null, ___EmotionJSX(Link, null, "Body Button"), ___EmotionJSX(Link, null, "Second Body Button")))));
|
27
27
|
};
|
28
28
|
|
29
|
+
var getComponentInOverlayPanel = function getComponentInOverlayPanel() {
|
30
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
31
|
+
return render(___EmotionJSX(OverlayPanel, {
|
32
|
+
isOpen: true
|
33
|
+
}, ___EmotionJSX(AccordionGridGroup, _extends({}, defaultProps, props), ___EmotionJSX(Item, {
|
34
|
+
key: "first",
|
35
|
+
textValue: "Duplicate"
|
36
|
+
}, ___EmotionJSX(Box, null, ___EmotionJSX(Link, null, "Header Button"), ___EmotionJSX(Link, null, "Second Header Button")), ___EmotionJSX(Box, null, ___EmotionJSX(Link, null, "Body Button"), ___EmotionJSX(Link, null, "Second Body Button"))), ___EmotionJSX(Item, {
|
37
|
+
key: "second",
|
38
|
+
textValue: "Duplicate"
|
39
|
+
}, ___EmotionJSX(Box, null, ___EmotionJSX(Link, null, "Header Button"), ___EmotionJSX(Link, null, "Second Header Button")), ___EmotionJSX(Box, null, ___EmotionJSX(Link, null, "Body Button"), ___EmotionJSX(Link, null, "Second Body Button"))), ___EmotionJSX(Item, {
|
40
|
+
key: "third",
|
41
|
+
textValue: "Duplicate"
|
42
|
+
}, ___EmotionJSX(Box, null, ___EmotionJSX(Link, null, "Header Button"), ___EmotionJSX(Link, null, "Second Header Button")), ___EmotionJSX(Box, null, ___EmotionJSX(Link, null, "Body Button"), ___EmotionJSX(Link, null, "Second Body Button"))))));
|
43
|
+
};
|
44
|
+
|
29
45
|
axeTest(getComponent, {
|
30
46
|
// landmark-unique rule conflicts with react-aria role definition
|
31
47
|
rules: {
|
@@ -166,4 +182,10 @@ test('default expanded keys expands an accordion item', function () {
|
|
166
182
|
var row = screen.getAllByRole('row');
|
167
183
|
var selectedRow = row[0];
|
168
184
|
expect(selectedRow).toHaveAttribute('aria-selected', 'true');
|
185
|
+
});
|
186
|
+
test('items do not automatically expand if wrapped in an open OverlayPanel', function () {
|
187
|
+
getComponentInOverlayPanel();
|
188
|
+
var row = screen.getAllByRole('row');
|
189
|
+
var selectedRow = row[0];
|
190
|
+
expect(selectedRow).not.toHaveAttribute('aria-selected', 'true');
|
169
191
|
});
|
@@ -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, {
|
@@ -7,6 +7,7 @@ import axeTest from '../../utils/testUtils/testAxe';
|
|
7
7
|
import { act, fireEvent, render, screen } from '../../utils/testUtils/testWrapper';
|
8
8
|
import Text from '../Text';
|
9
9
|
import AccordionGroup from '../AccordionGroup';
|
10
|
+
import { OverlayPanel } from '../../index';
|
10
11
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
11
12
|
var testId = 'test-accordion';
|
12
13
|
var defaultProps = {
|
@@ -16,6 +17,28 @@ var defaultProps = {
|
|
16
17
|
var getComponent = function getComponent() {
|
17
18
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
18
19
|
return render(___EmotionJSX(AccordionGroup, _extends({}, defaultProps, props), ___EmotionJSX(Item, {
|
20
|
+
key: "first",
|
21
|
+
textValue: "Duplicate",
|
22
|
+
"data-id": "first",
|
23
|
+
label: "Accordion item"
|
24
|
+
}, ___EmotionJSX(Text, null, "Render me!")), ___EmotionJSX(Item, {
|
25
|
+
key: "second",
|
26
|
+
textValue: "Duplicate",
|
27
|
+
"data-id": "second",
|
28
|
+
label: "Accordion item"
|
29
|
+
}, ___EmotionJSX(Text, null, "Render me!")), ___EmotionJSX(Item, {
|
30
|
+
key: "third",
|
31
|
+
textValue: "Duplicate",
|
32
|
+
"data-id": "third",
|
33
|
+
label: "Accordion item"
|
34
|
+
}, ___EmotionJSX(Text, null, "Render me!"))));
|
35
|
+
};
|
36
|
+
|
37
|
+
var getComponentInOverlayPanel = function getComponentInOverlayPanel() {
|
38
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
39
|
+
return render(___EmotionJSX(OverlayPanel, {
|
40
|
+
isOpen: true
|
41
|
+
}, ___EmotionJSX(AccordionGroup, _extends({}, defaultProps, props), ___EmotionJSX(Item, {
|
19
42
|
key: "first",
|
20
43
|
textValue: "Duplicate",
|
21
44
|
"data-id": "first"
|
@@ -27,7 +50,7 @@ var getComponent = function getComponent() {
|
|
27
50
|
key: "third",
|
28
51
|
textValue: "Duplicate",
|
29
52
|
"data-id": "third"
|
30
|
-
}, ___EmotionJSX(Text, null, "Render me!"))));
|
53
|
+
}, ___EmotionJSX(Text, null, "Render me!")))));
|
31
54
|
}; // Need to be added to each test file to test accessibility using axe.
|
32
55
|
|
33
56
|
|
@@ -197,4 +220,10 @@ test('Item accepts a data-id and the data-id can be found in the DOM', function
|
|
197
220
|
var selectedItem = buttons[0];
|
198
221
|
var parentElement = selectedItem.parentElement;
|
199
222
|
expect(parentElement).toHaveAttribute('data-id', 'first');
|
223
|
+
});
|
224
|
+
test('items do not automatically expand if wrapped in an open OverlayPanel', function () {
|
225
|
+
getComponentInOverlayPanel();
|
226
|
+
var buttons = screen.getAllByRole('button');
|
227
|
+
var selectedItem = buttons[0];
|
228
|
+
expect(selectedItem).not.toHaveAttribute('aria-expanded', 'true');
|
200
229
|
});
|
@@ -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',
|
@@ -94,9 +93,11 @@ var AccordionItem = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
94
93
|
ml: "5px"
|
95
94
|
}, ___EmotionJSX(Icon, {
|
96
95
|
icon: isOpen ? MenuUp : MenuDown
|
97
|
-
}))), ___EmotionJSX(Box, _extends({
|
96
|
+
}))), isOpen && ___EmotionJSX(Box, _extends({
|
98
97
|
variant: "accordion.accordionBody"
|
99
|
-
}, accordionRegionProps, regionProps
|
98
|
+
}, accordionRegionProps, regionProps, {
|
99
|
+
className: itemClasses
|
100
|
+
}), item.rendered));
|
100
101
|
});
|
101
102
|
AccordionItem.propTypes = {
|
102
103
|
'aria-label': PropTypes.string,
|
@@ -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,
|
@@ -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
|
};
|
@@ -20,8 +20,8 @@ import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
20
20
|
export var icons = {
|
21
21
|
"default": AlertCircleOutlineIcon,
|
22
22
|
success: CheckCircleIcon,
|
23
|
-
error:
|
24
|
-
warning:
|
23
|
+
error: AlertCircleIcon,
|
24
|
+
warning: AlertCircleOutlineIcon
|
25
25
|
};
|
26
26
|
|
27
27
|
var CloseButton = function CloseButton(_ref) {
|
@@ -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
|
}));
|
@@ -3,9 +3,8 @@ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
|
3
3
|
import React, { useState } from 'react';
|
4
4
|
import { Item } from '@react-stately/collections';
|
5
5
|
import { useOverlayPanelState } from '../../hooks';
|
6
|
-
import Button from '../Button/Button';
|
7
6
|
import OverlayPanel from './OverlayPanel';
|
8
|
-
import { OverlayProvider, Box, Text, List, ListItem, Separator, Messages } from '../../index';
|
7
|
+
import { OverlayProvider, Box, Text, List, ListItem, Separator, Messages, Button, AccordionGroup } from '../../index';
|
9
8
|
import { panelSizes } from '../../utils/devUtils/constants/panelSizes';
|
10
9
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
11
10
|
export default {
|
@@ -47,9 +46,12 @@ export var Default = function Default(_ref) {
|
|
47
46
|
isOpen: state.isOpen
|
48
47
|
}, args), ___EmotionJSX(Box, null, ___EmotionJSX(Button, {
|
49
48
|
onPress: state.close
|
50
|
-
}, "Close Panel"), ___EmotionJSX(
|
51
|
-
|
52
|
-
|
49
|
+
}, "Close Panel"), ___EmotionJSX(AccordionGroup, args, ___EmotionJSX(Item, {
|
50
|
+
key: "accordionKey",
|
51
|
+
textValue: "accordionKey",
|
52
|
+
label: "Accordion Label",
|
53
|
+
"data-id": "accordionItem"
|
54
|
+
}, ___EmotionJSX(Text, null, "Render me!"))))))
|
53
55
|
);
|
54
56
|
};
|
55
57
|
export var InnerPanel = function InnerPanel(_ref2) {
|
@@ -1,13 +1,20 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import axeTest from '../../utils/testUtils/testAxe';
|
3
3
|
import { render, screen } from '../../utils/testUtils/testWrapper';
|
4
|
-
import { Box } from '../../index';
|
4
|
+
import { Box, OverlayPanel } from '../../index';
|
5
5
|
import PopoverContainer from './PopoverContainer';
|
6
6
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
7
7
|
|
8
8
|
var getComponent = function getComponent() {
|
9
9
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
10
10
|
return render(___EmotionJSX(React.Fragment, null, ___EmotionJSX(PopoverContainer, props, ___EmotionJSX(Box, null, "I am in a popover"))));
|
11
|
+
};
|
12
|
+
|
13
|
+
var getComponentInOverlayPanel = function getComponentInOverlayPanel() {
|
14
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
15
|
+
return render(___EmotionJSX(OverlayPanel, {
|
16
|
+
isOpen: true
|
17
|
+
}, ___EmotionJSX(PopoverContainer, props, ___EmotionJSX(Box, null, "I am in a popover"))));
|
11
18
|
}; // Need to be added to each test file to test accessibility using axe.
|
12
19
|
|
13
20
|
|
@@ -26,4 +33,12 @@ test('should render a popover with no arrow', function () {
|
|
26
33
|
});
|
27
34
|
var arrow = screen.queryByTestId('popover-arrow');
|
28
35
|
expect(arrow).not.toBeInTheDocument();
|
36
|
+
});
|
37
|
+
test('popover will not open if wrapped in an overlayPanel', function () {
|
38
|
+
getComponentInOverlayPanel({
|
39
|
+
popoverProps: {
|
40
|
+
'data-test-id': 'popover-test'
|
41
|
+
}
|
42
|
+
});
|
43
|
+
expect(screen.queryByTestId('popover-test')).not.toBeInTheDocument();
|
29
44
|
});
|
@@ -12,7 +12,11 @@ import { Textarea as ThemeUITextArea } from 'theme-ui';
|
|
12
12
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
13
13
|
var TextArea = /*#__PURE__*/forwardRef(function (props, ref) {
|
14
14
|
return ___EmotionJSX(ThemeUITextArea, _extends({
|
15
|
-
ref: ref
|
15
|
+
ref: ref // this requires to fix safari resizing issue (UIP-4995)
|
16
|
+
,
|
17
|
+
sx: {
|
18
|
+
position: 'relative'
|
19
|
+
}
|
16
20
|
}, props));
|
17
21
|
});
|
18
22
|
TextArea.displayName = 'TextArea';
|
@@ -18,11 +18,11 @@ var accordion = {
|
|
18
18
|
alignItems: 'flex-start'
|
19
19
|
};
|
20
20
|
var accordionBody = {
|
21
|
-
display: 'none
|
21
|
+
display: 'none',
|
22
22
|
pt: 'md',
|
23
23
|
width: '100%',
|
24
24
|
'.is-open &': {
|
25
|
-
display: 'flex
|
25
|
+
display: 'flex'
|
26
26
|
}
|
27
27
|
};
|
28
28
|
var accordionGridHeader = {
|