@swan-io/lake 11.3.3 → 11.3.4
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/package.json
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
1
2
|
import { IconName } from "./Icon";
|
|
2
3
|
import { SpacingValue } from "./Space";
|
|
3
4
|
export declare const tabsViewHeight: number;
|
|
@@ -8,6 +9,7 @@ type Tab = ({
|
|
|
8
9
|
}) & {
|
|
9
10
|
count?: number;
|
|
10
11
|
icon?: IconName;
|
|
12
|
+
endElement?: ReactNode;
|
|
11
13
|
label: string;
|
|
12
14
|
withSeparator?: boolean;
|
|
13
15
|
};
|
|
@@ -407,7 +407,7 @@ export const TabView = ({ tabs, otherLabel, hideIfSingleItem = true, sticky = fa
|
|
|
407
407
|
return null;
|
|
408
408
|
}
|
|
409
409
|
return (_jsxs(Box, { alignItems: "center", direction: "row", role: "tablist", ref: containerRef, style: [styles.container, sticky && styles.sticky, { paddingHorizontal: padding }], children: [_jsxs(View, { style: styles.placeholder, "aria-hidden": true, ref: placeholderRef, onLayout: onLayout, children: [tabs.map(tab => {
|
|
410
|
-
const { label, icon, count } = tab;
|
|
410
|
+
const { label, icon, count, endElement } = tab;
|
|
411
411
|
const tabId = getTabId(tab);
|
|
412
412
|
return (_jsxs(Fragment, { children: [_jsxs(TabViewLink, { ref: ref => {
|
|
413
413
|
if (placeholderLinkRef.current) {
|
|
@@ -416,9 +416,9 @@ export const TabView = ({ tabs, otherLabel, hideIfSingleItem = true, sticky = fa
|
|
|
416
416
|
}, activeTabId: activeTabId, tab: tab, onChange: onChange, style: ({ active, hovered }) => [
|
|
417
417
|
styles.link,
|
|
418
418
|
active ? styles.activeLink : hovered ? styles.hoveredLink : null,
|
|
419
|
-
], children: [isNotNullish(icon) && (_jsxs(_Fragment, { children: [_jsx(Icon, { name: icon, size: 16, color: "currentColor" }), _jsx(Space, { width: 8 })] })), _jsx(Text, { children: label }), count != null ? (_jsxs(_Fragment, { children: [_jsx(Space, { width: 8 }), _jsx(Text, { style: styles.count, children: count })] })) : null] }), _jsx(Space, { width: 32 })] }, tabId));
|
|
419
|
+
], children: [isNotNullish(icon) && (_jsxs(_Fragment, { children: [_jsx(Icon, { name: icon, size: 16, color: "currentColor" }), _jsx(Space, { width: 8 })] })), _jsx(Text, { children: label }), isNotNullish(endElement) && (_jsxs(_Fragment, { children: [_jsx(Space, { width: 8 }), endElement] })), count != null ? (_jsxs(_Fragment, { children: [_jsx(Space, { width: 8 }), _jsx(Text, { style: styles.count, children: count })] })) : null] }), _jsx(Space, { width: 32 })] }, tabId));
|
|
420
420
|
}), _jsxs(LakeText, { ref: otherPlaceholderRef, style: styles.link, children: [_jsx(Text, { children: otherLabel }), _jsx(Space, { width: 8 }), _jsx(Text, { style: styles.count, children: tabs.length }), _jsx(Space, { width: 4 }), _jsx(Icon, { name: "chevron-down-filled", size: 12 })] })] }), kept.map(tab => {
|
|
421
|
-
const { label, icon, withSeparator, count } = tab;
|
|
421
|
+
const { label, icon, withSeparator, count, endElement } = tab;
|
|
422
422
|
const tabId = getTabId(tab);
|
|
423
423
|
return (_jsxs(Fragment, { children: [_jsxs(TabViewLink, { ref: ref => {
|
|
424
424
|
if (linksRefs.current) {
|
|
@@ -427,7 +427,7 @@ export const TabView = ({ tabs, otherLabel, hideIfSingleItem = true, sticky = fa
|
|
|
427
427
|
}, onChange: onChange, activeTabId: activeTabId, tab: tab, role: "tab", style: ({ active, hovered }) => [
|
|
428
428
|
styles.link,
|
|
429
429
|
active ? styles.activeLink : hovered ? styles.hoveredLink : null,
|
|
430
|
-
], children: [withSeparator === true && _jsx(View, { style: styles.separator, role: "none" }), isNotNullish(icon) && (_jsxs(_Fragment, { children: [_jsx(Icon, { name: icon, size: 16, color: "currentColor" }), _jsx(Space, { width: 8 })] })), _jsx(Text, { children: label }), count != null ? (_jsxs(_Fragment, { children: [_jsx(Space, { width: 8 }), _jsx(Text, { style: styles.count, children: count })] })) : null] }), _jsx(Space, { width: 32 })] }, tabId));
|
|
430
|
+
], children: [withSeparator === true && _jsx(View, { style: styles.separator, role: "none" }), isNotNullish(icon) && (_jsxs(_Fragment, { children: [_jsx(Icon, { name: icon, size: 16, color: "currentColor" }), _jsx(Space, { width: 8 })] })), _jsx(Text, { children: label }), isNotNullish(endElement) && (_jsxs(_Fragment, { children: [_jsx(Space, { width: 8 }), endElement] })), count != null ? (_jsxs(_Fragment, { children: [_jsx(Space, { width: 8 }), _jsx(Text, { style: styles.count, children: count })] })) : null] }), _jsx(Space, { width: 32 })] }, tabId));
|
|
431
431
|
}), collapsed.length > 0 ? (_jsx(DropdownItems, { ref: ref => {
|
|
432
432
|
collapsed.forEach(item => {
|
|
433
433
|
if (linksRefs.current) {
|