@pingux/astro 1.0.1 → 1.1.0-alpha.11
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 +137 -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/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/FileInputField/FileItem.js +2 -1
- 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/List/List.js +3 -0
- package/lib/cjs/components/List/List.stories.js +7 -2
- 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/ListView/ListView.stories.js +580 -39
- package/lib/cjs/components/Messages/Message.js +2 -2
- package/lib/cjs/components/MultivaluesField/MultivaluesField.js +3 -2
- 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/components/TooltipTrigger/TooltipTrigger.stories.js +45 -2
- package/lib/cjs/styles/variants/accordion.js +2 -2
- package/lib/cjs/styles/variants/boxes.js +2 -1
- package/lib/cjs/styles/variants/buttons.js +47 -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/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/FileInputField/FileItem.js +2 -1
- 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/List/List.js +2 -0
- package/lib/components/List/List.stories.js +6 -2
- 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/ListView/ListView.stories.js +577 -39
- package/lib/components/Messages/Message.js +2 -2
- package/lib/components/MultivaluesField/MultivaluesField.js +3 -2
- 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/components/TooltipTrigger/TooltipTrigger.stories.js +33 -1
- package/lib/styles/variants/accordion.js +2 -2
- package/lib/styles/variants/boxes.js +1 -1
- package/lib/styles/variants/buttons.js +46 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,143 @@
|
|
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.11](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.1.0-alpha.10...@pingux/astro@1.1.0-alpha.11) (2022-01-28)
|
7
|
+
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
* [UIP-5177] Icon Button Color Update ([05b8a95](https://gitlab.corp.pingidentity.com/ux/pingux/commit/05b8a95e3fae60e7f655cf2812dfd2104496b1c5))
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
# [1.1.0-alpha.10](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.1.0-alpha.9...@pingux/astro@1.1.0-alpha.10) (2022-01-28)
|
18
|
+
|
19
|
+
|
20
|
+
### Bug Fixes
|
21
|
+
|
22
|
+
* [UIP-5180] File Upload Field Update Document Icon Color ([debaf91](https://gitlab.corp.pingidentity.com/ux/pingux/commit/debaf9100401c822c37fdd16be1a1b1704096f10))
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
# [1.1.0-alpha.9](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.1.0-alpha.8...@pingux/astro@1.1.0-alpha.9) (2022-01-24)
|
29
|
+
|
30
|
+
|
31
|
+
### Bug Fixes
|
32
|
+
|
33
|
+
* [UIP-5111] Deprecate List Component ([3cd9b69](https://gitlab.corp.pingidentity.com/ux/pingux/commit/3cd9b699c48ac43e34d9cfd61b07f33b4b7d4fc4))
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
# [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)
|
40
|
+
|
41
|
+
|
42
|
+
### Bug Fixes
|
43
|
+
|
44
|
+
* [UIP-4995] TextArea Safari resize issue ([33c8af3](https://gitlab.corp.pingidentity.com/ux/pingux/commit/33c8af35fbe82820427b87bdd9ab0744039a6c18))
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
# [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)
|
51
|
+
|
52
|
+
|
53
|
+
### Bug Fixes
|
54
|
+
|
55
|
+
* [UIP-5109] AccordionGroup OverlayPanel Compatibility Fix ([6a78b76](https://gitlab.corp.pingidentity.com/ux/pingux/commit/6a78b76a3c3ab7b9ac78a7dcd6ca74a6449d63c2))
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
# [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)
|
62
|
+
|
63
|
+
|
64
|
+
### Bug Fixes
|
65
|
+
|
66
|
+
* [UIP-5070] Icons for warning and error messages are reversed ([36f0d6e](https://gitlab.corp.pingidentity.com/ux/pingux/commit/36f0d6e1b65662b3c64aa1599012a2967b59e56d))
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
# [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)
|
73
|
+
|
74
|
+
|
75
|
+
### Bug Fixes
|
76
|
+
|
77
|
+
* [UIP-5030] Components shouldn't have a default aria-label ([8927951](https://gitlab.corp.pingidentity.com/ux/pingux/commit/8927951339ef49faa03f5654d9e8f357b136430a))
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
# [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)
|
84
|
+
|
85
|
+
|
86
|
+
### Bug Fixes
|
87
|
+
|
88
|
+
* [UIP-4992] Fix SelectField Warnings ([dab3f92](https://gitlab.corp.pingidentity.com/ux/pingux/commit/dab3f9254c5d7b1b124ed24616e4ef68f53af7d0))
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
# [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)
|
95
|
+
|
96
|
+
|
97
|
+
### Bug Fixes
|
98
|
+
|
99
|
+
* [UIP-5007] ComboBoxField controlled custom input throws an exception ([9651c98](https://gitlab.corp.pingidentity.com/ux/pingux/commit/9651c98da3b3ac158c84f378303a2d331db78cce))
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
# [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)
|
106
|
+
|
107
|
+
|
108
|
+
### Bug Fixes
|
109
|
+
|
110
|
+
* [UIP-5039] IconButton Square Variant ([2fecfac](https://gitlab.corp.pingidentity.com/ux/pingux/commit/2fecfac9d39974eb5dc773d210c3a830d1bd9e2a))
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
# [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)
|
117
|
+
|
118
|
+
|
119
|
+
### Bug Fixes
|
120
|
+
|
121
|
+
* [UIP-5026] Infinite Loading List requests page 2 instantly ([e6888cf](https://gitlab.corp.pingidentity.com/ux/pingux/commit/e6888cfe91435fae0ab583b0ff22b2c169ba7bcd))
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
# [1.1.0-alpha.0](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.0.1...@pingux/astro@1.1.0-alpha.0) (2022-01-19)
|
128
|
+
|
129
|
+
|
130
|
+
### Bug Fixes
|
131
|
+
|
132
|
+
* [UIP-5122] adjust x icon to 14px ([6b4ca54](https://gitlab.corp.pingidentity.com/ux/pingux/commit/6b4ca5418ddaffb6e1a4daaf28b57151a23529cb))
|
133
|
+
|
134
|
+
|
135
|
+
### Features
|
136
|
+
|
137
|
+
* [UIP-5066] Add Icon, Chip, and Text with Tooltips ([1681083](https://gitlab.corp.pingidentity.com/ux/pingux/commit/168108386d77ef09635a177a35cb6d68cfad8bc2))
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
6
143
|
## [1.0.1](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.0.0...@pingux/astro@1.0.1) (2022-01-19)
|
7
144
|
|
8
145
|
**Note:** Version bump only for package @pingux/astro
|
@@ -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,
|
@@ -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 = {
|
@@ -20,6 +20,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
20
20
|
|
21
21
|
var _Box = _interopRequireDefault(require("../Box/Box"));
|
22
22
|
|
23
|
+
var _hooks = require("../../hooks");
|
24
|
+
|
23
25
|
var _react2 = require("@emotion/react");
|
24
26
|
|
25
27
|
/**
|
@@ -29,6 +31,7 @@ var _react2 = require("@emotion/react");
|
|
29
31
|
var List = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
30
32
|
var children = props.children,
|
31
33
|
others = (0, _objectWithoutProperties2["default"])(props, ["children"]);
|
34
|
+
(0, _hooks.useDeprecationWarning)('The List component will be deprecated in Astro-UI 2.0.0, use ListView instead.');
|
32
35
|
return (0, _react2.jsx)(_Box["default"], (0, _extends2["default"])({
|
33
36
|
ref: ref,
|
34
37
|
role: "list",
|
@@ -20,11 +20,16 @@ var _Text = _interopRequireDefault(require("../Text"));
|
|
20
20
|
|
21
21
|
var _Separator = _interopRequireDefault(require("../Separator"));
|
22
22
|
|
23
|
+
var _withDeprecationWarning = _interopRequireDefault(require("../../utils/devUtils/decorators/withDeprecationWarning"));
|
24
|
+
|
23
25
|
var _react2 = require("@emotion/react");
|
24
26
|
|
25
27
|
var _default = {
|
26
|
-
title: 'List',
|
27
|
-
component: [_["default"], _ListItem["default"]]
|
28
|
+
title: 'Deprecated/List',
|
29
|
+
component: [_["default"], _ListItem["default"]],
|
30
|
+
decorators: [function (Story, context) {
|
31
|
+
return (0, _withDeprecationWarning["default"])(Story, context, 'The `List` component will be deprecated in Astro-UI 2.0.0, use `ListView` instead.');
|
32
|
+
}]
|
28
33
|
};
|
29
34
|
exports["default"] = _default;
|
30
35
|
|
@@ -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
|
};
|