@pingux/astro 2.140.0-alpha.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/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/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/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
@@ -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/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
|
}
|
@@ -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'],
|