@alfalab/core-components-tab-bar 4.0.2 → 4.0.3
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.map +1 -1
- package/components/tab/Component.d.ts +2 -2
- package/components/tab/Component.js +6 -2
- package/components/tab/Component.js.map +1 -1
- package/components/tab/index.css +7 -7
- package/components/tab/index.module.css.js +1 -1
- package/components/tab/index.module.css.js.map +1 -1
- package/cssm/Component.js.map +1 -1
- package/cssm/components/tab/Component.d.ts +2 -2
- package/cssm/components/tab/Component.js +6 -2
- package/cssm/components/tab/Component.js.map +1 -1
- package/cssm/types.d.ts +2 -2
- package/esm/Component.js.map +1 -1
- package/esm/components/tab/Component.d.ts +2 -2
- package/esm/components/tab/Component.js +6 -2
- package/esm/components/tab/Component.js.map +1 -1
- package/esm/components/tab/index.css +7 -7
- package/esm/components/tab/index.module.css.js +1 -1
- package/esm/components/tab/index.module.css.js.map +1 -1
- package/esm/index.css +5 -5
- package/esm/index.module.css.js +1 -1
- package/esm/index.module.css.js.map +1 -1
- package/esm/types.d.ts +2 -2
- package/index.css +5 -5
- package/index.module.css.js +1 -1
- package/index.module.css.js.map +1 -1
- package/modern/Component.js.map +1 -1
- package/modern/components/tab/Component.d.ts +2 -2
- package/modern/components/tab/Component.js +6 -2
- package/modern/components/tab/Component.js.map +1 -1
- package/modern/components/tab/index.css +7 -7
- package/modern/components/tab/index.module.css.js +1 -1
- package/modern/components/tab/index.module.css.js.map +1 -1
- package/modern/index.css +5 -5
- package/modern/index.module.css.js +1 -1
- package/modern/index.module.css.js.map +1 -1
- package/modern/types.d.ts +2 -2
- package/moderncssm/Component.js.map +1 -1
- package/moderncssm/components/tab/Component.d.ts +2 -2
- package/moderncssm/components/tab/Component.js +6 -2
- package/moderncssm/components/tab/Component.js.map +1 -1
- package/moderncssm/types.d.ts +2 -2
- package/package.json +6 -6
- package/src/components/tab/Component.tsx +6 -2
- package/src/components/tab/index.module.css +1 -1
- package/src/index.module.css +1 -1
- package/types.d.ts +2 -2
package/Component.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.js","sources":["src/Component.tsx"],"sourcesContent":["import React, { Children, cloneElement, forwardRef } from 'react';\nimport cn from 'classnames';\n\nimport { getDataTestId } from '@alfalab/core-components-shared';\n\nimport { Tab } from './components/tab';\nimport { type TabBarProps } from './types';\n\nimport styles from './index.module.css';\n\nconst TabBarComponent = forwardRef<HTMLDivElement, TabBarProps>(\n (\n {\n children,\n className,\n selectedId,\n border,\n dataTestId,\n tabClassNames,\n onChange,\n accentColor = 'primary',\n bgColor = 'modal-bg-primary',\n ...restProps\n },\n ref,\n ) => {\n if (Children.count(children) > 5) {\n // eslint-disable-next-line no-console\n console.error('Компонент TabBar не может содержать больше 5 табов');\n }\n\n return (\n <nav\n data-test-id={dataTestId}\n {...restProps}\n ref={ref}\n className={cn(styles.component, styles[bgColor], className, {\n [styles.border]: border,\n })}\n >\n {Children.map(children, (tab) =>\n cloneElement(tab, {\n bgColor,\n accentColor,\n selected: tab.props.id === selectedId,\n onChange,\n tabClassNames,\n dataTestId: getDataTestId(dataTestId, 'tab'),\n }),\n )}\n </nav>\n );\n },\n);\n\nTabBarComponent.displayName = 'TabBarComponent';\n\nexport const TabBar = Object.assign(TabBarComponent, { Tab });\n"],"names":["forwardRef","__rest","Children","React","cn","styles","cloneElement","getDataTestId","Tab"],"mappings":";;;;;;;;;;;;;;;;AAUA,IAAM,eAAe,GAAGA,gBAAU,CAC9B,UACI,EAWC,EACD,GAAG,EAAA;;AAXC,IAAA,IAAA,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,UAAU,GAAA,EAAA,CAAA,UAAA,EACV,MAAM,YAAA,EACN,UAAU,gBAAA,EACV,aAAa,mBAAA,EACb,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,mBAAuB,EAAvB,WAAW,GAAG,EAAA,KAAA,MAAA,GAAA,SAAS,KAAA,EACvB,EAAA,GAAA,EAAA,CAAA,OAA4B,EAA5B,OAAO,mBAAG,kBAAkB,GAAA,EAAA,EACzB,SAAS,GAAAC,YAAA,CAAA,EAAA,EAVhB,sHAWC,CADe;IAIhB,IAAIC,cAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;;AAE9B,QAAA,OAAO,CAAC,KAAK,CAAC,oDAAoD,CAAC
|
|
1
|
+
{"version":3,"file":"Component.js","sources":["src/Component.tsx"],"sourcesContent":["import React, { Children, cloneElement, forwardRef } from 'react';\nimport cn from 'classnames';\n\nimport { getDataTestId } from '@alfalab/core-components-shared';\n\nimport { Tab } from './components/tab';\nimport { type TabBarProps } from './types';\n\nimport styles from './index.module.css';\n\nconst TabBarComponent = forwardRef<HTMLDivElement, TabBarProps>(\n (\n {\n children,\n className,\n selectedId,\n border,\n dataTestId,\n tabClassNames,\n onChange,\n accentColor = 'primary',\n bgColor = 'modal-bg-primary',\n ...restProps\n },\n ref,\n ) => {\n if (Children.count(children) > 5) {\n // eslint-disable-next-line no-console\n console.error('Компонент TabBar не может содержать больше 5 табов');\n }\n\n return (\n <nav\n data-test-id={dataTestId}\n {...restProps}\n ref={ref}\n className={cn(styles.component, styles[bgColor], className, {\n [styles.border]: border,\n })}\n >\n {Children.map(children, (tab) =>\n cloneElement(tab, {\n bgColor,\n accentColor,\n selected: tab.props.id === selectedId,\n onChange,\n tabClassNames,\n dataTestId: getDataTestId(dataTestId, 'tab'),\n }),\n )}\n </nav>\n );\n },\n);\n\nTabBarComponent.displayName = 'TabBarComponent';\n\nexport const TabBar = Object.assign(TabBarComponent, { Tab });\n"],"names":["forwardRef","__rest","Children","React","cn","styles","cloneElement","getDataTestId","Tab"],"mappings":";;;;;;;;;;;;;;;;AAUA,IAAM,eAAe,GAAGA,gBAAU,CAC9B,UACI,EAWC,EACD,GAAG,EAAA;;AAXC,IAAA,IAAA,QAAQ,GAAA,EAAA,CAAA,QAAA,E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M,CAAC,MAAM,CAAC,eAAe,EAAE,EAAE,GAAG,EAAAC,aAAA,EAAE;;;;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type ForwardRefExoticComponent, type RefAttributes } from 'react';
|
|
2
2
|
import { type PublicTabProps } from '../../types';
|
|
3
|
-
export declare const Tab:
|
|
3
|
+
export declare const Tab: ForwardRefExoticComponent<PublicTabProps & RefAttributes<HTMLElement>>;
|
|
@@ -26,10 +26,14 @@ var TabComponent = React.forwardRef(function (_a, ref) {
|
|
|
26
26
|
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(index_module.component, commonClassName, className, selected && commonSelectedClassName, selected && selectedClassName, (_b = {},
|
|
27
27
|
_b[index_module[accentColor]] = selected,
|
|
28
28
|
_b)), onClick: handleClick }),
|
|
29
|
-
React__default.default.createElement("div", { className: cn__default.default(index_module.icon, commonIconClassName, iconClassName) }, React.isValidElement(icon)
|
|
29
|
+
React__default.default.createElement("div", { className: cn__default.default(index_module.icon, commonIconClassName, iconClassName) }, React.isValidElement(icon)
|
|
30
|
+
? React.cloneElement(icon, { selected: selected })
|
|
31
|
+
: icon),
|
|
30
32
|
React__default.default.createElement(coreComponentsTypography.TypographyText, { weight: 'medium', view: 'secondary-small', className: cn__default.default(index_module.label, commonLabelClassName, labelClassName, (_c = {},
|
|
31
33
|
_c[index_module.labelSelected] = selected,
|
|
32
|
-
_c)) }, React.isValidElement(label)
|
|
34
|
+
_c)) }, React.isValidElement(label)
|
|
35
|
+
? React.cloneElement(label, { selected: selected })
|
|
36
|
+
: label),
|
|
33
37
|
showIndicator && (React__default.default.createElement("div", { className: index_module.indicator },
|
|
34
38
|
React__default.default.createElement(coreComponentsIndicator.Indicator, tslib.__assign({}, indicatorProps, { height: (indicatorProps === null || indicatorProps === void 0 ? void 0 : indicatorProps.value) ? 16 : undefined, border: {
|
|
35
39
|
width: 2,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.js","sources":["../../src/components/tab/Component.tsx"],"sourcesContent":["import React, {\n cloneElement,\n forwardRef,\n type ForwardRefExoticComponent,\n isValidElement,\n type MouseEventHandler,\n type RefAttributes,\n} from 'react';\nimport cn from 'classnames';\n\nimport { Indicator } from '@alfalab/core-components-indicator';\nimport { TypographyText } from '@alfalab/core-components-typography';\n\nimport { INDICATOR_BG_COLOR, INDICATOR_BORDER_COLOR } from '../../consts';\nimport { type AllTabProps, type PublicTabProps } from '../../types';\n\nimport styles from './index.module.css';\n\nconst TabComponent = forwardRef<HTMLElement, AllTabProps>(\n (\n {\n showIndicator,\n indicatorProps,\n label,\n icon,\n id,\n selected,\n onChange,\n onClick,\n tabClassNames = {},\n dataTestId,\n className,\n labelClassName,\n selectedClassName,\n iconClassName,\n href,\n Component = href ? 'a' : 'button',\n accentColor = 'primary',\n bgColor = 'modal-bg-primary',\n ...restProps\n },\n ref,\n ) => {\n const handleClick: MouseEventHandler<HTMLElement> = (event) => {\n onChange?.(id);\n onClick?.(event);\n };\n\n const {\n className: commonClassName,\n labelClassName: commonLabelClassName,\n selectedClassName: commonSelectedClassName,\n iconClassName: commonIconClassName,\n } = tabClassNames;\n\n return (\n <Component\n data-test-id={dataTestId}\n tabIndex={0}\n {...(Component === 'button' ? { type: 'button' } : null)}\n {...restProps}\n href={href}\n id={id}\n ref={ref}\n className={cn(\n styles.component,\n commonClassName,\n className,\n selected && commonSelectedClassName,\n selected && selectedClassName,\n {\n [styles[accentColor]]: selected,\n },\n )}\n onClick={handleClick}\n >\n <div className={cn(styles.icon, commonIconClassName, iconClassName)}>\n {isValidElement(icon)
|
|
1
|
+
{"version":3,"file":"Component.js","sources":["../../src/components/tab/Component.tsx"],"sourcesContent":["import React, {\n cloneElement,\n forwardRef,\n type ForwardRefExoticComponent,\n isValidElement,\n type MouseEventHandler,\n type RefAttributes,\n} from 'react';\nimport cn from 'classnames';\n\nimport { Indicator } from '@alfalab/core-components-indicator';\nimport { TypographyText } from '@alfalab/core-components-typography';\n\nimport { INDICATOR_BG_COLOR, INDICATOR_BORDER_COLOR } from '../../consts';\nimport { type AllTabProps, type PublicTabProps } from '../../types';\n\nimport styles from './index.module.css';\n\nconst TabComponent = forwardRef<HTMLElement, AllTabProps>(\n (\n {\n showIndicator,\n indicatorProps,\n label,\n icon,\n id,\n selected,\n onChange,\n onClick,\n tabClassNames = {},\n dataTestId,\n className,\n labelClassName,\n selectedClassName,\n iconClassName,\n href,\n Component = href ? 'a' : 'button',\n accentColor = 'primary',\n bgColor = 'modal-bg-primary',\n ...restProps\n },\n ref,\n ) => {\n const handleClick: MouseEventHandler<HTMLElement> = (event) => {\n onChange?.(id);\n onClick?.(event);\n };\n\n const {\n className: commonClassName,\n labelClassName: commonLabelClassName,\n selectedClassName: commonSelectedClassName,\n iconClassName: commonIconClassName,\n } = tabClassNames;\n\n return (\n <Component\n data-test-id={dataTestId}\n tabIndex={0}\n {...(Component === 'button' ? { type: 'button' } : null)}\n {...restProps}\n href={href}\n id={id}\n ref={ref}\n className={cn(\n styles.component,\n commonClassName,\n className,\n selected && commonSelectedClassName,\n selected && selectedClassName,\n {\n [styles[accentColor]]: selected,\n },\n )}\n onClick={handleClick}\n >\n <div className={cn(styles.icon, commonIconClassName, iconClassName)}>\n {isValidElement<{ selected: unknown }>(icon)\n ? cloneElement(icon, { selected })\n : icon}\n </div>\n\n <TypographyText\n weight='medium'\n view='secondary-small'\n className={cn(styles.label, commonLabelClassName, labelClassName, {\n [styles.labelSelected]: selected,\n })}\n >\n {isValidElement<{ selected: unknown }>(label)\n ? cloneElement(label, { selected })\n : label}\n </TypographyText>\n\n {showIndicator && (\n <div className={styles.indicator}>\n <Indicator\n {...indicatorProps}\n height={indicatorProps?.value ? 16 : undefined}\n border={{\n width: 2,\n color: INDICATOR_BORDER_COLOR[bgColor],\n }}\n backgroundColor={INDICATOR_BG_COLOR[accentColor]}\n />\n </div>\n )}\n </Component>\n );\n },\n);\n\nexport const Tab = TabComponent as ForwardRefExoticComponent<\n PublicTabProps & RefAttributes<HTMLElement>\n>;\n"],"names":["forwardRef","__rest","React","__assign","cn","styles","isValidElement","cloneElement","TypographyText","Indicator","INDICATOR_BORDER_COLOR","INDICATOR_BG_COLOR"],"mappings":";;;;;;;;;;;;;;;;;AAkBA,IAAM,YAAY,GAAGA,gBAAU,CAC3B,UACI,EAoBC,EACD,GAAG,EAAA;;AApBC,IAAA,IAAA,aAAa,GAAA,EAAA,CAAA,aAAA,EACb,cAAc,GAAA,EAAA,CAAA,cAAA,EACd,KAAK,GAAA,EAAA,CAAA,KAAA,EACL,IAAI,UAAA,EACJ,EAAE,QAAA,EACF,QAAQ,cAAA,EACR,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,OAAO,GAAA,EAAA,CAAA,OAAA,EACP,EAAkB,GAAA,EAAA,CAAA,aAAA,EAAlB,aAAa,GAAG,EAAA,KAAA,MAAA,GAAA,EAAE,GAAA,EAAA,EAClB,UAAU,GAAA,EAAA,CAAA,UAAA,EACV,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,cAAc,GAAA,EAAA,CAAA,cAAA,EACd,iBAAiB,GAAA,EAAA,CAAA,iBAAA,EACjB,aAAa,GAAA,EAAA,CAAA,aAAA,EACb,IAAI,UAAA,EACJ,EAAA,GAAA,EAAA,CAAA,SAAiC,EAAjC,SAAS,mBAAG,IAAI,GAAG,GAAG,GAAG,QAAQ,GAAA,EAAA,EACjC,EAAuB,GAAA,EAAA,CAAA,WAAA,EAAvB,WAAW,GAAG,EAAA,KAAA,MAAA,GAAA,SAAS,KAAA,EACvB,EAAA,GAAA,EAAA,CAAA,OAA4B,EAA5B,OAAO,mBAAG,kBAAkB,GAAA,EAAA,EACzB,SAAS,GAAAC,YAAA,CAAA,EAAA,EAnBhB,gPAoBC,CADe;IAIhB,IAAM,WAAW,GAAmC,UAAC,KAAK,EAAA;AACtD,QAAA,QAA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AE,CAACC,YAAM,CAAC,KAAK,EAAE,oBAAoB,EAAE,cAAc,GAAA,EAAA,GAAA,EAAA;AAC5D,gBAAA,EAAA,CAACA,YAAM,CAAC,aAAa,CAAA,GAAG,QAAQ;oBAClC,EAED,EAAAC,oBAAc,CAAwB,KAAK;cACtCC,kBAAY,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAA,QAAA,EAAE;cAChC,KAAK,CACE;AAEhB,QAAA,aAAa,KACVL,sBAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAEG,YAAM,CAAC,SAAS,EAAA;YAC5BH,sBAAC,CAAA,aAAA,CAAAO,iCAAS,EACFN,cAAA,CAAA,EAAA,EAAA,cAAc,EAClB,EAAA,MAAM,EAAE,CAAA,cAAc,KAAd,IAAA,IAAA,cAAc,KAAd,MAAA,GAAA,MAAA,GAAA,cAAc,CAAE,KAAK,IAAG,EAAE,GAAG,SAAS,EAC9C,MAAM,EAAE;AACJ,oBAAA,KAAK,EAAE,CAAC;AACR,oBAAA,KAAK,EAAEO,6BAAsB,CAAC,OAAO,CAAC;iBACzC,EACD,eAAe,EAAEC,yBAAkB,CAAC,WAAW,CAAC,EAAA,CAAA,CAClD,CACA,CACT,CACO;AAEpB,CAAC,CACJ;AAEM,IAAM,GAAG,GAAG;;;;"}
|
package/components/tab/index.css
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
--gap-4: var(--gap-2xs);
|
|
15
15
|
--gap-8: var(--gap-xs);
|
|
16
16
|
}
|
|
17
|
-
.tab-
|
|
17
|
+
.tab-bar__component_1gp7j {
|
|
18
18
|
-webkit-tap-highlight-color: transparent;
|
|
19
19
|
box-sizing: border-box;
|
|
20
20
|
background-color: transparent;
|
|
@@ -42,20 +42,20 @@
|
|
|
42
42
|
padding: var(--gap-8) var(--gap-0);
|
|
43
43
|
color: var(--color-light-neutral-translucent-700);
|
|
44
44
|
}
|
|
45
|
-
.tab-
|
|
45
|
+
.tab-bar__primary_1gp7j {
|
|
46
46
|
color: var(--color-light-accent-primary);
|
|
47
47
|
}
|
|
48
|
-
.tab-
|
|
48
|
+
.tab-bar__secondary_1gp7j {
|
|
49
49
|
color: var(--color-light-accent-secondary);
|
|
50
50
|
}
|
|
51
|
-
.tab-
|
|
51
|
+
.tab-bar__icon_1gp7j {
|
|
52
52
|
display: flex;
|
|
53
53
|
align-items: center;
|
|
54
54
|
justify-content: center;
|
|
55
55
|
flex-grow: 1;
|
|
56
56
|
width: 100%;
|
|
57
57
|
}
|
|
58
|
-
.tab-
|
|
58
|
+
.tab-bar__label_1gp7j {
|
|
59
59
|
-webkit-line-clamp: 1;
|
|
60
60
|
display: -webkit-box;
|
|
61
61
|
-webkit-box-orient: vertical;
|
|
@@ -65,10 +65,10 @@
|
|
|
65
65
|
|
|
66
66
|
color: var(--color-light-text-secondary);
|
|
67
67
|
}
|
|
68
|
-
.tab-
|
|
68
|
+
.tab-bar__labelSelected_1gp7j {
|
|
69
69
|
color: inherit;
|
|
70
70
|
}
|
|
71
|
-
.tab-
|
|
71
|
+
.tab-bar__indicator_1gp7j {
|
|
72
72
|
position: absolute;
|
|
73
73
|
top: 3px;
|
|
74
74
|
left: calc(50% + var(--gap-4));
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require('./index.css');
|
|
4
4
|
|
|
5
|
-
var styles = {"component":"tab-
|
|
5
|
+
var styles = {"component":"tab-bar__component_1gp7j","primary":"tab-bar__primary_1gp7j","secondary":"tab-bar__secondary_1gp7j","icon":"tab-bar__icon_1gp7j","label":"tab-bar__label_1gp7j","labelSelected":"tab-bar__labelSelected_1gp7j","indicator":"tab-bar__indicator_1gp7j"};
|
|
6
6
|
|
|
7
7
|
module.exports = styles;
|
|
8
8
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.module.css.js","sources":["../../src/components/tab/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/
|
|
1
|
+
{"version":3,"file":"index.module.css.js","sources":["../../src/components/tab/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n\n.component {\n @mixin button-reset;\n\n position: relative;\n display: inline-flex;\n flex-direction: column;\n flex: 1 0 0;\n align-items: center;\n padding: var(--gap-8) var(--gap-0);\n color: var(--color-light-neutral-translucent-700);\n}\n\n.primary {\n color: var(--color-light-accent-primary);\n}\n\n.secondary {\n color: var(--color-light-accent-secondary);\n}\n\n.icon {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-grow: 1;\n width: 100%;\n}\n\n.label {\n @mixin row_limit 1;\n word-break: break-all;\n flex-shrink: 0;\n\n color: var(--color-light-text-secondary);\n}\n\n.labelSelected {\n color: inherit;\n}\n\n.indicator {\n position: absolute;\n top: 3px;\n left: calc(50% + var(--gap-4));\n height: 16px;\n min-width: 16px;\n}\n"],"names":[],"mappings":";;;;AAEgB,aAAe,CAAC,WAAW,CAAC,0BAA0B,CAAC,SAAS,CAAC,wBAAwB,CAAC,WAAW,CAAC,0BAA0B,CAAC,MAAM,CAAC,qBAAqB,CAAC,OAAO,CAAC,sBAAsB,CAAC,eAAe,CAAC,8BAA8B,CAAC,WAAW,CAAC,0BAA0B,CAAC;;;;"}
|
package/cssm/Component.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.js","sources":["../src/Component.tsx"],"sourcesContent":["import React, { Children, cloneElement, forwardRef } from 'react';\nimport cn from 'classnames';\n\nimport { getDataTestId } from '@alfalab/core-components-shared';\n\nimport { Tab } from './components/tab';\nimport { type TabBarProps } from './types';\n\nimport styles from './index.module.css';\n\nconst TabBarComponent = forwardRef<HTMLDivElement, TabBarProps>(\n (\n {\n children,\n className,\n selectedId,\n border,\n dataTestId,\n tabClassNames,\n onChange,\n accentColor = 'primary',\n bgColor = 'modal-bg-primary',\n ...restProps\n },\n ref,\n ) => {\n if (Children.count(children) > 5) {\n // eslint-disable-next-line no-console\n console.error('Компонент TabBar не может содержать больше 5 табов');\n }\n\n return (\n <nav\n data-test-id={dataTestId}\n {...restProps}\n ref={ref}\n className={cn(styles.component, styles[bgColor], className, {\n [styles.border]: border,\n })}\n >\n {Children.map(children, (tab) =>\n cloneElement(tab, {\n bgColor,\n accentColor,\n selected: tab.props.id === selectedId,\n onChange,\n tabClassNames,\n dataTestId: getDataTestId(dataTestId, 'tab'),\n }),\n )}\n </nav>\n );\n },\n);\n\nTabBarComponent.displayName = 'TabBarComponent';\n\nexport const TabBar = Object.assign(TabBarComponent, { Tab });\n"],"names":["forwardRef","__rest","Children","React","cn","styles","cloneElement","getDataTestId","Tab"],"mappings":";;;;;;;;;;;;;;;;;AAUA,IAAM,eAAe,GAAGA,gBAAU,CAC9B,UACI,EAWC,EACD,GAAG,EAAA;;AAXC,IAAA,IAAA,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,UAAU,GAAA,EAAA,CAAA,UAAA,EACV,MAAM,YAAA,EACN,UAAU,gBAAA,EACV,aAAa,mBAAA,EACb,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,mBAAuB,EAAvB,WAAW,GAAG,EAAA,KAAA,MAAA,GAAA,SAAS,KAAA,EACvB,EAAA,GAAA,EAAA,CAAA,OAA4B,EAA5B,OAAO,mBAAG,kBAAkB,GAAA,EAAA,EACzB,SAAS,GAAAC,YAAA,CAAA,EAAA,EAVhB,sHAWC,CADe;IAIhB,IAAIC,cAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;;AAE9B,QAAA,OAAO,CAAC,KAAK,CAAC,oDAAoD,CAAC
|
|
1
|
+
{"version":3,"file":"Component.js","sources":["../src/Component.tsx"],"sourcesContent":["import React, { Children, cloneElement, forwardRef } from 'react';\nimport cn from 'classnames';\n\nimport { getDataTestId } from '@alfalab/core-components-shared';\n\nimport { Tab } from './components/tab';\nimport { type TabBarProps } from './types';\n\nimport styles from './index.module.css';\n\nconst TabBarComponent = forwardRef<HTMLDivElement, TabBarProps>(\n (\n {\n children,\n className,\n selectedId,\n border,\n dataTestId,\n tabClassNames,\n onChange,\n accentColor = 'primary',\n bgColor = 'modal-bg-primary',\n ...restProps\n },\n ref,\n ) => {\n if (Children.count(children) > 5) {\n // eslint-disable-next-line no-console\n console.error('Компонент TabBar не может содержать больше 5 табов');\n }\n\n return (\n <nav\n data-test-id={dataTestId}\n {...restProps}\n ref={ref}\n className={cn(styles.component, styles[bgColor], className, {\n [styles.border]: border,\n })}\n >\n {Children.map(children, (tab) =>\n cloneElement(tab, {\n bgColor,\n accentColor,\n selected: tab.props.id === selectedId,\n onChange,\n tabClassNames,\n dataTestId: getDataTestId(dataTestId, 'tab'),\n }),\n )}\n </nav>\n );\n },\n);\n\nTabBarComponent.displayName = 'TabBarComponent';\n\nexport const TabBar = Object.assign(TabBarComponent, { Tab });\n"],"names":["forwardRef","__rest","Children","React","cn","styles","cloneElement","getDataTestId","Tab"],"mappings":";;;;;;;;;;;;;;;;;AAUA,IAAM,eAAe,GAAGA,gBAAU,CAC9B,UACI,EAWC,EACD,GAAG,EAAA;;AAXC,IAAA,IAAA,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,UAAU,GAAA,EAAA,CAAA,UAAA,EACV,MAAM,YAAA,EACN,UAAU,gBAAA,EACV,aAAa,mBAAA,EACb,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,mBAAuB,EAAvB,WAAW,GAAG,EAAA,KAAA,MAAA,GAAA,SAAS,KAAA,EACvB,EAAA,GAAA,EAAA,CAAA,OAA4B,EAA5B,OAAO,mBAAG,kBAAkB,GAAA,EAAA,EACzB,SAAS,GAAAC,YAAA,CAAA,EAAA,EAVhB,sHAWC,CADe;IAIhB,IAAIC,cAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;;AAE9B,QAAA,OAAO,CAAC,KAAK,CAAC,oDAAoD,CAAC;;IAGvE,QACIC,6EACkB,UAAU,EAAA,EACpB,SAAS,EACb,EAAA,GAAG,EAAE,GAAG,EACR,SAAS,EAAEC,mBAAE,CAACC,uBAAM,CAAC,SAAS,EAAEA,uBAAM,CAAC,OAAO,CAAC,EAAE,SAAS,GAAA,EAAA,GAAA,EAAA;AACtD,YAAA,EAAA,CAACA,uBAAM,CAAC,MAAM,CAAA,GAAG,MAAM;AACzB,YAAA,EAAA,EAAA,EAAA,CAAA,EAEDH,cAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,UAAC,GAAG,EAAA;QACxB,OAAAI,kBAAY,CAAC,GAAG,EAAE;AACd,YAAA,OAAO,EAAA,OAAA;AACP,YAAA,WAAW,EAAA,WAAA;AACX,YAAA,QAAQ,EAAE,GAAG,CAAC,KAAK,CAAC,EAAE,KAAK,UAAU;AACrC,YAAA,QAAQ,EAAA,QAAA;AACR,YAAA,aAAa,EAAA,aAAA;AACb,YAAA,UAAU,EAAEC,kBAAa,CAAC,UAAU,EAAE,KAAK,CAAC;SAC/C,CAAC;KAAA,CACL,CACC;AAEd,CAAC,CACJ;AAED,eAAe,CAAC,WAAW,GAAG,iBAAiB;AAExC,IAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE,EAAE,GAAG,EAAAC,aAAA,EAAE;;;;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type ForwardRefExoticComponent, type RefAttributes } from 'react';
|
|
2
2
|
import { type PublicTabProps } from '../../types';
|
|
3
|
-
export declare const Tab:
|
|
3
|
+
export declare const Tab: ForwardRefExoticComponent<PublicTabProps & RefAttributes<HTMLElement>>;
|
|
@@ -27,10 +27,14 @@ var TabComponent = React.forwardRef(function (_a, ref) {
|
|
|
27
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 = {},
|
|
28
28
|
_b[styles__default.default[accentColor]] = selected,
|
|
29
29
|
_b)), onClick: handleClick }),
|
|
30
|
-
React__default.default.createElement("div", { className: cn__default.default(styles__default.default.icon, commonIconClassName, iconClassName) }, React.isValidElement(icon)
|
|
30
|
+
React__default.default.createElement("div", { className: cn__default.default(styles__default.default.icon, commonIconClassName, iconClassName) }, React.isValidElement(icon)
|
|
31
|
+
? React.cloneElement(icon, { selected: selected })
|
|
32
|
+
: icon),
|
|
31
33
|
React__default.default.createElement(cssm.TypographyText, { weight: 'medium', view: 'secondary-small', className: cn__default.default(styles__default.default.label, commonLabelClassName, labelClassName, (_c = {},
|
|
32
34
|
_c[styles__default.default.labelSelected] = selected,
|
|
33
|
-
_c)) }, React.isValidElement(label)
|
|
35
|
+
_c)) }, React.isValidElement(label)
|
|
36
|
+
? React.cloneElement(label, { selected: selected })
|
|
37
|
+
: label),
|
|
34
38
|
showIndicator && (React__default.default.createElement("div", { className: styles__default.default.indicator },
|
|
35
39
|
React__default.default.createElement(cssm$1.Indicator, tslib.__assign({}, indicatorProps, { height: (indicatorProps === null || indicatorProps === void 0 ? void 0 : indicatorProps.value) ? 16 : undefined, border: {
|
|
36
40
|
width: 2,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.js","sources":["../../../src/components/tab/Component.tsx"],"sourcesContent":["import React, {\n cloneElement,\n forwardRef,\n type ForwardRefExoticComponent,\n isValidElement,\n type MouseEventHandler,\n type RefAttributes,\n} from 'react';\nimport cn from 'classnames';\n\nimport { Indicator } from '@alfalab/core-components-indicator';\nimport { TypographyText } from '@alfalab/core-components-typography';\n\nimport { INDICATOR_BG_COLOR, INDICATOR_BORDER_COLOR } from '../../consts';\nimport { type AllTabProps, type PublicTabProps } from '../../types';\n\nimport styles from './index.module.css';\n\nconst TabComponent = forwardRef<HTMLElement, AllTabProps>(\n (\n {\n showIndicator,\n indicatorProps,\n label,\n icon,\n id,\n selected,\n onChange,\n onClick,\n tabClassNames = {},\n dataTestId,\n className,\n labelClassName,\n selectedClassName,\n iconClassName,\n href,\n Component = href ? 'a' : 'button',\n accentColor = 'primary',\n bgColor = 'modal-bg-primary',\n ...restProps\n },\n ref,\n ) => {\n const handleClick: MouseEventHandler<HTMLElement> = (event) => {\n onChange?.(id);\n onClick?.(event);\n };\n\n const {\n className: commonClassName,\n labelClassName: commonLabelClassName,\n selectedClassName: commonSelectedClassName,\n iconClassName: commonIconClassName,\n } = tabClassNames;\n\n return (\n <Component\n data-test-id={dataTestId}\n tabIndex={0}\n {...(Component === 'button' ? { type: 'button' } : null)}\n {...restProps}\n href={href}\n id={id}\n ref={ref}\n className={cn(\n styles.component,\n commonClassName,\n className,\n selected && commonSelectedClassName,\n selected && selectedClassName,\n {\n [styles[accentColor]]: selected,\n },\n )}\n onClick={handleClick}\n >\n <div className={cn(styles.icon, commonIconClassName, iconClassName)}>\n {isValidElement(icon)
|
|
1
|
+
{"version":3,"file":"Component.js","sources":["../../../src/components/tab/Component.tsx"],"sourcesContent":["import React, {\n cloneElement,\n forwardRef,\n type ForwardRefExoticComponent,\n isValidElement,\n type MouseEventHandler,\n type RefAttributes,\n} from 'react';\nimport cn from 'classnames';\n\nimport { Indicator } from '@alfalab/core-components-indicator';\nimport { TypographyText } from '@alfalab/core-components-typography';\n\nimport { INDICATOR_BG_COLOR, INDICATOR_BORDER_COLOR } from '../../consts';\nimport { type AllTabProps, type PublicTabProps } from '../../types';\n\nimport styles from './index.module.css';\n\nconst TabComponent = forwardRef<HTMLElement, AllTabProps>(\n (\n {\n showIndicator,\n indicatorProps,\n label,\n icon,\n id,\n selected,\n onChange,\n onClick,\n tabClassNames = {},\n dataTestId,\n className,\n labelClassName,\n selectedClassName,\n iconClassName,\n href,\n Component = href ? 'a' : 'button',\n accentColor = 'primary',\n bgColor = 'modal-bg-primary',\n ...restProps\n },\n ref,\n ) => {\n const handleClick: MouseEventHandler<HTMLElement> = (event) => {\n onChange?.(id);\n onClick?.(event);\n };\n\n const {\n className: commonClassName,\n labelClassName: commonLabelClassName,\n selectedClassName: commonSelectedClassName,\n iconClassName: commonIconClassName,\n } = tabClassNames;\n\n return (\n <Component\n data-test-id={dataTestId}\n tabIndex={0}\n {...(Component === 'button' ? { type: 'button' } : null)}\n {...restProps}\n href={href}\n id={id}\n ref={ref}\n className={cn(\n styles.component,\n commonClassName,\n className,\n selected && commonSelectedClassName,\n selected && selectedClassName,\n {\n [styles[accentColor]]: selected,\n },\n )}\n onClick={handleClick}\n >\n <div className={cn(styles.icon, commonIconClassName, iconClassName)}>\n {isValidElement<{ selected: unknown }>(icon)\n ? cloneElement(icon, { selected })\n : icon}\n </div>\n\n <TypographyText\n weight='medium'\n view='secondary-small'\n className={cn(styles.label, commonLabelClassName, labelClassName, {\n [styles.labelSelected]: selected,\n })}\n >\n {isValidElement<{ selected: unknown }>(label)\n ? cloneElement(label, { selected })\n : label}\n </TypographyText>\n\n {showIndicator && (\n <div className={styles.indicator}>\n <Indicator\n {...indicatorProps}\n height={indicatorProps?.value ? 16 : undefined}\n border={{\n width: 2,\n color: INDICATOR_BORDER_COLOR[bgColor],\n }}\n backgroundColor={INDICATOR_BG_COLOR[accentColor]}\n />\n </div>\n )}\n </Component>\n );\n },\n);\n\nexport const Tab = TabComponent as ForwardRefExoticComponent<\n PublicTabProps & RefAttributes<HTMLElement>\n>;\n"],"names":["forwardRef","__rest","React","__assign","cn","styles","isValidElement","cloneElement","TypographyText","Indicator","INDICATOR_BORDER_COLOR","INDICATOR_BG_COLOR"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,IAAM,YAAY,GAAGA,gBAAU,CAC3B,UACI,EAoBC,EACD,GAAG,EAAA;;AApBC,IAAA,IAAA,aAAa,GAAA,EAAA,CAAA,aAAA,EACb,cAAc,GAAA,EAAA,CAAA,cAAA,EACd,KAAK,GAAA,EAAA,CAAA,KAAA,EACL,IAAI,UAAA,EACJ,EAAE,QAAA,EACF,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AA,MAAM,EAAE,CAAA,cAAc,KAAd,IAAA,IAAA,cAAc,KAAd,MAAA,GAAA,MAAA,GAAA,cAAc,CAAE,KAAK,IAAG,EAAE,GAAG,SAAS,EAC9C,MAAM,EAAE;AACJ,oBAAA,KAAK,EAAE,CAAC;AACR,oBAAA,KAAK,EAAEO,6BAAsB,CAAC,OAAO,CAAC;iBACzC,EACD,eAAe,EAAEC,yBAAkB,CAAC,WAAW,CAAC,EAAA,CAAA,CAClD,CACA,CACT,CACO;AAEpB,CAAC,CACJ;AAEM,IAAM,GAAG,GAAG;;;;"}
|
package/cssm/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type AllHTMLAttributes, type ElementType, type ForwardRefExoticComponent, type HTMLAttributes, type ReactElement, type ReactNode, type RefAttributes } from 'react';
|
|
2
2
|
import { type IndicatorProps } from '@alfalab/core-components-indicator/cssm';
|
|
3
|
-
export
|
|
4
|
-
|
|
3
|
+
export type AllTabProps = PublicTabProps & PrivateTabProps;
|
|
4
|
+
type TabElementType = ReactElement<AllTabProps, ForwardRefExoticComponent<AllTabProps & RefAttributes<HTMLElement>>>;
|
|
5
5
|
export interface TabBarProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
6
6
|
/**
|
|
7
7
|
* Дополнительный класс
|
package/esm/Component.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.js","sources":["../src/Component.tsx"],"sourcesContent":["import React, { Children, cloneElement, forwardRef } from 'react';\nimport cn from 'classnames';\n\nimport { getDataTestId } from '@alfalab/core-components-shared';\n\nimport { Tab } from './components/tab';\nimport { type TabBarProps } from './types';\n\nimport styles from './index.module.css';\n\nconst TabBarComponent = forwardRef<HTMLDivElement, TabBarProps>(\n (\n {\n children,\n className,\n selectedId,\n border,\n dataTestId,\n tabClassNames,\n onChange,\n accentColor = 'primary',\n bgColor = 'modal-bg-primary',\n ...restProps\n },\n ref,\n ) => {\n if (Children.count(children) > 5) {\n // eslint-disable-next-line no-console\n console.error('Компонент TabBar не может содержать больше 5 табов');\n }\n\n return (\n <nav\n data-test-id={dataTestId}\n {...restProps}\n ref={ref}\n className={cn(styles.component, styles[bgColor], className, {\n [styles.border]: border,\n })}\n >\n {Children.map(children, (tab) =>\n cloneElement(tab, {\n bgColor,\n accentColor,\n selected: tab.props.id === selectedId,\n onChange,\n tabClassNames,\n dataTestId: getDataTestId(dataTestId, 'tab'),\n }),\n )}\n </nav>\n );\n },\n);\n\nTabBarComponent.displayName = 'TabBarComponent';\n\nexport const TabBar = Object.assign(TabBarComponent, { Tab });\n"],"names":[],"mappings":";;;;;;;AAUA,IAAM,eAAe,GAAG,UAAU,CAC9B,UACI,EAWC,EACD,GAAG,EAAA;;AAXC,IAAA,IAAA,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,UAAU,GAAA,EAAA,CAAA,UAAA,EACV,MAAM,YAAA,EACN,UAAU,gBAAA,EACV,aAAa,mBAAA,EACb,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,mBAAuB,EAAvB,WAAW,GAAG,EAAA,KAAA,MAAA,GAAA,SAAS,KAAA,EACvB,EAAA,GAAA,EAAA,CAAA,OAA4B,EAA5B,OAAO,mBAAG,kBAAkB,GAAA,EAAA,EACzB,SAAS,GAAA,MAAA,CAAA,EAAA,EAVhB,sHAWC,CADe;IAIhB,IAAI,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;;AAE9B,QAAA,OAAO,CAAC,KAAK,CAAC,oDAAoD,CAAC
|
|
1
|
+
{"version":3,"file":"Component.js","sources":["../src/Component.tsx"],"sourcesContent":["import React, { Children, cloneElement, forwardRef } from 'react';\nimport cn from 'classnames';\n\nimport { getDataTestId } from '@alfalab/core-components-shared';\n\nimport { Tab } from './components/tab';\nimport { type TabBarProps } from './types';\n\nimport styles from './index.module.css';\n\nconst TabBarComponent = forwardRef<HTMLDivElement, TabBarProps>(\n (\n {\n children,\n className,\n selectedId,\n border,\n dataTestId,\n tabClassNames,\n onChange,\n accentColor = 'primary',\n bgColor = 'modal-bg-primary',\n ...restProps\n },\n ref,\n ) => {\n if (Children.count(children) > 5) {\n // eslint-disable-next-line no-console\n console.error('Компонент TabBar не может содержать больше 5 табов');\n }\n\n return (\n <nav\n data-test-id={dataTestId}\n {...restProps}\n ref={ref}\n className={cn(styles.component, styles[bgColor], className, {\n [styles.border]: border,\n })}\n >\n {Children.map(children, (tab) =>\n cloneElement(tab, {\n bgColor,\n accentColor,\n selected: tab.props.id === selectedId,\n onChange,\n tabClassNames,\n dataTestId: getDataTestId(dataTestId, 'tab'),\n }),\n )}\n </nav>\n );\n },\n);\n\nTabBarComponent.displayName = 'TabBarComponent';\n\nexport const TabBar = Object.assign(TabBarComponent, { Tab });\n"],"names":[],"mappings":";;;;;;;AAUA,IAAM,eAAe,GAAG,UAAU,CAC9B,UACI,EAWC,EACD,GAAG,EAAA;;AAXC,IAAA,IAAA,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,UAAU,GAAA,EAAA,CAAA,UAAA,EACV,MAAM,YAAA,EACN,UAAU,gBAAA,EACV,aAAa,mBAAA,EACb,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,mBAAuB,EAAvB,WAAW,GAAG,EAAA,KAAA,MAAA,GAAA,SAAS,KAAA,EACvB,EAAA,GAAA,EAAA,CAAA,OAA4B,EAA5B,OAAO,mBAAG,kBAAkB,GAAA,EAAA,EACzB,SAAS,GAAA,MAAA,CAAA,EAAA,EAVhB,sHAWC,CADe;IAIhB,IAAI,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;;AAE9B,QAAA,OAAO,CAAC,KAAK,CAAC,oDAAoD,CAAC;;IAGvE,QACI,sDACkB,UAAU,EAAA,EACpB,SAAS,EACb,EAAA,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE,SAAS,GAAA,EAAA,GAAA,EAAA;AACtD,YAAA,EAAA,CAAC,MAAM,CAAC,MAAM,CAAA,GAAG,MAAM;AACzB,YAAA,EAAA,EAAA,EAAA,CAAA,EAED,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,UAAC,GAAG,EAAA;QACxB,OAAA,YAAY,CAAC,GAAG,EAAE;AACd,YAAA,OAAO,EAAA,OAAA;AACP,YAAA,WAAW,EAAA,WAAA;AACX,YAAA,QAAQ,EAAE,GAAG,CAAC,KAAK,CAAC,EAAE,KAAK,UAAU;AACrC,YAAA,QAAQ,EAAA,QAAA;AACR,YAAA,aAAa,EAAA,aAAA;AACb,YAAA,UAAU,EAAE,aAAa,CAAC,UAAU,EAAE,KAAK,CAAC;SAC/C,CAAC;KAAA,CACL,CACC;AAEd,CAAC,CACJ;AAED,eAAe,CAAC,WAAW,GAAG,iBAAiB;AAExC,IAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE,EAAE,GAAG,EAAA,GAAA,EAAE;;;;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type ForwardRefExoticComponent, type RefAttributes } from 'react';
|
|
2
2
|
import { type PublicTabProps } from '../../types';
|
|
3
|
-
export declare const Tab:
|
|
3
|
+
export declare const Tab: ForwardRefExoticComponent<PublicTabProps & RefAttributes<HTMLElement>>;
|
|
@@ -17,10 +17,14 @@ var TabComponent = forwardRef(function (_a, ref) {
|
|
|
17
17
|
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 = {},
|
|
18
18
|
_b[styles[accentColor]] = selected,
|
|
19
19
|
_b)), onClick: handleClick }),
|
|
20
|
-
React.createElement("div", { className: cn(styles.icon, commonIconClassName, iconClassName) }, isValidElement(icon)
|
|
20
|
+
React.createElement("div", { className: cn(styles.icon, commonIconClassName, iconClassName) }, isValidElement(icon)
|
|
21
|
+
? cloneElement(icon, { selected: selected })
|
|
22
|
+
: icon),
|
|
21
23
|
React.createElement(TypographyText, { weight: 'medium', view: 'secondary-small', className: cn(styles.label, commonLabelClassName, labelClassName, (_c = {},
|
|
22
24
|
_c[styles.labelSelected] = selected,
|
|
23
|
-
_c)) }, isValidElement(label)
|
|
25
|
+
_c)) }, isValidElement(label)
|
|
26
|
+
? cloneElement(label, { selected: selected })
|
|
27
|
+
: label),
|
|
24
28
|
showIndicator && (React.createElement("div", { className: styles.indicator },
|
|
25
29
|
React.createElement(Indicator, __assign({}, indicatorProps, { height: (indicatorProps === null || indicatorProps === void 0 ? void 0 : indicatorProps.value) ? 16 : undefined, border: {
|
|
26
30
|
width: 2,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.js","sources":["../../../src/components/tab/Component.tsx"],"sourcesContent":["import React, {\n cloneElement,\n forwardRef,\n type ForwardRefExoticComponent,\n isValidElement,\n type MouseEventHandler,\n type RefAttributes,\n} from 'react';\nimport cn from 'classnames';\n\nimport { Indicator } from '@alfalab/core-components-indicator';\nimport { TypographyText } from '@alfalab/core-components-typography';\n\nimport { INDICATOR_BG_COLOR, INDICATOR_BORDER_COLOR } from '../../consts';\nimport { type AllTabProps, type PublicTabProps } from '../../types';\n\nimport styles from './index.module.css';\n\nconst TabComponent = forwardRef<HTMLElement, AllTabProps>(\n (\n {\n showIndicator,\n indicatorProps,\n label,\n icon,\n id,\n selected,\n onChange,\n onClick,\n tabClassNames = {},\n dataTestId,\n className,\n labelClassName,\n selectedClassName,\n iconClassName,\n href,\n Component = href ? 'a' : 'button',\n accentColor = 'primary',\n bgColor = 'modal-bg-primary',\n ...restProps\n },\n ref,\n ) => {\n const handleClick: MouseEventHandler<HTMLElement> = (event) => {\n onChange?.(id);\n onClick?.(event);\n };\n\n const {\n className: commonClassName,\n labelClassName: commonLabelClassName,\n selectedClassName: commonSelectedClassName,\n iconClassName: commonIconClassName,\n } = tabClassNames;\n\n return (\n <Component\n data-test-id={dataTestId}\n tabIndex={0}\n {...(Component === 'button' ? { type: 'button' } : null)}\n {...restProps}\n href={href}\n id={id}\n ref={ref}\n className={cn(\n styles.component,\n commonClassName,\n className,\n selected && commonSelectedClassName,\n selected && selectedClassName,\n {\n [styles[accentColor]]: selected,\n },\n )}\n onClick={handleClick}\n >\n <div className={cn(styles.icon, commonIconClassName, iconClassName)}>\n {isValidElement(icon)
|
|
1
|
+
{"version":3,"file":"Component.js","sources":["../../../src/components/tab/Component.tsx"],"sourcesContent":["import React, {\n cloneElement,\n forwardRef,\n type ForwardRefExoticComponent,\n isValidElement,\n type MouseEventHandler,\n type RefAttributes,\n} from 'react';\nimport cn from 'classnames';\n\nimport { Indicator } from '@alfalab/core-components-indicator';\nimport { TypographyText } from '@alfalab/core-components-typography';\n\nimport { INDICATOR_BG_COLOR, INDICATOR_BORDER_COLOR } from '../../consts';\nimport { type AllTabProps, type PublicTabProps } from '../../types';\n\nimport styles from './index.module.css';\n\nconst TabComponent = forwardRef<HTMLElement, AllTabProps>(\n (\n {\n showIndicator,\n indicatorProps,\n label,\n icon,\n id,\n selected,\n onChange,\n onClick,\n tabClassNames = {},\n dataTestId,\n className,\n labelClassName,\n selectedClassName,\n iconClassName,\n href,\n Component = href ? 'a' : 'button',\n accentColor = 'primary',\n bgColor = 'modal-bg-primary',\n ...restProps\n },\n ref,\n ) => {\n const handleClick: MouseEventHandler<HTMLElement> = (event) => {\n onChange?.(id);\n onClick?.(event);\n };\n\n const {\n className: commonClassName,\n labelClassName: commonLabelClassName,\n selectedClassName: commonSelectedClassName,\n iconClassName: commonIconClassName,\n } = tabClassNames;\n\n return (\n <Component\n data-test-id={dataTestId}\n tabIndex={0}\n {...(Component === 'button' ? { type: 'button' } : null)}\n {...restProps}\n href={href}\n id={id}\n ref={ref}\n className={cn(\n styles.component,\n commonClassName,\n className,\n selected && commonSelectedClassName,\n selected && selectedClassName,\n {\n [styles[accentColor]]: selected,\n },\n )}\n onClick={handleClick}\n >\n <div className={cn(styles.icon, commonIconClassName, iconClassName)}>\n {isValidElement<{ selected: unknown }>(icon)\n ? cloneElement(icon, { selected })\n : icon}\n </div>\n\n <TypographyText\n weight='medium'\n view='secondary-small'\n className={cn(styles.label, commonLabelClassName, labelClassName, {\n [styles.labelSelected]: selected,\n })}\n >\n {isValidElement<{ selected: unknown }>(label)\n ? cloneElement(label, { selected })\n : label}\n </TypographyText>\n\n {showIndicator && (\n <div className={styles.indicator}>\n <Indicator\n {...indicatorProps}\n height={indicatorProps?.value ? 16 : undefined}\n border={{\n width: 2,\n color: INDICATOR_BORDER_COLOR[bgColor],\n }}\n backgroundColor={INDICATOR_BG_COLOR[accentColor]}\n />\n </div>\n )}\n </Component>\n );\n },\n);\n\nexport const Tab = TabComponent as ForwardRefExoticComponent<\n PublicTabProps & RefAttributes<HTMLElement>\n>;\n"],"names":[],"mappings":";;;;;;;;AAkBA,IAAM,YAAY,GAAG,UAAU,CAC3B,UACI,EAoBC,EACD,GAAG,EAAA;;AApBC,IAAA,IAAA,aAAa,GAAA,EAAA,CAAA,aAAA,EACb,cAAc,GAAA,EAAA,CAAA,cAAA,EACd,KAAK,GAAA,EAAA,CAAA,KAAA,EACL,IAAI,UAAA,EACJ,EAAE,QAAA,EACF,QAAQ,cAAA,EACR,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,OAAO,GAAA,EAAA,CAAA,OAAA,EACP,EAAkB,GAAA,EAAA,CAAA,aAAA,EAAlB,aAAa,GAAG,EAAA,KAAA,MAAA,GAAA,EAAE,GAAA,EAAA,EAClB,UAAU,GAAA,EAAA,CAAA,UAAA,EACV,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,cAAc,GAAA,EAAA,CAAA,cAAA,EACd,iBAAiB,GAAA,EAAA,CAAA,iBAAA,E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14,7 @@
|
|
|
14
14
|
--gap-4: var(--gap-2xs);
|
|
15
15
|
--gap-8: var(--gap-xs);
|
|
16
16
|
}
|
|
17
|
-
.tab-
|
|
17
|
+
.tab-bar__component_1gp7j {
|
|
18
18
|
-webkit-tap-highlight-color: transparent;
|
|
19
19
|
box-sizing: border-box;
|
|
20
20
|
background-color: transparent;
|
|
@@ -42,20 +42,20 @@
|
|
|
42
42
|
padding: var(--gap-8) var(--gap-0);
|
|
43
43
|
color: var(--color-light-neutral-translucent-700);
|
|
44
44
|
}
|
|
45
|
-
.tab-
|
|
45
|
+
.tab-bar__primary_1gp7j {
|
|
46
46
|
color: var(--color-light-accent-primary);
|
|
47
47
|
}
|
|
48
|
-
.tab-
|
|
48
|
+
.tab-bar__secondary_1gp7j {
|
|
49
49
|
color: var(--color-light-accent-secondary);
|
|
50
50
|
}
|
|
51
|
-
.tab-
|
|
51
|
+
.tab-bar__icon_1gp7j {
|
|
52
52
|
display: flex;
|
|
53
53
|
align-items: center;
|
|
54
54
|
justify-content: center;
|
|
55
55
|
flex-grow: 1;
|
|
56
56
|
width: 100%;
|
|
57
57
|
}
|
|
58
|
-
.tab-
|
|
58
|
+
.tab-bar__label_1gp7j {
|
|
59
59
|
-webkit-line-clamp: 1;
|
|
60
60
|
display: -webkit-box;
|
|
61
61
|
-webkit-box-orient: vertical;
|
|
@@ -65,10 +65,10 @@
|
|
|
65
65
|
|
|
66
66
|
color: var(--color-light-text-secondary);
|
|
67
67
|
}
|
|
68
|
-
.tab-
|
|
68
|
+
.tab-bar__labelSelected_1gp7j {
|
|
69
69
|
color: inherit;
|
|
70
70
|
}
|
|
71
|
-
.tab-
|
|
71
|
+
.tab-bar__indicator_1gp7j {
|
|
72
72
|
position: absolute;
|
|
73
73
|
top: 3px;
|
|
74
74
|
left: calc(50% + var(--gap-4));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
|
|
3
|
-
var styles = {"component":"tab-
|
|
3
|
+
var styles = {"component":"tab-bar__component_1gp7j","primary":"tab-bar__primary_1gp7j","secondary":"tab-bar__secondary_1gp7j","icon":"tab-bar__icon_1gp7j","label":"tab-bar__label_1gp7j","labelSelected":"tab-bar__labelSelected_1gp7j","indicator":"tab-bar__indicator_1gp7j"};
|
|
4
4
|
|
|
5
5
|
export { styles as default };
|
|
6
6
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.module.css.js","sources":["../../src/components/tab/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/
|
|
1
|
+
{"version":3,"file":"index.module.css.js","sources":["../../src/components/tab/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n\n.component {\n @mixin button-reset;\n\n position: relative;\n display: inline-flex;\n flex-direction: column;\n flex: 1 0 0;\n align-items: center;\n padding: var(--gap-8) var(--gap-0);\n color: var(--color-light-neutral-translucent-700);\n}\n\n.primary {\n color: var(--color-light-accent-primary);\n}\n\n.secondary {\n color: var(--color-light-accent-secondary);\n}\n\n.icon {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-grow: 1;\n width: 100%;\n}\n\n.label {\n @mixin row_limit 1;\n word-break: break-all;\n flex-shrink: 0;\n\n color: var(--color-light-text-secondary);\n}\n\n.labelSelected {\n color: inherit;\n}\n\n.indicator {\n position: absolute;\n top: 3px;\n left: calc(50% + var(--gap-4));\n height: 16px;\n min-width: 16px;\n}\n"],"names":[],"mappings":";;AAEgB,aAAe,CAAC,WAAW,CAAC,0BAA0B,CAAC,SAAS,CAAC,wBAAwB,CAAC,WAAW,CAAC,0BAA0B,CAAC,MAAM,CAAC,qBAAqB,CAAC,OAAO,CAAC,sBAAsB,CAAC,eAAe,CAAC,8BAA8B,CAAC,WAAW,CAAC,0BAA0B,CAAC;;;;"}
|
package/esm/index.css
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
:root {
|
|
10
10
|
--sab: env(safe-area-inset-bottom, var(--gap-0));
|
|
11
11
|
}
|
|
12
|
-
.tab-
|
|
12
|
+
.tab-bar__component_1ks6h {
|
|
13
13
|
display: flex;
|
|
14
14
|
justify-content: center;
|
|
15
15
|
height: 64px;
|
|
@@ -18,17 +18,17 @@
|
|
|
18
18
|
overflow: hidden;
|
|
19
19
|
transition: box-shadow 0.2s ease;
|
|
20
20
|
}
|
|
21
|
-
.tab-
|
|
21
|
+
.tab-bar__component_1ks6h.tab-bar__modal-bg-primary_1ks6h {
|
|
22
22
|
background-color: var(--color-light-base-bg-primary);
|
|
23
23
|
}
|
|
24
|
-
.tab-
|
|
24
|
+
.tab-bar__component_1ks6h.tab-bar__modal-bg-alt-primary_1ks6h {
|
|
25
25
|
background-color: var(--color-light-base-bg-alt-primary);
|
|
26
26
|
}
|
|
27
27
|
@media (display-mode: standalone) {
|
|
28
|
-
.tab-
|
|
28
|
+
.tab-bar__component_1ks6h {
|
|
29
29
|
padding-bottom: var(--sab);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
.tab-
|
|
32
|
+
.tab-bar__border_1ks6h {
|
|
33
33
|
box-shadow: 0 -1px 0 0 var(--color-light-neutral-translucent-300);
|
|
34
34
|
}
|
package/esm/index.module.css.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
|
|
3
|
-
var styles = {"component":"tab-
|
|
3
|
+
var styles = {"component":"tab-bar__component_1ks6h","modal-bg-primary":"tab-bar__modal-bg-primary_1ks6h","modal-bg-alt-primary":"tab-bar__modal-bg-alt-primary_1ks6h","border":"tab-bar__border_1ks6h"};
|
|
4
4
|
|
|
5
5
|
export { styles as default };
|
|
6
6
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.module.css.js","sources":["src/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/
|
|
1
|
+
{"version":3,"file":"index.module.css.js","sources":["src/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n@import '@alfalab/core-components-vars/src/safe-area.css';\n\n.component {\n display: flex;\n justify-content: center;\n height: 64px;\n max-height: 64px;\n box-sizing: border-box;\n overflow: hidden;\n transition: box-shadow 0.2s ease;\n\n &.modal-bg-primary {\n background-color: var(--color-light-base-bg-primary);\n }\n\n &.modal-bg-alt-primary {\n background-color: var(--color-light-base-bg-alt-primary);\n }\n\n @media (display-mode: standalone) {\n padding-bottom: var(--sab);\n }\n}\n\n.border {\n box-shadow: 0 -1px 0 0 var(--color-light-neutral-translucent-300);\n}\n"],"names":[],"mappings":";;AAEgB,aAAe,CAAC,WAAW,CAAC,0BAA0B,CAAC,kBAAkB,CAAC,iCAAiC,CAAC,sBAAsB,CAAC,qCAAqC,CAAC,QAAQ,CAAC,uBAAuB,CAAC;;;;"}
|
package/esm/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type AllHTMLAttributes, type ElementType, type ForwardRefExoticComponent, type HTMLAttributes, type ReactElement, type ReactNode, type RefAttributes } from 'react';
|
|
2
2
|
import { type IndicatorProps } from '@alfalab/core-components-indicator/esm';
|
|
3
|
-
export
|
|
4
|
-
|
|
3
|
+
export type AllTabProps = PublicTabProps & PrivateTabProps;
|
|
4
|
+
type TabElementType = ReactElement<AllTabProps, ForwardRefExoticComponent<AllTabProps & RefAttributes<HTMLElement>>>;
|
|
5
5
|
export interface TabBarProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
6
6
|
/**
|
|
7
7
|
* Дополнительный класс
|
package/index.css
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
:root {
|
|
10
10
|
--sab: env(safe-area-inset-bottom, var(--gap-0));
|
|
11
11
|
}
|
|
12
|
-
.tab-
|
|
12
|
+
.tab-bar__component_1ks6h {
|
|
13
13
|
display: flex;
|
|
14
14
|
justify-content: center;
|
|
15
15
|
height: 64px;
|
|
@@ -18,17 +18,17 @@
|
|
|
18
18
|
overflow: hidden;
|
|
19
19
|
transition: box-shadow 0.2s ease;
|
|
20
20
|
}
|
|
21
|
-
.tab-
|
|
21
|
+
.tab-bar__component_1ks6h.tab-bar__modal-bg-primary_1ks6h {
|
|
22
22
|
background-color: var(--color-light-base-bg-primary);
|
|
23
23
|
}
|
|
24
|
-
.tab-
|
|
24
|
+
.tab-bar__component_1ks6h.tab-bar__modal-bg-alt-primary_1ks6h {
|
|
25
25
|
background-color: var(--color-light-base-bg-alt-primary);
|
|
26
26
|
}
|
|
27
27
|
@media (display-mode: standalone) {
|
|
28
|
-
.tab-
|
|
28
|
+
.tab-bar__component_1ks6h {
|
|
29
29
|
padding-bottom: var(--sab);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
.tab-
|
|
32
|
+
.tab-bar__border_1ks6h {
|
|
33
33
|
box-shadow: 0 -1px 0 0 var(--color-light-neutral-translucent-300);
|
|
34
34
|
}
|
package/index.module.css.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require('./index.css');
|
|
4
4
|
|
|
5
|
-
var styles = {"component":"tab-
|
|
5
|
+
var styles = {"component":"tab-bar__component_1ks6h","modal-bg-primary":"tab-bar__modal-bg-primary_1ks6h","modal-bg-alt-primary":"tab-bar__modal-bg-alt-primary_1ks6h","border":"tab-bar__border_1ks6h"};
|
|
6
6
|
|
|
7
7
|
module.exports = styles;
|
|
8
8
|
//# sourceMappingURL=index.module.css.js.map
|
package/index.module.css.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.module.css.js","sources":["src/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/
|
|
1
|
+
{"version":3,"file":"index.module.css.js","sources":["src/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n@import '@alfalab/core-components-vars/src/safe-area.css';\n\n.component {\n display: flex;\n justify-content: center;\n height: 64px;\n max-height: 64px;\n box-sizing: border-box;\n overflow: hidden;\n transition: box-shadow 0.2s ease;\n\n &.modal-bg-primary {\n background-color: var(--color-light-base-bg-primary);\n }\n\n &.modal-bg-alt-primary {\n background-color: var(--color-light-base-bg-alt-primary);\n }\n\n @media (display-mode: standalone) {\n padding-bottom: var(--sab);\n }\n}\n\n.border {\n box-shadow: 0 -1px 0 0 var(--color-light-neutral-translucent-300);\n}\n"],"names":[],"mappings":";;;;AAEgB,aAAe,CAAC,WAAW,CAAC,0BAA0B,CAAC,kBAAkB,CAAC,iCAAiC,CAAC,sBAAsB,CAAC,qCAAqC,CAAC,QAAQ,CAAC,uBAAuB,CAAC;;;;"}
|
package/modern/Component.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.js","sources":["../src/Component.tsx"],"sourcesContent":["import React, { Children, cloneElement, forwardRef } from 'react';\nimport cn from 'classnames';\n\nimport { getDataTestId } from '@alfalab/core-components-shared';\n\nimport { Tab } from './components/tab';\nimport { type TabBarProps } from './types';\n\nimport styles from './index.module.css';\n\nconst TabBarComponent = forwardRef<HTMLDivElement, TabBarProps>(\n (\n {\n children,\n className,\n selectedId,\n border,\n dataTestId,\n tabClassNames,\n onChange,\n accentColor = 'primary',\n bgColor = 'modal-bg-primary',\n ...restProps\n },\n ref,\n ) => {\n if (Children.count(children) > 5) {\n // eslint-disable-next-line no-console\n console.error('Компонент TabBar не может содержать больше 5 табов');\n }\n\n return (\n <nav\n data-test-id={dataTestId}\n {...restProps}\n ref={ref}\n className={cn(styles.component, styles[bgColor], className, {\n [styles.border]: border,\n })}\n >\n {Children.map(children, (tab) =>\n cloneElement(tab, {\n bgColor,\n accentColor,\n selected: tab.props.id === selectedId,\n onChange,\n tabClassNames,\n dataTestId: getDataTestId(dataTestId, 'tab'),\n }),\n )}\n </nav>\n );\n },\n);\n\nTabBarComponent.displayName = 'TabBarComponent';\n\nexport const TabBar = Object.assign(TabBarComponent, { Tab });\n"],"names":[],"mappings":";;;;;;AAUA,MAAM,eAAe,GAAG,UAAU,CAC9B,CACI,EACI,QAAQ,EACR,SAAS,EACT,UAAU,EACV,MAAM,EACN,UAAU,EACV,aAAa,EACb,QAAQ,EACR,WAAW,GAAG,SAAS,EACvB,OAAO,GAAG,kBAAkB,EAC5B,GAAG,SAAS,EACf,EACD,GAAG,KACH;IACA,IAAI,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;;AAE9B,QAAA,OAAO,CAAC,KAAK,CAAC,oDAAoD,CAAC
|
|
1
|
+
{"version":3,"file":"Component.js","sources":["../src/Component.tsx"],"sourcesContent":["import React, { Children, cloneElement, forwardRef } from 'react';\nimport cn from 'classnames';\n\nimport { getDataTestId } from '@alfalab/core-components-shared';\n\nimport { Tab } from './components/tab';\nimport { type TabBarProps } from './types';\n\nimport styles from './index.module.css';\n\nconst TabBarComponent = forwardRef<HTMLDivElement, TabBarProps>(\n (\n {\n children,\n className,\n selectedId,\n border,\n dataTestId,\n tabClassNames,\n onChange,\n accentColor = 'primary',\n bgColor = 'modal-bg-primary',\n ...restProps\n },\n ref,\n ) => {\n if (Children.count(children) > 5) {\n // eslint-disable-next-line no-console\n console.error('Компонент TabBar не может содержать больше 5 табов');\n }\n\n return (\n <nav\n data-test-id={dataTestId}\n {...restProps}\n ref={ref}\n className={cn(styles.component, styles[bgColor], className, {\n [styles.border]: border,\n })}\n >\n {Children.map(children, (tab) =>\n cloneElement(tab, {\n bgColor,\n accentColor,\n selected: tab.props.id === selectedId,\n onChange,\n tabClassNames,\n dataTestId: getDataTestId(dataTestId, 'tab'),\n }),\n )}\n </nav>\n );\n },\n);\n\nTabBarComponent.displayName = 'TabBarComponent';\n\nexport const TabBar = Object.assign(TabBarComponent, { Tab });\n"],"names":[],"mappings":";;;;;;AAUA,MAAM,eAAe,GAAG,UAAU,CAC9B,CACI,EACI,QAAQ,EACR,SAAS,EACT,UAAU,EACV,MAAM,EACN,UAAU,EACV,aAAa,EACb,QAAQ,EACR,WAAW,GAAG,SAAS,EACvB,OAAO,GAAG,kBAAkB,EAC5B,GAAG,SAAS,EACf,EACD,GAAG,KACH;IACA,IAAI,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;;AAE9B,QAAA,OAAO,CAAC,KAAK,CAAC,oDAAoD,CAAC;;IAGvE,QACI,KACkB,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,cAAA,EAAA,UAAU,EACpB,GAAA,SAAS,EACb,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE;AACxD,YAAA,CAAC,MAAM,CAAC,MAAM,GAAG,MAAM;AAC1B,SAAA,CAAC,EAED,EAAA,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,GAAG,KACxB,YAAY,CAAC,GAAG,EAAE;QACd,OAAO;QACP,WAAW;AACX,QAAA,QAAQ,EAAE,GAAG,CAAC,KAAK,CAAC,EAAE,KAAK,UAAU;QACrC,QAAQ;QACR,aAAa;AACb,QAAA,UAAU,EAAE,aAAa,CAAC,UAAU,EAAE,KAAK,CAAC;KAC/C,CAAC,CACL,CACC;AAEd,CAAC,CACJ;AAED,eAAe,CAAC,WAAW,GAAG,iBAAiB;AAExC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE,EAAE,GAAG,EAAE;;;;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type ForwardRefExoticComponent, type RefAttributes } from 'react';
|
|
2
2
|
import { type PublicTabProps } from '../../types';
|
|
3
|
-
export declare const Tab:
|
|
3
|
+
export declare const Tab: ForwardRefExoticComponent<PublicTabProps & RefAttributes<HTMLElement>>;
|
|
@@ -14,10 +14,14 @@ const TabComponent = forwardRef(({ showIndicator, indicatorProps, label, icon, i
|
|
|
14
14
|
return (React.createElement(Component, { "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, {
|
|
15
15
|
[styles[accentColor]]: selected,
|
|
16
16
|
}), onClick: handleClick },
|
|
17
|
-
React.createElement("div", { className: cn(styles.icon, commonIconClassName, iconClassName) }, isValidElement(icon)
|
|
17
|
+
React.createElement("div", { className: cn(styles.icon, commonIconClassName, iconClassName) }, isValidElement(icon)
|
|
18
|
+
? cloneElement(icon, { selected })
|
|
19
|
+
: icon),
|
|
18
20
|
React.createElement(TypographyText, { weight: 'medium', view: 'secondary-small', className: cn(styles.label, commonLabelClassName, labelClassName, {
|
|
19
21
|
[styles.labelSelected]: selected,
|
|
20
|
-
}) }, isValidElement(label)
|
|
22
|
+
}) }, isValidElement(label)
|
|
23
|
+
? cloneElement(label, { selected })
|
|
24
|
+
: label),
|
|
21
25
|
showIndicator && (React.createElement("div", { className: styles.indicator },
|
|
22
26
|
React.createElement(Indicator, { ...indicatorProps, height: indicatorProps?.value ? 16 : undefined, border: {
|
|
23
27
|
width: 2,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.js","sources":["../../../src/components/tab/Component.tsx"],"sourcesContent":["import React, {\n cloneElement,\n forwardRef,\n type ForwardRefExoticComponent,\n isValidElement,\n type MouseEventHandler,\n type RefAttributes,\n} from 'react';\nimport cn from 'classnames';\n\nimport { Indicator } from '@alfalab/core-components-indicator';\nimport { TypographyText } from '@alfalab/core-components-typography';\n\nimport { INDICATOR_BG_COLOR, INDICATOR_BORDER_COLOR } from '../../consts';\nimport { type AllTabProps, type PublicTabProps } from '../../types';\n\nimport styles from './index.module.css';\n\nconst TabComponent = forwardRef<HTMLElement, AllTabProps>(\n (\n {\n showIndicator,\n indicatorProps,\n label,\n icon,\n id,\n selected,\n onChange,\n onClick,\n tabClassNames = {},\n dataTestId,\n className,\n labelClassName,\n selectedClassName,\n iconClassName,\n href,\n Component = href ? 'a' : 'button',\n accentColor = 'primary',\n bgColor = 'modal-bg-primary',\n ...restProps\n },\n ref,\n ) => {\n const handleClick: MouseEventHandler<HTMLElement> = (event) => {\n onChange?.(id);\n onClick?.(event);\n };\n\n const {\n className: commonClassName,\n labelClassName: commonLabelClassName,\n selectedClassName: commonSelectedClassName,\n iconClassName: commonIconClassName,\n } = tabClassNames;\n\n return (\n <Component\n data-test-id={dataTestId}\n tabIndex={0}\n {...(Component === 'button' ? { type: 'button' } : null)}\n {...restProps}\n href={href}\n id={id}\n ref={ref}\n className={cn(\n styles.component,\n commonClassName,\n className,\n selected && commonSelectedClassName,\n selected && selectedClassName,\n {\n [styles[accentColor]]: selected,\n },\n )}\n onClick={handleClick}\n >\n <div className={cn(styles.icon, commonIconClassName, iconClassName)}>\n {isValidElement(icon)
|
|
1
|
+
{"version":3,"file":"Component.js","sources":["../../../src/components/tab/Component.tsx"],"sourcesContent":["import React, {\n cloneElement,\n forwardRef,\n type ForwardRefExoticComponent,\n isValidElement,\n type MouseEventHandler,\n type RefAttributes,\n} from 'react';\nimport cn from 'classnames';\n\nimport { Indicator } from '@alfalab/core-components-indicator';\nimport { TypographyText } from '@alfalab/core-components-typography';\n\nimport { INDICATOR_BG_COLOR, INDICATOR_BORDER_COLOR } from '../../consts';\nimport { type AllTabProps, type PublicTabProps } from '../../types';\n\nimport styles from './index.module.css';\n\nconst TabComponent = forwardRef<HTMLElement, AllTabProps>(\n (\n {\n showIndicator,\n indicatorProps,\n label,\n icon,\n id,\n selected,\n onChange,\n onClick,\n tabClassNames = {},\n dataTestId,\n className,\n labelClassName,\n selectedClassName,\n iconClassName,\n href,\n Component = href ? 'a' : 'button',\n accentColor = 'primary',\n bgColor = 'modal-bg-primary',\n ...restProps\n },\n ref,\n ) => {\n const handleClick: MouseEventHandler<HTMLElement> = (event) => {\n onChange?.(id);\n onClick?.(event);\n };\n\n const {\n className: commonClassName,\n labelClassName: commonLabelClassName,\n selectedClassName: commonSelectedClassName,\n iconClassName: commonIconClassName,\n } = tabClassNames;\n\n return (\n <Component\n data-test-id={dataTestId}\n tabIndex={0}\n {...(Component === 'button' ? { type: 'button' } : null)}\n {...restProps}\n href={href}\n id={id}\n ref={ref}\n className={cn(\n styles.component,\n commonClassName,\n className,\n selected && commonSelectedClassName,\n selected && selectedClassName,\n {\n [styles[accentColor]]: selected,\n },\n )}\n onClick={handleClick}\n >\n <div className={cn(styles.icon, commonIconClassName, iconClassName)}>\n {isValidElement<{ selected: unknown }>(icon)\n ? cloneElement(icon, { selected })\n : icon}\n </div>\n\n <TypographyText\n weight='medium'\n view='secondary-small'\n className={cn(styles.label, commonLabelClassName, labelClassName, {\n [styles.labelSelected]: selected,\n })}\n >\n {isValidElement<{ selected: unknown }>(label)\n ? cloneElement(label, { selected })\n : label}\n </TypographyText>\n\n {showIndicator && (\n <div className={styles.indicator}>\n <Indicator\n {...indicatorProps}\n height={indicatorProps?.value ? 16 : undefined}\n border={{\n width: 2,\n color: INDICATOR_BORDER_COLOR[bgColor],\n }}\n backgroundColor={INDICATOR_BG_COLOR[accentColor]}\n />\n </div>\n )}\n </Component>\n );\n },\n);\n\nexport const Tab = TabComponent as ForwardRefExoticComponent<\n PublicTabProps & RefAttributes<HTMLElement>\n>;\n"],"names":[],"mappings":";;;;;;;AAkBA,MAAM,YAAY,GAAG,UAAU,CAC3B,CACI,EACI,aAAa,EACb,cAAc,EACd,KAAK,EACL,IAAI,EACJ,EAAE,EACF,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,aAAa,GAAG,EAAE,EAClB,UAAU,EACV,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,IAAI,EACJ,SAAS,GAAG,IAAI,GAAG,GAAG,GAAG,QAAQ,EACjC,WAAW,GAAG,SAAS,EACvB,OAAO,GAAG,kBAAkB,EAC5B,GAAG,SAAS,EACf,EACD,GAAG,KACH;AACA,IAAA,MAAM,WAAW,GAAmC,CAAC,KAAK,KAAI;AAC1D,QAAA,QAAQ,GAAG,EAAE,CAAC;AACd,QAAA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AAK,CACE;AAEhB,QAAA,aAAa,KACV,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,MAAM,CAAC,SAAS,EAAA;AAC5B,YAAA,KAAA,CAAA,aAAA,CAAC,SAAS,EACF,EAAA,GAAA,cAAc,EAClB,MAAM,EAAE,cAAc,EAAE,KAAK,GAAG,EAAE,GAAG,SAAS,EAC9C,MAAM,EAAE;AACJ,oBAAA,KAAK,EAAE,CAAC;AACR,oBAAA,KAAK,EAAE,sBAAsB,CAAC,OAAO,CAAC;iBACzC,EACD,eAAe,EAAE,kBAAkB,CAAC,WAAW,CAAC,EAAA,CAClD,CACA,CACT,CACO;AAEpB,CAAC,CACJ;AAEM,MAAM,GAAG,GAAG;;;;"}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
--gap-4: var(--gap-2xs);
|
|
15
15
|
--gap-8: var(--gap-xs);
|
|
16
16
|
}
|
|
17
|
-
.tab-
|
|
17
|
+
.tab-bar__component_1gp7j {
|
|
18
18
|
-webkit-tap-highlight-color: transparent;
|
|
19
19
|
box-sizing: border-box;
|
|
20
20
|
background-color: transparent;
|
|
@@ -42,20 +42,20 @@
|
|
|
42
42
|
padding: var(--gap-8) var(--gap-0);
|
|
43
43
|
color: var(--color-light-neutral-translucent-700);
|
|
44
44
|
}
|
|
45
|
-
.tab-
|
|
45
|
+
.tab-bar__primary_1gp7j {
|
|
46
46
|
color: var(--color-light-accent-primary);
|
|
47
47
|
}
|
|
48
|
-
.tab-
|
|
48
|
+
.tab-bar__secondary_1gp7j {
|
|
49
49
|
color: var(--color-light-accent-secondary);
|
|
50
50
|
}
|
|
51
|
-
.tab-
|
|
51
|
+
.tab-bar__icon_1gp7j {
|
|
52
52
|
display: flex;
|
|
53
53
|
align-items: center;
|
|
54
54
|
justify-content: center;
|
|
55
55
|
flex-grow: 1;
|
|
56
56
|
width: 100%;
|
|
57
57
|
}
|
|
58
|
-
.tab-
|
|
58
|
+
.tab-bar__label_1gp7j {
|
|
59
59
|
-webkit-line-clamp: 1;
|
|
60
60
|
display: -webkit-box;
|
|
61
61
|
-webkit-box-orient: vertical;
|
|
@@ -65,10 +65,10 @@
|
|
|
65
65
|
|
|
66
66
|
color: var(--color-light-text-secondary);
|
|
67
67
|
}
|
|
68
|
-
.tab-
|
|
68
|
+
.tab-bar__labelSelected_1gp7j {
|
|
69
69
|
color: inherit;
|
|
70
70
|
}
|
|
71
|
-
.tab-
|
|
71
|
+
.tab-bar__indicator_1gp7j {
|
|
72
72
|
position: absolute;
|
|
73
73
|
top: 3px;
|
|
74
74
|
left: calc(50% + var(--gap-4));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
|
|
3
|
-
const styles = {"component":"tab-
|
|
3
|
+
const styles = {"component":"tab-bar__component_1gp7j","primary":"tab-bar__primary_1gp7j","secondary":"tab-bar__secondary_1gp7j","icon":"tab-bar__icon_1gp7j","label":"tab-bar__label_1gp7j","labelSelected":"tab-bar__labelSelected_1gp7j","indicator":"tab-bar__indicator_1gp7j"};
|
|
4
4
|
|
|
5
5
|
export { styles as default };
|
|
6
6
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.module.css.js","sources":["../../src/components/tab/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/
|
|
1
|
+
{"version":3,"file":"index.module.css.js","sources":["../../src/components/tab/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n\n.component {\n @mixin button-reset;\n\n position: relative;\n display: inline-flex;\n flex-direction: column;\n flex: 1 0 0;\n align-items: center;\n padding: var(--gap-8) var(--gap-0);\n color: var(--color-light-neutral-translucent-700);\n}\n\n.primary {\n color: var(--color-light-accent-primary);\n}\n\n.secondary {\n color: var(--color-light-accent-secondary);\n}\n\n.icon {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-grow: 1;\n width: 100%;\n}\n\n.label {\n @mixin row_limit 1;\n word-break: break-all;\n flex-shrink: 0;\n\n color: var(--color-light-text-secondary);\n}\n\n.labelSelected {\n color: inherit;\n}\n\n.indicator {\n position: absolute;\n top: 3px;\n left: calc(50% + var(--gap-4));\n height: 16px;\n min-width: 16px;\n}\n"],"names":[],"mappings":";;AAEgB,eAAe,CAAC,WAAW,CAAC,0BAA0B,CAAC,SAAS,CAAC,wBAAwB,CAAC,WAAW,CAAC,0BAA0B,CAAC,MAAM,CAAC,qBAAqB,CAAC,OAAO,CAAC,sBAAsB,CAAC,eAAe,CAAC,8BAA8B,CAAC,WAAW,CAAC,0BAA0B,CAAC;;;;"}
|
package/modern/index.css
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
:root {
|
|
10
10
|
--sab: env(safe-area-inset-bottom, var(--gap-0));
|
|
11
11
|
}
|
|
12
|
-
.tab-
|
|
12
|
+
.tab-bar__component_1ks6h {
|
|
13
13
|
display: flex;
|
|
14
14
|
justify-content: center;
|
|
15
15
|
height: 64px;
|
|
@@ -18,17 +18,17 @@
|
|
|
18
18
|
overflow: hidden;
|
|
19
19
|
transition: box-shadow 0.2s ease;
|
|
20
20
|
}
|
|
21
|
-
.tab-
|
|
21
|
+
.tab-bar__component_1ks6h.tab-bar__modal-bg-primary_1ks6h {
|
|
22
22
|
background-color: var(--color-light-base-bg-primary);
|
|
23
23
|
}
|
|
24
|
-
.tab-
|
|
24
|
+
.tab-bar__component_1ks6h.tab-bar__modal-bg-alt-primary_1ks6h {
|
|
25
25
|
background-color: var(--color-light-base-bg-alt-primary);
|
|
26
26
|
}
|
|
27
27
|
@media (display-mode: standalone) {
|
|
28
|
-
.tab-
|
|
28
|
+
.tab-bar__component_1ks6h {
|
|
29
29
|
padding-bottom: var(--sab);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
.tab-
|
|
32
|
+
.tab-bar__border_1ks6h {
|
|
33
33
|
box-shadow: 0 -1px 0 0 var(--color-light-neutral-translucent-300);
|
|
34
34
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
|
|
3
|
-
const styles = {"component":"tab-
|
|
3
|
+
const styles = {"component":"tab-bar__component_1ks6h","modal-bg-primary":"tab-bar__modal-bg-primary_1ks6h","modal-bg-alt-primary":"tab-bar__modal-bg-alt-primary_1ks6h","border":"tab-bar__border_1ks6h"};
|
|
4
4
|
|
|
5
5
|
export { styles as default };
|
|
6
6
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.module.css.js","sources":["src/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/
|
|
1
|
+
{"version":3,"file":"index.module.css.js","sources":["src/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n@import '@alfalab/core-components-vars/src/safe-area.css';\n\n.component {\n display: flex;\n justify-content: center;\n height: 64px;\n max-height: 64px;\n box-sizing: border-box;\n overflow: hidden;\n transition: box-shadow 0.2s ease;\n\n &.modal-bg-primary {\n background-color: var(--color-light-base-bg-primary);\n }\n\n &.modal-bg-alt-primary {\n background-color: var(--color-light-base-bg-alt-primary);\n }\n\n @media (display-mode: standalone) {\n padding-bottom: var(--sab);\n }\n}\n\n.border {\n box-shadow: 0 -1px 0 0 var(--color-light-neutral-translucent-300);\n}\n"],"names":[],"mappings":";;AAEgB,eAAe,CAAC,WAAW,CAAC,0BAA0B,CAAC,kBAAkB,CAAC,iCAAiC,CAAC,sBAAsB,CAAC,qCAAqC,CAAC,QAAQ,CAAC,uBAAuB,CAAC;;;;"}
|
package/modern/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type AllHTMLAttributes, type ElementType, type ForwardRefExoticComponent, type HTMLAttributes, type ReactElement, type ReactNode, type RefAttributes } from 'react';
|
|
2
2
|
import { type IndicatorProps } from '@alfalab/core-components-indicator/modern';
|
|
3
|
-
export
|
|
4
|
-
|
|
3
|
+
export type AllTabProps = PublicTabProps & PrivateTabProps;
|
|
4
|
+
type TabElementType = ReactElement<AllTabProps, ForwardRefExoticComponent<AllTabProps & RefAttributes<HTMLElement>>>;
|
|
5
5
|
export interface TabBarProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
6
6
|
/**
|
|
7
7
|
* Дополнительный класс
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.js","sources":["../src/Component.tsx"],"sourcesContent":["import React, { Children, cloneElement, forwardRef } from 'react';\nimport cn from 'classnames';\n\nimport { getDataTestId } from '@alfalab/core-components-shared';\n\nimport { Tab } from './components/tab';\nimport { type TabBarProps } from './types';\n\nimport styles from './index.module.css';\n\nconst TabBarComponent = forwardRef<HTMLDivElement, TabBarProps>(\n (\n {\n children,\n className,\n selectedId,\n border,\n dataTestId,\n tabClassNames,\n onChange,\n accentColor = 'primary',\n bgColor = 'modal-bg-primary',\n ...restProps\n },\n ref,\n ) => {\n if (Children.count(children) > 5) {\n // eslint-disable-next-line no-console\n console.error('Компонент TabBar не может содержать больше 5 табов');\n }\n\n return (\n <nav\n data-test-id={dataTestId}\n {...restProps}\n ref={ref}\n className={cn(styles.component, styles[bgColor], className, {\n [styles.border]: border,\n })}\n >\n {Children.map(children, (tab) =>\n cloneElement(tab, {\n bgColor,\n accentColor,\n selected: tab.props.id === selectedId,\n onChange,\n tabClassNames,\n dataTestId: getDataTestId(dataTestId, 'tab'),\n }),\n )}\n </nav>\n );\n },\n);\n\nTabBarComponent.displayName = 'TabBarComponent';\n\nexport const TabBar = Object.assign(TabBarComponent, { Tab });\n"],"names":[],"mappings":";;;;;;AAUA,MAAM,eAAe,GAAG,UAAU,CAC9B,CACI,EACI,QAAQ,EACR,SAAS,EACT,UAAU,EACV,MAAM,EACN,UAAU,EACV,aAAa,EACb,QAAQ,EACR,WAAW,GAAG,SAAS,EACvB,OAAO,GAAG,kBAAkB,EAC5B,GAAG,SAAS,EACf,EACD,GAAG,KACH;IACA,IAAI,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;;AAE9B,QAAA,OAAO,CAAC,KAAK,CAAC,oDAAoD,CAAC
|
|
1
|
+
{"version":3,"file":"Component.js","sources":["../src/Component.tsx"],"sourcesContent":["import React, { Children, cloneElement, forwardRef } from 'react';\nimport cn from 'classnames';\n\nimport { getDataTestId } from '@alfalab/core-components-shared';\n\nimport { Tab } from './components/tab';\nimport { type TabBarProps } from './types';\n\nimport styles from './index.module.css';\n\nconst TabBarComponent = forwardRef<HTMLDivElement, TabBarProps>(\n (\n {\n children,\n className,\n selectedId,\n border,\n dataTestId,\n tabClassNames,\n onChange,\n accentColor = 'primary',\n bgColor = 'modal-bg-primary',\n ...restProps\n },\n ref,\n ) => {\n if (Children.count(children) > 5) {\n // eslint-disable-next-line no-console\n console.error('Компонент TabBar не может содержать больше 5 табов');\n }\n\n return (\n <nav\n data-test-id={dataTestId}\n {...restProps}\n ref={ref}\n className={cn(styles.component, styles[bgColor], className, {\n [styles.border]: border,\n })}\n >\n {Children.map(children, (tab) =>\n cloneElement(tab, {\n bgColor,\n accentColor,\n selected: tab.props.id === selectedId,\n onChange,\n tabClassNames,\n dataTestId: getDataTestId(dataTestId, 'tab'),\n }),\n )}\n </nav>\n );\n },\n);\n\nTabBarComponent.displayName = 'TabBarComponent';\n\nexport const TabBar = Object.assign(TabBarComponent, { Tab });\n"],"names":[],"mappings":";;;;;;AAUA,MAAM,eAAe,GAAG,UAAU,CAC9B,CACI,EACI,QAAQ,EACR,SAAS,EACT,UAAU,EACV,MAAM,EACN,UAAU,EACV,aAAa,EACb,QAAQ,EACR,WAAW,GAAG,SAAS,EACvB,OAAO,GAAG,kBAAkB,EAC5B,GAAG,SAAS,EACf,EACD,GAAG,KACH;IACA,IAAI,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;;AAE9B,QAAA,OAAO,CAAC,KAAK,CAAC,oDAAoD,CAAC;;IAGvE,QACI,KACkB,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,cAAA,EAAA,UAAU,EACpB,GAAA,SAAS,EACb,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE;AACxD,YAAA,CAAC,MAAM,CAAC,MAAM,GAAG,MAAM;AAC1B,SAAA,CAAC,EAED,EAAA,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,GAAG,KACxB,YAAY,CAAC,GAAG,EAAE;QACd,OAAO;QACP,WAAW;AACX,QAAA,QAAQ,EAAE,GAAG,CAAC,KAAK,CAAC,EAAE,KAAK,UAAU;QACrC,QAAQ;QACR,aAAa;AACb,QAAA,UAAU,EAAE,aAAa,CAAC,UAAU,EAAE,KAAK,CAAC;KAC/C,CAAC,CACL,CACC;AAEd,CAAC,CACJ;AAED,eAAe,CAAC,WAAW,GAAG,iBAAiB;AAExC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE,EAAE,GAAG,EAAE;;;;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type ForwardRefExoticComponent, type RefAttributes } from 'react';
|
|
2
2
|
import { type PublicTabProps } from '../../types';
|
|
3
|
-
export declare const Tab:
|
|
3
|
+
export declare const Tab: ForwardRefExoticComponent<PublicTabProps & RefAttributes<HTMLElement>>;
|
|
@@ -14,10 +14,14 @@ const TabComponent = forwardRef(({ showIndicator, indicatorProps, label, icon, i
|
|
|
14
14
|
return (React.createElement(Component, { "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, {
|
|
15
15
|
[styles[accentColor]]: selected,
|
|
16
16
|
}), onClick: handleClick },
|
|
17
|
-
React.createElement("div", { className: cn(styles.icon, commonIconClassName, iconClassName) }, isValidElement(icon)
|
|
17
|
+
React.createElement("div", { className: cn(styles.icon, commonIconClassName, iconClassName) }, isValidElement(icon)
|
|
18
|
+
? cloneElement(icon, { selected })
|
|
19
|
+
: icon),
|
|
18
20
|
React.createElement(TypographyText, { weight: 'medium', view: 'secondary-small', className: cn(styles.label, commonLabelClassName, labelClassName, {
|
|
19
21
|
[styles.labelSelected]: selected,
|
|
20
|
-
}) }, isValidElement(label)
|
|
22
|
+
}) }, isValidElement(label)
|
|
23
|
+
? cloneElement(label, { selected })
|
|
24
|
+
: label),
|
|
21
25
|
showIndicator && (React.createElement("div", { className: styles.indicator },
|
|
22
26
|
React.createElement(Indicator, { ...indicatorProps, height: indicatorProps?.value ? 16 : undefined, border: {
|
|
23
27
|
width: 2,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.js","sources":["../../../src/components/tab/Component.tsx"],"sourcesContent":["import React, {\n cloneElement,\n forwardRef,\n type ForwardRefExoticComponent,\n isValidElement,\n type MouseEventHandler,\n type RefAttributes,\n} from 'react';\nimport cn from 'classnames';\n\nimport { Indicator } from '@alfalab/core-components-indicator';\nimport { TypographyText } from '@alfalab/core-components-typography';\n\nimport { INDICATOR_BG_COLOR, INDICATOR_BORDER_COLOR } from '../../consts';\nimport { type AllTabProps, type PublicTabProps } from '../../types';\n\nimport styles from './index.module.css';\n\nconst TabComponent = forwardRef<HTMLElement, AllTabProps>(\n (\n {\n showIndicator,\n indicatorProps,\n label,\n icon,\n id,\n selected,\n onChange,\n onClick,\n tabClassNames = {},\n dataTestId,\n className,\n labelClassName,\n selectedClassName,\n iconClassName,\n href,\n Component = href ? 'a' : 'button',\n accentColor = 'primary',\n bgColor = 'modal-bg-primary',\n ...restProps\n },\n ref,\n ) => {\n const handleClick: MouseEventHandler<HTMLElement> = (event) => {\n onChange?.(id);\n onClick?.(event);\n };\n\n const {\n className: commonClassName,\n labelClassName: commonLabelClassName,\n selectedClassName: commonSelectedClassName,\n iconClassName: commonIconClassName,\n } = tabClassNames;\n\n return (\n <Component\n data-test-id={dataTestId}\n tabIndex={0}\n {...(Component === 'button' ? { type: 'button' } : null)}\n {...restProps}\n href={href}\n id={id}\n ref={ref}\n className={cn(\n styles.component,\n commonClassName,\n className,\n selected && commonSelectedClassName,\n selected && selectedClassName,\n {\n [styles[accentColor]]: selected,\n },\n )}\n onClick={handleClick}\n >\n <div className={cn(styles.icon, commonIconClassName, iconClassName)}>\n {isValidElement(icon)
|
|
1
|
+
{"version":3,"file":"Component.js","sources":["../../../src/components/tab/Component.tsx"],"sourcesContent":["import React, {\n cloneElement,\n forwardRef,\n type ForwardRefExoticComponent,\n isValidElement,\n type MouseEventHandler,\n type RefAttributes,\n} from 'react';\nimport cn from 'classnames';\n\nimport { Indicator } from '@alfalab/core-components-indicator';\nimport { TypographyText } from '@alfalab/core-components-typography';\n\nimport { INDICATOR_BG_COLOR, INDICATOR_BORDER_COLOR } from '../../consts';\nimport { type AllTabProps, type PublicTabProps } from '../../types';\n\nimport styles from './index.module.css';\n\nconst TabComponent = forwardRef<HTMLElement, AllTabProps>(\n (\n {\n showIndicator,\n indicatorProps,\n label,\n icon,\n id,\n selected,\n onChange,\n onClick,\n tabClassNames = {},\n dataTestId,\n className,\n labelClassName,\n selectedClassName,\n iconClassName,\n href,\n Component = href ? 'a' : 'button',\n accentColor = 'primary',\n bgColor = 'modal-bg-primary',\n ...restProps\n },\n ref,\n ) => {\n const handleClick: MouseEventHandler<HTMLElement> = (event) => {\n onChange?.(id);\n onClick?.(event);\n };\n\n const {\n className: commonClassName,\n labelClassName: commonLabelClassName,\n selectedClassName: commonSelectedClassName,\n iconClassName: commonIconClassName,\n } = tabClassNames;\n\n return (\n <Component\n data-test-id={dataTestId}\n tabIndex={0}\n {...(Component === 'button' ? { type: 'button' } : null)}\n {...restProps}\n href={href}\n id={id}\n ref={ref}\n className={cn(\n styles.component,\n commonClassName,\n className,\n selected && commonSelectedClassName,\n selected && selectedClassName,\n {\n [styles[accentColor]]: selected,\n },\n )}\n onClick={handleClick}\n >\n <div className={cn(styles.icon, commonIconClassName, iconClassName)}>\n {isValidElement<{ selected: unknown }>(icon)\n ? cloneElement(icon, { selected })\n : icon}\n </div>\n\n <TypographyText\n weight='medium'\n view='secondary-small'\n className={cn(styles.label, commonLabelClassName, labelClassName, {\n [styles.labelSelected]: selected,\n })}\n >\n {isValidElement<{ selected: unknown }>(label)\n ? cloneElement(label, { selected })\n : label}\n </TypographyText>\n\n {showIndicator && (\n <div className={styles.indicator}>\n <Indicator\n {...indicatorProps}\n height={indicatorProps?.value ? 16 : undefined}\n border={{\n width: 2,\n color: INDICATOR_BORDER_COLOR[bgColor],\n }}\n backgroundColor={INDICATOR_BG_COLOR[accentColor]}\n />\n </div>\n )}\n </Component>\n );\n },\n);\n\nexport const Tab = TabComponent as ForwardRefExoticComponent<\n PublicTabProps & RefAttributes<HTMLElement>\n>;\n"],"names":[],"mappings":";;;;;;;AAkBA,MAAM,YAAY,GAAG,UAAU,CAC3B,CACI,EACI,aAAa,EACb,cAAc,EACd,KAAK,EACL,IAAI,EACJ,EAAE,EACF,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,aAAa,GAAG,EAAE,EAClB,UAAU,EACV,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,IAAI,EACJ,SAAS,GAAG,IAAI,GAAG,GAAG,GAAG,QAAQ,EACjC,WAAW,GAAG,SAAS,EACvB,OAAO,GAAG,kBAAkB,EAC5B,GAAG,SAAS,EACf,EACD,GAAG,KACH;AACA,IAAA,MAAM,WAAW,GAAmC,CAAC,KAAK,KAAI;AAC1D,QAAA,QAAQ,GAAG,EAAE,CAAC;AACd,QAAA,OAAO,GAAG,KAAK,CAAC;AACpB,KAAC;AAED,IAAA,MAAM,EACF,SAAS,EAAE,eAAe,EAC1B,cAAc,EAAE,oBAAoB,EACpC,iBAAiB,EAAE,uBAAuB,EAC1C,aAAa,EAAE,mBAAmB,GACrC,GAAG,aAAa;AAEjB,IAAA,QACI,KAAA,CA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E,KAAK,GAAG,EAAE,GAAG,SAAS,EAC9C,MAAM,EAAE;AACJ,oBAAA,KAAK,EAAE,CAAC;AACR,oBAAA,KAAK,EAAE,sBAAsB,CAAC,OAAO,CAAC;iBACzC,EACD,eAAe,EAAE,kBAAkB,CAAC,WAAW,CAAC,EAAA,CAClD,CACA,CACT,CACO;AAEpB,CAAC,CACJ;AAEM,MAAM,GAAG,GAAG;;;;"}
|
package/moderncssm/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type AllHTMLAttributes, type ElementType, type ForwardRefExoticComponent, type HTMLAttributes, type ReactElement, type ReactNode, type RefAttributes } from 'react';
|
|
2
2
|
import { type IndicatorProps } from '@alfalab/core-components-indicator/moderncssm';
|
|
3
|
-
export
|
|
4
|
-
|
|
3
|
+
export type AllTabProps = PublicTabProps & PrivateTabProps;
|
|
4
|
+
type TabElementType = ReactElement<AllTabProps, ForwardRefExoticComponent<AllTabProps & RefAttributes<HTMLElement>>>;
|
|
5
5
|
export interface TabBarProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
6
6
|
/**
|
|
7
7
|
* Дополнительный класс
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfalab/core-components-tab-bar",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
"main": "index.js",
|
|
11
11
|
"module": "./esm/index.js",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@alfalab/core-components-indicator": "^4.0.
|
|
14
|
-
"@alfalab/core-components-shared": "^2.1.
|
|
15
|
-
"@alfalab/core-components-typography": "^6.0.
|
|
13
|
+
"@alfalab/core-components-indicator": "^4.0.2",
|
|
14
|
+
"@alfalab/core-components-shared": "^2.1.1",
|
|
15
|
+
"@alfalab/core-components-typography": "^6.0.3",
|
|
16
16
|
"classnames": "^2.5.1",
|
|
17
17
|
"tslib": "^2.4.0"
|
|
18
18
|
},
|
|
@@ -24,6 +24,6 @@
|
|
|
24
24
|
"access": "public",
|
|
25
25
|
"directory": "dist"
|
|
26
26
|
},
|
|
27
|
-
"themesVersion": "15.0.
|
|
28
|
-
"varsVersion": "11.0.
|
|
27
|
+
"themesVersion": "15.0.2",
|
|
28
|
+
"varsVersion": "11.0.2"
|
|
29
29
|
}
|
|
@@ -75,7 +75,9 @@ const TabComponent = forwardRef<HTMLElement, AllTabProps>(
|
|
|
75
75
|
onClick={handleClick}
|
|
76
76
|
>
|
|
77
77
|
<div className={cn(styles.icon, commonIconClassName, iconClassName)}>
|
|
78
|
-
{isValidElement
|
|
78
|
+
{isValidElement<{ selected: unknown }>(icon)
|
|
79
|
+
? cloneElement(icon, { selected })
|
|
80
|
+
: icon}
|
|
79
81
|
</div>
|
|
80
82
|
|
|
81
83
|
<TypographyText
|
|
@@ -85,7 +87,9 @@ const TabComponent = forwardRef<HTMLElement, AllTabProps>(
|
|
|
85
87
|
[styles.labelSelected]: selected,
|
|
86
88
|
})}
|
|
87
89
|
>
|
|
88
|
-
{isValidElement
|
|
90
|
+
{isValidElement<{ selected: unknown }>(label)
|
|
91
|
+
? cloneElement(label, { selected })
|
|
92
|
+
: label}
|
|
89
93
|
</TypographyText>
|
|
90
94
|
|
|
91
95
|
{showIndicator && (
|
package/src/index.module.css
CHANGED
package/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type AllHTMLAttributes, type ElementType, type ForwardRefExoticComponent, type HTMLAttributes, type ReactElement, type ReactNode, type RefAttributes } from 'react';
|
|
2
2
|
import { type IndicatorProps } from '@alfalab/core-components-indicator';
|
|
3
|
-
export
|
|
4
|
-
|
|
3
|
+
export type AllTabProps = PublicTabProps & PrivateTabProps;
|
|
4
|
+
type TabElementType = ReactElement<AllTabProps, ForwardRefExoticComponent<AllTabProps & RefAttributes<HTMLElement>>>;
|
|
5
5
|
export interface TabBarProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
6
6
|
/**
|
|
7
7
|
* Дополнительный класс
|