@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/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
6
6
|
import { clsx } from 'clsx';
|
|
7
7
|
import { twMerge } from 'tailwind-merge';
|
|
8
8
|
import * as RxContextMenu from '@radix-ui/react-context-menu';
|
|
9
|
-
import { AnimatePresence, m, LazyMotion, domMax, useReducedMotion, useMotionValue, animate,
|
|
9
|
+
import { AnimatePresence, m, LazyMotion, domMax, useReducedMotion, useAnimationFrame, useMotionValue, animate, useSpring, useTransform, LayoutGroup, useScroll, useMotionValueEvent } from 'motion/react';
|
|
10
10
|
import { cornerRadius } from '@bug-on/m3-tokens';
|
|
11
11
|
import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
|
|
12
12
|
import { Slot } from '@radix-ui/react-slot';
|
|
@@ -5689,26 +5689,46 @@ function generateWavyCircularPath(center, radius, amplitude, wavelength) {
|
|
|
5689
5689
|
if (i === 0) d += `M ${xAt(t0).toFixed(2)} ${yAt(t0).toFixed(2)}`;
|
|
5690
5690
|
d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${xAt(t1).toFixed(2)} ${yAt(t1).toFixed(2)}`;
|
|
5691
5691
|
}
|
|
5692
|
-
d
|
|
5693
|
-
return d;
|
|
5692
|
+
return `${d} Z`;
|
|
5694
5693
|
}
|
|
5695
5694
|
function getSinePath(startX, endX, phase, wl, amp) {
|
|
5696
5695
|
if (startX >= endX) return "";
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
|
|
5696
|
+
if (amp <= 0.01) {
|
|
5697
|
+
return `M ${startX.toFixed(2)} 0 L ${endX.toFixed(2)} 0`;
|
|
5698
|
+
}
|
|
5699
|
+
const safeWl = Math.max(1, wl);
|
|
5700
|
+
const k = 2 * Math.PI / safeWl;
|
|
5701
|
+
const phi = phase / safeWl * 2 * Math.PI;
|
|
5702
|
+
const yAt = (x) => amp * Math.sin(k * x + phi);
|
|
5703
|
+
const dyAt = (x) => amp * k * Math.cos(k * x + phi);
|
|
5704
|
+
const step = safeWl / 4;
|
|
5705
|
+
let d = `M ${startX.toFixed(2)} ${yAt(startX).toFixed(2)}`;
|
|
5706
|
+
let currentX = startX;
|
|
5707
|
+
while (currentX < endX) {
|
|
5708
|
+
const nextX = Math.min(endX, currentX + step);
|
|
5709
|
+
const dx = nextX - currentX;
|
|
5710
|
+
const scale = dx / 3;
|
|
5711
|
+
const y0 = yAt(currentX);
|
|
5712
|
+
const dy0 = dyAt(currentX);
|
|
5713
|
+
const y1 = yAt(nextX);
|
|
5714
|
+
const dy1 = dyAt(nextX);
|
|
5715
|
+
const cp1x = currentX + scale;
|
|
5716
|
+
const cp1y = y0 + scale * dy0;
|
|
5717
|
+
const cp2x = nextX - scale;
|
|
5718
|
+
const cp2y = y1 - scale * dy1;
|
|
5719
|
+
d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${nextX.toFixed(2)} ${y1.toFixed(2)}`;
|
|
5720
|
+
currentX = nextX;
|
|
5721
|
+
}
|
|
5710
5722
|
return d;
|
|
5711
5723
|
}
|
|
5724
|
+
var GLOBAL_ROTATION_DURATION = 6e3;
|
|
5725
|
+
var GLOBAL_ROTATION_TARGET = 1080;
|
|
5726
|
+
var ADDITIONAL_ROTATION_CYCLE = 1500;
|
|
5727
|
+
var ADDITIONAL_ROTATION_STEP = 90;
|
|
5728
|
+
var ADDITIONAL_ROTATION_EASE_DURATION = 500;
|
|
5729
|
+
var DEFAULT_MIN_PROGRESS = 0.1;
|
|
5730
|
+
var DEFAULT_MAX_PROGRESS = 0.8;
|
|
5731
|
+
var PROGRESS_CYCLE_DURATION = 1500;
|
|
5712
5732
|
var CircularProgress = React62.forwardRef(
|
|
5713
5733
|
(_a, ref) => {
|
|
5714
5734
|
var _b = _a, {
|
|
@@ -5722,6 +5742,10 @@ var CircularProgress = React62.forwardRef(
|
|
|
5722
5742
|
crawlerSpeed = 1,
|
|
5723
5743
|
color,
|
|
5724
5744
|
trackColor,
|
|
5745
|
+
showTrack = "auto",
|
|
5746
|
+
minProgress = DEFAULT_MIN_PROGRESS,
|
|
5747
|
+
maxProgress = DEFAULT_MAX_PROGRESS,
|
|
5748
|
+
amplitudeRange,
|
|
5725
5749
|
className,
|
|
5726
5750
|
"aria-label": ariaLabel
|
|
5727
5751
|
} = _b, restProps = __objRest(_b, [
|
|
@@ -5735,6 +5759,10 @@ var CircularProgress = React62.forwardRef(
|
|
|
5735
5759
|
"crawlerSpeed",
|
|
5736
5760
|
"color",
|
|
5737
5761
|
"trackColor",
|
|
5762
|
+
"showTrack",
|
|
5763
|
+
"minProgress",
|
|
5764
|
+
"maxProgress",
|
|
5765
|
+
"amplitudeRange",
|
|
5738
5766
|
"className",
|
|
5739
5767
|
"aria-label"
|
|
5740
5768
|
]);
|
|
@@ -5745,6 +5773,7 @@ var CircularProgress = React62.forwardRef(
|
|
|
5745
5773
|
const activeColor = color || "var(--md-sys-color-indicator-active)";
|
|
5746
5774
|
const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
|
|
5747
5775
|
const isWavy = shape === "wavy";
|
|
5776
|
+
const shouldShowIndeterminateTrack = showTrack === "auto" ? isWavy : showTrack;
|
|
5748
5777
|
const BASELINE_SIZE = 48;
|
|
5749
5778
|
const scaleFactor = size / BASELINE_SIZE;
|
|
5750
5779
|
const effectiveAmplitude = React62.useMemo(
|
|
@@ -5755,6 +5784,10 @@ var CircularProgress = React62.forwardRef(
|
|
|
5755
5784
|
() => wavelength != null ? wavelength : 15 * scaleFactor,
|
|
5756
5785
|
[wavelength, scaleFactor]
|
|
5757
5786
|
);
|
|
5787
|
+
const resolvedAmplitudeRange = React62.useMemo(
|
|
5788
|
+
() => amplitudeRange != null ? amplitudeRange : [0, effectiveAmplitude],
|
|
5789
|
+
[amplitudeRange, effectiveAmplitude]
|
|
5790
|
+
);
|
|
5758
5791
|
const wavyActivePath = React62.useMemo(
|
|
5759
5792
|
() => isWavy ? generateWavyCircularPath(
|
|
5760
5793
|
center,
|
|
@@ -5774,6 +5807,145 @@ var CircularProgress = React62.forwardRef(
|
|
|
5774
5807
|
const trackLength = isDeterminate ? Math.max(1e-3, 1 - activeAngularFraction - 2 * gapForTrack) : 1;
|
|
5775
5808
|
const ActiveCircleElem = m.circle;
|
|
5776
5809
|
const ActivePathElem = m.path;
|
|
5810
|
+
const indeterminateSvgRef = React62.useRef(null);
|
|
5811
|
+
const indeterminateTrackRef = React62.useRef(null);
|
|
5812
|
+
const indeterminateActiveRef = React62.useRef(null);
|
|
5813
|
+
const indeterminateWavyTrackPathRef = React62.useRef(null);
|
|
5814
|
+
const indeterminateWavyActivePathRef = React62.useRef(null);
|
|
5815
|
+
const cachedPathLengthRef = React62.useRef(0);
|
|
5816
|
+
React62.useLayoutEffect(() => {
|
|
5817
|
+
if (!isWavy || !wavyActivePath) {
|
|
5818
|
+
cachedPathLengthRef.current = circumference;
|
|
5819
|
+
return;
|
|
5820
|
+
}
|
|
5821
|
+
const el = indeterminateActiveRef.current;
|
|
5822
|
+
if (el && "getTotalLength" in el) {
|
|
5823
|
+
try {
|
|
5824
|
+
const len = el.getTotalLength();
|
|
5825
|
+
if (len > 0) {
|
|
5826
|
+
cachedPathLengthRef.current = len;
|
|
5827
|
+
return;
|
|
5828
|
+
}
|
|
5829
|
+
} catch (e) {
|
|
5830
|
+
}
|
|
5831
|
+
}
|
|
5832
|
+
cachedPathLengthRef.current = circumference;
|
|
5833
|
+
}, [isWavy, circumference, wavyActivePath]);
|
|
5834
|
+
useAnimationFrame((time) => {
|
|
5835
|
+
if (isDeterminate) return;
|
|
5836
|
+
const safeCrawlerSpeed = Math.max(0.1, crawlerSpeed);
|
|
5837
|
+
const scaledTime = time * safeCrawlerSpeed;
|
|
5838
|
+
const globalCycle = scaledTime % GLOBAL_ROTATION_DURATION;
|
|
5839
|
+
const globalAngle = globalCycle / GLOBAL_ROTATION_DURATION * GLOBAL_ROTATION_TARGET;
|
|
5840
|
+
const additionalFullCycles = Math.floor(
|
|
5841
|
+
scaledTime / ADDITIONAL_ROTATION_CYCLE
|
|
5842
|
+
);
|
|
5843
|
+
const additionalCycleTime = scaledTime % ADDITIONAL_ROTATION_CYCLE;
|
|
5844
|
+
const additionalEaseT = Math.min(
|
|
5845
|
+
1,
|
|
5846
|
+
additionalCycleTime / ADDITIONAL_ROTATION_EASE_DURATION
|
|
5847
|
+
);
|
|
5848
|
+
const additionalAngle = (additionalFullCycles + easeInOutCubic(additionalEaseT)) * ADDITIONAL_ROTATION_STEP;
|
|
5849
|
+
const totalRotation = globalAngle + additionalAngle;
|
|
5850
|
+
if (indeterminateSvgRef.current) {
|
|
5851
|
+
indeterminateSvgRef.current.style.transform = `rotate(${totalRotation - 90}deg)`;
|
|
5852
|
+
}
|
|
5853
|
+
const progressFullCycle = PROGRESS_CYCLE_DURATION * 2;
|
|
5854
|
+
const progressCycleTime = scaledTime % progressFullCycle;
|
|
5855
|
+
let progress;
|
|
5856
|
+
if (progressCycleTime < PROGRESS_CYCLE_DURATION) {
|
|
5857
|
+
const t = progressCycleTime / PROGRESS_CYCLE_DURATION;
|
|
5858
|
+
progress = minProgress + (maxProgress - minProgress) * easeInOutCubic(t);
|
|
5859
|
+
} else {
|
|
5860
|
+
const t = (progressCycleTime - PROGRESS_CYCLE_DURATION) / PROGRESS_CYCLE_DURATION;
|
|
5861
|
+
progress = maxProgress - (maxProgress - minProgress) * easeInOutCubic(t);
|
|
5862
|
+
}
|
|
5863
|
+
if (isWavy) {
|
|
5864
|
+
const amplitudeT = (progress - minProgress) / (maxProgress - minProgress);
|
|
5865
|
+
const currentAmplitude = resolvedAmplitudeRange[0] + (resolvedAmplitudeRange[1] - resolvedAmplitudeRange[0]) * amplitudeT;
|
|
5866
|
+
const dynamicPath = generateWavyCircularPath(
|
|
5867
|
+
center,
|
|
5868
|
+
radius,
|
|
5869
|
+
currentAmplitude,
|
|
5870
|
+
effectiveWavelength
|
|
5871
|
+
);
|
|
5872
|
+
if (indeterminateWavyActivePathRef.current) {
|
|
5873
|
+
indeterminateWavyActivePathRef.current.setAttribute("d", dynamicPath);
|
|
5874
|
+
}
|
|
5875
|
+
if (indeterminateWavyTrackPathRef.current) {
|
|
5876
|
+
indeterminateWavyTrackPathRef.current.setAttribute("d", dynamicPath);
|
|
5877
|
+
}
|
|
5878
|
+
const pathEl = indeterminateWavyActivePathRef.current;
|
|
5879
|
+
let totalLen = cachedPathLengthRef.current || circumference;
|
|
5880
|
+
if (pathEl) {
|
|
5881
|
+
try {
|
|
5882
|
+
const len = pathEl.getTotalLength();
|
|
5883
|
+
if (len > 0) totalLen = len;
|
|
5884
|
+
} catch (e) {
|
|
5885
|
+
}
|
|
5886
|
+
}
|
|
5887
|
+
const gapFrac = (gapSize + trackHeight) / totalLen;
|
|
5888
|
+
const activeLen = totalLen * progress;
|
|
5889
|
+
const activeOff = 0;
|
|
5890
|
+
if (indeterminateWavyActivePathRef.current) {
|
|
5891
|
+
indeterminateWavyActivePathRef.current.setAttribute(
|
|
5892
|
+
"stroke-dasharray",
|
|
5893
|
+
`${activeLen} ${totalLen}`
|
|
5894
|
+
);
|
|
5895
|
+
indeterminateWavyActivePathRef.current.setAttribute(
|
|
5896
|
+
"stroke-dashoffset",
|
|
5897
|
+
`${activeOff}`
|
|
5898
|
+
);
|
|
5899
|
+
}
|
|
5900
|
+
if (shouldShowIndeterminateTrack && indeterminateWavyTrackPathRef.current) {
|
|
5901
|
+
const trackStartFrac = progress + gapFrac;
|
|
5902
|
+
const trackLen = Math.max(
|
|
5903
|
+
1e-3,
|
|
5904
|
+
totalLen * (1 - progress - 2 * gapFrac)
|
|
5905
|
+
);
|
|
5906
|
+
const trackOff = -totalLen * trackStartFrac;
|
|
5907
|
+
indeterminateWavyTrackPathRef.current.setAttribute(
|
|
5908
|
+
"stroke-dasharray",
|
|
5909
|
+
`${trackLen} ${totalLen}`
|
|
5910
|
+
);
|
|
5911
|
+
indeterminateWavyTrackPathRef.current.setAttribute(
|
|
5912
|
+
"stroke-dashoffset",
|
|
5913
|
+
`${trackOff}`
|
|
5914
|
+
);
|
|
5915
|
+
}
|
|
5916
|
+
} else {
|
|
5917
|
+
const totalLen = circumference;
|
|
5918
|
+
const activeLen = totalLen * progress;
|
|
5919
|
+
const activeOff = 0;
|
|
5920
|
+
if (indeterminateActiveRef.current) {
|
|
5921
|
+
indeterminateActiveRef.current.setAttribute(
|
|
5922
|
+
"stroke-dasharray",
|
|
5923
|
+
`${activeLen} ${totalLen}`
|
|
5924
|
+
);
|
|
5925
|
+
indeterminateActiveRef.current.setAttribute(
|
|
5926
|
+
"stroke-dashoffset",
|
|
5927
|
+
`${activeOff}`
|
|
5928
|
+
);
|
|
5929
|
+
}
|
|
5930
|
+
if (shouldShowIndeterminateTrack && indeterminateTrackRef.current) {
|
|
5931
|
+
const gapFrac = (gapSize + trackHeight) / totalLen;
|
|
5932
|
+
const trackStartFrac = progress + gapFrac;
|
|
5933
|
+
const trackLen = Math.max(
|
|
5934
|
+
1e-3,
|
|
5935
|
+
totalLen * (1 - progress - 2 * gapFrac)
|
|
5936
|
+
);
|
|
5937
|
+
const trackOff = -totalLen * trackStartFrac;
|
|
5938
|
+
indeterminateTrackRef.current.setAttribute(
|
|
5939
|
+
"stroke-dasharray",
|
|
5940
|
+
`${trackLen} ${totalLen}`
|
|
5941
|
+
);
|
|
5942
|
+
indeterminateTrackRef.current.setAttribute(
|
|
5943
|
+
"stroke-dashoffset",
|
|
5944
|
+
`${trackOff}`
|
|
5945
|
+
);
|
|
5946
|
+
}
|
|
5947
|
+
}
|
|
5948
|
+
});
|
|
5777
5949
|
return /* @__PURE__ */ jsx(
|
|
5778
5950
|
"div",
|
|
5779
5951
|
__spreadProps(__spreadValues({
|
|
@@ -5850,9 +6022,10 @@ var CircularProgress = React62.forwardRef(
|
|
|
5850
6022
|
]
|
|
5851
6023
|
}
|
|
5852
6024
|
),
|
|
5853
|
-
!isDeterminate && /* @__PURE__ */
|
|
5854
|
-
|
|
6025
|
+
!isDeterminate && /* @__PURE__ */ jsx(
|
|
6026
|
+
"svg",
|
|
5855
6027
|
{
|
|
6028
|
+
ref: indeterminateSvgRef,
|
|
5856
6029
|
width: size,
|
|
5857
6030
|
height: size,
|
|
5858
6031
|
viewBox: `0 0 ${size} ${size}`,
|
|
@@ -5861,90 +6034,60 @@ var CircularProgress = React62.forwardRef(
|
|
|
5861
6034
|
position: "absolute",
|
|
5862
6035
|
inset: 0,
|
|
5863
6036
|
overflow: "visible",
|
|
5864
|
-
|
|
5865
|
-
|
|
6037
|
+
transformOrigin: "center",
|
|
6038
|
+
transform: "rotate(-90deg)"
|
|
5866
6039
|
},
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
5871
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
5872
|
-
ease: "linear"
|
|
5873
|
-
}
|
|
5874
|
-
},
|
|
5875
|
-
children: [
|
|
5876
|
-
/* @__PURE__ */ jsx(
|
|
5877
|
-
m.circle,
|
|
6040
|
+
children: isWavy ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6041
|
+
shouldShowIndeterminateTrack && /* @__PURE__ */ jsx(
|
|
6042
|
+
"path",
|
|
5878
6043
|
{
|
|
5879
|
-
|
|
5880
|
-
|
|
5881
|
-
r: radius,
|
|
6044
|
+
ref: indeterminateWavyTrackPathRef,
|
|
6045
|
+
d: wavyActivePath != null ? wavyActivePath : "",
|
|
5882
6046
|
fill: "none",
|
|
5883
6047
|
stroke: bgTrackColor,
|
|
5884
6048
|
strokeWidth: trackHeight,
|
|
5885
|
-
strokeLinecap: "round"
|
|
5886
|
-
style: { originX: "50%", originY: "50%" },
|
|
5887
|
-
animate: {
|
|
5888
|
-
pathLength: [
|
|
5889
|
-
Math.max(1e-3, 1 - 0.1 - 2 * gapForTrack),
|
|
5890
|
-
Math.max(1e-3, 1 - 0.75 - 2 * gapForTrack),
|
|
5891
|
-
Math.max(1e-3, 1 - 0.1 - 2 * gapForTrack)
|
|
5892
|
-
],
|
|
5893
|
-
rotate: [
|
|
5894
|
-
`${(0.1 + gapForTrack) * 360}deg`,
|
|
5895
|
-
`${(1 + gapForTrack) * 360}deg`,
|
|
5896
|
-
`${(1.1 + gapForTrack) * 360}deg`
|
|
5897
|
-
]
|
|
5898
|
-
},
|
|
5899
|
-
transition: {
|
|
5900
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
5901
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
5902
|
-
ease: [0.4, 0, 0.2, 1]
|
|
5903
|
-
}
|
|
6049
|
+
strokeLinecap: "round"
|
|
5904
6050
|
}
|
|
5905
6051
|
),
|
|
5906
|
-
|
|
5907
|
-
|
|
6052
|
+
/* @__PURE__ */ jsx(
|
|
6053
|
+
"path",
|
|
5908
6054
|
{
|
|
6055
|
+
ref: indeterminateWavyActivePathRef,
|
|
5909
6056
|
d: wavyActivePath != null ? wavyActivePath : "",
|
|
5910
6057
|
fill: "none",
|
|
5911
6058
|
stroke: activeColor,
|
|
5912
6059
|
strokeWidth: trackHeight,
|
|
5913
|
-
strokeLinecap: "round"
|
|
5914
|
-
style: { originX: "50%", originY: "50%" },
|
|
5915
|
-
animate: {
|
|
5916
|
-
pathLength: [0.1, 0.75, 0.1],
|
|
5917
|
-
rotate: ["0deg", "90deg", "360deg"]
|
|
5918
|
-
},
|
|
5919
|
-
transition: {
|
|
5920
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
5921
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
5922
|
-
ease: [0.4, 0, 0.2, 1]
|
|
5923
|
-
}
|
|
6060
|
+
strokeLinecap: "round"
|
|
5924
6061
|
}
|
|
5925
|
-
)
|
|
5926
|
-
|
|
6062
|
+
)
|
|
6063
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6064
|
+
shouldShowIndeterminateTrack && /* @__PURE__ */ jsx(
|
|
6065
|
+
"circle",
|
|
5927
6066
|
{
|
|
6067
|
+
ref: indeterminateTrackRef,
|
|
6068
|
+
cx: center,
|
|
6069
|
+
cy: center,
|
|
6070
|
+
r: radius,
|
|
6071
|
+
fill: "none",
|
|
6072
|
+
stroke: bgTrackColor,
|
|
6073
|
+
strokeWidth: trackHeight,
|
|
6074
|
+
strokeLinecap: "round"
|
|
6075
|
+
}
|
|
6076
|
+
),
|
|
6077
|
+
/* @__PURE__ */ jsx(
|
|
6078
|
+
"circle",
|
|
6079
|
+
{
|
|
6080
|
+
ref: indeterminateActiveRef,
|
|
5928
6081
|
cx: center,
|
|
5929
6082
|
cy: center,
|
|
5930
6083
|
r: radius,
|
|
5931
6084
|
fill: "none",
|
|
5932
6085
|
stroke: activeColor,
|
|
5933
6086
|
strokeWidth: trackHeight,
|
|
5934
|
-
strokeLinecap: "round"
|
|
5935
|
-
style: { originX: "50%", originY: "50%" },
|
|
5936
|
-
animate: {
|
|
5937
|
-
pathLength: [0.1, 0.75, 0.1],
|
|
5938
|
-
rotate: ["0deg", "90deg", "360deg"]
|
|
5939
|
-
},
|
|
5940
|
-
transition: {
|
|
5941
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
5942
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
5943
|
-
ease: [0.4, 0, 0.2, 1]
|
|
5944
|
-
}
|
|
6087
|
+
strokeLinecap: "round"
|
|
5945
6088
|
}
|
|
5946
6089
|
)
|
|
5947
|
-
]
|
|
6090
|
+
] })
|
|
5948
6091
|
}
|
|
5949
6092
|
)
|
|
5950
6093
|
] })
|
|
@@ -6108,6 +6251,12 @@ var WavyLinearTrack = React62.memo(function WavyLinearTrack2({
|
|
|
6108
6251
|
duration: 0.5
|
|
6109
6252
|
});
|
|
6110
6253
|
animate(fractionMV, fraction, { duration: 0.4, ease: [0.2, 0, 0, 1] });
|
|
6254
|
+
} else {
|
|
6255
|
+
animate(amplitudeMV, amplitude, {
|
|
6256
|
+
type: "spring",
|
|
6257
|
+
bounce: 0,
|
|
6258
|
+
duration: 0.5
|
|
6259
|
+
});
|
|
6111
6260
|
}
|
|
6112
6261
|
}, [
|
|
6113
6262
|
clampedValue,
|
|
@@ -6121,10 +6270,10 @@ var WavyLinearTrack = React62.memo(function WavyLinearTrack2({
|
|
|
6121
6270
|
1,
|
|
6122
6271
|
isDeterminate ? wavelength : indeterminateWavelength
|
|
6123
6272
|
);
|
|
6124
|
-
const trackAmp = trackShape === "wavy" ? amplitude : 0;
|
|
6125
6273
|
useAnimationFrame((time) => {
|
|
6126
6274
|
if (width === 0) return;
|
|
6127
6275
|
const currentAmp = amplitudeMV.get();
|
|
6276
|
+
const trackAmp = trackShape === "wavy" ? amplitude : 0;
|
|
6128
6277
|
const phase = time / 1e3 * waveSpeed * activeWavelength;
|
|
6129
6278
|
const capWidth = trackHeight / 2;
|
|
6130
6279
|
let activePathD = "";
|
|
@@ -6144,7 +6293,7 @@ var WavyLinearTrack = React62.memo(function WavyLinearTrack2({
|
|
|
6144
6293
|
currentAmp
|
|
6145
6294
|
);
|
|
6146
6295
|
} else if (fraction === 0) {
|
|
6147
|
-
activePathD =
|
|
6296
|
+
activePathD = "";
|
|
6148
6297
|
}
|
|
6149
6298
|
const trackStart = adjHead + totalGap;
|
|
6150
6299
|
if (trackStart < width - capWidth) {
|
|
@@ -6176,20 +6325,20 @@ var WavyLinearTrack = React62.memo(function WavyLinearTrack2({
|
|
|
6176
6325
|
activeLines.push({ tail: l1T, head: l1H });
|
|
6177
6326
|
activeLines.push({ tail: l2T, head: l2H });
|
|
6178
6327
|
}
|
|
6179
|
-
const
|
|
6180
|
-
const
|
|
6181
|
-
const
|
|
6328
|
+
const activeSegments = activeLines.map((line) => {
|
|
6329
|
+
const rawTail = line.tail * width;
|
|
6330
|
+
const rawHead = line.head * width;
|
|
6182
6331
|
const adjTail = Math.max(
|
|
6183
6332
|
capWidth,
|
|
6184
|
-
Math.min(width - capWidth,
|
|
6333
|
+
Math.min(width - capWidth, rawTail)
|
|
6185
6334
|
);
|
|
6186
6335
|
const adjHead = Math.max(
|
|
6187
6336
|
capWidth,
|
|
6188
|
-
Math.min(width - capWidth,
|
|
6337
|
+
Math.min(width - capWidth, rawHead)
|
|
6189
6338
|
);
|
|
6190
6339
|
return { adjTail, adjHead };
|
|
6191
6340
|
}).filter((seg) => seg.adjHead - seg.adjTail > 0.1);
|
|
6192
|
-
activePathD =
|
|
6341
|
+
activePathD = activeSegments.map(
|
|
6193
6342
|
(seg) => getSinePath(
|
|
6194
6343
|
seg.adjTail,
|
|
6195
6344
|
seg.adjHead,
|
|
@@ -6198,13 +6347,24 @@ var WavyLinearTrack = React62.memo(function WavyLinearTrack2({
|
|
|
6198
6347
|
currentAmp
|
|
6199
6348
|
)
|
|
6200
6349
|
).join(" ");
|
|
6350
|
+
const validActiveLines = activeLines.filter(
|
|
6351
|
+
(line) => line.head > line.tail && line.head * width > 0 && line.tail * width < width
|
|
6352
|
+
).sort((a, b) => a.tail - b.tail);
|
|
6201
6353
|
let currentTrackX = capWidth;
|
|
6202
|
-
for (const
|
|
6203
|
-
const
|
|
6354
|
+
for (const line of validActiveLines) {
|
|
6355
|
+
const blockStart = line.tail * width - totalGap;
|
|
6356
|
+
const blockEnd = line.head * width + totalGap;
|
|
6357
|
+
const trackEnd = Math.min(width - capWidth, blockStart);
|
|
6204
6358
|
if (trackEnd > currentTrackX) {
|
|
6205
|
-
trackD += `${getSinePath(
|
|
6359
|
+
trackD += `${getSinePath(
|
|
6360
|
+
currentTrackX,
|
|
6361
|
+
trackEnd,
|
|
6362
|
+
phase,
|
|
6363
|
+
activeWavelength,
|
|
6364
|
+
trackAmp
|
|
6365
|
+
)} `;
|
|
6206
6366
|
}
|
|
6207
|
-
currentTrackX = Math.max(currentTrackX,
|
|
6367
|
+
currentTrackX = Math.max(currentTrackX, blockEnd);
|
|
6208
6368
|
}
|
|
6209
6369
|
if (currentTrackX < width - capWidth) {
|
|
6210
6370
|
trackD += getSinePath(
|
|
@@ -6217,15 +6377,15 @@ var WavyLinearTrack = React62.memo(function WavyLinearTrack2({
|
|
|
6217
6377
|
}
|
|
6218
6378
|
}
|
|
6219
6379
|
if (activePathRef.current)
|
|
6220
|
-
activePathRef.current.setAttribute("d", activePathD);
|
|
6380
|
+
activePathRef.current.setAttribute("d", activePathD || "");
|
|
6221
6381
|
if (trackPathRef.current)
|
|
6222
|
-
trackPathRef.current.setAttribute("d", trackD.trim());
|
|
6382
|
+
trackPathRef.current.setAttribute("d", trackD.trim() || "");
|
|
6223
6383
|
});
|
|
6224
6384
|
return /* @__PURE__ */ jsx(
|
|
6225
6385
|
"div",
|
|
6226
6386
|
{
|
|
6227
6387
|
ref: containerRef,
|
|
6228
|
-
className: "relative w-full
|
|
6388
|
+
className: "relative w-full",
|
|
6229
6389
|
style: { height: svgHeight },
|
|
6230
6390
|
children: width > 0 && /* @__PURE__ */ jsxs(
|
|
6231
6391
|
"svg",
|
|
@@ -6279,7 +6439,7 @@ var LinearProgress = React62.forwardRef(
|
|
|
6279
6439
|
waveSpeed = 1,
|
|
6280
6440
|
crawlerSpeed = 1,
|
|
6281
6441
|
determinateAnimation = "md3",
|
|
6282
|
-
indeterminateAnimation = "
|
|
6442
|
+
indeterminateAnimation = "md3",
|
|
6283
6443
|
gapSize = 4,
|
|
6284
6444
|
showStopIndicator = "auto",
|
|
6285
6445
|
color,
|
|
@@ -6316,15 +6476,15 @@ var LinearProgress = React62.forwardRef(
|
|
|
6316
6476
|
setIsRtl(dir === "rtl");
|
|
6317
6477
|
}
|
|
6318
6478
|
}, []);
|
|
6319
|
-
const isWavy = shape === "wavy";
|
|
6320
6479
|
const resolvedTrackShape = trackShape != null ? trackShape : shape;
|
|
6480
|
+
const isWavy = shape === "wavy" || resolvedTrackShape === "wavy";
|
|
6321
6481
|
const effectiveAmplitude = React62.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
|
|
6322
6482
|
const svgHeight = React62.useMemo(
|
|
6323
6483
|
() => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
|
|
6324
6484
|
[isWavy, trackHeight, effectiveAmplitude]
|
|
6325
6485
|
);
|
|
6326
6486
|
const shouldShowStop = React62.useMemo(
|
|
6327
|
-
() => isDeterminate && resolvedTrackShape === "flat" &&
|
|
6487
|
+
() => isDeterminate && resolvedTrackShape === "flat" && showStopIndicator !== false,
|
|
6328
6488
|
[isDeterminate, resolvedTrackShape, showStopIndicator]
|
|
6329
6489
|
);
|
|
6330
6490
|
const stopSize = React62.useMemo(
|
|
@@ -6334,6 +6494,8 @@ var LinearProgress = React62.forwardRef(
|
|
|
6334
6494
|
const stopOffset = (trackHeight - stopSize) / 2;
|
|
6335
6495
|
const activeColor = color || "var(--md-sys-color-indicator-active)";
|
|
6336
6496
|
const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
|
|
6497
|
+
const useWavyTrack = isWavy || !isDeterminate;
|
|
6498
|
+
const trackAmp = isWavy ? effectiveAmplitude : 0;
|
|
6337
6499
|
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsxs(
|
|
6338
6500
|
"div",
|
|
6339
6501
|
__spreadProps(__spreadValues({
|
|
@@ -6350,12 +6512,12 @@ var LinearProgress = React62.forwardRef(
|
|
|
6350
6512
|
style: { height: svgHeight }
|
|
6351
6513
|
}, restProps), {
|
|
6352
6514
|
children: [
|
|
6353
|
-
|
|
6515
|
+
useWavyTrack ? /* @__PURE__ */ jsx(
|
|
6354
6516
|
WavyLinearTrack,
|
|
6355
6517
|
{
|
|
6356
6518
|
trackHeight,
|
|
6357
6519
|
svgHeight,
|
|
6358
|
-
amplitude:
|
|
6520
|
+
amplitude: trackAmp,
|
|
6359
6521
|
wavelength,
|
|
6360
6522
|
indeterminateWavelength,
|
|
6361
6523
|
activeColor,
|