@wandelbots/wandelbots-js-react-components 2.34.2 → 2.35.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.
Files changed (65) hide show
  1. package/dist/components/AppHeader.d.ts +34 -0
  2. package/dist/components/AppHeader.d.ts.map +1 -0
  3. package/dist/components/CycleTimer.d.ts +33 -16
  4. package/dist/components/CycleTimer.d.ts.map +1 -1
  5. package/dist/components/DataGrid.d.ts +66 -0
  6. package/dist/components/DataGrid.d.ts.map +1 -0
  7. package/dist/components/LogPanel.d.ts +38 -0
  8. package/dist/components/LogPanel.d.ts.map +1 -0
  9. package/dist/components/LogStore.d.ts +12 -0
  10. package/dist/components/LogStore.d.ts.map +1 -0
  11. package/dist/components/LogViewer.d.ts +46 -0
  12. package/dist/components/LogViewer.d.ts.map +1 -0
  13. package/dist/components/ProgramControl.d.ts +8 -2
  14. package/dist/components/ProgramControl.d.ts.map +1 -1
  15. package/dist/components/ProgramStateIndicator.d.ts +1 -1
  16. package/dist/components/ProgramStateIndicator.d.ts.map +1 -1
  17. package/dist/components/RobotCard.d.ts +103 -0
  18. package/dist/components/RobotCard.d.ts.map +1 -0
  19. package/dist/components/RobotListItem.d.ts +34 -0
  20. package/dist/components/RobotListItem.d.ts.map +1 -0
  21. package/dist/components/RobotSetupReadinessIndicator.d.ts +31 -0
  22. package/dist/components/RobotSetupReadinessIndicator.d.ts.map +1 -0
  23. package/dist/components/RobotSetupReadinessIndicator.test.d.ts +2 -0
  24. package/dist/components/RobotSetupReadinessIndicator.test.d.ts.map +1 -0
  25. package/dist/components/TabBar.d.ts +30 -0
  26. package/dist/components/TabBar.d.ts.map +1 -0
  27. package/dist/components/robots/Robot.d.ts +3 -2
  28. package/dist/components/robots/Robot.d.ts.map +1 -1
  29. package/dist/components/robots/manufacturerHomePositions.d.ts +21 -0
  30. package/dist/components/robots/manufacturerHomePositions.d.ts.map +1 -0
  31. package/dist/icons/DropdownArrowIcon.d.ts +3 -0
  32. package/dist/icons/DropdownArrowIcon.d.ts.map +1 -0
  33. package/dist/icons/index.d.ts +1 -0
  34. package/dist/icons/index.d.ts.map +1 -1
  35. package/dist/index.cjs +50 -50
  36. package/dist/index.cjs.map +1 -1
  37. package/dist/index.d.ts +10 -0
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +11332 -9473
  40. package/dist/index.js.map +1 -1
  41. package/dist/themes/createDarkTheme.d.ts.map +1 -1
  42. package/package.json +2 -1
  43. package/src/components/AppHeader.md +84 -0
  44. package/src/components/AppHeader.tsx +199 -0
  45. package/src/components/CycleTimer.tsx +384 -159
  46. package/src/components/DataGrid.tsx +659 -0
  47. package/src/components/LogPanel.tsx +69 -0
  48. package/src/components/LogStore.ts +44 -0
  49. package/src/components/LogViewer.tsx +370 -0
  50. package/src/components/ProgramControl.tsx +27 -12
  51. package/src/components/ProgramStateIndicator.tsx +25 -8
  52. package/src/components/RobotCard.tsx +568 -0
  53. package/src/components/RobotListItem.tsx +150 -0
  54. package/src/components/RobotSetupReadinessIndicator.test.tsx +60 -0
  55. package/src/components/RobotSetupReadinessIndicator.tsx +124 -0
  56. package/src/components/TabBar.tsx +144 -0
  57. package/src/components/robots/Robot.tsx +5 -2
  58. package/src/components/robots/manufacturerHomePositions.ts +76 -0
  59. package/src/i18n/locales/de/translations.json +8 -1
  60. package/src/i18n/locales/en/translations.json +8 -1
  61. package/src/icons/DropdownArrowIcon.tsx +13 -0
  62. package/src/icons/chevronDown.svg +3 -0
  63. package/src/icons/index.ts +1 -0
  64. package/src/index.ts +14 -0
  65. package/src/themes/createDarkTheme.ts +75 -1
