@wandelbots/wandelbots-js-react-components 1.7.1 → 1.9.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 (96) hide show
  1. package/README.md +30 -16
  2. package/dist/components/3d-viewport/SafetyZonesRenderer.d.ts +1 -1
  3. package/dist/components/3d-viewport/SafetyZonesRenderer.d.ts.map +1 -1
  4. package/dist/components/CopyableText.d.ts +5 -0
  5. package/dist/components/CopyableText.d.ts.map +1 -0
  6. package/dist/components/LoadingButton.d.ts +1 -1
  7. package/dist/components/LoadingButton.stories.d.ts +1 -1
  8. package/dist/components/LoadingButton.stories.d.ts.map +1 -1
  9. package/dist/components/ThemeSelect.d.ts.map +1 -1
  10. package/dist/components/VelocitySlider.d.ts.map +1 -1
  11. package/dist/components/VelocitySlider.stories.d.ts +2 -2
  12. package/dist/components/VelocitySlider.stories.d.ts.map +1 -1
  13. package/dist/components/jogging/JoggingCartesianAxisControl.stories.d.ts +1 -1
  14. package/dist/components/jogging/JoggingCartesianAxisControl.stories.d.ts.map +1 -1
  15. package/dist/components/jogging/JoggingCartesianTab.d.ts.map +1 -1
  16. package/dist/components/jogging/JoggingCartesianValues.d.ts +1 -1
  17. package/dist/components/jogging/JoggingCartesianValues.d.ts.map +1 -1
  18. package/dist/components/jogging/JoggingJointLimitDetector.d.ts +2 -2
  19. package/dist/components/jogging/JoggingJointLimitDetector.d.ts.map +1 -1
  20. package/dist/components/jogging/JoggingJointRotationControl.d.ts.map +1 -1
  21. package/dist/components/jogging/JoggingJointRotationControl.stories.d.ts +2 -2
  22. package/dist/components/jogging/JoggingJointRotationControl.stories.d.ts.map +1 -1
  23. package/dist/components/jogging/JoggingJointValues.d.ts +1 -1
  24. package/dist/components/jogging/JoggingJointValues.d.ts.map +1 -1
  25. package/dist/components/jogging/JoggingOptions.d.ts.map +1 -1
  26. package/dist/components/jogging/JoggingPanel.d.ts +8 -1
  27. package/dist/components/jogging/JoggingPanel.d.ts.map +1 -1
  28. package/dist/components/jogging/JoggingPanel.stories.d.ts +2 -2
  29. package/dist/components/jogging/JoggingPanel.stories.d.ts.map +1 -1
  30. package/dist/components/jogging/JoggingStore.d.ts +14 -1
  31. package/dist/components/jogging/JoggingStore.d.ts.map +1 -1
  32. package/dist/components/jogging/JoggingVelocitySlider.d.ts.map +1 -1
  33. package/dist/components/robots/FANUC_CRX20iAL.d.ts +3 -0
  34. package/dist/components/robots/FANUC_CRX20iAL.d.ts.map +1 -0
  35. package/dist/components/robots/SupportedRobot.d.ts.map +1 -1
  36. package/dist/components/wandelscript-editor/WandelscriptEditor.d.ts +2 -2
  37. package/dist/components/wandelscript-editor/WandelscriptEditor.d.ts.map +1 -1
  38. package/dist/components/wandelscript-editor/WandelscriptEditor.stories.d.ts +2 -2
  39. package/dist/components/wandelscript-editor/WandelscriptEditor.stories.d.ts.map +1 -1
  40. package/dist/externalizeComponent.d.ts +7 -0
  41. package/dist/externalizeComponent.d.ts.map +1 -0
  42. package/dist/index.cjs +29 -48
  43. package/dist/index.cjs.map +1 -1
  44. package/dist/index.d.ts +49 -9
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +11672 -12089
  47. package/dist/index.js.map +1 -1
  48. package/dist/themes/color.d.ts +1 -1
  49. package/dist/themes/color.d.ts.map +1 -1
  50. package/dist/themes/novaTheme.stories.d.ts +5 -0
  51. package/dist/themes/novaTheme.stories.d.ts.map +1 -0
  52. package/dist/themes/theming.d.ts +49 -0
  53. package/dist/themes/theming.d.ts.map +1 -0
  54. package/package.json +20 -13
  55. package/src/components/3d-viewport/SafetyZonesRenderer.tsx +2 -2
  56. package/src/components/CopyableText.tsx +30 -0
  57. package/src/components/LoadingButton.stories.tsx +19 -26
  58. package/src/components/ThemeSelect.tsx +3 -4
  59. package/src/components/VelocitySlider.stories.tsx +10 -15
  60. package/src/components/VelocitySlider.tsx +7 -2
  61. package/src/components/jogging/JoggingCartesianAxisControl.stories.tsx +21 -21
  62. package/src/components/jogging/JoggingCartesianAxisControl.tsx +1 -1
  63. package/src/components/jogging/JoggingCartesianTab.tsx +37 -44
  64. package/src/components/jogging/JoggingCartesianValues.tsx +37 -33
  65. package/src/components/jogging/JoggingJointLimitDetector.tsx +10 -7
  66. package/src/components/jogging/JoggingJointRotationControl.stories.tsx +31 -19
  67. package/src/components/jogging/JoggingJointRotationControl.tsx +44 -30
  68. package/src/components/jogging/JoggingJointValues.tsx +35 -33
  69. package/src/components/jogging/JoggingOptions.tsx +130 -80
  70. package/src/components/jogging/JoggingPanel.stories.tsx +20 -17
  71. package/src/components/jogging/JoggingPanel.tsx +29 -31
  72. package/src/components/jogging/JoggingStore.tsx +69 -18
  73. package/src/components/jogging/JoggingVelocitySlider.tsx +24 -22
  74. package/src/components/robots/FANUC_CRX20iAL.tsx +176 -0
  75. package/src/components/robots/SupportedRobot.tsx +4 -0
  76. package/src/components/wandelscript-editor/WandelscriptEditor.stories.tsx +7 -7
  77. package/src/components/wandelscript-editor/WandelscriptEditor.tsx +48 -23
  78. package/src/externalizeComponent.tsx +37 -0
  79. package/src/i18n/locales/de/translations.json +2 -1
  80. package/src/i18n/locales/en/translations.json +2 -1
  81. package/src/icons/orientation-coord-system.svg +3 -0
  82. package/src/icons/orientation-tool.svg +3 -0
  83. package/src/index.ts +39 -9
  84. package/src/themes/color.tsx +29 -19
  85. package/src/themes/novaTheme.stories.tsx +77 -0
  86. package/src/themes/themeTypes.d.ts +11 -0
  87. package/src/themes/theming.ts +174 -0
  88. package/dist/themes/theme.d.ts +0 -144
  89. package/dist/themes/theme.d.ts.map +0 -1
  90. package/dist/themes/wbTheme.d.ts +0 -73
  91. package/dist/themes/wbTheme.d.ts.map +0 -1
  92. package/dist/themes/wbTheme.stories.d.ts +0 -7
  93. package/dist/themes/wbTheme.stories.d.ts.map +0 -1
  94. package/src/themes/theme.ts +0 -150
  95. package/src/themes/wbTheme.stories.tsx +0 -64
  96. package/src/themes/wbTheme.ts +0 -186
