@wandelbots/wandelbots-js-react-components 2.28.0 → 2.29.0-pr.feature-add-cycle-timer.368.cb225d2
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.
- package/dist/components/CycleTimer.d.ts +79 -0
- package/dist/components/CycleTimer.d.ts.map +1 -0
- package/dist/components/ProgramControl.d.ts +43 -0
- package/dist/components/ProgramControl.d.ts.map +1 -0
- package/dist/components/jogging/JoggingStore.d.ts +1 -1
- package/dist/index.cjs +82 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16622 -8526
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/src/components/CycleTimer.tsx +369 -0
- package/src/components/ProgramControl.tsx +217 -0
- package/src/i18n/locales/de/translations.json +7 -1
- package/src/i18n/locales/en/translations.json +7 -1
- package/src/index.ts +2 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export interface CycleTimerProps {
|
|
2
|
+
/**
|
|
3
|
+
* Callback that receives the timer control functions:
|
|
4
|
+
* - `startNewCycle(maxTimeSeconds, elapsedSeconds?)` - Start a new timer cycle
|
|
5
|
+
* - `pause()` - Pause the countdown while preserving remaining time
|
|
6
|
+
* - `resume()` - Resume countdown from where it was paused
|
|
7
|
+
* - `isPaused()` - Check current pause state
|
|
8
|
+
*/
|
|
9
|
+
onCycleComplete: (controls: {
|
|
10
|
+
startNewCycle: (maxTimeSeconds: number, elapsedSeconds?: number) => void;
|
|
11
|
+
pause: () => void;
|
|
12
|
+
resume: () => void;
|
|
13
|
+
isPaused: () => boolean;
|
|
14
|
+
}) => void;
|
|
15
|
+
/** Callback fired when a cycle actually completes (reaches zero) */
|
|
16
|
+
onCycleEnd?: () => void;
|
|
17
|
+
/** Whether the timer should start automatically when maxTime is set */
|
|
18
|
+
autoStart?: boolean;
|
|
19
|
+
/** Visual variant of the timer */
|
|
20
|
+
variant?: "default" | "small";
|
|
21
|
+
/** For small variant: whether to show remaining time details (compact hides them) */
|
|
22
|
+
compact?: boolean;
|
|
23
|
+
/** Additional CSS classes */
|
|
24
|
+
className?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A circular gauge timer component that shows the remaining time of a cycle
|
|
28
|
+
*
|
|
29
|
+
* Features:
|
|
30
|
+
* - Circular gauge with 264px diameter and 40px thickness
|
|
31
|
+
* - Shows remaining time prominently in the center (60px font)
|
|
32
|
+
* - Displays "remaining time" label at top and total time at bottom
|
|
33
|
+
* - Automatically counts down and triggers callback when reaching zero
|
|
34
|
+
* - Full timer control: start, pause, resume functionality
|
|
35
|
+
* - Support for starting with elapsed time (resume mid-cycle)
|
|
36
|
+
* - Fully localized with i18next
|
|
37
|
+
* - Material-UI theming integration
|
|
38
|
+
* - Small variant with animated progress icon (gauge border only) next to text
|
|
39
|
+
*
|
|
40
|
+
* @param onCycleComplete - Callback that receives timer control functions
|
|
41
|
+
* @param onCycleEnd - Optional callback fired when a cycle actually completes (reaches zero)
|
|
42
|
+
* @param autoStart - Whether to start timer automatically (default: true)
|
|
43
|
+
* @param variant - Visual variant: "default" (large gauge) or "small" (animated icon with text)
|
|
44
|
+
* @param compact - For small variant: whether to hide remaining time details
|
|
45
|
+
* @param className - Additional CSS classes
|
|
46
|
+
*
|
|
47
|
+
* Usage:
|
|
48
|
+
* ```tsx
|
|
49
|
+
* <CycleTimer
|
|
50
|
+
* onCycleComplete={(controls) => {
|
|
51
|
+
* // Start a 5-minute cycle
|
|
52
|
+
* controls.startNewCycle(300)
|
|
53
|
+
*
|
|
54
|
+
* // Or start a 5-minute cycle with 2 minutes already elapsed
|
|
55
|
+
* controls.startNewCycle(300, 120)
|
|
56
|
+
*
|
|
57
|
+
* // Pause the timer
|
|
58
|
+
* controls.pause()
|
|
59
|
+
*
|
|
60
|
+
* // Resume the timer
|
|
61
|
+
* controls.resume()
|
|
62
|
+
*
|
|
63
|
+
* // Check if paused
|
|
64
|
+
* const paused = controls.isPaused()
|
|
65
|
+
* }}
|
|
66
|
+
* onCycleEnd={() => console.log('Cycle completed!')}
|
|
67
|
+
* />
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* Control Functions:
|
|
71
|
+
* - `startNewCycle(maxTimeSeconds, elapsedSeconds?)` - Start a new timer cycle
|
|
72
|
+
* - `pause()` - Pause the countdown while preserving remaining time
|
|
73
|
+
* - `resume()` - Resume countdown from where it was paused
|
|
74
|
+
* - `isPaused()` - Check current pause state
|
|
75
|
+
*/
|
|
76
|
+
export declare const CycleTimer: (({ onCycleComplete, onCycleEnd, autoStart, variant, compact, className, }: CycleTimerProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
77
|
+
displayName: string;
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=CycleTimer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CycleTimer.d.ts","sourceRoot":"","sources":["../../src/components/CycleTimer.tsx"],"names":[],"mappings":"AAOA,MAAM,WAAW,eAAe;IAC9B;;;;;;OAMG;IACH,eAAe,EAAE,CAAC,QAAQ,EAAE;QAC1B,aAAa,EAAE,CAAC,cAAc,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;QACxE,KAAK,EAAE,MAAM,IAAI,CAAA;QACjB,MAAM,EAAE,MAAM,IAAI,CAAA;QAClB,QAAQ,EAAE,MAAM,OAAO,CAAA;KACxB,KAAK,IAAI,CAAA;IACV,oEAAoE;IACpE,UAAU,CAAC,EAAE,MAAM,IAAI,CAAA;IACvB,uEAAuE;IACvE,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,kCAAkC;IAClC,OAAO,CAAC,EAAE,SAAS,GAAG,OAAO,CAAA;IAC7B,qFAAqF;IACrF,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,eAAO,MAAM,UAAU,8EAShB,eAAe;;CAoRrB,CAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export type ProgramState = "idle" | "running" | "paused" | "stopping";
|
|
2
|
+
export interface ProgramControlProps {
|
|
3
|
+
/** The current state of the program control */
|
|
4
|
+
state: ProgramState;
|
|
5
|
+
/** Callback fired when the run/resume button is clicked */
|
|
6
|
+
onRun: () => void;
|
|
7
|
+
/** Callback fired when the pause button is clicked (only available in 'with_pause' variant) */
|
|
8
|
+
onPause?: () => void;
|
|
9
|
+
/** Callback fired when the stop button is clicked */
|
|
10
|
+
onStop: () => void;
|
|
11
|
+
/**
|
|
12
|
+
* Function to reset the component from 'stopping' state back to 'idle'.
|
|
13
|
+
* This must be called manually by the user when requiresManualReset is true.
|
|
14
|
+
*/
|
|
15
|
+
onReset?: () => void;
|
|
16
|
+
/**
|
|
17
|
+
* When true, the component will stay in 'stopping' state until onReset is called manually.
|
|
18
|
+
* When false (default), auto-resets to 'idle' after 2 seconds.
|
|
19
|
+
*/
|
|
20
|
+
requiresManualReset?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Variant of the component:
|
|
23
|
+
* - 'with_pause': Shows run/pause/stop buttons (default)
|
|
24
|
+
* - 'without_pause': Shows only run/stop buttons
|
|
25
|
+
*/
|
|
26
|
+
variant?: "with_pause" | "without_pause";
|
|
27
|
+
/** Additional CSS class name */
|
|
28
|
+
className?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A control component for program execution with run, pause, and stop functionality.
|
|
32
|
+
*
|
|
33
|
+
* Features:
|
|
34
|
+
* - State machine with idle, running, paused, and stopping states
|
|
35
|
+
* - Two variants: with_pause (3 buttons) and without_pause (2 buttons)
|
|
36
|
+
* - Optional manual reset functionality
|
|
37
|
+
* - Responsive design with 110px circular buttons
|
|
38
|
+
* - Material-UI theming integration
|
|
39
|
+
*/
|
|
40
|
+
export declare const ProgramControl: (({ state, onRun, onPause, onStop, onReset, requiresManualReset, variant, className, }: ProgramControlProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
41
|
+
displayName: string;
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=ProgramControl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgramControl.d.ts","sourceRoot":"","sources":["../../src/components/ProgramControl.tsx"],"names":[],"mappings":"AAMA,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,CAAA;AAErE,MAAM,WAAW,mBAAmB;IAClC,+CAA+C;IAC/C,KAAK,EAAE,YAAY,CAAA;IACnB,2DAA2D;IAC3D,KAAK,EAAE,MAAM,IAAI,CAAA;IACjB,+FAA+F;IAC/F,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,qDAAqD;IACrD,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B;;;;OAIG;IACH,OAAO,CAAC,EAAE,YAAY,GAAG,eAAe,CAAA;IACxC,gCAAgC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AASD;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,0FAWpB,mBAAmB;;CAuJzB,CAAA"}
|
|
@@ -113,7 +113,7 @@ export declare class JoggingStore {
|
|
|
113
113
|
saveToLocalStorage(): void;
|
|
114
114
|
get isLocked(): boolean;
|
|
115
115
|
get localStorageSave(): {
|
|
116
|
-
selectedTabId: "
|
|
116
|
+
selectedTabId: "debug" | "cartesian" | "joint";
|
|
117
117
|
selectedCoordSystemId: string;
|
|
118
118
|
selectedTcpId: string;
|
|
119
119
|
selectedOrientation: string;
|