chili-ui 0.22.1 → 0.22.2
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.
|
@@ -21,10 +21,15 @@ export const Tabs = React.forwardRef((props: TabsProps, ref?: React.Ref<HTMLElem
|
|
|
21
21
|
activeTabKey: activeTabKeyProp,
|
|
22
22
|
children,
|
|
23
23
|
className,
|
|
24
|
+
contentRender,
|
|
25
|
+
headingRender,
|
|
26
|
+
onChange,
|
|
24
27
|
shouldScrollTabs,
|
|
25
28
|
style,
|
|
26
29
|
tabContentNode,
|
|
27
30
|
tabRender,
|
|
31
|
+
wrapperRender,
|
|
32
|
+
...restProps
|
|
28
33
|
} = useProps(props);
|
|
29
34
|
|
|
30
35
|
const theme = useTheme(themeProp, COMPONENTS_NAMESPACES.tabs);
|
|
@@ -77,6 +82,7 @@ export const Tabs = React.forwardRef((props: TabsProps, ref?: React.Ref<HTMLElem
|
|
|
77
82
|
|
|
78
83
|
return (
|
|
79
84
|
<Wrapper
|
|
85
|
+
{...restProps}
|
|
80
86
|
className={combinedClassNames}
|
|
81
87
|
style={style as React.CSSProperties}
|
|
82
88
|
ref={ref}
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
2
13
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
14
|
import React from 'react';
|
|
4
15
|
import isNil from 'lodash/isNil';
|
|
@@ -12,7 +23,7 @@ import { TabsContext } from './TabsContext';
|
|
|
12
23
|
import { ArrowLeft, ArrowRight } from './ScrollArrows';
|
|
13
24
|
import { Div } from '../Div';
|
|
14
25
|
export const Tabs = React.forwardRef((props, ref) => {
|
|
15
|
-
const { theme: themeProp, activeTabKey: activeTabKeyProp, children, className, shouldScrollTabs, style, tabContentNode, tabRender, } =
|
|
26
|
+
const _a = useProps(props), { theme: themeProp, activeTabKey: activeTabKeyProp, children, className, contentRender, headingRender, onChange, shouldScrollTabs, style, tabContentNode, tabRender, wrapperRender } = _a, restProps = __rest(_a, ["theme", "activeTabKey", "children", "className", "contentRender", "headingRender", "onChange", "shouldScrollTabs", "style", "tabContentNode", "tabRender", "wrapperRender"]);
|
|
16
27
|
const theme = useTheme(themeProp, COMPONENTS_NAMESPACES.tabs);
|
|
17
28
|
const [activeTabKeyState, setActiveTabKeyState] = React.useState(() => {
|
|
18
29
|
var _a;
|
|
@@ -35,11 +46,11 @@ export const Tabs = React.forwardRef((props, ref) => {
|
|
|
35
46
|
const headingClassNames = getClassNames(theme.tabsBar, shouldScrollTabs && theme.scroll);
|
|
36
47
|
if (!children)
|
|
37
48
|
return null;
|
|
38
|
-
return (_jsxs(Wrapper, { className: combinedClassNames, style: style, ref: ref, children: [_jsxs(Div, { ref: containerRef, className: containerClassNames, children: [hasLeftArrow && (_jsx(ArrowLeft, { onClick: onLeftClick, theme: theme })), hasRightArrow && (_jsx(ArrowRight, { onClick: onRightClick, theme: theme })), _jsx(Heading, { className: headingClassNames, children: _jsx(TabsContext.Provider, { value: tabsContext, children: React.Children.map(children, (child) => {
|
|
49
|
+
return (_jsxs(Wrapper, Object.assign({}, restProps, { className: combinedClassNames, style: style, ref: ref, children: [_jsxs(Div, { ref: containerRef, className: containerClassNames, children: [hasLeftArrow && (_jsx(ArrowLeft, { onClick: onLeftClick, theme: theme })), hasRightArrow && (_jsx(ArrowRight, { onClick: onRightClick, theme: theme })), _jsx(Heading, { className: headingClassNames, children: _jsx(TabsContext.Provider, { value: tabsContext, children: React.Children.map(children, (child) => {
|
|
39
50
|
if (!React.isValidElement(child))
|
|
40
51
|
return null;
|
|
41
52
|
return (_jsx(Tab, Object.assign({}, child.props)));
|
|
42
|
-
}) }) })] }), _jsx(Content, { className: theme.content, tabContentNode: tabContentNode, children: _jsx(TabContent, { activeTabKey: activeTabKey, children: children }, activeTabKey) })] }));
|
|
53
|
+
}) }) })] }), _jsx(Content, { className: theme.content, tabContentNode: tabContentNode, children: _jsx(TabContent, { activeTabKey: activeTabKey, children: children }, activeTabKey) })] })));
|
|
43
54
|
});
|
|
44
55
|
Tabs.displayName = 'Tabs';
|
|
45
56
|
//# sourceMappingURL=Tabs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.js","sourceRoot":"","sources":["../../../chili/components/Tabs/Tabs.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC
|
|
1
|
+
{"version":3,"file":"Tabs.js","sourceRoot":"","sources":["../../../chili/components/Tabs/Tabs.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;AAEb,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,MAAM,cAAc,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EACL,aAAa,EAAE,QAAQ,EAAE,QAAQ,GAClC,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,SAAS,EAA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