@pingux/astro 2.139.0 → 2.140.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/GridList/GridList.d.ts +16 -2
- package/lib/cjs/components/GridList/GridList.js +11 -3
- package/lib/cjs/components/GridList/GridList.stories.d.ts +12 -1
- package/lib/cjs/components/GridList/GridList.stories.js +15 -3
- package/lib/cjs/components/GridList/GridList.test.js +35 -2
- package/lib/cjs/components/GridList/GridListRow.js +7 -5
- package/lib/cjs/components/Tab/Tab.js +9 -3
- package/lib/cjs/components/TabPicker/TabPicker.js +2 -1
- package/lib/cjs/components/Tabs/Tabs.js +22 -8
- package/lib/cjs/components/Tabs/Tabs.stories.d.ts +1 -0
- package/lib/cjs/components/Tabs/Tabs.stories.js +41 -2
- package/lib/cjs/components/Tabs/Tabs.style.d.ts +55 -4
- package/lib/cjs/components/Tabs/Tabs.style.js +59 -7
- package/lib/cjs/styles/themes/next-gen/convertedComponentList.d.ts +1 -0
- package/lib/cjs/styles/themes/next-gen/convertedComponentList.js +2 -1
- package/lib/cjs/styles/themes/next-gen/next-gen.d.ts +3 -1
- package/lib/cjs/styles/themes/next-gen/variants/tabs.d.ts +3 -1
- package/lib/cjs/styles/themes/next-gen/variants/tabs.js +3 -1
- package/lib/cjs/styles/themes/next-gen/variants/variants.d.ts +3 -1
- package/lib/cjs/types/dnd.d.ts +2 -0
- package/lib/cjs/types/item.d.ts +1 -0
- package/lib/cjs/types/tab.d.ts +1 -0
- package/lib/cjs/types/tabs.d.ts +3 -1
- package/lib/components/GridList/GridList.js +11 -3
- package/lib/components/GridList/GridList.stories.js +15 -3
- package/lib/components/GridList/GridList.test.js +35 -2
- package/lib/components/GridList/GridListRow.js +7 -5
- package/lib/components/Tab/Tab.js +9 -3
- package/lib/components/TabPicker/TabPicker.js +2 -1
- package/lib/components/Tabs/Tabs.js +23 -9
- package/lib/components/Tabs/Tabs.stories.js +38 -0
- package/lib/components/Tabs/Tabs.style.js +57 -6
- package/lib/styles/themes/next-gen/convertedComponentList.js +2 -1
- package/lib/styles/themes/next-gen/variants/tabs.js +3 -1
- package/package.json +1 -1
@@ -1,3 +1,17 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
|
1
|
+
import React, { Key } from 'react';
|
2
|
+
import { Collection } from 'react-stately';
|
3
|
+
import type { Node } from '@react-types/shared';
|
4
|
+
type GridListProps = {
|
5
|
+
containerProps: object;
|
6
|
+
rowProps: object;
|
7
|
+
cellProps: object;
|
8
|
+
children?: React.ReactNode;
|
9
|
+
isReorderable?: boolean;
|
10
|
+
items: Iterable<object>;
|
11
|
+
keyboardNavigationBehavior?: 'arrow' | 'tab';
|
12
|
+
onAction?: (key: Key) => void;
|
13
|
+
onSelectionChange?: (keys: Selection) => void;
|
14
|
+
collection: Collection<Node<object>>;
|
15
|
+
};
|
16
|
+
declare const GridList: (props: GridListProps) => React.JSX.Element;
|
3
17
|
export default GridList;
|
@@ -20,12 +20,14 @@ var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-sta
|
|
20
20
|
var _from = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/from"));
|
21
21
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
22
22
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
23
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
|
23
24
|
var _react = _interopRequireWildcard(require("react"));
|
24
25
|
var _reactAria = require("react-aria");
|
25
26
|
var _useGridList2 = _interopRequireDefault(require("../../hooks/useGridList"));
|
26
27
|
var _index = require("../../index");
|
27
28
|
var _GridListRow = _interopRequireDefault(require("./GridListRow"));
|
28
29
|
var _react2 = require("@emotion/react");
|
30
|
+
var _excluded = ["containerProps", "rowProps", "cellProps"];
|
29
31
|
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
30
32
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
31
33
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
@@ -33,14 +35,18 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
33
35
|
var GridList = function GridList(props) {
|
34
36
|
var _context, _context2;
|
35
37
|
var ref = (0, _react.useRef)(null);
|
36
|
-
var
|
38
|
+
var containerProps = props.containerProps,
|
39
|
+
rowProps = props.rowProps,
|
40
|
+
cellProps = props.cellProps,
|
41
|
+
others = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
42
|
+
var _useGridList = (0, _useGridList2["default"])(_objectSpread(_objectSpread({}, others), {}, {
|
37
43
|
ref: ref
|
38
44
|
})),
|
39
45
|
collectionProps = _useGridList.collectionProps,
|
40
46
|
gridListItemProps = _useGridList.gridListItemProps,
|
41
47
|
gridProps = _useGridList.gridProps,
|
42
48
|
state = _useGridList.state;
|
43
|
-
return (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({}, (0, _reactAria.mergeProps)(gridProps, collectionProps), {
|
49
|
+
return (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({}, (0, _reactAria.mergeProps)(gridProps, collectionProps, containerProps), {
|
44
50
|
ref: ref,
|
45
51
|
className: "list",
|
46
52
|
variant: "gridList.container",
|
@@ -48,7 +54,9 @@ var GridList = function GridList(props) {
|
|
48
54
|
}), (0, _map["default"])(_context = (0, _concat["default"])(_context2 = []).call(_context2, (0, _from["default"])(state.collection))).call(_context, function (item) {
|
49
55
|
return (0, _react2.jsx)(_GridListRow["default"], (0, _extends2["default"])({
|
50
56
|
key: item.key,
|
51
|
-
item: item
|
57
|
+
item: item,
|
58
|
+
rowProps: rowProps,
|
59
|
+
cellProps: cellProps
|
52
60
|
}, gridListItemProps));
|
53
61
|
}));
|
54
62
|
};
|
@@ -1,7 +1,18 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
declare const _default: {
|
3
3
|
title: string;
|
4
|
-
component: (props:
|
4
|
+
component: (props: {
|
5
|
+
containerProps: object;
|
6
|
+
rowProps: object;
|
7
|
+
cellProps: object;
|
8
|
+
children?: React.ReactNode;
|
9
|
+
isReorderable?: boolean | undefined;
|
10
|
+
items: Iterable<object>;
|
11
|
+
keyboardNavigationBehavior?: "tab" | "arrow" | undefined;
|
12
|
+
onAction?: ((key: React.Key) => void) | undefined;
|
13
|
+
onSelectionChange?: ((keys: Selection) => void) | undefined;
|
14
|
+
collection: import("react-stately").Collection<import("@react-types/shared").Node<object>>;
|
15
|
+
}) => React.JSX.Element;
|
5
16
|
argTypes: {
|
6
17
|
isReorderable: {
|
7
18
|
description: string;
|
@@ -69,12 +69,14 @@ var ExampleComponent = function ExampleComponent(_ref) {
|
|
69
69
|
sx: {
|
70
70
|
alignItems: 'center'
|
71
71
|
},
|
72
|
-
gap: "sm"
|
72
|
+
gap: "sm",
|
73
|
+
flexGrow: "1"
|
73
74
|
}, (0, _react2.jsx)(_index.TextField, {
|
74
75
|
"aria-label": label,
|
75
76
|
ref: ref,
|
76
77
|
defaultValue: label,
|
77
|
-
"data-testid": "".concat(label, "-text-field")
|
78
|
+
"data-testid": "".concat(label, "-text-field"),
|
79
|
+
flexGrow: "1"
|
78
80
|
}), (0, _react2.jsx)(_index.Box, {
|
79
81
|
isRow: true,
|
80
82
|
sx: {
|
@@ -122,7 +124,17 @@ var Default = function Default(args) {
|
|
122
124
|
return (0, _react2.jsx)(_index.GridList, (0, _extends2["default"])({
|
123
125
|
items: items,
|
124
126
|
isReorderable: true,
|
125
|
-
keyboardNavigationBehavior: "tab"
|
127
|
+
keyboardNavigationBehavior: "tab",
|
128
|
+
rowProps: {
|
129
|
+
sx: {
|
130
|
+
flexGrow: 1
|
131
|
+
}
|
132
|
+
},
|
133
|
+
cellProps: {
|
134
|
+
sx: {
|
135
|
+
flexGrow: 1
|
136
|
+
}
|
137
|
+
}
|
126
138
|
}, args), function (item) {
|
127
139
|
return (0, _react2.jsx)(_reactStately.Item, {
|
128
140
|
textValue: item.name,
|
@@ -53,12 +53,12 @@ describe('GridList Component', function () {
|
|
53
53
|
});
|
54
54
|
});
|
55
55
|
test('renders GridListRow for each item', function () {
|
56
|
-
getDefaultComponent();
|
56
|
+
getDefaultComponent({});
|
57
57
|
var rows = _testWrapper.screen.getAllByRole('row');
|
58
58
|
expect(rows).toHaveLength(items.length);
|
59
59
|
});
|
60
60
|
test('handles keyboard navigation', function () {
|
61
|
-
getDefaultComponent();
|
61
|
+
getDefaultComponent({});
|
62
62
|
var rows = _testWrapper.screen.getAllByRole('row');
|
63
63
|
_userEvent["default"].tab();
|
64
64
|
expect(rows[0]).toHaveClass('is-focused');
|
@@ -150,4 +150,37 @@ describe('GridList Component', function () {
|
|
150
150
|
}
|
151
151
|
}, _callee2);
|
152
152
|
})));
|
153
|
+
test('renders GridList with containerProps', function () {
|
154
|
+
getDefaultComponent({
|
155
|
+
containerProps: {
|
156
|
+
sx: {
|
157
|
+
background: 'red'
|
158
|
+
}
|
159
|
+
}
|
160
|
+
});
|
161
|
+
var list = _testWrapper.screen.getByRole('grid');
|
162
|
+
expect(list).toHaveStyle('background: red');
|
163
|
+
});
|
164
|
+
test('renders GridList with rowProps', function () {
|
165
|
+
getDefaultComponent({
|
166
|
+
rowProps: {
|
167
|
+
sx: {
|
168
|
+
background: 'red'
|
169
|
+
}
|
170
|
+
}
|
171
|
+
});
|
172
|
+
var rows = _testWrapper.screen.getAllByRole('row');
|
173
|
+
expect(rows[0]).toHaveStyle('background: red');
|
174
|
+
});
|
175
|
+
test('renders GridList with cellProps', function () {
|
176
|
+
getDefaultComponent({
|
177
|
+
cellProps: {
|
178
|
+
sx: {
|
179
|
+
background: 'red'
|
180
|
+
}
|
181
|
+
}
|
182
|
+
});
|
183
|
+
var gridCells = _testWrapper.screen.getAllByRole('gridcell');
|
184
|
+
expect(gridCells[0]).toHaveStyle('background: red');
|
185
|
+
});
|
153
186
|
});
|
@@ -24,7 +24,9 @@ var GridListRow = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
24
24
|
var rowRef = (0, _hooks.useLocalOrForwardRef)(ref);
|
25
25
|
var buttonRef = _react["default"].useRef(null);
|
26
26
|
var cellRef = _react["default"].useRef(null);
|
27
|
-
var
|
27
|
+
var customRowProps = props.rowProps,
|
28
|
+
cellProps = props.cellProps,
|
29
|
+
dragState = props.dragState,
|
28
30
|
dropState = props.dropState,
|
29
31
|
isReorderable = props.isReorderable,
|
30
32
|
item = props.item,
|
@@ -54,6 +56,8 @@ var GridListRow = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
54
56
|
variant: "gridList.rowContainer",
|
55
57
|
isRow: true,
|
56
58
|
ref: rowRef
|
59
|
+
}, customRowProps, {
|
60
|
+
flexGrow: "1"
|
57
61
|
}), isReorderable && (0, _react2.jsx)(_index.Box, {
|
58
62
|
isRow: true,
|
59
63
|
sx: {
|
@@ -70,10 +74,8 @@ var GridListRow = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
70
74
|
icon: _DragVerticalIcon["default"]
|
71
75
|
}))), (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({}, gridCellProps, {
|
72
76
|
isRow: true,
|
73
|
-
|
74
|
-
|
75
|
-
}
|
76
|
-
}), item.rendered)), state.collection.getKeyAfter(item.key) == null && (0, _react2.jsx)(_TreeView.InsertionIndicator, {
|
77
|
+
alignItems: "center"
|
78
|
+
}, cellProps), item.rendered)), state.collection.getKeyAfter(item.key) == null && (0, _react2.jsx)(_TreeView.InsertionIndicator, {
|
77
79
|
key: "".concat(item.key, "-after"),
|
78
80
|
target: {
|
79
81
|
type: 'item',
|
@@ -32,6 +32,7 @@ var CollectionTab = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
32
32
|
var className = props.className,
|
33
33
|
item = props.item,
|
34
34
|
tabsDisabled = props.isDisabled,
|
35
|
+
isRequired = props.isRequired,
|
35
36
|
orientation = props.orientation,
|
36
37
|
mode = props.mode,
|
37
38
|
slots = props.slots;
|
@@ -63,6 +64,9 @@ var CollectionTab = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
63
64
|
isDisabled: isDisabled
|
64
65
|
}, state, tabRef),
|
65
66
|
tabProps = _useTab.tabProps;
|
67
|
+
var defaultIndicator = (0, _react2.jsx)(_.Box, {
|
68
|
+
variant: "forms.label.indicator"
|
69
|
+
}, "*");
|
66
70
|
var tab = (0, _react2.jsx)(_.Box, {
|
67
71
|
isRow: true
|
68
72
|
}, slots === null || slots === void 0 ? void 0 : slots.beforeTab, (0, _react2.jsx)(_.Box, (0, _extends2["default"])({
|
@@ -71,10 +75,12 @@ var CollectionTab = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
71
75
|
}, (0, _reactAria.mergeProps)(focusProps, hoverProps, tabProps), (0, _pendoID.getPendoID)('Tab'), {
|
72
76
|
ref: tabRef
|
73
77
|
}, itemProps, {
|
74
|
-
title: itemProps === null || itemProps === void 0 ? void 0 : itemProps.textValue
|
78
|
+
title: itemProps === null || itemProps === void 0 ? void 0 : itemProps.textValue,
|
79
|
+
width: "100%"
|
75
80
|
}), (0, _react2.jsx)(_react["default"].Fragment, null, itemProps === null || itemProps === void 0 ? void 0 : itemProps.icon, (0, _react2.jsx)(_.Text, (0, _extends2["default"])({
|
76
|
-
variant: "tabLabel"
|
77
|
-
|
81
|
+
variant: "tabLabel",
|
82
|
+
display: "flex"
|
83
|
+
}, itemProps === null || itemProps === void 0 ? void 0 : itemProps.tabLabelProps), rendered, isRequired && defaultIndicator), isSelected && !isDisabled && (0, _react2.jsx)(TabLine, itemProps === null || itemProps === void 0 ? void 0 : itemProps.tabLineProps))), slots === null || slots === void 0 ? void 0 : slots.afterTab);
|
78
84
|
if (mode === 'list' && itemProps !== null && itemProps !== void 0 && itemProps.list) {
|
79
85
|
return (0, _react2.jsx)(_TabPicker["default"], (0, _extends2["default"])({
|
80
86
|
ref: tabRef,
|
@@ -181,7 +181,8 @@ var TabPicker = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
181
181
|
onAction: setSelectedItem,
|
182
182
|
selectionMode: "single",
|
183
183
|
selectedKeys: [selectionManager.focusedKey],
|
184
|
-
ref: menuRef
|
184
|
+
ref: menuRef,
|
185
|
+
className: className
|
185
186
|
}, (0, _map["default"])(items).call(items, function (tab) {
|
186
187
|
return (0, _react2.jsx)(_reactStately.Item, {
|
187
188
|
role: tab.role,
|
@@ -32,7 +32,7 @@ var _Box = _interopRequireDefault(require("../Box"));
|
|
32
32
|
var _Tab = require("../Tab");
|
33
33
|
var _react2 = require("@emotion/react");
|
34
34
|
var _excluded = ["state"],
|
35
|
-
_excluded2 = ["isDisabled", "items", "onSelectionChange", "orientation", "mode", "tabListProps", "tabPanelProps"];
|
35
|
+
_excluded2 = ["isDisabled", "items", "onSelectionChange", "orientation", "mode", "tabListProps", "tabPanelProps", "className"];
|
36
36
|
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
37
37
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
38
38
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty2(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
@@ -44,7 +44,8 @@ var TabPanel = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
44
44
|
var state = _ref.state,
|
45
45
|
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
46
46
|
var children = props.children,
|
47
|
-
tabPanelProps = props.tabPanelProps
|
47
|
+
tabPanelProps = props.tabPanelProps,
|
48
|
+
className = props.className;
|
48
49
|
var tabPanelRef = (0, _hooks.useLocalOrForwardRef)(ref);
|
49
50
|
var _ref2 = (0, _reactAria.useTabPanel)(props, state, tabPanelRef),
|
50
51
|
raTabPanelProps = _ref2.tabPanelProps;
|
@@ -54,7 +55,9 @@ var TabPanel = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
54
55
|
raTabPanelProps['aria-labelledby'] = parentTab === null || parentTab === void 0 ? void 0 : parentTab.id;
|
55
56
|
}
|
56
57
|
return (0, _react2.jsx)(_Box["default"], (0, _extends2["default"])({}, tabPanelProps, raTabPanelProps, {
|
57
|
-
ref: tabPanelRef
|
58
|
+
ref: tabPanelRef,
|
59
|
+
className: className,
|
60
|
+
variant: "tabPanelBody"
|
58
61
|
}), children);
|
59
62
|
});
|
60
63
|
var Tabs = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
@@ -66,6 +69,7 @@ var Tabs = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
66
69
|
mode = props.mode,
|
67
70
|
tabListProps = props.tabListProps,
|
68
71
|
tabPanelProps = props.tabPanelProps,
|
72
|
+
className = props.className,
|
69
73
|
others = (0, _objectWithoutProperties2["default"])(props, _excluded2);
|
70
74
|
(0, _hooks.usePropWarning)(props, 'disabled', 'isDisabled');
|
71
75
|
var tabListRef = (0, _hooks.useLocalOrForwardRef)(ref);
|
@@ -91,30 +95,40 @@ var Tabs = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
91
95
|
}));
|
92
96
|
var _useTabList = (0, _reactAria.useTabList)(props, state, tabListRef),
|
93
97
|
raTabListProps = _useTabList.tabListProps;
|
98
|
+
var _useStatusClasses = (0, _hooks.useStatusClasses)(className, {
|
99
|
+
'is-vertical': orientation === _orientation["default"].VERTICAL,
|
100
|
+
'is-horizontal': orientation === _orientation["default"].HORIZONTAL
|
101
|
+
}),
|
102
|
+
classNames = _useStatusClasses.classNames;
|
94
103
|
return (0, _react2.jsx)(TabsContext.Provider, {
|
95
104
|
value: state
|
96
|
-
}, (0, _react2.jsx)(_Box["default"],
|
105
|
+
}, (0, _react2.jsx)(_Box["default"], (0, _extends2["default"])({}, others, {
|
106
|
+
isRow: orientation === _orientation["default"].VERTICAL
|
107
|
+
}), (0, _react2.jsx)(_Box["default"], (0, _extends2["default"])({
|
97
108
|
variant: "tabs",
|
98
109
|
isRow: orientation === _orientation["default"].HORIZONTAL
|
99
110
|
}, tabListProps, raTabListProps, {
|
100
|
-
ref: tabListRef
|
111
|
+
ref: tabListRef,
|
112
|
+
className: classNames
|
101
113
|
}), (0, _map["default"])(_context4 = (0, _filter["default"])(_context5 = (0, _from["default"])(state.collection)).call(_context5, function (item) {
|
102
114
|
var _item$props;
|
103
115
|
return !(item !== null && item !== void 0 && (_item$props = item.props) !== null && _item$props !== void 0 && _item$props.isListItem);
|
104
116
|
})).call(_context4, function (item) {
|
105
|
-
var _item$props2;
|
117
|
+
var _item$props2, _item$props3;
|
106
118
|
return (0, _react2.jsx)(_Tab.CollectionTab, {
|
107
119
|
key: item.key,
|
108
120
|
item: item,
|
109
121
|
isDisabled: isDisabled,
|
122
|
+
isRequired: item === null || item === void 0 || (_item$props2 = item.props) === null || _item$props2 === void 0 ? void 0 : _item$props2.isRequired,
|
110
123
|
orientation: orientation,
|
111
124
|
mode: mode,
|
112
|
-
slots: item === null || item === void 0 || (_item$
|
125
|
+
slots: item === null || item === void 0 || (_item$props3 = item.props) === null || _item$props3 === void 0 ? void 0 : _item$props3.slots
|
113
126
|
});
|
114
127
|
})), (0, _react2.jsx)(TabPanel, {
|
115
128
|
key: (_state$selectedItem3 = state.selectedItem) === null || _state$selectedItem3 === void 0 ? void 0 : _state$selectedItem3.key,
|
116
129
|
state: state,
|
117
|
-
tabPanelProps: tabPanelProps
|
130
|
+
tabPanelProps: tabPanelProps,
|
131
|
+
className: classNames
|
118
132
|
}, ((_state$selectedItem4 = state.selectedItem) === null || _state$selectedItem4 === void 0 ? void 0 : _state$selectedItem4.props.children) || ((_state$selectedItem5 = state.selectedItem) === null || _state$selectedItem5 === void 0 ? void 0 : _state$selectedItem5.props.content))));
|
119
133
|
});
|
120
134
|
Tabs.defaultProps = {
|
@@ -8,7 +8,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
8
8
|
_Object$defineProperty(exports, "__esModule", {
|
9
9
|
value: true
|
10
10
|
});
|
11
|
-
exports["default"] = exports.WithList = exports.DisabledSingleTab = exports.DisabledAllTabs = exports.Default = exports.CustomTabLine = exports.CustomPanelProps = exports.Controlled = exports.ContentSlots = exports.Centered = void 0;
|
11
|
+
exports["default"] = exports.WithList = exports.VerticalOrientation = exports.DisabledSingleTab = exports.DisabledAllTabs = exports.Default = exports.CustomTabLine = exports.CustomPanelProps = exports.Controlled = exports.ContentSlots = exports.Centered = void 0;
|
12
12
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
13
13
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
14
14
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
@@ -68,6 +68,17 @@ var tabs = [{
|
|
68
68
|
name: 'Tab 3',
|
69
69
|
children: (0, _react2.jsx)(_index.Text, null, "Tab 3 body")
|
70
70
|
}];
|
71
|
+
var customTabs = [{
|
72
|
+
name: 'Details',
|
73
|
+
children: (0, _react2.jsx)(_index.Text, null, "Tab 1 body"),
|
74
|
+
isRequired: true
|
75
|
+
}, {
|
76
|
+
name: 'First Factor',
|
77
|
+
children: (0, _react2.jsx)(_index.Text, null, "Tab 2 body")
|
78
|
+
}, {
|
79
|
+
name: 'MFA & Risk',
|
80
|
+
children: (0, _react2.jsx)(_index.Text, null, "Tab 3 body")
|
81
|
+
}];
|
71
82
|
var Default = function Default(args) {
|
72
83
|
return (0, _react2.jsx)(_index.Tabs, (0, _extends2["default"])({
|
73
84
|
items: tabs
|
@@ -240,4 +251,32 @@ var CustomPanelProps = function CustomPanelProps() {
|
|
240
251
|
}, item.children);
|
241
252
|
});
|
242
253
|
};
|
243
|
-
exports.CustomPanelProps = CustomPanelProps;
|
254
|
+
exports.CustomPanelProps = CustomPanelProps;
|
255
|
+
CustomPanelProps.parameters = {
|
256
|
+
codesandbox: false
|
257
|
+
};
|
258
|
+
var VerticalOrientation = function VerticalOrientation(args) {
|
259
|
+
return (0, _react2.jsx)(_index.Tabs, (0, _extends2["default"])({
|
260
|
+
items: customTabs
|
261
|
+
}, args, {
|
262
|
+
orientation: "vertical",
|
263
|
+
tabPanelProps: {
|
264
|
+
sx: {
|
265
|
+
m: '24px'
|
266
|
+
}
|
267
|
+
},
|
268
|
+
tabListProps: {
|
269
|
+
sx: {
|
270
|
+
width: '209px'
|
271
|
+
}
|
272
|
+
}
|
273
|
+
}), function (item) {
|
274
|
+
return (0, _react2.jsx)(_index.Tab, {
|
275
|
+
key: item.name,
|
276
|
+
title: item.name,
|
277
|
+
"data-testid": "testing-".concat(item.name),
|
278
|
+
isRequired: item === null || item === void 0 ? void 0 : item.isRequired
|
279
|
+
}, item.children);
|
280
|
+
});
|
281
|
+
};
|
282
|
+
exports.VerticalOrientation = VerticalOrientation;
|
@@ -22,6 +22,48 @@ export declare const tab: {
|
|
22
22
|
'& > svg': {
|
23
23
|
flexShrink: number;
|
24
24
|
};
|
25
|
+
'&.is-vertical': {
|
26
|
+
borderRadius: string;
|
27
|
+
p: string;
|
28
|
+
WebkitAlignItems: string;
|
29
|
+
'& > span': {
|
30
|
+
m: string;
|
31
|
+
p: string;
|
32
|
+
fontSize: string;
|
33
|
+
color: string;
|
34
|
+
};
|
35
|
+
'&.is-selected': {
|
36
|
+
borderLeft: string;
|
37
|
+
borderLeftColor: string;
|
38
|
+
bg: string;
|
39
|
+
'& > span': {
|
40
|
+
p: string;
|
41
|
+
color: string;
|
42
|
+
};
|
43
|
+
'& > div': {
|
44
|
+
border: string;
|
45
|
+
borderBottomColor: string;
|
46
|
+
bg: string;
|
47
|
+
height: string;
|
48
|
+
};
|
49
|
+
};
|
50
|
+
'&.is-hovered:not(.is-selected)': {
|
51
|
+
bg: string;
|
52
|
+
};
|
53
|
+
'&.is-hovered.is-selected': {
|
54
|
+
bg: string;
|
55
|
+
};
|
56
|
+
'&.is-focused': {
|
57
|
+
boxShadow: string;
|
58
|
+
outline: string;
|
59
|
+
outlineColor: string;
|
60
|
+
borderRadius: string;
|
61
|
+
zIndex: number;
|
62
|
+
'& > span': {
|
63
|
+
outline: string;
|
64
|
+
};
|
65
|
+
};
|
66
|
+
};
|
25
67
|
};
|
26
68
|
export declare const tabLine: {
|
27
69
|
height: string;
|
@@ -33,11 +75,16 @@ export declare const tabPanel: {
|
|
33
75
|
outline: string;
|
34
76
|
};
|
35
77
|
export declare const tabs: {
|
36
|
-
borderBottomWidth: number;
|
37
|
-
borderBottomStyle: string;
|
38
|
-
borderBottomColor: string;
|
39
78
|
mb: string;
|
40
|
-
|
79
|
+
'&.is-vertical': {
|
80
|
+
borderRight: string;
|
81
|
+
};
|
82
|
+
'&.is-horizontal': {
|
83
|
+
borderBottomWidth: number;
|
84
|
+
borderBottomStyle: string;
|
85
|
+
borderBottomColor: string;
|
86
|
+
gap: string;
|
87
|
+
};
|
41
88
|
};
|
42
89
|
export declare const menuTab: {
|
43
90
|
color: string;
|
@@ -48,6 +95,10 @@ export declare const menuTab: {
|
|
48
95
|
'& + *:not(div:first-of-type)': {
|
49
96
|
ml: string;
|
50
97
|
};
|
98
|
+
'&.is-selected.is-vertical': {
|
99
|
+
bg: string;
|
100
|
+
};
|
51
101
|
all: string;
|
52
102
|
display: string;
|
53
103
|
};
|
104
|
+
export declare const tabPanelBody: {};
|
@@ -12,7 +12,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
12
12
|
_Object$defineProperty(exports, "__esModule", {
|
13
13
|
value: true
|
14
14
|
});
|
15
|
-
exports.tabs = exports.tabPanel = exports.tabLine = exports.tab = exports.menuTab = void 0;
|
15
|
+
exports.tabs = exports.tabPanelBody = exports.tabPanel = exports.tabLine = exports.tab = exports.menuTab = void 0;
|
16
16
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
17
17
|
var _Buttons = require("../Button/Buttons.styles");
|
18
18
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
@@ -37,6 +37,48 @@ var tab = {
|
|
37
37
|
},
|
38
38
|
'& > svg': {
|
39
39
|
flexShrink: 0
|
40
|
+
},
|
41
|
+
'&.is-vertical': {
|
42
|
+
borderRadius: '0px',
|
43
|
+
p: '12px 20px',
|
44
|
+
WebkitAlignItems: 'start',
|
45
|
+
'& > span': {
|
46
|
+
m: '0',
|
47
|
+
p: '0',
|
48
|
+
fontSize: '14px',
|
49
|
+
color: '#68747f'
|
50
|
+
},
|
51
|
+
'&.is-selected': {
|
52
|
+
borderLeft: '3px solid',
|
53
|
+
borderLeftColor: 'active',
|
54
|
+
bg: 'accent.95',
|
55
|
+
'& > span': {
|
56
|
+
p: '0',
|
57
|
+
color: 'active'
|
58
|
+
},
|
59
|
+
'& > div': {
|
60
|
+
border: ' none',
|
61
|
+
borderBottomColor: 'none',
|
62
|
+
bg: 'transparent',
|
63
|
+
height: '0px'
|
64
|
+
}
|
65
|
+
},
|
66
|
+
'&.is-hovered:not(.is-selected)': {
|
67
|
+
bg: '#f2f3f4'
|
68
|
+
},
|
69
|
+
'&.is-hovered.is-selected': {
|
70
|
+
bg: 'accent.95'
|
71
|
+
},
|
72
|
+
'&.is-focused': {
|
73
|
+
boxShadow: 'none',
|
74
|
+
outline: '2px solid',
|
75
|
+
outlineColor: 'active',
|
76
|
+
borderRadius: '2px',
|
77
|
+
zIndex: 1,
|
78
|
+
'& > span': {
|
79
|
+
outline: 'none'
|
80
|
+
}
|
81
|
+
}
|
40
82
|
}
|
41
83
|
};
|
42
84
|
exports.tab = tab;
|
@@ -52,11 +94,16 @@ var tabPanel = {
|
|
52
94
|
};
|
53
95
|
exports.tabPanel = tabPanel;
|
54
96
|
var tabs = {
|
55
|
-
borderBottomWidth: 1,
|
56
|
-
borderBottomStyle: 'solid',
|
57
|
-
borderBottomColor: 'neutral.90',
|
58
97
|
mb: 'lg',
|
59
|
-
|
98
|
+
'&.is-vertical': {
|
99
|
+
borderRight: '1px solid #e4e6e9'
|
100
|
+
},
|
101
|
+
'&.is-horizontal': {
|
102
|
+
borderBottomWidth: 1,
|
103
|
+
borderBottomStyle: 'solid',
|
104
|
+
borderBottomColor: 'neutral.90',
|
105
|
+
gap: 'lg'
|
106
|
+
}
|
60
107
|
};
|
61
108
|
exports.tabs = tabs;
|
62
109
|
var menuTab = _objectSpread(_objectSpread({}, _Buttons.quiet), {}, {
|
@@ -66,7 +113,12 @@ var menuTab = _objectSpread(_objectSpread({}, _Buttons.quiet), {}, {
|
|
66
113
|
color: 'active'
|
67
114
|
},
|
68
115
|
'& + *:not(div:first-of-type)': {
|
69
|
-
|
116
|
+
ml: 'md'
|
117
|
+
},
|
118
|
+
'&.is-selected.is-vertical': {
|
119
|
+
bg: 'accent.95'
|
70
120
|
}
|
71
121
|
});
|
72
|
-
exports.menuTab = menuTab;
|
122
|
+
exports.menuTab = menuTab;
|
123
|
+
var tabPanelBody = {};
|
124
|
+
exports.tabPanelBody = tabPanelBody;
|
@@ -13,7 +13,8 @@ var componentSpecificNextGenBlacklist = {
|
|
13
13
|
PasswordField: ['Success'],
|
14
14
|
TextField: ['Success'],
|
15
15
|
OverlayPanel: ['Expandable'],
|
16
|
-
DataTable: ['Default']
|
16
|
+
DataTable: ['Default'],
|
17
|
+
Tabs: ['Vertical Orientation']
|
17
18
|
};
|
18
19
|
exports.componentSpecificNextGenBlacklist = componentSpecificNextGenBlacklist;
|
19
20
|
var astroBlacklistStory = {
|
package/lib/cjs/types/dnd.d.ts
CHANGED
@@ -54,6 +54,8 @@ export interface GridListRowProps {
|
|
54
54
|
isReorderable?: boolean;
|
55
55
|
item: Node<object>;
|
56
56
|
state: ListState<object>;
|
57
|
+
rowProps?: object;
|
58
|
+
cellProps?: object;
|
57
59
|
}
|
58
60
|
export interface UseReorderableCollectionProps {
|
59
61
|
draggableCollectionStateOptions: DraggableCollectionStateOptions;
|
package/lib/cjs/types/item.d.ts
CHANGED
package/lib/cjs/types/tab.d.ts
CHANGED
@@ -5,6 +5,7 @@ import { DOMAttributes, OrientationProps, StyleProps } from './shared';
|
|
5
5
|
import { TooltipTriggerProps } from './tooltipTrigger';
|
6
6
|
export interface TabProps extends StyleProps, DOMAttributes, OrientationProps, TestingAttributes {
|
7
7
|
isDisabled?: boolean;
|
8
|
+
isRequired?: boolean;
|
8
9
|
item: {
|
9
10
|
key: string | number;
|
10
11
|
props?: {
|
package/lib/cjs/types/tabs.d.ts
CHANGED
@@ -16,7 +16,7 @@ export interface TabsProps extends StyleProps, TestingAttributes, OrientationPro
|
|
16
16
|
/**
|
17
17
|
* *For performance reasons, use this prop instead of Array.map when iteratively rendering Items*.
|
18
18
|
* For use with [dynamic collections](https://react-spectrum.adobe.com/react-stately/collections.html#dynamic-collections).
|
19
|
-
|
19
|
+
*/
|
20
20
|
items?: Array<TabListItemProps>;
|
21
21
|
/** Whether the entire tablist is disabled. */
|
22
22
|
isDisabled?: boolean;
|
@@ -29,6 +29,7 @@ export interface TabsProps extends StyleProps, TestingAttributes, OrientationPro
|
|
29
29
|
/** Whether tabs are activated automatically on focus or manually¸ */
|
30
30
|
keyboardActivation?: 'automatic' | 'manual';
|
31
31
|
children?: CollectionChildren<object>;
|
32
|
+
className?: string;
|
32
33
|
}
|
33
34
|
export interface AriaTabListOptions<T> extends Omit<AriaTabListProps<T>, 'children'> {
|
34
35
|
children: CollectionChildren<T>;
|
@@ -49,4 +50,5 @@ export interface TabListItemProps {
|
|
49
50
|
}>;
|
50
51
|
props?: object;
|
51
52
|
index?: number;
|
53
|
+
isRequired?: boolean;
|
52
54
|
}
|
@@ -8,6 +8,8 @@ import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/obje
|
|
8
8
|
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
9
9
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
10
10
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
11
|
+
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
12
|
+
var _excluded = ["containerProps", "rowProps", "cellProps"];
|
11
13
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
12
14
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
13
15
|
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
@@ -22,14 +24,18 @@ import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
22
24
|
var GridList = function GridList(props) {
|
23
25
|
var _context, _context2;
|
24
26
|
var ref = useRef(null);
|
25
|
-
var
|
27
|
+
var containerProps = props.containerProps,
|
28
|
+
rowProps = props.rowProps,
|
29
|
+
cellProps = props.cellProps,
|
30
|
+
others = _objectWithoutProperties(props, _excluded);
|
31
|
+
var _useGridList = useGridList(_objectSpread(_objectSpread({}, others), {}, {
|
26
32
|
ref: ref
|
27
33
|
})),
|
28
34
|
collectionProps = _useGridList.collectionProps,
|
29
35
|
gridListItemProps = _useGridList.gridListItemProps,
|
30
36
|
gridProps = _useGridList.gridProps,
|
31
37
|
state = _useGridList.state;
|
32
|
-
return ___EmotionJSX(Box, _extends({}, mergeProps(gridProps, collectionProps), {
|
38
|
+
return ___EmotionJSX(Box, _extends({}, mergeProps(gridProps, collectionProps, containerProps), {
|
33
39
|
ref: ref,
|
34
40
|
className: "list",
|
35
41
|
variant: "gridList.container",
|
@@ -37,7 +43,9 @@ var GridList = function GridList(props) {
|
|
37
43
|
}), _mapInstanceProperty(_context = _concatInstanceProperty(_context2 = []).call(_context2, _Array$from(state.collection))).call(_context, function (item) {
|
38
44
|
return ___EmotionJSX(GridListRow, _extends({
|
39
45
|
key: item.key,
|
40
|
-
item: item
|
46
|
+
item: item,
|
47
|
+
rowProps: rowProps,
|
48
|
+
cellProps: cellProps
|
41
49
|
}, gridListItemProps));
|
42
50
|
}));
|
43
51
|
};
|
@@ -57,12 +57,14 @@ var ExampleComponent = function ExampleComponent(_ref) {
|
|
57
57
|
sx: {
|
58
58
|
alignItems: 'center'
|
59
59
|
},
|
60
|
-
gap: "sm"
|
60
|
+
gap: "sm",
|
61
|
+
flexGrow: "1"
|
61
62
|
}, ___EmotionJSX(TextField, {
|
62
63
|
"aria-label": label,
|
63
64
|
ref: ref,
|
64
65
|
defaultValue: label,
|
65
|
-
"data-testid": "".concat(label, "-text-field")
|
66
|
+
"data-testid": "".concat(label, "-text-field"),
|
67
|
+
flexGrow: "1"
|
66
68
|
}), ___EmotionJSX(Box, {
|
67
69
|
isRow: true,
|
68
70
|
sx: {
|
@@ -110,7 +112,17 @@ export var Default = function Default(args) {
|
|
110
112
|
return ___EmotionJSX(GridList, _extends({
|
111
113
|
items: items,
|
112
114
|
isReorderable: true,
|
113
|
-
keyboardNavigationBehavior: "tab"
|
115
|
+
keyboardNavigationBehavior: "tab",
|
116
|
+
rowProps: {
|
117
|
+
sx: {
|
118
|
+
flexGrow: 1
|
119
|
+
}
|
120
|
+
},
|
121
|
+
cellProps: {
|
122
|
+
sx: {
|
123
|
+
flexGrow: 1
|
124
|
+
}
|
125
|
+
}
|
114
126
|
}, args), function (item) {
|
115
127
|
return ___EmotionJSX(Item, {
|
116
128
|
textValue: item.name,
|
@@ -49,12 +49,12 @@ describe('GridList Component', function () {
|
|
49
49
|
});
|
50
50
|
});
|
51
51
|
test('renders GridListRow for each item', function () {
|
52
|
-
getDefaultComponent();
|
52
|
+
getDefaultComponent({});
|
53
53
|
var rows = screen.getAllByRole('row');
|
54
54
|
expect(rows).toHaveLength(items.length);
|
55
55
|
});
|
56
56
|
test('handles keyboard navigation', function () {
|
57
|
-
getDefaultComponent();
|
57
|
+
getDefaultComponent({});
|
58
58
|
var rows = screen.getAllByRole('row');
|
59
59
|
userEvent.tab();
|
60
60
|
expect(rows[0]).toHaveClass('is-focused');
|
@@ -146,4 +146,37 @@ describe('GridList Component', function () {
|
|
146
146
|
}
|
147
147
|
}, _callee2);
|
148
148
|
})));
|
149
|
+
test('renders GridList with containerProps', function () {
|
150
|
+
getDefaultComponent({
|
151
|
+
containerProps: {
|
152
|
+
sx: {
|
153
|
+
background: 'red'
|
154
|
+
}
|
155
|
+
}
|
156
|
+
});
|
157
|
+
var list = screen.getByRole('grid');
|
158
|
+
expect(list).toHaveStyle('background: red');
|
159
|
+
});
|
160
|
+
test('renders GridList with rowProps', function () {
|
161
|
+
getDefaultComponent({
|
162
|
+
rowProps: {
|
163
|
+
sx: {
|
164
|
+
background: 'red'
|
165
|
+
}
|
166
|
+
}
|
167
|
+
});
|
168
|
+
var rows = screen.getAllByRole('row');
|
169
|
+
expect(rows[0]).toHaveStyle('background: red');
|
170
|
+
});
|
171
|
+
test('renders GridList with cellProps', function () {
|
172
|
+
getDefaultComponent({
|
173
|
+
cellProps: {
|
174
|
+
sx: {
|
175
|
+
background: 'red'
|
176
|
+
}
|
177
|
+
}
|
178
|
+
});
|
179
|
+
var gridCells = screen.getAllByRole('gridcell');
|
180
|
+
expect(gridCells[0]).toHaveStyle('background: red');
|
181
|
+
});
|
149
182
|
});
|
@@ -11,7 +11,9 @@ var GridListRow = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
11
11
|
var rowRef = useLocalOrForwardRef(ref);
|
12
12
|
var buttonRef = React.useRef(null);
|
13
13
|
var cellRef = React.useRef(null);
|
14
|
-
var
|
14
|
+
var customRowProps = props.rowProps,
|
15
|
+
cellProps = props.cellProps,
|
16
|
+
dragState = props.dragState,
|
15
17
|
dropState = props.dropState,
|
16
18
|
isReorderable = props.isReorderable,
|
17
19
|
item = props.item,
|
@@ -41,6 +43,8 @@ var GridListRow = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
41
43
|
variant: "gridList.rowContainer",
|
42
44
|
isRow: true,
|
43
45
|
ref: rowRef
|
46
|
+
}, customRowProps, {
|
47
|
+
flexGrow: "1"
|
44
48
|
}), isReorderable && ___EmotionJSX(Box, {
|
45
49
|
isRow: true,
|
46
50
|
sx: {
|
@@ -57,10 +61,8 @@ var GridListRow = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
57
61
|
icon: DragIcon
|
58
62
|
}))), ___EmotionJSX(Box, _extends({}, gridCellProps, {
|
59
63
|
isRow: true,
|
60
|
-
|
61
|
-
|
62
|
-
}
|
63
|
-
}), item.rendered)), state.collection.getKeyAfter(item.key) == null && ___EmotionJSX(InsertionIndicator, {
|
64
|
+
alignItems: "center"
|
65
|
+
}, cellProps), item.rendered)), state.collection.getKeyAfter(item.key) == null && ___EmotionJSX(InsertionIndicator, {
|
64
66
|
key: "".concat(item.key, "-after"),
|
65
67
|
target: {
|
66
68
|
type: 'item',
|
@@ -19,6 +19,7 @@ export var CollectionTab = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
19
19
|
var className = props.className,
|
20
20
|
item = props.item,
|
21
21
|
tabsDisabled = props.isDisabled,
|
22
|
+
isRequired = props.isRequired,
|
22
23
|
orientation = props.orientation,
|
23
24
|
mode = props.mode,
|
24
25
|
slots = props.slots;
|
@@ -50,6 +51,9 @@ export var CollectionTab = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
50
51
|
isDisabled: isDisabled
|
51
52
|
}, state, tabRef),
|
52
53
|
tabProps = _useTab.tabProps;
|
54
|
+
var defaultIndicator = ___EmotionJSX(Box, {
|
55
|
+
variant: "forms.label.indicator"
|
56
|
+
}, "*");
|
53
57
|
var tab = ___EmotionJSX(Box, {
|
54
58
|
isRow: true
|
55
59
|
}, slots === null || slots === void 0 ? void 0 : slots.beforeTab, ___EmotionJSX(Box, _extends({
|
@@ -58,10 +62,12 @@ export var CollectionTab = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
58
62
|
}, mergeProps(focusProps, hoverProps, tabProps), getPendoID('Tab'), {
|
59
63
|
ref: tabRef
|
60
64
|
}, itemProps, {
|
61
|
-
title: itemProps === null || itemProps === void 0 ? void 0 : itemProps.textValue
|
65
|
+
title: itemProps === null || itemProps === void 0 ? void 0 : itemProps.textValue,
|
66
|
+
width: "100%"
|
62
67
|
}), ___EmotionJSX(React.Fragment, null, itemProps === null || itemProps === void 0 ? void 0 : itemProps.icon, ___EmotionJSX(Text, _extends({
|
63
|
-
variant: "tabLabel"
|
64
|
-
|
68
|
+
variant: "tabLabel",
|
69
|
+
display: "flex"
|
70
|
+
}, itemProps === null || itemProps === void 0 ? void 0 : itemProps.tabLabelProps), rendered, isRequired && defaultIndicator), isSelected && !isDisabled && ___EmotionJSX(TabLine, itemProps === null || itemProps === void 0 ? void 0 : itemProps.tabLineProps))), slots === null || slots === void 0 ? void 0 : slots.afterTab);
|
65
71
|
if (mode === 'list' && itemProps !== null && itemProps !== void 0 && itemProps.list) {
|
66
72
|
return ___EmotionJSX(TabPicker, _extends({
|
67
73
|
ref: tabRef,
|
@@ -169,7 +169,8 @@ var TabPicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
169
169
|
onAction: setSelectedItem,
|
170
170
|
selectionMode: "single",
|
171
171
|
selectedKeys: [selectionManager.focusedKey],
|
172
|
-
ref: menuRef
|
172
|
+
ref: menuRef,
|
173
|
+
className: className
|
173
174
|
}, _mapInstanceProperty(items).call(items, function (tab) {
|
174
175
|
return ___EmotionJSX(Tab, {
|
175
176
|
role: tab.role,
|
@@ -8,7 +8,7 @@ import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
|
8
8
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
9
9
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
10
10
|
var _excluded = ["state"],
|
11
|
-
_excluded2 = ["isDisabled", "items", "onSelectionChange", "orientation", "mode", "tabListProps", "tabPanelProps"];
|
11
|
+
_excluded2 = ["isDisabled", "items", "onSelectionChange", "orientation", "mode", "tabListProps", "tabPanelProps", "className"];
|
12
12
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
13
13
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context6, _context7; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context6 = ownKeys(Object(source), !0)).call(_context6, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context7 = ownKeys(Object(source))).call(_context7, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
14
14
|
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
@@ -19,7 +19,7 @@ import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
19
19
|
import React, { forwardRef } from 'react';
|
20
20
|
import { useTabList, useTabPanel } from 'react-aria';
|
21
21
|
import { useTabListState } from 'react-stately';
|
22
|
-
import { useLocalOrForwardRef, usePropWarning } from '../../hooks';
|
22
|
+
import { useLocalOrForwardRef, usePropWarning, useStatusClasses } from '../../hooks';
|
23
23
|
import ORIENTATION from '../../utils/devUtils/constants/orientation';
|
24
24
|
import Box from '../Box';
|
25
25
|
import { CollectionTab } from '../Tab';
|
@@ -30,7 +30,8 @@ var TabPanel = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
30
30
|
var state = _ref.state,
|
31
31
|
props = _objectWithoutProperties(_ref, _excluded);
|
32
32
|
var children = props.children,
|
33
|
-
tabPanelProps = props.tabPanelProps
|
33
|
+
tabPanelProps = props.tabPanelProps,
|
34
|
+
className = props.className;
|
34
35
|
var tabPanelRef = useLocalOrForwardRef(ref);
|
35
36
|
var _ref2 = useTabPanel(props, state, tabPanelRef),
|
36
37
|
raTabPanelProps = _ref2.tabPanelProps;
|
@@ -40,7 +41,9 @@ var TabPanel = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
40
41
|
raTabPanelProps['aria-labelledby'] = parentTab === null || parentTab === void 0 ? void 0 : parentTab.id;
|
41
42
|
}
|
42
43
|
return ___EmotionJSX(Box, _extends({}, tabPanelProps, raTabPanelProps, {
|
43
|
-
ref: tabPanelRef
|
44
|
+
ref: tabPanelRef,
|
45
|
+
className: className,
|
46
|
+
variant: "tabPanelBody"
|
44
47
|
}), children);
|
45
48
|
});
|
46
49
|
var Tabs = /*#__PURE__*/forwardRef(function (props, ref) {
|
@@ -52,6 +55,7 @@ var Tabs = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
52
55
|
mode = props.mode,
|
53
56
|
tabListProps = props.tabListProps,
|
54
57
|
tabPanelProps = props.tabPanelProps,
|
58
|
+
className = props.className,
|
55
59
|
others = _objectWithoutProperties(props, _excluded2);
|
56
60
|
usePropWarning(props, 'disabled', 'isDisabled');
|
57
61
|
var tabListRef = useLocalOrForwardRef(ref);
|
@@ -77,30 +81,40 @@ var Tabs = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
77
81
|
}));
|
78
82
|
var _useTabList = useTabList(props, state, tabListRef),
|
79
83
|
raTabListProps = _useTabList.tabListProps;
|
84
|
+
var _useStatusClasses = useStatusClasses(className, {
|
85
|
+
'is-vertical': orientation === ORIENTATION.VERTICAL,
|
86
|
+
'is-horizontal': orientation === ORIENTATION.HORIZONTAL
|
87
|
+
}),
|
88
|
+
classNames = _useStatusClasses.classNames;
|
80
89
|
return ___EmotionJSX(TabsContext.Provider, {
|
81
90
|
value: state
|
82
|
-
}, ___EmotionJSX(Box,
|
91
|
+
}, ___EmotionJSX(Box, _extends({}, others, {
|
92
|
+
isRow: orientation === ORIENTATION.VERTICAL
|
93
|
+
}), ___EmotionJSX(Box, _extends({
|
83
94
|
variant: "tabs",
|
84
95
|
isRow: orientation === ORIENTATION.HORIZONTAL
|
85
96
|
}, tabListProps, raTabListProps, {
|
86
|
-
ref: tabListRef
|
97
|
+
ref: tabListRef,
|
98
|
+
className: classNames
|
87
99
|
}), _mapInstanceProperty(_context4 = _filterInstanceProperty(_context5 = _Array$from(state.collection)).call(_context5, function (item) {
|
88
100
|
var _item$props;
|
89
101
|
return !(item !== null && item !== void 0 && (_item$props = item.props) !== null && _item$props !== void 0 && _item$props.isListItem);
|
90
102
|
})).call(_context4, function (item) {
|
91
|
-
var _item$props2;
|
103
|
+
var _item$props2, _item$props3;
|
92
104
|
return ___EmotionJSX(CollectionTab, {
|
93
105
|
key: item.key,
|
94
106
|
item: item,
|
95
107
|
isDisabled: isDisabled,
|
108
|
+
isRequired: item === null || item === void 0 || (_item$props2 = item.props) === null || _item$props2 === void 0 ? void 0 : _item$props2.isRequired,
|
96
109
|
orientation: orientation,
|
97
110
|
mode: mode,
|
98
|
-
slots: item === null || item === void 0 || (_item$
|
111
|
+
slots: item === null || item === void 0 || (_item$props3 = item.props) === null || _item$props3 === void 0 ? void 0 : _item$props3.slots
|
99
112
|
});
|
100
113
|
})), ___EmotionJSX(TabPanel, {
|
101
114
|
key: (_state$selectedItem3 = state.selectedItem) === null || _state$selectedItem3 === void 0 ? void 0 : _state$selectedItem3.key,
|
102
115
|
state: state,
|
103
|
-
tabPanelProps: tabPanelProps
|
116
|
+
tabPanelProps: tabPanelProps,
|
117
|
+
className: classNames
|
104
118
|
}, ((_state$selectedItem4 = state.selectedItem) === null || _state$selectedItem4 === void 0 ? void 0 : _state$selectedItem4.props.children) || ((_state$selectedItem5 = state.selectedItem) === null || _state$selectedItem5 === void 0 ? void 0 : _state$selectedItem5.props.content))));
|
105
119
|
});
|
106
120
|
Tabs.defaultProps = {
|
@@ -54,6 +54,17 @@ var tabs = [{
|
|
54
54
|
name: 'Tab 3',
|
55
55
|
children: ___EmotionJSX(Text, null, "Tab 3 body")
|
56
56
|
}];
|
57
|
+
var customTabs = [{
|
58
|
+
name: 'Details',
|
59
|
+
children: ___EmotionJSX(Text, null, "Tab 1 body"),
|
60
|
+
isRequired: true
|
61
|
+
}, {
|
62
|
+
name: 'First Factor',
|
63
|
+
children: ___EmotionJSX(Text, null, "Tab 2 body")
|
64
|
+
}, {
|
65
|
+
name: 'MFA & Risk',
|
66
|
+
children: ___EmotionJSX(Text, null, "Tab 3 body")
|
67
|
+
}];
|
57
68
|
export var Default = function Default(args) {
|
58
69
|
return ___EmotionJSX(Tabs, _extends({
|
59
70
|
items: tabs
|
@@ -217,4 +228,31 @@ export var CustomPanelProps = function CustomPanelProps() {
|
|
217
228
|
"data-testid": "testing-".concat(item.name)
|
218
229
|
}, item.children);
|
219
230
|
});
|
231
|
+
};
|
232
|
+
CustomPanelProps.parameters = {
|
233
|
+
codesandbox: false
|
234
|
+
};
|
235
|
+
export var VerticalOrientation = function VerticalOrientation(args) {
|
236
|
+
return ___EmotionJSX(Tabs, _extends({
|
237
|
+
items: customTabs
|
238
|
+
}, args, {
|
239
|
+
orientation: "vertical",
|
240
|
+
tabPanelProps: {
|
241
|
+
sx: {
|
242
|
+
m: '24px'
|
243
|
+
}
|
244
|
+
},
|
245
|
+
tabListProps: {
|
246
|
+
sx: {
|
247
|
+
width: '209px'
|
248
|
+
}
|
249
|
+
}
|
250
|
+
}), function (item) {
|
251
|
+
return ___EmotionJSX(Tab, {
|
252
|
+
key: item.name,
|
253
|
+
title: item.name,
|
254
|
+
"data-testid": "testing-".concat(item.name),
|
255
|
+
isRequired: item === null || item === void 0 ? void 0 : item.isRequired
|
256
|
+
}, item.children);
|
257
|
+
});
|
220
258
|
};
|
@@ -30,6 +30,48 @@ export var tab = {
|
|
30
30
|
},
|
31
31
|
'& > svg': {
|
32
32
|
flexShrink: 0
|
33
|
+
},
|
34
|
+
'&.is-vertical': {
|
35
|
+
borderRadius: '0px',
|
36
|
+
p: '12px 20px',
|
37
|
+
WebkitAlignItems: 'start',
|
38
|
+
'& > span': {
|
39
|
+
m: '0',
|
40
|
+
p: '0',
|
41
|
+
fontSize: '14px',
|
42
|
+
color: '#68747f'
|
43
|
+
},
|
44
|
+
'&.is-selected': {
|
45
|
+
borderLeft: '3px solid',
|
46
|
+
borderLeftColor: 'active',
|
47
|
+
bg: 'accent.95',
|
48
|
+
'& > span': {
|
49
|
+
p: '0',
|
50
|
+
color: 'active'
|
51
|
+
},
|
52
|
+
'& > div': {
|
53
|
+
border: ' none',
|
54
|
+
borderBottomColor: 'none',
|
55
|
+
bg: 'transparent',
|
56
|
+
height: '0px'
|
57
|
+
}
|
58
|
+
},
|
59
|
+
'&.is-hovered:not(.is-selected)': {
|
60
|
+
bg: '#f2f3f4'
|
61
|
+
},
|
62
|
+
'&.is-hovered.is-selected': {
|
63
|
+
bg: 'accent.95'
|
64
|
+
},
|
65
|
+
'&.is-focused': {
|
66
|
+
boxShadow: 'none',
|
67
|
+
outline: '2px solid',
|
68
|
+
outlineColor: 'active',
|
69
|
+
borderRadius: '2px',
|
70
|
+
zIndex: 1,
|
71
|
+
'& > span': {
|
72
|
+
outline: 'none'
|
73
|
+
}
|
74
|
+
}
|
33
75
|
}
|
34
76
|
};
|
35
77
|
export var tabLine = {
|
@@ -42,11 +84,16 @@ export var tabPanel = {
|
|
42
84
|
outline: 'none'
|
43
85
|
};
|
44
86
|
export var tabs = {
|
45
|
-
borderBottomWidth: 1,
|
46
|
-
borderBottomStyle: 'solid',
|
47
|
-
borderBottomColor: 'neutral.90',
|
48
87
|
mb: 'lg',
|
49
|
-
|
88
|
+
'&.is-vertical': {
|
89
|
+
borderRight: '1px solid #e4e6e9'
|
90
|
+
},
|
91
|
+
'&.is-horizontal': {
|
92
|
+
borderBottomWidth: 1,
|
93
|
+
borderBottomStyle: 'solid',
|
94
|
+
borderBottomColor: 'neutral.90',
|
95
|
+
gap: 'lg'
|
96
|
+
}
|
50
97
|
};
|
51
98
|
export var menuTab = _objectSpread(_objectSpread({}, quiet), {}, {
|
52
99
|
color: 'neutral.40',
|
@@ -55,6 +102,10 @@ export var menuTab = _objectSpread(_objectSpread({}, quiet), {}, {
|
|
55
102
|
color: 'active'
|
56
103
|
},
|
57
104
|
'& + *:not(div:first-of-type)': {
|
58
|
-
|
105
|
+
ml: 'md'
|
106
|
+
},
|
107
|
+
'&.is-selected.is-vertical': {
|
108
|
+
bg: 'accent.95'
|
59
109
|
}
|
60
|
-
});
|
110
|
+
});
|
111
|
+
export var tabPanelBody = {};
|
@@ -6,7 +6,8 @@ export var componentSpecificNextGenBlacklist = {
|
|
6
6
|
PasswordField: ['Success'],
|
7
7
|
TextField: ['Success'],
|
8
8
|
OverlayPanel: ['Expandable'],
|
9
|
-
DataTable: ['Default']
|
9
|
+
DataTable: ['Default'],
|
10
|
+
Tabs: ['Vertical Orientation']
|
10
11
|
};
|
11
12
|
export var astroBlacklistStory = {
|
12
13
|
DataTable: ['Onyx Default'],
|