@@ -1,4 +1,4 @@
1
- import { ReactNode } from "react";
1
+ import type { ReactNode } from "react";
2
2
  export declare function ColorSection(props: {
3
3
  name: string;
4
4
  children: ReactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../src/themes/color.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAuB,MAAM,OAAO,CAAC;AAE9D,wBAAgB,YAAY,CAAC,KAAK,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,2CAexE;AAED,wBAAgB,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,2CAsDrE"}
1
+ {"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../src/themes/color.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AAGtC,wBAAgB,YAAY,CAAC,KAAK,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,2CAsBxE;AAED,wBAAgB,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,2CAuDrE"}
@@ -0,0 +1,5 @@
1
+ import type { Meta } from "@storybook/react";
2
+ declare const ColorPalette: () => import("react/jsx-runtime").JSX.Element;
3
+ declare const meta: Meta<typeof ColorPalette>;
4
+ export default meta;
5
+ //# sourceMappingURL=novaTheme.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"novaTheme.stories.d.ts","sourceRoot":"","sources":["../../src/themes/novaTheme.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAY,MAAM,kBAAkB,CAAA;AAItD,QAAA,MAAM,YAAY,+CAuDjB,CAAA;AAED,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,YAAY,CASnC,CAAA;AAED,eAAe,IAAI,CAAA"}
@@ -0,0 +1,49 @@
1
+ import type { Theme } from "@mui/material/styles";
2
+ /**
3
+ * A Nova components theme is a collection of Nova-specific settings that is
4
+ * not specifically MUI-related, but can be used to construct a MUI
5
+ * theme in turn.
6
+ *
7
+ * This object defines the default Nova theme settings, and the structure
8
+ * of the options here is used to validate alternative themes.
9
+ */
10
+ export declare const novaDarkTheme: {
11
+ mode: "dark" | "light";
12
+ colors: {
13
+ primary: string;
14
+ textDefault: string;
15
+ textSubtle: string;
16
+ background: {
17
+ default: string;
18
+ panel: string;
19
+ };
20
+ };
21
+ };
22
+ export type NovaTheme = typeof novaDarkTheme;
23
+ export declare const novaLightTheme: {
24
+ mode: "light";
25
+ colors: {
26
+ primary: string;
27
+ textDefault: string;
28
+ textSubtle: string;
29
+ background: {
30
+ default: string;
31
+ panel: string;
32
+ };
33
+ };
34
+ };
35
+ /**
36
+ * Configure a Nova theme with the given options.
37
+ * If no options are provided, the default dark theme is used.
38
+ * Otherwise, the default dark or light theme is extended with
39
+ * the overrides provided as appropriate.
40
+ */
41
+ export declare function createNovaTheme(opts?: Partial<NovaTheme>): NovaTheme;
42
+ /**
43
+ * Turn a set of Nova theme settings into a Material UI theme.
44
+ *
45
+ * The original Nova settings are available on the resulting MUI
46
+ * theme object under the `nova` key, if needed.
47
+ */
48
+ export declare function createMUIThemeFromNova(novaTheme: NovaTheme): Theme;
49
+ //# sourceMappingURL=theming.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theming.d.ts","sourceRoot":"","sources":["../../src/themes/theming.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAyBjD;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa;UACR,MAAM,GAAG,OAAO;;;;;;;;;;CAUjC,CAAA;AAED,MAAM,MAAM,SAAS,GAAG,OAAO,aAAa,CAAA;AAE5C,eAAO,MAAM,cAAc;;;;;;;;;;;CAWN,CAAA;AAErB;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,GAAE,OAAO,CAAC,SAAS,CAAM,GAAG,SAAS,CAGxE;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,SAAS,GAAG,KAAK,CA6FlE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wandelbots/wandelbots-js-react-components",
3
- "version": "1.7.1",
3
+ "version": "1.9.0",
4
4
  "description": "React UI toolkit for building applications on top of the Wandelbots platform",
5
5
  "files": [
6
6
  "dist",
@@ -19,7 +19,8 @@
19
19
  "types": "./dist/index.d.ts",
20
20
  "scripts": {
21
21
  "dev": "storybook dev -p 6006 --no-open",
22
- "dev:pack": "nodemon -w \".\" -e ts -i *.tgz -i dist -x \"npm run build && npm pack\"",
22
+ "dev:pack": "nodemon -V -w src -e '*' -x \"npm run build && npm pack\"",
23
+ "dev:build": "nodemon -V -w src -e '*' -x \"vite build && tsc --declaration --emitDeclarationOnly\"",
23
24
  "dev:wbjs": "nodemon --watch $WBJS_PATH -e tgz --exec 'npm install file:$WBJS_PATH && storybook dev -p 6006 --no-open'",
24
25
  "tsc": "tsc --pretty --noEmit",
25
26
  "test": "npm run build",
@@ -28,7 +29,7 @@
28
29
  },
29
30
  "repository": {
30
31
  "type": "git",
31
- "url": "git+https://github.com/wandelbotsgmbh/wandelui.git"
32
+ "url": "git+https://github.com/wandelbotsgmbh/wandelbots-js-react-components.git"
32
33
  },
33
34
  "keywords": [
34
35
  "ui",
@@ -46,20 +47,22 @@
46
47
  "@rollup/plugin-node-resolve": "^15.2.3",
47
48
  "@rollup/plugin-terser": "^0.4.4",
48
49
  "@rollup/plugin-typescript": "^11.1.6",
49
- "@storybook/addon-essentials": "^8.2.7",
50
- "@storybook/addon-interactions": "^8.2.7",
51
- "@storybook/addon-links": "^8.2.7",
52
- "@storybook/blocks": "^8.2.7",
53
- "@storybook/react": "^8.2.7",
54
- "@storybook/react-vite": "^8.2.7",
55
- "@storybook/test": "^8.2.7",
50
+ "@storybook/addon-essentials": "^8.2.9",
51
+ "@storybook/addon-interactions": "^8.2.9",
52
+ "@storybook/addon-links": "^8.2.9",
53
+ "@storybook/blocks": "^8.2.9",
54
+ "@storybook/react": "^8.2.9",
55
+ "@storybook/react-vite": "^8.2.9",
56
+ "@storybook/test": "^8.2.9",
56
57
  "@storybook/test-runner": "^0.19.1",
57
58
  "@svgr/rollup": "^8.1.0",
58
59
  "@types/lodash-es": "^4.17.12",
59
60
  "@types/react": "^18.3.3",
61
+ "@types/three": "^0.167.1",
60
62
  "@vitejs/plugin-react": "^4.3.1",
61
63
  "nodemon": "^3.1.4",
62
64
  "postcss": "^8.4.40",
65
+ "prettier-eslint": "^16.3.0",
63
66
  "prop-types": "^15.8.1",
64
67
  "react": "^18.3.1",
65
68
  "react-dom": "^18.3.1",
@@ -70,7 +73,8 @@
70
73
  "rollup-plugin-peer-deps-external": "^2.2.4",
71
74
  "rollup-plugin-postcss": "^4.0.2",
72
75
  "semantic-release": "^24.0.0",
73
- "storybook": "^8.2.7",
76
+ "storybook": "^8.2.9",
77
+ "storybook-dark-mode": "^4.0.2",
74
78
  "tslib": "^2.6.3",
75
79
  "typescript": "^5.5.4",
76
80
  "vite": "^5.3.5",
@@ -84,7 +88,7 @@
84
88
  "@react-spring/three": ">=9",
85
89
  "@react-three/drei": ">=9",
86
90
  "@react-three/fiber": ">=8",
87
- "@wandelbots/wandelbots-js": "^1.6.0",
91
+ "@wandelbots/wandelbots-js": "^1.7.0",
88
92
  "react": "^18.2.0",
89
93
  "react-dom": "^18.2.0",
90
94
  "three": ">=0.167",
@@ -96,16 +100,19 @@
96
100
  }
97
101
  },
98
102
  "dependencies": {
103
+ "@chromatic-com/storybook": "^1.6.1",
99
104
  "@monaco-editor/react": "^4.6.0",
100
105
  "@mui/icons-material": "^5.16.6",
101
106
  "@mui/lab": "^5.0.0-alpha.173",
102
107
  "@shikijs/monaco": "^1.12.0",
108
+ "@storybook/addon-onboarding": "^8.2.9",
103
109
  "i18next-browser-languagedetector": "^8.0.0",
104
110
  "lodash-es": "^4.17.21",
105
111
  "mobx": "^6.13.1",
106
112
  "mobx-react-lite": "^4.0.7",
107
113
  "react-error-boundary": "^4.0.13",
108
114
  "react-i18next": "^15.0.0",
109
- "shiki": "^1.12.0"
115
+ "shiki": "^1.12.0",
116
+ "storybook-preset-inline-svg": "^1.0.1"
110
117
  }
111
118
  }
@@ -1,5 +1,5 @@
1
- import { SafetySetupSafetyZone } from "@wandelbots/wandelbots-js"
2
- import { Geometry } from "@wandelbots/wandelbots-api-client"
1
+ import type { SafetySetupSafetyZone } from "@wandelbots/wandelbots-js"
2
+ import type { Geometry } from "@wandelbots/wandelbots-api-client"
3
3
  import * as THREE from "three"
4
4
  import { ConvexGeometry } from "three-stdlib"
5
5
  import { type GroupProps } from "@react-three/fiber"
@@ -0,0 +1,30 @@
1
+ import { Chip, InputLabel } from "@mui/material"
2
+ import { forwardRef } from "react"
3
+
4
+ export const CopyableText = forwardRef(
5
+ (
6
+ {
7
+ label,
8
+ value,
9
+ }: {
10
+ label?: string
11
+ value: string
12
+ },
13
+ ref: React.ForwardedRef<HTMLPreElement>,
14
+ ) => {
15
+ return (
16
+ <>
17
+ {label && <InputLabel>{label}</InputLabel>}
18
+ <Chip
19
+ ref={ref}
20
+ sx={{
21
+ fontSize: "14px",
22
+ opacity: 0.8,
23
+ marginTop: "4px !important",
24
+ }}
25
+ value={value}
26
+ />
27
+ </>
28
+ )
29
+ },
30
+ )
@@ -1,35 +1,29 @@
1
- import { Meta, StoryObj } from "@storybook/react";
2
- import { LoadingButton } from "./LoadingButton";
3
- import { useState } from "react";
1
+ import type { Meta, StoryObj } from "@storybook/react"
2
+ import { LoadingButton } from "./LoadingButton"
3
+ import { useState } from "react"
4
4
  import { PlayArrow } from "@mui/icons-material"
5
5
 
6
6
  async function delay(ms: number) {
7
7
  return new Promise<void>((resolve) => {
8
8
  setTimeout(() => {
9
- resolve();
10
- }, ms);
11
- });
9
+ resolve()
10
+ }, ms)
11
+ })
12
12
  }
