@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/dist/navigation.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { clsx } from 'clsx';
|
|
|
5
5
|
import { twMerge } from 'tailwind-merge';
|
|
6
6
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
7
|
import * as RxContextMenu from '@radix-ui/react-context-menu';
|
|
8
|
-
import { AnimatePresence, m, LazyMotion, domMax, useMotionValue, animate,
|
|
8
|
+
import { AnimatePresence, m, LazyMotion, domMax, useAnimationFrame, useMotionValue, animate, useReducedMotion, LayoutGroup, useScroll, useMotionValueEvent, useTransform } from 'motion/react';
|
|
9
9
|
import { cornerRadius } from '@bug-on/m3-tokens';
|
|
10
10
|
import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
|
|
11
11
|
import { Slot } from '@radix-ui/react-slot';
|
|
@@ -6315,26 +6315,46 @@ function generateWavyCircularPath(center, radius, amplitude, wavelength) {
|
|
|
6315
6315
|
if (i === 0) d += `M ${xAt(t0).toFixed(2)} ${yAt(t0).toFixed(2)}`;
|
|
6316
6316
|
d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${xAt(t1).toFixed(2)} ${yAt(t1).toFixed(2)}`;
|
|
6317
6317
|
}
|
|
6318
|
-
d
|
|
6319
|
-
return d;
|
|
6318
|
+
return `${d} Z`;
|
|
6320
6319
|
}
|
|
6321
6320
|
function getSinePath(startX, endX, phase, wl, amp) {
|
|
6322
6321
|
if (startX >= endX) return "";
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6326
|
-
|
|
6327
|
-
|
|
6328
|
-
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
|
|
6322
|
+
if (amp <= 0.01) {
|
|
6323
|
+
return `M ${startX.toFixed(2)} 0 L ${endX.toFixed(2)} 0`;
|
|
6324
|
+
}
|
|
6325
|
+
const safeWl = Math.max(1, wl);
|
|
6326
|
+
const k = 2 * Math.PI / safeWl;
|
|
6327
|
+
const phi = phase / safeWl * 2 * Math.PI;
|
|
6328
|
+
const yAt = (x) => amp * Math.sin(k * x + phi);
|
|
6329
|
+
const dyAt = (x) => amp * k * Math.cos(k * x + phi);
|
|
6330
|
+
const step = safeWl / 4;
|
|
6331
|
+
let d = `M ${startX.toFixed(2)} ${yAt(startX).toFixed(2)}`;
|
|
6332
|
+
let currentX = startX;
|
|
6333
|
+
while (currentX < endX) {
|
|
6334
|
+
const nextX = Math.min(endX, currentX + step);
|
|
6335
|
+
const dx = nextX - currentX;
|
|
6336
|
+
const scale = dx / 3;
|
|
6337
|
+
const y0 = yAt(currentX);
|
|
6338
|
+
const dy0 = dyAt(currentX);
|
|
6339
|
+
const y1 = yAt(nextX);
|
|
6340
|
+
const dy1 = dyAt(nextX);
|
|
6341
|
+
const cp1x = currentX + scale;
|
|
6342
|
+
const cp1y = y0 + scale * dy0;
|
|
6343
|
+
const cp2x = nextX - scale;
|
|
6344
|
+
const cp2y = y1 - scale * dy1;
|
|
6345
|
+
d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${nextX.toFixed(2)} ${y1.toFixed(2)}`;
|
|
6346
|
+
currentX = nextX;
|
|
6333
6347
|
}
|
|
6334
|
-
const yEnd = Math.sin((endX + phase) / wl * 2 * Math.PI) * amp;
|
|
6335
|
-
d += ` L ${endX.toFixed(2)} ${yEnd.toFixed(2)}`;
|
|
6336
6348
|
return d;
|
|
6337
6349
|
}
|
|
6350
|
+
var GLOBAL_ROTATION_DURATION = 6e3;
|
|
6351
|
+
var GLOBAL_ROTATION_TARGET = 1080;
|
|
6352
|
+
var ADDITIONAL_ROTATION_CYCLE = 1500;
|
|
6353
|
+
var ADDITIONAL_ROTATION_STEP = 90;
|
|
6354
|
+
var ADDITIONAL_ROTATION_EASE_DURATION = 500;
|
|
6355
|
+
var DEFAULT_MIN_PROGRESS = 0.1;
|
|
6356
|
+
var DEFAULT_MAX_PROGRESS = 0.8;
|
|
6357
|
+
var PROGRESS_CYCLE_DURATION = 1500;
|
|
6338
6358
|
var CircularProgress = React37.forwardRef(
|
|
6339
6359
|
(_a, ref) => {
|
|
6340
6360
|
var _b = _a, {
|
|
@@ -6348,6 +6368,10 @@ var CircularProgress = React37.forwardRef(
|
|
|
6348
6368
|
crawlerSpeed = 1,
|
|
6349
6369
|
color,
|
|
6350
6370
|
trackColor,
|
|
6371
|
+
showTrack = "auto",
|
|
6372
|
+
minProgress = DEFAULT_MIN_PROGRESS,
|
|
6373
|
+
maxProgress = DEFAULT_MAX_PROGRESS,
|
|
6374
|
+
amplitudeRange,
|
|
6351
6375
|
className,
|
|
6352
6376
|
"aria-label": ariaLabel
|
|
6353
6377
|
} = _b, restProps = __objRest(_b, [
|
|
@@ -6361,6 +6385,10 @@ var CircularProgress = React37.forwardRef(
|
|
|
6361
6385
|
"crawlerSpeed",
|
|
6362
6386
|
"color",
|
|
6363
6387
|
"trackColor",
|
|
6388
|
+
"showTrack",
|
|
6389
|
+
"minProgress",
|
|
6390
|
+
"maxProgress",
|
|
6391
|
+
"amplitudeRange",
|
|
6364
6392
|
"className",
|
|
6365
6393
|
"aria-label"
|
|
6366
6394
|
]);
|
|
@@ -6371,6 +6399,7 @@ var CircularProgress = React37.forwardRef(
|
|
|
6371
6399
|
const activeColor = color || "var(--md-sys-color-indicator-active)";
|
|
6372
6400
|
const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
|
|
6373
6401
|
const isWavy = shape === "wavy";
|
|
6402
|
+
const shouldShowIndeterminateTrack = showTrack === "auto" ? isWavy : showTrack;
|
|
6374
6403
|
const BASELINE_SIZE = 48;
|
|
6375
6404
|
const scaleFactor = size / BASELINE_SIZE;
|
|
6376
6405
|
const effectiveAmplitude = React37.useMemo(
|
|
@@ -6381,6 +6410,10 @@ var CircularProgress = React37.forwardRef(
|
|
|
6381
6410
|
() => wavelength != null ? wavelength : 15 * scaleFactor,
|
|
6382
6411
|
[wavelength, scaleFactor]
|
|
6383
6412
|
);
|
|
6413
|
+
const resolvedAmplitudeRange = React37.useMemo(
|
|
6414
|
+
() => amplitudeRange != null ? amplitudeRange : [0, effectiveAmplitude],
|
|
6415
|
+
[amplitudeRange, effectiveAmplitude]
|
|
6416
|
+
);
|
|
6384
6417
|
const wavyActivePath = React37.useMemo(
|
|
6385
6418
|
() => isWavy ? generateWavyCircularPath(
|
|
6386
6419
|
center,
|
|
@@ -6400,6 +6433,145 @@ var CircularProgress = React37.forwardRef(
|
|
|
6400
6433
|
const trackLength = isDeterminate ? Math.max(1e-3, 1 - activeAngularFraction - 2 * gapForTrack) : 1;
|
|
6401
6434
|
const ActiveCircleElem = m.circle;
|
|
6402
6435
|
const ActivePathElem = m.path;
|
|
6436
|
+
const indeterminateSvgRef = React37.useRef(null);
|
|
6437
|
+
const indeterminateTrackRef = React37.useRef(null);
|
|
6438
|
+
const indeterminateActiveRef = React37.useRef(null);
|
|
6439
|
+
const indeterminateWavyTrackPathRef = React37.useRef(null);
|
|
6440
|
+
const indeterminateWavyActivePathRef = React37.useRef(null);
|
|
6441
|
+
const cachedPathLengthRef = React37.useRef(0);
|
|
6442
|
+
React37.useLayoutEffect(() => {
|
|
6443
|
+
if (!isWavy || !wavyActivePath) {
|
|
6444
|
+
cachedPathLengthRef.current = circumference;
|
|
6445
|
+
return;
|
|
6446
|
+
}
|
|
6447
|
+
const el = indeterminateActiveRef.current;
|
|
6448
|
+
if (el && "getTotalLength" in el) {
|
|
6449
|
+
try {
|
|
6450
|
+
const len = el.getTotalLength();
|
|
6451
|
+
if (len > 0) {
|
|
6452
|
+
cachedPathLengthRef.current = len;
|
|
6453
|
+
return;
|
|
6454
|
+
}
|
|
6455
|
+
} catch (e) {
|
|
6456
|
+
}
|
|
6457
|
+
}
|
|
6458
|
+
cachedPathLengthRef.current = circumference;
|
|
6459
|
+
}, [isWavy, circumference, wavyActivePath]);
|
|
6460
|
+
useAnimationFrame((time) => {
|
|
6461
|
+
if (isDeterminate) return;
|
|
6462
|
+
const safeCrawlerSpeed = Math.max(0.1, crawlerSpeed);
|
|
6463
|
+
const scaledTime = time * safeCrawlerSpeed;
|
|
6464
|
+
const globalCycle = scaledTime % GLOBAL_ROTATION_DURATION;
|
|
6465
|
+
const globalAngle = globalCycle / GLOBAL_ROTATION_DURATION * GLOBAL_ROTATION_TARGET;
|
|
6466
|
+
const additionalFullCycles = Math.floor(
|
|
6467
|
+
scaledTime / ADDITIONAL_ROTATION_CYCLE
|
|
6468
|
+
);
|
|
6469
|
+
const additionalCycleTime = scaledTime % ADDITIONAL_ROTATION_CYCLE;
|
|
6470
|
+
const additionalEaseT = Math.min(
|
|
6471
|
+
1,
|
|
6472
|
+
additionalCycleTime / ADDITIONAL_ROTATION_EASE_DURATION
|
|
6473
|
+
);
|
|
6474
|
+
const additionalAngle = (additionalFullCycles + easeInOutCubic(additionalEaseT)) * ADDITIONAL_ROTATION_STEP;
|
|
6475
|
+
const totalRotation = globalAngle + additionalAngle;
|
|
6476
|
+
if (indeterminateSvgRef.current) {
|
|
6477
|
+
indeterminateSvgRef.current.style.transform = `rotate(${totalRotation - 90}deg)`;
|
|
6478
|
+
}
|
|
6479
|
+
const progressFullCycle = PROGRESS_CYCLE_DURATION * 2;
|
|
6480
|
+
const progressCycleTime = scaledTime % progressFullCycle;
|
|
6481
|
+
let progress;
|
|
6482
|
+
if (progressCycleTime < PROGRESS_CYCLE_DURATION) {
|
|
6483
|
+
const t = progressCycleTime / PROGRESS_CYCLE_DURATION;
|
|
6484
|
+
progress = minProgress + (maxProgress - minProgress) * easeInOutCubic(t);
|
|
6485
|
+
} else {
|
|
6486
|
+
const t = (progressCycleTime - PROGRESS_CYCLE_DURATION) / PROGRESS_CYCLE_DURATION;
|
|
6487
|
+
progress = maxProgress - (maxProgress - minProgress) * easeInOutCubic(t);
|
|
6488
|
+
}
|
|
6489
|
+
if (isWavy) {
|
|
6490
|
+
const amplitudeT = (progress - minProgress) / (maxProgress - minProgress);
|
|
6491
|
+
const currentAmplitude = resolvedAmplitudeRange[0] + (resolvedAmplitudeRange[1] - resolvedAmplitudeRange[0]) * amplitudeT;
|
|
6492
|
+
const dynamicPath = generateWavyCircularPath(
|
|
6493
|
+
center,
|
|
6494
|
+
radius,
|
|
6495
|
+
currentAmplitude,
|
|
6496
|
+
effectiveWavelength
|
|
6497
|
+
);
|
|
6498
|
+
if (indeterminateWavyActivePathRef.current) {
|
|
6499
|
+
indeterminateWavyActivePathRef.current.setAttribute("d", dynamicPath);
|
|
6500
|
+
}
|
|
6501
|
+
if (indeterminateWavyTrackPathRef.current) {
|
|
6502
|
+
indeterminateWavyTrackPathRef.current.setAttribute("d", dynamicPath);
|
|
6503
|
+
}
|
|
6504
|
+
const pathEl = indeterminateWavyActivePathRef.current;
|
|
6505
|
+
let totalLen = cachedPathLengthRef.current || circumference;
|
|
6506
|
+
if (pathEl) {
|
|
6507
|
+
try {
|
|
6508
|
+
const len = pathEl.getTotalLength();
|
|
6509
|
+
if (len > 0) totalLen = len;
|
|
6510
|
+
} catch (e) {
|
|
6511
|
+
}
|
|
6512
|
+
}
|
|
6513
|
+
const gapFrac = (gapSize + trackHeight) / totalLen;
|
|
6514
|
+
const activeLen = totalLen * progress;
|
|
6515
|
+
const activeOff = 0;
|
|
6516
|
+
if (indeterminateWavyActivePathRef.current) {
|
|
6517
|
+
indeterminateWavyActivePathRef.current.setAttribute(
|
|
6518
|
+
"stroke-dasharray",
|
|
6519
|
+
`${activeLen} ${totalLen}`
|
|
6520
|
+
);
|
|
6521
|
+
indeterminateWavyActivePathRef.current.setAttribute(
|
|
6522
|
+
"stroke-dashoffset",
|
|
6523
|
+
`${activeOff}`
|
|
6524
|
+
);
|
|
6525
|
+
}
|
|
6526
|
+
if (shouldShowIndeterminateTrack && indeterminateWavyTrackPathRef.current) {
|
|
6527
|
+
const trackStartFrac = progress + gapFrac;
|
|
6528
|
+
const trackLen = Math.max(
|
|
6529
|
+
1e-3,
|
|
6530
|
+
totalLen * (1 - progress - 2 * gapFrac)
|
|
6531
|
+
);
|
|
6532
|
+
const trackOff = -totalLen * trackStartFrac;
|
|
6533
|
+
indeterminateWavyTrackPathRef.current.setAttribute(
|
|
6534
|
+
"stroke-dasharray",
|
|
6535
|
+
`${trackLen} ${totalLen}`
|
|
6536
|
+
);
|
|
6537
|
+
indeterminateWavyTrackPathRef.current.setAttribute(
|
|
6538
|
+
"stroke-dashoffset",
|
|
6539
|
+
`${trackOff}`
|
|
6540
|
+
);
|
|
6541
|
+
}
|
|
6542
|
+
} else {
|
|
6543
|
+
const totalLen = circumference;
|
|
6544
|
+
const activeLen = totalLen * progress;
|
|
6545
|
+
const activeOff = 0;
|
|
6546
|
+
if (indeterminateActiveRef.current) {
|
|
6547
|
+
indeterminateActiveRef.current.setAttribute(
|
|
6548
|
+
"stroke-dasharray",
|
|
6549
|
+
`${activeLen} ${totalLen}`
|
|
6550
|
+
);
|
|
6551
|
+
indeterminateActiveRef.current.setAttribute(
|
|
6552
|
+
"stroke-dashoffset",
|
|
6553
|
+
`${activeOff}`
|
|
6554
|
+
);
|
|
6555
|
+
}
|
|
6556
|
+
if (shouldShowIndeterminateTrack && indeterminateTrackRef.current) {
|
|
6557
|
+
const gapFrac = (gapSize + trackHeight) / totalLen;
|
|
6558
|
+
const trackStartFrac = progress + gapFrac;
|
|
6559
|
+
const trackLen = Math.max(
|
|
6560
|
+
1e-3,
|
|
6561
|
+
totalLen * (1 - progress - 2 * gapFrac)
|
|
6562
|
+
);
|
|
6563
|
+
const trackOff = -totalLen * trackStartFrac;
|
|
6564
|
+
indeterminateTrackRef.current.setAttribute(
|
|
6565
|
+
"stroke-dasharray",
|
|
6566
|
+
`${trackLen} ${totalLen}`
|
|
6567
|
+
);
|
|
6568
|
+
indeterminateTrackRef.current.setAttribute(
|
|
6569
|
+
"stroke-dashoffset",
|
|
6570
|
+
`${trackOff}`
|
|
6571
|
+
);
|
|
6572
|
+
}
|
|
6573
|
+
}
|
|
6574
|
+
});
|
|
6403
6575
|
return /* @__PURE__ */ jsx(
|
|
6404
6576
|
"div",
|
|
6405
6577
|
__spreadProps(__spreadValues({
|
|
@@ -6476,9 +6648,10 @@ var CircularProgress = React37.forwardRef(
|
|
|
6476
6648
|
]
|
|
6477
6649
|
}
|
|
6478
6650
|
),
|
|
6479
|
-
!isDeterminate && /* @__PURE__ */
|
|
6480
|
-
|
|
6651
|
+
!isDeterminate && /* @__PURE__ */ jsx(
|
|
6652
|
+
"svg",
|
|
6481
6653
|
{
|
|
6654
|
+
ref: indeterminateSvgRef,
|
|
6482
6655
|
width: size,
|
|
6483
6656
|
height: size,
|
|
6484
6657
|
viewBox: `0 0 ${size} ${size}`,
|
|
@@ -6487,90 +6660,60 @@ var CircularProgress = React37.forwardRef(
|
|
|
6487
6660
|
position: "absolute",
|
|
6488
6661
|
inset: 0,
|
|
6489
6662
|
overflow: "visible",
|
|
6490
|
-
|
|
6491
|
-
|
|
6663
|
+
transformOrigin: "center",
|
|
6664
|
+
transform: "rotate(-90deg)"
|
|
6492
6665
|
},
|
|
6493
|
-
|
|
6494
|
-
|
|
6495
|
-
|
|
6496
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
6497
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
6498
|
-
ease: "linear"
|
|
6499
|
-
}
|
|
6500
|
-
},
|
|
6501
|
-
children: [
|
|
6502
|
-
/* @__PURE__ */ jsx(
|
|
6503
|
-
m.circle,
|
|
6666
|
+
children: isWavy ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6667
|
+
shouldShowIndeterminateTrack && /* @__PURE__ */ jsx(
|
|
6668
|
+
"path",
|
|
6504
6669
|
{
|
|
6505
|
-
|
|
6506
|
-
|
|
6507
|
-
r: radius,
|
|
6670
|
+
ref: indeterminateWavyTrackPathRef,
|
|
6671
|
+
d: wavyActivePath != null ? wavyActivePath : "",
|
|
6508
6672
|
fill: "none",
|
|
6509
6673
|
stroke: bgTrackColor,
|
|
6510
6674
|
strokeWidth: trackHeight,
|
|
6511
|
-
strokeLinecap: "round"
|
|
6512
|
-
style: { originX: "50%", originY: "50%" },
|
|
6513
|
-
animate: {
|
|
6514
|
-
pathLength: [
|
|
6515
|
-
Math.max(1e-3, 1 - 0.1 - 2 * gapForTrack),
|
|
6516
|
-
Math.max(1e-3, 1 - 0.75 - 2 * gapForTrack),
|
|
6517
|
-
Math.max(1e-3, 1 - 0.1 - 2 * gapForTrack)
|
|
6518
|
-
],
|
|
6519
|
-
rotate: [
|
|
6520
|
-
`${(0.1 + gapForTrack) * 360}deg`,
|
|
6521
|
-
`${(1 + gapForTrack) * 360}deg`,
|
|
6522
|
-
`${(1.1 + gapForTrack) * 360}deg`
|
|
6523
|
-
]
|
|
6524
|
-
},
|
|
6525
|
-
transition: {
|
|
6526
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
6527
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
6528
|
-
ease: [0.4, 0, 0.2, 1]
|
|
6529
|
-
}
|
|
6675
|
+
strokeLinecap: "round"
|
|
6530
6676
|
}
|
|
6531
6677
|
),
|
|
6532
|
-
|
|
6533
|
-
|
|
6678
|
+
/* @__PURE__ */ jsx(
|
|
6679
|
+
"path",
|
|
6534
6680
|
{
|
|
6681
|
+
ref: indeterminateWavyActivePathRef,
|
|
6535
6682
|
d: wavyActivePath != null ? wavyActivePath : "",
|
|
6536
6683
|
fill: "none",
|
|
6537
6684
|
stroke: activeColor,
|
|
6538
6685
|
strokeWidth: trackHeight,
|
|
6539
|
-
strokeLinecap: "round"
|
|
6540
|
-
style: { originX: "50%", originY: "50%" },
|
|
6541
|
-
animate: {
|
|
6542
|
-
pathLength: [0.1, 0.75, 0.1],
|
|
6543
|
-
rotate: ["0deg", "90deg", "360deg"]
|
|
6544
|
-
},
|
|
6545
|
-
transition: {
|
|
6546
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
6547
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
6548
|
-
ease: [0.4, 0, 0.2, 1]
|
|
6549
|
-
}
|
|
6686
|
+
strokeLinecap: "round"
|
|
6550
6687
|
}
|
|
6551
|
-
)
|
|
6552
|
-
|
|
6688
|
+
)
|
|
6689
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6690
|
+
shouldShowIndeterminateTrack && /* @__PURE__ */ jsx(
|
|
6691
|
+
"circle",
|
|
6553
6692
|
{
|
|
6693
|
+
ref: indeterminateTrackRef,
|
|
6694
|
+
cx: center,
|
|
6695
|
+
cy: center,
|
|
6696
|
+
r: radius,
|
|
6697
|
+
fill: "none",
|
|
6698
|
+
stroke: bgTrackColor,
|
|
6699
|
+
strokeWidth: trackHeight,
|
|
6700
|
+
strokeLinecap: "round"
|
|
6701
|
+
}
|
|
6702
|
+
),
|
|
6703
|
+
/* @__PURE__ */ jsx(
|
|
6704
|
+
"circle",
|
|
6705
|
+
{
|
|
6706
|
+
ref: indeterminateActiveRef,
|
|
6554
6707
|
cx: center,
|
|
6555
6708
|
cy: center,
|
|
6556
6709
|
r: radius,
|
|
6557
6710
|
fill: "none",
|
|
6558
6711
|
stroke: activeColor,
|
|
6559
6712
|
strokeWidth: trackHeight,
|
|
6560
|
-
strokeLinecap: "round"
|
|
6561
|
-
style: { originX: "50%", originY: "50%" },
|
|
6562
|
-
animate: {
|
|
6563
|
-
pathLength: [0.1, 0.75, 0.1],
|
|
6564
|
-
rotate: ["0deg", "90deg", "360deg"]
|
|
6565
|
-
},
|
|
6566
|
-
transition: {
|
|
6567
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
6568
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
6569
|
-
ease: [0.4, 0, 0.2, 1]
|
|
6570
|
-
}
|
|
6713
|
+
strokeLinecap: "round"
|
|
6571
6714
|
}
|
|
6572
6715
|
)
|
|
6573
|
-
]
|
|
6716
|
+
] })
|
|
6574
6717
|
}
|
|
6575
6718
|
)
|
|
6576
6719
|
] })
|
|
@@ -6734,6 +6877,12 @@ var WavyLinearTrack = React37.memo(function WavyLinearTrack2({
|
|
|
6734
6877
|
duration: 0.5
|
|
6735
6878
|
});
|
|
6736
6879
|
animate(fractionMV, fraction, { duration: 0.4, ease: [0.2, 0, 0, 1] });
|
|
6880
|
+
} else {
|
|
6881
|
+
animate(amplitudeMV, amplitude, {
|
|
6882
|
+
type: "spring",
|
|
6883
|
+
bounce: 0,
|
|
6884
|
+
duration: 0.5
|
|
6885
|
+
});
|
|
6737
6886
|
}
|
|
6738
6887
|
}, [
|
|
6739
6888
|
clampedValue,
|
|
@@ -6747,10 +6896,10 @@ var WavyLinearTrack = React37.memo(function WavyLinearTrack2({
|
|
|
6747
6896
|
1,
|
|
6748
6897
|
isDeterminate ? wavelength : indeterminateWavelength
|
|
6749
6898
|
);
|
|
6750
|
-
const trackAmp = trackShape === "wavy" ? amplitude : 0;
|
|
6751
6899
|
useAnimationFrame((time) => {
|
|
6752
6900
|
if (width === 0) return;
|
|
6753
6901
|
const currentAmp = amplitudeMV.get();
|
|
6902
|
+
const trackAmp = trackShape === "wavy" ? amplitude : 0;
|
|
6754
6903
|
const phase = time / 1e3 * waveSpeed * activeWavelength;
|
|
6755
6904
|
const capWidth = trackHeight / 2;
|
|
6756
6905
|
let activePathD = "";
|
|
@@ -6770,7 +6919,7 @@ var WavyLinearTrack = React37.memo(function WavyLinearTrack2({
|
|
|
6770
6919
|
currentAmp
|
|
6771
6920
|
);
|
|
6772
6921
|
} else if (fraction === 0) {
|
|
6773
|
-
activePathD =
|
|
6922
|
+
activePathD = "";
|
|
6774
6923
|
}
|
|
6775
6924
|
const trackStart = adjHead + totalGap;
|
|
6776
6925
|
if (trackStart < width - capWidth) {
|
|
@@ -6802,20 +6951,20 @@ var WavyLinearTrack = React37.memo(function WavyLinearTrack2({
|
|
|
6802
6951
|
activeLines.push({ tail: l1T, head: l1H });
|
|
6803
6952
|
activeLines.push({ tail: l2T, head: l2H });
|
|
6804
6953
|
}
|
|
6805
|
-
const
|
|
6806
|
-
const
|
|
6807
|
-
const
|
|
6954
|
+
const activeSegments = activeLines.map((line) => {
|
|
6955
|
+
const rawTail = line.tail * width;
|
|
6956
|
+
const rawHead = line.head * width;
|
|
6808
6957
|
const adjTail = Math.max(
|
|
6809
6958
|
capWidth,
|
|
6810
|
-
Math.min(width - capWidth,
|
|
6959
|
+
Math.min(width - capWidth, rawTail)
|
|
6811
6960
|
);
|
|
6812
6961
|
const adjHead = Math.max(
|
|
6813
6962
|
capWidth,
|
|
6814
|
-
Math.min(width - capWidth,
|
|
6963
|
+
Math.min(width - capWidth, rawHead)
|
|
6815
6964
|
);
|
|
6816
6965
|
return { adjTail, adjHead };
|
|
6817
6966
|
}).filter((seg) => seg.adjHead - seg.adjTail > 0.1);
|
|
6818
|
-
activePathD =
|
|
6967
|
+
activePathD = activeSegments.map(
|
|
6819
6968
|
(seg) => getSinePath(
|
|
6820
6969
|
seg.adjTail,
|
|
6821
6970
|
seg.adjHead,
|
|
@@ -6824,13 +6973,24 @@ var WavyLinearTrack = React37.memo(function WavyLinearTrack2({
|
|
|
6824
6973
|
currentAmp
|
|
6825
6974
|
)
|
|
6826
6975
|
).join(" ");
|
|
6976
|
+
const validActiveLines = activeLines.filter(
|
|
6977
|
+
(line) => line.head > line.tail && line.head * width > 0 && line.tail * width < width
|
|
6978
|
+
).sort((a, b) => a.tail - b.tail);
|
|
6827
6979
|
let currentTrackX = capWidth;
|
|
6828
|
-
for (const
|
|
6829
|
-
const
|
|
6980
|
+
for (const line of validActiveLines) {
|
|
6981
|
+
const blockStart = line.tail * width - totalGap;
|
|
6982
|
+
const blockEnd = line.head * width + totalGap;
|
|
6983
|
+
const trackEnd = Math.min(width - capWidth, blockStart);
|
|
6830
6984
|
if (trackEnd > currentTrackX) {
|
|
6831
|
-
trackD += `${getSinePath(
|
|
6985
|
+
trackD += `${getSinePath(
|
|
6986
|
+
currentTrackX,
|
|
6987
|
+
trackEnd,
|
|
6988
|
+
phase,
|
|
6989
|
+
activeWavelength,
|
|
6990
|
+
trackAmp
|
|
6991
|
+
)} `;
|
|
6832
6992
|
}
|
|
6833
|
-
currentTrackX = Math.max(currentTrackX,
|
|
6993
|
+
currentTrackX = Math.max(currentTrackX, blockEnd);
|
|
6834
6994
|
}
|
|
6835
6995
|
if (currentTrackX < width - capWidth) {
|
|
6836
6996
|
trackD += getSinePath(
|
|
@@ -6843,15 +7003,15 @@ var WavyLinearTrack = React37.memo(function WavyLinearTrack2({
|
|
|
6843
7003
|
}
|
|
6844
7004
|
}
|
|
6845
7005
|
if (activePathRef.current)
|
|
6846
|
-
activePathRef.current.setAttribute("d", activePathD);
|
|
7006
|
+
activePathRef.current.setAttribute("d", activePathD || "");
|
|
6847
7007
|
if (trackPathRef.current)
|
|
6848
|
-
trackPathRef.current.setAttribute("d", trackD.trim());
|
|
7008
|
+
trackPathRef.current.setAttribute("d", trackD.trim() || "");
|
|
6849
7009
|
});
|
|
6850
7010
|
return /* @__PURE__ */ jsx(
|
|
6851
7011
|
"div",
|
|
6852
7012
|
{
|
|
6853
7013
|
ref: containerRef,
|
|
6854
|
-
className: "relative w-full
|
|
7014
|
+
className: "relative w-full",
|
|
6855
7015
|
style: { height: svgHeight },
|
|
6856
7016
|
children: width > 0 && /* @__PURE__ */ jsxs(
|
|
6857
7017
|
"svg",
|
|
@@ -6905,7 +7065,7 @@ var LinearProgress = React37.forwardRef(
|
|
|
6905
7065
|
waveSpeed = 1,
|
|
6906
7066
|
crawlerSpeed = 1,
|
|
6907
7067
|
determinateAnimation = "md3",
|
|
6908
|
-
indeterminateAnimation = "
|
|
7068
|
+
indeterminateAnimation = "md3",
|
|
6909
7069
|
gapSize = 4,
|
|
6910
7070
|
showStopIndicator = "auto",
|
|
6911
7071
|
color,
|
|
@@ -6942,15 +7102,15 @@ var LinearProgress = React37.forwardRef(
|
|
|
6942
7102
|
setIsRtl(dir === "rtl");
|
|
6943
7103
|
}
|
|
6944
7104
|
}, []);
|
|
6945
|
-
const isWavy = shape === "wavy";
|
|
6946
7105
|
const resolvedTrackShape = trackShape != null ? trackShape : shape;
|
|
7106
|
+
const isWavy = shape === "wavy" || resolvedTrackShape === "wavy";
|
|
6947
7107
|
const effectiveAmplitude = React37.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
|
|
6948
7108
|
const svgHeight = React37.useMemo(
|
|
6949
7109
|
() => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
|
|
6950
7110
|
[isWavy, trackHeight, effectiveAmplitude]
|
|
6951
7111
|
);
|
|
6952
7112
|
const shouldShowStop = React37.useMemo(
|
|
6953
|
-
() => isDeterminate && resolvedTrackShape === "flat" &&
|
|
7113
|
+
() => isDeterminate && resolvedTrackShape === "flat" && showStopIndicator !== false,
|
|
6954
7114
|
[isDeterminate, resolvedTrackShape, showStopIndicator]
|
|
6955
7115
|
);
|
|
6956
7116
|
const stopSize = React37.useMemo(
|
|
@@ -6960,6 +7120,8 @@ var LinearProgress = React37.forwardRef(
|
|
|
6960
7120
|
const stopOffset = (trackHeight - stopSize) / 2;
|
|
6961
7121
|
const activeColor = color || "var(--md-sys-color-indicator-active)";
|
|
6962
7122
|
const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
|
|
7123
|
+
const useWavyTrack = isWavy || !isDeterminate;
|
|
7124
|
+
const trackAmp = isWavy ? effectiveAmplitude : 0;
|
|
6963
7125
|
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsxs(
|
|
6964
7126
|
"div",
|
|
6965
7127
|
__spreadProps(__spreadValues({
|
|
@@ -6976,12 +7138,12 @@ var LinearProgress = React37.forwardRef(
|
|
|
6976
7138
|
style: { height: svgHeight }
|
|
6977
7139
|
}, restProps), {
|
|
6978
7140
|
children: [
|
|
6979
|
-
|
|
7141
|
+
useWavyTrack ? /* @__PURE__ */ jsx(
|
|
6980
7142
|
WavyLinearTrack,
|
|
6981
7143
|
{
|
|
6982
7144
|
trackHeight,
|
|
6983
7145
|
svgHeight,
|
|
6984
|
-
amplitude:
|
|
7146
|
+
amplitude: trackAmp,
|
|
6985
7147
|
wavelength,
|
|
6986
7148
|
indeterminateWavelength,
|
|
6987
7149
|
activeColor,
|