@alfalab/core-components-tabs 8.0.8 → 8.1.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/collapsible.d.ts +1 -6
- package/collapsible.js +5 -16
- package/components/primary-tablist/Component.collapsible.d.ts +2 -2
- package/components/primary-tablist/Component.collapsible.js +11 -11
- package/components/primary-tablist/Component.d.ts +2 -2
- package/components/primary-tablist/Component.desktop.js +8 -2
- package/components/primary-tablist/Component.js +8 -2
- package/components/primary-tablist/Component.mobile.js +12 -4
- package/components/primary-tablist/Component.responsive.js +7 -2
- package/components/primary-tablist/index.css +31 -29
- package/components/primary-tablist/mobile.css +34 -32
- package/components/scroll-controls/Component.d.ts +11 -0
- package/components/scroll-controls/Component.js +53 -0
- package/components/scroll-controls/index.css +94 -0
- package/components/scroll-controls/index.d.ts +1 -0
- package/components/scroll-controls/index.js +17 -0
- package/components/scroll-controls/utils.d.ts +7 -0
- package/components/scroll-controls/utils.js +56 -0
- package/components/scrollable-container/Component.d.ts +14 -2
- package/components/scrollable-container/Component.js +45 -8
- package/components/scrollable-container/index.css +10 -6
- package/components/scrollable-container/index.js +7 -0
- package/components/secondary-tablist/Component.d.ts +2 -2
- package/components/secondary-tablist/Component.desktop.js +8 -2
- package/components/secondary-tablist/Component.js +9 -3
- package/components/secondary-tablist/Component.mobile.d.ts +2 -2
- package/components/secondary-tablist/Component.mobile.js +10 -4
- package/components/secondary-tablist/Component.responsive.d.ts +1 -1
- package/components/secondary-tablist/Component.responsive.js +9 -3
- package/components/secondary-tablist/index.css +11 -11
- package/components/secondary-tablist/mobile.css +13 -13
- package/components/tab/Component.js +1 -1
- package/components/tab/index.css +3 -3
- package/components/tabs/Component.collapsible.d.ts +6 -0
- package/components/tabs/{Component.collabsible.desktop.js → Component.collapsible.js} +5 -6
- package/components/tabs/Component.d.ts +1 -1
- package/components/tabs/Component.desktop.js +8 -2
- package/components/tabs/Component.js +2 -2
- package/components/tabs/Component.mobile.d.ts +1 -1
- package/components/tabs/Component.mobile.js +8 -3
- package/components/tabs/Component.responsive.js +8 -3
- package/cssm/collapsible.d.ts +1 -6
- package/cssm/collapsible.js +4 -15
- package/cssm/components/primary-tablist/Component.collapsible.d.ts +2 -2
- package/cssm/components/primary-tablist/Component.collapsible.js +12 -11
- package/cssm/components/primary-tablist/Component.d.ts +2 -2
- package/cssm/components/primary-tablist/Component.desktop.js +8 -1
- package/cssm/components/primary-tablist/Component.js +9 -2
- package/cssm/components/primary-tablist/Component.mobile.js +8 -1
- package/cssm/components/primary-tablist/Component.responsive.js +7 -0
- package/cssm/components/primary-tablist/index.module.css +2 -0
- package/cssm/components/scroll-controls/Component.d.ts +11 -0
- package/cssm/components/scroll-controls/Component.js +52 -0
- package/cssm/components/scroll-controls/index.d.ts +1 -0
- package/cssm/components/scroll-controls/index.js +18 -0
- package/cssm/components/scroll-controls/index.module.css +93 -0
- package/cssm/components/scroll-controls/utils.d.ts +7 -0
- package/cssm/components/scroll-controls/utils.js +56 -0
- package/cssm/components/scrollable-container/Component.d.ts +14 -2
- package/cssm/components/scrollable-container/Component.js +45 -7
- package/cssm/components/scrollable-container/index.js +8 -0
- package/cssm/components/scrollable-container/index.module.css +5 -1
- package/cssm/components/secondary-tablist/Component.d.ts +2 -2
- package/cssm/components/secondary-tablist/Component.desktop.js +8 -1
- package/cssm/components/secondary-tablist/Component.js +10 -3
- package/cssm/components/secondary-tablist/Component.mobile.d.ts +2 -2
- package/cssm/components/secondary-tablist/Component.mobile.js +9 -2
- package/cssm/components/secondary-tablist/Component.responsive.d.ts +1 -1
- package/cssm/components/secondary-tablist/Component.responsive.js +9 -2
- package/cssm/components/tabs/Component.collapsible.d.ts +6 -0
- package/cssm/components/tabs/{Component.collabsible.desktop.js → Component.collapsible.js} +4 -5
- package/cssm/components/tabs/Component.d.ts +1 -1
- package/cssm/components/tabs/Component.desktop.js +7 -0
- package/cssm/components/tabs/Component.js +2 -2
- package/cssm/components/tabs/Component.mobile.d.ts +1 -1
- package/cssm/components/tabs/Component.mobile.js +7 -0
- package/cssm/components/tabs/Component.responsive.js +7 -0
- package/cssm/desktop.js +7 -0
- package/cssm/index-c76d6398.d.ts +0 -1
- package/cssm/index.js +7 -0
- package/cssm/mobile.js +7 -0
- package/cssm/shared.js +8 -1
- package/cssm/typings.d.ts +13 -2
- package/desktop.js +8 -2
- package/esm/collapsible.d.ts +1 -6
- package/esm/collapsible.js +4 -10
- package/esm/components/primary-tablist/Component.collapsible.d.ts +2 -2
- package/esm/components/primary-tablist/Component.collapsible.js +11 -11
- package/esm/components/primary-tablist/Component.d.ts +2 -2
- package/esm/components/primary-tablist/Component.desktop.js +8 -2
- package/esm/components/primary-tablist/Component.js +8 -2
- package/esm/components/primary-tablist/Component.mobile.js +11 -3
- package/esm/components/primary-tablist/Component.responsive.js +7 -2
- package/esm/components/primary-tablist/index.css +31 -29
- package/esm/components/primary-tablist/mobile.css +34 -32
- package/esm/components/scroll-controls/Component.d.ts +11 -0
- package/esm/components/scroll-controls/Component.js +43 -0
- package/esm/components/scroll-controls/index.css +94 -0
- package/esm/components/scroll-controls/index.d.ts +1 -0
- package/esm/components/scroll-controls/index.js +9 -0
- package/esm/components/scroll-controls/utils.d.ts +7 -0
- package/esm/components/scroll-controls/utils.js +50 -0
- package/esm/components/scrollable-container/Component.d.ts +14 -2
- package/esm/components/scrollable-container/Component.js +46 -9
- package/esm/components/scrollable-container/index.css +10 -6
- package/esm/components/scrollable-container/index.js +7 -0
- package/esm/components/secondary-tablist/Component.d.ts +2 -2
- package/esm/components/secondary-tablist/Component.desktop.js +8 -2
- package/esm/components/secondary-tablist/Component.js +9 -3
- package/esm/components/secondary-tablist/Component.mobile.d.ts +2 -2
- package/esm/components/secondary-tablist/Component.mobile.js +10 -4
- package/esm/components/secondary-tablist/Component.responsive.d.ts +1 -1
- package/esm/components/secondary-tablist/Component.responsive.js +9 -3
- package/esm/components/secondary-tablist/index.css +11 -11
- package/esm/components/secondary-tablist/mobile.css +13 -13
- package/esm/components/tab/Component.js +1 -1
- package/esm/components/tab/index.css +3 -3
- package/esm/components/tabs/Component.collapsible.d.ts +6 -0
- package/esm/components/tabs/{Component.collabsible.desktop.js → Component.collapsible.js} +5 -6
- package/esm/components/tabs/Component.d.ts +1 -1
- package/esm/components/tabs/Component.desktop.js +8 -2
- package/esm/components/tabs/Component.js +2 -2
- package/esm/components/tabs/Component.mobile.d.ts +1 -1
- package/esm/components/tabs/Component.mobile.js +8 -3
- package/esm/components/tabs/Component.responsive.js +8 -3
- package/esm/desktop.js +8 -2
- package/esm/index-c76d6398.d.ts +0 -1
- package/esm/index.js +8 -3
- package/esm/index.module-e0497aa4.js +4 -0
- package/esm/index.module-ee44d88b.js +4 -0
- package/esm/mobile.js +8 -3
- package/esm/shared.js +7 -1
- package/esm/typings.d.ts +13 -2
- package/index-c76d6398.d.ts +0 -1
- package/index-ebda875c.d.ts +86 -21
- package/index.js +8 -3
- package/index.module-ae0eca4b.js +6 -0
- package/index.module-ed812325.js +6 -0
- package/mobile.js +8 -3
- package/modern/collapsible.d.ts +1 -6
- package/modern/collapsible.js +4 -10
- package/modern/components/primary-tablist/Component.collapsible.d.ts +2 -2
- package/modern/components/primary-tablist/Component.collapsible.js +11 -11
- package/modern/components/primary-tablist/Component.d.ts +2 -2
- package/modern/components/primary-tablist/Component.desktop.js +8 -2
- package/modern/components/primary-tablist/Component.js +8 -2
- package/modern/components/primary-tablist/Component.mobile.js +11 -3
- package/modern/components/primary-tablist/Component.responsive.js +7 -2
- package/modern/components/primary-tablist/index.css +31 -29
- package/modern/components/primary-tablist/mobile.css +34 -32
- package/modern/components/scroll-controls/Component.d.ts +11 -0
- package/modern/components/scroll-controls/Component.js +40 -0
- package/modern/components/scroll-controls/index.css +94 -0
- package/modern/components/scroll-controls/index.d.ts +1 -0
- package/modern/components/scroll-controls/index.js +8 -0
- package/modern/components/scroll-controls/utils.d.ts +7 -0
- package/modern/components/scroll-controls/utils.js +50 -0
- package/modern/components/scrollable-container/Component.d.ts +14 -2
- package/modern/components/scrollable-container/Component.js +44 -9
- package/modern/components/scrollable-container/index.css +10 -6
- package/modern/components/scrollable-container/index.js +6 -0
- package/modern/components/secondary-tablist/Component.d.ts +2 -2
- package/modern/components/secondary-tablist/Component.desktop.js +8 -2
- package/modern/components/secondary-tablist/Component.js +9 -3
- package/modern/components/secondary-tablist/Component.mobile.d.ts +2 -2
- package/modern/components/secondary-tablist/Component.mobile.js +9 -3
- package/modern/components/secondary-tablist/Component.responsive.d.ts +1 -1
- package/modern/components/secondary-tablist/Component.responsive.js +9 -3
- package/modern/components/secondary-tablist/index.css +11 -11
- package/modern/components/secondary-tablist/mobile.css +13 -13
- package/modern/components/tab/Component.js +1 -1
- package/modern/components/tab/index.css +3 -3
- package/modern/components/tabs/Component.collapsible.d.ts +6 -0
- package/modern/components/tabs/{Component.collabsible.desktop.js → Component.collapsible.js} +4 -5
- package/modern/components/tabs/Component.d.ts +1 -1
- package/modern/components/tabs/Component.desktop.js +8 -2
- package/modern/components/tabs/Component.js +2 -2
- package/modern/components/tabs/Component.mobile.d.ts +1 -1
- package/modern/components/tabs/Component.mobile.js +8 -3
- package/modern/components/tabs/Component.responsive.js +8 -3
- package/modern/desktop.js +8 -2
- package/modern/index-c76d6398.d.ts +0 -1
- package/modern/index.js +8 -3
- package/modern/index.module-0162508b.js +4 -0
- package/modern/index.module-1d3d8c31.js +4 -0
- package/modern/mobile.js +8 -3
- package/modern/shared.js +6 -0
- package/modern/typings.d.ts +13 -2
- package/package.json +5 -2
- package/shared.js +7 -1
- package/src/collapsible.ts +1 -9
- package/src/components/primary-tablist/Component.collapsible.tsx +6 -7
- package/src/components/primary-tablist/Component.desktop.tsx +1 -1
- package/src/components/primary-tablist/Component.mobile.tsx +6 -1
- package/src/components/primary-tablist/Component.tsx +6 -2
- package/src/components/primary-tablist/index.module.css +4 -0
- package/src/components/scroll-controls/Component.tsx +78 -0
- package/src/components/scroll-controls/index.module.css +68 -0
- package/src/components/scroll-controls/index.ts +1 -0
- package/src/components/scroll-controls/utils.ts +60 -0
- package/src/components/scrollable-container/Component.tsx +81 -12
- package/src/components/scrollable-container/index.module.css +7 -1
- package/src/components/secondary-tablist/Component.desktop.tsx +1 -0
- package/src/components/secondary-tablist/Component.mobile.tsx +4 -2
- package/src/components/secondary-tablist/Component.responsive.tsx +1 -2
- package/src/components/secondary-tablist/Component.tsx +10 -2
- package/src/components/tabs/Component.collapsible.tsx +15 -0
- package/src/components/tabs/Component.mobile.tsx +1 -1
- package/src/components/tabs/Component.tsx +4 -0
- package/src/typings.ts +16 -0
- package/typings.d.ts +13 -2
- package/components/primary-tablist/Component.collapsible.desktop.d.ts +0 -5
- package/components/primary-tablist/Component.collapsible.desktop.js +0 -32
- package/components/primary-tablist/Component.collapsible.mobile.d.ts +0 -6
- package/components/primary-tablist/Component.collapsible.mobile.js +0 -35
- package/components/primary-tablist/Component.collapsible.responsive.d.ts +0 -5
- package/components/primary-tablist/Component.collapsible.responsive.js +0 -36
- package/components/tabs/Component.collabsible.desktop.d.ts +0 -6
- package/components/tabs/Component.collapsible.mobile.d.ts +0 -6
- package/components/tabs/Component.collapsible.mobile.js +0 -35
- package/components/tabs/Component.collapsible.responsive.d.ts +0 -6
- package/components/tabs/Component.collapsible.responsive.js +0 -37
- package/cssm/components/primary-tablist/Component.collapsible.desktop.d.ts +0 -5
- package/cssm/components/primary-tablist/Component.collapsible.desktop.js +0 -33
- package/cssm/components/primary-tablist/Component.collapsible.mobile.d.ts +0 -6
- package/cssm/components/primary-tablist/Component.collapsible.mobile.js +0 -37
- package/cssm/components/primary-tablist/Component.collapsible.responsive.d.ts +0 -5
- package/cssm/components/primary-tablist/Component.collapsible.responsive.js +0 -36
- package/cssm/components/tabs/Component.collabsible.desktop.d.ts +0 -6
- package/cssm/components/tabs/Component.collapsible.mobile.d.ts +0 -6
- package/cssm/components/tabs/Component.collapsible.mobile.js +0 -35
- package/cssm/components/tabs/Component.collapsible.responsive.d.ts +0 -6
- package/cssm/components/tabs/Component.collapsible.responsive.js +0 -37
- package/esm/components/primary-tablist/Component.collapsible.desktop.d.ts +0 -5
- package/esm/components/primary-tablist/Component.collapsible.desktop.js +0 -24
- package/esm/components/primary-tablist/Component.collapsible.mobile.d.ts +0 -6
- package/esm/components/primary-tablist/Component.collapsible.mobile.js +0 -26
- package/esm/components/primary-tablist/Component.collapsible.responsive.d.ts +0 -5
- package/esm/components/primary-tablist/Component.collapsible.responsive.js +0 -28
- package/esm/components/tabs/Component.collabsible.desktop.d.ts +0 -6
- package/esm/components/tabs/Component.collapsible.mobile.d.ts +0 -6
- package/esm/components/tabs/Component.collapsible.mobile.js +0 -27
- package/esm/components/tabs/Component.collapsible.responsive.d.ts +0 -6
- package/esm/components/tabs/Component.collapsible.responsive.js +0 -29
- package/esm/index.module-511c86f3.js +0 -4
- package/esm/index.module-ffeeb976.js +0 -4
- package/esm/mobile.module-34deaa77.js +0 -4
- package/index.module-0d8ea41a.js +0 -6
- package/index.module-38e4686f.js +0 -6
- package/mobile.module-a305e8da.js +0 -6
- package/modern/components/primary-tablist/Component.collapsible.desktop.d.ts +0 -5
- package/modern/components/primary-tablist/Component.collapsible.desktop.js +0 -20
- package/modern/components/primary-tablist/Component.collapsible.mobile.d.ts +0 -6
- package/modern/components/primary-tablist/Component.collapsible.mobile.js +0 -25
- package/modern/components/primary-tablist/Component.collapsible.responsive.d.ts +0 -5
- package/modern/components/primary-tablist/Component.collapsible.responsive.js +0 -26
- package/modern/components/tabs/Component.collabsible.desktop.d.ts +0 -6
- package/modern/components/tabs/Component.collapsible.mobile.d.ts +0 -6
- package/modern/components/tabs/Component.collapsible.mobile.js +0 -23
- package/modern/components/tabs/Component.collapsible.responsive.d.ts +0 -6
- package/modern/components/tabs/Component.collapsible.responsive.js +0 -25
- package/modern/index.module-4f82d773.js +0 -4
- package/modern/index.module-6f255828.js +0 -4
- package/modern/mobile.module-02182f0f.js +0 -4
- package/src/components/primary-tablist/Component.collapsible.desktop.tsx +0 -11
- package/src/components/primary-tablist/Component.collapsible.mobile.tsx +0 -27
- package/src/components/primary-tablist/Component.collapsible.responsive.tsx +0 -34
- package/src/components/tabs/Component.collabsible.desktop.tsx +0 -15
- package/src/components/tabs/Component.collapsible.mobile.tsx +0 -15
- package/src/components/tabs/Component.collapsible.responsive.tsx +0 -12
|
@@ -6,8 +6,14 @@ import { ScrollableContainer } from '../scrollable-container/Component.js';
|
|
|
6
6
|
import { Title } from '../title/Component.js';
|
|
7
7
|
import '@alfalab/core-components-shared/modern';
|
|
8
8
|
import 'compute-scroll-into-view';
|
|
9
|
+
import '../scroll-controls/Component.js';
|
|
10
|
+
import 'lodash.debounce';
|
|
11
|
+
import '@alfalab/core-components-icon-button/modern';
|
|
12
|
+
import '@alfalab/icons-glyph/ChevronLeftMIcon';
|
|
13
|
+
import '@alfalab/icons-glyph/ChevronRightMIcon';
|
|
14
|
+
import '../scroll-controls/utils.js';
|
|
9
15
|
|
|
10
|
-
const PrimaryTabList = ({ size, styles = {}, className, containerClassName, titles = [], selectedId = titles.length ? titles[0].id : undefined, scrollable = true, fullWidthScroll, onChange, dataTestId, }) => {
|
|
16
|
+
const PrimaryTabList = ({ size, styles = {}, className, containerClassName, titles = [], selectedId = titles.length ? titles[0].id : undefined, scrollable = true, fullWidthScroll, onChange, dataTestId, platform, }) => {
|
|
11
17
|
const lineRef = useRef(null);
|
|
12
18
|
const { selectedTab, focusedTab, getTabListItemProps } = useTabs({
|
|
13
19
|
titles,
|
|
@@ -25,7 +31,7 @@ const PrimaryTabList = ({ size, styles = {}, className, containerClassName, titl
|
|
|
25
31
|
}) },
|
|
26
32
|
titles.map(({ dataTestId: _, ...restTitleProps }, index) => (React.createElement(KeyboardFocusable, { key: restTitleProps.id }, (ref, focused) => (React.createElement(Title, { ...getTabListItemProps(index, ref), ...restTitleProps, focused: focused, styles: styles }))))),
|
|
27
33
|
React.createElement("div", { className: styles.line, ref: lineRef })));
|
|
28
|
-
return scrollable ? (React.createElement(ScrollableContainer, { activeChild: focusedTab || selectedTab, containerClassName: containerClassName, fullWidthScroll: fullWidthScroll }, renderContent())) : (React.createElement("div", { className: cn(styles.container, containerClassName) }, renderContent()));
|
|
34
|
+
return scrollable ? (React.createElement(ScrollableContainer, { activeChild: focusedTab || selectedTab, containerClassName: containerClassName, fullWidthScroll: fullWidthScroll, view: 'primary', size: size, platform: platform }, renderContent())) : (React.createElement("div", { className: cn(styles.container, containerClassName) }, renderContent()));
|
|
29
35
|
};
|
|
30
36
|
|
|
31
37
|
export { PrimaryTabList };
|
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
import { PrimaryTabList } from './Component.js';
|
|
4
|
-
import { c as commonStyles } from '../../index.module-
|
|
5
|
-
import { m as mobileStyles } from '../../mobile.module-02182f0f.js';
|
|
4
|
+
import { c as commonStyles } from '../../index.module-0162508b.js';
|
|
6
5
|
import '@alfalab/core-components-keyboard-focusable/modern';
|
|
7
6
|
import '../../hooks/use-tabs.js';
|
|
8
7
|
import '@alfalab/core-components-shared/modern';
|
|
9
8
|
import '../scrollable-container/Component.js';
|
|
10
9
|
import 'compute-scroll-into-view';
|
|
10
|
+
import '../scroll-controls/Component.js';
|
|
11
|
+
import 'lodash.debounce';
|
|
12
|
+
import '@alfalab/core-components-icon-button/modern';
|
|
13
|
+
import '@alfalab/icons-glyph/ChevronLeftMIcon';
|
|
14
|
+
import '@alfalab/icons-glyph/ChevronRightMIcon';
|
|
15
|
+
import '../scroll-controls/utils.js';
|
|
11
16
|
import '../title/Component.js';
|
|
12
17
|
|
|
18
|
+
const mobileStyles = {"title":"tabs__title_nd1k6 tabs__title_1m9uu","mobile":"tabs__mobile_nd1k6"};
|
|
19
|
+
require('./mobile.css')
|
|
20
|
+
|
|
13
21
|
const styles = {
|
|
14
22
|
...commonStyles,
|
|
15
23
|
...mobileStyles,
|
|
16
24
|
};
|
|
17
|
-
const PrimaryTabListMobile = ({ className, ...restProps }) => (React.createElement(PrimaryTabList, { ...restProps, styles: styles, className: cn(className, styles.mobile) }));
|
|
25
|
+
const PrimaryTabListMobile = ({ className, ...restProps }) => (React.createElement(PrimaryTabList, { ...restProps, styles: styles, className: cn(className, styles.mobile), platform: 'mobile' }));
|
|
18
26
|
|
|
19
27
|
export { PrimaryTabListMobile };
|
|
@@ -9,9 +9,14 @@ import '../../hooks/use-tabs.js';
|
|
|
9
9
|
import '@alfalab/core-components-shared/modern';
|
|
10
10
|
import '../scrollable-container/Component.js';
|
|
11
11
|
import 'compute-scroll-into-view';
|
|
12
|
+
import '../scroll-controls/Component.js';
|
|
13
|
+
import 'lodash.debounce';
|
|
14
|
+
import '@alfalab/core-components-icon-button/modern';
|
|
15
|
+
import '@alfalab/icons-glyph/ChevronLeftMIcon';
|
|
16
|
+
import '@alfalab/icons-glyph/ChevronRightMIcon';
|
|
17
|
+
import '../scroll-controls/utils.js';
|
|
12
18
|
import '../title/Component.js';
|
|
13
|
-
import '../../index.module-
|
|
14
|
-
import '../../mobile.module-02182f0f.js';
|
|
19
|
+
import '../../index.module-0162508b.js';
|
|
15
20
|
|
|
16
21
|
const PrimaryTabListResponsive = ({ size, breakpoint = 1024, fullWidthScroll, defaultMatchMediaValue, ...restProps }) => {
|
|
17
22
|
const [isDesktop] = useMatchMedia(`(min-width: ${breakpoint}px)`, defaultMatchMediaValue);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 13d4g */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-border-accent: #ef3124;
|
|
@@ -83,11 +83,11 @@
|
|
|
83
83
|
/* size l */
|
|
84
84
|
|
|
85
85
|
/* size xl */
|
|
86
|
-
} .
|
|
86
|
+
} .tabs__component_1m9uu {
|
|
87
87
|
position: relative;
|
|
88
88
|
display: inline-flex;
|
|
89
89
|
min-width: 100%
|
|
90
|
-
} .
|
|
90
|
+
} .tabs__component_1m9uu:before {
|
|
91
91
|
content: '';
|
|
92
92
|
display: block;
|
|
93
93
|
position: absolute;
|
|
@@ -95,17 +95,17 @@
|
|
|
95
95
|
height: 1px;
|
|
96
96
|
width: 100%;
|
|
97
97
|
background-color: var(--primary-tablist-bottom-border-color);
|
|
98
|
-
} .
|
|
98
|
+
} .tabs__fullWidthScroll_1m9uu {
|
|
99
99
|
min-width: calc(100% - 2 * var(--gap-m));
|
|
100
100
|
margin: 0 var(--gap-m);
|
|
101
|
-
} .
|
|
101
|
+
} .tabs__container_1m9uu {
|
|
102
102
|
position: relative;
|
|
103
103
|
overflow: hidden;
|
|
104
104
|
|
|
105
105
|
/* focus-outline fix */
|
|
106
106
|
margin: var(--gap-2xs-neg) 0 var(--gap-2xs-neg) var(--gap-2xs-neg);
|
|
107
107
|
padding: var(--gap-2xs) 0 var(--gap-2xs) var(--gap-2xs);
|
|
108
|
-
} .
|
|
108
|
+
} .tabs__title_1m9uu {
|
|
109
109
|
display: flex;
|
|
110
110
|
align-items: center;
|
|
111
111
|
height: 100%;
|
|
@@ -122,76 +122,78 @@
|
|
|
122
122
|
user-select: none;
|
|
123
123
|
cursor: pointer;
|
|
124
124
|
outline: none
|
|
125
|
-
} .
|
|
125
|
+
} .tabs__title_1m9uu:not(.tabs__disabled_1m9uu):hover {
|
|
126
126
|
color: var(--primary-tablist-hover-color);
|
|
127
|
-
} .
|
|
127
|
+
} .tabs__focused_1m9uu {
|
|
128
128
|
outline: 2px solid var(--focus-color);
|
|
129
129
|
outline-offset: 2px;
|
|
130
|
-
} .
|
|
130
|
+
} .tabs__collapsed_1m9uu {
|
|
131
131
|
order: 99;
|
|
132
132
|
visibility: collapse;
|
|
133
|
-
} .
|
|
133
|
+
} .tabs__selected_1m9uu {
|
|
134
134
|
cursor: default;
|
|
135
135
|
color: var(--primary-tablist-selected-color);
|
|
136
|
-
} .
|
|
136
|
+
} .tabs__disabled_1m9uu {
|
|
137
137
|
cursor: var(--disabled-cursor);
|
|
138
138
|
color: var(--primary-tablist-disabled-color);
|
|
139
|
-
} .
|
|
139
|
+
} .tabs__line_1m9uu {
|
|
140
140
|
position: absolute;
|
|
141
141
|
height: 3px;
|
|
142
142
|
bottom: 0;
|
|
143
143
|
left: 0;
|
|
144
144
|
background-color: var(--primary-tablist-line-color);
|
|
145
145
|
transition: transform 0.2s ease, width 0.2s ease;
|
|
146
|
-
}
|
|
146
|
+
} .tabs__option_1m9uu {
|
|
147
|
+
color: var(--color-light-text-primary);
|
|
148
|
+
} /* sizes */ .tabs__s_1m9uu .tabs__title_1m9uu, .tabs__xs_1m9uu .tabs__title_1m9uu, .tabs__xxs_1m9uu .tabs__title_1m9uu {
|
|
147
149
|
padding: var(--primary-tablist-s-padding);
|
|
148
150
|
font-size: var(--primary-tablist-s-font-size);
|
|
149
151
|
font-weight: var(--primary-tablist-s-font-weight);
|
|
150
152
|
font-family: var(--primary-tablist-s-font-family);
|
|
151
153
|
line-height: 24px;
|
|
152
|
-
} .
|
|
154
|
+
} .tabs__s_1m9uu .tabs__title_1m9uu + .tabs__title_1m9uu, .tabs__xs_1m9uu .tabs__title_1m9uu + .tabs__title_1m9uu, .tabs__xxs_1m9uu .tabs__title_1m9uu + .tabs__title_1m9uu {
|
|
153
155
|
margin-left: var(--primary-tablist-s-gaps);
|
|
154
|
-
} .
|
|
156
|
+
} .tabs__s_1m9uu .tabs__pickerWrapper_1m9uu, .tabs__xs_1m9uu .tabs__pickerWrapper_1m9uu, .tabs__xxs_1m9uu .tabs__pickerWrapper_1m9uu {
|
|
155
157
|
margin-left: var(--primary-tablist-s-gaps);
|
|
156
|
-
} .
|
|
158
|
+
} .tabs__s_1m9uu .tabs__option_1m9uu, .tabs__xs_1m9uu .tabs__option_1m9uu, .tabs__xxs_1m9uu .tabs__option_1m9uu {
|
|
157
159
|
padding: 0;
|
|
158
|
-
} .
|
|
160
|
+
} .tabs__m_1m9uu .tabs__title_1m9uu {
|
|
159
161
|
padding: var(--primary-tablist-m-padding);
|
|
160
162
|
font-size: var(--primary-tablist-m-font-size);
|
|
161
163
|
font-weight: var(--primary-tablist-m-font-weight);
|
|
162
164
|
font-family: var(--primary-tablist-m-font-family);
|
|
163
165
|
line-height: 24px;
|
|
164
|
-
} .
|
|
166
|
+
} .tabs__m_1m9uu .tabs__title_1m9uu + .tabs__title_1m9uu {
|
|
165
167
|
margin-left: var(--primary-tablist-m-gaps);
|
|
166
|
-
} .
|
|
168
|
+
} .tabs__m_1m9uu .tabs__pickerWrapper_1m9uu {
|
|
167
169
|
margin-left: var(--primary-tablist-m-gaps);
|
|
168
|
-
} .
|
|
170
|
+
} .tabs__m_1m9uu .tabs__option_1m9uu {
|
|
169
171
|
padding: 0;
|
|
170
|
-
} .
|
|
172
|
+
} .tabs__l_1m9uu .tabs__title_1m9uu {
|
|
171
173
|
padding: var(--primary-tablist-l-padding);
|
|
172
174
|
font-size: var(--primary-tablist-l-font-size);
|
|
173
175
|
font-weight: var(--primary-tablist-l-font-weight);
|
|
174
176
|
font-family: var(--primary-tablist-l-font-family);
|
|
175
177
|
line-height: 24px;
|
|
176
|
-
} .
|
|
178
|
+
} .tabs__l_1m9uu .tabs__title_1m9uu + .tabs__title_1m9uu {
|
|
177
179
|
margin-left: var(--primary-tablist-l-gaps);
|
|
178
|
-
} .
|
|
180
|
+
} .tabs__l_1m9uu .tabs__pickerWrapper_1m9uu {
|
|
179
181
|
margin-left: var(--primary-tablist-l-gaps);
|
|
180
|
-
} .
|
|
182
|
+
} .tabs__l_1m9uu .tabs__option_1m9uu {
|
|
181
183
|
padding: 0;
|
|
182
|
-
} .
|
|
184
|
+
} .tabs__xl_1m9uu .tabs__title_1m9uu {
|
|
183
185
|
padding: var(--primary-tablist-xl-padding);
|
|
184
186
|
font-size: var(--primary-tablist-xl-font-size);
|
|
185
187
|
font-weight: var(--primary-tablist-xl-font-weight);
|
|
186
188
|
font-family: var(--primary-tablist-xl-font-family);
|
|
187
189
|
line-height: 32px;
|
|
188
|
-
} .
|
|
190
|
+
} .tabs__xl_1m9uu .tabs__title_1m9uu + .tabs__title_1m9uu {
|
|
189
191
|
margin-left: var(--primary-tablist-xl-gaps);
|
|
190
|
-
} .
|
|
192
|
+
} .tabs__xl_1m9uu .tabs__pickerWrapper_1m9uu {
|
|
191
193
|
margin-left: var(--primary-tablist-xl-gaps);
|
|
192
|
-
} .
|
|
194
|
+
} .tabs__xl_1m9uu .tabs__option_1m9uu {
|
|
193
195
|
padding: 0;
|
|
194
|
-
} .
|
|
196
|
+
} .tabs__rightAddons_1m9uu {
|
|
195
197
|
display: flex;
|
|
196
198
|
justify-content: center;
|
|
197
199
|
align-items: center;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1ygs1 */
|
|
2
2
|
:root {
|
|
3
3
|
}/* deprecated */:root {
|
|
4
4
|
--color-light-border-accent: #ef3124;
|
|
@@ -90,11 +90,11 @@
|
|
|
90
90
|
/* size l */
|
|
91
91
|
|
|
92
92
|
/* size xl */
|
|
93
|
-
}.
|
|
93
|
+
}.tabs__component_1m9uu {
|
|
94
94
|
position: relative;
|
|
95
95
|
display: inline-flex;
|
|
96
96
|
min-width: 100%
|
|
97
|
-
}.
|
|
97
|
+
}.tabs__component_1m9uu:before {
|
|
98
98
|
content: '';
|
|
99
99
|
display: block;
|
|
100
100
|
position: absolute;
|
|
@@ -102,17 +102,17 @@
|
|
|
102
102
|
height: 1px;
|
|
103
103
|
width: 100%;
|
|
104
104
|
background-color: var(--primary-tablist-bottom-border-color);
|
|
105
|
-
}.
|
|
105
|
+
}.tabs__fullWidthScroll_1m9uu {
|
|
106
106
|
min-width: calc(100% - 2 * var(--gap-m));
|
|
107
107
|
margin: 0 var(--gap-m);
|
|
108
|
-
}.
|
|
108
|
+
}.tabs__container_1m9uu {
|
|
109
109
|
position: relative;
|
|
110
110
|
overflow: hidden;
|
|
111
111
|
|
|
112
112
|
/* focus-outline fix */
|
|
113
113
|
margin: var(--gap-2xs-neg) 0 var(--gap-2xs-neg) var(--gap-2xs-neg);
|
|
114
114
|
padding: var(--gap-2xs) 0 var(--gap-2xs) var(--gap-2xs);
|
|
115
|
-
}.
|
|
115
|
+
}.tabs__title_1m9uu {
|
|
116
116
|
display: flex;
|
|
117
117
|
align-items: center;
|
|
118
118
|
height: 100%;
|
|
@@ -129,76 +129,78 @@
|
|
|
129
129
|
user-select: none;
|
|
130
130
|
cursor: pointer;
|
|
131
131
|
outline: none
|
|
132
|
-
}.
|
|
132
|
+
}.tabs__title_1m9uu:not(.tabs__disabled_1m9uu):hover {
|
|
133
133
|
color: var(--primary-tablist-hover-color);
|
|
134
|
-
}.
|
|
134
|
+
}.tabs__focused_1m9uu {
|
|
135
135
|
outline: 2px solid var(--focus-color);
|
|
136
136
|
outline-offset: 2px;
|
|
137
|
-
}.
|
|
137
|
+
}.tabs__collapsed_1m9uu {
|
|
138
138
|
order: 99;
|
|
139
139
|
visibility: collapse;
|
|
140
|
-
}.
|
|
140
|
+
}.tabs__selected_1m9uu {
|
|
141
141
|
cursor: default;
|
|
142
142
|
color: var(--primary-tablist-selected-color);
|
|
143
|
-
}.
|
|
143
|
+
}.tabs__disabled_1m9uu {
|
|
144
144
|
cursor: var(--disabled-cursor);
|
|
145
145
|
color: var(--primary-tablist-disabled-color);
|
|
146
|
-
}.
|
|
146
|
+
}.tabs__line_1m9uu {
|
|
147
147
|
position: absolute;
|
|
148
148
|
height: 3px;
|
|
149
149
|
bottom: 0;
|
|
150
150
|
left: 0;
|
|
151
151
|
background-color: var(--primary-tablist-line-color);
|
|
152
152
|
transition: transform 0.2s ease, width 0.2s ease;
|
|
153
|
-
}
|
|
153
|
+
}.tabs__option_1m9uu {
|
|
154
|
+
color: var(--color-light-text-primary);
|
|
155
|
+
}/* sizes */.tabs__s_1m9uu .tabs__title_1m9uu, .tabs__xs_1m9uu .tabs__title_1m9uu, .tabs__xxs_1m9uu .tabs__title_1m9uu {
|
|
154
156
|
padding: var(--primary-tablist-s-padding);
|
|
155
157
|
font-size: var(--primary-tablist-s-font-size);
|
|
156
158
|
font-weight: var(--primary-tablist-s-font-weight);
|
|
157
159
|
font-family: var(--primary-tablist-s-font-family);
|
|
158
160
|
line-height: 24px;
|
|
159
|
-
}.
|
|
161
|
+
}.tabs__s_1m9uu .tabs__title_1m9uu + .tabs__title_1m9uu, .tabs__xs_1m9uu .tabs__title_1m9uu + .tabs__title_1m9uu, .tabs__xxs_1m9uu .tabs__title_1m9uu + .tabs__title_1m9uu {
|
|
160
162
|
margin-left: var(--primary-tablist-s-gaps);
|
|
161
|
-
}.
|
|
163
|
+
}.tabs__s_1m9uu .tabs__pickerWrapper_1m9uu, .tabs__xs_1m9uu .tabs__pickerWrapper_1m9uu, .tabs__xxs_1m9uu .tabs__pickerWrapper_1m9uu {
|
|
162
164
|
margin-left: var(--primary-tablist-s-gaps);
|
|
163
|
-
}.
|
|
165
|
+
}.tabs__s_1m9uu .tabs__option_1m9uu, .tabs__xs_1m9uu .tabs__option_1m9uu, .tabs__xxs_1m9uu .tabs__option_1m9uu {
|
|
164
166
|
padding: 0;
|
|
165
|
-
}.
|
|
167
|
+
}.tabs__m_1m9uu .tabs__title_1m9uu {
|
|
166
168
|
padding: var(--primary-tablist-m-padding);
|
|
167
169
|
font-size: var(--primary-tablist-m-font-size);
|
|
168
170
|
font-weight: var(--primary-tablist-m-font-weight);
|
|
169
171
|
font-family: var(--primary-tablist-m-font-family);
|
|
170
172
|
line-height: 24px;
|
|
171
|
-
}.
|
|
173
|
+
}.tabs__m_1m9uu .tabs__title_1m9uu + .tabs__title_1m9uu {
|
|
172
174
|
margin-left: var(--primary-tablist-m-gaps);
|
|
173
|
-
}.
|
|
175
|
+
}.tabs__m_1m9uu .tabs__pickerWrapper_1m9uu {
|
|
174
176
|
margin-left: var(--primary-tablist-m-gaps);
|
|
175
|
-
}.
|
|
177
|
+
}.tabs__m_1m9uu .tabs__option_1m9uu {
|
|
176
178
|
padding: 0;
|
|
177
|
-
}.
|
|
179
|
+
}.tabs__l_1m9uu .tabs__title_1m9uu {
|
|
178
180
|
padding: var(--primary-tablist-l-padding);
|
|
179
181
|
font-size: var(--primary-tablist-l-font-size);
|
|
180
182
|
font-weight: var(--primary-tablist-l-font-weight);
|
|
181
183
|
font-family: var(--primary-tablist-l-font-family);
|
|
182
184
|
line-height: 24px;
|
|
183
|
-
}.
|
|
185
|
+
}.tabs__l_1m9uu .tabs__title_1m9uu + .tabs__title_1m9uu {
|
|
184
186
|
margin-left: var(--primary-tablist-l-gaps);
|
|
185
|
-
}.
|
|
187
|
+
}.tabs__l_1m9uu .tabs__pickerWrapper_1m9uu {
|
|
186
188
|
margin-left: var(--primary-tablist-l-gaps);
|
|
187
|
-
}.
|
|
189
|
+
}.tabs__l_1m9uu .tabs__option_1m9uu {
|
|
188
190
|
padding: 0;
|
|
189
|
-
}.
|
|
191
|
+
}.tabs__xl_1m9uu .tabs__title_1m9uu {
|
|
190
192
|
padding: var(--primary-tablist-xl-padding);
|
|
191
193
|
font-size: var(--primary-tablist-xl-font-size);
|
|
192
194
|
font-weight: var(--primary-tablist-xl-font-weight);
|
|
193
195
|
font-family: var(--primary-tablist-xl-font-family);
|
|
194
196
|
line-height: 32px;
|
|
195
|
-
}.
|
|
197
|
+
}.tabs__xl_1m9uu .tabs__title_1m9uu + .tabs__title_1m9uu {
|
|
196
198
|
margin-left: var(--primary-tablist-xl-gaps);
|
|
197
|
-
}.
|
|
199
|
+
}.tabs__xl_1m9uu .tabs__pickerWrapper_1m9uu {
|
|
198
200
|
margin-left: var(--primary-tablist-xl-gaps);
|
|
199
|
-
}.
|
|
201
|
+
}.tabs__xl_1m9uu .tabs__option_1m9uu {
|
|
200
202
|
padding: 0;
|
|
201
|
-
}.
|
|
203
|
+
}.tabs__rightAddons_1m9uu {
|
|
202
204
|
display: flex;
|
|
203
205
|
justify-content: center;
|
|
204
206
|
align-items: center;
|
|
@@ -1106,13 +1108,13 @@
|
|
|
1106
1108
|
|
|
1107
1109
|
/* size xl */
|
|
1108
1110
|
--secondary-tablist-xl-gaps: var(--gap-m);
|
|
1109
|
-
} .
|
|
1110
|
-
} .
|
|
1111
|
+
} .tabs__title_nd1k6 {
|
|
1112
|
+
} .tabs__mobile_nd1k6 .tabs__title_nd1k6 {
|
|
1111
1113
|
padding: var(--primary-tablist-mobile-padding);
|
|
1112
1114
|
font-size: var(--primary-tablist-mobile-font-size);
|
|
1113
1115
|
font-weight: var(--primary-tablist-mobile-font-weight);
|
|
1114
1116
|
font-family: var(--primary-tablist-mobile-font-family);
|
|
1115
1117
|
line-height: var(--primary-tablist-mobile-line-height)
|
|
1116
|
-
} .
|
|
1118
|
+
} .tabs__mobile_nd1k6 .tabs__title_nd1k6 + .tabs__title_nd1k6 {
|
|
1117
1119
|
margin-left: var(--primary-tablist-mobile-gaps);
|
|
1118
1120
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { RefObject } from "react";
|
|
4
|
+
import { TabsProps } from "../../typings";
|
|
5
|
+
type ScrollControlsProps = {
|
|
6
|
+
view: Exclude<TabsProps['view'], undefined>;
|
|
7
|
+
size: TabsProps['size'];
|
|
8
|
+
containerRef: RefObject<HTMLDivElement>;
|
|
9
|
+
};
|
|
10
|
+
declare const ScrollControls: React.ForwardRefExoticComponent<ScrollControlsProps & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
export { ScrollControls };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React, { forwardRef, useState, useEffect } from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
import _debounce from 'lodash.debounce';
|
|
4
|
+
import { IconButton } from '@alfalab/core-components-icon-button/modern';
|
|
5
|
+
import { ChevronLeftMIcon } from '@alfalab/icons-glyph/ChevronLeftMIcon';
|
|
6
|
+
import { ChevronRightMIcon } from '@alfalab/icons-glyph/ChevronRightMIcon';
|
|
7
|
+
import { getDisabledState, scrollIntoFirstTab, scrollIntoLastTab } from './utils.js';
|
|
8
|
+
|
|
9
|
+
const styles = {"component":"tabs__component_1ov4g","borderVisible":"tabs__borderVisible_1ov4g","primary":"tabs__primary_1ov4g","button":"tabs__button_1ov4g","xl":"tabs__xl_1ov4g","secondary":"tabs__secondary_1ov4g","xs":"tabs__xs_1ov4g"};
|
|
10
|
+
require('./index.css')
|
|
11
|
+
|
|
12
|
+
const ScrollControls = forwardRef(({ containerRef, view, size: sizeProp }, ref) => {
|
|
13
|
+
const container = containerRef.current;
|
|
14
|
+
const [disabledState, updateDisabledState] = useState(() => getDisabledState(container));
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
const handleScroll = _debounce(() => updateDisabledState(getDisabledState(container)), 100, { leading: true, maxWait: 100, trailing: true });
|
|
17
|
+
container?.addEventListener('scroll', handleScroll);
|
|
18
|
+
return () => container?.removeEventListener('scroll', handleScroll);
|
|
19
|
+
}, [container]);
|
|
20
|
+
const getSize = () => {
|
|
21
|
+
if (view === 'primary') {
|
|
22
|
+
return sizeProp === 'xl' ? 'xs' : 'xxs';
|
|
23
|
+
}
|
|
24
|
+
return sizeProp && ['s', 'm', 'l', 'xl'].includes(sizeProp) ? 's' : 'xs';
|
|
25
|
+
};
|
|
26
|
+
const handleScrollLeft = () => scrollIntoFirstTab(container);
|
|
27
|
+
const handleScrollRight = () => scrollIntoLastTab(container);
|
|
28
|
+
const commonButtonProps = {
|
|
29
|
+
className: styles.button,
|
|
30
|
+
size: getSize(),
|
|
31
|
+
view: 'secondary',
|
|
32
|
+
};
|
|
33
|
+
return (React.createElement("div", { ref: ref, className: cn(styles.component, styles[view], sizeProp && styles[sizeProp], {
|
|
34
|
+
[styles.borderVisible]: !disabledState.toRight,
|
|
35
|
+
}) },
|
|
36
|
+
React.createElement(IconButton, { ...commonButtonProps, icon: ChevronLeftMIcon, disabled: disabledState.toLeft, onClick: handleScrollLeft }),
|
|
37
|
+
React.createElement(IconButton, { ...commonButtonProps, icon: ChevronRightMIcon, disabled: disabledState.toRight, onClick: handleScrollRight })));
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
export { ScrollControls };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/* hash: h4a1t */
|
|
2
|
+
:root {
|
|
3
|
+
} /* deprecated */ :root {
|
|
4
|
+
--color-light-border-primary: #dcdcdd;
|
|
5
|
+
--color-light-specialbg-tertiary-transparent: rgba(11, 31, 53, 0.1); /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
6
|
+
} :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
7
|
+
} :root {
|
|
8
|
+
} :root {
|
|
9
|
+
|
|
10
|
+
/* Hard */
|
|
11
|
+
|
|
12
|
+
/* Up */
|
|
13
|
+
|
|
14
|
+
/* Hard up */
|
|
15
|
+
} :root {
|
|
16
|
+
} :root {
|
|
17
|
+
--gap-2xs: 4px;
|
|
18
|
+
--gap-xs: 8px;
|
|
19
|
+
} :root {
|
|
20
|
+
} :root {
|
|
21
|
+
} :root {
|
|
22
|
+
--primary-tablist-bottom-border-color: var(--color-light-border-primary);
|
|
23
|
+
|
|
24
|
+
/* mobile */
|
|
25
|
+
|
|
26
|
+
/* size s */
|
|
27
|
+
|
|
28
|
+
/* size m */
|
|
29
|
+
|
|
30
|
+
/* size l */
|
|
31
|
+
|
|
32
|
+
/* size xl */
|
|
33
|
+
|
|
34
|
+
/* mobile */
|
|
35
|
+
|
|
36
|
+
/* size xxs */
|
|
37
|
+
|
|
38
|
+
/* size xs */
|
|
39
|
+
|
|
40
|
+
/* size s */
|
|
41
|
+
|
|
42
|
+
/* size m */
|
|
43
|
+
|
|
44
|
+
/* size l */
|
|
45
|
+
|
|
46
|
+
/* size xl */
|
|
47
|
+
} .tabs__component_1ov4g {
|
|
48
|
+
position: relative;
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-shrink: 0
|
|
51
|
+
} .tabs__component_1ov4g:before {
|
|
52
|
+
content: '';
|
|
53
|
+
display: block;
|
|
54
|
+
position: absolute;
|
|
55
|
+
top: 0;
|
|
56
|
+
left: 0;
|
|
57
|
+
width: 1px;
|
|
58
|
+
background-color: transparent;
|
|
59
|
+
transition: background-color 0.3s ease;
|
|
60
|
+
} .tabs__borderVisible_1ov4g:before {
|
|
61
|
+
background-color: var(--color-light-specialbg-tertiary-transparent);
|
|
62
|
+
} .tabs__primary_1ov4g {
|
|
63
|
+
align-items: flex-start;
|
|
64
|
+
justify-content: flex-end
|
|
65
|
+
} .tabs__primary_1ov4g:after {
|
|
66
|
+
content: '';
|
|
67
|
+
display: block;
|
|
68
|
+
position: absolute;
|
|
69
|
+
bottom: 1px;
|
|
70
|
+
height: 1px;
|
|
71
|
+
width: 100%;
|
|
72
|
+
background-color: var(--primary-tablist-bottom-border-color);
|
|
73
|
+
} .tabs__primary_1ov4g:before {
|
|
74
|
+
bottom: 2px;
|
|
75
|
+
} .tabs__primary_1ov4g {
|
|
76
|
+
|
|
77
|
+
.tabs__button_1ov4g:first-child {
|
|
78
|
+
padding-left: var(--gap-xs);
|
|
79
|
+
margin-right: var(--gap-xs);
|
|
80
|
+
}
|
|
81
|
+
} .tabs__primary_1ov4g.tabs__xl_1ov4g .tabs__button_1ov4g:first-child {
|
|
82
|
+
margin-right: var(--gap-2xs);
|
|
83
|
+
} .tabs__secondary_1ov4g {
|
|
84
|
+
align-items: center;
|
|
85
|
+
justify-content: center
|
|
86
|
+
} .tabs__secondary_1ov4g:before {
|
|
87
|
+
bottom: 0;
|
|
88
|
+
} .tabs__secondary_1ov4g.tabs__xs_1ov4g {
|
|
89
|
+
width: 76px;
|
|
90
|
+
|
|
91
|
+
.tabs__button_1ov4g:first-child {
|
|
92
|
+
margin-right: var(--gap-2xs);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ScrollControls } from "./Component";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { ScrollControls } from './Component.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import 'classnames';
|
|
4
|
+
import 'lodash.debounce';
|
|
5
|
+
import '@alfalab/core-components-icon-button/modern';
|
|
6
|
+
import '@alfalab/icons-glyph/ChevronLeftMIcon';
|
|
7
|
+
import '@alfalab/icons-glyph/ChevronRightMIcon';
|
|
8
|
+
import './utils.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare function scrollIntoLastTab(container: HTMLDivElement | null): void;
|
|
2
|
+
declare function scrollIntoFirstTab(container: HTMLDivElement | null): void;
|
|
3
|
+
declare function getDisabledState(container: HTMLDivElement | null): {
|
|
4
|
+
toLeft: boolean;
|
|
5
|
+
toRight: boolean;
|
|
6
|
+
};
|
|
7
|
+
export { scrollIntoLastTab, scrollIntoFirstTab, getDisabledState };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const ADDITIONAL_OFFSET = 15;
|
|
2
|
+
function getTabs(container) {
|
|
3
|
+
return Array.from(container.querySelectorAll('button[role="tab"]'));
|
|
4
|
+
}
|
|
5
|
+
function findLastVisibleTab(container) {
|
|
6
|
+
const tabs = getTabs(container);
|
|
7
|
+
return tabs.reduce((res, tab) => {
|
|
8
|
+
if (tab.offsetLeft + ADDITIONAL_OFFSET < container.clientWidth + container.scrollLeft) {
|
|
9
|
+
return tab;
|
|
10
|
+
}
|
|
11
|
+
return res;
|
|
12
|
+
}, tabs[0]);
|
|
13
|
+
}
|
|
14
|
+
function findFirstVisibleTab(container) {
|
|
15
|
+
const tabs = getTabs(container);
|
|
16
|
+
return tabs.reduceRight((res, tab) => {
|
|
17
|
+
if (tab.offsetLeft + tab.clientWidth > container.scrollLeft + ADDITIONAL_OFFSET) {
|
|
18
|
+
return tab;
|
|
19
|
+
}
|
|
20
|
+
return res;
|
|
21
|
+
}, tabs[tabs.length - 1]);
|
|
22
|
+
}
|
|
23
|
+
function scrollIntoLastTab(container) {
|
|
24
|
+
if (!container)
|
|
25
|
+
return;
|
|
26
|
+
findLastVisibleTab(container).scrollIntoView({
|
|
27
|
+
behavior: 'smooth',
|
|
28
|
+
block: 'nearest',
|
|
29
|
+
inline: 'start',
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function scrollIntoFirstTab(container) {
|
|
33
|
+
if (!container)
|
|
34
|
+
return;
|
|
35
|
+
findFirstVisibleTab(container).scrollIntoView({
|
|
36
|
+
behavior: 'smooth',
|
|
37
|
+
block: 'nearest',
|
|
38
|
+
inline: 'end',
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function getDisabledState(container) {
|
|
42
|
+
if (!container)
|
|
43
|
+
return { toLeft: false, toRight: false };
|
|
44
|
+
const scrollOffset = 2;
|
|
45
|
+
const toLeft = container.scrollLeft <= scrollOffset;
|
|
46
|
+
const toRight = container.scrollLeft + container.clientWidth >= container.scrollWidth - scrollOffset;
|
|
47
|
+
return { toLeft, toRight };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export { getDisabledState, scrollIntoFirstTab, scrollIntoLastTab };
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
|
-
import { TabsProps } from "../../typings";
|
|
4
|
+
import { PlatformProps, TabsProps } from "../../typings";
|
|
5
5
|
type ScrollableContainerProps = {
|
|
6
|
+
/**
|
|
7
|
+
* Дополнительный класс враппера контейнера
|
|
8
|
+
*/
|
|
9
|
+
containerWrapperClassName?: string;
|
|
6
10
|
/**
|
|
7
11
|
* Дополнительный класс контейнера
|
|
8
12
|
*/
|
|
@@ -15,6 +19,14 @@ type ScrollableContainerProps = {
|
|
|
15
19
|
* Активный элемент (всегда будет в видимой области)
|
|
16
20
|
*/
|
|
17
21
|
activeChild: HTMLElement | null;
|
|
22
|
+
/**
|
|
23
|
+
* Внешний вид заголовков табов
|
|
24
|
+
*/
|
|
25
|
+
view: Exclude<TabsProps['view'], undefined>;
|
|
26
|
+
/**
|
|
27
|
+
* Размер
|
|
28
|
+
*/
|
|
29
|
+
size: TabsProps['size'];
|
|
18
30
|
};
|
|
19
|
-
declare const ScrollableContainer: ({ containerClassName, children, activeChild, fullWidthScroll, }: ScrollableContainerProps & Pick<TabsProps, 'fullWidthScroll'>) => React.JSX.Element;
|
|
31
|
+
declare const ScrollableContainer: ({ containerWrapperClassName, containerClassName, children, activeChild, fullWidthScroll, view, size, platform, }: ScrollableContainerProps & Pick<TabsProps, 'fullWidthScroll'> & PlatformProps) => React.JSX.Element;
|
|
20
32
|
export { ScrollableContainerProps, ScrollableContainer };
|