@wandelbots/wandelbots-js-react-components 2.54.3 → 2.54.5
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/TabBar.d.ts.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +107 -85
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/TabBar.tsx +51 -18
package/package.json
CHANGED
|
@@ -70,6 +70,34 @@ function TabPanel(props: TabPanelProps) {
|
|
|
70
70
|
)
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
/**
|
|
74
|
+
* Wrapper component that filters out MUI Tabs internal props
|
|
75
|
+
* to prevent them from being passed to DOM elements
|
|
76
|
+
*/
|
|
77
|
+
interface TabWrapperProps {
|
|
78
|
+
children: React.ReactNode
|
|
79
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
80
|
+
[key: string]: any
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function TabWrapper({ children, ...props }: TabWrapperProps) {
|
|
84
|
+
// Filter out MUI Tabs internal props that shouldn't reach the DOM
|
|
85
|
+
const {
|
|
86
|
+
fullWidth,
|
|
87
|
+
indicator,
|
|
88
|
+
onChange,
|
|
89
|
+
orientation,
|
|
90
|
+
scrollButtons,
|
|
91
|
+
selectionFollowsFocus,
|
|
92
|
+
textColor,
|
|
93
|
+
value,
|
|
94
|
+
variant,
|
|
95
|
+
...cleanProps
|
|
96
|
+
} = props
|
|
97
|
+
|
|
98
|
+
return <Box {...cleanProps}>{children}</Box>
|
|
99
|
+
}
|
|
100
|
+
|
|
73
101
|
/**
|
|
74
102
|
* A styled tab bar component with configurable tabs and content.
|
|
75
103
|
* Features the same styling as the Wandelbots design system with rounded tabs
|
|
@@ -238,26 +266,31 @@ export const TabBar = externalizeComponent(
|
|
|
238
266
|
}
|
|
239
267
|
|
|
240
268
|
return (
|
|
241
|
-
<
|
|
269
|
+
<TabWrapper
|
|
242
270
|
key={item.id}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
max={item.badge?.max}
|
|
246
|
-
showZero={item.badge?.showZero}
|
|
247
|
-
anchorOrigin={{
|
|
248
|
-
vertical: "top",
|
|
249
|
-
horizontal: "right",
|
|
250
|
-
}}
|
|
251
|
-
overlap="rectangular"
|
|
252
|
-
sx={{
|
|
253
|
-
"& .MuiBadge-badge": {
|
|
254
|
-
// Ensure badge doesn't inherit tab opacity
|
|
255
|
-
opacity: "1 !important",
|
|
256
|
-
},
|
|
257
|
-
}}
|
|
271
|
+
component="span"
|
|
272
|
+
sx={{ display: "inline-flex" }}
|
|
258
273
|
>
|
|
259
|
-
|
|
260
|
-
|
|
274
|
+
<Badge
|
|
275
|
+
badgeContent={badgeContent}
|
|
276
|
+
color={item.badge?.color || "error"}
|
|
277
|
+
max={item.badge?.max}
|
|
278
|
+
showZero={item.badge?.showZero}
|
|
279
|
+
anchorOrigin={{
|
|
280
|
+
vertical: "top",
|
|
281
|
+
horizontal: "right",
|
|
282
|
+
}}
|
|
283
|
+
overlap="rectangular"
|
|
284
|
+
sx={{
|
|
285
|
+
"& .MuiBadge-badge": {
|
|
286
|
+
// Ensure badge doesn't inherit tab opacity
|
|
287
|
+
opacity: "1 !important",
|
|
288
|
+
},
|
|
289
|
+
}}
|
|
290
|
+
>
|
|
291
|
+
{tab}
|
|
292
|
+
</Badge>
|
|
293
|
+
</TabWrapper>
|
|
261
294
|
)
|
|
262
295
|
})}
|
|
263
296
|
</Tabs>
|