@bug-on/m3-expressive 1.2.5 → 1.2.7
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/CHANGELOG.md +12 -0
- package/dist/buttons.js +260 -98
- package/dist/buttons.js.map +1 -1
- package/dist/buttons.mjs +261 -99
- package/dist/buttons.mjs.map +1 -1
- package/dist/core.js +338 -176
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +321 -159
- package/dist/core.mjs.map +1 -1
- package/dist/feedback.d.mts +32 -0
- package/dist/feedback.d.ts +32 -0
- package/dist/feedback.js +348 -186
- package/dist/feedback.js.map +1 -1
- package/dist/feedback.mjs +326 -164
- package/dist/feedback.mjs.map +1 -1
- package/dist/index.js +261 -99
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +262 -100
- package/dist/index.mjs.map +1 -1
- package/dist/layout.js +261 -99
- package/dist/layout.js.map +1 -1
- package/dist/layout.mjs +262 -100
- package/dist/layout.mjs.map +1 -1
- package/dist/navigation.js +260 -98
- package/dist/navigation.js.map +1 -1
- package/dist/navigation.mjs +261 -99
- package/dist/navigation.mjs.map +1 -1
- package/dist/overlays.js +391 -229
- package/dist/overlays.js.map +1 -1
- package/dist/overlays.mjs +354 -192
- package/dist/overlays.mjs.map +1 -1
- package/dist/pickers.js +399 -237
- package/dist/pickers.js.map +1 -1
- package/dist/pickers.mjs +367 -205
- package/dist/pickers.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @bug-on/m3-expressive
|
|
2
2
|
|
|
3
|
+
## 1.2.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 81a5076: Fix issues Circular Indeterminate do not work.
|
|
8
|
+
|
|
9
|
+
## 1.2.6
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 564003a: Improve Progress Indicator component
|
|
14
|
+
|
|
3
15
|
## 1.2.5
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/buttons.js
CHANGED
|
@@ -278,26 +278,46 @@ function generateWavyCircularPath(center, radius, amplitude, wavelength) {
|
|
|
278
278
|
if (i === 0) d += `M ${xAt(t0).toFixed(2)} ${yAt(t0).toFixed(2)}`;
|
|
279
279
|
d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${xAt(t1).toFixed(2)} ${yAt(t1).toFixed(2)}`;
|
|
280
280
|
}
|
|
281
|
-
d
|
|
282
|
-
return d;
|
|
281
|
+
return `${d} Z`;
|
|
283
282
|
}
|
|
284
283
|
function getSinePath(startX, endX, phase, wl, amp) {
|
|
285
284
|
if (startX >= endX) return "";
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
285
|
+
if (amp <= 0.01) {
|
|
286
|
+
return `M ${startX.toFixed(2)} 0 L ${endX.toFixed(2)} 0`;
|
|
287
|
+
}
|
|
288
|
+
const safeWl = Math.max(1, wl);
|
|
289
|
+
const k = 2 * Math.PI / safeWl;
|
|
290
|
+
const phi = phase / safeWl * 2 * Math.PI;
|
|
291
|
+
const yAt = (x) => amp * Math.sin(k * x + phi);
|
|
292
|
+
const dyAt = (x) => amp * k * Math.cos(k * x + phi);
|
|
293
|
+
const step = safeWl / 4;
|
|
294
|
+
let d = `M ${startX.toFixed(2)} ${yAt(startX).toFixed(2)}`;
|
|
295
|
+
let currentX = startX;
|
|
296
|
+
while (currentX < endX) {
|
|
297
|
+
const nextX = Math.min(endX, currentX + step);
|
|
298
|
+
const dx = nextX - currentX;
|
|
299
|
+
const scale = dx / 3;
|
|
300
|
+
const y0 = yAt(currentX);
|
|
301
|
+
const dy0 = dyAt(currentX);
|
|
302
|
+
const y1 = yAt(nextX);
|
|
303
|
+
const dy1 = dyAt(nextX);
|
|
304
|
+
const cp1x = currentX + scale;
|
|
305
|
+
const cp1y = y0 + scale * dy0;
|
|
306
|
+
const cp2x = nextX - scale;
|
|
307
|
+
const cp2y = y1 - scale * dy1;
|
|
308
|
+
d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${nextX.toFixed(2)} ${y1.toFixed(2)}`;
|
|
309
|
+
currentX = nextX;
|
|
296
310
|
}
|
|
297
|
-
const yEnd = Math.sin((endX + phase) / wl * 2 * Math.PI) * amp;
|
|
298
|
-
d += ` L ${endX.toFixed(2)} ${yEnd.toFixed(2)}`;
|
|
299
311
|
return d;
|
|
300
312
|
}
|
|
313
|
+
var GLOBAL_ROTATION_DURATION = 6e3;
|
|
314
|
+
var GLOBAL_ROTATION_TARGET = 1080;
|
|
315
|
+
var ADDITIONAL_ROTATION_CYCLE = 1500;
|
|
316
|
+
var ADDITIONAL_ROTATION_STEP = 90;
|
|
317
|
+
var ADDITIONAL_ROTATION_EASE_DURATION = 500;
|
|
318
|
+
var DEFAULT_MIN_PROGRESS = 0.1;
|
|
319
|
+
var DEFAULT_MAX_PROGRESS = 0.8;
|
|
320
|
+
var PROGRESS_CYCLE_DURATION = 1500;
|
|
301
321
|
var CircularProgress = React16__namespace.forwardRef(
|
|
302
322
|
(_a, ref) => {
|
|
303
323
|
var _b = _a, {
|
|
@@ -311,6 +331,10 @@ var CircularProgress = React16__namespace.forwardRef(
|
|
|
311
331
|
crawlerSpeed = 1,
|
|
312
332
|
color,
|
|
313
333
|
trackColor,
|
|
334
|
+
showTrack = "auto",
|
|
335
|
+
minProgress = DEFAULT_MIN_PROGRESS,
|
|
336
|
+
maxProgress = DEFAULT_MAX_PROGRESS,
|
|
337
|
+
amplitudeRange,
|
|
314
338
|
className,
|
|
315
339
|
"aria-label": ariaLabel
|
|
316
340
|
} = _b, restProps = __objRest(_b, [
|
|
@@ -324,6 +348,10 @@ var CircularProgress = React16__namespace.forwardRef(
|
|
|
324
348
|
"crawlerSpeed",
|
|
325
349
|
"color",
|
|
326
350
|
"trackColor",
|
|
351
|
+
"showTrack",
|
|
352
|
+
"minProgress",
|
|
353
|
+
"maxProgress",
|
|
354
|
+
"amplitudeRange",
|
|
327
355
|
"className",
|
|
328
356
|
"aria-label"
|
|
329
357
|
]);
|
|
@@ -334,6 +362,7 @@ var CircularProgress = React16__namespace.forwardRef(
|
|
|
334
362
|
const activeColor = color || "var(--md-sys-color-indicator-active)";
|
|
335
363
|
const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
|
|
336
364
|
const isWavy = shape === "wavy";
|
|
365
|
+
const shouldShowIndeterminateTrack = showTrack === "auto" ? isWavy : showTrack;
|
|
337
366
|
const BASELINE_SIZE = 48;
|
|
338
367
|
const scaleFactor = size / BASELINE_SIZE;
|
|
339
368
|
const effectiveAmplitude = React16__namespace.useMemo(
|
|
@@ -344,6 +373,10 @@ var CircularProgress = React16__namespace.forwardRef(
|
|
|
344
373
|
() => wavelength != null ? wavelength : 15 * scaleFactor,
|
|
345
374
|
[wavelength, scaleFactor]
|
|
346
375
|
);
|
|
376
|
+
const resolvedAmplitudeRange = React16__namespace.useMemo(
|
|
377
|
+
() => amplitudeRange != null ? amplitudeRange : [0, effectiveAmplitude],
|
|
378
|
+
[amplitudeRange, effectiveAmplitude]
|
|
379
|
+
);
|
|
347
380
|
const wavyActivePath = React16__namespace.useMemo(
|
|
348
381
|
() => isWavy ? generateWavyCircularPath(
|
|
349
382
|
center,
|
|
@@ -363,6 +396,145 @@ var CircularProgress = React16__namespace.forwardRef(
|
|
|
363
396
|
const trackLength = isDeterminate ? Math.max(1e-3, 1 - activeAngularFraction - 2 * gapForTrack) : 1;
|
|
364
397
|
const ActiveCircleElem = react.m.circle;
|
|
365
398
|
const ActivePathElem = react.m.path;
|
|
399
|
+
const indeterminateSvgRef = React16__namespace.useRef(null);
|
|
400
|
+
const indeterminateTrackRef = React16__namespace.useRef(null);
|
|
401
|
+
const indeterminateActiveRef = React16__namespace.useRef(null);
|
|
402
|
+
const indeterminateWavyTrackPathRef = React16__namespace.useRef(null);
|
|
403
|
+
const indeterminateWavyActivePathRef = React16__namespace.useRef(null);
|
|
404
|
+
const cachedPathLengthRef = React16__namespace.useRef(0);
|
|
405
|
+
React16__namespace.useLayoutEffect(() => {
|
|
406
|
+
if (!isWavy || !wavyActivePath) {
|
|
407
|
+
cachedPathLengthRef.current = circumference;
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
const el = indeterminateActiveRef.current;
|
|
411
|
+
if (el && "getTotalLength" in el) {
|
|
412
|
+
try {
|
|
413
|
+
const len = el.getTotalLength();
|
|
414
|
+
if (len > 0) {
|
|
415
|
+
cachedPathLengthRef.current = len;
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
} catch (e) {
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
cachedPathLengthRef.current = circumference;
|
|
422
|
+
}, [isWavy, circumference, wavyActivePath]);
|
|
423
|
+
react.useAnimationFrame((time) => {
|
|
424
|
+
if (isDeterminate) return;
|
|
425
|
+
const safeCrawlerSpeed = Math.max(0.1, crawlerSpeed);
|
|
426
|
+
const scaledTime = time * safeCrawlerSpeed;
|
|
427
|
+
const globalCycle = scaledTime % GLOBAL_ROTATION_DURATION;
|
|
428
|
+
const globalAngle = globalCycle / GLOBAL_ROTATION_DURATION * GLOBAL_ROTATION_TARGET;
|
|
429
|
+
const additionalFullCycles = Math.floor(
|
|
430
|
+
scaledTime / ADDITIONAL_ROTATION_CYCLE
|
|
431
|
+
);
|
|
432
|
+
const additionalCycleTime = scaledTime % ADDITIONAL_ROTATION_CYCLE;
|
|
433
|
+
const additionalEaseT = Math.min(
|
|
434
|
+
1,
|
|
435
|
+
additionalCycleTime / ADDITIONAL_ROTATION_EASE_DURATION
|
|
436
|
+
);
|
|
437
|
+
const additionalAngle = (additionalFullCycles + easeInOutCubic(additionalEaseT)) * ADDITIONAL_ROTATION_STEP;
|
|
438
|
+
const totalRotation = globalAngle + additionalAngle;
|
|
439
|
+
if (indeterminateSvgRef.current) {
|
|
440
|
+
indeterminateSvgRef.current.style.transform = `rotate(${totalRotation - 90}deg)`;
|
|
441
|
+
}
|
|
442
|
+
const progressFullCycle = PROGRESS_CYCLE_DURATION * 2;
|
|
443
|
+
const progressCycleTime = scaledTime % progressFullCycle;
|
|
444
|
+
let progress;
|
|
445
|
+
if (progressCycleTime < PROGRESS_CYCLE_DURATION) {
|
|
446
|
+
const t = progressCycleTime / PROGRESS_CYCLE_DURATION;
|
|
447
|
+
progress = minProgress + (maxProgress - minProgress) * easeInOutCubic(t);
|
|
448
|
+
} else {
|
|
449
|
+
const t = (progressCycleTime - PROGRESS_CYCLE_DURATION) / PROGRESS_CYCLE_DURATION;
|
|
450
|
+
progress = maxProgress - (maxProgress - minProgress) * easeInOutCubic(t);
|
|
451
|
+
}
|
|
452
|
+
if (isWavy) {
|
|
453
|
+
const amplitudeT = (progress - minProgress) / (maxProgress - minProgress);
|
|
454
|
+
const currentAmplitude = resolvedAmplitudeRange[0] + (resolvedAmplitudeRange[1] - resolvedAmplitudeRange[0]) * amplitudeT;
|
|
455
|
+
const dynamicPath = generateWavyCircularPath(
|
|
456
|
+
center,
|
|
457
|
+
radius,
|
|
458
|
+
currentAmplitude,
|
|
459
|
+
effectiveWavelength
|
|
460
|
+
);
|
|
461
|
+
if (indeterminateWavyActivePathRef.current) {
|
|
462
|
+
indeterminateWavyActivePathRef.current.setAttribute("d", dynamicPath);
|
|
463
|
+
}
|
|
464
|
+
if (indeterminateWavyTrackPathRef.current) {
|
|
465
|
+
indeterminateWavyTrackPathRef.current.setAttribute("d", dynamicPath);
|
|
466
|
+
}
|
|
467
|
+
const pathEl = indeterminateWavyActivePathRef.current;
|
|
468
|
+
let totalLen = cachedPathLengthRef.current || circumference;
|
|
469
|
+
if (pathEl) {
|
|
470
|
+
try {
|
|
471
|
+
const len = pathEl.getTotalLength();
|
|
472
|
+
if (len > 0) totalLen = len;
|
|
473
|
+
} catch (e) {
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
const gapFrac = (gapSize + trackHeight) / totalLen;
|
|
477
|
+
const activeLen = totalLen * progress;
|
|
478
|
+
const activeOff = 0;
|
|
479
|
+
if (indeterminateWavyActivePathRef.current) {
|
|
480
|
+
indeterminateWavyActivePathRef.current.setAttribute(
|
|
481
|
+
"stroke-dasharray",
|
|
482
|
+
`${activeLen} ${totalLen}`
|
|
483
|
+
);
|
|
484
|
+
indeterminateWavyActivePathRef.current.setAttribute(
|
|
485
|
+
"stroke-dashoffset",
|
|
486
|
+
`${activeOff}`
|
|
487
|
+
);
|
|
488
|
+
}
|
|
489
|
+
if (shouldShowIndeterminateTrack && indeterminateWavyTrackPathRef.current) {
|
|
490
|
+
const trackStartFrac = progress + gapFrac;
|
|
491
|
+
const trackLen = Math.max(
|
|
492
|
+
1e-3,
|
|
493
|
+
totalLen * (1 - progress - 2 * gapFrac)
|
|
494
|
+
);
|
|
495
|
+
const trackOff = -totalLen * trackStartFrac;
|
|
496
|
+
indeterminateWavyTrackPathRef.current.setAttribute(
|
|
497
|
+
"stroke-dasharray",
|
|
498
|
+
`${trackLen} ${totalLen}`
|
|
499
|
+
);
|
|
500
|
+
indeterminateWavyTrackPathRef.current.setAttribute(
|
|
501
|
+
"stroke-dashoffset",
|
|
502
|
+
`${trackOff}`
|
|
503
|
+
);
|
|
504
|
+
}
|
|
505
|
+
} else {
|
|
506
|
+
const totalLen = circumference;
|
|
507
|
+
const activeLen = totalLen * progress;
|
|
508
|
+
const activeOff = 0;
|
|
509
|
+
if (indeterminateActiveRef.current) {
|
|
510
|
+
indeterminateActiveRef.current.setAttribute(
|
|
511
|
+
"stroke-dasharray",
|
|
512
|
+
`${activeLen} ${totalLen}`
|
|
513
|
+
);
|
|
514
|
+
indeterminateActiveRef.current.setAttribute(
|
|
515
|
+
"stroke-dashoffset",
|
|
516
|
+
`${activeOff}`
|
|
517
|
+
);
|
|
518
|
+
}
|
|
519
|
+
if (shouldShowIndeterminateTrack && indeterminateTrackRef.current) {
|
|
520
|
+
const gapFrac = (gapSize + trackHeight) / totalLen;
|
|
521
|
+
const trackStartFrac = progress + gapFrac;
|
|
522
|
+
const trackLen = Math.max(
|
|
523
|
+
1e-3,
|
|
524
|
+
totalLen * (1 - progress - 2 * gapFrac)
|
|
525
|
+
);
|
|
526
|
+
const trackOff = -totalLen * trackStartFrac;
|
|
527
|
+
indeterminateTrackRef.current.setAttribute(
|
|
528
|
+
"stroke-dasharray",
|
|
529
|
+
`${trackLen} ${totalLen}`
|
|
530
|
+
);
|
|
531
|
+
indeterminateTrackRef.current.setAttribute(
|
|
532
|
+
"stroke-dashoffset",
|
|
533
|
+
`${trackOff}`
|
|
534
|
+
);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
});
|
|
366
538
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
367
539
|
"div",
|
|
368
540
|
__spreadProps(__spreadValues({
|
|
@@ -439,9 +611,10 @@ var CircularProgress = React16__namespace.forwardRef(
|
|
|
439
611
|
]
|
|
440
612
|
}
|
|
441
613
|
),
|
|
442
|
-
!isDeterminate && /* @__PURE__ */ jsxRuntime.
|
|
443
|
-
|
|
614
|
+
!isDeterminate && /* @__PURE__ */ jsxRuntime.jsx(
|
|
615
|
+
"svg",
|
|
444
616
|
{
|
|
617
|
+
ref: indeterminateSvgRef,
|
|
445
618
|
width: size,
|
|
446
619
|
height: size,
|
|
447
620
|
viewBox: `0 0 ${size} ${size}`,
|
|
@@ -450,90 +623,60 @@ var CircularProgress = React16__namespace.forwardRef(
|
|
|
450
623
|
position: "absolute",
|
|
451
624
|
inset: 0,
|
|
452
625
|
overflow: "visible",
|
|
453
|
-
|
|
454
|
-
|
|
626
|
+
transformOrigin: "center",
|
|
627
|
+
transform: "rotate(-90deg)"
|
|
455
628
|
},
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
460
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
461
|
-
ease: "linear"
|
|
462
|
-
}
|
|
463
|
-
},
|
|
464
|
-
children: [
|
|
465
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
466
|
-
react.m.circle,
|
|
629
|
+
children: isWavy ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
630
|
+
shouldShowIndeterminateTrack && /* @__PURE__ */ jsxRuntime.jsx(
|
|
631
|
+
"path",
|
|
467
632
|
{
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
r: radius,
|
|
633
|
+
ref: indeterminateWavyTrackPathRef,
|
|
634
|
+
d: wavyActivePath != null ? wavyActivePath : "",
|
|
471
635
|
fill: "none",
|
|
472
636
|
stroke: bgTrackColor,
|
|
473
637
|
strokeWidth: trackHeight,
|
|
474
|
-
strokeLinecap: "round"
|
|
475
|
-
style: { originX: "50%", originY: "50%" },
|
|
476
|
-
animate: {
|
|
477
|
-
pathLength: [
|
|
478
|
-
Math.max(1e-3, 1 - 0.1 - 2 * gapForTrack),
|
|
479
|
-
Math.max(1e-3, 1 - 0.75 - 2 * gapForTrack),
|
|
480
|
-
Math.max(1e-3, 1 - 0.1 - 2 * gapForTrack)
|
|
481
|
-
],
|
|
482
|
-
rotate: [
|
|
483
|
-
`${(0.1 + gapForTrack) * 360}deg`,
|
|
484
|
-
`${(1 + gapForTrack) * 360}deg`,
|
|
485
|
-
`${(1.1 + gapForTrack) * 360}deg`
|
|
486
|
-
]
|
|
487
|
-
},
|
|
488
|
-
transition: {
|
|
489
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
490
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
491
|
-
ease: [0.4, 0, 0.2, 1]
|
|
492
|
-
}
|
|
638
|
+
strokeLinecap: "round"
|
|
493
639
|
}
|
|
494
640
|
),
|
|
495
|
-
|
|
496
|
-
|
|
641
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
642
|
+
"path",
|
|
497
643
|
{
|
|
644
|
+
ref: indeterminateWavyActivePathRef,
|
|
498
645
|
d: wavyActivePath != null ? wavyActivePath : "",
|
|
499
646
|
fill: "none",
|
|
500
647
|
stroke: activeColor,
|
|
501
648
|
strokeWidth: trackHeight,
|
|
502
|
-
strokeLinecap: "round"
|
|
503
|
-
style: { originX: "50%", originY: "50%" },
|
|
504
|
-
animate: {
|
|
505
|
-
pathLength: [0.1, 0.75, 0.1],
|
|
506
|
-
rotate: ["0deg", "90deg", "360deg"]
|
|
507
|
-
},
|
|
508
|
-
transition: {
|
|
509
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
510
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
511
|
-
ease: [0.4, 0, 0.2, 1]
|
|
512
|
-
}
|
|
649
|
+
strokeLinecap: "round"
|
|
513
650
|
}
|
|
514
|
-
)
|
|
515
|
-
|
|
651
|
+
)
|
|
652
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
653
|
+
shouldShowIndeterminateTrack && /* @__PURE__ */ jsxRuntime.jsx(
|
|
654
|
+
"circle",
|
|
516
655
|
{
|
|
656
|
+
ref: indeterminateTrackRef,
|
|
657
|
+
cx: center,
|
|
658
|
+
cy: center,
|
|
659
|
+
r: radius,
|
|
660
|
+
fill: "none",
|
|
661
|
+
stroke: bgTrackColor,
|
|
662
|
+
strokeWidth: trackHeight,
|
|
663
|
+
strokeLinecap: "round"
|
|
664
|
+
}
|
|
665
|
+
),
|
|
666
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
667
|
+
"circle",
|
|
668
|
+
{
|
|
669
|
+
ref: indeterminateActiveRef,
|
|
517
670
|
cx: center,
|
|
518
671
|
cy: center,
|
|
519
672
|
r: radius,
|
|
520
673
|
fill: "none",
|
|
521
674
|
stroke: activeColor,
|
|
522
675
|
strokeWidth: trackHeight,
|
|
523
|
-
strokeLinecap: "round"
|
|
524
|
-
style: { originX: "50%", originY: "50%" },
|
|
525
|
-
animate: {
|
|
526
|
-
pathLength: [0.1, 0.75, 0.1],
|
|
527
|
-
rotate: ["0deg", "90deg", "360deg"]
|
|
528
|
-
},
|
|
529
|
-
transition: {
|
|
530
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
531
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
532
|
-
ease: [0.4, 0, 0.2, 1]
|
|
533
|
-
}
|
|
676
|
+
strokeLinecap: "round"
|
|
534
677
|
}
|
|
535
678
|
)
|
|
536
|
-
]
|
|
679
|
+
] })
|
|
537
680
|
}
|
|
538
681
|
)
|
|
539
682
|
] })
|
|
@@ -697,6 +840,12 @@ var WavyLinearTrack = React16__namespace.memo(function WavyLinearTrack2({
|
|
|
697
840
|
duration: 0.5
|
|
698
841
|
});
|
|
699
842
|
react.animate(fractionMV, fraction, { duration: 0.4, ease: [0.2, 0, 0, 1] });
|
|
843
|
+
} else {
|
|
844
|
+
react.animate(amplitudeMV, amplitude, {
|
|
845
|
+
type: "spring",
|
|
846
|
+
bounce: 0,
|
|
847
|
+
duration: 0.5
|
|
848
|
+
});
|
|
700
849
|
}
|
|
701
850
|
}, [
|
|
702
851
|
clampedValue,
|
|
@@ -710,10 +859,10 @@ var WavyLinearTrack = React16__namespace.memo(function WavyLinearTrack2({
|
|
|
710
859
|
1,
|
|
711
860
|
isDeterminate ? wavelength : indeterminateWavelength
|
|
712
861
|
);
|
|
713
|
-
const trackAmp = trackShape === "wavy" ? amplitude : 0;
|
|
714
862
|
react.useAnimationFrame((time) => {
|
|
715
863
|
if (width === 0) return;
|
|
716
864
|
const currentAmp = amplitudeMV.get();
|
|
865
|
+
const trackAmp = trackShape === "wavy" ? amplitude : 0;
|
|
717
866
|
const phase = time / 1e3 * waveSpeed * activeWavelength;
|
|
718
867
|
const capWidth = trackHeight / 2;
|
|
719
868
|
let activePathD = "";
|
|
@@ -733,7 +882,7 @@ var WavyLinearTrack = React16__namespace.memo(function WavyLinearTrack2({
|
|
|
733
882
|
currentAmp
|
|
734
883
|
);
|
|
735
884
|
} else if (fraction === 0) {
|
|
736
|
-
activePathD =
|
|
885
|
+
activePathD = "";
|
|
737
886
|
}
|
|
738
887
|
const trackStart = adjHead + totalGap;
|
|
739
888
|
if (trackStart < width - capWidth) {
|
|
@@ -765,20 +914,20 @@ var WavyLinearTrack = React16__namespace.memo(function WavyLinearTrack2({
|
|
|
765
914
|
activeLines.push({ tail: l1T, head: l1H });
|
|
766
915
|
activeLines.push({ tail: l2T, head: l2H });
|
|
767
916
|
}
|
|
768
|
-
const
|
|
769
|
-
const
|
|
770
|
-
const
|
|
917
|
+
const activeSegments = activeLines.map((line) => {
|
|
918
|
+
const rawTail = line.tail * width;
|
|
919
|
+
const rawHead = line.head * width;
|
|
771
920
|
const adjTail = Math.max(
|
|
772
921
|
capWidth,
|
|
773
|
-
Math.min(width - capWidth,
|
|
922
|
+
Math.min(width - capWidth, rawTail)
|
|
774
923
|
);
|
|
775
924
|
const adjHead = Math.max(
|
|
776
925
|
capWidth,
|
|
777
|
-
Math.min(width - capWidth,
|
|
926
|
+
Math.min(width - capWidth, rawHead)
|
|
778
927
|
);
|
|
779
928
|
return { adjTail, adjHead };
|
|
780
929
|
}).filter((seg) => seg.adjHead - seg.adjTail > 0.1);
|
|
781
|
-
activePathD =
|
|
930
|
+
activePathD = activeSegments.map(
|
|
782
931
|
(seg) => getSinePath(
|
|
783
932
|
seg.adjTail,
|
|
784
933
|
seg.adjHead,
|
|
@@ -787,13 +936,24 @@ var WavyLinearTrack = React16__namespace.memo(function WavyLinearTrack2({
|
|
|
787
936
|
currentAmp
|
|
788
937
|
)
|
|
789
938
|
).join(" ");
|
|
939
|
+
const validActiveLines = activeLines.filter(
|
|
940
|
+
(line) => line.head > line.tail && line.head * width > 0 && line.tail * width < width
|
|
941
|
+
).sort((a, b) => a.tail - b.tail);
|
|
790
942
|
let currentTrackX = capWidth;
|
|
791
|
-
for (const
|
|
792
|
-
const
|
|
943
|
+
for (const line of validActiveLines) {
|
|
944
|
+
const blockStart = line.tail * width - totalGap;
|
|
945
|
+
const blockEnd = line.head * width + totalGap;
|
|
946
|
+
const trackEnd = Math.min(width - capWidth, blockStart);
|
|
793
947
|
if (trackEnd > currentTrackX) {
|
|
794
|
-
trackD += `${getSinePath(
|
|
948
|
+
trackD += `${getSinePath(
|
|
949
|
+
currentTrackX,
|
|
950
|
+
trackEnd,
|
|
951
|
+
phase,
|
|
952
|
+
activeWavelength,
|
|
953
|
+
trackAmp
|
|
954
|
+
)} `;
|
|
795
955
|
}
|
|
796
|
-
currentTrackX = Math.max(currentTrackX,
|
|
956
|
+
currentTrackX = Math.max(currentTrackX, blockEnd);
|
|
797
957
|
}
|
|
798
958
|
if (currentTrackX < width - capWidth) {
|
|
799
959
|
trackD += getSinePath(
|
|
@@ -806,15 +966,15 @@ var WavyLinearTrack = React16__namespace.memo(function WavyLinearTrack2({
|
|
|
806
966
|
}
|
|
807
967
|
}
|
|
808
968
|
if (activePathRef.current)
|
|
809
|
-
activePathRef.current.setAttribute("d", activePathD);
|
|
969
|
+
activePathRef.current.setAttribute("d", activePathD || "");
|
|
810
970
|
if (trackPathRef.current)
|
|
811
|
-
trackPathRef.current.setAttribute("d", trackD.trim());
|
|
971
|
+
trackPathRef.current.setAttribute("d", trackD.trim() || "");
|
|
812
972
|
});
|
|
813
973
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
814
974
|
"div",
|
|
815
975
|
{
|
|
816
976
|
ref: containerRef,
|
|
817
|
-
className: "relative w-full
|
|
977
|
+
className: "relative w-full",
|
|
818
978
|
style: { height: svgHeight },
|
|
819
979
|
children: width > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
820
980
|
"svg",
|
|
@@ -868,7 +1028,7 @@ var LinearProgress = React16__namespace.forwardRef(
|
|
|
868
1028
|
waveSpeed = 1,
|
|
869
1029
|
crawlerSpeed = 1,
|
|
870
1030
|
determinateAnimation = "md3",
|
|
871
|
-
indeterminateAnimation = "
|
|
1031
|
+
indeterminateAnimation = "md3",
|
|
872
1032
|
gapSize = 4,
|
|
873
1033
|
showStopIndicator = "auto",
|
|
874
1034
|
color,
|
|
@@ -905,15 +1065,15 @@ var LinearProgress = React16__namespace.forwardRef(
|
|
|
905
1065
|
setIsRtl(dir === "rtl");
|
|
906
1066
|
}
|
|
907
1067
|
}, []);
|
|
908
|
-
const isWavy = shape === "wavy";
|
|
909
1068
|
const resolvedTrackShape = trackShape != null ? trackShape : shape;
|
|
1069
|
+
const isWavy = shape === "wavy" || resolvedTrackShape === "wavy";
|
|
910
1070
|
const effectiveAmplitude = React16__namespace.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
|
|
911
1071
|
const svgHeight = React16__namespace.useMemo(
|
|
912
1072
|
() => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
|
|
913
1073
|
[isWavy, trackHeight, effectiveAmplitude]
|
|
914
1074
|
);
|
|
915
1075
|
const shouldShowStop = React16__namespace.useMemo(
|
|
916
|
-
() => isDeterminate && resolvedTrackShape === "flat" &&
|
|
1076
|
+
() => isDeterminate && resolvedTrackShape === "flat" && showStopIndicator !== false,
|
|
917
1077
|
[isDeterminate, resolvedTrackShape, showStopIndicator]
|
|
918
1078
|
);
|
|
919
1079
|
const stopSize = React16__namespace.useMemo(
|
|
@@ -923,6 +1083,8 @@ var LinearProgress = React16__namespace.forwardRef(
|
|
|
923
1083
|
const stopOffset = (trackHeight - stopSize) / 2;
|
|
924
1084
|
const activeColor = color || "var(--md-sys-color-indicator-active)";
|
|
925
1085
|
const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
|
|
1086
|
+
const useWavyTrack = isWavy || !isDeterminate;
|
|
1087
|
+
const trackAmp = isWavy ? effectiveAmplitude : 0;
|
|
926
1088
|
return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
927
1089
|
"div",
|
|
928
1090
|
__spreadProps(__spreadValues({
|
|
@@ -939,12 +1101,12 @@ var LinearProgress = React16__namespace.forwardRef(
|
|
|
939
1101
|
style: { height: svgHeight }
|
|
940
1102
|
}, restProps), {
|
|
941
1103
|
children: [
|
|
942
|
-
|
|
1104
|
+
useWavyTrack ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
943
1105
|
WavyLinearTrack,
|
|
944
1106
|
{
|
|
945
1107
|
trackHeight,
|
|
946
1108
|
svgHeight,
|
|
947
|
-
amplitude:
|
|
1109
|
+
amplitude: trackAmp,
|
|
948
1110
|
wavelength,
|
|
949
1111
|
indeterminateWavelength,
|
|
950
1112
|
activeColor,
|