@homebound/beam 2.167.0 → 2.168.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Tabs.d.ts +33 -12
- package/dist/components/Tabs.js +13 -6
- package/package.json +1 -1
|
@@ -16,6 +16,7 @@ export interface TabsProps<V extends string, X> {
|
|
|
16
16
|
onChange: (value: V) => void;
|
|
17
17
|
contentXss?: X;
|
|
18
18
|
alwaysShowAllTabs?: boolean;
|
|
19
|
+
includeBottomBorder?: boolean;
|
|
19
20
|
}
|
|
20
21
|
export interface RouteTabsProps<V extends string, X> extends Omit<TabsProps<V, X>, "onChange" | "selected" | "tabs"> {
|
|
21
22
|
tabs: RouteTab<V>[];
|
|
@@ -65,26 +66,36 @@ export declare function getTabStyles(): {
|
|
|
65
66
|
} & {
|
|
66
67
|
paddingRight: import("csstype").Property.PaddingRight<0 | (string & {})> | undefined;
|
|
67
68
|
} & {
|
|
68
|
-
|
|
69
|
+
outline: import("csstype").Property.Outline<0 | (string & {})> | undefined;
|
|
70
|
+
} & {
|
|
71
|
+
color: import("csstype").Property.Color | undefined;
|
|
72
|
+
} & {
|
|
73
|
+
width: import("csstype").Property.Width<0 | (string & {})> | undefined;
|
|
74
|
+
} & {
|
|
75
|
+
cursor: import("csstype").Property.Cursor | undefined;
|
|
69
76
|
} & {
|
|
70
77
|
fontWeight: import("csstype").Property.FontWeight | undefined;
|
|
71
78
|
} & {
|
|
72
79
|
fontSize: import("csstype").Property.FontSize<0 | (string & {})> | undefined;
|
|
73
80
|
} & {
|
|
74
81
|
lineHeight: import("csstype").Property.LineHeight<0 | (string & {})> | undefined;
|
|
82
|
+
};
|
|
83
|
+
activeStyles: {
|
|
84
|
+
borderBottomStyle: import("csstype").Property.BorderBottomStyle | undefined;
|
|
75
85
|
} & {
|
|
76
|
-
|
|
86
|
+
borderBottomWidth: import("csstype").Property.BorderBottomWidth<0 | (string & {})> | undefined;
|
|
77
87
|
} & {
|
|
78
|
-
|
|
88
|
+
paddingBottom: import("csstype").Property.PaddingBottom<0 | (string & {})> | undefined;
|
|
79
89
|
} & {
|
|
80
|
-
|
|
90
|
+
borderColor: import("csstype").Property.BorderColor | undefined;
|
|
81
91
|
} & {
|
|
82
|
-
|
|
83
|
-
};
|
|
84
|
-
activeStyles: {
|
|
85
|
-
color: import("csstype").Property.Color | undefined;
|
|
92
|
+
fontWeight: import("csstype").Property.FontWeight | undefined;
|
|
86
93
|
} & {
|
|
87
|
-
|
|
94
|
+
fontSize: import("csstype").Property.FontSize<0 | (string & {})> | undefined;
|
|
95
|
+
} & {
|
|
96
|
+
lineHeight: import("csstype").Property.LineHeight<0 | (string & {})> | undefined;
|
|
97
|
+
} & {
|
|
98
|
+
color: import("csstype").Property.Color | undefined;
|
|
88
99
|
};
|
|
89
100
|
disabledStyles: {
|
|
90
101
|
color: import("csstype").Property.Color | undefined;
|
|
@@ -97,14 +108,24 @@ export declare function getTabStyles(): {
|
|
|
97
108
|
boxShadow: import("csstype").Property.BoxShadow | undefined;
|
|
98
109
|
};
|
|
99
110
|
hoverStyles: {
|
|
100
|
-
|
|
111
|
+
borderBottomStyle: import("csstype").Property.BorderBottomStyle | undefined;
|
|
101
112
|
} & {
|
|
102
|
-
|
|
113
|
+
borderBottomWidth: import("csstype").Property.BorderBottomWidth<0 | (string & {})> | undefined;
|
|
114
|
+
} & {
|
|
115
|
+
paddingBottom: import("csstype").Property.PaddingBottom<0 | (string & {})> | undefined;
|
|
116
|
+
} & {
|
|
117
|
+
borderColor: import("csstype").Property.BorderColor | undefined;
|
|
103
118
|
};
|
|
104
119
|
activeHoverStyles: {
|
|
105
120
|
backgroundColor: import("csstype").Property.BackgroundColor | undefined;
|
|
106
121
|
} & {
|
|
107
|
-
|
|
122
|
+
borderBottomStyle: import("csstype").Property.BorderBottomStyle | undefined;
|
|
123
|
+
} & {
|
|
124
|
+
borderBottomWidth: import("csstype").Property.BorderBottomWidth<0 | (string & {})> | undefined;
|
|
125
|
+
} & {
|
|
126
|
+
paddingBottom: import("csstype").Property.PaddingBottom<0 | (string & {})> | undefined;
|
|
127
|
+
} & {
|
|
128
|
+
borderColor: import("csstype").Property.BorderColor | undefined;
|
|
108
129
|
};
|
|
109
130
|
};
|
|
110
131
|
export declare function getNextTabValue<V extends string>(selected: V, key: "ArrowLeft" | "ArrowRight", tabs: Tab<V>[] | RouteTab<V>[]): V;
|
package/dist/components/Tabs.js
CHANGED
|
@@ -45,7 +45,7 @@ exports.TabContent = TabContent;
|
|
|
45
45
|
/** The top list of tabs. */
|
|
46
46
|
function Tabs(props) {
|
|
47
47
|
const { tabActionsRef, tabActionsDiv } = (0, BeamContext_1.useBeamContext)();
|
|
48
|
-
const { ariaLabel, tabs, ...others } = props;
|
|
48
|
+
const { ariaLabel, tabs, includeBottomBorder, ...others } = props;
|
|
49
49
|
const location = (0, react_router_1.useLocation)();
|
|
50
50
|
const selected = isRouteTabs(props)
|
|
51
51
|
? uniqueTabValue(props.tabs.find((t) => !!(0, react_router_1.matchPath)(location.pathname, { path: t.path, exact: true })) || props.tabs[0])
|
|
@@ -84,7 +84,7 @@ function Tabs(props) {
|
|
|
84
84
|
setActive(selected);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ css: Css_1.Css.df.aic.$ }, { children: [!hideTabs(props) && ((0, jsx_runtime_1.jsx)("div", Object.assign({ ref: ref, css: Css_1.Css.dif.childGap1.$, "aria-label": ariaLabel, role: "tablist" }, tid, { children: tabs.map((tab) => {
|
|
87
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ css: Css_1.Css.df.aic.$ }, { children: [!hideTabs(props) && ((0, jsx_runtime_1.jsx)("div", Object.assign({ ref: ref, css: { ...Css_1.Css.dif.childGap1.$, ...(includeBottomBorder ? { ...Css_1.Css.bb.bGray200.$ } : {}) }, "aria-label": ariaLabel, role: "tablist" }, tid, { children: tabs.map((tab) => {
|
|
88
88
|
const uniqueValue = uniqueTabValue(tab);
|
|
89
89
|
return ((0, jsx_runtime_1.jsx)(TabImpl, Object.assign({ active: active === uniqueValue, focusProps: focusProps, isFocusVisible: isFocusVisible, onClick: onClick, onKeyUp: onKeyUp, onBlur: onBlur, tab: tab }, tid[(0, defaultTestId_1.defaultTestId)(uniqueValue)]), uniqueValue));
|
|
90
90
|
}) }), void 0)), (0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.ml("auto").addIn("&>div", Css_1.Css.df.aic.childGap1.$).$, ref: tabActionsRef }, void 0)] }), void 0));
|
|
@@ -122,13 +122,20 @@ function TabImpl(props) {
|
|
|
122
122
|
return isDisabled ? ((0, jsx_runtime_1.jsx)("div", Object.assign({}, tabProps, { children: tabLabel }), void 0)) : isRouteTab(tab) ? ((0, jsx_runtime_1.jsx)(react_router_dom_1.Link, Object.assign({}, { ...tabProps, ...interactiveProps }, { className: "navLink", to: tab.href }, { children: tabLabel }), void 0)) : ((0, jsx_runtime_1.jsx)("button", Object.assign({}, { ...tabProps, ...interactiveProps }, { children: tabLabel }), void 0));
|
|
123
123
|
}
|
|
124
124
|
function getTabStyles() {
|
|
125
|
+
const borderBottomWidthPx = 4;
|
|
126
|
+
const verticalPaddingPx = 6;
|
|
127
|
+
// Decrease the bottom padding by the same amount of the new border width to prevent text layout shift
|
|
128
|
+
const borderBottomStyles = Css_1.Css.bb
|
|
129
|
+
.add("borderBottomWidth", `${borderBottomWidthPx}px`)
|
|
130
|
+
.pbPx(verticalPaddingPx - borderBottomWidthPx).$;
|
|
125
131
|
return {
|
|
126
|
-
baseStyles: Css_1.Css.df.aic.hPx(32).pyPx(
|
|
127
|
-
|
|
132
|
+
baseStyles: Css_1.Css.df.aic.hPx(32).pyPx(verticalPaddingPx).px1.outline0.gray700.add("width", "fit-content")
|
|
133
|
+
.cursorPointer.sm.$,
|
|
134
|
+
activeStyles: Css_1.Css.add(borderBottomStyles).bLightBlue700.smEm.gray900.$,
|
|
128
135
|
disabledStyles: Css_1.Css.gray400.cursorNotAllowed.$,
|
|
129
136
|
focusRingStyles: Css_1.Css.bgLightBlue50.bshFocus.$,
|
|
130
|
-
hoverStyles: Css_1.Css.
|
|
131
|
-
activeHoverStyles: Css_1.Css.
|
|
137
|
+
hoverStyles: Css_1.Css.add(borderBottomStyles).bGray400.$,
|
|
138
|
+
activeHoverStyles: Css_1.Css.bgLightBlue50.add(borderBottomStyles).bLightBlue700.$,
|
|
132
139
|
};
|
|
133
140
|
}
|
|
134
141
|
exports.getTabStyles = getTabStyles;
|