@wandelbots/wandelbots-js-react-components 2.34.2-pr.feature-robot-precondition-list.372.9dfd57e → 2.34.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.
Files changed (65) hide show
  1. package/dist/components/CycleTimer.d.ts +16 -33
  2. package/dist/components/CycleTimer.d.ts.map +1 -1
  3. package/dist/components/ProgramControl.d.ts +2 -8
  4. package/dist/components/ProgramControl.d.ts.map +1 -1
  5. package/dist/components/ProgramStateIndicator.d.ts +1 -1
  6. package/dist/components/ProgramStateIndicator.d.ts.map +1 -1
  7. package/dist/components/robots/Robot.d.ts +2 -3
  8. package/dist/components/robots/Robot.d.ts.map +1 -1
  9. package/dist/icons/index.d.ts +0 -1
  10. package/dist/icons/index.d.ts.map +1 -1
  11. package/dist/index.cjs +50 -50
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.ts +0 -10
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +9576 -11435
  16. package/dist/index.js.map +1 -1
  17. package/dist/themes/createDarkTheme.d.ts.map +1 -1
  18. package/package.json +1 -2
  19. package/src/components/CycleTimer.tsx +159 -384
  20. package/src/components/ProgramControl.tsx +12 -27
  21. package/src/components/ProgramStateIndicator.tsx +8 -25
  22. package/src/components/robots/Robot.tsx +2 -5
  23. package/src/i18n/locales/de/translations.json +1 -8
  24. package/src/i18n/locales/en/translations.json +1 -8
  25. package/src/icons/index.ts +0 -1
  26. package/src/index.ts +0 -14
  27. package/src/themes/createDarkTheme.ts +1 -75
  28. package/dist/components/AppHeader.d.ts +0 -34
  29. package/dist/components/AppHeader.d.ts.map +0 -1
  30. package/dist/components/DataGrid.d.ts +0 -66
  31. package/dist/components/DataGrid.d.ts.map +0 -1
  32. package/dist/components/LogPanel.d.ts +0 -38
  33. package/dist/components/LogPanel.d.ts.map +0 -1
  34. package/dist/components/LogStore.d.ts +0 -12
  35. package/dist/components/LogStore.d.ts.map +0 -1
  36. package/dist/components/LogViewer.d.ts +0 -46
  37. package/dist/components/LogViewer.d.ts.map +0 -1
  38. package/dist/components/RobotCard.d.ts +0 -103
  39. package/dist/components/RobotCard.d.ts.map +0 -1
  40. package/dist/components/RobotListItem.d.ts +0 -34
  41. package/dist/components/RobotListItem.d.ts.map +0 -1
  42. package/dist/components/RobotSetupReadinessIndicator.d.ts +0 -31
  43. package/dist/components/RobotSetupReadinessIndicator.d.ts.map +0 -1
  44. package/dist/components/RobotSetupReadinessIndicator.test.d.ts +0 -2
  45. package/dist/components/RobotSetupReadinessIndicator.test.d.ts.map +0 -1
  46. package/dist/components/TabBar.d.ts +0 -30
  47. package/dist/components/TabBar.d.ts.map +0 -1
  48. package/dist/components/robots/manufacturerHomePositions.d.ts +0 -21
  49. package/dist/components/robots/manufacturerHomePositions.d.ts.map +0 -1
  50. package/dist/icons/DropdownArrowIcon.d.ts +0 -3
  51. package/dist/icons/DropdownArrowIcon.d.ts.map +0 -1
  52. package/src/components/AppHeader.md +0 -84
  53. package/src/components/AppHeader.tsx +0 -199
  54. package/src/components/DataGrid.tsx +0 -659
  55. package/src/components/LogPanel.tsx +0 -69
  56. package/src/components/LogStore.ts +0 -44
  57. package/src/components/LogViewer.tsx +0 -370
  58. package/src/components/RobotCard.tsx +0 -568
  59. package/src/components/RobotListItem.tsx +0 -150
  60. package/src/components/RobotSetupReadinessIndicator.test.tsx +0 -60
  61. package/src/components/RobotSetupReadinessIndicator.tsx +0 -124
  62. package/src/components/TabBar.tsx +0 -144
  63. package/src/components/robots/manufacturerHomePositions.ts +0 -76
  64. package/src/icons/DropdownArrowIcon.tsx +0 -13
  65. package/src/icons/chevronDown.svg +0 -3
