@wandelbots/wandelbots-js-react-components 1.3.1 → 1.4.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 (78) hide show
  1. package/package.json +18 -8
  2. package/src/components/3d-viewport/CoordinateSystemTransform.tsx +44 -0
  3. package/src/components/3d-viewport/PresetEnvironment.tsx +78 -0
  4. package/src/components/3d-viewport/SafetyZonesRenderer.tsx +55 -0
  5. package/src/components/LoadingButton.stories.tsx +61 -0
  6. package/src/components/LoadingButton.tsx +19 -0
  7. package/src/components/LoadingCover.tsx +75 -0
  8. package/src/components/ThemeSelect.tsx +49 -0
  9. package/src/components/VelocitySlider.stories.tsx +32 -0
  10. package/src/components/VelocitySlider.tsx +52 -0
  11. package/src/components/jogging/JoggingCartesianAxisControl.stories.tsx +41 -0
  12. package/src/components/jogging/JoggingCartesianAxisControl.tsx +127 -0
  13. package/src/components/jogging/JoggingCartesianTab.tsx +265 -0
  14. package/src/components/jogging/JoggingCartesianValues.tsx +45 -0
  15. package/src/components/jogging/JoggingFreedriveTab.tsx +9 -0
  16. package/src/components/jogging/JoggingJointLimitDetector.tsx +51 -0
  17. package/src/components/jogging/JoggingJointRotationControl.stories.tsx +38 -0
  18. package/src/components/jogging/JoggingJointRotationControl.tsx +197 -0
  19. package/src/components/jogging/JoggingJointTab.tsx +93 -0
  20. package/src/components/jogging/JoggingJointValues.tsx +45 -0
  21. package/src/components/jogging/JoggingOptions.tsx +96 -0
  22. package/src/components/jogging/JoggingPanel.stories.tsx +26 -0
  23. package/src/components/jogging/JoggingPanel.tsx +148 -0
  24. package/src/components/jogging/JoggingStore.tsx +294 -0
  25. package/src/components/jogging/JoggingVelocitySlider.tsx +56 -0
  26. package/src/components/robots/ABB_1200_07_7.tsx +127 -0
  27. package/src/components/robots/AxisConfig.ts +3 -0
  28. package/src/components/robots/DHRobot.tsx +128 -0
  29. package/src/components/robots/FANUC_ARC_Mate_100iD.tsx +187 -0
  30. package/src/components/robots/FANUC_ARC_Mate_120iD.tsx +187 -0
  31. package/src/components/robots/FANUC_CRX10iA.tsx +171 -0
  32. package/src/components/robots/FANUC_CRX25iA.tsx +171 -0
  33. package/src/components/robots/FANUC_CRX25iAL.tsx +182 -0
  34. package/src/components/robots/KUKA_KR210_R2700.tsx +291 -0
  35. package/src/components/robots/KUKA_KR270_R2700.tsx +244 -0
  36. package/src/components/robots/Robot.tsx +42 -0
  37. package/src/components/robots/RobotAnimator.tsx +82 -0
  38. package/src/components/robots/SupportedRobot.tsx +144 -0
  39. package/src/components/robots/UniversalRobots_UR10.tsx +112 -0
  40. package/src/components/robots/UniversalRobots_UR10e.tsx +275 -0
  41. package/src/components/robots/UniversalRobots_UR3.tsx +112 -0
  42. package/src/components/robots/UniversalRobots_UR3e.tsx +112 -0
  43. package/src/components/robots/UniversalRobots_UR5.tsx +111 -0
  44. package/src/components/robots/UniversalRobots_UR5e.tsx +280 -0
  45. package/src/components/robots/Yaskawa_AR1440.tsx +156 -0
  46. package/src/components/robots/Yaskawa_AR1730.tsx +169 -0
  47. package/src/components/robots/Yaskawa_AR2010.tsx +163 -0
  48. package/src/components/robots/Yaskawa_AR3120.tsx +164 -0
  49. package/src/components/robots/Yaskawa_AR900.tsx +125 -0
  50. package/src/components/utils/converters.ts +23 -0
  51. package/src/components/utils/errorHandling.ts +30 -0
  52. package/src/components/utils/hooks.tsx +54 -0
  53. package/src/components/utils/robotTreeQuery.ts +27 -0
  54. package/src/components/wandelscript-editor/WandelscriptEditor.stories.tsx +45 -0
  55. package/src/components/wandelscript-editor/WandelscriptEditor.tsx +114 -0
  56. package/src/components/wandelscript-editor/wandelscript.tmLanguage.ts +62 -0
  57. package/src/declarations.d.ts +10 -0
  58. package/src/i18n/config.ts +27 -0
  59. package/src/i18n/locales/de/translations.json +12 -0
  60. package/src/i18n/locales/en/translations.json +12 -0
  61. package/src/icons/arrowForwardFilled.tsx +7 -0
  62. package/src/icons/axis-x.svg +3 -0
  63. package/src/icons/axis-y.svg +3 -0
  64. package/src/icons/axis-z.svg +3 -0
  65. package/src/icons/expandFilled.tsx +11 -0
  66. package/src/icons/home.tsx +12 -0
  67. package/src/icons/index.ts +6 -0
  68. package/src/icons/infoOutlined.tsx +10 -0
  69. package/src/icons/jogging.svg +3 -0
  70. package/src/icons/robot.svg +3 -0
  71. package/src/icons/robot.tsx +14 -0
  72. package/src/icons/rotation.svg +4 -0
  73. package/src/icons/wbLogo.tsx +21 -0
  74. package/src/index.ts +8 -0
  75. package/src/themes/color.tsx +74 -0
  76. package/src/themes/theme.ts +150 -0
  77. package/src/themes/wbTheme.stories.tsx +64 -0
  78. package/src/themes/wbTheme.ts +186 -0