13
13
 
14
14
  const DemoLoader = (props: React.ComponentProps<typeof LoadingButton>) => {
15
- const [isLoading, setIsLoading] = useState(false);
15
+ const [isLoading, setIsLoading] = useState(false)
16
16
 
17
17
  async function doThing() {
18
- setIsLoading(true);
18
+ setIsLoading(true)
19
19
  try {
20
- await delay(1000);
20
+ await delay(1000)
21
21
  } finally {
22
- setIsLoading(false);
22
+ setIsLoading(false)
23
23
  }
24
24
  }
25
25
 
26
- return (
27
- <LoadingButton
28
- loading={isLoading}
29
- onClick={doThing}
30
- {...props}
31
- />
32
- );
26
+ return <LoadingButton loading={isLoading} onClick={doThing} {...props} />
33
27
  }
34
28
 
35
29
  const meta: Meta<typeof LoadingButton> = {
@@ -44,18 +38,17 @@ const meta: Meta<typeof LoadingButton> = {
44
38
  argTypes: {
45
39
  loadingPosition: {
46
40
  options: ["center", "start", "end"],
47
- control: { type: 'select' },
41
+ control: { type: "select" },
48
42
  },
49
43
  variant: {
50
44
  options: ["contained", "outlined", "text"],
51
- control: { type: 'select' },
52
- }
45
+ control: { type: "select" },
46
+ },
53
47
  },
54
48
  render: (props) => {
55
- return <DemoLoader {...props} />;
56
- }
57
- };
58
- export default meta;
49
+ return <DemoLoader {...props} />
50
+ },
51
+ }
52
+ export default meta
59
53
 