@@ -1 +1 @@
1
- {"version":3,"file":"createDarkTheme.d.ts","sourceRoot":"","sources":["../../src/themes/createDarkTheme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,KAAK,EAAE,MAAM,eAAe,CAAA;AAEjE,wBAAgB,eAAe,IAAI,KAAK,CAgSvC"}
1
+ {"version":3,"file":"createDarkTheme.d.ts","sourceRoot":"","sources":["../../src/themes/createDarkTheme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,KAAK,EAAE,MAAM,eAAe,CAAA;AAEjE,wBAAgB,eAAe,IAAI,KAAK,CA0WvC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wandelbots/wandelbots-js-react-components",
3
- "version": "2.34.2",
3
+ "version": "2.35.0",
4
4
  "description": "React UI toolkit for building applications on top of the Wandelbots platform",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -139,6 +139,7 @@
139
139
  "dependencies": {
140
140
  "@monaco-editor/react": "^4.7.0",
141
141
  "@mui/x-charts": "^8.9.0",
142
+ "@mui/x-data-grid": "^8.10.1",
142
143
  "@shikijs/monaco": "^3.1.0",
143
144
  "i18next-browser-languagedetector": "^8.0.4",
144
145
  "lodash-es": "^4.17.21",
@@ -0,0 +1,84 @@
1
+ # AppHeader Component
2
+
3
+ A navigation header component that displays the current application's icon and name, with an optional dropdown menu for switching between different applications.
4
+
5
+ ## Features
6
+
7
+ - **App Branding**: Displays the current app's icon and name with custom typography
8
+ - **App Switching**: Dropdown menu with blur backdrop for navigating to other apps
9
+ - **Responsive Design**: Uses MUI AppBar for consistent styling
10
+ - **Accessibility**: Proper ARIA labels and keyboard navigation
11
+ - **Flexible Navigation**: Supports both URL navigation and custom click handlers
12
+
13
+ ## Usage
14
+
15
+ ```tsx
16
+ import {
17
+ AppHeader,
18
+ type AppItem,
19
+ } from "@wandelbots/wandelbots-js-react-components"
20
+ import { Home, Settings, Person } from "@mui/icons-material"
21
+
22
+ const apps: AppItem[] = [
23
+ {
24
+ id: "dashboard",
25
+ name: "Dashboard",
26
+ icon: <Home />,
27
+ href: "/dashboard",
28
+ },
29
+ {
30
+ id: "settings",
31
+ name: "Settings",
32
+ icon: <Settings />,
33
+ onClick: () => navigateToSettings(),
34
+ },
35
+ ]
36
+
37
+ function MyApp() {
38
+ return (
39
+ <AppHeader
40
+ appIcon={<Person />}
41
+ appName="Robot Control Studio"
42
+ apps={apps}
43
+ onAppSelect={(app) => console.log("Selected:", app.name)}
44
+ />
45
+ )
46
+ }
47
+ ```
48
+
49
+ ## Props
50
+
51
+ ### AppHeaderProps
52
+
53
+ - **appIcon** (`ReactNode`): Icon component for the current application
54
+ - **appName** (`string`): Display name of the current application
55
+ - **apps** (`AppItem[]`, optional): Array of available apps for the dropdown menu
56
+ - **onAppSelect** (`(app: AppItem) => void`, optional): Callback when an app is selected
57
+ - **sx** (`SxProps`, optional): Additional MUI styling
58
+
59
+ ### AppItem
60
+
61
+ - **id** (`string`): Unique identifier for the app
62
+ - **name** (`string`): Display name of the app
63
+ - **icon** (`ReactNode`): Icon component to display
64
+ - **href** (`string`, optional): URL to navigate to
65
+ - **onClick** (`() => void`, optional): Custom click handler
66
+
67
+ ## Styling
68
+
69
+ The component uses the specified typography:
70
+
71
+ - Font weight: 700 (Bold)
72
+ - Font size: 20px
73
+ - Line height: 24px
74
+ - Letter spacing: 0px
75
+
76
+ The dropdown arrow uses a custom SVG icon with 56% opacity.
77
+
78
+ ## Behavior
79
+
80
+ - When apps are provided, a dropdown arrow appears on the right side
81
+ - Clicking the arrow opens a menu with available apps
82
+ - The background blurs when the menu is open to focus attention
83
+ - Apps can navigate via URL (`href`) or custom handler (`onClick`)
84
+ - The menu closes automatically when an app is selected or when clicking outside
@@ -0,0 +1,199 @@
1
+ import {
2
+ alpha,
3
+ AppBar,
4
+ Backdrop,
5
+ Box,
6
+ IconButton,
7
+ Menu,
8
+ MenuItem,
9
+ type SxProps,
10
+ Toolbar,
11
+ Typography,
12
+ } from "@mui/material"
13
+ import { observer } from "mobx-react-lite"
14
+ import { type MouseEvent, type ReactNode, useState } from "react"
15
+ import { externalizeComponent } from "../externalizeComponent"
16
+ import { DropdownArrowIcon } from "../icons/DropdownArrowIcon"
17
+
18
+ export type AppItem = {
19
+ /** Unique identifier for the app */
20
+ id: string
21
+ /** Display name of the app */
22
+ name: string
23
+ /** Icon component to display */
24
+ icon: ReactNode
25
+ /** URL or callback to navigate to the app */
26
+ href?: string
27
+ /** Click handler for the app */
28
+ onClick?: () => void
29
+ }
30
+
31
+ export type AppHeaderProps = {
32
+ /** Current app icon */
33
+ appIcon: ReactNode
34
+ /** Current app name */
35
+ appName: string
36
+ /** List of other available apps */
37
+ apps?: AppItem[]
38
+ /** Callback when an app is selected */
39
+ onAppSelect?: (app: AppItem) => void
40
+ /** Additional styling */
41
+ sx?: SxProps
42
+ }
43
+
44
+ /**
45
+ * A top navigation header component that displays the current app and provides
46
+ * a dropdown menu to navigate to other apps.
47
+ */
48
+ export const AppHeader = externalizeComponent(
49
+ observer((props: AppHeaderProps) => {
50
+ const { appIcon, appName, apps = [], onAppSelect, sx } = props
51
+ const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null)
52
+ const isMenuOpen = Boolean(anchorEl)
53
+
54
+ const handleMenuOpen = (event: MouseEvent<HTMLElement>) => {
55
+ setAnchorEl(event.currentTarget)
56
+ }
57
+
58
+ const handleMenuClose = () => {
59
+ setAnchorEl(null)
60
+ }
61
+
62
+ const handleAppSelect = (app: AppItem) => {
63
+ handleMenuClose()
64
+
65
+ if (app.onClick) {
66
+ app.onClick()
67
+ } else if (app.href) {
68
+ window.location.href = app.href
69
+ }
70
+
71
+ onAppSelect?.(app)
72
+ }
73
+
74
+ return (
75
+ <>
76
+ <AppBar
77
+ position="static"
78
+ sx={{
79
+ boxShadow: "none",
80
+ backgroundImage: "none",
81
+ "& .MuiAppBar-root": {
82
+ backgroundImage: "none",
83
+ backgroundColor: "transparent",
84
+ },
85
+ ...sx,
86
+ }}
87
+ >
88
+ <Toolbar sx={{ minHeight: "64px !important" }}>
89
+ {/* App Icon */}
90
+ <Box sx={{ mr: 2, display: "flex", alignItems: "center" }}>
91
+ {appIcon}
92
+ </Box>
93
+
94
+ {/* App Name and Dropdown */}
95
+ <Box sx={{ display: "flex", alignItems: "center", flexGrow: 1 }}>
96
+ <Typography
97
+ variant="h6"
98
+ component="div"
99
+ sx={{
100
+ fontWeight: 700,
101
+ fontSize: "20px",
102
+ lineHeight: "24px",
103
+ letterSpacing: 0,
104
+ }}
105
+ >
106
+ {appName}
107
+ </Typography>
108
+
109
+ {/* Dropdown Button */}
110
+ {apps.length > 0 && (
111
+ <IconButton
112
+ color="inherit"
113
+ aria-label="switch app"
114
+ aria-controls="app-menu"
115
+ aria-haspopup="true"
116
+ onClick={handleMenuOpen}
117
+ sx={{
118
+ ml: 2,
119
+ width: 30,
120
+ height: 30,
121
+ borderRadius: "8px",
122
+ padding: "5px",
123
+ backgroundColor: (theme) =>
124
+ alpha(theme.palette.common.white, 0.1),
125
+ opacity: 1,
126
+ "&:hover": {
127
+ backgroundColor: (theme) =>
128
+ alpha(theme.palette.common.white, 0.16),
129
+ },
130
+ "& .MuiSvgIcon-root": {
131
+ fontSize: "10px",
132
+ width: "10px",
133
+ height: "8px",
134
+ },
135
+ }}
136
+ >
137
+ <DropdownArrowIcon />
138
+ </IconButton>
139
+ )}
140
+ </Box>
141
+ </Toolbar>
142
+ </AppBar>
143
+
144
+ {/* Backdrop for blur effect */}
145
+ <Backdrop
146
+ open={isMenuOpen}
147
+ onClick={handleMenuClose}
148
+ sx={{
149
+ backdropFilter: "blur(4px)",
150
+ backgroundColor: "rgba(0, 0, 0, 0.3)",
151
+ zIndex: (theme) => theme.zIndex.modal - 1,
152
+ }}
153
+ />
154
+
155
+ {/* Dropdown Menu */}
156
+ <Menu
157
+ id="app-menu"
158
+ anchorEl={anchorEl}
159
+ open={isMenuOpen}
160
+ onClose={handleMenuClose}
161
+ anchorOrigin={{
162
+ vertical: "bottom",
163
+ horizontal: "left",
164
+ }}
165
+ transformOrigin={{
166
+ vertical: "top",
167
+ horizontal: "left",
168
+ }}
169
+ sx={{
170
+ zIndex: (theme) => theme.zIndex.modal,
171
+ "& .MuiPaper-root": {
172
+ minWidth: 200,
173
+ mt: 1,
174
+ },
175
+ }}
176
+ >
177
+ {apps.map((app) => (
178
+ <MenuItem
179
+ key={app.id}
180
+ onClick={() => handleAppSelect(app)}
181
+ sx={{
182
+ display: "flex",
183
+ alignItems: "center",
184
+ gap: 2,
185
+ py: 1.5,
186
+ px: 2,
187
+ }}
188
+ >
189
+ <Box sx={{ display: "flex", alignItems: "center" }}>
190
+ {app.icon}
191
+ </Box>
192
+ <Typography variant="body1">{app.name}</Typography>
193
+ </MenuItem>
194
+ ))}
195
+ </Menu>
196
+ </>
197
+ )
198
+ }),
199
+ )