@wandelbots/wandelbots-js-react-components 2.54.2 → 2.54.3-pr.fix-dom-leak.403.8043b0b
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 +110 -87
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/TabBar.tsx +53 -23
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wandelbots/wandelbots-js-react-components",
|
|
3
|
-
"version": "2.54.
|
|
3
|
+
"version": "2.54.3-pr.fix-dom-leak.403.8043b0b",
|
|
4
4
|
"description": "React UI toolkit for building applications on top of the Wandelbots platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -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
|
|
@@ -194,6 +222,7 @@ export const TabBar = externalizeComponent(
|
|
|
194
222
|
|
|
195
223
|
const tab = (
|
|
196
224
|
<Tab
|
|
225
|
+
key={item.id}
|
|
197
226
|
label={item.label}
|
|
198
227
|
icon={item.icon}
|
|
199
228
|
iconPosition="start"
|
|
@@ -233,34 +262,35 @@ export const TabBar = externalizeComponent(
|
|
|
233
262
|
)
|
|
234
263
|
|
|
235
264
|
if (!showBadge) {
|
|
236
|
-
return
|
|
237
|
-
<Box key={item.id} sx={{ display: "inline-flex" }}>
|
|
238
|
-
{tab}
|
|
239
|
-
</Box>
|
|
240
|
-
)
|
|
265
|
+
return tab
|
|
241
266
|
}
|
|
242
267
|
|
|
243
268
|
return (
|
|
244
|
-
<
|
|
269
|
+
<TabWrapper
|
|
245
270
|
key={item.id}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
max={item.badge?.max}
|
|
249
|
-
showZero={item.badge?.showZero}
|
|
250
|
-
anchorOrigin={{
|
|
251
|
-
vertical: "top",
|
|
252
|
-
horizontal: "right",
|
|
253
|
-
}}
|
|
254
|
-
overlap="rectangular"
|
|
255
|
-
sx={{
|
|
256
|
-
"& .MuiBadge-badge": {
|
|
257
|
-
// Ensure badge doesn't inherit tab opacity
|
|
258
|
-
opacity: "1 !important",
|
|
259
|
-
},
|
|
260
|
-
}}
|
|
271
|
+
component="span"
|
|
272
|
+
sx={{ display: "inline-flex" }}
|
|
261
273
|
>
|
|
262
|
-
|
|
263
|
-
|
|
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>
|
|
264
294
|
)
|
|
265
295
|
})}
|
|
266
296
|
</Tabs>
|