@salutejs/plasma-new-hope 0.268.2-canary.1780.13373736245.0 → 0.269.0-canary.1766.13384359206.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Combobox/ComboboxNew/Combobox.js +1 -1
- package/cjs/components/Combobox/ComboboxNew/Combobox.js.map +1 -1
- package/cjs/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.js +1 -0
- package/cjs/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.js.map +1 -1
- package/cjs/components/Combobox/ComboboxNew/utils/updateDescendants.js +6 -3
- package/cjs/components/Combobox/ComboboxNew/utils/updateDescendants.js.map +1 -1
- package/cjs/components/Select/Select.js +1 -1
- package/cjs/components/Select/Select.js.map +1 -1
- package/cjs/components/Select/ui/Inner/ui/Item/Item.js +1 -0
- package/cjs/components/Select/ui/Inner/ui/Item/Item.js.map +1 -1
- package/cjs/components/Select/utils/updateDescendants.js +6 -3
- package/cjs/components/Select/utils/updateDescendants.js.map +1 -1
- package/cjs/components/Tabs/ui/horizontal/HorizontalTabItem/HorizontalTabItem.js +4 -10
- package/cjs/components/Tabs/ui/horizontal/HorizontalTabItem/HorizontalTabItem.js.map +1 -1
- package/cjs/components/Tabs/ui/horizontal/HorizontalTabs/HorizontalTabs.js +28 -21
- package/cjs/components/Tabs/ui/horizontal/HorizontalTabs/HorizontalTabs.js.map +1 -1
- package/cjs/components/Tabs/ui/vertical/VerticalTabItem/VerticalTabItem.js +4 -10
- package/cjs/components/Tabs/ui/vertical/VerticalTabItem/VerticalTabItem.js.map +1 -1
- package/cjs/components/Tabs/ui/vertical/VerticalTabs/VerticalTabs.js +28 -21
- package/cjs/components/Tabs/ui/vertical/VerticalTabs/VerticalTabs.js.map +1 -1
- package/emotion/cjs/components/Combobox/ComboboxNew/Combobox.js +1 -1
- package/emotion/cjs/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.js +1 -0
- package/emotion/cjs/components/Combobox/ComboboxNew/utils/updateDescendants.js +6 -3
- package/emotion/cjs/components/Select/Select.js +1 -1
- package/emotion/cjs/components/Select/ui/Inner/ui/Item/Item.js +1 -0
- package/emotion/cjs/components/Select/utils/updateDescendants.js +6 -3
- package/emotion/cjs/components/Tabs/Tabs.template-doc.mdx +2 -7
- package/emotion/cjs/components/Tabs/ui/horizontal/HorizontalTabItem/HorizontalTabItem.js +4 -10
- package/emotion/cjs/components/Tabs/ui/horizontal/HorizontalTabs/HorizontalTabs.js +18 -11
- package/emotion/cjs/components/Tabs/ui/vertical/VerticalTabItem/VerticalTabItem.js +4 -10
- package/emotion/cjs/components/Tabs/ui/vertical/VerticalTabs/VerticalTabs.js +18 -11
- package/emotion/cjs/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +1 -0
- package/emotion/es/components/Combobox/ComboboxNew/Combobox.js +1 -1
- package/emotion/es/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.js +1 -0
- package/emotion/es/components/Combobox/ComboboxNew/utils/updateDescendants.js +6 -3
- package/emotion/es/components/Select/Select.js +1 -1
- package/emotion/es/components/Select/ui/Inner/ui/Item/Item.js +1 -0
- package/emotion/es/components/Select/utils/updateDescendants.js +6 -3
- package/emotion/es/components/Tabs/Tabs.template-doc.mdx +2 -7
- package/emotion/es/components/Tabs/ui/horizontal/HorizontalTabItem/HorizontalTabItem.js +5 -11
- package/emotion/es/components/Tabs/ui/horizontal/HorizontalTabs/HorizontalTabs.js +19 -12
- package/emotion/es/components/Tabs/ui/vertical/VerticalTabItem/VerticalTabItem.js +5 -11
- package/emotion/es/components/Tabs/ui/vertical/VerticalTabs/VerticalTabs.js +19 -12
- package/emotion/es/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +1 -0
- package/es/components/Combobox/ComboboxNew/Combobox.js +1 -1
- package/es/components/Combobox/ComboboxNew/Combobox.js.map +1 -1
- package/es/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.js +1 -0
- package/es/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.js.map +1 -1
- package/es/components/Combobox/ComboboxNew/utils/updateDescendants.js +6 -3
- package/es/components/Combobox/ComboboxNew/utils/updateDescendants.js.map +1 -1
- package/es/components/Select/Select.js +1 -1
- package/es/components/Select/Select.js.map +1 -1
- package/es/components/Select/ui/Inner/ui/Item/Item.js +1 -0
- package/es/components/Select/ui/Inner/ui/Item/Item.js.map +1 -1
- package/es/components/Select/utils/updateDescendants.js +6 -3
- package/es/components/Select/utils/updateDescendants.js.map +1 -1
- package/es/components/Tabs/ui/horizontal/HorizontalTabItem/HorizontalTabItem.js +5 -11
- package/es/components/Tabs/ui/horizontal/HorizontalTabItem/HorizontalTabItem.js.map +1 -1
- package/es/components/Tabs/ui/horizontal/HorizontalTabs/HorizontalTabs.js +19 -12
- package/es/components/Tabs/ui/horizontal/HorizontalTabs/HorizontalTabs.js.map +1 -1
- package/es/components/Tabs/ui/vertical/VerticalTabItem/VerticalTabItem.js +5 -11
- package/es/components/Tabs/ui/vertical/VerticalTabItem/VerticalTabItem.js.map +1 -1
- package/es/components/Tabs/ui/vertical/VerticalTabs/VerticalTabs.js +19 -12
- package/es/components/Tabs/ui/vertical/VerticalTabs/VerticalTabs.js.map +1 -1
- package/package.json +2 -2
- package/styled-components/cjs/components/Combobox/ComboboxNew/Combobox.js +1 -1
- package/styled-components/cjs/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.js +1 -0
- package/styled-components/cjs/components/Combobox/ComboboxNew/utils/updateDescendants.js +6 -3
- package/styled-components/cjs/components/Select/Select.js +1 -1
- package/styled-components/cjs/components/Select/ui/Inner/ui/Item/Item.js +1 -0
- package/styled-components/cjs/components/Select/utils/updateDescendants.js +6 -3
- package/styled-components/cjs/components/Tabs/Tabs.template-doc.mdx +2 -7
- package/styled-components/cjs/components/Tabs/ui/horizontal/HorizontalTabItem/HorizontalTabItem.js +4 -10
- package/styled-components/cjs/components/Tabs/ui/horizontal/HorizontalTabs/HorizontalTabs.js +18 -11
- package/styled-components/cjs/components/Tabs/ui/vertical/VerticalTabItem/VerticalTabItem.js +4 -10
- package/styled-components/cjs/components/Tabs/ui/vertical/VerticalTabs/VerticalTabs.js +18 -11
- package/styled-components/cjs/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +1 -0
- package/styled-components/es/components/Combobox/ComboboxNew/Combobox.js +1 -1
- package/styled-components/es/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.js +1 -0
- package/styled-components/es/components/Combobox/ComboboxNew/utils/updateDescendants.js +6 -3
- package/styled-components/es/components/Select/Select.js +1 -1
- package/styled-components/es/components/Select/ui/Inner/ui/Item/Item.js +1 -0
- package/styled-components/es/components/Select/utils/updateDescendants.js +6 -3
- package/styled-components/es/components/Tabs/Tabs.template-doc.mdx +2 -7
- package/styled-components/es/components/Tabs/ui/horizontal/HorizontalTabItem/HorizontalTabItem.js +5 -11
- package/styled-components/es/components/Tabs/ui/horizontal/HorizontalTabs/HorizontalTabs.js +19 -12
- package/styled-components/es/components/Tabs/ui/vertical/VerticalTabItem/VerticalTabItem.js +5 -11
- package/styled-components/es/components/Tabs/ui/vertical/VerticalTabs/VerticalTabs.js +19 -12
- package/styled-components/es/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +1 -0
- package/types/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/utils/updateDescendants.d.ts +2 -2
- package/types/components/Combobox/ComboboxNew/utils/updateDescendants.d.ts.map +1 -1
- package/types/components/Select/ui/Inner/ui/Item/Item.d.ts.map +1 -1
- package/types/components/Select/utils/updateDescendants.d.ts +2 -2
- package/types/components/Select/utils/updateDescendants.d.ts.map +1 -1
- package/types/components/Tabs/ui/horizontal/HorizontalTabItem/HorizontalTabItem.d.ts.map +1 -1
- package/types/components/Tabs/ui/horizontal/HorizontalTabs/HorizontalTabs.d.ts.map +1 -1
- package/types/components/Tabs/ui/vertical/VerticalTabItem/VerticalTabItem.d.ts.map +1 -1
- package/types/components/Tabs/ui/vertical/VerticalTabs/VerticalTabs.d.ts.map +1 -1
- package/cjs/components/Tabs/utils/index.js +0 -26
- package/cjs/components/Tabs/utils/index.js.map +0 -1
- package/emotion/cjs/components/Tabs/utils/index.js +0 -24
- package/emotion/es/components/Tabs/utils/index.js +0 -18
- package/es/components/Tabs/utils/index.js +0 -21
- package/es/components/Tabs/utils/index.js.map +0 -1
- package/styled-components/cjs/components/Tabs/utils/index.js +0 -24
- package/styled-components/es/components/Tabs/utils/index.js +0 -18
- package/types/components/Tabs/utils/index.d.ts +0 -4
- package/types/components/Tabs/utils/index.d.ts.map +0 -1
@@ -1,11 +1,14 @@
|
|
1
|
-
export var updateDescendants = function updateDescendants(node, checkedMap, isChecked) {
|
1
|
+
export var updateDescendants = function updateDescendants(node, checkedMap, isChecked, valueToItemMap) {
|
2
2
|
if (!(node !== null && node !== void 0 && node.items)) {
|
3
3
|
return;
|
4
4
|
}
|
5
5
|
node.items.forEach(function (item) {
|
6
|
-
|
6
|
+
var _valueToItemMap$get;
|
7
|
+
if (!(valueToItemMap !== null && valueToItemMap !== void 0 && (_valueToItemMap$get = valueToItemMap.get(item.value)) !== null && _valueToItemMap$get !== void 0 && _valueToItemMap$get.disabled)) {
|
8
|
+
checkedMap.set(item.value, isChecked);
|
9
|
+
}
|
7
10
|
if (item.items) {
|
8
|
-
updateDescendants(item, checkedMap, isChecked);
|
11
|
+
updateDescendants(item, checkedMap, isChecked, valueToItemMap);
|
9
12
|
}
|
10
13
|
});
|
11
14
|
};
|
@@ -97,21 +97,18 @@ export function App() {
|
|
97
97
|
```
|
98
98
|
|
99
99
|
### Пример с прокруткой
|
100
|
-
При выборе таба происходит прокрутка до выбранного таба.
|
101
100
|
|
102
101
|
```tsx live
|
103
102
|
import React, { useState } from 'react';
|
104
|
-
import { Tabs, TabItem
|
103
|
+
import { Tabs, TabItem } from '@salutejs/{{ package }}';
|
105
104
|
import { IconClock } from '@salutejs/plasma-icons';
|
106
105
|
|
107
106
|
export function App() {
|
108
107
|
const items = Array(8).fill(0);
|
109
108
|
const [index, setIndex] = useState(0);
|
110
109
|
|
111
|
-
const specificIndex = 6;
|
112
|
-
|
113
110
|
return (
|
114
|
-
<div
|
111
|
+
<div>
|
115
112
|
<Tabs view="divider" size="xs" style=\{{ width: '15rem' }}>
|
116
113
|
{items.map((_, i) => (
|
117
114
|
<TabItem
|
@@ -127,8 +124,6 @@ export function App() {
|
|
127
124
|
</TabItem>
|
128
125
|
))}
|
129
126
|
</Tabs>
|
130
|
-
|
131
|
-
<Button onClick={() => setIndex(specificIndex)}>{`Выбрать элемент ${specificIndex + 1}`}</Button>
|
132
127
|
</div>
|
133
128
|
);
|
134
129
|
}
|
package/styled-components/es/components/Tabs/ui/horizontal/HorizontalTabItem/HorizontalTabItem.js
CHANGED
@@ -8,7 +8,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
8
8
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
9
9
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
10
10
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
11
|
-
import React, { forwardRef, useRef, useContext, useEffect, useCallback
|
11
|
+
import React, { forwardRef, useRef, useContext, useEffect, useCallback } from 'react';
|
12
12
|
import { useForkRef } from '@salutejs/plasma-core';
|
13
13
|
import { classes } from '../../../tokens';
|
14
14
|
import { cx } from '../../../../../utils';
|
@@ -62,16 +62,6 @@ export var horizontalTabItemRoot = function horizontalTabItemRoot(Root) {
|
|
62
62
|
return refs.unregister(innerRef);
|
63
63
|
};
|
64
64
|
}, [refs]);
|
65
|
-
useLayoutEffect(function () {
|
66
|
-
var _innerRef$current;
|
67
|
-
if (!selected) {
|
68
|
-
return;
|
69
|
-
}
|
70
|
-
(_innerRef$current = innerRef.current) === null || _innerRef$current === void 0 || _innerRef$current.scrollIntoView({
|
71
|
-
block: 'nearest',
|
72
|
-
inline: 'nearest'
|
73
|
-
});
|
74
|
-
}, [selected]);
|
75
65
|
var onItemFocus = useCallback(function (event) {
|
76
66
|
if (disabled) {
|
77
67
|
return;
|
@@ -97,6 +87,10 @@ export var horizontalTabItemRoot = function horizontalTabItemRoot(Root) {
|
|
97
87
|
refs.setCurrent(focusIndex);
|
98
88
|
}, [refs, innerRef, onIndexChange, disabled]);
|
99
89
|
var handleClick = function handleClick(event) {
|
90
|
+
event.currentTarget.scrollIntoView({
|
91
|
+
block: 'nearest',
|
92
|
+
inline: 'nearest'
|
93
|
+
});
|
100
94
|
if (!onClick) {
|
101
95
|
return;
|
102
96
|
}
|
@@ -8,13 +8,12 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
8
8
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
9
9
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
10
10
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
11
|
-
import React, { forwardRef, useCallback, useMemo, useState,
|
11
|
+
import React, { forwardRef, useCallback, useMemo, useState, useEffect, useRef } from 'react';
|
12
12
|
import { safeUseId } from '@salutejs/plasma-core';
|
13
13
|
import { IconDisclosureLeft, IconDisclosureRight } from '../../../../_Icon';
|
14
14
|
import { classes } from '../../../tokens';
|
15
15
|
import { cx } from '../../../../../utils';
|
16
16
|
import { TabItemRefs, TabsContext } from '../../../TabsContext';
|
17
|
-
import { getFirstOverflowingTab, getLastOverflowingTab } from '../../../utils';
|
18
17
|
import { base as sizeCSS } from './variations/_size/base';
|
19
18
|
import { base as viewCSS } from './variations/_view/base';
|
20
19
|
import { base as disabledCSS } from './variations/_disabled/base';
|
@@ -83,7 +82,13 @@ export var horizontalTabsRoot = function horizontalTabsRoot(Root) {
|
|
83
82
|
return;
|
84
83
|
}
|
85
84
|
var scrollLeft = Math.round(scrollRef.current.scrollLeft);
|
86
|
-
var firstOverflowingTab =
|
85
|
+
var firstOverflowingTab = refs.items.slice().reverse().find(function (item) {
|
86
|
+
if (!item.current || item.current.offsetLeft === undefined) {
|
87
|
+
return;
|
88
|
+
}
|
89
|
+
var tabStartX = item.current.offsetLeft;
|
90
|
+
return tabStartX < scrollLeft;
|
91
|
+
});
|
87
92
|
firstOverflowingTab === null || firstOverflowingTab === void 0 || (_firstOverflowingTab$ = firstOverflowingTab.current) === null || _firstOverflowingTab$ === void 0 || _firstOverflowingTab$.scrollIntoView({
|
88
93
|
block: 'nearest',
|
89
94
|
inline: 'start'
|
@@ -95,7 +100,13 @@ export var horizontalTabsRoot = function horizontalTabsRoot(Root) {
|
|
95
100
|
return;
|
96
101
|
}
|
97
102
|
var scrollRight = Math.round(scrollRef.current.scrollLeft + scrollRef.current.clientWidth);
|
98
|
-
var lastOverflowingTab =
|
103
|
+
var lastOverflowingTab = refs.items.find(function (item) {
|
104
|
+
if (!item.current || item.current.offsetLeft === undefined) {
|
105
|
+
return;
|
106
|
+
}
|
107
|
+
var tabEndX = item.current.offsetLeft + item.current.offsetWidth;
|
108
|
+
return tabEndX > scrollRight;
|
109
|
+
});
|
99
110
|
lastOverflowingTab === null || lastOverflowingTab === void 0 || (_lastOverflowingTab$c = lastOverflowingTab.current) === null || _lastOverflowingTab$c === void 0 || _lastOverflowingTab$c.scrollIntoView({
|
100
111
|
block: 'nearest',
|
101
112
|
inline: 'end'
|
@@ -170,22 +181,18 @@ export var horizontalTabsRoot = function horizontalTabsRoot(Root) {
|
|
170
181
|
});
|
171
182
|
}
|
172
183
|
}, [index]);
|
173
|
-
|
184
|
+
useEffect(function () {
|
174
185
|
var _scrollRef$current, _scrollRef$current2;
|
175
186
|
setLastItemVisible(((_scrollRef$current = scrollRef.current) === null || _scrollRef$current === void 0 ? void 0 : _scrollRef$current.scrollWidth) === ((_scrollRef$current2 = scrollRef.current) === null || _scrollRef$current2 === void 0 ? void 0 : _scrollRef$current2.clientWidth));
|
176
187
|
}, []);
|
177
188
|
|
178
189
|
// Этот хук компенсирует появление левой стрелки при прокрутке
|
179
|
-
|
180
|
-
var _lastOverflowingTab$c2;
|
190
|
+
useEffect(function () {
|
181
191
|
if (firstItemVisible || !scrollRef.current || !leftArrowRef.current) {
|
182
192
|
return;
|
183
193
|
}
|
184
|
-
|
185
|
-
|
186
|
-
lastOverflowingTab === null || lastOverflowingTab === void 0 || (_lastOverflowingTab$c2 = lastOverflowingTab.current) === null || _lastOverflowingTab$c2 === void 0 || _lastOverflowingTab$c2.scrollIntoView({
|
187
|
-
block: 'nearest',
|
188
|
-
inline: 'end'
|
194
|
+
scrollRef.current.scrollTo({
|
195
|
+
left: Math.round(scrollRef.current.scrollLeft + leftArrowRef.current.clientWidth)
|
189
196
|
});
|
190
197
|
}, [firstItemVisible, scrollRef, leftArrowRef]);
|
191
198
|
return /*#__PURE__*/React.createElement(TabsContext.Provider, {
|
@@ -8,7 +8,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
8
8
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
9
9
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
10
10
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
11
|
-
import React, { forwardRef, useRef, useContext, useEffect, useCallback
|
11
|
+
import React, { forwardRef, useRef, useContext, useEffect, useCallback } from 'react';
|
12
12
|
import { useForkRef } from '@salutejs/plasma-core';
|
13
13
|
import { classes } from '../../../tokens';
|
14
14
|
import { cx } from '../../../../../utils';
|
@@ -53,16 +53,6 @@ export var verticalTabItemRoot = function verticalTabItemRoot(Root) {
|
|
53
53
|
return refs.unregister(innerRef);
|
54
54
|
};
|
55
55
|
}, [refs]);
|
56
|
-
useLayoutEffect(function () {
|
57
|
-
var _innerRef$current;
|
58
|
-
if (!selected) {
|
59
|
-
return;
|
60
|
-
}
|
61
|
-
(_innerRef$current = innerRef.current) === null || _innerRef$current === void 0 || _innerRef$current.scrollIntoView({
|
62
|
-
block: 'nearest',
|
63
|
-
inline: 'nearest'
|
64
|
-
});
|
65
|
-
}, [selected]);
|
66
56
|
var onItemFocus = useCallback(function (event) {
|
67
57
|
if (disabled) {
|
68
58
|
return;
|
@@ -87,6 +77,10 @@ export var verticalTabItemRoot = function verticalTabItemRoot(Root) {
|
|
87
77
|
refs.setCurrent(focusIndex);
|
88
78
|
}, [refs, innerRef, onIndexChange, disabled]);
|
89
79
|
var handleClick = function handleClick(event) {
|
80
|
+
event.currentTarget.scrollIntoView({
|
81
|
+
block: 'nearest',
|
82
|
+
inline: 'nearest'
|
83
|
+
});
|
90
84
|
if (!onClick) {
|
91
85
|
return;
|
92
86
|
}
|
@@ -9,13 +9,12 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
9
9
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
10
10
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
11
11
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
12
|
-
import React, { forwardRef, useCallback, useMemo, useState,
|
12
|
+
import React, { forwardRef, useCallback, useMemo, useState, useEffect, useRef } from 'react';
|
13
13
|
import { safeUseId } from '@salutejs/plasma-core';
|
14
14
|
import { classes } from '../../../tokens';
|
15
15
|
import { cx } from '../../../../../utils';
|
16
16
|
import { TabItemRefs, TabsContext } from '../../../TabsContext';
|
17
17
|
import { IconDisclosureLeft, IconDisclosureRight } from '../../../../_Icon';
|
18
|
-
import { getFirstOverflowingTab, getLastOverflowingTab } from '../../../utils';
|
19
18
|
import { base, StyledArrow, StyledContent, StyledContentWrapper } from './VerticalTabs.styles';
|
20
19
|
import { base as sizeCSS } from './variations/_size/base';
|
21
20
|
import { base as viewCSS } from './variations/_view/base';
|
@@ -70,7 +69,13 @@ export var verticalTabsRoot = function verticalTabsRoot(Root) {
|
|
70
69
|
return;
|
71
70
|
}
|
72
71
|
var scrollTop = Math.round(scrollRef.current.scrollTop);
|
73
|
-
var firstOverflowingTab =
|
72
|
+
var firstOverflowingTab = refs.items.slice().reverse().find(function (item) {
|
73
|
+
if (!item.current || item.current.offsetTop === undefined) {
|
74
|
+
return;
|
75
|
+
}
|
76
|
+
var tabStartY = item.current.offsetTop;
|
77
|
+
return tabStartY < scrollTop;
|
78
|
+
});
|
74
79
|
firstOverflowingTab === null || firstOverflowingTab === void 0 || (_firstOverflowingTab$ = firstOverflowingTab.current) === null || _firstOverflowingTab$ === void 0 || _firstOverflowingTab$.scrollIntoView({
|
75
80
|
block: 'start',
|
76
81
|
inline: 'nearest'
|
@@ -82,7 +87,13 @@ export var verticalTabsRoot = function verticalTabsRoot(Root) {
|
|
82
87
|
return;
|
83
88
|
}
|
84
89
|
var scrollBottom = Math.round(scrollRef.current.scrollTop + scrollRef.current.clientHeight);
|
85
|
-
var lastOverflowingTab =
|
90
|
+
var lastOverflowingTab = refs.items.find(function (item) {
|
91
|
+
if (!item.current || item.current.offsetTop === undefined) {
|
92
|
+
return;
|
93
|
+
}
|
94
|
+
var tabEndY = item.current.offsetTop + item.current.offsetHeight;
|
95
|
+
return tabEndY > scrollBottom;
|
96
|
+
});
|
86
97
|
lastOverflowingTab === null || lastOverflowingTab === void 0 || (_lastOverflowingTab$c = lastOverflowingTab.current) === null || _lastOverflowingTab$c === void 0 || _lastOverflowingTab$c.scrollIntoView({
|
87
98
|
block: 'end',
|
88
99
|
inline: 'nearest'
|
@@ -148,22 +159,18 @@ export var verticalTabsRoot = function verticalTabsRoot(Root) {
|
|
148
159
|
});
|
149
160
|
}
|
150
161
|
}, [index]);
|
151
|
-
|
162
|
+
useEffect(function () {
|
152
163
|
var _scrollRef$current, _scrollRef$current2;
|
153
164
|
setLastItemVisible(((_scrollRef$current = scrollRef.current) === null || _scrollRef$current === void 0 ? void 0 : _scrollRef$current.scrollHeight) === ((_scrollRef$current2 = scrollRef.current) === null || _scrollRef$current2 === void 0 ? void 0 : _scrollRef$current2.clientHeight));
|
154
165
|
}, []);
|
155
166
|
|
156
167
|
// Этот хук компенсирует появление верхней стрелки при прокрутке
|
157
|
-
|
158
|
-
var _lastOverflowingTab$c2;
|
168
|
+
useEffect(function () {
|
159
169
|
if (firstItemVisible || !scrollRef.current || !upArrowRef.current) {
|
160
170
|
return;
|
161
171
|
}
|
162
|
-
|
163
|
-
|
164
|
-
lastOverflowingTab === null || lastOverflowingTab === void 0 || (_lastOverflowingTab$c2 = lastOverflowingTab.current) === null || _lastOverflowingTab$c2 === void 0 || _lastOverflowingTab$c2.scrollIntoView({
|
165
|
-
block: 'end',
|
166
|
-
inline: 'nearest'
|
172
|
+
scrollRef.current.scrollTo({
|
173
|
+
top: Math.round(scrollRef.current.scrollTop + upArrowRef.current.clientHeight)
|
167
174
|
});
|
168
175
|
}, [firstItemVisible, scrollRef, upArrowRef]);
|
169
176
|
return /*#__PURE__*/React.createElement(TabsContext.Provider, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../../../../../../../src/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAU,EAAE,EAAc,MAAM,OAAO,CAAC;AAQtD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAezC,eAAO,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,
|
1
|
+
{"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../../../../../../../src/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAU,EAAE,EAAc,MAAM,OAAO,CAAC;AAQtD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAezC,eAAO,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,CAsH9B,CAAC"}
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import type { ItemOptionTransformed } from '../ui/Inner/ui/Item/Item.types';
|
2
|
-
import type { ValueToCheckedMapType } from '../hooks/getPathMaps';
|
3
|
-
export declare const updateDescendants: (node: ItemOptionTransformed, checkedMap: ValueToCheckedMapType, isChecked: boolean) => void;
|
2
|
+
import type { ValueToCheckedMapType, ValueToItemMapType } from '../hooks/getPathMaps';
|
3
|
+
export declare const updateDescendants: (node: ItemOptionTransformed, checkedMap: ValueToCheckedMapType, isChecked: boolean, valueToItemMap?: ValueToItemMapType | undefined) => void;
|
4
4
|
//# sourceMappingURL=updateDescendants.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"updateDescendants.d.ts","sourceRoot":"","sources":["../../../../../src/components/Combobox/ComboboxNew/utils/updateDescendants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;
|
1
|
+
{"version":3,"file":"updateDescendants.d.ts","sourceRoot":"","sources":["../../../../../src/components/Combobox/ComboboxNew/utils/updateDescendants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,KAAK,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAEtF,eAAO,MAAM,iBAAiB,SACpB,qBAAqB,gDAEhB,OAAO,0DAgBrB,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/Select/ui/Inner/ui/Item/Item.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAU,EAAE,EAAc,MAAM,OAAO,CAAC;AAQtD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAezC,eAAO,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,
|
1
|
+
{"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/Select/ui/Inner/ui/Item/Item.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAU,EAAE,EAAc,MAAM,OAAO,CAAC;AAQtD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAezC,eAAO,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,CAsH9B,CAAC"}
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import type { MergedDropdownNodeTransformed } from '../ui/Inner/ui/Item/Item.types';
|
2
|
-
import type { ValueToCheckedMapType } from '../hooks/usePathMaps';
|
3
|
-
export declare const updateDescendants: (node: MergedDropdownNodeTransformed, checkedMap: ValueToCheckedMapType, isChecked: boolean) => void;
|
2
|
+
import type { ValueToCheckedMapType, ValueToItemMapType } from '../hooks/usePathMaps';
|
3
|
+
export declare const updateDescendants: (node: MergedDropdownNodeTransformed, checkedMap: ValueToCheckedMapType, isChecked: boolean, valueToItemMap?: ValueToItemMapType | undefined) => void;
|
4
4
|
//# sourceMappingURL=updateDescendants.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"updateDescendants.d.ts","sourceRoot":"","sources":["../../../../src/components/Select/utils/updateDescendants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AACpF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;
|
1
|
+
{"version":3,"file":"updateDescendants.d.ts","sourceRoot":"","sources":["../../../../src/components/Select/utils/updateDescendants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AACpF,OAAO,KAAK,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAEtF,eAAO,MAAM,iBAAiB,SACpB,6BAA6B,gDAExB,OAAO,0DAgBrB,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"HorizontalTabItem.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Tabs/ui/horizontal/HorizontalTabItem/HorizontalTabItem.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"HorizontalTabItem.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Tabs/ui/horizontal/HorizontalTabItem/HorizontalTabItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiE,MAAM,OAAO,CAAC;AAGtF,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAInD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAQhE,eAAO,MAAM,qBAAqB,SAAU,UAAU,cAAc,EAAE,sBAAsB,CAAC,kGAuHvF,CAAC;AAEP,eAAO,MAAM,uBAAuB;;;mBAzHQ,UAAU,cAAc,EAAE,sBAAsB,CAAC;;;;;;;;;;;;;;;;;;;;CAgJ5F,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"HorizontalTabs.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Tabs/ui/horizontal/HorizontalTabs/HorizontalTabs.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"HorizontalTabs.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Tabs/ui/horizontal/HorizontalTabs/HorizontalTabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuF,MAAM,OAAO,CAAC;AAI5G,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAK9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAqB/D,eAAO,MAAM,kBAAkB,SAAU,UAAU,cAAc,EAAE,mBAAmB,CAAC,+FAuNjF,CAAC;AAEP,eAAO,MAAM,oBAAoB;;;mBAzNQ,UAAU,cAAc,EAAE,mBAAmB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;CAqPtF,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"VerticalTabItem.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Tabs/ui/vertical/VerticalTabItem/VerticalTabItem.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"VerticalTabItem.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Tabs/ui/vertical/VerticalTabItem/VerticalTabItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiE,MAAM,OAAO,CAAC;AAGtF,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAInD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAO9D,eAAO,MAAM,mBAAmB,SAAU,UAAU,iBAAiB,EAAE,oBAAoB,CAAC,mGA8GtF,CAAC;AAEP,eAAO,MAAM,qBAAqB;;;mBAhHQ,UAAU,iBAAiB,EAAE,oBAAoB,CAAC;;;;;;;;;;;;;;;;;CAoI3F,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"VerticalTabs.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Tabs/ui/vertical/VerticalTabs/VerticalTabs.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"VerticalTabs.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Tabs/ui/vertical/VerticalTabs/VerticalTabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuF,MAAM,OAAO,CAAC;AAI5G,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAI9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAgB7D,eAAO,MAAM,gBAAgB,SAAU,UAAU,cAAc,EAAE,iBAAiB,CAAC,+KAiM7E,CAAC;AAEP,eAAO,MAAM,kBAAkB;;;mBAnMQ,UAAU,cAAc,EAAE,iBAAiB,CAAC;;;;;;;;;;;;;;;;;;CAwNlF,CAAC"}
|
@@ -1,26 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
-
|
5
|
-
var getFirstOverflowingTab = function getFirstOverflowingTab(items, maxScroll) {
|
6
|
-
return items.find(function (item) {
|
7
|
-
if (!item.current || item.current.offsetLeft === undefined) {
|
8
|
-
return;
|
9
|
-
}
|
10
|
-
var tabStartX = item.current.offsetLeft;
|
11
|
-
return tabStartX < maxScroll;
|
12
|
-
});
|
13
|
-
};
|
14
|
-
var getLastOverflowingTab = function getLastOverflowingTab(items, minScroll) {
|
15
|
-
return items.find(function (item) {
|
16
|
-
if (!item.current || item.current.offsetLeft === undefined) {
|
17
|
-
return;
|
18
|
-
}
|
19
|
-
var tabEndX = item.current.offsetLeft + item.current.offsetWidth;
|
20
|
-
return tabEndX > minScroll;
|
21
|
-
});
|
22
|
-
};
|
23
|
-
|
24
|
-
exports.getFirstOverflowingTab = getFirstOverflowingTab;
|
25
|
-
exports.getLastOverflowingTab = getLastOverflowingTab;
|
26
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/Tabs/utils/index.ts"],"sourcesContent":["import { MutableRefObject } from 'react';\n\nexport const getFirstOverflowingTab = (items: MutableRefObject<HTMLElement | null>[], maxScroll: number) => {\n return items.find((item: MutableRefObject<HTMLElement | null>) => {\n if (!item.current || item.current.offsetLeft === undefined) {\n return;\n }\n const tabStartX = item.current.offsetLeft;\n\n return tabStartX < maxScroll;\n });\n};\n\nexport const getLastOverflowingTab = (items: MutableRefObject<HTMLElement | null>[], minScroll: number) => {\n return items.find((item: MutableRefObject<HTMLElement | null>) => {\n if (!item.current || item.current.offsetLeft === undefined) {\n return;\n }\n const tabEndX = item.current.offsetLeft + item.current.offsetWidth;\n\n return tabEndX > minScroll;\n });\n};\n"],"names":["getFirstOverflowingTab","items","maxScroll","find","item","current","offsetLeft","undefined","tabStartX","getLastOverflowingTab","minScroll","tabEndX","offsetWidth"],"mappings":";;;;AAEO,IAAMA,sBAAsB,GAAG,SAAzBA,sBAAsBA,CAAIC,KAA6C,EAAEC,SAAiB,EAAK;AACxG,EAAA,OAAOD,KAAK,CAACE,IAAI,CAAC,UAACC,IAA0C,EAAK;AAC9D,IAAA,IAAI,CAACA,IAAI,CAACC,OAAO,IAAID,IAAI,CAACC,OAAO,CAACC,UAAU,KAAKC,SAAS,EAAE;AACxD,MAAA,OAAA;AACJ,KAAA;AACA,IAAA,IAAMC,SAAS,GAAGJ,IAAI,CAACC,OAAO,CAACC,UAAU,CAAA;IAEzC,OAAOE,SAAS,GAAGN,SAAS,CAAA;AAChC,GAAC,CAAC,CAAA;AACN,EAAC;AAEM,IAAMO,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAAIR,KAA6C,EAAES,SAAiB,EAAK;AACvG,EAAA,OAAOT,KAAK,CAACE,IAAI,CAAC,UAACC,IAA0C,EAAK;AAC9D,IAAA,IAAI,CAACA,IAAI,CAACC,OAAO,IAAID,IAAI,CAACC,OAAO,CAACC,UAAU,KAAKC,SAAS,EAAE;AACxD,MAAA,OAAA;AACJ,KAAA;AACA,IAAA,IAAMI,OAAO,GAAGP,IAAI,CAACC,OAAO,CAACC,UAAU,GAAGF,IAAI,CAACC,OAAO,CAACO,WAAW,CAAA;IAElE,OAAOD,OAAO,GAAGD,SAAS,CAAA;AAC9B,GAAC,CAAC,CAAA;AACN;;;;;"}
|
@@ -1,24 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.getLastOverflowingTab = exports.getFirstOverflowingTab = void 0;
|
7
|
-
var getFirstOverflowingTab = exports.getFirstOverflowingTab = function getFirstOverflowingTab(items, maxScroll) {
|
8
|
-
return items.find(function (item) {
|
9
|
-
if (!item.current || item.current.offsetLeft === undefined) {
|
10
|
-
return;
|
11
|
-
}
|
12
|
-
var tabStartX = item.current.offsetLeft;
|
13
|
-
return tabStartX < maxScroll;
|
14
|
-
});
|
15
|
-
};
|
16
|
-
var getLastOverflowingTab = exports.getLastOverflowingTab = function getLastOverflowingTab(items, minScroll) {
|
17
|
-
return items.find(function (item) {
|
18
|
-
if (!item.current || item.current.offsetLeft === undefined) {
|
19
|
-
return;
|
20
|
-
}
|
21
|
-
var tabEndX = item.current.offsetLeft + item.current.offsetWidth;
|
22
|
-
return tabEndX > minScroll;
|
23
|
-
});
|
24
|
-
};
|
@@ -1,18 +0,0 @@
|
|
1
|
-
export var getFirstOverflowingTab = function getFirstOverflowingTab(items, maxScroll) {
|
2
|
-
return items.find(function (item) {
|
3
|
-
if (!item.current || item.current.offsetLeft === undefined) {
|
4
|
-
return;
|
5
|
-
}
|
6
|
-
var tabStartX = item.current.offsetLeft;
|
7
|
-
return tabStartX < maxScroll;
|
8
|
-
});
|
9
|
-
};
|
10
|
-
export var getLastOverflowingTab = function getLastOverflowingTab(items, minScroll) {
|
11
|
-
return items.find(function (item) {
|
12
|
-
if (!item.current || item.current.offsetLeft === undefined) {
|
13
|
-
return;
|
14
|
-
}
|
15
|
-
var tabEndX = item.current.offsetLeft + item.current.offsetWidth;
|
16
|
-
return tabEndX > minScroll;
|
17
|
-
});
|
18
|
-
};
|
@@ -1,21 +0,0 @@
|
|
1
|
-
var getFirstOverflowingTab = function getFirstOverflowingTab(items, maxScroll) {
|
2
|
-
return items.find(function (item) {
|
3
|
-
if (!item.current || item.current.offsetLeft === undefined) {
|
4
|
-
return;
|
5
|
-
}
|
6
|
-
var tabStartX = item.current.offsetLeft;
|
7
|
-
return tabStartX < maxScroll;
|
8
|
-
});
|
9
|
-
};
|
10
|
-
var getLastOverflowingTab = function getLastOverflowingTab(items, minScroll) {
|
11
|
-
return items.find(function (item) {
|
12
|
-
if (!item.current || item.current.offsetLeft === undefined) {
|
13
|
-
return;
|
14
|
-
}
|
15
|
-
var tabEndX = item.current.offsetLeft + item.current.offsetWidth;
|
16
|
-
return tabEndX > minScroll;
|
17
|
-
});
|
18
|
-
};
|
19
|
-
|
20
|
-
export { getFirstOverflowingTab, getLastOverflowingTab };
|
21
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/Tabs/utils/index.ts"],"sourcesContent":["import { MutableRefObject } from 'react';\n\nexport const getFirstOverflowingTab = (items: MutableRefObject<HTMLElement | null>[], maxScroll: number) => {\n return items.find((item: MutableRefObject<HTMLElement | null>) => {\n if (!item.current || item.current.offsetLeft === undefined) {\n return;\n }\n const tabStartX = item.current.offsetLeft;\n\n return tabStartX < maxScroll;\n });\n};\n\nexport const getLastOverflowingTab = (items: MutableRefObject<HTMLElement | null>[], minScroll: number) => {\n return items.find((item: MutableRefObject<HTMLElement | null>) => {\n if (!item.current || item.current.offsetLeft === undefined) {\n return;\n }\n const tabEndX = item.current.offsetLeft + item.current.offsetWidth;\n\n return tabEndX > minScroll;\n });\n};\n"],"names":["getFirstOverflowingTab","items","maxScroll","find","item","current","offsetLeft","undefined","tabStartX","getLastOverflowingTab","minScroll","tabEndX","offsetWidth"],"mappings":"AAEO,IAAMA,sBAAsB,GAAG,SAAzBA,sBAAsBA,CAAIC,KAA6C,EAAEC,SAAiB,EAAK;AACxG,EAAA,OAAOD,KAAK,CAACE,IAAI,CAAC,UAACC,IAA0C,EAAK;AAC9D,IAAA,IAAI,CAACA,IAAI,CAACC,OAAO,IAAID,IAAI,CAACC,OAAO,CAACC,UAAU,KAAKC,SAAS,EAAE;AACxD,MAAA,OAAA;AACJ,KAAA;AACA,IAAA,IAAMC,SAAS,GAAGJ,IAAI,CAACC,OAAO,CAACC,UAAU,CAAA;IAEzC,OAAOE,SAAS,GAAGN,SAAS,CAAA;AAChC,GAAC,CAAC,CAAA;AACN,EAAC;AAEM,IAAMO,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAAIR,KAA6C,EAAES,SAAiB,EAAK;AACvG,EAAA,OAAOT,KAAK,CAACE,IAAI,CAAC,UAACC,IAA0C,EAAK;AAC9D,IAAA,IAAI,CAACA,IAAI,CAACC,OAAO,IAAID,IAAI,CAACC,OAAO,CAACC,UAAU,KAAKC,SAAS,EAAE;AACxD,MAAA,OAAA;AACJ,KAAA;AACA,IAAA,IAAMI,OAAO,GAAGP,IAAI,CAACC,OAAO,CAACC,UAAU,GAAGF,IAAI,CAACC,OAAO,CAACO,WAAW,CAAA;IAElE,OAAOD,OAAO,GAAGD,SAAS,CAAA;AAC9B,GAAC,CAAC,CAAA;AACN;;;;"}
|
@@ -1,24 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.getLastOverflowingTab = exports.getFirstOverflowingTab = void 0;
|
7
|
-
var getFirstOverflowingTab = exports.getFirstOverflowingTab = function getFirstOverflowingTab(items, maxScroll) {
|
8
|
-
return items.find(function (item) {
|
9
|
-
if (!item.current || item.current.offsetLeft === undefined) {
|
10
|
-
return;
|
11
|
-
}
|
12
|
-
var tabStartX = item.current.offsetLeft;
|
13
|
-
return tabStartX < maxScroll;
|
14
|
-
});
|
15
|
-
};
|
16
|
-
var getLastOverflowingTab = exports.getLastOverflowingTab = function getLastOverflowingTab(items, minScroll) {
|
17
|
-
return items.find(function (item) {
|
18
|
-
if (!item.current || item.current.offsetLeft === undefined) {
|
19
|
-
return;
|
20
|
-
}
|
21
|
-
var tabEndX = item.current.offsetLeft + item.current.offsetWidth;
|
22
|
-
return tabEndX > minScroll;
|
23
|
-
});
|
24
|
-
};
|
@@ -1,18 +0,0 @@
|
|
1
|
-
export var getFirstOverflowingTab = function getFirstOverflowingTab(items, maxScroll) {
|
2
|
-
return items.find(function (item) {
|
3
|
-
if (!item.current || item.current.offsetLeft === undefined) {
|
4
|
-
return;
|
5
|
-
}
|
6
|
-
var tabStartX = item.current.offsetLeft;
|
7
|
-
return tabStartX < maxScroll;
|
8
|
-
});
|
9
|
-
};
|
10
|
-
export var getLastOverflowingTab = function getLastOverflowingTab(items, minScroll) {
|
11
|
-
return items.find(function (item) {
|
12
|
-
if (!item.current || item.current.offsetLeft === undefined) {
|
13
|
-
return;
|
14
|
-
}
|
15
|
-
var tabEndX = item.current.offsetLeft + item.current.offsetWidth;
|
16
|
-
return tabEndX > minScroll;
|
17
|
-
});
|
18
|
-
};
|
@@ -1,4 +0,0 @@
|
|
1
|
-
import { MutableRefObject } from 'react';
|
2
|
-
export declare const getFirstOverflowingTab: (items: MutableRefObject<HTMLElement | null>[], maxScroll: number) => MutableRefObject<HTMLElement | null> | undefined;
|
3
|
-
export declare const getLastOverflowingTab: (items: MutableRefObject<HTMLElement | null>[], minScroll: number) => MutableRefObject<HTMLElement | null> | undefined;
|
4
|
-
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Tabs/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAEzC,eAAO,MAAM,sBAAsB,UAAW,iBAAiB,WAAW,GAAG,IAAI,CAAC,EAAE,aAAa,MAAM,qDAStG,CAAC;AAEF,eAAO,MAAM,qBAAqB,UAAW,iBAAiB,WAAW,GAAG,IAAI,CAAC,EAAE,aAAa,MAAM,qDASrG,CAAC"}
|