@pingux/astro 1.4.2-alpha.1 → 1.5.0-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/CodeView/CodeView.js +1 -1
- package/lib/cjs/components/CodeView/CodeView.test.js +22 -27
- package/lib/cjs/components/CopyText/CopyText.js +1 -1
- package/lib/cjs/components/ListView/ListView.js +12 -13
- package/lib/cjs/components/ListView/ListView.test.js +8 -8
- package/lib/cjs/components/ListViewItem/ListViewItem.js +0 -2
- package/lib/cjs/components/MultiselectFilter/MultiselectFilter.js +143 -0
- package/lib/cjs/components/MultiselectFilter/MultiselectFilter.stories.js +283 -0
- package/lib/cjs/components/MultiselectFilter/MultiselectFilter.test.js +83 -0
- package/lib/cjs/components/MultiselectFilter/index.js +18 -0
- package/lib/cjs/components/MultiselectFilterItem/MultiselectFilterItem.js +55 -0
- package/lib/cjs/components/MultiselectFilterItem/MultiselectFilterItem.test.js +53 -0
- package/lib/cjs/components/MultiselectFilterItem/index.js +18 -0
- package/lib/cjs/components/MultiselectListContainer/MultiselectBadge.js +47 -0
- package/lib/cjs/components/MultiselectListContainer/MultiselectBadge.test.js +48 -0
- package/lib/cjs/components/MultiselectListContainer/MultiselectListContainer.js +157 -0
- package/lib/cjs/components/MultiselectListContainer/MultiselectListContainer.test.js +112 -0
- package/lib/cjs/components/MultiselectListContainer/index.js +18 -0
- package/lib/cjs/components/PopoverMenu/PopoverMenu.js +7 -2
- package/lib/cjs/components/Tab/Tab.js +22 -15
- package/lib/cjs/components/TabPicker/TabPicker.js +239 -0
- package/lib/cjs/components/TabPicker/index.js +18 -0
- package/lib/cjs/components/Tabs/Tabs.js +46 -13
- package/lib/cjs/components/Tabs/Tabs.stories.js +32 -2
- package/lib/cjs/components/Tabs/Tabs.test.js +183 -32
- package/lib/cjs/index.js +98 -32
- package/lib/cjs/styles/variants/buttons.js +38 -1
- package/lib/cjs/styles/variants/codeView.js +2 -1
- package/lib/cjs/styles/variants/multiselectListContainer.js +73 -0
- package/lib/cjs/styles/variants/tabs.js +5 -1
- package/lib/cjs/styles/variants/text.js +29 -2
- package/lib/cjs/styles/variants/variants.js +3 -0
- package/lib/components/CodeView/CodeView.js +1 -1
- package/lib/components/CodeView/CodeView.test.js +22 -23
- package/lib/components/CopyText/CopyText.js +1 -1
- package/lib/components/ListView/ListView.js +12 -13
- package/lib/components/ListView/ListView.test.js +8 -8
- package/lib/components/ListViewItem/ListViewItem.js +0 -2
- package/lib/components/MultiselectFilter/MultiselectFilter.js +118 -0
- package/lib/components/MultiselectFilter/MultiselectFilter.stories.js +251 -0
- package/lib/components/MultiselectFilter/MultiselectFilter.test.js +69 -0
- package/lib/components/MultiselectFilter/index.js +1 -0
- package/lib/components/MultiselectFilterItem/MultiselectFilterItem.js +36 -0
- package/lib/components/MultiselectFilterItem/MultiselectFilterItem.test.js +37 -0
- package/lib/components/MultiselectFilterItem/index.js +1 -0
- package/lib/components/MultiselectListContainer/MultiselectBadge.js +31 -0
- package/lib/components/MultiselectListContainer/MultiselectBadge.test.js +34 -0
- package/lib/components/MultiselectListContainer/MultiselectListContainer.js +123 -0
- package/lib/components/MultiselectListContainer/MultiselectListContainer.test.js +81 -0
- package/lib/components/MultiselectListContainer/index.js +1 -0
- package/lib/components/PopoverMenu/PopoverMenu.js +7 -2
- package/lib/components/Tab/Tab.js +14 -8
- package/lib/components/TabPicker/TabPicker.js +210 -0
- package/lib/components/TabPicker/index.js +1 -0
- package/lib/components/Tabs/Tabs.js +44 -11
- package/lib/components/Tabs/Tabs.stories.js +27 -0
- package/lib/components/Tabs/Tabs.test.js +165 -32
- package/lib/index.js +6 -0
- package/lib/styles/variants/buttons.js +38 -1
- package/lib/styles/variants/codeView.js +2 -1
- package/lib/styles/variants/multiselectListContainer.js +63 -0
- package/lib/styles/variants/tabs.js +5 -1
- package/lib/styles/variants/text.js +29 -2
- package/lib/styles/variants/variants.js +2 -0
- package/package.json +1 -1
@@ -1,20 +1,21 @@
|
|
1
1
|
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
2
2
|
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
3
3
|
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
4
|
-
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
5
4
|
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
6
|
-
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
7
5
|
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
8
6
|
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
9
7
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
10
8
|
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
11
|
-
import
|
9
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
12
10
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
11
|
+
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
12
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
13
|
+
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
13
14
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
14
15
|
|
15
16
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); if (enumerableOnly) symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
16
17
|
|
17
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var
|
18
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context6; _forEachInstanceProperty(_context6 = ownKeys(Object(source), true)).call(_context6, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context7; _forEachInstanceProperty(_context7 = ownKeys(Object(source))).call(_context7, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
18
19
|
|
19
20
|
import React, { forwardRef, useImperativeHandle, useRef } from 'react';
|
20
21
|
import PropTypes from 'prop-types';
|
@@ -27,16 +28,17 @@ import { usePropWarning } from '../../hooks';
|
|
27
28
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
28
29
|
export var TabsContext = /*#__PURE__*/React.createContext({});
|
29
30
|
var Tabs = /*#__PURE__*/forwardRef(function (props, ref) {
|
30
|
-
var
|
31
|
+
var _context4, _context5;
|
31
32
|
|
32
33
|
var children = props.children,
|
33
34
|
isDisabled = props.isDisabled,
|
35
|
+
items = props.items,
|
34
36
|
onSelectionChange = props.onSelectionChange,
|
35
37
|
orientation = props.orientation,
|
36
38
|
mode = props.mode,
|
37
39
|
tabListProps = props.tabListProps,
|
38
40
|
tabPanelProps = props.tabPanelProps,
|
39
|
-
others = _objectWithoutProperties(props, ["children", "isDisabled", "onSelectionChange", "orientation", "mode", "tabListProps", "tabPanelProps"]);
|
41
|
+
others = _objectWithoutProperties(props, ["children", "isDisabled", "items", "onSelectionChange", "orientation", "mode", "tabListProps", "tabPanelProps"]);
|
40
42
|
|
41
43
|
var tabListRef = useRef();
|
42
44
|
usePropWarning(props, 'disabled', 'isDisabled');
|
@@ -51,8 +53,31 @@ var Tabs = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
51
53
|
useImperativeHandle(ref, function () {
|
52
54
|
return tabPanelRef.current;
|
53
55
|
});
|
56
|
+
var allItems = [];
|
57
|
+
|
58
|
+
if (mode === 'list') {
|
59
|
+
_forEachInstanceProperty(items).call(items, function (item) {
|
60
|
+
var _context;
|
61
|
+
|
62
|
+
allItems = _concatInstanceProperty(_context = []).call(_context, allItems, [item]);
|
63
|
+
|
64
|
+
if (item.list) {
|
65
|
+
var _context2, _context3;
|
66
|
+
|
67
|
+
var list = _mapInstanceProperty(_context2 = item.list).call(_context2, function (el) {
|
68
|
+
return _objectSpread(_objectSpread({}, el), {}, {
|
69
|
+
isListItem: true
|
70
|
+
});
|
71
|
+
});
|
72
|
+
|
73
|
+
allItems = _concatInstanceProperty(_context3 = []).call(_context3, allItems, list);
|
74
|
+
}
|
75
|
+
});
|
76
|
+
}
|
77
|
+
|
54
78
|
var state = useTabListState(_objectSpread(_objectSpread({}, props), {}, {
|
55
|
-
onSelectionChange: onSelectionChange
|
79
|
+
onSelectionChange: onSelectionChange,
|
80
|
+
items: mode === 'list' ? allItems : items
|
56
81
|
}));
|
57
82
|
|
58
83
|
var _useTabList = useTabList(props, state, tabListRef),
|
@@ -70,7 +95,11 @@ var Tabs = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
70
95
|
isRow: orientation === ORIENTATION.HORIZONTAL
|
71
96
|
}, tabListProps, raTabListProps, {
|
72
97
|
ref: tabListRef
|
73
|
-
}), _mapInstanceProperty(
|
98
|
+
}), _mapInstanceProperty(_context4 = _filterInstanceProperty(_context5 = _Array$from(state.collection)).call(_context5, function (item) {
|
99
|
+
var _item$value;
|
100
|
+
|
101
|
+
return !(item === null || item === void 0 ? void 0 : (_item$value = item.value) === null || _item$value === void 0 ? void 0 : _item$value.isListItem);
|
102
|
+
})).call(_context4, function (item) {
|
74
103
|
var _item$props;
|
75
104
|
|
76
105
|
return ___EmotionJSX(CollectionTab, {
|
@@ -100,7 +129,7 @@ Tabs.propTypes = {
|
|
100
129
|
orientation: PropTypes.oneOf(['horizontal', 'vertical']),
|
101
130
|
|
102
131
|
/** Determines the behavior model for the tabs. */
|
103
|
-
mode: PropTypes.oneOf(['default', 'tooltip']),
|
132
|
+
mode: PropTypes.oneOf(['default', 'tooltip', 'list']),
|
104
133
|
|
105
134
|
/**
|
106
135
|
* *For performance reasons, use this prop instead of Array.map when iteratively rendering Items*.
|
@@ -118,12 +147,16 @@ Tabs.propTypes = {
|
|
118
147
|
tabListProps: PropTypes.shape({}),
|
119
148
|
|
120
149
|
/** Props object that is spread directly into all of the tab panel wrapper elements. */
|
121
|
-
tabPanelProps: PropTypes.shape({})
|
150
|
+
tabPanelProps: PropTypes.shape({}),
|
151
|
+
|
152
|
+
/** Whether tabs are activated automatically on focus or manually¸ */
|
153
|
+
keyboardActivation: PropTypes.oneOf(['automatic', 'manual'])
|
122
154
|
};
|
123
155
|
Tabs.defaultProps = {
|
124
156
|
isDisabled: false,
|
125
157
|
orientation: 'horizontal',
|
126
|
-
mode: 'default'
|
158
|
+
mode: 'default',
|
159
|
+
keyboardActivation: 'manual'
|
127
160
|
};
|
128
161
|
Tabs.displayName = 'Tabs';
|
129
162
|
export default Tabs;
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
1
2
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
2
3
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
3
4
|
import React, { useState } from 'react';
|
@@ -225,4 +226,30 @@ export var ContentSlots = function ContentSlots() {
|
|
225
226
|
afterTab: afterTabNode
|
226
227
|
}
|
227
228
|
}, ___EmotionJSX(Text, null, "Users Matched"))));
|
229
|
+
};
|
230
|
+
export var WithList = function WithList() {
|
231
|
+
var _context;
|
232
|
+
|
233
|
+
var allTabs = _concatInstanceProperty(_context = []).call(_context, tabs, [{
|
234
|
+
name: 'Tab 4',
|
235
|
+
list: [{
|
236
|
+
key: 'tab1list',
|
237
|
+
name: 'Tab 1 list',
|
238
|
+
children: 'Tab 1 from list'
|
239
|
+
}, {
|
240
|
+
key: 'tab2list',
|
241
|
+
name: 'Tab 2 list',
|
242
|
+
children: 'Tab 2 from list'
|
243
|
+
}]
|
244
|
+
}]);
|
245
|
+
|
246
|
+
return ___EmotionJSX(Tabs, {
|
247
|
+
items: allTabs,
|
248
|
+
mode: "list"
|
249
|
+
}, function (item) {
|
250
|
+
return ___EmotionJSX(Tab, _extends({
|
251
|
+
key: item.name,
|
252
|
+
title: item.name
|
253
|
+
}, item), item.children);
|
254
|
+
});
|
228
255
|
};
|
@@ -4,6 +4,7 @@ import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerat
|
|
4
4
|
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
5
5
|
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
6
6
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
7
|
+
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
7
8
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
8
9
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
9
10
|
import React from 'react';
|
@@ -33,6 +34,21 @@ var defaultTabs = [{
|
|
33
34
|
name: 'Tab 3',
|
34
35
|
children: 'Tab 3 body'
|
35
36
|
}];
|
37
|
+
var tabsWithList = [{
|
38
|
+
name: 'Tab 1',
|
39
|
+
children: 'Tab 1 body'
|
40
|
+
}, {
|
41
|
+
name: 'Tab 2',
|
42
|
+
list: [{
|
43
|
+
key: 'tab1list',
|
44
|
+
name: 'Tab 1 list',
|
45
|
+
children: 'Tab 1 from list'
|
46
|
+
}, {
|
47
|
+
key: 'tab2list',
|
48
|
+
name: 'Tab 2 list',
|
49
|
+
children: 'Tab 2 from list'
|
50
|
+
}]
|
51
|
+
}];
|
36
52
|
var defaultProps = {
|
37
53
|
'data-testid': testId,
|
38
54
|
defaultSelectedKey: defaultTabs[0].name
|
@@ -60,6 +76,21 @@ var getComponent = function getComponent() {
|
|
60
76
|
}))));
|
61
77
|
};
|
62
78
|
|
79
|
+
var getComponentWithDynamicItems = function getComponentWithDynamicItems(props) {
|
80
|
+
return render(___EmotionJSX(CacheProvider, {
|
81
|
+
value: emotionCache
|
82
|
+
}, ___EmotionJSX(Tabs, props, function (_ref3) {
|
83
|
+
var name = _ref3.name,
|
84
|
+
children = _ref3.children,
|
85
|
+
tabProps = _objectWithoutProperties(_ref3, ["name", "children"]);
|
86
|
+
|
87
|
+
return ___EmotionJSX(Tab, _extends({
|
88
|
+
key: name,
|
89
|
+
title: name
|
90
|
+
}, tabProps), children);
|
91
|
+
})));
|
92
|
+
};
|
93
|
+
|
63
94
|
var getTabs = function getTabs() {
|
64
95
|
var tabs = screen.queryAllByRole('tab');
|
65
96
|
|
@@ -77,8 +108,8 @@ var getTabs = function getTabs() {
|
|
77
108
|
};
|
78
109
|
|
79
110
|
var testTabPanel = function testTabPanel(expectedTabIndex) {
|
80
|
-
return _forEachInstanceProperty(defaultTabs).call(defaultTabs, function (
|
81
|
-
var children =
|
111
|
+
return _forEachInstanceProperty(defaultTabs).call(defaultTabs, function (_ref4, index) {
|
112
|
+
var children = _ref4.children;
|
82
113
|
return index === expectedTabIndex ? expect(screen.queryByText(children)).toBeInTheDocument() : expect(screen.queryByText(children)).not.toBeInTheDocument();
|
83
114
|
});
|
84
115
|
};
|
@@ -138,7 +169,7 @@ test('interacting with tabs via click', function () {
|
|
138
169
|
testSingleTab(tabs, tab0, 'toContainElement', [screen.getByRole('presentation')]);
|
139
170
|
testTabPanel(0);
|
140
171
|
});
|
141
|
-
test('interacting with tabs
|
172
|
+
test('interacting with tabs with manual activation', function () {
|
142
173
|
getComponent();
|
143
174
|
|
144
175
|
var _getTabs2 = getTabs(),
|
@@ -150,6 +181,36 @@ test('interacting with tabs via focus -- horizontal', function () {
|
|
150
181
|
return expect(tab).not.toHaveFocus();
|
151
182
|
});
|
152
183
|
|
184
|
+
userEvent.tab();
|
185
|
+
testSingleTab(tabs, tab0, 'toHaveFocus');
|
186
|
+
testTabPanel(0);
|
187
|
+
fireEvent.keyDown(tab0, {
|
188
|
+
key: 'ArrowRight',
|
189
|
+
code: 'ArrowRight'
|
190
|
+
});
|
191
|
+
testSingleTab(tabs, tab1, 'toHaveFocus');
|
192
|
+
testTabPanel(0);
|
193
|
+
fireEvent.keyDown(tab1, {
|
194
|
+
key: 'Enter',
|
195
|
+
code: 'Enter'
|
196
|
+
});
|
197
|
+
testSingleTab(tabs, tab1, 'toHaveFocus');
|
198
|
+
testTabPanel(1);
|
199
|
+
});
|
200
|
+
test('interacting with tabs via focus -- horizontal', function () {
|
201
|
+
getComponent({
|
202
|
+
keyboardActivation: 'automatic'
|
203
|
+
});
|
204
|
+
|
205
|
+
var _getTabs3 = getTabs(),
|
206
|
+
tabs = _getTabs3.tabs,
|
207
|
+
tab0 = _getTabs3.tab0,
|
208
|
+
tab1 = _getTabs3.tab1;
|
209
|
+
|
210
|
+
_forEachInstanceProperty(tabs).call(tabs, function (tab) {
|
211
|
+
return expect(tab).not.toHaveFocus();
|
212
|
+
});
|
213
|
+
|
153
214
|
userEvent.tab();
|
154
215
|
testSingleTab(tabs, tab0, 'toHaveFocus');
|
155
216
|
testTabPanel(0);
|
@@ -168,13 +229,14 @@ test('interacting with tabs via focus -- horizontal', function () {
|
|
168
229
|
});
|
169
230
|
test('interacting with tabs via focus -- vertical', function () {
|
170
231
|
getComponent({
|
171
|
-
orientation: 'vertical'
|
232
|
+
orientation: 'vertical',
|
233
|
+
keyboardActivation: 'automatic'
|
172
234
|
});
|
173
235
|
|
174
|
-
var
|
175
|
-
tabs =
|
176
|
-
tab0 =
|
177
|
-
tab1 =
|
236
|
+
var _getTabs4 = getTabs(),
|
237
|
+
tabs = _getTabs4.tabs,
|
238
|
+
tab0 = _getTabs4.tab0,
|
239
|
+
tab1 = _getTabs4.tab1;
|
178
240
|
|
179
241
|
_forEachInstanceProperty(tabs).call(tabs, function (tab) {
|
180
242
|
return expect(tab).not.toHaveFocus();
|
@@ -201,9 +263,9 @@ test('disabled all tabs', function () {
|
|
201
263
|
isDisabled: true
|
202
264
|
});
|
203
265
|
|
204
|
-
var
|
205
|
-
tab0 =
|
206
|
-
tab1 =
|
266
|
+
var _getTabs5 = getTabs(),
|
267
|
+
tab0 = _getTabs5.tab0,
|
268
|
+
tab1 = _getTabs5.tab1;
|
207
269
|
|
208
270
|
var tabLine = screen.queryByRole('presentation'); // Tabs cannot be DOM disabled so must check visuals
|
209
271
|
|
@@ -222,15 +284,16 @@ test('disabled all tabs', function () {
|
|
222
284
|
});
|
223
285
|
test('disabled tab is not accessible on click or focus', function () {
|
224
286
|
getComponent({
|
225
|
-
disabledKeys: [defaultTabs[1].name]
|
287
|
+
disabledKeys: [defaultTabs[1].name],
|
288
|
+
keyboardActivation: 'automatic'
|
226
289
|
});
|
227
290
|
testTabPanel(0);
|
228
291
|
|
229
|
-
var
|
230
|
-
tabs =
|
231
|
-
tab0 =
|
232
|
-
tab1 =
|
233
|
-
tab2 =
|
292
|
+
var _getTabs6 = getTabs(),
|
293
|
+
tabs = _getTabs6.tabs,
|
294
|
+
tab0 = _getTabs6.tab0,
|
295
|
+
tab1 = _getTabs6.tab1,
|
296
|
+
tab2 = _getTabs6.tab2; // Ensure that clicking a disabled tab does nothing
|
234
297
|
|
235
298
|
|
236
299
|
userEvent.click(tab1);
|
@@ -255,11 +318,11 @@ test('controlled tabs', function () {
|
|
255
318
|
}),
|
256
319
|
rerender = _getComponent.rerender;
|
257
320
|
|
258
|
-
var
|
259
|
-
tabs =
|
260
|
-
tab0 =
|
261
|
-
tab1 =
|
262
|
-
tab2 =
|
321
|
+
var _getTabs7 = getTabs(),
|
322
|
+
tabs = _getTabs7.tabs,
|
323
|
+
tab0 = _getTabs7.tab0,
|
324
|
+
tab1 = _getTabs7.tab1,
|
325
|
+
tab2 = _getTabs7.tab2; // Expect the second tab to be selected
|
263
326
|
|
264
327
|
|
265
328
|
expect(onSelectionChange).not.toHaveBeenCalled();
|
@@ -296,9 +359,9 @@ test('tab line props', function () {
|
|
296
359
|
}),
|
297
360
|
rerender = _getComponent2.rerender;
|
298
361
|
|
299
|
-
var
|
300
|
-
tabs =
|
301
|
-
tab0 =
|
362
|
+
var _getTabs8 = getTabs(),
|
363
|
+
tabs = _getTabs8.tabs,
|
364
|
+
tab0 = _getTabs8.tab0;
|
302
365
|
|
303
366
|
var tabLine = screen.getByRole('presentation'); // Expect the tab line to have a red background
|
304
367
|
|
@@ -327,16 +390,16 @@ test('tab with icon', function () {
|
|
327
390
|
tabs: newTabs
|
328
391
|
});
|
329
392
|
|
330
|
-
var
|
331
|
-
tabs =
|
332
|
-
tab0 =
|
393
|
+
var _getTabs9 = getTabs(),
|
394
|
+
tabs = _getTabs9.tabs,
|
395
|
+
tab0 = _getTabs9.tab0;
|
333
396
|
|
334
397
|
var icon = screen.getByTestId('icon'); // Expect the tab to have the given icon element
|
335
398
|
|
336
399
|
testSingleTab(tabs, tab0, 'toContainElement', [icon]);
|
337
400
|
});
|
338
401
|
test('tooltip renders on tab\'s hover in `tooltip` mode', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
339
|
-
var
|
402
|
+
var _getTabs10, tab0;
|
340
403
|
|
341
404
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
342
405
|
while (1) {
|
@@ -346,7 +409,7 @@ test('tooltip renders on tab\'s hover in `tooltip` mode', /*#__PURE__*/_asyncToG
|
|
346
409
|
mode: 'tooltip'
|
347
410
|
});
|
348
411
|
expect(screen.queryByRole('tooltip')).not.toBeInTheDocument();
|
349
|
-
|
412
|
+
_getTabs10 = getTabs(), tab0 = _getTabs10.tab0;
|
350
413
|
fireEvent.mouseMove(tab0);
|
351
414
|
fireEvent.mouseEnter(tab0);
|
352
415
|
|
@@ -370,8 +433,8 @@ test('tabs without selected keys show null tab panel content', function () {
|
|
370
433
|
test('hover tab style', function () {
|
371
434
|
getComponent();
|
372
435
|
|
373
|
-
var
|
374
|
-
tab0 =
|
436
|
+
var _getTabs11 = getTabs(),
|
437
|
+
tab0 = _getTabs11.tab0;
|
375
438
|
|
376
439
|
expect(tab0).not.toHaveClass('is-hovered');
|
377
440
|
userEvent.hover(tab0);
|
@@ -414,4 +477,74 @@ test('will render slots.afterTab if provided', function () {
|
|
414
477
|
tabs: tabs
|
415
478
|
});
|
416
479
|
expect(screen.getByText(testText)).toBeInTheDocument();
|
480
|
+
});
|
481
|
+
test('will render tab with list if provided', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
482
|
+
var _getTabs12, menuBtn, menuItems, firstListItemContent;
|
483
|
+
|
484
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
485
|
+
while (1) {
|
486
|
+
switch (_context2.prev = _context2.next) {
|
487
|
+
case 0:
|
488
|
+
getComponentWithDynamicItems({
|
489
|
+
items: tabsWithList,
|
490
|
+
mode: 'list'
|
491
|
+
});
|
492
|
+
testTabPanel(0);
|
493
|
+
_getTabs12 = getTabs(), menuBtn = _getTabs12.tab1.parentElement;
|
494
|
+
userEvent.click(menuBtn);
|
495
|
+
expect(screen.queryByRole('menu')).toBeInTheDocument();
|
496
|
+
testTabPanel(0);
|
497
|
+
menuItems = screen.queryAllByRole('menuitemradio');
|
498
|
+
expect(menuItems).toHaveLength(tabsWithList[1].list.length);
|
499
|
+
expect(menuItems[0]).not.toHaveFocus();
|
500
|
+
userEvent.click(menuItems[0]);
|
501
|
+
firstListItemContent = tabsWithList[1].list[0].children;
|
502
|
+
expect(screen.queryByRole('tabpanel')).toHaveTextContent(firstListItemContent);
|
503
|
+
expect(screen.queryByRole('menu')).not.toBeInTheDocument();
|
504
|
+
|
505
|
+
case 13:
|
506
|
+
case "end":
|
507
|
+
return _context2.stop();
|
508
|
+
}
|
509
|
+
}
|
510
|
+
}, _callee2);
|
511
|
+
})));
|
512
|
+
test('tab list is accessible via keyboard', function () {
|
513
|
+
getComponentWithDynamicItems({
|
514
|
+
items: tabsWithList,
|
515
|
+
mode: 'list'
|
516
|
+
});
|
517
|
+
|
518
|
+
var _getTabs13 = getTabs(),
|
519
|
+
tabs = _getTabs13.tabs,
|
520
|
+
tab0 = _getTabs13.tab0,
|
521
|
+
tab1 = _getTabs13.tab1;
|
522
|
+
|
523
|
+
_forEachInstanceProperty(tabs).call(tabs, function (tab) {
|
524
|
+
return expect(tab).not.toHaveFocus();
|
525
|
+
});
|
526
|
+
|
527
|
+
userEvent.tab();
|
528
|
+
testTabPanel(0);
|
529
|
+
fireEvent.keyDown(tab0, {
|
530
|
+
key: 'ArrowRight',
|
531
|
+
code: 'ArrowRight'
|
532
|
+
});
|
533
|
+
expect(tab1).toHaveFocus();
|
534
|
+
fireEvent.keyDown(tab1, {
|
535
|
+
key: 'Enter',
|
536
|
+
code: 'Enter'
|
537
|
+
});
|
538
|
+
expect(screen.queryByRole('menu')).toBeInTheDocument();
|
539
|
+
testTabPanel(0);
|
540
|
+
var menuItems = screen.queryAllByRole('menuitemradio');
|
541
|
+
expect(menuItems).toHaveLength(tabsWithList[1].list.length);
|
542
|
+
expect(menuItems[0]).toHaveFocus();
|
543
|
+
fireEvent.keyDown(menuItems[0], {
|
544
|
+
key: 'Enter',
|
545
|
+
code: 'Enter'
|
546
|
+
});
|
547
|
+
var firstListItemContent = tabsWithList[1].list[0].children;
|
548
|
+
expect(screen.queryByRole('tabpanel')).toHaveTextContent(firstListItemContent);
|
549
|
+
expect(screen.queryByRole('menu')).not.toBeInTheDocument();
|
417
550
|
});
|
package/lib/index.js
CHANGED
@@ -72,6 +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 MultiselectFilter } from './components/MultiselectFilter';
|
76
|
+
export * from './components/MultiselectFilter';
|
77
|
+
export { default as MultiselectFilterItem } from './components/MultiselectFilterItem';
|
78
|
+
export * from './components/MultiselectFilterItem';
|
79
|
+
export { default as MultiselectListContainer } from './components/MultiselectListContainer';
|
80
|
+
export * from './components/MultiselectListContainer';
|
75
81
|
export { default as NavBar } from './components/NavBar';
|
76
82
|
export * from './components/NavBar';
|
77
83
|
export { default as NavBarSection } from './components/NavBarSection';
|
@@ -125,6 +125,24 @@ var modalCloseButton = _objectSpread(_objectSpread({}, iconButton), {}, {
|
|
125
125
|
right: 10
|
126
126
|
});
|
127
127
|
|
128
|
+
var multiselectToggle = _objectSpread(_objectSpread({}, square), {}, {
|
129
|
+
bg: 'accent.99',
|
130
|
+
height: '40px',
|
131
|
+
minWidth: 'max-content',
|
132
|
+
pl: '0px',
|
133
|
+
ml: '10px',
|
134
|
+
path: {
|
135
|
+
fill: 'active'
|
136
|
+
},
|
137
|
+
'&.is-hovered': {
|
138
|
+
backgroundColor: 'accent.99'
|
139
|
+
},
|
140
|
+
'&.is-focused': _objectSpread({}, defaultFocus),
|
141
|
+
'&.is-pressed': {
|
142
|
+
backgroundColor: 'accent.99'
|
143
|
+
}
|
144
|
+
});
|
145
|
+
|
128
146
|
var close = _objectSpread(_objectSpread({}, iconButton), {}, {
|
129
147
|
p: 0,
|
130
148
|
ml: 'auto',
|
@@ -461,6 +479,10 @@ var link = _objectSpread(_objectSpread({}, text), {}, {
|
|
461
479
|
width: 'max-content'
|
462
480
|
});
|
463
481
|
|
482
|
+
var neutralText = _objectSpread(_objectSpread({}, link), {}, {
|
483
|
+
color: 'neutral.10'
|
484
|
+
});
|
485
|
+
|
464
486
|
var expandableRow = {
|
465
487
|
chartWrapper: {
|
466
488
|
display: 'flex',
|
@@ -616,6 +638,18 @@ var colorBlock = {
|
|
616
638
|
borderColor: 'accent.20'
|
617
639
|
}
|
618
640
|
};
|
641
|
+
|
642
|
+
var menuTab = _objectSpread(_objectSpread({}, quiet), {}, {
|
643
|
+
color: 'neutral.40',
|
644
|
+
alignItems: 'center',
|
645
|
+
'&.is-selected *, &.is-hovered *': {
|
646
|
+
color: 'active'
|
647
|
+
},
|
648
|
+
'& + *:not(div:first-of-type)': {
|
649
|
+
'ml': 'md'
|
650
|
+
}
|
651
|
+
});
|
652
|
+
|
619
653
|
export default {
|
620
654
|
accordionHeader: accordionHeader,
|
621
655
|
chipDeleteButton: chipDeleteButton,
|
@@ -657,5 +691,8 @@ export default {
|
|
657
691
|
tooltipChip: tooltipChip,
|
658
692
|
tooltipIconButton: tooltipIconButton,
|
659
693
|
tooltipInline: tooltipInline,
|
660
|
-
colorBlock: colorBlock
|
694
|
+
colorBlock: colorBlock,
|
695
|
+
menuTab: menuTab,
|
696
|
+
multiselectToggle: multiselectToggle,
|
697
|
+
neutralText: neutralText
|
661
698
|
};
|
@@ -0,0 +1,63 @@
|
|
1
|
+
var multiselectListContainer = {
|
2
|
+
height: '40px',
|
3
|
+
overflowX: 'hidden',
|
4
|
+
pr: 'sm',
|
5
|
+
transition: 'right 500ms',
|
6
|
+
'&.is-open': {
|
7
|
+
height: '100%'
|
8
|
+
}
|
9
|
+
};
|
10
|
+
var multiselectListContent = {
|
11
|
+
bg: 'accent.99',
|
12
|
+
fontSize: 'sm',
|
13
|
+
height: '100%',
|
14
|
+
width: '300px',
|
15
|
+
'&.is-focused': {
|
16
|
+
borderColor: 'accent.80',
|
17
|
+
boxShadow: 'focus',
|
18
|
+
outline: 'none'
|
19
|
+
},
|
20
|
+
'& div': {
|
21
|
+
alignItems: 'center',
|
22
|
+
display: 'flex',
|
23
|
+
minHeight: '45px',
|
24
|
+
padding: '3px',
|
25
|
+
width: '100%'
|
26
|
+
}
|
27
|
+
};
|
28
|
+
var multiselectListTitle = {
|
29
|
+
alignContent: 'center',
|
30
|
+
bg: 'accent.99',
|
31
|
+
display: 'flex',
|
32
|
+
fontWeight: '500',
|
33
|
+
minHeight: '40px',
|
34
|
+
alignItems: 'center',
|
35
|
+
padding: '0 10px !important',
|
36
|
+
flexWrap: 'wrap',
|
37
|
+
maxWidth: 'max-content !important',
|
38
|
+
margin: '0 auto'
|
39
|
+
};
|
40
|
+
var multiselectListBadge = {
|
41
|
+
borderRadius: '5px',
|
42
|
+
display: 'flex',
|
43
|
+
height: '17px',
|
44
|
+
justifyContent: 'center',
|
45
|
+
minWidth: 'max-content',
|
46
|
+
position: 'relative',
|
47
|
+
pb: '0px !important',
|
48
|
+
pr: '3px !important',
|
49
|
+
pl: '3px !important',
|
50
|
+
alignItems: 'center',
|
51
|
+
fontWeight: 500
|
52
|
+
};
|
53
|
+
var multiselectFilterItem = {
|
54
|
+
minHeight: '45px',
|
55
|
+
margin: 'auto'
|
56
|
+
};
|
57
|
+
export default {
|
58
|
+
multiselectListContainer: multiselectListContainer,
|
59
|
+
multiselectListContent: multiselectListContent,
|
60
|
+
multiselectListTitle: multiselectListTitle,
|
61
|
+
multiselectListBadge: multiselectListBadge,
|
62
|
+
multiselectFilterItem: multiselectFilterItem
|
63
|
+
};
|
@@ -14,12 +14,16 @@ export var tab = {
|
|
14
14
|
},
|
15
15
|
'&.is-selected.is-vertical': {
|
16
16
|
bg: 'accent.95'
|
17
|
+
},
|
18
|
+
'& > svg': {
|
19
|
+
flexShrink: 0
|
17
20
|
}
|
18
21
|
};
|
19
22
|
export var tabLine = {
|
20
23
|
height: '2px',
|
21
24
|
width: '100%',
|
22
|
-
bg: 'active'
|
25
|
+
bg: 'active',
|
26
|
+
flexShrink: 0
|
23
27
|
};
|
24
28
|
export var tabPanel = {
|
25
29
|
outline: 'none'
|
@@ -30,11 +30,16 @@ var wordWrap = {
|
|
30
30
|
var tabLabel = _objectSpread(_objectSpread(_objectSpread({}, base), wordWrap), {}, {
|
31
31
|
fontSize: 'sm',
|
32
32
|
fontWeight: 1,
|
33
|
-
mb:
|
33
|
+
mb: 'sm',
|
34
|
+
lineHeight: '16px',
|
34
35
|
color: 'neutral.40',
|
36
|
+
height: '100%',
|
35
37
|
'.is-selected &, .is-hovered &': {
|
38
|
+
color: 'active'
|
39
|
+
},
|
40
|
+
'.is-selected &': {
|
36
41
|
color: 'active',
|
37
|
-
mb:
|
42
|
+
mb: 8
|
38
43
|
},
|
39
44
|
'.is-disabled &': {
|
40
45
|
color: 'neutral.80'
|
@@ -141,6 +146,26 @@ var navBarHeaderText = _objectSpread(_objectSpread({}, wordWrap), {}, {
|
|
141
146
|
fontWeight: 1
|
142
147
|
});
|
143
148
|
|
149
|
+
var multiselectFilterItem = _objectSpread(_objectSpread({}, wordWrap), {}, {
|
150
|
+
color: 'neutral.30',
|
151
|
+
fontSize: 'sm',
|
152
|
+
fontWeight: 500,
|
153
|
+
overflow: 'hidden',
|
154
|
+
marginRight: 'xs',
|
155
|
+
textOverflow: 'ellipsis',
|
156
|
+
whiteSpace: 'nowrap'
|
157
|
+
});
|
158
|
+
|
159
|
+
var multiselectFilterTitle = _objectSpread(_objectSpread({}, wordWrap), {}, {
|
160
|
+
fontSize: 'sm',
|
161
|
+
fontWeight: 500,
|
162
|
+
color: 'text.secondary',
|
163
|
+
whiteSpace: 'nowrap',
|
164
|
+
overflow: 'hidden',
|
165
|
+
textOverflow: 'ellipsis',
|
166
|
+
mr: 'xs'
|
167
|
+
});
|
168
|
+
|
144
169
|
var maskedValue = {
|
145
170
|
width: 252,
|
146
171
|
wordBreak: 'break-all',
|
@@ -229,6 +254,8 @@ export var text = {
|
|
229
254
|
}),
|
230
255
|
maskedValue: maskedValue,
|
231
256
|
expandableRow: expandableRow,
|
257
|
+
multiselectFilterItem: multiselectFilterItem,
|
258
|
+
multiselectFilterTitle: multiselectFilterTitle,
|
232
259
|
navBarHeaderText: navBarHeaderText,
|
233
260
|
navBarSubtitle: navBarSubtitle,
|
234
261
|
placeholder: {
|