@alfalab/core-components-tabs 6.3.2 → 6.5.0
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/CHANGELOG.md +22 -0
- package/components/primary-tablist/Component.d.ts +2 -1
- package/components/primary-tablist/Component.desktop.js +2 -2
- package/components/primary-tablist/Component.js +24 -19
- package/components/primary-tablist/Component.mobile.d.ts +1 -1
- package/components/primary-tablist/Component.mobile.js +3 -3
- package/components/primary-tablist/Component.responsive.d.ts +1 -1
- package/components/primary-tablist/Component.responsive.js +4 -4
- package/components/primary-tablist/index.css +27 -21
- package/components/primary-tablist/mobile.css +30 -24
- package/components/scrollable-container/Component.d.ts +2 -1
- package/components/scrollable-container/Component.js +14 -4
- package/components/scrollable-container/index.css +11 -6
- package/components/secondary-tablist/Component.d.ts +2 -1
- package/components/secondary-tablist/Component.desktop.d.ts +1 -1
- package/components/secondary-tablist/Component.desktop.js +2 -2
- package/components/secondary-tablist/Component.js +11 -6
- package/components/secondary-tablist/Component.mobile.d.ts +1 -1
- package/components/secondary-tablist/Component.mobile.js +3 -3
- package/components/secondary-tablist/Component.responsive.d.ts +1 -1
- package/components/secondary-tablist/Component.responsive.js +4 -4
- package/components/secondary-tablist/index.css +15 -14
- package/components/secondary-tablist/mobile.css +17 -16
- package/components/tab/Component.js +1 -1
- package/components/tab/index.css +3 -3
- package/components/tabs/Component.d.ts +1 -1
- package/components/tabs/Component.desktop.d.ts +1 -1
- package/components/tabs/Component.desktop.js +3 -3
- package/components/tabs/Component.js +4 -3
- package/components/tabs/Component.mobile.d.ts +1 -1
- package/components/tabs/Component.mobile.js +3 -3
- package/components/tabs/Component.responsive.d.ts +1 -1
- package/components/tabs/Component.responsive.js +3 -3
- package/cssm/components/primary-tablist/Component.d.ts +2 -1
- package/cssm/components/primary-tablist/Component.js +23 -18
- package/cssm/components/primary-tablist/Component.mobile.d.ts +1 -1
- package/cssm/components/primary-tablist/Component.responsive.d.ts +1 -1
- package/cssm/components/primary-tablist/Component.responsive.js +2 -2
- package/cssm/components/primary-tablist/index.module.css +8 -2
- package/cssm/components/scrollable-container/Component.d.ts +2 -1
- package/cssm/components/scrollable-container/Component.js +13 -3
- package/cssm/components/scrollable-container/index.module.css +7 -2
- package/cssm/components/secondary-tablist/Component.d.ts +2 -1
- package/cssm/components/secondary-tablist/Component.desktop.d.ts +1 -1
- package/cssm/components/secondary-tablist/Component.js +10 -5
- package/cssm/components/secondary-tablist/Component.mobile.d.ts +1 -1
- package/cssm/components/secondary-tablist/Component.responsive.d.ts +1 -1
- package/cssm/components/secondary-tablist/Component.responsive.js +2 -2
- package/cssm/components/secondary-tablist/index.module.css +5 -4
- package/cssm/components/tabs/Component.d.ts +1 -1
- package/cssm/components/tabs/Component.desktop.d.ts +1 -1
- package/cssm/components/tabs/Component.js +4 -3
- package/cssm/components/tabs/Component.mobile.d.ts +1 -1
- package/cssm/components/tabs/Component.responsive.d.ts +1 -1
- package/cssm/typings.d.ts +11 -2
- package/desktop.js +3 -3
- package/esm/components/primary-tablist/Component.d.ts +2 -1
- package/esm/components/primary-tablist/Component.desktop.js +2 -2
- package/esm/components/primary-tablist/Component.js +24 -19
- package/esm/components/primary-tablist/Component.mobile.d.ts +1 -1
- package/esm/components/primary-tablist/Component.mobile.js +3 -3
- package/esm/components/primary-tablist/Component.responsive.d.ts +1 -1
- package/esm/components/primary-tablist/Component.responsive.js +4 -4
- package/esm/components/primary-tablist/index.css +27 -21
- package/esm/components/primary-tablist/mobile.css +30 -24
- package/esm/components/scrollable-container/Component.d.ts +2 -1
- package/esm/components/scrollable-container/Component.js +14 -4
- package/esm/components/scrollable-container/index.css +11 -6
- package/esm/components/secondary-tablist/Component.d.ts +2 -1
- package/esm/components/secondary-tablist/Component.desktop.d.ts +1 -1
- package/esm/components/secondary-tablist/Component.desktop.js +2 -2
- package/esm/components/secondary-tablist/Component.js +11 -6
- package/esm/components/secondary-tablist/Component.mobile.d.ts +1 -1
- package/esm/components/secondary-tablist/Component.mobile.js +3 -3
- package/esm/components/secondary-tablist/Component.responsive.d.ts +1 -1
- package/esm/components/secondary-tablist/Component.responsive.js +4 -4
- package/esm/components/secondary-tablist/index.css +15 -14
- package/esm/components/secondary-tablist/mobile.css +17 -16
- package/esm/components/tab/Component.js +1 -1
- package/esm/components/tab/index.css +3 -3
- package/esm/components/tabs/Component.d.ts +1 -1
- package/esm/components/tabs/Component.desktop.d.ts +1 -1
- package/esm/components/tabs/Component.desktop.js +3 -3
- package/esm/components/tabs/Component.js +4 -3
- package/esm/components/tabs/Component.mobile.d.ts +1 -1
- package/esm/components/tabs/Component.mobile.js +3 -3
- package/esm/components/tabs/Component.responsive.d.ts +1 -1
- package/esm/components/tabs/Component.responsive.js +3 -3
- package/esm/desktop.js +3 -3
- package/esm/index.js +3 -3
- package/esm/index.module-4bf6c045.js +4 -0
- package/esm/index.module-c15e7c79.js +4 -0
- package/esm/mobile.js +3 -3
- package/esm/responsive.js +3 -3
- package/esm/{tslib.es6-d595f357.d.ts → tslib.es6-b50bf201.d.ts} +0 -0
- package/esm/{tslib.es6-d595f357.js → tslib.es6-b50bf201.js} +0 -0
- package/esm/typings.d.ts +11 -2
- package/index.js +3 -3
- package/index.module-960245fb.js +6 -0
- package/index.module-d67ef5e7.js +6 -0
- package/mobile.js +3 -3
- package/modern/components/primary-tablist/Component.d.ts +2 -1
- package/modern/components/primary-tablist/Component.desktop.js +1 -1
- package/modern/components/primary-tablist/Component.js +7 -5
- package/modern/components/primary-tablist/Component.mobile.d.ts +1 -1
- package/modern/components/primary-tablist/Component.mobile.js +2 -2
- package/modern/components/primary-tablist/Component.responsive.d.ts +1 -1
- package/modern/components/primary-tablist/Component.responsive.js +3 -3
- package/modern/components/primary-tablist/index.css +27 -21
- package/modern/components/primary-tablist/mobile.css +30 -24
- package/modern/components/scrollable-container/Component.d.ts +2 -1
- package/modern/components/scrollable-container/Component.js +13 -4
- package/modern/components/scrollable-container/index.css +11 -6
- package/modern/components/secondary-tablist/Component.d.ts +2 -1
- package/modern/components/secondary-tablist/Component.desktop.d.ts +1 -1
- package/modern/components/secondary-tablist/Component.desktop.js +1 -1
- package/modern/components/secondary-tablist/Component.js +9 -5
- package/modern/components/secondary-tablist/Component.mobile.d.ts +1 -1
- package/modern/components/secondary-tablist/Component.mobile.js +2 -2
- package/modern/components/secondary-tablist/Component.responsive.d.ts +1 -1
- package/modern/components/secondary-tablist/Component.responsive.js +3 -3
- package/modern/components/secondary-tablist/index.css +15 -14
- package/modern/components/secondary-tablist/mobile.css +17 -16
- package/modern/components/tab/Component.js +1 -1
- package/modern/components/tab/index.css +3 -3
- package/modern/components/tabs/Component.d.ts +1 -1
- package/modern/components/tabs/Component.desktop.d.ts +1 -1
- package/modern/components/tabs/Component.desktop.js +2 -2
- package/modern/components/tabs/Component.js +4 -3
- package/modern/components/tabs/Component.mobile.d.ts +1 -1
- package/modern/components/tabs/Component.mobile.js +2 -2
- package/modern/components/tabs/Component.responsive.d.ts +1 -1
- package/modern/components/tabs/Component.responsive.js +2 -2
- package/modern/desktop.js +2 -2
- package/modern/index.js +2 -2
- package/modern/index.module-4bf6c045.js +4 -0
- package/modern/index.module-c15e7c79.js +4 -0
- package/modern/mobile.js +2 -2
- package/modern/responsive.js +2 -2
- package/modern/typings.d.ts +11 -2
- package/package.json +4 -4
- package/responsive.js +3 -3
- package/{tslib.es6-21f3b6da.d.ts → tslib.es6-996824db.d.ts} +0 -0
- package/{tslib.es6-21f3b6da.js → tslib.es6-996824db.js} +0 -0
- package/typings.d.ts +11 -2
- package/esm/index.module-7be29ac4.js +0 -4
- package/esm/index.module-a7445354.js +0 -4
- package/index.module-5ed9b0e6.js +0 -6
- package/index.module-fa5020d4.js +0 -6
- package/modern/index.module-7be29ac4.js +0 -4
- package/modern/index.module-a7445354.js +0 -4
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Styles } from "../../typings";
|
|
4
|
-
declare const SecondaryTabList: ({ styles, className, containerClassName, size, titles, selectedId, scrollable, tagSize, onChange, dataTestId, }: Pick<import("../../typings").TabsProps, "className" | "onChange" | "size" | "dataTestId" | "containerClassName" | "defaultMatch" | "selectedId" | "scrollable"> & {
|
|
4
|
+
declare const SecondaryTabList: ({ styles, className, containerClassName, size, titles, selectedId, scrollable, fullWidthScroll, tagSize, onChange, dataTestId, }: Pick<import("../../typings").TabsProps, "className" | "onChange" | "size" | "dataTestId" | "containerClassName" | "defaultMatch" | "selectedId" | "scrollable" | "fullWidthScroll"> & {
|
|
5
5
|
titles?: {
|
|
6
6
|
title: string;
|
|
7
7
|
id: React.ReactText;
|
|
8
8
|
disabled?: boolean | undefined;
|
|
9
9
|
rightAddons?: React.ReactNode;
|
|
10
10
|
hidden?: boolean | undefined;
|
|
11
|
+
toggleClassName?: string | undefined;
|
|
11
12
|
}[] | undefined;
|
|
12
13
|
} & {
|
|
13
14
|
tagSize?: "xxs" | "xs" | "s" | "m" | "l" | "xl" | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { SecondaryTabListProps } from "../../typings";
|
|
3
3
|
type SecondaryTabListDesktopProps = Omit<SecondaryTabListProps, 'tagSize'>;
|
|
4
|
-
declare const SecondaryTabListDesktop: ({ size, ...restProps }: Pick<SecondaryTabListProps, "className" | "onChange" | "size" | "dataTestId" | "containerClassName" | "defaultMatch" | "selectedId" | "scrollable" | "titles">) => JSX.Element;
|
|
4
|
+
declare const SecondaryTabListDesktop: ({ size, ...restProps }: Pick<SecondaryTabListProps, "className" | "onChange" | "size" | "dataTestId" | "containerClassName" | "defaultMatch" | "selectedId" | "scrollable" | "fullWidthScroll" | "titles">) => JSX.Element;
|
|
5
5
|
export { SecondaryTabListDesktopProps, SecondaryTabListDesktop };
|
|
@@ -17,18 +17,23 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
17
17
|
var cn__default = /*#__PURE__*/_interopDefaultLegacy(cn);
|
|
18
18
|
|
|
19
19
|
var SecondaryTabList = function (_a) {
|
|
20
|
-
var _b = _a.styles, styles = _b === void 0 ? {} : _b, className = _a.className, containerClassName = _a.containerClassName, size = _a.size, _c = _a.titles, titles = _c === void 0 ? [] : _c, _d = _a.selectedId, selectedId = _d === void 0 ? titles.length ? titles[0].id : undefined : _d, _e = _a.scrollable, scrollable = _e === void 0 ? true : _e, _f = _a.tagSize, tagSize = _f === void 0 ? 'xs' : _f, onChange = _a.onChange, dataTestId = _a.dataTestId;
|
|
20
|
+
var _b = _a.styles, styles = _b === void 0 ? {} : _b, className = _a.className, containerClassName = _a.containerClassName, size = _a.size, _c = _a.titles, titles = _c === void 0 ? [] : _c, _d = _a.selectedId, selectedId = _d === void 0 ? titles.length ? titles[0].id : undefined : _d, _e = _a.scrollable, scrollable = _e === void 0 ? true : _e, fullWidthScroll = _a.fullWidthScroll, _f = _a.tagSize, tagSize = _f === void 0 ? 'xs' : _f, onChange = _a.onChange, dataTestId = _a.dataTestId;
|
|
21
21
|
var _g = useTabs.useTabs({
|
|
22
22
|
titles: titles,
|
|
23
23
|
selectedId: selectedId,
|
|
24
24
|
onChange: onChange,
|
|
25
25
|
}), focusedTab = _g.focusedTab, selectedTab = _g.selectedTab, getTabListItemProps = _g.getTabListItemProps;
|
|
26
26
|
var renderContent = function () {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
var _a;
|
|
28
|
+
return (React__default['default'].createElement("div", { role: 'tablist', "data-test-id": dataTestId, className: cn__default['default'](styles.component, className, size && styles[size], (_a = {},
|
|
29
|
+
_a[styles.fullWidthScroll] = fullWidthScroll,
|
|
30
|
+
_a)) }, titles.map(function (item, index) {
|
|
31
|
+
if (item.hidden)
|
|
32
|
+
return null;
|
|
33
|
+
return (React__default['default'].createElement(coreComponentsTag.Tag, tslib_es6.__assign({}, getTabListItemProps(index), { key: item.id, className: cn__default['default'](styles.title, item.toggleClassName), checked: item.id === selectedId, size: tagSize, rightAddons: item.rightAddons }), item.title));
|
|
34
|
+
})));
|
|
30
35
|
};
|
|
31
|
-
return
|
|
36
|
+
return scrollable ? (React__default['default'].createElement(components_scrollableContainer_Component.ScrollableContainer, { activeChild: focusedTab || selectedTab, containerClassName: containerClassName, fullWidthScroll: fullWidthScroll }, renderContent())) : (React__default['default'].createElement("div", { className: cn__default['default'](styles.container, containerClassName) }, renderContent()));
|
|
32
37
|
};
|
|
33
38
|
|
|
34
39
|
exports.SecondaryTabList = SecondaryTabList;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { SecondaryTabListProps } from "../../typings";
|
|
3
3
|
type SecondaryTabListMobileProps = Omit<SecondaryTabListProps, 'size' | 'tagSize'>;
|
|
4
|
-
declare const SecondaryTabListMobile: ({ className, ...restProps }: Pick<SecondaryTabListProps, "className" | "onChange" | "dataTestId" | "containerClassName" | "defaultMatch" | "selectedId" | "scrollable" | "titles">) => JSX.Element;
|
|
4
|
+
declare const SecondaryTabListMobile: ({ className, ...restProps }: Pick<SecondaryTabListProps, "className" | "onChange" | "dataTestId" | "containerClassName" | "defaultMatch" | "selectedId" | "scrollable" | "fullWidthScroll" | "titles">) => JSX.Element;
|
|
5
5
|
export { SecondaryTabListMobileProps, SecondaryTabListMobile };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { SecondaryTabListProps } from "../../typings";
|
|
3
|
-
declare const SecondaryTabListResponsive: ({ size, defaultMatch, ...restProps }: SecondaryTabListProps) => JSX.Element;
|
|
3
|
+
declare const SecondaryTabListResponsive: ({ size, defaultMatch, fullWidthScroll, ...restProps }: SecondaryTabListProps) => JSX.Element;
|
|
4
4
|
export { SecondaryTabListResponsive };
|
|
@@ -22,12 +22,12 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
22
22
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
23
23
|
|
|
24
24
|
var SecondaryTabListResponsive = function (_a) {
|
|
25
|
-
var size = _a.size, _b = _a.defaultMatch, defaultMatch = _b === void 0 ? 'desktop' : _b, restProps = tslib_es6.__rest(_a, ["size", "defaultMatch"]);
|
|
25
|
+
var size = _a.size, _b = _a.defaultMatch, defaultMatch = _b === void 0 ? 'desktop' : _b, fullWidthScroll = _a.fullWidthScroll, restProps = tslib_es6.__rest(_a, ["size", "defaultMatch", "fullWidthScroll"]);
|
|
26
26
|
var view = hooks.useMedia([
|
|
27
27
|
['mobile', '(max-width: 767px)'],
|
|
28
28
|
['desktop', '(min-width: 768px)'],
|
|
29
29
|
], defaultMatch)[0];
|
|
30
|
-
return view === 'desktop' ? (React__default['default'].createElement(components_secondaryTablist_Component_desktop.SecondaryTabListDesktop, tslib_es6.__assign({ size: size }, restProps))) : (React__default['default'].createElement(components_secondaryTablist_Component_mobile.SecondaryTabListMobile, tslib_es6.__assign({}, restProps)));
|
|
30
|
+
return view === 'desktop' ? (React__default['default'].createElement(components_secondaryTablist_Component_desktop.SecondaryTabListDesktop, tslib_es6.__assign({ size: size }, restProps))) : (React__default['default'].createElement(components_secondaryTablist_Component_mobile.SecondaryTabListMobile, tslib_es6.__assign({ fullWidthScroll: fullWidthScroll }, restProps)));
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
exports.SecondaryTabListResponsive = SecondaryTabListResponsive;
|
|
@@ -45,12 +45,13 @@
|
|
|
45
45
|
}
|
|
46
46
|
.component {
|
|
47
47
|
position: relative;
|
|
48
|
-
display: flex;
|
|
49
|
-
|
|
48
|
+
display: inline-flex;
|
|
49
|
+
}
|
|
50
|
+
.fullWidthScroll {
|
|
51
|
+
margin: 0 var(--gap-m);
|
|
50
52
|
}
|
|
51
53
|
.container {
|
|
52
|
-
|
|
53
|
-
align-items: center;
|
|
54
|
+
overflow: hidden;
|
|
54
55
|
}
|
|
55
56
|
.title {
|
|
56
57
|
white-space: nowrap;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { TabsProps } from "../../typings";
|
|
3
|
-
declare const Tabs: ({ TabList, className, containerClassName, size, defaultMatch, children, selectedId, scrollable, keepMounted, dataTestId, onChange, }: Pick<TabsProps, "children" | "className" | "onChange" | "size" | "dataTestId" | "mobile" | "containerClassName" | "defaultMatch" | "selectedId" | "scrollable" | "keepMounted" | "TabList">) => JSX.Element;
|
|
3
|
+
declare const Tabs: ({ TabList, className, containerClassName, size, defaultMatch, children, selectedId, scrollable, fullWidthScroll, keepMounted, dataTestId, onChange, }: Pick<TabsProps, "children" | "className" | "onChange" | "size" | "dataTestId" | "mobile" | "containerClassName" | "defaultMatch" | "selectedId" | "scrollable" | "fullWidthScroll" | "keepMounted" | "TabList">) => JSX.Element;
|
|
4
4
|
export { Tabs };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { TabsProps } from "../../typings";
|
|
3
|
-
type TabsDesktopProps = Omit<TabsProps, 'TabList'>;
|
|
3
|
+
type TabsDesktopProps = Omit<TabsProps, 'TabList' | 'fullWidthScroll'>;
|
|
4
4
|
declare const TabsDesktop: ({ view, scrollable, size, ...restProps }: Pick<TabsProps, "children" | "className" | "onChange" | "size" | "dataTestId" | "view" | "mobile" | "containerClassName" | "defaultMatch" | "selectedId" | "scrollable" | "keepMounted">) => JSX.Element;
|
|
5
5
|
export { TabsDesktopProps, TabsDesktop };
|
|
@@ -9,21 +9,22 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
9
9
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
10
10
|
|
|
11
11
|
var Tabs = function (_a) {
|
|
12
|
-
var TabList = _a.TabList, className = _a.className, containerClassName = _a.containerClassName, size = _a.size, defaultMatch = _a.defaultMatch, children = _a.children, selectedId = _a.selectedId, scrollable = _a.scrollable, _b = _a.
|
|
12
|
+
var TabList = _a.TabList, className = _a.className, containerClassName = _a.containerClassName, size = _a.size, defaultMatch = _a.defaultMatch, children = _a.children, selectedId = _a.selectedId, scrollable = _a.scrollable, _b = _a.fullWidthScroll, fullWidthScroll = _b === void 0 ? false : _b, _c = _a.keepMounted, keepMounted = _c === void 0 ? false : _c, dataTestId = _a.dataTestId, onChange = _a.onChange;
|
|
13
13
|
var tabsArray = React__default['default'].Children.toArray(children);
|
|
14
14
|
var titles = tabsArray.map(function (_a) {
|
|
15
|
-
var _b = _a.props, title = _b.title, id = _b.id, rightAddons = _b.rightAddons, disabled = _b.disabled, hidden = _b.hidden;
|
|
15
|
+
var _b = _a.props, title = _b.title, id = _b.id, rightAddons = _b.rightAddons, disabled = _b.disabled, hidden = _b.hidden, toggleClassName = _b.toggleClassName;
|
|
16
16
|
return ({
|
|
17
17
|
title: title,
|
|
18
18
|
id: id,
|
|
19
19
|
disabled: disabled,
|
|
20
20
|
rightAddons: rightAddons,
|
|
21
21
|
hidden: hidden,
|
|
22
|
+
toggleClassName: toggleClassName,
|
|
22
23
|
});
|
|
23
24
|
});
|
|
24
25
|
var tabs = tabsArray.filter(function (tab) { return tab.props.id === selectedId || tab.props.keepMounted || keepMounted; });
|
|
25
26
|
return (React__default['default'].createElement("div", { className: className },
|
|
26
|
-
React__default['default'].createElement(TabList, { containerClassName: containerClassName, size: size, titles: titles, selectedId: selectedId, scrollable: scrollable, onChange: onChange, dataTestId: dataTestId, defaultMatch: defaultMatch }),
|
|
27
|
+
React__default['default'].createElement(TabList, { containerClassName: containerClassName, size: size, titles: titles, selectedId: selectedId, scrollable: scrollable, onChange: onChange, dataTestId: dataTestId, defaultMatch: defaultMatch, fullWidthScroll: fullWidthScroll }),
|
|
27
28
|
tabs.map(function (tab) { return React.cloneElement(tab, { hidden: tab.props.id !== selectedId }); })));
|
|
28
29
|
};
|
|
29
30
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { TabsProps } from "../../typings";
|
|
3
3
|
type TabsMobileProps = Omit<TabsProps, 'TabList' | 'size'>;
|
|
4
|
-
declare const TabsMobile: ({ view, scrollable, ...restProps }: Pick<TabsProps, "children" | "className" | "onChange" | "dataTestId" | "view" | "mobile" | "containerClassName" | "defaultMatch" | "selectedId" | "scrollable" | "keepMounted">) => JSX.Element;
|
|
4
|
+
declare const TabsMobile: ({ view, scrollable, ...restProps }: Pick<TabsProps, "children" | "className" | "onChange" | "dataTestId" | "view" | "mobile" | "containerClassName" | "defaultMatch" | "selectedId" | "scrollable" | "fullWidthScroll" | "keepMounted">) => JSX.Element;
|
|
5
5
|
export { TabsMobileProps, TabsMobile };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { TabsProps } from "../../typings";
|
|
3
3
|
type TabsResponsiveProps = Omit<TabsProps, 'TabList'>;
|
|
4
|
-
declare const TabsResponsive: ({ view, scrollable, ...restProps }: Pick<TabsProps, "children" | "className" | "onChange" | "size" | "dataTestId" | "view" | "mobile" | "containerClassName" | "defaultMatch" | "selectedId" | "scrollable" | "keepMounted">) => JSX.Element;
|
|
4
|
+
declare const TabsResponsive: ({ view, scrollable, ...restProps }: Pick<TabsProps, "children" | "className" | "onChange" | "size" | "dataTestId" | "view" | "mobile" | "containerClassName" | "defaultMatch" | "selectedId" | "scrollable" | "fullWidthScroll" | "keepMounted">) => JSX.Element;
|
|
5
5
|
export { TabsResponsiveProps, TabsResponsive };
|
package/cssm/typings.d.ts
CHANGED
|
@@ -39,6 +39,10 @@ type TabsProps = {
|
|
|
39
39
|
* Рендерить заголовки табов в контейнере со скроллом
|
|
40
40
|
*/
|
|
41
41
|
scrollable?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* При скроле табы будут уходить в край экрана
|
|
44
|
+
*/
|
|
45
|
+
fullWidthScroll?: boolean;
|
|
42
46
|
/**
|
|
43
47
|
* Компоненты табов
|
|
44
48
|
*/
|
|
@@ -68,9 +72,13 @@ type TabProps = {
|
|
|
68
72
|
*/
|
|
69
73
|
title: string;
|
|
70
74
|
/**
|
|
71
|
-
* Дополнительный класс
|
|
75
|
+
* Дополнительный класс для контейнера содержимого таба
|
|
72
76
|
*/
|
|
73
77
|
className?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Дополнительный класс для кнопки таба
|
|
80
|
+
*/
|
|
81
|
+
toggleClassName?: string;
|
|
74
82
|
/**
|
|
75
83
|
* Блокирует таб
|
|
76
84
|
*/
|
|
@@ -96,7 +104,7 @@ type TabProps = {
|
|
|
96
104
|
*/
|
|
97
105
|
dataTestId?: string;
|
|
98
106
|
};
|
|
99
|
-
type TabListProps = Pick<TabsProps, 'className' | 'containerClassName' | 'size' | 'defaultMatch' | 'selectedId' | 'scrollable' | 'onChange' | 'dataTestId'> & {
|
|
107
|
+
type TabListProps = Pick<TabsProps, 'className' | 'containerClassName' | 'size' | 'defaultMatch' | 'selectedId' | 'scrollable' | 'onChange' | 'dataTestId' | 'fullWidthScroll'> & {
|
|
100
108
|
/**
|
|
101
109
|
* Заголовки табов
|
|
102
110
|
*/
|
|
@@ -106,6 +114,7 @@ type TabListProps = Pick<TabsProps, 'className' | 'containerClassName' | 'size'
|
|
|
106
114
|
disabled?: boolean;
|
|
107
115
|
rightAddons?: ReactNode;
|
|
108
116
|
hidden?: boolean;
|
|
117
|
+
toggleClassName?: string;
|
|
109
118
|
}>;
|
|
110
119
|
};
|
|
111
120
|
type SecondaryTabListProps = TabListProps & {
|
package/desktop.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
require('./tslib.es6-
|
|
5
|
+
require('./tslib.es6-996824db.js');
|
|
6
6
|
require('react');
|
|
7
7
|
require('@alfalab/core-components-keyboard-focusable');
|
|
8
8
|
require('classnames');
|
|
@@ -10,11 +10,11 @@ require('compute-scroll-into-view');
|
|
|
10
10
|
var components_scrollableContainer_Component = require('./components/scrollable-container/Component.js');
|
|
11
11
|
var useTabs = require('./useTabs.js');
|
|
12
12
|
require('./components/primary-tablist/Component.js');
|
|
13
|
-
require('./index.module-
|
|
13
|
+
require('./index.module-d67ef5e7.js');
|
|
14
14
|
var components_primaryTablist_Component_desktop = require('./components/primary-tablist/Component.desktop.js');
|
|
15
15
|
require('@alfalab/core-components-tag');
|
|
16
16
|
require('./components/secondary-tablist/Component.js');
|
|
17
|
-
require('./index.module-
|
|
17
|
+
require('./index.module-960245fb.js');
|
|
18
18
|
var components_secondaryTablist_Component_desktop = require('./components/secondary-tablist/Component.desktop.js');
|
|
19
19
|
var components_tab_Component = require('./components/tab/Component.js');
|
|
20
20
|
require('./components/tabs/Component.js');
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Styles } from "../../typings";
|
|
4
|
-
declare const PrimaryTabList: ({ size, styles, className, containerClassName, titles, selectedId, scrollable, onChange, dataTestId, }: Pick<import("../../typings").TabsProps, "className" | "onChange" | "size" | "dataTestId" | "containerClassName" | "defaultMatch" | "selectedId" | "scrollable"> & {
|
|
4
|
+
declare const PrimaryTabList: ({ size, styles, className, containerClassName, titles, selectedId, scrollable, fullWidthScroll, onChange, dataTestId, }: Pick<import("../../typings").TabsProps, "className" | "onChange" | "size" | "dataTestId" | "containerClassName" | "defaultMatch" | "selectedId" | "scrollable" | "fullWidthScroll"> & {
|
|
5
5
|
titles?: {
|
|
6
6
|
title: string;
|
|
7
7
|
id: React.ReactText;
|
|
8
8
|
disabled?: boolean | undefined;
|
|
9
9
|
rightAddons?: React.ReactNode;
|
|
10
10
|
hidden?: boolean | undefined;
|
|
11
|
+
toggleClassName?: string | undefined;
|
|
11
12
|
}[] | undefined;
|
|
12
13
|
} & Styles) => JSX.Element;
|
|
13
14
|
export { PrimaryTabList };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as __rest, a as __assign } from '../../tslib.es6-
|
|
1
|
+
import { _ as __rest, a as __assign } from '../../tslib.es6-b50bf201.js';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import '@alfalab/core-components-keyboard-focusable/esm';
|
|
4
4
|
import 'classnames';
|
|
@@ -6,7 +6,7 @@ import 'compute-scroll-into-view';
|
|
|
6
6
|
import '../scrollable-container/Component.js';
|
|
7
7
|
import '../../useTabs.js';
|
|
8
8
|
import { PrimaryTabList } from './Component.js';
|
|
9
|
-
import { c as commonStyles } from '../../index.module-
|
|
9
|
+
import { c as commonStyles } from '../../index.module-4bf6c045.js';
|
|
10
10
|
|
|
11
11
|
var PrimaryTabListDesktop = function (_a) {
|
|
12
12
|
var _b = _a.size, size = _b === void 0 ? 'm' : _b, restProps = __rest(_a, ["size"]);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as __assign } from '../../tslib.es6-
|
|
1
|
+
import { a as __assign } from '../../tslib.es6-b50bf201.js';
|
|
2
2
|
import React, { useRef, useEffect } from 'react';
|
|
3
3
|
import { KeyboardFocusable } from '@alfalab/core-components-keyboard-focusable/esm';
|
|
4
4
|
import cn from 'classnames';
|
|
@@ -7,7 +7,7 @@ import { ScrollableContainer } from '../scrollable-container/Component.js';
|
|
|
7
7
|
import { useTabs } from '../../useTabs.js';
|
|
8
8
|
|
|
9
9
|
var PrimaryTabList = function (_a) {
|
|
10
|
-
var size = _a.size, _b = _a.styles, styles = _b === void 0 ? {} : _b, className = _a.className, containerClassName = _a.containerClassName, _c = _a.titles, titles = _c === void 0 ? [] : _c, _d = _a.selectedId, selectedId = _d === void 0 ? titles.length ? titles[0].id : undefined : _d, _e = _a.scrollable, scrollable = _e === void 0 ? true : _e, onChange = _a.onChange, dataTestId = _a.dataTestId;
|
|
10
|
+
var size = _a.size, _b = _a.styles, styles = _b === void 0 ? {} : _b, className = _a.className, containerClassName = _a.containerClassName, _c = _a.titles, titles = _c === void 0 ? [] : _c, _d = _a.selectedId, selectedId = _d === void 0 ? titles.length ? titles[0].id : undefined : _d, _e = _a.scrollable, scrollable = _e === void 0 ? true : _e, fullWidthScroll = _a.fullWidthScroll, onChange = _a.onChange, dataTestId = _a.dataTestId;
|
|
11
11
|
var lineRef = useRef(null);
|
|
12
12
|
var _f = useTabs({
|
|
13
13
|
titles: titles,
|
|
@@ -19,23 +19,28 @@ var PrimaryTabList = function (_a) {
|
|
|
19
19
|
lineRef.current.style.width = selectedTab.offsetWidth + "px";
|
|
20
20
|
lineRef.current.style.transform = "translateX(" + selectedTab.offsetLeft + "px)";
|
|
21
21
|
}
|
|
22
|
-
});
|
|
23
|
-
var renderContent = function () {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
React.createElement("
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
22
|
+
}, [selectedTab]);
|
|
23
|
+
var renderContent = function () {
|
|
24
|
+
var _a;
|
|
25
|
+
return (React.createElement("div", { role: 'tablist', "data-test-id": dataTestId, className: cn(styles.component, className, size && styles[size], (_a = {},
|
|
26
|
+
_a[styles.fullWidthScroll] = fullWidthScroll,
|
|
27
|
+
_a)) },
|
|
28
|
+
titles.map(function (item, index) {
|
|
29
|
+
if (item.hidden)
|
|
30
|
+
return null;
|
|
31
|
+
return (React.createElement(KeyboardFocusable, { key: item.id }, function (ref, focused) {
|
|
32
|
+
var _a;
|
|
33
|
+
return (React.createElement("button", __assign({}, getTabListItemProps(index, ref), { type: 'button', className: cn(styles.title, (_a = {},
|
|
34
|
+
_a[styles.selected] = item.id === selectedId,
|
|
35
|
+
_a[styles.disabled] = item.disabled,
|
|
36
|
+
_a), item.toggleClassName) }),
|
|
37
|
+
React.createElement("span", { className: focused ? styles.focused : undefined }, item.title),
|
|
38
|
+
item.rightAddons && (React.createElement("span", { className: styles.rightAddons }, item.rightAddons))));
|
|
39
|
+
}));
|
|
40
|
+
}),
|
|
41
|
+
React.createElement("div", { className: styles.line, ref: lineRef })));
|
|
42
|
+
};
|
|
43
|
+
return scrollable ? (React.createElement(ScrollableContainer, { activeChild: focusedTab || selectedTab, containerClassName: containerClassName, fullWidthScroll: fullWidthScroll }, renderContent())) : (React.createElement("div", { className: cn(styles.container, containerClassName) }, renderContent()));
|
|
39
44
|
};
|
|
40
45
|
|
|
41
46
|
export { PrimaryTabList };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { TabListProps } from "../../typings";
|
|
3
3
|
type PrimaryTabListMobileProps = Omit<TabListProps, 'size'>;
|
|
4
|
-
declare const PrimaryTabListMobile: ({ className, ...restProps }: Pick<TabListProps, "className" | "onChange" | "dataTestId" | "containerClassName" | "defaultMatch" | "selectedId" | "scrollable" | "titles">) => JSX.Element;
|
|
4
|
+
declare const PrimaryTabListMobile: ({ className, ...restProps }: Pick<TabListProps, "className" | "onChange" | "dataTestId" | "containerClassName" | "defaultMatch" | "selectedId" | "scrollable" | "fullWidthScroll" | "titles">) => JSX.Element;
|
|
5
5
|
export { PrimaryTabListMobileProps, PrimaryTabListMobile };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as __assign, _ as __rest } from '../../tslib.es6-
|
|
1
|
+
import { a as __assign, _ as __rest } from '../../tslib.es6-b50bf201.js';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import '@alfalab/core-components-keyboard-focusable/esm';
|
|
4
4
|
import cn from 'classnames';
|
|
@@ -6,9 +6,9 @@ import 'compute-scroll-into-view';
|
|
|
6
6
|
import '../scrollable-container/Component.js';
|
|
7
7
|
import '../../useTabs.js';
|
|
8
8
|
import { PrimaryTabList } from './Component.js';
|
|
9
|
-
import { c as commonStyles } from '../../index.module-
|
|
9
|
+
import { c as commonStyles } from '../../index.module-4bf6c045.js';
|
|
10
10
|
|
|
11
|
-
var mobileStyles = {"title":"
|
|
11
|
+
var mobileStyles = {"title":"tabs__title_dhwzv tabs__title_astus","mobile":"tabs__mobile_dhwzv"};
|
|
12
12
|
require('./mobile.css')
|
|
13
13
|
|
|
14
14
|
var styles = __assign(__assign({}, commonStyles), mobileStyles);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { TabListProps } from "../../typings";
|
|
3
|
-
declare const PrimaryTabListResponsive: ({ size, defaultMatch, ...restProps }: TabListProps) => JSX.Element;
|
|
3
|
+
declare const PrimaryTabListResponsive: ({ size, defaultMatch, fullWidthScroll, ...restProps }: TabListProps) => JSX.Element;
|
|
4
4
|
export { PrimaryTabListResponsive };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as __rest, a as __assign } from '../../tslib.es6-
|
|
1
|
+
import { _ as __rest, a as __assign } from '../../tslib.es6-b50bf201.js';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import '@alfalab/core-components-keyboard-focusable/esm';
|
|
4
4
|
import 'classnames';
|
|
@@ -6,18 +6,18 @@ import 'compute-scroll-into-view';
|
|
|
6
6
|
import '../scrollable-container/Component.js';
|
|
7
7
|
import '../../useTabs.js';
|
|
8
8
|
import './Component.js';
|
|
9
|
-
import '../../index.module-
|
|
9
|
+
import '../../index.module-4bf6c045.js';
|
|
10
10
|
import { PrimaryTabListDesktop } from './Component.desktop.js';
|
|
11
11
|
import { useMedia } from '@alfalab/hooks';
|
|
12
12
|
import { PrimaryTabListMobile } from './Component.mobile.js';
|
|
13
13
|
|
|
14
14
|
var PrimaryTabListResponsive = function (_a) {
|
|
15
|
-
var size = _a.size, _b = _a.defaultMatch, defaultMatch = _b === void 0 ? 'desktop' : _b, restProps = __rest(_a, ["size", "defaultMatch"]);
|
|
15
|
+
var size = _a.size, _b = _a.defaultMatch, defaultMatch = _b === void 0 ? 'desktop' : _b, fullWidthScroll = _a.fullWidthScroll, restProps = __rest(_a, ["size", "defaultMatch", "fullWidthScroll"]);
|
|
16
16
|
var view = useMedia([
|
|
17
17
|
['mobile', '(max-width: 767px)'],
|
|
18
18
|
['desktop', '(min-width: 768px)'],
|
|
19
19
|
], defaultMatch)[0];
|
|
20
|
-
return view === 'desktop' ? (React.createElement(PrimaryTabListDesktop, __assign({ size: size }, restProps))) : (React.createElement(PrimaryTabListMobile, __assign({}, restProps)));
|
|
20
|
+
return view === 'desktop' ? (React.createElement(PrimaryTabListDesktop, __assign({ size: size }, restProps))) : (React.createElement(PrimaryTabListMobile, __assign({ fullWidthScroll: fullWidthScroll }, restProps)));
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
export { PrimaryTabListResponsive };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: t09rb */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-border-accent: #ef3124;
|
|
4
4
|
--color-light-border-link: #007aff;
|
|
@@ -82,10 +82,12 @@
|
|
|
82
82
|
|
|
83
83
|
/* size xl */
|
|
84
84
|
}
|
|
85
|
-
.
|
|
86
|
-
position: relative
|
|
85
|
+
.tabs__component_astus {
|
|
86
|
+
position: relative;
|
|
87
|
+
display: inline-flex;
|
|
88
|
+
min-width: 100%
|
|
87
89
|
}
|
|
88
|
-
.
|
|
90
|
+
.tabs__component_astus:before {
|
|
89
91
|
content: '';
|
|
90
92
|
display: block;
|
|
91
93
|
position: absolute;
|
|
@@ -94,11 +96,15 @@
|
|
|
94
96
|
width: 100%;
|
|
95
97
|
background-color: var(--primary-tablist-bottom-border-color);
|
|
96
98
|
}
|
|
97
|
-
.
|
|
99
|
+
.tabs__fullWidthScroll_astus {
|
|
100
|
+
min-width: calc(100% - 2 * var(--gap-m));
|
|
101
|
+
margin: 0 var(--gap-m);
|
|
102
|
+
}
|
|
103
|
+
.tabs__container_astus {
|
|
98
104
|
position: relative;
|
|
99
|
-
|
|
105
|
+
overflow: hidden;
|
|
100
106
|
}
|
|
101
|
-
.
|
|
107
|
+
.tabs__title_astus {
|
|
102
108
|
display: flex;
|
|
103
109
|
align-items: center;
|
|
104
110
|
height: 100%;
|
|
@@ -116,22 +122,22 @@
|
|
|
116
122
|
cursor: pointer;
|
|
117
123
|
outline: none
|
|
118
124
|
}
|
|
119
|
-
.
|
|
125
|
+
.tabs__title_astus:not(.tabs__disabled_astus):hover {
|
|
120
126
|
color: var(--primary-tablist-hover-color);
|
|
121
127
|
}
|
|
122
|
-
.
|
|
128
|
+
.tabs__focused_astus {
|
|
123
129
|
outline: 2px solid var(--focus-color);
|
|
124
130
|
outline-offset: 2px;
|
|
125
131
|
}
|
|
126
|
-
.
|
|
132
|
+
.tabs__selected_astus {
|
|
127
133
|
cursor: default;
|
|
128
134
|
color: var(--primary-tablist-selected-color);
|
|
129
135
|
}
|
|
130
|
-
.
|
|
136
|
+
.tabs__disabled_astus {
|
|
131
137
|
cursor: var(--disabled-cursor);
|
|
132
138
|
color: var(--primary-tablist-disabled-color);
|
|
133
139
|
}
|
|
134
|
-
.
|
|
140
|
+
.tabs__line_astus {
|
|
135
141
|
position: absolute;
|
|
136
142
|
height: 3px;
|
|
137
143
|
bottom: 0;
|
|
@@ -140,46 +146,46 @@
|
|
|
140
146
|
transition: transform 0.2s ease, width 0.2s ease;
|
|
141
147
|
}
|
|
142
148
|
/* sizes */
|
|
143
|
-
.
|
|
149
|
+
.tabs__s_astus .tabs__title_astus, .tabs__xs_astus .tabs__title_astus, .tabs__xxs_astus .tabs__title_astus {
|
|
144
150
|
padding: var(--primary-tablist-s-padding);
|
|
145
151
|
font-size: var(--primary-tablist-s-font-size);
|
|
146
152
|
font-weight: var(--primary-tablist-s-font-weight);
|
|
147
153
|
font-family: var(--primary-tablist-s-font-family);
|
|
148
154
|
line-height: 24px;
|
|
149
155
|
}
|
|
150
|
-
.
|
|
156
|
+
.tabs__s_astus .tabs__title_astus + .tabs__title_astus, .tabs__xs_astus .tabs__title_astus + .tabs__title_astus, .tabs__xxs_astus .tabs__title_astus + .tabs__title_astus {
|
|
151
157
|
margin-left: var(--primary-tablist-s-gaps);
|
|
152
158
|
}
|
|
153
|
-
.
|
|
159
|
+
.tabs__m_astus .tabs__title_astus {
|
|
154
160
|
padding: var(--primary-tablist-m-padding);
|
|
155
161
|
font-size: var(--primary-tablist-m-font-size);
|
|
156
162
|
font-weight: var(--primary-tablist-m-font-weight);
|
|
157
163
|
font-family: var(--primary-tablist-m-font-family);
|
|
158
164
|
line-height: 24px;
|
|
159
165
|
}
|
|
160
|
-
.
|
|
166
|
+
.tabs__m_astus .tabs__title_astus + .tabs__title_astus {
|
|
161
167
|
margin-left: var(--primary-tablist-m-gaps);
|
|
162
168
|
}
|
|
163
|
-
.
|
|
169
|
+
.tabs__l_astus .tabs__title_astus {
|
|
164
170
|
padding: var(--primary-tablist-l-padding);
|
|
165
171
|
font-size: var(--primary-tablist-l-font-size);
|
|
166
172
|
font-weight: var(--primary-tablist-l-font-weight);
|
|
167
173
|
font-family: var(--primary-tablist-l-font-family);
|
|
168
174
|
line-height: 24px;
|
|
169
175
|
}
|
|
170
|
-
.
|
|
176
|
+
.tabs__l_astus .tabs__title_astus + .tabs__title_astus {
|
|
171
177
|
margin-left: var(--primary-tablist-l-gaps);
|
|
172
178
|
}
|
|
173
|
-
.
|
|
179
|
+
.tabs__xl_astus .tabs__title_astus {
|
|
174
180
|
padding: var(--primary-tablist-xl-padding);
|
|
175
181
|
font-size: var(--primary-tablist-xl-font-size);
|
|
176
182
|
font-weight: var(--primary-tablist-xl-font-weight);
|
|
177
183
|
font-family: var(--primary-tablist-xl-font-family);
|
|
178
184
|
line-height: 32px;
|
|
179
185
|
}
|
|
180
|
-
.
|
|
186
|
+
.tabs__xl_astus .tabs__title_astus + .tabs__title_astus {
|
|
181
187
|
margin-left: var(--primary-tablist-xl-gaps);
|
|
182
188
|
}
|
|
183
|
-
.
|
|
189
|
+
.tabs__rightAddons_astus {
|
|
184
190
|
margin-left: var(--gap-xs);
|
|
185
191
|
}
|