@pingux/astro 1.10.0-alpha.0 → 1.10.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/AccordionGridGroup/AccordionGridGroup.stories.js +55 -2
- package/lib/cjs/components/AccordionGridGroup/AccordionGridGroup.test.js +32 -0
- package/lib/cjs/components/AccordionGridItem/AccordionGridItem.js +1 -0
- package/lib/cjs/components/AccordionGridItem/AccordionGridItemBody.js +8 -2
- package/lib/cjs/styles/variants/accordion.js +10 -1
- package/lib/components/AccordionGridGroup/AccordionGridGroup.stories.js +51 -1
- package/lib/components/AccordionGridGroup/AccordionGridGroup.test.js +26 -1
- package/lib/components/AccordionGridItem/AccordionGridItem.js +1 -0
- package/lib/components/AccordionGridItem/AccordionGridItemBody.js +8 -2
- package/lib/styles/variants/accordion.js +10 -1
- package/package.json +1 -1
@@ -14,7 +14,7 @@ _Object$defineProperty(exports, "__esModule", {
|
|
14
14
|
value: true
|
15
15
|
});
|
16
16
|
|
17
|
-
exports["default"] = exports.Default = exports.Controlled = void 0;
|
17
|
+
exports["default"] = exports.Default = exports.Controlled = exports.AccordionWithInputs = void 0;
|
18
18
|
|
19
19
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
20
20
|
|
@@ -295,6 +295,59 @@ var Controlled = function Controlled() {
|
|
295
295
|
}) : null);
|
296
296
|
}))
|
297
297
|
);
|
298
|
+
}; // const items = [
|
299
|
+
// { id: 1, name: "Aardvark", key: "Aardvark" },
|
300
|
+
// { id: 2, name: "Kangaroo", key: "Kangaroo" },
|
301
|
+
// { id: 3, name: "Snake", key: "Snake" },
|
302
|
+
// { id: 4, name: "Frog", key: "Frog" },
|
303
|
+
// { id: 5, name: "Seal", key: "Seal" },
|
304
|
+
// { id: 6, name: "Orangutan", key: "Orangutan" },
|
305
|
+
// { id: 7, name: "Shark", key: "Shark" }
|
306
|
+
// ];
|
307
|
+
// const data = [
|
308
|
+
// {
|
309
|
+
// name: "Client Application Developer",
|
310
|
+
// key: "Client"
|
311
|
+
// },
|
312
|
+
// {
|
313
|
+
// name: "Environment Admin",
|
314
|
+
// key: "Environment"
|
315
|
+
// },
|
316
|
+
// {
|
317
|
+
// name: "Organization Admin",
|
318
|
+
// key: "Organization"
|
319
|
+
// }
|
320
|
+
// ];
|
321
|
+
|
322
|
+
|
323
|
+
exports.Controlled = Controlled;
|
324
|
+
|
325
|
+
var AccordionWithInputs = function AccordionWithInputs() {
|
326
|
+
return (0, _react2.jsx)(_AccordionGridGroup["default"], {
|
327
|
+
items: data
|
328
|
+
}, function (item) {
|
329
|
+
return (0, _react2.jsx)(_collections.Item, {
|
330
|
+
key: item.key,
|
331
|
+
textValue: item.name
|
332
|
+
}, (0, _react2.jsx)(_index.Text, {
|
333
|
+
sx: {
|
334
|
+
fontWeight: 3,
|
335
|
+
textOverflow: 'ellipsis',
|
336
|
+
whiteSpace: 'nowrap',
|
337
|
+
overflow: 'hidden'
|
338
|
+
},
|
339
|
+
variant: "itemTitle",
|
340
|
+
alignSelf: "center"
|
341
|
+
}, item.name), (0, _react2.jsx)(_index.Box, {
|
342
|
+
gap: "md"
|
343
|
+
}, (0, _react2.jsx)(_index.TextField, {
|
344
|
+
label: "label 1"
|
345
|
+
}), (0, _react2.jsx)(_index.TextField, {
|
346
|
+
label: "label 2"
|
347
|
+
}), (0, _react2.jsx)(_index.TextField, {
|
348
|
+
label: "label 3"
|
349
|
+
})));
|
350
|
+
});
|
298
351
|
};
|
299
352
|
|
300
|
-
exports.
|
353
|
+
exports.AccordionWithInputs = AccordionWithInputs;
|
@@ -59,6 +59,18 @@ var getComponentInOverlayPanel = function getComponentInOverlayPanel() {
|
|
59
59
|
}, (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"))))));
|
60
60
|
};
|
61
61
|
|
62
|
+
var getComponentWithTextFields = function getComponentWithTextFields() {
|
63
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
64
|
+
return (0, _testWrapper.render)((0, _react2.jsx)(_AccordionGridGroup["default"], (0, _extends2["default"])({}, defaultProps, props), (0, _react2.jsx)(_collections.Item, {
|
65
|
+
key: "first",
|
66
|
+
textValue: "Duplicate"
|
67
|
+
}, (0, _react2.jsx)(_index.Text, null, "Header"), (0, _react2.jsx)(_index.Box, null, (0, _react2.jsx)(_index.TextField, {
|
68
|
+
label: "label 1"
|
69
|
+
}), (0, _react2.jsx)(_index.TextField, {
|
70
|
+
label: "label 2"
|
71
|
+
})))));
|
72
|
+
};
|
73
|
+
|
62
74
|
(0, _testAxe["default"])(getComponent, {
|
63
75
|
// landmark-unique rule conflicts with react-aria role definition
|
64
76
|
rules: {
|
@@ -249,4 +261,24 @@ test('items do not automatically expand if wrapped in an open OverlayPanel', fun
|
|
249
261
|
|
250
262
|
var selectedRow = row[0];
|
251
263
|
expect(selectedRow).not.toHaveAttribute('aria-selected', 'true');
|
264
|
+
});
|
265
|
+
test('adds focus to inputs', function () {
|
266
|
+
getComponentWithTextFields();
|
267
|
+
|
268
|
+
var firstInput = _testWrapper.screen.getAllByRole('gridcell')[0];
|
269
|
+
|
270
|
+
var secondInput = _testWrapper.screen.getAllByRole('gridcell')[1];
|
271
|
+
|
272
|
+
expect(firstInput).not.toHaveFocus();
|
273
|
+
expect(secondInput).not.toHaveFocus();
|
274
|
+
|
275
|
+
_userEvent["default"].click(firstInput);
|
276
|
+
|
277
|
+
expect(firstInput).toHaveFocus();
|
278
|
+
expect(secondInput).not.toHaveFocus();
|
279
|
+
|
280
|
+
_userEvent["default"].click(secondInput);
|
281
|
+
|
282
|
+
expect(firstInput).not.toHaveFocus();
|
283
|
+
expect(secondInput).toHaveFocus();
|
252
284
|
});
|
@@ -105,6 +105,7 @@ var AccordionGridItem = function AccordionGridItem(props) {
|
|
105
105
|
}, (0, _utils.mergeProps)(rowProps, others), {
|
106
106
|
"aria-selected": isSelected,
|
107
107
|
className: classNames,
|
108
|
+
variant: "accordion.accordionGridItem",
|
108
109
|
ref: rowRef
|
109
110
|
}), (0, _react2.jsx)(_AccordionGridItemHeader["default"], (0, _extends2["default"])({
|
110
111
|
item: item,
|
@@ -62,10 +62,16 @@ var AccordionGridItemBody = /*#__PURE__*/(0, _react.forwardRef)(function (props,
|
|
62
62
|
|
63
63
|
var _useGridCell = (0, _grid.useGridCell)({
|
64
64
|
node: cellNode,
|
65
|
-
focusMode: '
|
65
|
+
focusMode: 'cell',
|
66
66
|
shouldSelectOnPressUp: true
|
67
67
|
}, state, ref),
|
68
|
-
gridCellProps = _useGridCell.gridCellProps;
|
68
|
+
gridCellProps = _useGridCell.gridCellProps;
|
69
|
+
/* istanbul ignore next */
|
70
|
+
|
71
|
+
|
72
|
+
gridCellProps.onClick = function (e) {
|
73
|
+
e.target.focus();
|
74
|
+
}; // Add the cell's key to the disabled keys array,
|
69
75
|
// so that clicking this cell does not close the accordion.
|
70
76
|
|
71
77
|
|
@@ -130,6 +130,14 @@ var accordionGridBody = {
|
|
130
130
|
width: '100%',
|
131
131
|
'&.is-selected': {
|
132
132
|
display: 'flex !important'
|
133
|
+
},
|
134
|
+
':focus': {
|
135
|
+
outline: 'none'
|
136
|
+
}
|
137
|
+
};
|
138
|
+
var accordionGridItem = {
|
139
|
+
':focus': {
|
140
|
+
outline: 'none'
|
133
141
|
}
|
134
142
|
};
|
135
143
|
var _default = {
|
@@ -139,6 +147,7 @@ var _default = {
|
|
139
147
|
accordion: accordion,
|
140
148
|
accordionBody: accordionBody,
|
141
149
|
accordionGridHeaderNav: accordionGridHeaderNav,
|
142
|
-
accordionGridNavItem: accordionGridNavItem
|
150
|
+
accordionGridNavItem: accordionGridNavItem,
|
151
|
+
accordionGridItem: accordionGridItem
|
143
152
|
};
|
144
153
|
exports["default"] = _default;
|
@@ -4,7 +4,7 @@ import React, { useState } from 'react';
|
|
4
4
|
import { Item } from '@react-stately/collections';
|
5
5
|
import CreateIcon from 'mdi-react/CreateIcon';
|
6
6
|
import MoreVertIcon from 'mdi-react/MoreVertIcon';
|
7
|
-
import { Box, IconButton, Text, Separator, Link } from '../../index';
|
7
|
+
import { Box, IconButton, Text, Separator, Link, TextField } from '../../index';
|
8
8
|
import AccordionGridGroup from './AccordionGridGroup';
|
9
9
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
10
10
|
var data = [{
|
@@ -260,4 +260,54 @@ export var Controlled = function Controlled() {
|
|
260
260
|
}) : null);
|
261
261
|
}))
|
262
262
|
);
|
263
|
+
}; // const items = [
|
264
|
+
// { id: 1, name: "Aardvark", key: "Aardvark" },
|
265
|
+
// { id: 2, name: "Kangaroo", key: "Kangaroo" },
|
266
|
+
// { id: 3, name: "Snake", key: "Snake" },
|
267
|
+
// { id: 4, name: "Frog", key: "Frog" },
|
268
|
+
// { id: 5, name: "Seal", key: "Seal" },
|
269
|
+
// { id: 6, name: "Orangutan", key: "Orangutan" },
|
270
|
+
// { id: 7, name: "Shark", key: "Shark" }
|
271
|
+
// ];
|
272
|
+
// const data = [
|
273
|
+
// {
|
274
|
+
// name: "Client Application Developer",
|
275
|
+
// key: "Client"
|
276
|
+
// },
|
277
|
+
// {
|
278
|
+
// name: "Environment Admin",
|
279
|
+
// key: "Environment"
|
280
|
+
// },
|
281
|
+
// {
|
282
|
+
// name: "Organization Admin",
|
283
|
+
// key: "Organization"
|
284
|
+
// }
|
285
|
+
// ];
|
286
|
+
|
287
|
+
export var AccordionWithInputs = function AccordionWithInputs() {
|
288
|
+
return ___EmotionJSX(AccordionGridGroup, {
|
289
|
+
items: data
|
290
|
+
}, function (item) {
|
291
|
+
return ___EmotionJSX(Item, {
|
292
|
+
key: item.key,
|
293
|
+
textValue: item.name
|
294
|
+
}, ___EmotionJSX(Text, {
|
295
|
+
sx: {
|
296
|
+
fontWeight: 3,
|
297
|
+
textOverflow: 'ellipsis',
|
298
|
+
whiteSpace: 'nowrap',
|
299
|
+
overflow: 'hidden'
|
300
|
+
},
|
301
|
+
variant: "itemTitle",
|
302
|
+
alignSelf: "center"
|
303
|
+
}, item.name), ___EmotionJSX(Box, {
|
304
|
+
gap: "md"
|
305
|
+
}, ___EmotionJSX(TextField, {
|
306
|
+
label: "label 1"
|
307
|
+
}), ___EmotionJSX(TextField, {
|
308
|
+
label: "label 2"
|
309
|
+
}), ___EmotionJSX(TextField, {
|
310
|
+
label: "label 3"
|
311
|
+
})));
|
312
|
+
});
|
263
313
|
};
|
@@ -6,7 +6,7 @@ import { Item } from '@react-stately/collections';
|
|
6
6
|
import userEvent from '@testing-library/user-event';
|
7
7
|
import axeTest from '../../utils/testUtils/testAxe';
|
8
8
|
import { act, fireEvent, render, screen, waitFor } from '../../utils/testUtils/testWrapper';
|
9
|
-
import { Link, Box, OverlayPanel } from '../../index';
|
9
|
+
import { Link, Box, OverlayPanel, TextField, Text } from '../../index';
|
10
10
|
import AccordionGridGroup from '../AccordionGridGroup';
|
11
11
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
12
12
|
var testId = 'test-accordion';
|
@@ -44,6 +44,18 @@ var getComponentInOverlayPanel = function getComponentInOverlayPanel() {
|
|
44
44
|
}, ___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"))))));
|
45
45
|
};
|
46
46
|
|
47
|
+
var getComponentWithTextFields = function getComponentWithTextFields() {
|
48
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
49
|
+
return render(___EmotionJSX(AccordionGridGroup, _extends({}, defaultProps, props), ___EmotionJSX(Item, {
|
50
|
+
key: "first",
|
51
|
+
textValue: "Duplicate"
|
52
|
+
}, ___EmotionJSX(Text, null, "Header"), ___EmotionJSX(Box, null, ___EmotionJSX(TextField, {
|
53
|
+
label: "label 1"
|
54
|
+
}), ___EmotionJSX(TextField, {
|
55
|
+
label: "label 2"
|
56
|
+
})))));
|
57
|
+
};
|
58
|
+
|
47
59
|
axeTest(getComponent, {
|
48
60
|
// landmark-unique rule conflicts with react-aria role definition
|
49
61
|
rules: {
|
@@ -187,4 +199,17 @@ test('items do not automatically expand if wrapped in an open OverlayPanel', fun
|
|
187
199
|
var row = screen.getAllByRole('row');
|
188
200
|
var selectedRow = row[0];
|
189
201
|
expect(selectedRow).not.toHaveAttribute('aria-selected', 'true');
|
202
|
+
});
|
203
|
+
test('adds focus to inputs', function () {
|
204
|
+
getComponentWithTextFields();
|
205
|
+
var firstInput = screen.getAllByRole('gridcell')[0];
|
206
|
+
var secondInput = screen.getAllByRole('gridcell')[1];
|
207
|
+
expect(firstInput).not.toHaveFocus();
|
208
|
+
expect(secondInput).not.toHaveFocus();
|
209
|
+
userEvent.click(firstInput);
|
210
|
+
expect(firstInput).toHaveFocus();
|
211
|
+
expect(secondInput).not.toHaveFocus();
|
212
|
+
userEvent.click(secondInput);
|
213
|
+
expect(firstInput).not.toHaveFocus();
|
214
|
+
expect(secondInput).toHaveFocus();
|
190
215
|
});
|
@@ -68,6 +68,7 @@ var AccordionGridItem = function AccordionGridItem(props) {
|
|
68
68
|
}, mergeProps(rowProps, others), {
|
69
69
|
"aria-selected": isSelected,
|
70
70
|
className: classNames,
|
71
|
+
variant: "accordion.accordionGridItem",
|
71
72
|
ref: rowRef
|
72
73
|
}), ___EmotionJSX(AccordionGridItemHeader, _extends({
|
73
74
|
item: item,
|
@@ -27,10 +27,16 @@ var AccordionGridItemBody = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
27
27
|
|
28
28
|
var _useGridCell = useGridCell({
|
29
29
|
node: cellNode,
|
30
|
-
focusMode: '
|
30
|
+
focusMode: 'cell',
|
31
31
|
shouldSelectOnPressUp: true
|
32
32
|
}, state, ref),
|
33
|
-
gridCellProps = _useGridCell.gridCellProps;
|
33
|
+
gridCellProps = _useGridCell.gridCellProps;
|
34
|
+
/* istanbul ignore next */
|
35
|
+
|
36
|
+
|
37
|
+
gridCellProps.onClick = function (e) {
|
38
|
+
e.target.focus();
|
39
|
+
}; // Add the cell's key to the disabled keys array,
|
34
40
|
// so that clicking this cell does not close the accordion.
|
35
41
|
|
36
42
|
|
@@ -112,6 +112,14 @@ var accordionGridBody = {
|
|
112
112
|
width: '100%',
|
113
113
|
'&.is-selected': {
|
114
114
|
display: 'flex !important'
|
115
|
+
},
|
116
|
+
':focus': {
|
117
|
+
outline: 'none'
|
118
|
+
}
|
119
|
+
};
|
120
|
+
var accordionGridItem = {
|
121
|
+
':focus': {
|
122
|
+
outline: 'none'
|
115
123
|
}
|
116
124
|
};
|
117
125
|
export default {
|
@@ -121,5 +129,6 @@ export default {
|
|
121
129
|
accordion: accordion,
|
122
130
|
accordionBody: accordionBody,
|
123
131
|
accordionGridHeaderNav: accordionGridHeaderNav,
|
124
|
-
accordionGridNavItem: accordionGridNavItem
|
132
|
+
accordionGridNavItem: accordionGridNavItem,
|
133
|
+
accordionGridItem: accordionGridItem
|
125
134
|
};
|