60
- export const Default: StoryObj<typeof LoadingButton> = {
61
- };
54
+ export const Default: StoryObj<typeof LoadingButton> = {}
@@ -1,7 +1,6 @@
1
1
  // TODO implement this as part of theme?
2
2
 
3
- import { useThemeColors } from "../themes/wbTheme"
4
- import { Select, type SxProps } from "@mui/material"
3
+ import { Select, useTheme, type SxProps } from "@mui/material"
5
4
  import { defaultsDeep } from "lodash-es"
6
5
 
7
6
  type ThemeSelectProps = {
@@ -9,10 +8,10 @@ type ThemeSelectProps = {
9
8
  } & React.ComponentProps<typeof Select>
10
9
 
11
10
  export const ThemeSelect = ({ kind, sx, ...rest }: ThemeSelectProps) => {
12
- const colors = useThemeColors()
11
+ const theme = useTheme()
13
12
 
14
13
  let style: SxProps = defaultsDeep(sx, {
15
- backgroundColor: colors.selectBackground,
14
+ backgroundColor: theme.palette.background.default,
16
15
  borderRadius: "10px",
17
16
  borderStyle: "none",
18
17
  color: "currentColor",
@@ -1,6 +1,6 @@
1
- import { Meta, StoryObj } from "@storybook/react";
2
- import { VelocitySlider } from "./VelocitySlider";
3
- import { useArgs } from "@storybook/preview-api";
1
+ import type { Meta, StoryObj } from "@storybook/react"
2
+ import { VelocitySlider } from "../index"
3
+ import { useArgs } from "@storybook/preview-api"
4
4
 
5
5
  const meta: Meta<typeof VelocitySlider> = {
6
6
  component: VelocitySlider,
@@ -12,21 +12,16 @@ const meta: Meta<typeof VelocitySlider> = {
12
12
  disabled: false,
13
13
  },
14
14
  render: function Component(args) {
15
- const [, setArgs] = useArgs();
15
+ const [, setArgs] = useArgs()
16
16
 
17
17
  function onVelocityChange(newVelocity: number) {
18
- args.onVelocityChange?.(newVelocity);
19
- setArgs({ velocity: newVelocity });
18
+ args.onVelocityChange?.(newVelocity)
19
+ setArgs({ velocity: newVelocity })
20
20
  }
21
21
 
22
- return <VelocitySlider
23
- {...args}
24
- onVelocityChange={onVelocityChange}
25
- />;
22
+ return <VelocitySlider {...args} onVelocityChange={onVelocityChange} />
26
23
  },
24
+ }
25
+ export default meta
27
26
 
28
- };
29
- export default meta;
30
-
31
- export const Default: StoryObj<typeof VelocitySlider> = {
32
- };
27
+ export const Default: StoryObj<typeof VelocitySlider> = {}
@@ -1,7 +1,7 @@
1
1
  import Slider from "@mui/material/Slider"
2
2
  import { isNumber } from "lodash-es"
3
3
  import { observer } from "mobx-react-lite"
4
- import { Typography } from "@mui/material"
4
+ import { Stack, Typography, useTheme } from "@mui/material"
5
5
 
6
6
  type VelocitySliderProps = {
7
7
  min: number
@@ -14,7 +14,10 @@ type VelocitySliderProps = {
14
14
 
15
15
  /** A slider for controlling the movement velocity of a robot */
16
16
  export const VelocitySlider = observer((props: VelocitySliderProps) => {
17
- const valueLabelFormat = props.valueLabelFormat || ((value: number) => `${value}`)
17
+ const theme = useTheme()
18
+
19
+ const valueLabelFormat =
20
+ props.valueLabelFormat || ((value: number) => `${value}`)
18
21
 
19
22
  function onSliderChange(_event: Event, newVelocity: number | number[]) {
20
23
  if (newVelocity === props.velocity || !isNumber(newVelocity)) return
@@ -28,6 +31,8 @@ export const VelocitySlider = observer((props: VelocitySliderProps) => {
28
31
  sx={{
29
32
  textAlign: "center",
30
33
  fontSize: "15px",
34
+ opacity: 0.8,
35
+ color: theme.palette.text.primary,
31
36
  }}
32
37
  >
33
38
  {valueLabelFormat(props.velocity)}
@@ -1,8 +1,8 @@
1
- import { Meta, StoryObj } from "@storybook/react";
2
- import { JoggingCartesianAxisControl } from "./JoggingCartesianAxisControl";
3
- import { useRef, useState } from "react";
4
- import { useAnimationFrame } from "../utils/hooks";
5
- import { useArgs } from "@storybook/preview-api";
1
+ import type { Meta, StoryObj } from "@storybook/react"
2
+ import { JoggingCartesianAxisControl } from "./JoggingCartesianAxisControl"
3
+ import { useRef } from "react"
4
+ import { useAnimationFrame } from "../utils/hooks"
5
+ import { useArgs } from "@storybook/preview-api"
6
6
 
7
7
  const meta: Meta<typeof JoggingCartesianAxisControl> = {
8
8
  component: JoggingCartesianAxisControl,
@@ -13,29 +13,29 @@ const meta: Meta<typeof JoggingCartesianAxisControl> = {
13
13
  disabled: false,
14
14
  },
15
15
  render: function Component(args) {
16
- const [, setArgs] = useArgs();
16
+ const [, setArgs] = useArgs()
17
17
 
18
- const joggingDirRef = useRef<"+" | "-" | null>(null);
19
- const joggingValueRef = useRef(0);
18
+ const joggingDirRef = useRef<"+" | "-" | null>(null)
19
+ const joggingValueRef = useRef(0)
20
20
 
21
21
  useAnimationFrame(() => {
22
22
  if (joggingDirRef.current === "+") {
23
- joggingValueRef.current += 1;
23
+ joggingValueRef.current += 1
24
24
  } else if (joggingDirRef.current === "-") {
25
- joggingValueRef.current -= 1;
25
+ joggingValueRef.current -= 1
26
26
  }
27
27
  })
28
28
 
29
- return <JoggingCartesianAxisControl
30
- {...args}
31
- startJogging={(direction) => joggingDirRef.current = direction}
32
- stopJogging={() => joggingDirRef.current = null}
33
- getDisplayedValue={() => joggingValueRef.current.toString()}
34
- />;
29
+ return (
30
+ <JoggingCartesianAxisControl
31
+ {...args}
32
+ startJogging={(direction) => (joggingDirRef.current = direction)}
33
+ stopJogging={() => (joggingDirRef.current = null)}
34
+ getDisplayedValue={() => joggingValueRef.current.toString()}
35
+ />
36
+ )
35
37
  },
38
+ }
39
+ export default meta
36
40
 
37
- };
38
- export default meta;
39
-
40
- export const Default: StoryObj<typeof JoggingCartesianAxisControl> = {
41
- };
41
+ export const Default: StoryObj<typeof JoggingCartesianAxisControl> = {}
@@ -84,7 +84,7 @@ export const JoggingCartesianAxisControl = observer(
84
84
  alignItems="center"
85
85
  justifyItems="center"
86
86
  spacing={1}
87
- sx={{ userSelect: "none" }}
87
+ sx={{ userSelect: "none", color: "white" }}
88
88
  >
89
89
  {label}
90
90
  </Stack>
@@ -6,7 +6,7 @@ import {
6
6
  } from "@mui/material"
7
7
  import { observer } from "mobx-react-lite"
8
8
  import { JoggingCartesianAxisControl } from "./JoggingCartesianAxisControl"
9
- import { radiansToDegrees } from "@wandelbots/wandelbots-js"
9
+ import { degreesToRadians, radiansToDegrees } from "@wandelbots/wandelbots-js"
10
10
  import { useTranslation } from "react-i18next"
11
11
  import RotationIcon from "../../icons/rotation.svg"
12
12
  import XAxisIcon from "../../icons/axis-x.svg"
@@ -41,7 +41,9 @@ export const JoggingCartesianTab = observer(
41
41
  () => [store.selectedCoordSystemId, store.selectedTcpId],
42
42
  () => {
43
43
  store.jogger.motionStream.motionStateSocket.changeUrl(
44
- store.jogger.nova.makeWebsocketURL(`/motion-groups/${store.jogger.motionGroupId}/state-stream?tcp=${store.selectedTcpId}&response_coordinate_system=${store.selectedCoordSystemId}`)
44
+ store.jogger.nova.makeWebsocketURL(
45
+ `/motion-groups/${store.jogger.motionGroupId}/state-stream?tcp=${store.selectedTcpId}&response_coordinate_system=${store.selectedCoordSystemId}`,
46
+ ),
45
47
  )
46
48
  },
47
49
  { fireImmediately: true } as any,
@@ -51,31 +53,33 @@ export const JoggingCartesianTab = observer(
51
53
  opts: JoggingCartesianOpts,
52
54
  increment: DiscreteIncrementOption,
53
55
  ) {
54
- const tcpPose = store.jogger.motionStream.rapidlyChangingMotionState.tcp_pose
56
+ const tcpPose =
57
+ store.jogger.motionStream.rapidlyChangingMotionState.tcp_pose
55
58
  const jointPosition =
56
- store.jogger.motionStream.rapidlyChangingMotionState.state.joint_position
59
+ store.jogger.motionStream.rapidlyChangingMotionState.state
60
+ .joint_position
57
61
  if (!tcpPose) return
58
62
 
59
- // await robotPad.withMotionLock(async () => {
60
- // await jogger.runIncrementalCartesianMotion({
61
- // currentTcpPose: tcpPose,
62
- // currentJoints: jointPosition,
63
- // coordSystemId: store.selectedCoordSystemId,
64
- // velocityInRelevantUnits: store.velocityInCurrentUnits,
65
- // axis: opts.axis,
66
- // direction: opts.direction,
67
- // motion:
68
- // store.selectedCartesianMotionType === "translate"
69
- // ? {
70
- // type: "translate",
71
- // distanceMm: increment.mm,
72
- // }
73
- // : {
74
- // type: "rotate",
75
- // distanceRads: degreesToRadians(increment.degrees),
76
- // },
77
- // })
78
- // })
63
+ await store.withMotionLock(async () => {
64
+ await store.jogger.runIncrementalCartesianMotion({
65
+ currentTcpPose: tcpPose,
66
+ currentJoints: jointPosition,
67
+ coordSystemId: store.selectedCoordSystemId,
68
+ velocityInRelevantUnits: store.velocityInCurrentUnits,
69
+ axis: opts.axis,
70
+ direction: opts.direction,
71
+ motion:
72
+ store.selectedCartesianMotionType === "translate"
73
+ ? {
74
+ type: "translate",
75
+ distanceMm: increment.mm,
76
+ }
77
+ : {
78
+ type: "rotate",
79
+ distanceRads: degreesToRadians(increment.degrees),
80
+ },
81
+ })
82
+ })
79
83
  }
80
84
 
81
85
  async function startCartesianJogging(opts: JoggingCartesianOpts) {
@@ -97,7 +101,6 @@ export const JoggingCartesianTab = observer(
97
101
  direction: opts.direction,
98
102
  velocityRadsPerSec: store.rotationVelocityRadsPerSec,
99
103
  })
100
-
101
104
  }
102
105
  }
103
106
 
@@ -141,26 +144,19 @@ export const JoggingCartesianTab = observer(
141
144
 
142
145
  return (
143
146
  <Stack>
144
- {/* Jogging options */}
145
- <JoggingOptions store={store} />
146
-
147
147
  {/* Show Wandelscript string for the current coords */}
148
148
  <JoggingCartesianValues store={store} />
149
149
 
150
- {/* Translate or rotate toggle */}
151
- <Stack alignItems="center" marginTop="1rem">
150
+ {/* Jogging options */}
151
+ <JoggingOptions store={store} />
152
+
153
+ <Stack width="80%" maxWidth="296px" margin="auto" marginTop="24px">
154
+ {/* Translate or rotate toggle */}
152
155
  <ToggleButtonGroup
153
156
  value={store.selectedCartesianMotionType}
154
157
  onChange={onMotionTypeChange}
155
158
  exclusive
156
159
  aria-label={t("Jogging.Cartesian.MotionType.lb")}
157
- sx={{
158
- "& > button": {
159
- borderRadius: "8px",
160
- textTransform: "none",
161
- padding: "4px 30px",
162
- },
163
- }}
164
160
  >
165
161
  <ToggleButton value="translate">
166
162
  {t("Jogging.Cartesian.Translation.bt")}
@@ -169,9 +165,7 @@ export const JoggingCartesianTab = observer(
169
165
  {t("Jogging.Cartesian.Rotation.bt")}
170
166
  </ToggleButton>
171
167
  </ToggleButtonGroup>
172
- </Stack>
173
168
 
174
- <Stack width="80%" maxWidth="296px" margin="auto">
175
169
  {/* Cartesian translate jogging */}
176
170
  {store.selectedCartesianMotionType === "translate" &&
177
171
  axisList.map((axis) => (
@@ -197,9 +191,8 @@ export const JoggingCartesianTab = observer(
197
191
  }
198
192
  getDisplayedValue={() =>
199
193
  formatMM(
200
- store.jogger.motionStream.rapidlyChangingMotionState.tcp_pose?.position[
201
- axis.id
202
- ] || 0,
194
+ store.jogger.motionStream.rapidlyChangingMotionState
195
+ .tcp_pose?.position[axis.id] || 0,
203
196
  )
204
197
  }
205
198
  startJogging={(direction: "-" | "+") =>
@@ -238,8 +231,8 @@ export const JoggingCartesianTab = observer(
238
231
  }
239
232
  getDisplayedValue={() =>
240
233
  formatDegrees(
241
- store.jogger.motionStream.rapidlyChangingMotionState.tcp_pose
242
- ?.orientation?.[axis.id] || 0,
234
+ store.jogger.motionStream.rapidlyChangingMotionState
235
+ .tcp_pose?.orientation?.[axis.id] || 0,
243
236
  )
244
237
  }
245
238
  startJogging={(direction: "-" | "+") =>