@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,150 +0,0 @@
1
- import ErrorIcon from "@mui/icons-material/Error"
2
- import { Box, Divider, Typography, useTheme } from "@mui/material"
3
- import { observer } from "mobx-react-lite"
4
- import type { ComponentType } from "react"
5
- import { externalizeComponent } from "../externalizeComponent"
6
- import { RobotIcon } from "../icons"
7
- import {
8
- RobotSetupReadinessIndicator,
9
- RobotSetupReadinessState,
10
- } from "./RobotSetupReadinessIndicator"
11
-
12
- export interface RobotListItemProps {
13
- /** The name of the robot */
14
- robotName: string
15
- /** The type/model of the robot (will try to derive from nova if not provided) */
16
- robotType?: string
17
- /** The current setup readiness state of the robot */
18
- setupState: RobotSetupReadinessState
19
- /**
20
- * Component to render for the precondition indicator.
21
- * Defaults to RobotSetupReadinessIndicator.
22
- * Pass null or undefined to hide the indicator.
23
- */
24
- PreconditionComponent?: ComponentType<{
25
- setupState: RobotSetupReadinessState
26
- }> | null
27
- /** Additional CSS class name */
28
- className?: string
29
- }
30
-
31
- /**
32
- * A list item component that displays robot information and setup readiness state.
33
- *
34
- * Features:
35
- * - Shows robot name, type, and customizable precondition component
36
- * - Color-coded icon based on readiness state (robot icon for ready, warning for issues)
37
- * - Styled with consistent border, background, and spacing
38
- * - Responsive layout with proper spacing and alignment
39
- * - Flexible precondition component that can be customized or hidden
40
- */
41
- export const RobotListItem = externalizeComponent(
42
- observer(
43
- ({
44
- robotName,
45
- robotType,
46
- setupState,
47
- PreconditionComponent = RobotSetupReadinessIndicator,
48
- className,
49
- }: RobotListItemProps) => {
50
- const theme = useTheme()
51
-
52
- // Use provided robot type or default
53
- const displayRobotType = robotType || "Robot"
54
-
55
- const isReady = setupState === RobotSetupReadinessState.READY
56
-
57
- return (
58
- <Box
59
- className={className}
60
- sx={{
61
- border: `1px solid ${theme.palette.divider}`,
62
- background:
63
- theme.palette.backgroundPaperElevation?.[8] || "#292B3F",
64
- borderRadius: "8px",
65
- padding: "20px",
66
- display: "flex",
67
- alignItems: "center",
68
- justifyContent: "space-between",
69
- opacity: 1,
70
- }}
71
- >
72
- <Box
73
- sx={{
74
- display: "flex",
75
- alignItems: "center",
76
- gap: 2,
77
- flex: 1,
78
- }}
79
- >
80
- {/* Robot/Warning Icon */}
81
- {isReady ? (
82
- <Box
83
- sx={{
84
- fontSize: 24,
85
- display: "flex",
86
- alignItems: "center",
87
- justifyContent: "center",
88
- width: 24,
89
- height: 24,
90
- "& svg": {
91
- fill: `${theme.palette.primary.main} !important`,
92
- },
93
- "& svg path": {
94
- fill: `${theme.palette.primary.main} !important`,
95
- },
96
- }}
97
- >
98
- <RobotIcon />
99
- </Box>
100
- ) : (
101
- <ErrorIcon
102
- sx={{
103
- color: theme.palette.error.main,
104
- fontSize: 24,
105
- }}
106
- />
107
- )}
108
-
109
- {/* Robot Name */}
110
- <Typography
111
- variant="body1"
112
- sx={{
113
- fontWeight: 500,
114
- color: theme.palette.text.primary,
115
- }}
116
- >
117
- {robotName}
118
- </Typography>
119
-
120
- {/* Divider */}
121
- <Divider
122
- orientation="vertical"
123
- flexItem
124
- sx={{
125
- backgroundColor: theme.palette.text.secondary,
126
- opacity: 0.3,
127
- width: "1px",
128
- }}
129
- />
130
-
131
- {/* Robot Type */}
132
- <Typography
133
- variant="body2"
134
- sx={{
135
- color: theme.palette.text.secondary,
136
- }}
137
- >
138
- {displayRobotType}
139
- </Typography>
140
- </Box>
141
-
142
- {/* Setup Readiness Indicator */}
143
- {PreconditionComponent && (
144
- <PreconditionComponent setupState={setupState} />
145
- )}
146
- </Box>
147
- )
148
- },
149
- ),
150
- )
@@ -1,60 +0,0 @@
1
- import { render, screen } from "@testing-library/react"
2
- import { describe, expect, it } from "vitest"
3
- import {
4
- RobotSetupReadinessIndicator,
5
- RobotSetupReadinessState,
6
- } from "./RobotSetupReadinessIndicator"
7
-
8
- describe("RobotSetupReadinessIndicator", () => {
9
- it("renders ready state correctly", () => {
10
- render(
11
- <RobotSetupReadinessIndicator
12
- setupState={RobotSetupReadinessState.READY}
13
- />,
14
- )
15
-
16
- expect(screen.getByText("Ready")).toBeInTheDocument()
17
- })
18
-
19
- it("renders robot disconnected state correctly", () => {
20
- render(
21
- <RobotSetupReadinessIndicator
22
- setupState={RobotSetupReadinessState.ROBOT_DISCONNECTED}
23
- />,
24
- )
25
-
26
- expect(screen.getByText("Robot disconnected")).toBeInTheDocument()
27
- })
28
-
29
- it("renders precondition not fulfilled state correctly", () => {
30
- render(
31
- <RobotSetupReadinessIndicator
32
- setupState={RobotSetupReadinessState.PRECONDITION_NOT_FULFILLED}
33
- />,
34
- )
35
-
36
- expect(screen.getByText("Precondition not fulfilled")).toBeInTheDocument()
37
- })
38
-
39
- it("applies correct CSS class when provided", () => {
40
- const { container } = render(
41
- <RobotSetupReadinessIndicator
42
- setupState={RobotSetupReadinessState.READY}
43
- className="test-class"
44
- />,
45
- )
46
-
47
- expect(container.firstChild).toHaveClass("test-class")
48
- })
49
-
50
- it("renders indicator circle", () => {
51
- render(
52
- <RobotSetupReadinessIndicator
53
- setupState={RobotSetupReadinessState.READY}
54
- />,
55
- )
56
-
57
- // Check if the component is rendered - it's a chip, not a button
58
- expect(screen.getByText("Ready")).toBeInTheDocument()
59
- })
60
- })
@@ -1,124 +0,0 @@
1
- import { Box, Chip, Typography, useTheme } from "@mui/material"
2
- import { observer } from "mobx-react-lite"
3
- import { useTranslation } from "react-i18next"
4
- import { externalizeComponent } from "../externalizeComponent"
5
-
6
- /**
7
- * Enum representing the robot setup readiness state
8
- */
9
- export enum RobotSetupReadinessState {
10
- /** Preconditions are not fulfilled for robot operation */
11
- PRECONDITION_NOT_FULFILLED = "PRECONDITION_NOT_FULFILLED",
12
- /** Robot is disconnected from the system */
13
- ROBOT_DISCONNECTED = "ROBOT_DISCONNECTED",
14
- /** Robot is ready for operation */
15
- READY = "READY",
16
- }
17
-
18
- export interface RobotSetupReadinessIndicatorProps {
19
- /** The current setup readiness state of the robot */
20
- setupState: RobotSetupReadinessState
21
- /** Additional CSS class name */
22
- className?: string
23
- }
24
-
25
- /**
26
- * A state indicator component that displays the current robot setup readiness state.
27
- *
28
- * Features:
29
- * - Shows three states: Precondition not fulfilled, Robot disconnected, Ready
30
- * - Color-coded based on state (ready: tertiary/main, others: error/main)
31
- * - Rendered as Material-UI filled chip with paper-elevation-11 background
32
- * - Includes colored circle indicator (8px width)
33
- * - Localization support via react-i18next
34
- */
35
- export const RobotSetupReadinessIndicator = externalizeComponent(
36
- observer(({ setupState, className }: RobotSetupReadinessIndicatorProps) => {
37
- const theme = useTheme()
38
- const { t } = useTranslation()
39
-
40
- const getStateInfo = () => {
41
- switch (setupState) {
42
- case RobotSetupReadinessState.READY:
43
- return {
44
- label: t("RobotSetupReadinessIndicator.Ready.lb"),
45
- indicatorColor:
46
- theme.palette.tertiary?.main || theme.palette.primary.main,
47
- backgroundColor:
48
- theme.palette.backgroundPaperElevation?.[11] ||
49
- theme.palette.background.paper,
50
- textColor: theme.palette.secondary.contrastText,
51
- }
52
- case RobotSetupReadinessState.ROBOT_DISCONNECTED:
53
- return {
54
- label: t("RobotSetupReadinessIndicator.RobotDisconnected.lb"),
55
- indicatorColor: theme.palette.error.main,
56
- backgroundColor:
57
- theme.palette.backgroundPaperElevation?.[11] ||
58
- theme.palette.background.paper,
59
- textColor: theme.palette.secondary.contrastText,
60
- }
61
- case RobotSetupReadinessState.PRECONDITION_NOT_FULFILLED:
62
- default:
63
- return {
64
- label: t(
65
- "RobotSetupReadinessIndicator.PreconditionNotFulfilled.lb",
66
- ),
67
- indicatorColor: theme.palette.error.main,
68
- backgroundColor:
69
- theme.palette.backgroundPaperElevation?.[11] ||
70
- theme.palette.background.paper,
71
- textColor: theme.palette.secondary.contrastText,
72
- }
73
- }
74
- }
75
-
76
- const { label, indicatorColor, backgroundColor, textColor } = getStateInfo()
77
-
78
- return (
79
- <Chip
80
- className={className}
81
- label={
82
- <Box
83
- sx={{
84
- display: "flex",
85
- alignItems: "center",
86
- gap: 1,
87
- }}
88
- >
89
- <Box
90
- sx={{
91
- width: 8,
92
- height: 8,
93
- borderRadius: "50%",
94
- backgroundColor: indicatorColor,
95
- flexShrink: 0,
96
- }}
97
- />
98
- <Typography
99
- variant="body2"
100
- sx={{
101
- color: textColor,
102
- fontSize: "0.75rem", // Smaller than body2
103
- lineHeight: 1.2,
104
- }}
105
- >
106
- {label}
107
- </Typography>
108
- </Box>
109
- }
110
- variant="filled"
111
- sx={{
112
- backgroundColor,
113
- color: theme.palette.getContrastText(backgroundColor),
114
- fontWeight: 500,
115
- height: "auto",
116
- "& .MuiChip-label": {
117
- paddingX: 1.5,
118
- paddingY: 0.5,
119
- },
120
- }}
121
- />
122
- )
123
- }),
124
- )
@@ -1,144 +0,0 @@
1
- import type { SxProps } from "@mui/material"
2
- import { Box, Tab, Tabs } from "@mui/material"
3
- import { observer } from "mobx-react-lite"
4
- import { useState } from "react"
5
- import { externalizeComponent } from "../externalizeComponent"
6
-
7
- export interface TabItem {
8
- /** Unique identifier for the tab */
9
- id: string
10
- /** Label text for the tab */
11
- label: string
12
- /** Content to display when tab is active */
13
- content: React.ReactNode
14
- /** Optional icon component to display with the tab */
15
- icon?: React.ReactElement
16
- }
17
-
18
- export interface TabBarProps {
19
- /** Array of tab items to display */
20
- items: TabItem[]
21
- /** Default active tab index */
22
- defaultActiveTab?: number
23
- /** Callback when tab changes */
24
- onTabChange?: (index: number) => void
25
- /** Additional styling */
26
- sx?: SxProps
27
- }
28
-
29
- interface TabPanelProps {
30
- children?: React.ReactNode
31
- index: number
32
- value: number
33
- }
34
-
35
- function TabPanel(props: TabPanelProps) {
36
- const { children, value, index, ...other } = props
37
-
38
- return (
39
- <div
40
- role="tabpanel"
41
- hidden={value !== index}
42
- id={`tabpanel-${index}`}
43
- aria-labelledby={`tab-${index}`}
44
- {...other}
45
- >
46
- {value === index && <Box>{children}</Box>}
47
- </div>
48
- )
49
- }
50
-
51
- /**
52
- * A styled tab bar component with configurable tabs and content.
53
- * Features the same styling as the Wandelbots design system with rounded tabs
54
- * and smooth transitions.
55
- */
56
- export const TabBar = externalizeComponent(
57
- observer((props: TabBarProps) => {
58
- const { items, defaultActiveTab = 0, onTabChange, sx } = props
59
- const [activeTab, setActiveTab] = useState(defaultActiveTab)
60
-
61
- const handleTabChange = (
62
- _event: React.SyntheticEvent,
63
- newValue: number,
64
- ) => {
65
- setActiveTab(newValue)
66
- onTabChange?.(newValue)
67
- }
68
-
69
- return (
70
- <Box
71
- sx={{ height: "100%", display: "flex", flexDirection: "column", ...sx }}
72
- >
73
- {/* Tabs */}
74
- <Box sx={{ px: 3, pt: 3, pb: 3 }}>
75
- <Tabs
76
- value={activeTab}
77
- onChange={handleTabChange}
78
- sx={{
79
- minHeight: "auto",
80
- backgroundColor: "transparent",
81
- mt: 3,
82
- "& .MuiTabs-indicator": {
83
- display: "none", // Hide the default indicator
84
- },
85
- "& .MuiTabs-flexContainer": {
86
- gap: 2,
87
- },
88
- }}
89
- >
90
- {items.map((item, index) => (
91
- <Tab
92
- key={item.id}
93
- label={item.label}
94
- icon={item.icon}
95
- iconPosition="start"
96
- disableRipple
97
- sx={{
98
- minHeight: "auto",
99
- minWidth: "auto",
100
- padding: "4px 8px",
101
- borderRadius: "10px",
102
- backgroundColor: (theme) =>
103
- theme.palette.backgroundPaperElevation?.[11] || "#32344B",
104
- color: "text.primary",
105
- opacity: activeTab === index ? 1 : 0.38,
106
- textTransform: "none",
107
- fontWeight: 500,
108
- transition: "all 0.2s ease-in-out",
109
- "&:hover": {
110
- opacity: activeTab === index ? 1 : 0.6,
111
- },
112
- "&.Mui-selected": {
113
- opacity: 1,
114
- backgroundColor: (theme) =>
115
- theme.palette.backgroundPaperElevation?.[11] || "#32344B",
116
- color: "text.primary",
117
- },
118
- "&:focus": {
119
- outline: "none",
120
- },
121
- "&:active": {
122
- transform: "none",
123
- },
124
- }}
125
- />
126
- ))}
127
- </Tabs>
128
- </Box>
129
-
130
- {/* Border line */}
131
- <Box sx={{ mx: 3, borderBottom: 1, borderColor: "divider" }} />
132
-
133
- {/* Tab Content */}
134
- <Box sx={{ flex: 1, overflow: "auto" }}>
135
- {items.map((item, index) => (
136
- <TabPanel key={item.id} value={activeTab} index={index}>
137
- {item.content}
138
- </TabPanel>
139
- ))}
140
- </Box>
141
- </Box>
142
- )
143
- }),
144
- )
@@ -1,76 +0,0 @@
1
- import { Manufacturer } from "@wandelbots/nova-api/v1"
2
-
3
- /**
4
- * Default home configs for different robot manufacturers.
5
- * These joint configurations represent safe home configs for each manufacturer's robots.
6
- * All angles are in radians.
7
- */
8
- export const MANUFACTURER_HOME_CONFIGS: Record<Manufacturer, number[]> = {
9
- [Manufacturer.Abb]: [0.0, 0.0, 0.0, 0.0, Math.PI / 2, 0.0, 0.0],
10
- [Manufacturer.Fanuc]: [0.0, 0.0, 0.0, 0.0, -Math.PI / 2, 0.0, 0.0],
11
- [Manufacturer.Yaskawa]: [0.0, 0.0, 0.0, 0.0, -Math.PI / 2, 0.0, 0.0],
12
- [Manufacturer.Kuka]: [
13
- 0.0,
14
- -Math.PI / 2,
15
- Math.PI / 2,
16
- 0.0,
17
- Math.PI / 2,
18
- 0.0,
19
- 0.0,
20
- ],
21
- [Manufacturer.Universalrobots]: [
22
- 0.0,
23
- -Math.PI / 2,
24
- -Math.PI / 2,
25
- -Math.PI / 2,
26
- Math.PI / 2,
27
- -Math.PI / 2,
28
- 0.0,
29
- ],
30
- }
31
-
32
- /**
33
- * Extracts manufacturer from modelFromController string.
34
- * @param modelFromController - String in format "Manufacturer_ModelName"
35
- * @returns Manufacturer enum value or null if not recognized
36
- */
37
- export function extractManufacturer(
38
- modelFromController: string,
39
- ): Manufacturer | null {
40
- const [manufacturerString] = modelFromController.split("_")
41
-
42
- // Handle the mapping from string to enum
43
- switch (manufacturerString) {
44
- case "ABB":
45
- return Manufacturer.Abb
46
- case "FANUC":
47
- return Manufacturer.Fanuc
48
- case "YASKAWA":
49
- return Manufacturer.Yaskawa
50
- case "KUKA":
51
- return Manufacturer.Kuka
52
- case "UniversalRobots":
53
- return Manufacturer.Universalrobots
54
- default:
55
- return null
56
- }
57
- }
58
-
59
- /**
60
- * Gets the default home config for a robot based on its model identifier.
61
- * @param modelFromController - String in format "Manufacturer_ModelName"
62
- * @param defaultJointConfig - Optional custom default configuration to use if manufacturer not found
63
- * @returns Array of joint positions in radians, or null if no configuration available
64
- */
65
- export function getDefaultHomeConfig(
66
- modelFromController: string,
67
- defaultJointConfig?: number[],
68
- ): number[] | null {
69
- const manufacturer = extractManufacturer(modelFromController)
70
-
71
- if (manufacturer && manufacturer in MANUFACTURER_HOME_CONFIGS) {
72
- return MANUFACTURER_HOME_CONFIGS[manufacturer]
73
- }
74
-
75
- return defaultJointConfig || null
76
- }
@@ -1,13 +0,0 @@
1
- import { SvgIcon, type SvgIconProps } from "@mui/material"
2
-
3
- export const DropdownArrowIcon = (props: SvgIconProps) => {
4
- return (
5
- <SvgIcon {...props} viewBox="0 0 10 8">
6
- <path
7
- d="M8.825 0.9125L5 4.72917L1.175 0.9125L0 2.0875L5 7.0875L10 2.0875L8.825 0.9125Z"
8
- fill="currentColor"
9
- fillOpacity="0.56"
10
- />
11
- </SvgIcon>
12
- )
13
- }
@@ -1,3 +0,0 @@
1
- <svg width="10" height="8" viewBox="0 0 10 8" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M8.825 0.9125L5 4.72917L1.175 0.9125L0 2.0875L5 7.0875L10 2.0875L8.825 0.9125Z" fill="currentColor"/>
3
- </svg>