@pingux/astro 1.10.0 → 1.10.1-alpha.2
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/ArrayField/ArrayField.js +41 -25
- package/lib/cjs/components/ArrayField/ArrayField.stories.js +9 -0
- package/lib/cjs/components/ArrayField/ArrayField.test.js +5 -1
- package/lib/cjs/components/{MultiselectFilter/MultiselectFilter.js → CollapsiblePanel/CollapsiblePanel.js} +13 -13
- package/lib/cjs/components/{MultiselectFilter/MultiselectFilter.stories.js → CollapsiblePanel/CollapsiblePanel.stories.js} +9 -9
- package/lib/cjs/components/{MultiselectFilter/MultiselectFilter.test.js → CollapsiblePanel/CollapsiblePanel.test.js} +8 -8
- package/lib/cjs/components/{MultiselectFilter → CollapsiblePanel}/index.js +2 -2
- package/lib/cjs/components/{MultiselectListContainer/MultiselectBadge.js → CollapsiblePanelContainer/CollapsiblePanelBadge.js} +6 -6
- package/lib/cjs/components/{MultiselectListContainer/MultiselectBadge.test.js → CollapsiblePanelContainer/CollapsiblePanelBadge.test.js} +8 -8
- package/lib/cjs/components/{MultiselectListContainer/MultiselectListContainer.js → CollapsiblePanelContainer/CollapsiblePanelContainer.js} +12 -12
- package/lib/cjs/components/{MultiselectListContainer/MultiselectListContainer.test.js → CollapsiblePanelContainer/CollapsiblePanelContainer.test.js} +23 -23
- package/lib/cjs/components/{MultiselectListContainer → CollapsiblePanelContainer}/index.js +2 -2
- package/lib/cjs/components/{MultiselectFilterItem/MultiselectFilterItem.js → CollapsiblePanelItem/CollapsiblePanelItem.js} +7 -7
- package/lib/cjs/components/{MultiselectFilterItem/MultiselectFilterItem.test.js → CollapsiblePanelItem/CollapsiblePanelItem.test.js} +7 -7
- package/lib/cjs/components/{MultiselectFilterItem → CollapsiblePanelItem}/index.js +2 -2
- package/lib/cjs/components/ComboBoxField/ComboBoxField.js +15 -1
- package/lib/cjs/components/ComboBoxField/ComboBoxField.test.js +22 -0
- package/lib/cjs/index.js +36 -36
- package/lib/cjs/recipes/{MultiselectListContainer.stories.js → CollapsiblePanel.stories.js} +3 -3
- package/lib/cjs/styles/variants/buttons.js +2 -2
- package/lib/cjs/styles/variants/{multiselectListContainer.js → collapsiblePanel.js} +10 -10
- package/lib/cjs/styles/variants/text.js +4 -4
- package/lib/cjs/styles/variants/variants.js +2 -2
- package/lib/components/ArrayField/ArrayField.js +37 -25
- package/lib/components/ArrayField/ArrayField.stories.js +9 -0
- package/lib/components/ArrayField/ArrayField.test.js +5 -1
- package/lib/components/{MultiselectFilter/MultiselectFilter.js → CollapsiblePanel/CollapsiblePanel.js} +14 -14
- package/lib/components/{MultiselectFilter/MultiselectFilter.stories.js → CollapsiblePanel/CollapsiblePanel.stories.js} +8 -8
- package/lib/components/{MultiselectFilter/MultiselectFilter.test.js → CollapsiblePanel/CollapsiblePanel.test.js} +8 -8
- package/lib/components/CollapsiblePanel/index.js +1 -0
- package/lib/components/{MultiselectListContainer/MultiselectBadge.js → CollapsiblePanelContainer/CollapsiblePanelBadge.js} +6 -6
- package/lib/components/{MultiselectListContainer/MultiselectBadge.test.js → CollapsiblePanelContainer/CollapsiblePanelBadge.test.js} +8 -8
- package/lib/components/{MultiselectListContainer/MultiselectListContainer.js → CollapsiblePanelContainer/CollapsiblePanelContainer.js} +12 -12
- package/lib/components/{MultiselectListContainer/MultiselectListContainer.test.js → CollapsiblePanelContainer/CollapsiblePanelContainer.test.js} +23 -23
- package/lib/components/CollapsiblePanelContainer/index.js +1 -0
- package/lib/components/{MultiselectFilterItem/MultiselectFilterItem.js → CollapsiblePanelItem/CollapsiblePanelItem.js} +7 -7
- package/lib/components/{MultiselectFilterItem/MultiselectFilterItem.test.js → CollapsiblePanelItem/CollapsiblePanelItem.test.js} +7 -7
- package/lib/components/CollapsiblePanelItem/index.js +1 -0
- package/lib/components/ComboBoxField/ComboBoxField.js +15 -1
- package/lib/components/ComboBoxField/ComboBoxField.test.js +14 -0
- package/lib/index.js +6 -6
- package/lib/recipes/{MultiselectListContainer.stories.js → CollapsiblePanel.stories.js} +4 -4
- package/lib/styles/variants/buttons.js +2 -2
- package/lib/styles/variants/{multiselectListContainer.js → collapsiblePanel.js} +10 -10
- package/lib/styles/variants/text.js +4 -4
- package/lib/styles/variants/variants.js +2 -2
- package/package.json +1 -1
- package/lib/components/MultiselectFilter/index.js +0 -1
- package/lib/components/MultiselectFilterItem/index.js +0 -1
- package/lib/components/MultiselectListContainer/index.js +0 -1
@@ -7,15 +7,15 @@ import { useFocusRing } from '@react-aria/focus';
|
|
7
7
|
import { mergeProps } from '@react-aria/utils';
|
8
8
|
import { isIterableProp } from '../../utils/devUtils/props/isIterable';
|
9
9
|
import { useStatusClasses } from '../../hooks';
|
10
|
-
import
|
11
|
-
import { Box, ListView,
|
10
|
+
import CollapsiblePanelBadge from '../CollapsiblePanelContainer/CollapsiblePanelBadge';
|
11
|
+
import { Box, ListView, CollapsiblePanelContainer, Text } from '../../index';
|
12
12
|
/**
|
13
|
-
* The
|
13
|
+
* The CollapsiblePanel serves as a filter menu with a menu title
|
14
14
|
* and selected count displayed in a badge.
|
15
15
|
*/
|
16
16
|
|
17
17
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
18
|
-
var
|
18
|
+
var CollapsiblePanel = /*#__PURE__*/forwardRef(function (props, ref) {
|
19
19
|
var selectedFilterCount = props.selectedFilterCount,
|
20
20
|
className = props.className,
|
21
21
|
closeAriaLabel = props.closeAriaLabel,
|
@@ -45,7 +45,7 @@ var MultiselectFilter = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
45
45
|
}),
|
46
46
|
classNames = _useStatusClasses.classNames;
|
47
47
|
|
48
|
-
return ___EmotionJSX(
|
48
|
+
return ___EmotionJSX(CollapsiblePanelContainer, {
|
49
49
|
closeAriaLabel: closeAriaLabel,
|
50
50
|
isDefaultOpen: isDefaultOpen,
|
51
51
|
isOpen: isOpen,
|
@@ -54,16 +54,16 @@ var MultiselectFilter = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
54
54
|
selectedFilterCount: selectedFilterCount
|
55
55
|
}, ___EmotionJSX(Box, _extends({
|
56
56
|
className: classNames,
|
57
|
-
"data-testid": "
|
57
|
+
"data-testid": "collapsible-panel",
|
58
58
|
ref: ref,
|
59
59
|
tabIndex: 0,
|
60
|
-
variant: "
|
60
|
+
variant: "collapsiblePanel.collapsiblePanelContent"
|
61
61
|
}, mergedProps, others), ___EmotionJSX(Box, {
|
62
62
|
isRow: true,
|
63
|
-
variant: "
|
63
|
+
variant: "collapsiblePanel.collapsiblePanelContainerTitle"
|
64
64
|
}, ___EmotionJSX(Text, {
|
65
|
-
variant: "
|
66
|
-
}, listTitle), selectedFilterCount && ___EmotionJSX(
|
65
|
+
variant: "collapsiblePanelTitle"
|
66
|
+
}, listTitle), selectedFilterCount && ___EmotionJSX(CollapsiblePanelBadge, {
|
67
67
|
margin: "0",
|
68
68
|
selectedFilterCount: selectedFilterCount
|
69
69
|
})), ___EmotionJSX(Box, {
|
@@ -79,7 +79,7 @@ var MultiselectFilter = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
79
79
|
pl: "md"
|
80
80
|
}, children))));
|
81
81
|
});
|
82
|
-
|
82
|
+
CollapsiblePanel.propTypes = {
|
83
83
|
/** Amount of selected items indicator. */
|
84
84
|
selectedFilterCount: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
85
85
|
|
@@ -112,8 +112,8 @@ MultiselectFilter.propTypes = {
|
|
112
112
|
/** Defines a string value that labels the trigger icon when menu is closed. */
|
113
113
|
openAriaLabel: PropTypes.string
|
114
114
|
};
|
115
|
-
|
115
|
+
CollapsiblePanel.defaultProps = {
|
116
116
|
isDefaultOpen: true
|
117
117
|
};
|
118
|
-
|
119
|
-
export default
|
118
|
+
CollapsiblePanel.displayName = 'CollapsiblePanel';
|
119
|
+
export default CollapsiblePanel;
|
@@ -6,13 +6,13 @@ import ChevronRightIcon from 'mdi-react/ChevronRightIcon';
|
|
6
6
|
import FilterIcon from 'mdi-react/FilterIcon';
|
7
7
|
import SearchIcon from 'mdi-react/SearchIcon';
|
8
8
|
import AccountIcon from 'mdi-react/AccountIcon';
|
9
|
-
import
|
9
|
+
import CollapsiblePanel from './CollapsiblePanel';
|
10
10
|
import { useOverlayPanelState } from '../../hooks';
|
11
|
-
import { Breadcrumbs, Box, Button, Chip, ListView, Item, Icon, IconButton,
|
11
|
+
import { Breadcrumbs, Box, Button, Chip, ListView, Item, Icon, IconButton, CollapsiblePanelItem, OverlayPanel, OverlayProvider, SearchField, Text } from '../../index';
|
12
12
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
13
13
|
export default {
|
14
|
-
title: '
|
15
|
-
component:
|
14
|
+
title: 'CollapsiblePanel',
|
15
|
+
component: CollapsiblePanel,
|
16
16
|
argTypes: {
|
17
17
|
listTitle: {
|
18
18
|
defaultValue: 'Selected Groups'
|
@@ -117,9 +117,9 @@ var changeSelection = function changeSelection(selected) {
|
|
117
117
|
};
|
118
118
|
|
119
119
|
export var Default = function Default(args) {
|
120
|
-
return ___EmotionJSX(
|
120
|
+
return ___EmotionJSX(CollapsiblePanel, args);
|
121
121
|
};
|
122
|
-
export var
|
122
|
+
export var CollapsiblePanelWithBadge = function CollapsiblePanelWithBadge(args) {
|
123
123
|
var _useOverlayPanelState = useOverlayPanelState(),
|
124
124
|
state = _useOverlayPanelState.state,
|
125
125
|
onClose = _useOverlayPanelState.onClose;
|
@@ -234,7 +234,7 @@ export var MultiselectWithBadge = function MultiselectWithBadge(args) {
|
|
234
234
|
})), ___EmotionJSX(Text, {
|
235
235
|
variant: "listSubtitle"
|
236
236
|
}, item.subtitle))));
|
237
|
-
})), ___EmotionJSX(
|
237
|
+
})), ___EmotionJSX(CollapsiblePanel, _extends({
|
238
238
|
items: mockData,
|
239
239
|
onSelectionChange: changeSelection,
|
240
240
|
selectedFilterCount: "1000+"
|
@@ -243,7 +243,7 @@ export var MultiselectWithBadge = function MultiselectWithBadge(args) {
|
|
243
243
|
key: item.key,
|
244
244
|
textValue: item.name,
|
245
245
|
"data-id": item.key
|
246
|
-
}, ___EmotionJSX(
|
246
|
+
}, ___EmotionJSX(CollapsiblePanelItem, {
|
247
247
|
text: item.name,
|
248
248
|
icon: FilterIcon
|
249
249
|
}));
|
@@ -2,9 +2,9 @@ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
|
2
2
|
import React from 'react';
|
3
3
|
import axeTest from '../../utils/testUtils/testAxe';
|
4
4
|
import { render, screen } from '../../utils/testUtils/testWrapper';
|
5
|
-
import
|
5
|
+
import CollapsiblePanel from './CollapsiblePanel';
|
6
6
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
7
|
-
var testId = '
|
7
|
+
var testId = 'collapsible-panel-item';
|
8
8
|
var onSelectionChange = jest.fn();
|
9
9
|
var defaultProps = {
|
10
10
|
'data-testid': testId,
|
@@ -19,7 +19,7 @@ var defaultProps = {
|
|
19
19
|
|
20
20
|
var getComponent = function getComponent() {
|
21
21
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
22
|
-
return render(___EmotionJSX(
|
22
|
+
return render(___EmotionJSX(CollapsiblePanel, _extends({}, defaultProps, props)));
|
23
23
|
};
|
24
24
|
|
25
25
|
beforeAll(function () {
|
@@ -55,15 +55,15 @@ axeTest(getComponent, {
|
|
55
55
|
}
|
56
56
|
}
|
57
57
|
});
|
58
|
-
test('default
|
58
|
+
test('default CollapsiblePanel', function () {
|
59
59
|
getComponent();
|
60
|
-
var
|
61
|
-
expect(
|
60
|
+
var collapsiblePanel = screen.getByTestId(testId);
|
61
|
+
expect(collapsiblePanel).toBeInTheDocument();
|
62
62
|
});
|
63
63
|
test('custom classname can be passed', function () {
|
64
64
|
getComponent({
|
65
65
|
className: 'testing-class'
|
66
66
|
});
|
67
|
-
var
|
68
|
-
expect(
|
67
|
+
var collapsiblePanel = screen.getByTestId(testId);
|
68
|
+
expect(collapsiblePanel).toHaveClass('testing-class');
|
69
69
|
});
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './CollapsiblePanel';
|
@@ -5,12 +5,12 @@ import React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
6
6
|
import Chip from '../Chip';
|
7
7
|
/**
|
8
|
-
* The
|
8
|
+
* The CollapsiblePanelBadge serves as a badge to display selected count.
|
9
9
|
*/
|
10
10
|
|
11
11
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
12
12
|
|
13
|
-
var
|
13
|
+
var CollapsiblePanelBadge = function CollapsiblePanelBadge(props) {
|
14
14
|
var selectedFilterCount = props.selectedFilterCount,
|
15
15
|
others = _objectWithoutProperties(props, _excluded);
|
16
16
|
|
@@ -19,14 +19,14 @@ var MultiselectBadge = function MultiselectBadge(props) {
|
|
19
19
|
bg: "neutral.90",
|
20
20
|
label: selectedFilterCount.toString(),
|
21
21
|
textColor: "neutral.30",
|
22
|
-
variant: "
|
22
|
+
variant: "collapsiblePanel.collapsiblePanelBadge",
|
23
23
|
isUppercase: true
|
24
24
|
}, others));
|
25
25
|
};
|
26
26
|
|
27
|
-
|
27
|
+
CollapsiblePanelBadge.propTypes = {
|
28
28
|
selectedFilterCount: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
29
29
|
margin: PropTypes.string
|
30
30
|
};
|
31
|
-
|
32
|
-
export default
|
31
|
+
CollapsiblePanelBadge.displayName = 'CollapsiblePanelBadge';
|
32
|
+
export default CollapsiblePanelBadge;
|
@@ -2,9 +2,9 @@ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
|
2
2
|
import React from 'react';
|
3
3
|
import axeTest from '../../utils/testUtils/testAxe';
|
4
4
|
import { render, screen } from '../../utils/testUtils/testWrapper';
|
5
|
-
import
|
5
|
+
import CollapsiblePanelBadge from './CollapsiblePanelBadge';
|
6
6
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
7
|
-
var testId = 'test-
|
7
|
+
var testId = 'test-collapsiblePanelBadge';
|
8
8
|
var defaultProps = {
|
9
9
|
'data-testid': testId,
|
10
10
|
selectedFilterCount: 9
|
@@ -12,7 +12,7 @@ var defaultProps = {
|
|
12
12
|
|
13
13
|
var getComponent = function getComponent() {
|
14
14
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
15
|
-
return render(___EmotionJSX(
|
15
|
+
return render(___EmotionJSX(CollapsiblePanelBadge, _extends({}, defaultProps, props)));
|
16
16
|
};
|
17
17
|
|
18
18
|
afterEach(function () {
|
@@ -20,15 +20,15 @@ afterEach(function () {
|
|
20
20
|
}); // Need to be added to each test file to test accessibility using axe.
|
21
21
|
|
22
22
|
axeTest(getComponent);
|
23
|
-
test('default
|
23
|
+
test('default CollapsiblePanelBadge', function () {
|
24
24
|
getComponent();
|
25
|
-
var
|
26
|
-
expect(
|
25
|
+
var collapsiblePanelBadge = screen.getByTestId(testId);
|
26
|
+
expect(collapsiblePanelBadge).toBeInTheDocument();
|
27
27
|
});
|
28
28
|
test('custom classname can be passed', function () {
|
29
29
|
getComponent({
|
30
30
|
className: 'testing-class'
|
31
31
|
});
|
32
|
-
var
|
33
|
-
expect(
|
32
|
+
var collapsiblePanelBadge = screen.getByTestId(testId);
|
33
|
+
expect(collapsiblePanelBadge).toHaveClass('testing-class');
|
34
34
|
});
|
@@ -20,16 +20,16 @@ import PropTypes from 'prop-types';
|
|
20
20
|
import ChevronRightIcon from 'mdi-react/ChevronRightIcon';
|
21
21
|
import ChevronLeftIcon from 'mdi-react/ChevronLeftIcon';
|
22
22
|
import { useOverlayTriggerState } from '@react-stately/overlays';
|
23
|
-
import
|
23
|
+
import CollapsiblePanelBadge from './CollapsiblePanelBadge';
|
24
24
|
import { Icon, IconButton, Box } from '../../index';
|
25
25
|
import { useStatusClasses } from '../../hooks';
|
26
26
|
/**
|
27
|
-
* The
|
27
|
+
* The CollapsiblePanelContainer serves as a wrapper around a list and its associated trigger,
|
28
28
|
* linking the list's open state with the trigger's press state and providing necessary context.
|
29
29
|
*/
|
30
30
|
|
31
31
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
32
|
-
var
|
32
|
+
var CollapsiblePanelContainer = /*#__PURE__*/forwardRef(function (props, ref) {
|
33
33
|
var selectedFilterCount = props.selectedFilterCount,
|
34
34
|
className = props.className,
|
35
35
|
children = props.children,
|
@@ -71,28 +71,28 @@ var MultiselectListContainer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
71
71
|
className: classNames,
|
72
72
|
onKeyUp: handleClose,
|
73
73
|
ref: ref,
|
74
|
-
variant: "
|
74
|
+
variant: "collapsiblePanel.collapsiblePanelContainer",
|
75
75
|
isRow: true
|
76
76
|
}, others), ___EmotionJSX(IconButton, {
|
77
77
|
isRow: true,
|
78
78
|
"aria-label": state.isOpen ? closeAriaLabel : openAriaLabel,
|
79
|
-
"data-testid": "
|
79
|
+
"data-testid": "collapsible-panel-button",
|
80
80
|
onPress: handleButtonPress,
|
81
81
|
ref: triggerRef,
|
82
|
-
variant: "
|
82
|
+
variant: "collapsiblePanelToggle",
|
83
83
|
pr: "sm"
|
84
84
|
}, ___EmotionJSX(Icon, {
|
85
85
|
color: "active",
|
86
86
|
icon: state.isOpen ? ChevronRightIcon : ChevronLeftIcon,
|
87
87
|
role: "button",
|
88
88
|
size: "30px"
|
89
|
-
}), !state.isOpen && selectedFilterCount && ___EmotionJSX(
|
90
|
-
"data-testid": "
|
89
|
+
}), !state.isOpen && selectedFilterCount && ___EmotionJSX(CollapsiblePanelBadge, {
|
90
|
+
"data-testid": "collapsible-panel-badge",
|
91
91
|
margin: "auto",
|
92
92
|
selectedFilterCount: selectedFilterCount
|
93
93
|
})), state.isOpen && _objectSpread({}, children));
|
94
94
|
});
|
95
|
-
|
95
|
+
CollapsiblePanelContainer.propTypes = {
|
96
96
|
/** Amount of selected items indicator. */
|
97
97
|
selectedFilterCount: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
98
98
|
|
@@ -116,9 +116,9 @@ MultiselectListContainer.propTypes = {
|
|
116
116
|
/** Defines a string value that labels the trigger icon when menu is closed. */
|
117
117
|
openAriaLabel: PropTypes.string
|
118
118
|
};
|
119
|
-
|
119
|
+
CollapsiblePanelContainer.defaultProps = {
|
120
120
|
openAriaLabel: 'Open filter menu?',
|
121
121
|
closeAriaLabel: 'Close filter menu?'
|
122
122
|
};
|
123
|
-
|
124
|
-
export default
|
123
|
+
CollapsiblePanelContainer.displayName = 'CollapsiblePanelContainer';
|
124
|
+
export default CollapsiblePanelContainer;
|
@@ -3,20 +3,20 @@ import React from 'react';
|
|
3
3
|
import userEvent from '@testing-library/user-event';
|
4
4
|
import axeTest from '../../utils/testUtils/testAxe';
|
5
5
|
import { render, screen } from '../../utils/testUtils/testWrapper';
|
6
|
-
import
|
6
|
+
import CollapsiblePanelContainer from './CollapsiblePanelContainer';
|
7
7
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
8
|
-
var testId = 'test-
|
9
|
-
var
|
10
|
-
var
|
11
|
-
var
|
8
|
+
var testId = 'test-collapsiblePanelContainer';
|
9
|
+
var collapsiblePanelBadgeId = 'collapsible-panel-badge';
|
10
|
+
var collapsiblePanelButtonId = 'collapsible-panel-button';
|
11
|
+
var collapsiblePanelId = 'collapsible-panel';
|
12
12
|
var defaultProps = {
|
13
13
|
'data-testid': testId
|
14
14
|
};
|
15
15
|
|
16
16
|
var getComponent = function getComponent() {
|
17
17
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
18
|
-
return render(___EmotionJSX(
|
19
|
-
"data-testid":
|
18
|
+
return render(___EmotionJSX(CollapsiblePanelContainer, _extends({}, defaultProps, props), ___EmotionJSX("div", {
|
19
|
+
"data-testid": collapsiblePanelId
|
20
20
|
})));
|
21
21
|
};
|
22
22
|
|
@@ -25,17 +25,17 @@ afterEach(function () {
|
|
25
25
|
}); // Need to be added to each test file to test accessibility using axe.
|
26
26
|
|
27
27
|
axeTest(getComponent);
|
28
|
-
test('default
|
28
|
+
test('default CollapsiblePanelContainer', function () {
|
29
29
|
getComponent();
|
30
|
-
var
|
31
|
-
expect(
|
30
|
+
var collapsiblePanelContainer = screen.getByTestId(testId);
|
31
|
+
expect(collapsiblePanelContainer).toBeInTheDocument();
|
32
32
|
});
|
33
33
|
test('custom classname can be passed', function () {
|
34
34
|
getComponent({
|
35
35
|
className: 'testing-class'
|
36
36
|
});
|
37
|
-
var
|
38
|
-
expect(
|
37
|
+
var collapsiblePanelContainer = screen.getByTestId(testId);
|
38
|
+
expect(collapsiblePanelContainer).toHaveClass('testing-class');
|
39
39
|
});
|
40
40
|
test('shows badge when container is closed', function () {
|
41
41
|
getComponent({
|
@@ -44,7 +44,7 @@ test('shows badge when container is closed', function () {
|
|
44
44
|
isOpen: false
|
45
45
|
}
|
46
46
|
});
|
47
|
-
var badge = screen.getByTestId(
|
47
|
+
var badge = screen.getByTestId(collapsiblePanelBadgeId);
|
48
48
|
expect(badge).toBeInTheDocument();
|
49
49
|
});
|
50
50
|
test('updates aria label when button is clicked', function () {
|
@@ -54,28 +54,28 @@ test('updates aria label when button is clicked', function () {
|
|
54
54
|
getComponent({
|
55
55
|
state: state
|
56
56
|
});
|
57
|
-
var button = screen.getByTestId(
|
57
|
+
var button = screen.getByTestId(collapsiblePanelButtonId);
|
58
58
|
userEvent.click(button);
|
59
|
-
var
|
59
|
+
var collapsiblePanel = screen.queryByTestId(collapsiblePanelId);
|
60
60
|
expect(button).toHaveAttribute('aria-label', 'Close filter menu?');
|
61
|
-
expect(
|
61
|
+
expect(collapsiblePanel).toBeInTheDocument();
|
62
62
|
userEvent.click(button);
|
63
63
|
expect(button).toHaveAttribute('aria-label', 'Open filter menu?');
|
64
|
-
expect(
|
64
|
+
expect(collapsiblePanel).not.toBeInTheDocument();
|
65
65
|
});
|
66
66
|
test('shows children when isOpen is true', function () {
|
67
67
|
getComponent({
|
68
68
|
isOpen: true
|
69
69
|
});
|
70
|
-
var
|
71
|
-
expect(
|
70
|
+
var collapsiblePanel = screen.getByTestId(collapsiblePanelId);
|
71
|
+
expect(collapsiblePanel).toBeInTheDocument();
|
72
72
|
});
|
73
73
|
test('should hide children when pressing the escape key', function () {
|
74
74
|
getComponent();
|
75
|
-
var button = screen.getByTestId(
|
75
|
+
var button = screen.getByTestId(collapsiblePanelButtonId);
|
76
76
|
userEvent.click(button);
|
77
|
-
var
|
78
|
-
expect(
|
77
|
+
var collapsiblePanel = screen.queryByTestId(collapsiblePanelId);
|
78
|
+
expect(collapsiblePanel).toBeInTheDocument();
|
79
79
|
userEvent.type(button, '{esc}');
|
80
|
-
expect(
|
80
|
+
expect(collapsiblePanel).not.toBeInTheDocument();
|
81
81
|
});
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './CollapsiblePanelContainer';
|
@@ -2,25 +2,25 @@ import React, { forwardRef } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
3
3
|
import { Box, Icon, IconButton, Text } from '../../index';
|
4
4
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
5
|
-
var
|
5
|
+
var CollapsiblePanelItem = /*#__PURE__*/forwardRef(function (props, ref) {
|
6
6
|
var text = props.text,
|
7
7
|
icon = props.icon,
|
8
8
|
isDefaultSelected = props.isDefaultSelected,
|
9
9
|
onPress = props.onPress;
|
10
10
|
|
11
11
|
var iconElement = icon && ___EmotionJSX(Icon, {
|
12
|
-
"data-testid": "
|
12
|
+
"data-testid": "collapsible-panel-data-icon",
|
13
13
|
icon: icon,
|
14
14
|
color: isDefaultSelected ? 'neutral.10' : 'active',
|
15
15
|
size: 13
|
16
16
|
});
|
17
17
|
|
18
18
|
return ___EmotionJSX(Box, {
|
19
|
-
"data-testid": "
|
19
|
+
"data-testid": "collapsible-panel-item",
|
20
20
|
isRow: true,
|
21
21
|
ref: ref
|
22
22
|
}, ___EmotionJSX(Text, {
|
23
|
-
variant: "
|
23
|
+
variant: "collapsiblePanellItem"
|
24
24
|
}, text), iconElement && (isDefaultSelected ? iconElement : ___EmotionJSX(IconButton, {
|
25
25
|
sx: {
|
26
26
|
width: 13,
|
@@ -33,7 +33,7 @@ var MultiselectFilterItem = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
33
33
|
onPress: onPress
|
34
34
|
}, iconElement)));
|
35
35
|
});
|
36
|
-
|
36
|
+
CollapsiblePanelItem.propTypes = {
|
37
37
|
/**
|
38
38
|
* Display text.
|
39
39
|
*/
|
@@ -55,5 +55,5 @@ MultiselectFilterItem.propTypes = {
|
|
55
55
|
*/
|
56
56
|
onPress: PropTypes.func
|
57
57
|
};
|
58
|
-
|
59
|
-
export default
|
58
|
+
CollapsiblePanelItem.displayName = 'CollapsiblePanelItem';
|
59
|
+
export default CollapsiblePanelItem;
|
@@ -3,17 +3,17 @@ import React from 'react';
|
|
3
3
|
import FilterIcon from 'mdi-react/FilterIcon';
|
4
4
|
import axeTest from '../../utils/testUtils/testAxe';
|
5
5
|
import { render, screen } from '../../utils/testUtils/testWrapper';
|
6
|
-
import
|
6
|
+
import CollapsiblePanelItem from './CollapsiblePanelItem';
|
7
7
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
8
|
-
var testId = '
|
9
|
-
var iconId = '
|
8
|
+
var testId = 'collapsible-panel-item';
|
9
|
+
var iconId = 'collapsible-panel-data-icon';
|
10
10
|
var defaultProps = {
|
11
11
|
text: 'Item name'
|
12
12
|
};
|
13
13
|
|
14
14
|
var getComponent = function getComponent() {
|
15
15
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
16
|
-
return render(___EmotionJSX(
|
16
|
+
return render(___EmotionJSX(CollapsiblePanelItem, _extends({}, defaultProps, props)));
|
17
17
|
};
|
18
18
|
|
19
19
|
afterEach(function () {
|
@@ -21,12 +21,12 @@ afterEach(function () {
|
|
21
21
|
}); // Need to be added to each test file to test accessibility using axe.
|
22
22
|
|
23
23
|
axeTest(getComponent);
|
24
|
-
test('default
|
24
|
+
test('default collapsiblePanel', function () {
|
25
25
|
getComponent();
|
26
|
-
var
|
26
|
+
var collapsiblePanelItem = screen.getByTestId(testId);
|
27
27
|
var icon = screen.queryByTestId(iconId);
|
28
28
|
expect(icon).not.toBeInTheDocument();
|
29
|
-
expect(
|
29
|
+
expect(collapsiblePanelItem).toBeInTheDocument();
|
30
30
|
});
|
31
31
|
test('icon button displays when icon prop is present', function () {
|
32
32
|
getComponent({
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './CollapsiblePanelItem';
|
@@ -75,6 +75,7 @@ var ComboBoxField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
75
75
|
isNotFlippable = props.isNotFlippable,
|
76
76
|
direction = props.direction,
|
77
77
|
scrollBoxProps = props.scrollBoxProps,
|
78
|
+
controlProps = props.controlProps,
|
78
79
|
defaultFilter = props.defaultFilter;
|
79
80
|
var comboBoxOptions = {
|
80
81
|
children: children,
|
@@ -192,6 +193,11 @@ var ComboBoxField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
192
193
|
});
|
193
194
|
useLayoutEffect(onResize, [onResize]);
|
194
195
|
|
196
|
+
var handleInputOpen = function handleInputOpen(e) {
|
197
|
+
if (!state.isOpen && menuTrigger === 'focus') buttonRef.current.click();
|
198
|
+
if (controlProps !== null && controlProps !== void 0 && controlProps.onClick) controlProps.onClick(e);
|
199
|
+
};
|
200
|
+
|
195
201
|
var style = _objectSpread(_objectSpread({}, overlayProps.style), {}, {
|
196
202
|
width: menuWidth,
|
197
203
|
minWidth: menuWidth
|
@@ -221,7 +227,10 @@ var ComboBoxField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
221
227
|
labelProps: labelProps,
|
222
228
|
inputRef: inputRef,
|
223
229
|
triggerProps: buttonProps,
|
224
|
-
triggerRef: buttonRef
|
230
|
+
triggerRef: buttonRef,
|
231
|
+
controlProps: _objectSpread(_objectSpread({}, controlProps), {}, {
|
232
|
+
onClick: handleInputOpen
|
233
|
+
})
|
225
234
|
})), ___EmotionJSX(PopoverContainer, {
|
226
235
|
isOpen: state.isOpen,
|
227
236
|
ref: popoverRef,
|
@@ -369,6 +378,11 @@ ComboBoxField.propTypes = {
|
|
369
378
|
/** @ignore */
|
370
379
|
scrollBoxProps: PropTypes.shape({
|
371
380
|
maxHeight: PropTypes.string
|
381
|
+
}),
|
382
|
+
|
383
|
+
/** Props object that is spread directly into the ComboBoxInput element. */
|
384
|
+
controlProps: PropTypes.shape({
|
385
|
+
onClick: PropTypes.func
|
372
386
|
})
|
373
387
|
};
|
374
388
|
ComboBoxField.defaultProps = {
|
@@ -227,6 +227,20 @@ test('should open list on focus when menuTrigger is set to use focus', function
|
|
227
227
|
expect(screen.queryByRole('listbox')).toBeInTheDocument();
|
228
228
|
expect(screen.queryAllByRole('option')).toHaveLength(items.length);
|
229
229
|
});
|
230
|
+
test('should open list on focus on click after selection when menuTrigger is set to use focus', function () {
|
231
|
+
getComponent({
|
232
|
+
menuTrigger: 'focus'
|
233
|
+
});
|
234
|
+
var input = screen.getByRole('combobox');
|
235
|
+
expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
|
236
|
+
userEvent.click(input);
|
237
|
+
expect(screen.queryByRole('listbox')).toBeInTheDocument();
|
238
|
+
userEvent.click(screen.queryAllByRole('option')[0]);
|
239
|
+
expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
|
240
|
+
expect(input).toHaveFocus();
|
241
|
+
userEvent.click(input);
|
242
|
+
expect(screen.queryByRole('listbox')).toBeInTheDocument();
|
243
|
+
});
|
230
244
|
test('Item accepts a data-id and the data-id can be found in the DOM', function () {
|
231
245
|
getComponent();
|
232
246
|
var button = screen.queryByRole('button');
|
package/lib/index.js
CHANGED
@@ -72,12 +72,12 @@ export { default as Messages } from './components/Messages';
|
|
72
72
|
export * from './components/Messages';
|
73
73
|
export { default as Modal } from './components/Modal';
|
74
74
|
export * from './components/Modal';
|
75
|
-
export { default as
|
76
|
-
export * from './components/
|
77
|
-
export { default as
|
78
|
-
export * from './components/
|
79
|
-
export { default as
|
80
|
-
export * from './components/
|
75
|
+
export { default as CollapsiblePanel } from './components/CollapsiblePanel';
|
76
|
+
export * from './components/CollapsiblePanel';
|
77
|
+
export { default as CollapsiblePanelItem } from './components/CollapsiblePanelItem';
|
78
|
+
export * from './components/CollapsiblePanelItem';
|
79
|
+
export { default as CollapsiblePanelContainer } from './components/CollapsiblePanelContainer';
|
80
|
+
export * from './components/CollapsiblePanelContainer';
|
81
81
|
export { default as NavBar } from './components/NavBar';
|
82
82
|
export * from './components/NavBar';
|
83
83
|
export { default as NavBarSection } from './components/NavBarSection';
|
@@ -24,10 +24,10 @@ import CheckIcon from 'mdi-react/CheckIcon';
|
|
24
24
|
import Clear from 'mdi-react/CloseIcon';
|
25
25
|
import ChevronRightIcon from 'mdi-react/ChevronRightIcon';
|
26
26
|
import SearchIcon from 'mdi-react/SearchIcon';
|
27
|
-
import { Breadcrumbs, Box, CheckboxField, Chip, Icon, IconButton, Item, ListView,
|
27
|
+
import { Breadcrumbs, Box, CheckboxField, Chip, Icon, IconButton, Item, ListView, CollapsiblePanel, CollapsiblePanelItem, SearchField, Text } from '..';
|
28
28
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
29
29
|
export default {
|
30
|
-
title: 'Recipes/
|
30
|
+
title: 'Recipes/CollapsiblePanel with List'
|
31
31
|
};
|
32
32
|
var data = [{
|
33
33
|
id: '1',
|
@@ -283,7 +283,7 @@ export var Default = function Default() {
|
|
283
283
|
return el.key === item.key;
|
284
284
|
})
|
285
285
|
}));
|
286
|
-
})), ___EmotionJSX(
|
286
|
+
})), ___EmotionJSX(CollapsiblePanel, {
|
287
287
|
items: selectedItems,
|
288
288
|
selectedFilterCount: selectedItems.length.toString(),
|
289
289
|
listTitle: "Selected Groups",
|
@@ -294,7 +294,7 @@ export var Default = function Default() {
|
|
294
294
|
key: item.key,
|
295
295
|
textValue: item.name,
|
296
296
|
"data-id": item.key
|
297
|
-
}, ___EmotionJSX(
|
297
|
+
}, ___EmotionJSX(CollapsiblePanelItem, {
|
298
298
|
text: item.name,
|
299
299
|
icon: item.isDefaultSelected ? CheckIcon : Clear,
|
300
300
|
isDefaultSelected: item.isDefaultSelected,
|
@@ -126,7 +126,7 @@ var modalCloseButton = _objectSpread(_objectSpread({}, iconButton), {}, {
|
|
126
126
|
right: 10
|
127
127
|
});
|
128
128
|
|
129
|
-
var
|
129
|
+
var collapsiblePanelToggle = _objectSpread(_objectSpread({}, square), {}, {
|
130
130
|
bg: 'accent.99',
|
131
131
|
height: '40px',
|
132
132
|
minWidth: 'max-content',
|
@@ -700,6 +700,6 @@ export default {
|
|
700
700
|
tooltipInline: tooltipInline,
|
701
701
|
colorBlock: colorBlock,
|
702
702
|
menuTab: menuTab,
|
703
|
-
|
703
|
+
collapsiblePanelToggle: collapsiblePanelToggle,
|
704
704
|
neutralText: neutralText
|
705
705
|
};
|