@@ -1,659 +0,0 @@
1
- import ClearIcon from "@mui/icons-material/Clear"
2
- import FilterListIcon from "@mui/icons-material/FilterList"
3
- import SearchIcon from "@mui/icons-material/Search"
4
- import { Box, Divider, Typography, useTheme } from "@mui/material"
5
- import {
6
- DataGrid,
7
- type DataGridProps,
8
- FilterPanelTrigger,
9
- type GridColDef,
10
- type GridRowParams,
11
- QuickFilter,
12
- QuickFilterClear,
13
- QuickFilterControl,
14
- QuickFilterTrigger,
15
- Toolbar,
16
- ToolbarButton,
17
- useGridApiRef,
18
- } from "@mui/x-data-grid"
19
- import { observer } from "mobx-react-lite"
20
- import { useEffect, useMemo, useRef, useState } from "react"
21
- import { externalizeComponent } from "../externalizeComponent"
22
-
23
- export interface WandelbotsDataGridProps<T = Record<string, unknown>> {
24
- /**
25
- * Array of data items to display in the grid
26
- */
27
- data: T[]
28
-
29
- /**
30
- * Column definitions for the DataGrid
31
- */
32
- columns: GridColDef[]
33
-
34
- /**
35
- * Function to transform data items into DataGrid rows
36
- * Should return an object with an 'id' field and other fields matching column definitions
37
- */
38
- getRowData: (item: T) => Record<string, unknown> & { id: string | number }
39
-
40
- /**
41
- * Callback when a row is clicked
42
- */
43
- onRowClick?: (item: T, params: GridRowParams) => void
44
-
45
- /**
46
- * Currently selected item (for highlighting)
47
- */
48
- selectedItem?: T | null
49
-
50
- /**
51
- * Function to get the ID of an item (used for selection highlighting)
52
- */
53
- getItemId?: (item: T) => string | number
54
-
55
- /**
56
- * Title displayed in the toolbar
57
- */
58
- title?: string
59
-
60
- /**
61
- * Show item count in title
62
- * @default true
63
- */
64
- showCount?: boolean
65
-
66
- /**
67
- * Placeholder text for the search input
68
- * @default "Search programs"
69
- */
70
- searchPlaceholder?: string
71
-
72
- /**
73
- * Additional DataGrid props to pass through
74
- */
75
- dataGridProps?: Partial<DataGridProps>
76
-
77
- /**
78
- * Custom toolbar component to replace the default one
79
- */
80
- CustomToolbar?: React.ComponentType
81
-
82
- /**
83
- * Select the first item by default
84
- * @default false
85
- */
86
- selectFirstByDefault?: boolean
87
-
88
- /**
89
- * Custom sx styles for the root container
90
- */
91
- sx?: React.ComponentProps<typeof Box>["sx"]
92
- }
93
-
94
- export const WandelbotsDataGrid = externalizeComponent(
95
- observer(
96
- <T,>({
97
- data,
98
- columns,
99
- getRowData,
100
- onRowClick,
101
- selectedItem,
102
- getItemId,
103
- title,
104
- showCount = true,
105
- searchPlaceholder = "Search programs",
106
- dataGridProps,
107
- CustomToolbar,
108
- selectFirstByDefault = false,
109
- sx,
110
- }: WandelbotsDataGridProps<T>) => {
111
- const theme = useTheme()
112
- const apiRef = useGridApiRef()
113
- const containerRef = useRef<HTMLDivElement>(null)
114
-
115
- // Internal state for selection when not controlled
116
- const [internalSelectedItem, setInternalSelectedItem] =
117
- useState<T | null>(null)
118
-
119
- // Prepare rows for the DataGrid
120
- const rows = useMemo(() => data.map(getRowData), [data, getRowData])
121
-
122
- // Auto-resize columns when data changes
123
- useEffect(() => {
124
- if (apiRef.current && rows.length > 0) {
125
- apiRef.current.autosizeColumns({
126
- includeOutliers: true,
127
- includeHeaders: true,
128
- expand: true,
129
- columns: columns.map((col) => col.field),
130
- })
131
- }
132
- }, [rows, columns, apiRef])
133
-
134
- // Auto-resize columns when the DataGrid container is resized
135
- useEffect(() => {
136
- if (!containerRef.current || !apiRef.current) return
137
-
138
- const resizeObserver = new ResizeObserver(() => {
139
- // Use a small timeout to ensure the DataGrid has processed the size change
140
- setTimeout(() => {
141
- if (apiRef.current && rows.length > 0) {
142
- apiRef.current.autosizeColumns({
143
- includeOutliers: true,
144
- includeHeaders: true,
145
- expand: true,
146
- columns: columns.map((col) => col.field),
147
- })
148
- }
149
- }, 100)
150
- })
151
-
152
- resizeObserver.observe(containerRef.current)
153
-
154
- return () => {
155
- resizeObserver.disconnect()
156
- }
157
- }, [apiRef, rows.length, columns])
158
-
159
- // Handle default selection - only use if no selectedItem is explicitly provided
160
- const effectiveSelectedItem = useMemo(() => {
161
- // If selectedItem is explicitly provided, use it (including null)
162
- if (selectedItem !== undefined) {
163
- return selectedItem
164
- }
165
- // If we have an internal selection, use it
166
- if (internalSelectedItem !== null) {
167
- return internalSelectedItem
168
- }
169
- // Otherwise, use first item if selectFirstByDefault is true
170
- if (selectFirstByDefault && data.length > 0) {
171
- const firstItem = data[0]
172
- // Set internal state to first item on initial load
173
- setInternalSelectedItem(firstItem)
174
- return firstItem
175
- }
176
- return null
177
- }, [selectFirstByDefault, data, selectedItem, internalSelectedItem])
178
-
179
- // Handle row click
180
- const handleRowClick = (params: GridRowParams) => {
181
- const item = data.find((item) => {
182
- const rowData = getRowData(item)
183
- return rowData.id === params.id
184
- })
185
-
186
- if (item) {
187
- // Update internal selection state if not controlled by props
188
- if (selectedItem === undefined) {
189
- setInternalSelectedItem(item)
190
- }
191
-
192
- // Call the user's onRowClick callback
193
- if (onRowClick) {
194
- onRowClick(item, params)
195
- }
196
- }
197
- }
198
-
199
- // Get selected row ID for highlighting
200
- const selectedRowId = useMemo(() => {
201
- if (!effectiveSelectedItem || !getItemId) return null
202
- return getItemId(effectiveSelectedItem)
203
- }, [effectiveSelectedItem, getItemId])
204
-
205
- // Default toolbar with filter and quick filter
206
- function DefaultToolbar() {
207
- return (
208
- <Toolbar>
209
- <Box
210
- sx={{
211
- display: "flex",
212
- width: "100%",
213
- gap: 1,
214
- p: 0.5,
215
- alignItems: "center",
216
- }}
217
- >
218
- {title && (
219
- <Typography
220
- variant="h6"
221
- sx={{
222
- fontWeight: 500,
223
- color: "white",
224
- }}
225
- >
226
- {title}
227
- {showCount && ` (${data.length})`}
228
- </Typography>
229
- )}
230
- <Box
231
- sx={{
232
- ml: "auto",
233
- display: "flex",
234
- gap: 0.5,
235
- alignItems: "center",
236
- pr: 1,
237
- }}
238
- >
239
- <FilterPanelTrigger
240
- render={
241
- <ToolbarButton aria-label="Show filters">
242
- <FilterListIcon fontSize="small" />
243
- </ToolbarButton>
244
- }
245
- />
246
- <Divider
247
- orientation="vertical"
248
- flexItem
249
- sx={{
250
- height: "24px",
251
- alignSelf: "center",
252
- }}
253
- />
254
- <QuickFilter
255
- render={(props, state) => (
256
- <Box
257
- {...props}
258
- sx={{
259
- display: "flex",
260
- overflow: "hidden",
261
- }}
262
- >
263
- {!state.expanded && (
264
- <QuickFilterTrigger
265
- render={
266
- <ToolbarButton aria-label="Search">
267
- <SearchIcon fontSize="small" />
268
- </ToolbarButton>
269
- }
270
- />
271
- )}
272
- <Box
273
- sx={{
274
- display: "flex",
275
- overflow: "hidden",
276
- transition: "all 0.3s ease-in-out",
277
- width: state.expanded ? "200px" : "0px",
278
- position: "relative",
279
- }}
280
- >
281
- <Box
282
- sx={{
283
- flex: 1,
284
- position: "relative",
285
- "& .MuiInputBase-root": {
286
- height: "32px",
287
- borderRadius: "16px",
288
- backgroundColor: "#171927",
289
- paddingLeft: "40px",
290
- paddingRight:
291
- state.expanded && state.value !== ""
292
- ? "40px"
293
- : "12px",
294
- color: "white",
295
- fontSize: "14px",
296
- border: "none !important",
297
- outline: "none !important",
298
- boxShadow: "none !important",
299
- "&::before": {
300
- display: "none !important",
301
- border: "none !important",
302
- },
303
- "&::after": {
304
- display: "none !important",
305
- border: "none !important",
306
- },
307
- "&:hover": {
308
- "&::before": {
309
- display: "none !important",
310
- border: "none !important",
311
- },
312
- "&::after": {
313
- display: "none !important",
314
- border: "none !important",
315
- },
316
- },
317
- "&:focus-within": {
318
- outline: "none !important",
319
- boxShadow: "none !important",
320
- "&::before": {
321
- display: "none !important",
322
- border: "none !important",
323
- },
324
- "&::after": {
325
- display: "none !important",
326
- border: "none !important",
327
- },
328
- },
329
- "&.Mui-focused": {
330
- outline: "none !important",
331
- boxShadow: "none !important",
332
- "&::before": {
333
- display: "none !important",
334
- border: "none !important",
335
- },
336
- "&::after": {
337
- display: "none !important",
338
- border: "none !important",
339
- },
340
- },
341
- "& .MuiInputBase-input": {
342
- padding: "8px 0",
343
- border: "none !important",
344
- outline: "none !important",
345
- boxShadow: "none !important",
346
- "&:focus": {
347
- outline: "none !important",
348
- boxShadow: "none !important",
349
- border: "none !important",
350
- },
351
- "&::placeholder": {
352
- color: "rgba(255, 255, 255, 0.3)",
353
- opacity: 1,
354
- },
355
- },
356
- "& fieldset": {
357
- border: "none !important",
358
- display: "none !important",
359
- },
360
- "& .MuiOutlinedInput-notchedOutline": {
361
- border: "none !important",
362
- display: "none !important",
363
- },
364
- },
365
- }}
366
- >
367
- {state.expanded && (
368
- <SearchIcon
369
- fontSize="small"
370
- sx={{
371
- position: "absolute",
372
- left: "12px",
373
- top: "50%",
374
- transform: "translateY(-50%)",
375
- color: "rgba(255, 255, 255, 0.6)",
376
- zIndex: 1,
377
- pointerEvents: "none",
378
- }}
379
- />
380
- )}
381
- <QuickFilterControl placeholder={searchPlaceholder} />
382
- </Box>
383
- {state.expanded && state.value !== "" && (
384
- <QuickFilterClear
385
- render={
386
- <Box
387
- sx={{
388
- position: "absolute",
389
- right: "8px",
390
- top: "50%",
391
- transform: "translateY(-50%)",
392
- zIndex: 1,
393
- }}
394
- >
395
- <Box
396
- sx={{
397
- minWidth: "24px",
398
- width: "24px",
399
- height: "24px",
400
- padding: 0,
401
- color: "rgba(255, 255, 255, 0.6)",
402
- "&:hover": {
403
- backgroundColor:
404
- "rgba(255, 255, 255, 0.1)",
405
- },
406
- }}
407
- >
408
- <ToolbarButton aria-label="Clear">
409
- <ClearIcon fontSize="small" />
410
- </ToolbarButton>
411
- </Box>
412
- </Box>
413
- }
414
- />
415
- )}
416
- </Box>
417
- </Box>
418
- )}
419
- />
420
- </Box>
421
- </Box>
422
- </Toolbar>
423
- )
424
- }
425
-
426
- const ToolbarComponent = CustomToolbar || DefaultToolbar
427
-
428
- return (
429
- <Box
430
- ref={containerRef}
431
- sx={{
432
- height: "100%",
433
- display: "flex",
434
- flexDirection: "column",
435
- // Apply scrollbar styling like in the theme
436
- "& *": {
437
- scrollbarWidth: "none",
438
- msOverflowStyle: "none",
439
- "&::-webkit-scrollbar": {
440
- display: "none",
441
- },
442
- },
443
- "&:hover *": {
444
- scrollbarWidth: "thin",
445
- scrollbarColor: `${theme.palette.divider} transparent`,
446
- "&::-webkit-scrollbar": {
447
- display: "block",
448
- width: "8px",
449
- height: "8px",
450
- },
451
- "&::-webkit-scrollbar-track": {
452
- background: "transparent",
453
- },
454
- "&::-webkit-scrollbar-thumb": {
455
- background: theme.palette.divider,
456
- borderRadius: "4px",
457
- },
458
- "&::-webkit-scrollbar-thumb:hover": {
459
- background: theme.palette.action.hover,
460
- },
461
- },
462
- ...sx,
463
- }}
464
- >
465
- <DataGrid
466
- apiRef={apiRef}
467
- rows={rows}
468
- columns={columns}
469
- onRowClick={handleRowClick}
470
- disableColumnMenu={false}
471
- disableRowSelectionOnClick={true}
472
- disableMultipleRowSelection={true}
473
- hideFooterSelectedRowCount={true}
474
- filterMode="client"
475
- sortingOrder={["desc", "asc"]}
476
- hideFooter={false}
477
- showToolbar={true}
478
- slots={{
479
- toolbar: ToolbarComponent,
480
- }}
481
- initialState={{
482
- sorting: {
483
- sortModel: [],
484
- },
485
- filter: {
486
- filterModel: {
487
- items: [],
488
- },
489
- },
490
- ...dataGridProps?.initialState,
491
- }}
492
- {...dataGridProps}
493
- // Ensure autosize properties are always enabled and not overridden by dataGridProps
494
- autosizeOnMount={true}
495
- autosizeOptions={{
496
- // Merge any custom autosize options first
497
- ...(dataGridProps?.autosizeOptions || {}),
498
- // Force these key properties to always be true to maintain autosize behavior
499
- includeOutliers: true,
500
- includeHeaders: true,
501
- expand: true,
502
- // Auto-size all columns by default (can be overridden by dataGridProps)
503
- columns:
504
- dataGridProps?.autosizeOptions?.columns ||
505
- columns.map((col) => col.field),
506
- }}
507
- sx={{
508
- border: "none",
509
-
510
- width: "100%",
511
- // Remove any MUI overlays and elevation effects
512
- "& .MuiPaper-root": {
513
- boxShadow: "none !important",
514
- },
515
- "& .MuiDataGrid-overlay": {},
516
- "& .MuiDataGrid-main": {
517
- border: "none",
518
-
519
- // Remove any surface or paper overlays
520
- "& .MuiPaper-root": {},
521
- },
522
- "& .MuiDataGrid-container--top [role=row]": {},
523
- "& .MuiDataGrid-topContainer": {
524
- borderBottom: "none !important",
525
- },
526
- "& .MuiDataGrid-columnHeaders": {
527
- border: "none",
528
- borderBottom: "none !important",
529
- },
530
- "& .MuiDataGrid-row": {
531
- cursor: onRowClick ? "pointer" : "default",
532
- border: "none",
533
- margin: "1px 0",
534
- position: "relative",
535
- // Disable all default MUI hover effects
536
- backgroundColor: "transparent !important",
537
- "&:hover": {
538
- backgroundColor: "transparent !important",
539
- "&::before": {
540
- content: '""',
541
- position: "absolute",
542
- top: 0,
543
- left: "16px",
544
- right: "16px",
545
- bottom: 0,
546
- backgroundColor: "action.hover",
547
- borderRadius: "16px",
548
- zIndex: 0,
549
- },
550
- },
551
- // Disable MUI's built-in selection styling completely
552
- "&.Mui-selected": {
553
- backgroundColor: "transparent !important",
554
- "&:hover": {
555
- backgroundColor: "transparent !important",
556
- },
557
- },
558
- // Highlight selected row with a distinct color using data attribute
559
- ...(selectedRowId !== null && {
560
- [`&[data-id="${selectedRowId}"]`]: {
561
- backgroundColor: "transparent !important",
562
- "&::before": {
563
- content: '""',
564
- position: "absolute",
565
- top: 0,
566
- left: "16px",
567
- right: "16px",
568
- bottom: 0,
569
- backgroundColor: "rgba(255, 255, 255, 0.08) !important",
570
- borderRadius: "16px",
571
- zIndex: 0,
572
- },
573
- "&:hover": {
574
- backgroundColor: "transparent !important",
575
- },
576
- "&:hover::before": {
577
- backgroundColor: "rgba(255, 255, 255, 0.12) !important",
578
- },
579
- },
580
- }),
581
- },
582
- "& .MuiDataGrid-cell--textLeft": {
583
- paddingLeft: "40px",
584
- },
585
- "& .MuiDataGrid-cell": {
586
- border: "none",
587
- position: "relative",
588
- zIndex: 1,
589
- "&:focus": {
590
- outline: "none",
591
- },
592
- "&:focus-within": {
593
- outline: "none",
594
- },
595
- "&:hover": {
596
- backgroundColor: "transparent !important",
597
- },
598
- },
599
- "& .MuiDataGrid-columnHeader": {
600
- border: "none",
601
- paddingLeft: "40px",
602
- paddingRight: "40px",
603
-
604
- "& .MuiDataGrid-columnHeaderTitle": {
605
- color: "rgba(255, 255, 255, 0.6)",
606
- },
607
- },
608
- "& .MuiDataGrid-toolbarContainer": {
609
- padding: "8px",
610
- border: "none !important",
611
- borderBottom: "none !important",
612
-
613
- "& .MuiBox-root": {},
614
- "& .MuiFormControl-root": {},
615
- "& .MuiInputBase-root": {},
616
- "& .MuiPaper-root": {
617
- boxShadow: "none !important",
618
- },
619
- "& *": {
620
- borderBottom: "none !important",
621
- },
622
- },
623
- "& .MuiDataGrid-toolbar": {
624
- borderBottom: "none !important",
625
- },
626
- "& .MuiDataGrid-toolbarFilterList": {
627
- border: "none",
628
- },
629
- "& .MuiDataGrid-withBorderColor": {
630
- borderColor: "transparent !important",
631
- },
632
- "& .MuiDataGrid-columnSeparator": {
633
- display: "none",
634
- },
635
- "& .MuiDataGrid-footerContainer": {
636
- display: "none",
637
- },
638
- "& .MuiDataGrid-filler": {
639
- border: "none !important",
640
- borderTop: "none !important",
641
- borderBottom: "none !important",
642
- borderLeft: "none !important",
643
- borderRight: "none !important",
644
-
645
- "--rowBorderColor": "none !important",
646
- },
647
- // Remove any remaining MUI background overlays
648
- "& .MuiBackdrop-root": {},
649
- "& .MuiModal-backdrop": {},
650
- ...dataGridProps?.sx,
651
- }}
652
- />
653
- </Box>
654
- )
655
- },
656
- ),
657
- )
658
-
659
- WandelbotsDataGrid.displayName = "WandelbotsDataGrid"