bright-components 10.2.4 → 10.2.5
Sign up to get free protection for your applications and to get access to all the features.
@@ -108,10 +108,18 @@ const ResponsiveTabs = _ref => {
|
|
108
108
|
} = _ref,
|
109
109
|
rest = _objectWithoutProperties(_ref, ["tabs", "defaultIndex", "children", "autoTabWidth", "onSelected"]);
|
110
110
|
|
111
|
-
const
|
111
|
+
const tabs = tabsProp || _react.default.Children.map(children, child => {
|
112
|
+
return child && child.props && child.props.name ? {
|
113
|
+
name: child.props.name,
|
114
|
+
counter: child.props.counter
|
115
|
+
} : null;
|
116
|
+
});
|
117
|
+
|
118
|
+
const [index, setIndex] = (0, _react.useState)(defaultIndex < tabs.length ? defaultIndex : 0);
|
119
|
+
|
120
|
+
const onSelectChange = (event, _tabs) => {
|
121
|
+
const names = _tabs.map(tab => tab.name);
|
112
122
|
|
113
|
-
const onSelectChange = (event, tabs) => {
|
114
|
-
const names = tabs.map(tab => tab.name);
|
115
123
|
const newIndex = names.indexOf(event.target.value);
|
116
124
|
setIndex(newIndex);
|
117
125
|
};
|
@@ -120,13 +128,6 @@ const ResponsiveTabs = _ref => {
|
|
120
128
|
setIndex(newIndex);
|
121
129
|
};
|
122
130
|
|
123
|
-
const tabs = tabsProp || _react.default.Children.map(children, child => {
|
124
|
-
return child && child.props && child.props.name ? {
|
125
|
-
name: child.props.name,
|
126
|
-
counter: child.props.counter
|
127
|
-
} : null;
|
128
|
-
});
|
129
|
-
|
130
131
|
const DesktopTabList = autoTabWidth ? AutoWidthTabList : StyledTabList;
|
131
132
|
return _react.default.createElement(_Tabs.default, _extends({
|
132
133
|
selectedIndex: index
|
@@ -151,7 +152,7 @@ const ResponsiveTabs = _ref => {
|
|
151
152
|
onSelected(i);
|
152
153
|
}
|
153
154
|
},
|
154
|
-
value: tabs[index].name
|
155
|
+
value: tabs == null ? void 0 : tabs[index].name
|
155
156
|
}, tabs.map(_ref3 => {
|
156
157
|
let {
|
157
158
|
name,
|
package/package.json
CHANGED
@@ -94,20 +94,6 @@ const ResponsiveTabs = ({
|
|
94
94
|
onSelected,
|
95
95
|
...rest
|
96
96
|
}) => {
|
97
|
-
const [index, setIndex] = useState(
|
98
|
-
defaultIndex < children.length ? defaultIndex : 0
|
99
|
-
);
|
100
|
-
|
101
|
-
const onSelectChange = (event, tabs) => {
|
102
|
-
const names = tabs.map(tab => tab.name);
|
103
|
-
const newIndex = names.indexOf(event.target.value);
|
104
|
-
setIndex(newIndex);
|
105
|
-
};
|
106
|
-
|
107
|
-
const onSelect = newIndex => {
|
108
|
-
setIndex(newIndex);
|
109
|
-
};
|
110
|
-
|
111
97
|
const tabs =
|
112
98
|
tabsProp ||
|
113
99
|
React.Children.map(children, child => {
|
@@ -119,6 +105,20 @@ const ResponsiveTabs = ({
|
|
119
105
|
: null;
|
120
106
|
});
|
121
107
|
|
108
|
+
const [index, setIndex] = useState(
|
109
|
+
defaultIndex < tabs.length ? defaultIndex : 0
|
110
|
+
);
|
111
|
+
|
112
|
+
const onSelectChange = (event, _tabs) => {
|
113
|
+
const names = _tabs.map(tab => tab.name);
|
114
|
+
const newIndex = names.indexOf(event.target.value);
|
115
|
+
setIndex(newIndex);
|
116
|
+
};
|
117
|
+
|
118
|
+
const onSelect = newIndex => {
|
119
|
+
setIndex(newIndex);
|
120
|
+
};
|
121
|
+
|
122
122
|
const DesktopTabList = autoTabWidth ? AutoWidthTabList : StyledTabList;
|
123
123
|
|
124
124
|
return (
|
@@ -142,7 +142,7 @@ const ResponsiveTabs = ({
|
|
142
142
|
onSelected(i);
|
143
143
|
}
|
144
144
|
}}
|
145
|
-
value={tabs[index].name}
|
145
|
+
value={tabs?.[index].name}
|
146
146
|
>
|
147
147
|
{tabs.map(({ name, counter = null }) => (
|
148
148
|
<Option key={name} value={name}>
|