@wandelbots/wandelbots-js-react-components 2.27.1-pr.feature-add-cycle-timer.368.3779de1 → 2.27.1-pr.feature-add-cycle-timer.368.c18c8bd

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wandelbots/wandelbots-js-react-components",
3
- "version": "2.27.1-pr.feature-add-cycle-timer.368.3779de1",
3
+ "version": "2.27.1-pr.feature-add-cycle-timer.368.c18c8bd",
4
4
  "description": "React UI toolkit for building applications on top of the Wandelbots platform",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -12,6 +12,10 @@ export interface CycleTimerProps {
12
12
  onCycleEnd?: () => void
13
13
  /** Whether the timer should start automatically when maxTime is set */
14
14
  autoStart?: boolean
15
+ /** Visual variant of the timer */
16
+ variant?: "default" | "small"
17
+ /** For small variant: whether to show remaining time details (compact hides them) */
18
+ compact?: boolean
15
19
  /** Additional CSS classes */
16
20
  className?: string
17
21
  }
@@ -26,10 +30,13 @@ export interface CycleTimerProps {
26
30
  * - Automatically counts down and triggers callback when reaching zero
27
31
  * - Fully localized with i18next
28
32
  * - Material-UI theming integration
33
+ * - Small variant with animated progress icon (gauge border only) next to text
29
34
  *
30
35
  * @param onCycleComplete - Callback that receives the startNewCycle function for controlling the timer
31
36
  * @param onCycleEnd - Optional callback fired when a cycle actually completes (reaches zero)
32
37
  * @param autoStart - Whether to start timer automatically (default: true)
38
+ * @param variant - Visual variant: "default" (large gauge) or "small" (animated icon with text)
39
+ * @param compact - For small variant: whether to hide remaining time details
33
40
  * @param className - Additional CSS classes
34
41
  */
35
42
  export const CycleTimer = externalizeComponent(
@@ -38,6 +45,8 @@ export const CycleTimer = externalizeComponent(
38
45
  onCycleComplete,
39
46
  onCycleEnd,
40
47
  autoStart = true,
48
+ variant = "default",
49
+ compact = false,
41
50
  className,
42
51
  }: CycleTimerProps) => {
43
52
  const theme = useTheme()
@@ -116,6 +125,78 @@ export const CycleTimer = externalizeComponent(
116
125
  const progressValue =
117
126
  maxTime > 0 ? ((maxTime - remainingTime) / maxTime) * 100 : 0
118
127
 
128
+ // Small variant: horizontal layout with gauge icon and text
129
+ if (variant === "small") {
130
+ return (
131
+ <Box
132
+ className={className}
133
+ sx={{
134
+ display: "flex",
135
+ alignItems: "center",
136
+ gap: 0.125, // Minimal gap - 1px
137
+ }}
138
+ >
139
+ {/* Animated progress gauge icon */}
140
+ <Box
141
+ sx={{
142
+ position: "relative",
143
+ width: 40,
144
+ height: 40,
145
+ display: "flex",
146
+ alignItems: "center",
147
+ justifyContent: "center",
148
+ borderRadius: "50%",
149
+ overflow: "visible",
150
+ }}
151
+ >
152
+ <Gauge
153
+ width={40}
154
+ height={40}
155
+ value={progressValue}
156
+ valueMin={0}
157
+ valueMax={100}
158
+ innerRadius="70%"
159
+ outerRadius="95%"
160
+ sx={{
161
+ [`& .MuiGauge-valueArc`]: {
162
+ fill: theme.palette.success.main,
163
+ },
164
+ [`& .MuiGauge-referenceArc`]: {
165
+ fill: theme.palette.success.main,
166
+ opacity: 0.3,
167
+ },
168
+ [`& .MuiGauge-valueText`]: {
169
+ display: "none",
170
+ },
171
+ [`& .MuiGauge-text`]: {
172
+ display: "none",
173
+ },
174
+ [`& text`]: {
175
+ display: "none",
176
+ },
177
+ }}
178
+ />
179
+ </Box>
180
+
181
+ {/* Timer text display */}
182
+ <Typography
183
+ variant="body2"
184
+ sx={{
185
+ color: theme.palette.text.primary,
186
+ fontSize: "14px",
187
+ }}
188
+ >
189
+ {compact
190
+ ? // Compact mode: show only remaining time
191
+ formatTime(remainingTime)
192
+ : // Full mode: show "remaining / total min." format
193
+ `${formatTime(remainingTime)} / ${formatTime(maxTime)} ${t("CycleTimer.Min.lb")}`}
194
+ </Typography>
195
+ </Box>
196
+ )
197
+ }
198
+
199
+ // Default variant: large circular gauge with centered content
119
200
  return (
120
201
  <Box
121
202
  className={className}
@@ -147,7 +228,7 @@ export const CycleTimer = externalizeComponent(
147
228
  }}
148
229
  />
149
230
 
150
- {/* Center content overlay */}
231
+ {/* Center content overlay with timer information */}
151
232
  <Box
152
233
  sx={{
153
234
  position: "absolute",
@@ -157,7 +238,7 @@ export const CycleTimer = externalizeComponent(
157
238
  width: 187, // 71% of 264 = ~187px inner radius
158
239
  height: 187,
159
240
  borderRadius: "50%",
160
- backgroundColor: theme.palette.backgroundPaperElevation?.[8], // background/paper-elevation-8
241
+ backgroundColor: theme.palette.backgroundPaperElevation?.[8],
161
242
  display: "flex",
162
243
  flexDirection: "column",
163
244
  alignItems: "center",
@@ -192,7 +273,7 @@ export const CycleTimer = externalizeComponent(
192
273
  {formatTime(remainingTime)}
193
274
  </Typography>
194
275
 
195
- {/* Total time at bottom */}
276
+ {/* Total time display */}
196
277
  <Typography
197
278
  variant="body2"
198
279
  sx={{