@@ -0,0 +1,150 @@
1
+ import { ThemeOptions } from '@mui/material/styles';
2
+ import { wbTheme } from './wbTheme';
3
+
4
+ // TODO: Is all of this theme name foo actually necessary?
5
+
6
+ type ThemeName = 'wandelbots'
7
+
8
+ export const allThemes = {
9
+ wb: wbTheme,
10
+ }
11
+
12
+ export interface NamedThemeOptions extends ThemeOptions {
13
+ name: ThemeName
14
+ }
15
+
16
+ declare module '@mui/material/styles' {
17
+ interface Theme {
18
+ backgrounds: {
19
+ light1: string,
20
+ light2: string,
21
+ medium: string,
22
+ dark1: string,
23
+ dark2: string,
24
+ }
25
+ buttonPrimary: {
26
+ background: string;
27
+ text: string;
28
+ }
29
+ buttonSecondary: {
30
+ background: string;
31
+ text: string;
32
+ }
33
+ buttonBack: {
34
+ background: string;
35
+ text: string;
36
+ }
37
+ inputField: {
38
+ background: string;
39
+ text: string;
40
+ unitBackground: string;
41
+ unitText: string;
42
+ }
43
+ sidebar: {
44
+ background: string;
45
+ backgroundSelected: string;
46
+ selected: string;
47
+ }
48
+ actionPanel: {
49
+ background: string;
50
+ backgroundSelected: string;
51
+ text: string;
52
+ }
53
+ controlPanel: {
54
+ background: string;
55
+ text: string;
56
+ }
57
+ listItem: {
58
+ background: string;
59
+ backgroundSelected: string;
60
+ textTitle: string;
61
+ textTitleSelected: string;
62
+ textDesc: string;
63
+ textDescSelected: string;
64
+ }
65
+ breadcrumb: {
66
+ background: string;
67
+ text: string
68
+ textSelected: string;
69
+ }
70
+ axes: {
71
+ x: string;
72
+ y: string;
73
+ z: string;
74
+ };
75
+ viewport: {
76
+ background: string;
77
+ controlBackground: string;
78
+ };
79
+ tabIcon: {
80
+ color: string;
81
+ }
82
+ }
83
+
84
+ interface ThemeOptions {
85
+ backgrounds?: {
86
+ light1?: string,
87
+ light2?: string,
88
+ medium?: string,
89
+ dark1?: string,
90
+ dark2?: string,
91
+ }
92
+ buttonPrimary?: {
93
+ background?: string;
94
+ text?: string;
95
+ }
96
+ buttonSecondary?: {
97
+ background?: string;
98
+ text?: string;
99
+ }
100
+ buttonBack?: {
101
+ background?: string;
102
+ text?: string;
103
+ }
104
+ inputField?: {
105
+ background?: string;
106
+ text?: string;
107
+ unitBackground?: string;
108
+ unitText?: string;
109
+ }
110
+ sidebar?: {
111
+ background?: string;
112
+ backgroundSelected?: string;
113
+ selected?: string;
114
+ }
115
+ actionPanel?: {
116
+ background?: string;
117
+ backgroundSelected?: string;
118
+ text?: string;
119
+ }
120
+ controlPanel?: {
121
+ background?: string;
122
+ text?: string;
123
+ }
124
+ listItem?: {
125
+ background?: string;
126
+ backgroundSelected?: string;
127
+ textTitle?: string;
128
+ textTitleSelected?: string;
129
+ textDesc?: string;
130
+ textDescSelected?: string;
131
+ }
132
+ breadcrumb?: {
133
+ background?: string;
134
+ text?: string
135
+ textSelected?: string;
136
+ }
137
+ axes?: {
138
+ x?: string;
139
+ y?: string;
140
+ z?: string;
141
+ };
142
+ viewport?: {
143
+ background?: string;
144
+ controlBackground?: string;
145
+ };
146
+ tabIcon?: {
147
+ color?: string;
148
+ }
149
+ }
150
+ }
@@ -0,0 +1,64 @@
1
+ import { wbTheme } from "./wbTheme";
2
+ import { Meta, StoryObj } from "@storybook/react";
3
+ import { Color, ColorSection } from "./color";
4
+
5
+ const ColorPalette = () => {
6
+ return (
7
+ <div
8
+ style={{
9
+ fontFamily: "sans-serif",
10
+ }}
11
+ >
12
+ <ColorSection name="Palette">
13
+ <Color name="Primary" color={wbTheme.palette.primary.main} />
14
+ <Color name="Secondary" color={wbTheme.palette.secondary.main} />
15
+ <Color name="Background" color={wbTheme.palette.background.default} />
16
+ </ColorSection>
17
+ <ColorSection name="Text">
18
+ <Color name="Primary" color={wbTheme.palette.text.primary} />
19
+ <Color name="Secondary" color={wbTheme.palette.text.secondary} />
20
+ </ColorSection>
21
+ <ColorSection name="Button">
22
+ <Color
23
+ name="Primary Background"
24
+ color={wbTheme.buttonPrimary.background}
25
+ />
26
+ <Color name="Primary Text" color={wbTheme.buttonPrimary.text} />
27
+ <Color
28
+ name="Secondary Background"
29
+ color={wbTheme.buttonSecondary.background}
30
+ />
31
+ <Color name="Secondary Text" color={wbTheme.buttonSecondary.text} />
32
+ <Color name="Back Background" color={wbTheme.buttonBack.background} />
33
+ <Color name="Back Text" color={wbTheme.buttonBack.text} />
34
+ </ColorSection>
35
+ <ColorSection name="Input Field">
36
+ <Color name="Background" color={wbTheme.inputField.background} />
37
+ <Color name="Text" color={wbTheme.inputField.text} />
38
+ <Color
39
+ name="Unit Background"
40
+ color={wbTheme.inputField.unitBackground}
41
+ />
42
+ <Color name="Unit Text" color={wbTheme.inputField.unitText} />
43
+ </ColorSection>
44
+ <ColorSection name="Sidebar">
45
+ <Color name="Background" color={wbTheme.sidebar.background} />
46
+ <Color
47
+ name="Background Selected"
48
+ color={wbTheme.sidebar.backgroundSelected}
49
+ />
50
+ <Color name="Selected" color={wbTheme.sidebar.selected} />
51
+ </ColorSection>
52
+ </div>
53
+ );
54
+ };
55
+
56
+ const meta: Meta<typeof ColorPalette> = {
57
+ component: ColorPalette,
58
+ };
59
+
60
+ export default meta;
61
+
62
+ type Story = StoryObj<typeof ColorPalette>;
63
+
64
+ export const colorPalette: Story = {};
@@ -0,0 +1,186 @@
1
+ "use client"
2
+
3
+ import { createTheme, useTheme, type ThemeOptions } from "@mui/material/styles"
4
+ import { defaultsDeep } from "lodash-es"
5
+
6
+ const baseColors = {
7
+ white: "#FFFFFF",
8
+ midnightblue: "#001337",
9
+ lightbuttonblue: "#47D3FF",
10
+ midnightgray: "#DDE0E4",
11
+ midnightgray500: "#828B9B",
12
+ skyblue500: "#06B8F1",
13
+ skyblue600: "#0094CE",
14
+ darkishblue: "#262F42",
15
+ darkestblue: "#101629",
16
+ grayishblue: "#505968",
17
+ darkgrayishblue: "#363c4b",
18
+ scaryred: "#FF0E65",
19
+ tealGreen: "#1AC0B2",
20
+ magenta: "#EA3785",
21
+ }
22
+
23
+ /** Colors for the dark theme */
24
+ export const darkColors = {
25
+ primary: baseColors.skyblue500,
26
+ textDefault: baseColors.white,
27
+ textInverse: baseColors.darkestblue,
28
+ textError: baseColors.scaryred,
29
+ textSubtle: baseColors.midnightgray500,
30
+ backgroundDefault: baseColors.darkishblue,
31
+ inputBackgroundDefault: baseColors.darkgrayishblue,
32
+ borderColorDefault: "#3A4150",
33
+
34
+ selectBackground: baseColors.grayishblue,
35
+ appBarBackground: baseColors.darkestblue,
36
+ virtualRobot: "#1AC0B2",
37
+ physicalRobot: "#956FFA",
38
+ robotViewportBackground: "#1F283A",
39
+ viewportButtonInactiveBackground: baseColors.darkestblue,
40
+ viewportButtonHover: baseColors.midnightgray500,
41
+ viewportButtonActiveBackground: baseColors.skyblue500,
42
+ tabsBarBackground: baseColors.darkestblue,
43
+ activeTabBackground: baseColors.darkishblue,
44
+ omniverseConfigurationSuccess: baseColors.tealGreen,
45
+ omniverseConfigurationFailure: baseColors.magenta,
46
+ }
47
+
48
+ /** Colors for the light theme */
49
+ export const lightColors = {
50
+ primary: baseColors.lightbuttonblue,
51
+ textDefault: "#18181B",
52
+ textInverse: baseColors.white,
53
+ textError: baseColors.scaryred,
54
+ textSubtle: baseColors.midnightgray500,
55
+ backgroundDefault: baseColors.white,
56
+ inputBackgroundDefault: baseColors.white,
57
+ borderColorDefault: baseColors.midnightgray500,
58
+
59
+ selectBackground: "#E4E4E7",
60
+ appBarBackground: baseColors.white,
61
+ virtualRobot: "green",
62
+ physicalRobot: "blue",
63
+ robotViewportBackground: "#E4E4E7",
64
+ viewportButtonInactiveBackground: baseColors.midnightgray,
65
+ viewportButtonHover: baseColors.midnightgray500,
66
+ viewportButtonActiveBackground: baseColors.lightbuttonblue,
67
+ tabsBarBackground: baseColors.white,
68
+ activeTabBackground: baseColors.white,
69
+ omniverseConfigurationSuccess: baseColors.tealGreen,
70
+ omniverseConfigurationFailure: baseColors.magenta,
71
+ }
72
+
73
+ /** Gets the colors for the current theme (light or dark) */
74
+ export function useThemeColors() {
75
+ return useTheme().palette.mode === "dark" ? darkColors : lightColors
76
+ }
77
+
78
+ function createRobotPadTheme(
79
+ mode: "light" | "dark",
80
+ options: ThemeOptions = {},
81
+ ) {
82
+ const colors = mode === "light" ? lightColors : darkColors
83
+ return createTheme(
84
+ defaultsDeep(options, {
85
+ palette: {
86
+ mode,
87
+ primary: {
88
+ main: colors.primary,
89
+ },
90
+ background: {
91
+ default: colors.backgroundDefault,
92
+ },
93
+ },
94
+ typography: {
95
+ allVariants: {
96
+ color: colors.textDefault,
97
+ },
98
+ },
99
+ components: {
100
+ MuiPaper: {
101
+ styleOverrides: {
102
+ root: {
103
+ backgroundColor: colors.backgroundDefault,
104
+ },
105
+ },
106
+ },
107
+ MuiTabs: {
108
+ styleOverrides: {
109
+ root: {
110
+ backgroundColor: colors.tabsBarBackground,
111
+ minHeight: "42px",
112
+ },
113
+ },
114
+ },
115
+ MuiTab: {
116
+ styleOverrides: {
117
+ root: {
118
+ minHeight: "42px",
119
+ textTransform: "none",
120
+ "&.Mui-selected": {
121
+ color: "inherit",
122
+ backgroundColor: colors.activeTabBackground,
123
+ },
124
+ },
125
+ },
126
+ },
127
+ MuiButton: {
128
+ defaultProps: {
129
+ disableElevation: true,
130
+ },
131
+ styleOverrides: {
132
+ root: {
133
+ textTransform: "none",
134
+ borderRadius: "10px",
135
+ fontSize: "14px",
136
+ fontWeight: 500,
137
+ },
138
+ },
139
+ variants: [
140
+ {
141
+ props: { variant: "outlined" },
142
+ style: {
143
+ border: "2px solid rgba(255, 255, 255, 0.6)",
144
+ color: "rgba(255, 255, 255, 0.6)",
145
+ backgroundColor: "rgba(255, 255, 255, 0.2)",
146
+ "&:hover": {
147
+ backgroundColor: "rgba(255, 255, 255, 0.4)",
148
+ border: "2px solid rgba(255, 255, 255, 0.8)",
149
+ },
150
+ },
151
+ },
152
+ ],
153
+ },
154
+ MuiFab: {
155
+ styleOverrides: {
156
+ root: {
157
+ width: "48px",
158
+ height: "48px",
159
+ backgroundColor: colors.viewportButtonInactiveBackground,
160
+ color: colors.textDefault,
161
+ "&:hover": {
162
+ backgroundColor: colors.viewportButtonHover,
163
+ },
164
+ },
165
+ },
166
+ variants: [
167
+ {
168
+ props: { variant: "active" },
169
+ style: {
170
+ backgroundColor: colors.viewportButtonActiveBackground,
171
+ color: colors.textInverse,
172
+ "&:hover": {
173
+ backgroundColor: colors.viewportButtonActiveBackground,
174
+ },
175
+ },
176
+ },
177
+ ],
178
+ },
179
+ },
180
+ }),
181
+ )
182
+ }
183
+
184
+ export const darkTheme = createRobotPadTheme("dark")
185
+ export const lightTheme = createRobotPadTheme("light")
186
+ export const wbTheme = darkTheme