@alfalab/core-components-tab-bar 1.0.3 → 2.0.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/Component.js +7 -5
- package/components/tab/Component.js +9 -5
- package/components/tab/index.css +12 -9
- package/components/tab/index.js +0 -5
- package/consts.d.ts +9 -0
- package/consts.js +15 -0
- package/cssm/Component.js +6 -5
- package/cssm/components/tab/Component.js +8 -4
- package/cssm/components/tab/index.js +0 -6
- package/cssm/components/tab/index.module.css +6 -3
- package/cssm/consts.d.ts +9 -0
- package/cssm/consts.js +15 -0
- package/cssm/index.js +0 -9
- package/cssm/index.module.css +10 -8
- package/cssm/shared/index.d.ts +1 -0
- package/cssm/shared/index.js +9 -0
- package/cssm/types.d.ts +11 -3
- package/cssm/utils.d.ts +5 -0
- package/cssm/utils.js +14 -0
- package/esm/Component.js +7 -5
- package/esm/components/tab/Component.js +9 -5
- package/esm/components/tab/index.css +12 -9
- package/esm/components/tab/index.js +0 -5
- package/esm/consts.d.ts +9 -0
- package/esm/consts.js +10 -0
- package/esm/index.css +12 -10
- package/esm/index.js +0 -7
- package/esm/shared/index.d.ts +1 -0
- package/esm/shared/index.js +1 -0
- package/esm/types.d.ts +11 -3
- package/esm/utils.d.ts +5 -0
- package/esm/utils.js +10 -0
- package/index.css +12 -10
- package/index.js +0 -7
- package/modern/Component.js +7 -5
- package/modern/components/tab/Component.js +9 -5
- package/modern/components/tab/index.css +12 -9
- package/modern/components/tab/index.js +0 -4
- package/modern/consts.d.ts +9 -0
- package/modern/consts.js +10 -0
- package/modern/index.css +12 -10
- package/modern/index.js +0 -6
- package/modern/shared/index.d.ts +1 -0
- package/modern/shared/index.js +1 -0
- package/modern/types.d.ts +11 -3
- package/modern/utils.d.ts +5 -0
- package/modern/utils.js +10 -0
- package/package.json +4 -4
- package/shared/index.d.ts +1 -0
- package/shared/index.js +9 -0
- package/shared/package.json +3 -0
- package/src/Component.tsx +7 -1
- package/src/components/tab/Component.tsx +14 -3
- package/src/components/tab/index.module.css +6 -2
- package/src/consts.ts +9 -0
- package/src/index.module.css +9 -6
- package/src/shared/index.ts +1 -0
- package/src/shared/package.json +3 -0
- package/src/types.ts +17 -4
- package/src/utils.ts +8 -0
- package/types.d.ts +11 -3
- package/utils.d.ts +5 -0
- package/utils.js +14 -0
package/Component.js
CHANGED
|
@@ -7,26 +7,28 @@ var React = require('react');
|
|
|
7
7
|
var cn = require('classnames');
|
|
8
8
|
var coreComponentsShared = require('@alfalab/core-components-shared');
|
|
9
9
|
var components_tab_Component = require('./components/tab/Component.js');
|
|
10
|
-
require('@alfalab/core-components-badge');
|
|
11
|
-
require('@alfalab/core-components-typography');
|
|
12
10
|
|
|
13
11
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
14
12
|
|
|
15
13
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
16
14
|
var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
|
|
17
15
|
|
|
18
|
-
var styles = {"component":"tab-
|
|
16
|
+
var styles = {"component":"tab-bar__component_1b06f","modal-bg-primary":"tab-bar__modal-bg-primary_1b06f","modal-bg-alt-primary":"tab-bar__modal-bg-alt-primary_1b06f","border":"tab-bar__border_1b06f"};
|
|
19
17
|
require('./index.css')
|
|
20
18
|
|
|
21
19
|
var TabBarComponent = React.forwardRef(function (_a, ref) {
|
|
22
20
|
var _b;
|
|
23
|
-
var children = _a.children, className = _a.className, selectedId = _a.selectedId, border = _a.border, dataTestId = _a.dataTestId, tabClassNames = _a.tabClassNames, onChange = _a.onChange, restProps = tslib.__rest(_a, ["children", "className", "selectedId", "border", "dataTestId", "tabClassNames", "onChange"]);
|
|
21
|
+
var children = _a.children, className = _a.className, selectedId = _a.selectedId, border = _a.border, dataTestId = _a.dataTestId, tabClassNames = _a.tabClassNames, onChange = _a.onChange, _c = _a.accentColor, accentColor = _c === void 0 ? 'primary' : _c, _d = _a.bgColor, bgColor = _d === void 0 ? 'modal-bg-primary' : _d, restProps = tslib.__rest(_a, ["children", "className", "selectedId", "border", "dataTestId", "tabClassNames", "onChange", "accentColor", "bgColor"]);
|
|
24
22
|
if (React.Children.count(children) > 5) {
|
|
25
23
|
// eslint-disable-next-line no-console
|
|
26
24
|
console.error('Компонент TabBar не может содержать больше 5 табов');
|
|
27
25
|
}
|
|
28
|
-
return (React__default.default.createElement("nav", tslib.__assign({ "data-test-id": dataTestId }, restProps, { ref: ref, className: cn__default.default(styles.component, className, (_b = {},
|
|
26
|
+
return (React__default.default.createElement("nav", tslib.__assign({ "data-test-id": dataTestId }, restProps, { ref: ref, className: cn__default.default(styles.component, styles[bgColor], className, (_b = {},
|
|
27
|
+
_b[styles.border] = border,
|
|
28
|
+
_b)) }), React.Children.map(children, function (tab) {
|
|
29
29
|
return React.cloneElement(tab, {
|
|
30
|
+
bgColor: bgColor,
|
|
31
|
+
accentColor: accentColor,
|
|
30
32
|
selected: tab.props.id === selectedId,
|
|
31
33
|
onChange: onChange,
|
|
32
34
|
tabClassNames: tabClassNames,
|
|
@@ -5,34 +5,38 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var cn = require('classnames');
|
|
8
|
-
var
|
|
8
|
+
var coreComponentsIndicator = require('@alfalab/core-components-indicator');
|
|
9
9
|
var coreComponentsTypography = require('@alfalab/core-components-typography');
|
|
10
|
+
var consts = require('../../consts.js');
|
|
10
11
|
|
|
11
12
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
12
13
|
|
|
13
14
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
14
15
|
var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
|
|
15
16
|
|
|
16
|
-
var styles = {"component":"tab-
|
|
17
|
+
var styles = {"component":"tab-bar__component_m43fu","primary":"tab-bar__primary_m43fu","secondary":"tab-bar__secondary_m43fu","icon":"tab-bar__icon_m43fu","label":"tab-bar__label_m43fu","labelSelected":"tab-bar__labelSelected_m43fu","indicator":"tab-bar__indicator_m43fu"};
|
|
17
18
|
require('./index.css')
|
|
18
19
|
|
|
19
20
|
var TabComponent = React.forwardRef(function (_a, ref) {
|
|
20
21
|
var _b, _c;
|
|
21
|
-
var showIndicator = _a.showIndicator, indicatorProps = _a.indicatorProps, label = _a.label, icon = _a.icon, id = _a.id, selected = _a.selected, onChange = _a.onChange, onClick = _a.onClick, _d = _a.tabClassNames, tabClassNames = _d === void 0 ? {} : _d, dataTestId = _a.dataTestId, className = _a.className, labelClassName = _a.labelClassName, selectedClassName = _a.selectedClassName, iconClassName = _a.iconClassName, href = _a.href, _e = _a.Component, Component = _e === void 0 ? href ? 'a' : 'button' : _e, restProps = tslib.__rest(_a, ["showIndicator", "indicatorProps", "label", "icon", "id", "selected", "onChange", "onClick", "tabClassNames", "dataTestId", "className", "labelClassName", "selectedClassName", "iconClassName", "href", "Component"]);
|
|
22
|
+
var showIndicator = _a.showIndicator, indicatorProps = _a.indicatorProps, label = _a.label, icon = _a.icon, id = _a.id, selected = _a.selected, onChange = _a.onChange, onClick = _a.onClick, _d = _a.tabClassNames, tabClassNames = _d === void 0 ? {} : _d, dataTestId = _a.dataTestId, className = _a.className, labelClassName = _a.labelClassName, selectedClassName = _a.selectedClassName, iconClassName = _a.iconClassName, href = _a.href, _e = _a.Component, Component = _e === void 0 ? href ? 'a' : 'button' : _e, _f = _a.accentColor, accentColor = _f === void 0 ? 'primary' : _f, _g = _a.bgColor, bgColor = _g === void 0 ? 'modal-bg-primary' : _g, restProps = tslib.__rest(_a, ["showIndicator", "indicatorProps", "label", "icon", "id", "selected", "onChange", "onClick", "tabClassNames", "dataTestId", "className", "labelClassName", "selectedClassName", "iconClassName", "href", "Component", "accentColor", "bgColor"]);
|
|
22
23
|
var handleClick = function (event) {
|
|
23
24
|
onChange === null || onChange === void 0 ? void 0 : onChange(id);
|
|
24
25
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
25
26
|
};
|
|
26
27
|
var commonClassName = tabClassNames.className, commonLabelClassName = tabClassNames.labelClassName, commonSelectedClassName = tabClassNames.selectedClassName, commonIconClassName = tabClassNames.iconClassName;
|
|
27
28
|
return (React__default.default.createElement(Component, tslib.__assign({ "data-test-id": dataTestId, tabIndex: 0 }, (Component === 'button' ? { type: 'button' } : null), restProps, { href: href, id: id, ref: ref, className: cn__default.default(styles.component, commonClassName, className, selected && commonSelectedClassName, selected && selectedClassName, (_b = {},
|
|
28
|
-
_b[styles
|
|
29
|
+
_b[styles[accentColor]] = selected,
|
|
29
30
|
_b)), onClick: handleClick }),
|
|
30
31
|
React__default.default.createElement("div", { className: cn__default.default(styles.icon, commonIconClassName, iconClassName) }, React.isValidElement(icon) ? React.cloneElement(icon, { selected: selected }) : icon),
|
|
31
32
|
React__default.default.createElement(coreComponentsTypography.Typography.Text, { weight: 'medium', view: 'secondary-small', className: cn__default.default(styles.label, commonLabelClassName, labelClassName, (_c = {},
|
|
32
33
|
_c[styles.labelSelected] = selected,
|
|
33
34
|
_c)) }, React.isValidElement(label) ? React.cloneElement(label, { selected: selected }) : label),
|
|
34
35
|
showIndicator && (React__default.default.createElement("div", { className: styles.indicator },
|
|
35
|
-
React__default.default.createElement(
|
|
36
|
+
React__default.default.createElement(coreComponentsIndicator.Indicator, tslib.__assign({}, indicatorProps, { height: (indicatorProps === null || indicatorProps === void 0 ? void 0 : indicatorProps.value) ? 16 : undefined, border: {
|
|
37
|
+
width: 2,
|
|
38
|
+
color: consts.INDICATOR_BORDER_COLOR[bgColor],
|
|
39
|
+
}, backgroundColor: consts.INDICATOR_BG_COLOR[accentColor] }))))));
|
|
36
40
|
});
|
|
37
41
|
var Tab = TabComponent;
|
|
38
42
|
|
package/components/tab/index.css
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
/* hash:
|
|
2
|
-
:root {
|
|
1
|
+
/* hash: y33p9 */
|
|
2
|
+
: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 */ /* 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 */ /* deprecated */ /* deprecated */
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-accent-primary: #ef3124;
|
|
5
|
+
--color-light-accent-secondary: #212124;
|
|
5
6
|
--color-light-neutral-translucent-700: rgba(4, 4, 21, 0.47);
|
|
6
7
|
--color-light-text-secondary: rgba(4, 4, 19, 0.55); /* 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 */
|
|
7
8
|
} :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 */
|
|
@@ -19,7 +20,7 @@
|
|
|
19
20
|
--gap-xs: 8px;
|
|
20
21
|
} :root {
|
|
21
22
|
} :root {
|
|
22
|
-
} .tab-
|
|
23
|
+
} .tab-bar__component_m43fu {
|
|
23
24
|
box-sizing: border-box;
|
|
24
25
|
background-color: transparent;
|
|
25
26
|
-webkit-tap-highlight-color: transparent;
|
|
@@ -43,15 +44,17 @@
|
|
|
43
44
|
align-items: center;
|
|
44
45
|
padding: var(--gap-xs) 0;
|
|
45
46
|
color: var(--color-light-neutral-translucent-700);
|
|
46
|
-
} .tab-
|
|
47
|
+
} .tab-bar__primary_m43fu {
|
|
47
48
|
color: var(--color-light-accent-primary);
|
|
48
|
-
} .tab-
|
|
49
|
+
} .tab-bar__secondary_m43fu {
|
|
50
|
+
color: var(--color-light-accent-secondary);
|
|
51
|
+
} .tab-bar__icon_m43fu {
|
|
49
52
|
display: flex;
|
|
50
53
|
align-items: center;
|
|
51
54
|
justify-content: center;
|
|
52
55
|
flex-grow: 1;
|
|
53
56
|
width: 100%;
|
|
54
|
-
} .tab-
|
|
57
|
+
} .tab-bar__label_m43fu {
|
|
55
58
|
-webkit-line-clamp: 1;
|
|
56
59
|
display: -webkit-box;
|
|
57
60
|
-webkit-box-orient: vertical;
|
|
@@ -60,11 +63,11 @@
|
|
|
60
63
|
flex-shrink: 0;
|
|
61
64
|
|
|
62
65
|
color: var(--color-light-text-secondary);
|
|
63
|
-
} .tab-
|
|
66
|
+
} .tab-bar__labelSelected_m43fu {
|
|
64
67
|
color: inherit;
|
|
65
|
-
} .tab-
|
|
68
|
+
} .tab-bar__indicator_m43fu {
|
|
66
69
|
position: absolute;
|
|
67
|
-
top:
|
|
70
|
+
top: 3px;
|
|
68
71
|
left: calc(50% + var(--gap-2xs));
|
|
69
72
|
height: 16px;
|
|
70
73
|
min-width: 16px;
|
package/components/tab/index.js
CHANGED
|
@@ -3,11 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var components_tab_Component = require('./Component.js');
|
|
6
|
-
require('tslib');
|
|
7
|
-
require('react');
|
|
8
|
-
require('classnames');
|
|
9
|
-
require('@alfalab/core-components-badge');
|
|
10
|
-
require('@alfalab/core-components-typography');
|
|
11
6
|
|
|
12
7
|
|
|
13
8
|
|
package/consts.d.ts
ADDED
package/consts.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var INDICATOR_BORDER_COLOR = {
|
|
6
|
+
'modal-bg-primary': 'var(--color-light-base-bg-primary)',
|
|
7
|
+
'modal-bg-alt-primary': 'var(--color-light-base-bg-alt-primary)',
|
|
8
|
+
};
|
|
9
|
+
var INDICATOR_BG_COLOR = {
|
|
10
|
+
primary: 'var(--color-light-accent-primary)',
|
|
11
|
+
secondary: 'var(--color-light-accent-secondary)',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.INDICATOR_BG_COLOR = INDICATOR_BG_COLOR;
|
|
15
|
+
exports.INDICATOR_BORDER_COLOR = INDICATOR_BORDER_COLOR;
|
package/cssm/Component.js
CHANGED
|
@@ -8,9 +8,6 @@ var cn = require('classnames');
|
|
|
8
8
|
var coreComponentsShared = require('@alfalab/core-components-shared/cssm');
|
|
9
9
|
var components_tab_Component = require('./components/tab/Component.js');
|
|
10
10
|
var styles = require('./index.module.css');
|
|
11
|
-
require('@alfalab/core-components-badge/cssm');
|
|
12
|
-
require('@alfalab/core-components-typography/cssm');
|
|
13
|
-
require('./components/tab/index.module.css');
|
|
14
11
|
|
|
15
12
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
16
13
|
|
|
@@ -20,13 +17,17 @@ var styles__default = /*#__PURE__*/_interopDefaultCompat(styles);
|
|
|
20
17
|
|
|
21
18
|
var TabBarComponent = React.forwardRef(function (_a, ref) {
|
|
22
19
|
var _b;
|
|
23
|
-
var children = _a.children, className = _a.className, selectedId = _a.selectedId, border = _a.border, dataTestId = _a.dataTestId, tabClassNames = _a.tabClassNames, onChange = _a.onChange, restProps = tslib.__rest(_a, ["children", "className", "selectedId", "border", "dataTestId", "tabClassNames", "onChange"]);
|
|
20
|
+
var children = _a.children, className = _a.className, selectedId = _a.selectedId, border = _a.border, dataTestId = _a.dataTestId, tabClassNames = _a.tabClassNames, onChange = _a.onChange, _c = _a.accentColor, accentColor = _c === void 0 ? 'primary' : _c, _d = _a.bgColor, bgColor = _d === void 0 ? 'modal-bg-primary' : _d, restProps = tslib.__rest(_a, ["children", "className", "selectedId", "border", "dataTestId", "tabClassNames", "onChange", "accentColor", "bgColor"]);
|
|
24
21
|
if (React.Children.count(children) > 5) {
|
|
25
22
|
// eslint-disable-next-line no-console
|
|
26
23
|
console.error('Компонент TabBar не может содержать больше 5 табов');
|
|
27
24
|
}
|
|
28
|
-
return (React__default.default.createElement("nav", tslib.__assign({ "data-test-id": dataTestId }, restProps, { ref: ref, className: cn__default.default(styles__default.default.component,
|
|
25
|
+
return (React__default.default.createElement("nav", tslib.__assign({ "data-test-id": dataTestId }, restProps, { ref: ref, className: cn__default.default(styles__default.default.component, styles__default.default[bgColor], className, (_b = {},
|
|
26
|
+
_b[styles__default.default.border] = border,
|
|
27
|
+
_b)) }), React.Children.map(children, function (tab) {
|
|
29
28
|
return React.cloneElement(tab, {
|
|
29
|
+
bgColor: bgColor,
|
|
30
|
+
accentColor: accentColor,
|
|
30
31
|
selected: tab.props.id === selectedId,
|
|
31
32
|
onChange: onChange,
|
|
32
33
|
tabClassNames: tabClassNames,
|
|
@@ -5,8 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var cn = require('classnames');
|
|
8
|
-
var
|
|
8
|
+
var coreComponentsIndicator = require('@alfalab/core-components-indicator/cssm');
|
|
9
9
|
var coreComponentsTypography = require('@alfalab/core-components-typography/cssm');
|
|
10
|
+
var consts = require('../../consts.js');
|
|
10
11
|
var styles = require('./index.module.css');
|
|
11
12
|
|
|
12
13
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
@@ -17,21 +18,24 @@ var styles__default = /*#__PURE__*/_interopDefaultCompat(styles);
|
|
|
17
18
|
|
|
18
19
|
var TabComponent = React.forwardRef(function (_a, ref) {
|
|
19
20
|
var _b, _c;
|
|
20
|
-
var showIndicator = _a.showIndicator, indicatorProps = _a.indicatorProps, label = _a.label, icon = _a.icon, id = _a.id, selected = _a.selected, onChange = _a.onChange, onClick = _a.onClick, _d = _a.tabClassNames, tabClassNames = _d === void 0 ? {} : _d, dataTestId = _a.dataTestId, className = _a.className, labelClassName = _a.labelClassName, selectedClassName = _a.selectedClassName, iconClassName = _a.iconClassName, href = _a.href, _e = _a.Component, Component = _e === void 0 ? href ? 'a' : 'button' : _e, restProps = tslib.__rest(_a, ["showIndicator", "indicatorProps", "label", "icon", "id", "selected", "onChange", "onClick", "tabClassNames", "dataTestId", "className", "labelClassName", "selectedClassName", "iconClassName", "href", "Component"]);
|
|
21
|
+
var showIndicator = _a.showIndicator, indicatorProps = _a.indicatorProps, label = _a.label, icon = _a.icon, id = _a.id, selected = _a.selected, onChange = _a.onChange, onClick = _a.onClick, _d = _a.tabClassNames, tabClassNames = _d === void 0 ? {} : _d, dataTestId = _a.dataTestId, className = _a.className, labelClassName = _a.labelClassName, selectedClassName = _a.selectedClassName, iconClassName = _a.iconClassName, href = _a.href, _e = _a.Component, Component = _e === void 0 ? href ? 'a' : 'button' : _e, _f = _a.accentColor, accentColor = _f === void 0 ? 'primary' : _f, _g = _a.bgColor, bgColor = _g === void 0 ? 'modal-bg-primary' : _g, restProps = tslib.__rest(_a, ["showIndicator", "indicatorProps", "label", "icon", "id", "selected", "onChange", "onClick", "tabClassNames", "dataTestId", "className", "labelClassName", "selectedClassName", "iconClassName", "href", "Component", "accentColor", "bgColor"]);
|
|
21
22
|
var handleClick = function (event) {
|
|
22
23
|
onChange === null || onChange === void 0 ? void 0 : onChange(id);
|
|
23
24
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
24
25
|
};
|
|
25
26
|
var commonClassName = tabClassNames.className, commonLabelClassName = tabClassNames.labelClassName, commonSelectedClassName = tabClassNames.selectedClassName, commonIconClassName = tabClassNames.iconClassName;
|
|
26
27
|
return (React__default.default.createElement(Component, tslib.__assign({ "data-test-id": dataTestId, tabIndex: 0 }, (Component === 'button' ? { type: 'button' } : null), restProps, { href: href, id: id, ref: ref, className: cn__default.default(styles__default.default.component, commonClassName, className, selected && commonSelectedClassName, selected && selectedClassName, (_b = {},
|
|
27
|
-
_b[styles__default.default
|
|
28
|
+
_b[styles__default.default[accentColor]] = selected,
|
|
28
29
|
_b)), onClick: handleClick }),
|
|
29
30
|
React__default.default.createElement("div", { className: cn__default.default(styles__default.default.icon, commonIconClassName, iconClassName) }, React.isValidElement(icon) ? React.cloneElement(icon, { selected: selected }) : icon),
|
|
30
31
|
React__default.default.createElement(coreComponentsTypography.Typography.Text, { weight: 'medium', view: 'secondary-small', className: cn__default.default(styles__default.default.label, commonLabelClassName, labelClassName, (_c = {},
|
|
31
32
|
_c[styles__default.default.labelSelected] = selected,
|
|
32
33
|
_c)) }, React.isValidElement(label) ? React.cloneElement(label, { selected: selected }) : label),
|
|
33
34
|
showIndicator && (React__default.default.createElement("div", { className: styles__default.default.indicator },
|
|
34
|
-
React__default.default.createElement(
|
|
35
|
+
React__default.default.createElement(coreComponentsIndicator.Indicator, tslib.__assign({}, indicatorProps, { height: (indicatorProps === null || indicatorProps === void 0 ? void 0 : indicatorProps.value) ? 16 : undefined, border: {
|
|
36
|
+
width: 2,
|
|
37
|
+
color: consts.INDICATOR_BORDER_COLOR[bgColor],
|
|
38
|
+
}, backgroundColor: consts.INDICATOR_BG_COLOR[accentColor] }))))));
|
|
35
39
|
});
|
|
36
40
|
var Tab = TabComponent;
|
|
37
41
|
|
|
@@ -3,12 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var components_tab_Component = require('./Component.js');
|
|
6
|
-
require('tslib');
|
|
7
|
-
require('react');
|
|
8
|
-
require('classnames');
|
|
9
|
-
require('@alfalab/core-components-badge/cssm');
|
|
10
|
-
require('@alfalab/core-components-typography/cssm');
|
|
11
|
-
require('./index.module.css');
|
|
12
6
|
|
|
13
7
|
|
|
14
8
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
:root {
|
|
1
|
+
: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 */ /* 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 */ /* deprecated */ /* deprecated */
|
|
2
2
|
} /* deprecated */ :root {
|
|
3
3
|
--color-light-accent-primary: #ef3124;
|
|
4
|
+
--color-light-accent-secondary: #212124;
|
|
4
5
|
--color-light-neutral-translucent-700: rgba(4, 4, 21, 0.47);
|
|
5
6
|
--color-light-text-secondary: rgba(4, 4, 19, 0.55); /* 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
7
|
} :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 */
|
|
@@ -42,8 +43,10 @@
|
|
|
42
43
|
align-items: center;
|
|
43
44
|
padding: var(--gap-xs) 0;
|
|
44
45
|
color: var(--color-light-neutral-translucent-700);
|
|
45
|
-
} .
|
|
46
|
+
} .primary {
|
|
46
47
|
color: var(--color-light-accent-primary);
|
|
48
|
+
} .secondary {
|
|
49
|
+
color: var(--color-light-accent-secondary);
|
|
47
50
|
} .icon {
|
|
48
51
|
display: flex;
|
|
49
52
|
align-items: center;
|
|
@@ -63,7 +66,7 @@
|
|
|
63
66
|
color: inherit;
|
|
64
67
|
} .indicator {
|
|
65
68
|
position: absolute;
|
|
66
|
-
top:
|
|
69
|
+
top: 3px;
|
|
67
70
|
left: calc(50% + var(--gap-2xs));
|
|
68
71
|
height: 16px;
|
|
69
72
|
min-width: 16px;
|
package/cssm/consts.d.ts
ADDED
package/cssm/consts.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var INDICATOR_BORDER_COLOR = {
|
|
6
|
+
'modal-bg-primary': 'var(--color-light-base-bg-primary)',
|
|
7
|
+
'modal-bg-alt-primary': 'var(--color-light-base-bg-alt-primary)',
|
|
8
|
+
};
|
|
9
|
+
var INDICATOR_BG_COLOR = {
|
|
10
|
+
primary: 'var(--color-light-accent-primary)',
|
|
11
|
+
secondary: 'var(--color-light-accent-secondary)',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.INDICATOR_BG_COLOR = INDICATOR_BG_COLOR;
|
|
15
|
+
exports.INDICATOR_BORDER_COLOR = INDICATOR_BORDER_COLOR;
|
package/cssm/index.js
CHANGED
|
@@ -3,15 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var Component = require('./Component.js');
|
|
6
|
-
require('tslib');
|
|
7
|
-
require('react');
|
|
8
|
-
require('classnames');
|
|
9
|
-
require('@alfalab/core-components-shared/cssm');
|
|
10
|
-
require('./components/tab/Component.js');
|
|
11
|
-
require('@alfalab/core-components-badge/cssm');
|
|
12
|
-
require('@alfalab/core-components-typography/cssm');
|
|
13
|
-
require('./components/tab/index.module.css');
|
|
14
|
-
require('./index.module.css');
|
|
15
6
|
|
|
16
7
|
|
|
17
8
|
|
package/cssm/index.module.css
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
:root {
|
|
1
|
+
: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 */ /* 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 */ /* deprecated */ /* deprecated */
|
|
2
2
|
} /* deprecated */ :root {
|
|
3
|
+
--color-light-base-bg-alt-primary: #f2f3f5;
|
|
3
4
|
--color-light-base-bg-primary: #fff;
|
|
4
|
-
--color-light-neutral-300:
|
|
5
|
+
--color-light-neutral-translucent-300: rgba(15, 25, 55, 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 */
|
|
5
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 */
|
|
6
7
|
} :root {
|
|
7
8
|
} :root {
|
|
@@ -15,17 +16,18 @@
|
|
|
15
16
|
} :root {
|
|
16
17
|
} :root {
|
|
17
18
|
} :root {
|
|
18
|
-
} :root {
|
|
19
|
-
--tab-bar-bg-color: var(--color-light-base-bg-primary);
|
|
20
19
|
} .component {
|
|
21
20
|
display: flex;
|
|
22
21
|
justify-content: center;
|
|
23
22
|
height: 64px;
|
|
24
23
|
max-height: 64px;
|
|
25
|
-
background-color: var(--tab-bar-bg-color);
|
|
26
24
|
box-sizing: border-box;
|
|
27
25
|
overflow: hidden;
|
|
28
|
-
transition: box-shadow 0.2s ease
|
|
29
|
-
} .
|
|
30
|
-
|
|
26
|
+
transition: box-shadow 0.2s ease
|
|
27
|
+
} .component.modal-bg-primary {
|
|
28
|
+
background-color: var(--color-light-base-bg-primary);
|
|
29
|
+
} .component.modal-bg-alt-primary {
|
|
30
|
+
background-color: var(--color-light-base-bg-alt-primary);
|
|
31
|
+
} .border {
|
|
32
|
+
box-shadow: 0 -1px 0 0 var(--color-light-neutral-translucent-300);
|
|
31
33
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getTabBarTestIds } from "../utils";
|
package/cssm/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AllHTMLAttributes, ElementType, ForwardRefExoticComponent, HTMLAttributes, ReactElement, ReactNode, RefAttributes } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { IndicatorProps } from "@alfalab/core-components-indicator";
|
|
3
3
|
type TabElementType = ReactElement<TabProps, ForwardRefExoticComponent<TabProps & RefAttributes<HTMLElement>>>;
|
|
4
4
|
interface TabBarProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
5
5
|
/**
|
|
@@ -48,6 +48,14 @@ interface TabBarProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
|
48
48
|
* Обработчик изменения выбранного таба
|
|
49
49
|
*/
|
|
50
50
|
onChange?: (id: string) => void;
|
|
51
|
+
/**
|
|
52
|
+
* Цвет активного таба
|
|
53
|
+
*/
|
|
54
|
+
accentColor?: 'primary' | 'secondary';
|
|
55
|
+
/**
|
|
56
|
+
* Цвет фона
|
|
57
|
+
*/
|
|
58
|
+
bgColor?: 'modal-bg-primary' | 'modal-bg-alt-primary';
|
|
51
59
|
}
|
|
52
60
|
type AdditionalTabProps = Record<string, unknown>;
|
|
53
61
|
interface TabProps extends Omit<AllHTMLAttributes<unknown>, 'onChange' | 'label'>, AdditionalTabProps {
|
|
@@ -75,7 +83,7 @@ interface TabProps extends Omit<AllHTMLAttributes<unknown>, 'onChange' | 'label'
|
|
|
75
83
|
/**
|
|
76
84
|
* Свойства индикатора
|
|
77
85
|
*/
|
|
78
|
-
indicatorProps?: Omit<
|
|
86
|
+
indicatorProps?: Omit<IndicatorProps, 'color' | 'backgroundColor' | 'border' | 'view' | 'size' | 'height'>;
|
|
79
87
|
/**
|
|
80
88
|
* Дополнительный класс таба
|
|
81
89
|
*/
|
|
@@ -93,7 +101,7 @@ interface TabProps extends Omit<AllHTMLAttributes<unknown>, 'onChange' | 'label'
|
|
|
93
101
|
*/
|
|
94
102
|
iconClassName?: string;
|
|
95
103
|
}
|
|
96
|
-
interface PrivateTabProps extends Pick<TabBarProps, 'tabClassNames' | 'onChange' | 'dataTestId'> {
|
|
104
|
+
interface PrivateTabProps extends Pick<TabBarProps, 'tabClassNames' | 'onChange' | 'dataTestId' | 'accentColor' | 'bgColor'> {
|
|
97
105
|
selected: boolean;
|
|
98
106
|
}
|
|
99
107
|
export { TabBarProps, TabProps, PrivateTabProps };
|
package/cssm/utils.d.ts
ADDED
package/cssm/utils.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var coreComponentsShared = require('@alfalab/core-components-shared/cssm');
|
|
6
|
+
|
|
7
|
+
function getTabBarTestIds(dataTestId) {
|
|
8
|
+
return {
|
|
9
|
+
tabBar: dataTestId,
|
|
10
|
+
tab: coreComponentsShared.getDataTestId(dataTestId, 'tab'),
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
exports.getTabBarTestIds = getTabBarTestIds;
|
package/esm/Component.js
CHANGED
|
@@ -3,21 +3,23 @@ import React, { forwardRef, Children, cloneElement } from 'react';
|
|
|
3
3
|
import cn from 'classnames';
|
|
4
4
|
import { getDataTestId } from '@alfalab/core-components-shared/esm';
|
|
5
5
|
import { Tab } from './components/tab/Component.js';
|
|
6
|
-
import '@alfalab/core-components-badge/esm';
|
|
7
|
-
import '@alfalab/core-components-typography/esm';
|
|
8
6
|
|
|
9
|
-
var styles = {"component":"tab-
|
|
7
|
+
var styles = {"component":"tab-bar__component_1b06f","modal-bg-primary":"tab-bar__modal-bg-primary_1b06f","modal-bg-alt-primary":"tab-bar__modal-bg-alt-primary_1b06f","border":"tab-bar__border_1b06f"};
|
|
10
8
|
require('./index.css')
|
|
11
9
|
|
|
12
10
|
var TabBarComponent = forwardRef(function (_a, ref) {
|
|
13
11
|
var _b;
|
|
14
|
-
var children = _a.children, className = _a.className, selectedId = _a.selectedId, border = _a.border, dataTestId = _a.dataTestId, tabClassNames = _a.tabClassNames, onChange = _a.onChange, restProps = __rest(_a, ["children", "className", "selectedId", "border", "dataTestId", "tabClassNames", "onChange"]);
|
|
12
|
+
var children = _a.children, className = _a.className, selectedId = _a.selectedId, border = _a.border, dataTestId = _a.dataTestId, tabClassNames = _a.tabClassNames, onChange = _a.onChange, _c = _a.accentColor, accentColor = _c === void 0 ? 'primary' : _c, _d = _a.bgColor, bgColor = _d === void 0 ? 'modal-bg-primary' : _d, restProps = __rest(_a, ["children", "className", "selectedId", "border", "dataTestId", "tabClassNames", "onChange", "accentColor", "bgColor"]);
|
|
15
13
|
if (Children.count(children) > 5) {
|
|
16
14
|
// eslint-disable-next-line no-console
|
|
17
15
|
console.error('Компонент TabBar не может содержать больше 5 табов');
|
|
18
16
|
}
|
|
19
|
-
return (React.createElement("nav", __assign({ "data-test-id": dataTestId }, restProps, { ref: ref, className: cn(styles.component, className, (_b = {},
|
|
17
|
+
return (React.createElement("nav", __assign({ "data-test-id": dataTestId }, restProps, { ref: ref, className: cn(styles.component, styles[bgColor], className, (_b = {},
|
|
18
|
+
_b[styles.border] = border,
|
|
19
|
+
_b)) }), Children.map(children, function (tab) {
|
|
20
20
|
return cloneElement(tab, {
|
|
21
|
+
bgColor: bgColor,
|
|
22
|
+
accentColor: accentColor,
|
|
21
23
|
selected: tab.props.id === selectedId,
|
|
22
24
|
onChange: onChange,
|
|
23
25
|
tabClassNames: tabClassNames,
|
|
@@ -1,29 +1,33 @@
|
|
|
1
1
|
import { __rest, __assign } from 'tslib';
|
|
2
2
|
import React, { forwardRef, isValidElement, cloneElement } from 'react';
|
|
3
3
|
import cn from 'classnames';
|
|
4
|
-
import {
|
|
4
|
+
import { Indicator } from '@alfalab/core-components-indicator/esm';
|
|
5
5
|
import { Typography } from '@alfalab/core-components-typography/esm';
|
|
6
|
+
import { INDICATOR_BORDER_COLOR, INDICATOR_BG_COLOR } from '../../consts.js';
|
|
6
7
|
|
|
7
|
-
var styles = {"component":"tab-
|
|
8
|
+
var styles = {"component":"tab-bar__component_m43fu","primary":"tab-bar__primary_m43fu","secondary":"tab-bar__secondary_m43fu","icon":"tab-bar__icon_m43fu","label":"tab-bar__label_m43fu","labelSelected":"tab-bar__labelSelected_m43fu","indicator":"tab-bar__indicator_m43fu"};
|
|
8
9
|
require('./index.css')
|
|
9
10
|
|
|
10
11
|
var TabComponent = forwardRef(function (_a, ref) {
|
|
11
12
|
var _b, _c;
|
|
12
|
-
var showIndicator = _a.showIndicator, indicatorProps = _a.indicatorProps, label = _a.label, icon = _a.icon, id = _a.id, selected = _a.selected, onChange = _a.onChange, onClick = _a.onClick, _d = _a.tabClassNames, tabClassNames = _d === void 0 ? {} : _d, dataTestId = _a.dataTestId, className = _a.className, labelClassName = _a.labelClassName, selectedClassName = _a.selectedClassName, iconClassName = _a.iconClassName, href = _a.href, _e = _a.Component, Component = _e === void 0 ? href ? 'a' : 'button' : _e, restProps = __rest(_a, ["showIndicator", "indicatorProps", "label", "icon", "id", "selected", "onChange", "onClick", "tabClassNames", "dataTestId", "className", "labelClassName", "selectedClassName", "iconClassName", "href", "Component"]);
|
|
13
|
+
var showIndicator = _a.showIndicator, indicatorProps = _a.indicatorProps, label = _a.label, icon = _a.icon, id = _a.id, selected = _a.selected, onChange = _a.onChange, onClick = _a.onClick, _d = _a.tabClassNames, tabClassNames = _d === void 0 ? {} : _d, dataTestId = _a.dataTestId, className = _a.className, labelClassName = _a.labelClassName, selectedClassName = _a.selectedClassName, iconClassName = _a.iconClassName, href = _a.href, _e = _a.Component, Component = _e === void 0 ? href ? 'a' : 'button' : _e, _f = _a.accentColor, accentColor = _f === void 0 ? 'primary' : _f, _g = _a.bgColor, bgColor = _g === void 0 ? 'modal-bg-primary' : _g, restProps = __rest(_a, ["showIndicator", "indicatorProps", "label", "icon", "id", "selected", "onChange", "onClick", "tabClassNames", "dataTestId", "className", "labelClassName", "selectedClassName", "iconClassName", "href", "Component", "accentColor", "bgColor"]);
|
|
13
14
|
var handleClick = function (event) {
|
|
14
15
|
onChange === null || onChange === void 0 ? void 0 : onChange(id);
|
|
15
16
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
16
17
|
};
|
|
17
18
|
var commonClassName = tabClassNames.className, commonLabelClassName = tabClassNames.labelClassName, commonSelectedClassName = tabClassNames.selectedClassName, commonIconClassName = tabClassNames.iconClassName;
|
|
18
19
|
return (React.createElement(Component, __assign({ "data-test-id": dataTestId, tabIndex: 0 }, (Component === 'button' ? { type: 'button' } : null), restProps, { href: href, id: id, ref: ref, className: cn(styles.component, commonClassName, className, selected && commonSelectedClassName, selected && selectedClassName, (_b = {},
|
|
19
|
-
_b[styles
|
|
20
|
+
_b[styles[accentColor]] = selected,
|
|
20
21
|
_b)), onClick: handleClick }),
|
|
21
22
|
React.createElement("div", { className: cn(styles.icon, commonIconClassName, iconClassName) }, isValidElement(icon) ? cloneElement(icon, { selected: selected }) : icon),
|
|
22
23
|
React.createElement(Typography.Text, { weight: 'medium', view: 'secondary-small', className: cn(styles.label, commonLabelClassName, labelClassName, (_c = {},
|
|
23
24
|
_c[styles.labelSelected] = selected,
|
|
24
25
|
_c)) }, isValidElement(label) ? cloneElement(label, { selected: selected }) : label),
|
|
25
26
|
showIndicator && (React.createElement("div", { className: styles.indicator },
|
|
26
|
-
React.createElement(
|
|
27
|
+
React.createElement(Indicator, __assign({}, indicatorProps, { height: (indicatorProps === null || indicatorProps === void 0 ? void 0 : indicatorProps.value) ? 16 : undefined, border: {
|
|
28
|
+
width: 2,
|
|
29
|
+
color: INDICATOR_BORDER_COLOR[bgColor],
|
|
30
|
+
}, backgroundColor: INDICATOR_BG_COLOR[accentColor] }))))));
|
|
27
31
|
});
|
|
28
32
|
var Tab = TabComponent;
|
|
29
33
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
/* hash:
|
|
2
|
-
:root {
|
|
1
|
+
/* hash: y33p9 */
|
|
2
|
+
: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 */ /* 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 */ /* deprecated */ /* deprecated */
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-accent-primary: #ef3124;
|
|
5
|
+
--color-light-accent-secondary: #212124;
|
|
5
6
|
--color-light-neutral-translucent-700: rgba(4, 4, 21, 0.47);
|
|
6
7
|
--color-light-text-secondary: rgba(4, 4, 19, 0.55); /* 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 */
|
|
7
8
|
} :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 */
|
|
@@ -19,7 +20,7 @@
|
|
|
19
20
|
--gap-xs: 8px;
|
|
20
21
|
} :root {
|
|
21
22
|
} :root {
|
|
22
|
-
} .tab-
|
|
23
|
+
} .tab-bar__component_m43fu {
|
|
23
24
|
box-sizing: border-box;
|
|
24
25
|
background-color: transparent;
|
|
25
26
|
-webkit-tap-highlight-color: transparent;
|
|
@@ -43,15 +44,17 @@
|
|
|
43
44
|
align-items: center;
|
|
44
45
|
padding: var(--gap-xs) 0;
|
|
45
46
|
color: var(--color-light-neutral-translucent-700);
|
|
46
|
-
} .tab-
|
|
47
|
+
} .tab-bar__primary_m43fu {
|
|
47
48
|
color: var(--color-light-accent-primary);
|
|
48
|
-
} .tab-
|
|
49
|
+
} .tab-bar__secondary_m43fu {
|
|
50
|
+
color: var(--color-light-accent-secondary);
|
|
51
|
+
} .tab-bar__icon_m43fu {
|
|
49
52
|
display: flex;
|
|
50
53
|
align-items: center;
|
|
51
54
|
justify-content: center;
|
|
52
55
|
flex-grow: 1;
|
|
53
56
|
width: 100%;
|
|
54
|
-
} .tab-
|
|
57
|
+
} .tab-bar__label_m43fu {
|
|
55
58
|
-webkit-line-clamp: 1;
|
|
56
59
|
display: -webkit-box;
|
|
57
60
|
-webkit-box-orient: vertical;
|
|
@@ -60,11 +63,11 @@
|
|
|
60
63
|
flex-shrink: 0;
|
|
61
64
|
|
|
62
65
|
color: var(--color-light-text-secondary);
|
|
63
|
-
} .tab-
|
|
66
|
+
} .tab-bar__labelSelected_m43fu {
|
|
64
67
|
color: inherit;
|
|
65
|
-
} .tab-
|
|
68
|
+
} .tab-bar__indicator_m43fu {
|
|
66
69
|
position: absolute;
|
|
67
|
-
top:
|
|
70
|
+
top: 3px;
|
|
68
71
|
left: calc(50% + var(--gap-2xs));
|
|
69
72
|
height: 16px;
|
|
70
73
|
min-width: 16px;
|