@bug-on/m3-expressive 1.3.0 → 1.3.1
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 +6 -0
- package/dist/buttons.d.mts +1 -1
- package/dist/buttons.d.ts +1 -1
- package/dist/buttons.js +185 -40
- package/dist/buttons.js.map +1 -1
- package/dist/buttons.mjs +186 -41
- package/dist/buttons.mjs.map +1 -1
- package/dist/core.js +156 -25
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +157 -26
- package/dist/core.mjs.map +1 -1
- package/dist/feedback.d.mts +20 -0
- package/dist/feedback.d.ts +20 -0
- package/dist/feedback.js +156 -25
- package/dist/feedback.js.map +1 -1
- package/dist/feedback.mjs +157 -26
- package/dist/feedback.mjs.map +1 -1
- package/dist/forms.d.mts +3 -2
- package/dist/forms.d.ts +3 -2
- package/dist/forms.js +88 -100
- package/dist/forms.js.map +1 -1
- package/dist/forms.mjs +88 -100
- package/dist/forms.mjs.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +279 -146
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +280 -147
- package/dist/index.mjs.map +1 -1
- package/dist/layout.js +158 -27
- package/dist/layout.js.map +1 -1
- package/dist/layout.mjs +159 -28
- package/dist/layout.mjs.map +1 -1
- package/dist/navigation.js +156 -25
- package/dist/navigation.js.map +1 -1
- package/dist/navigation.mjs +157 -26
- package/dist/navigation.mjs.map +1 -1
- package/dist/overlays.js +156 -25
- package/dist/overlays.js.map +1 -1
- package/dist/overlays.mjs +157 -26
- package/dist/overlays.mjs.map +1 -1
- package/dist/pickers.js +156 -25
- package/dist/pickers.js.map +1 -1
- package/dist/pickers.mjs +157 -26
- package/dist/pickers.mjs.map +1 -1
- package/dist/{split-button-trailing-uncheckable-26qlZvKT.d.mts → split-button-trailing-uncheckable-CIVEYgjY.d.mts} +2 -0
- package/dist/{split-button-trailing-uncheckable-CXUVrH64.d.ts → split-button-trailing-uncheckable-DTQJjzsB.d.ts} +2 -0
- package/dist/{text-field-DWC7qOvp.d.mts → text-field-CiOmDM_8.d.ts} +52 -51
- package/dist/{text-field-DWC7qOvp.d.ts → text-field-Ear3hCSq.d.mts} +52 -51
- package/package.json +3 -3
package/dist/navigation.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { AnimatePresence, m, LazyMotion, domMax,
|
|
2
|
+
import { AnimatePresence, m, LazyMotion, domMax, useMotionValue, animate, useAnimationFrame, useReducedMotion, LayoutGroup, useScroll, useMotionValueEvent, useTransform } from 'motion/react';
|
|
3
3
|
import { clsx } from 'clsx';
|
|
4
4
|
import { twMerge } from 'tailwind-merge';
|
|
5
5
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -6447,7 +6447,7 @@ LoadingIndicator.displayName = "LoadingIndicator";
|
|
|
6447
6447
|
function easeInOutCubic(x) {
|
|
6448
6448
|
return x < 0.5 ? 4 * x * x * x : 1 - (-2 * x + 2) ** 3 / 2;
|
|
6449
6449
|
}
|
|
6450
|
-
function generateWavyCircularPath(center, radius, amplitude, wavelength) {
|
|
6450
|
+
function generateWavyCircularPath(center, radius, amplitude, wavelength, phase = 0) {
|
|
6451
6451
|
const circumference = 2 * Math.PI * radius;
|
|
6452
6452
|
const numWaves = Math.max(
|
|
6453
6453
|
3,
|
|
@@ -6455,8 +6455,8 @@ function generateWavyCircularPath(center, radius, amplitude, wavelength) {
|
|
|
6455
6455
|
);
|
|
6456
6456
|
const steps = numWaves * 4;
|
|
6457
6457
|
const dt = 2 * Math.PI / steps;
|
|
6458
|
-
const rAt = (t) => radius + amplitude * Math.sin(numWaves * t);
|
|
6459
|
-
const drAt = (t) => amplitude * numWaves * Math.cos(numWaves * t);
|
|
6458
|
+
const rAt = (t) => radius + amplitude * Math.sin(numWaves * t + phase);
|
|
6459
|
+
const drAt = (t) => amplitude * numWaves * Math.cos(numWaves * t + phase);
|
|
6460
6460
|
const xAt = (t) => center + rAt(t) * Math.cos(t);
|
|
6461
6461
|
const yAt = (t) => center + rAt(t) * Math.sin(t);
|
|
6462
6462
|
const dxAt = (t) => drAt(t) * Math.cos(t) - rAt(t) * Math.sin(t);
|
|
@@ -6521,15 +6521,18 @@ var CircularProgress = React37.forwardRef(
|
|
|
6521
6521
|
size = 48,
|
|
6522
6522
|
trackHeight = 4,
|
|
6523
6523
|
shape = "flat",
|
|
6524
|
+
trackShape = "flat",
|
|
6524
6525
|
amplitude,
|
|
6525
6526
|
wavelength,
|
|
6526
6527
|
gapSize = 4,
|
|
6528
|
+
waveSpeed = 1,
|
|
6527
6529
|
crawlerSpeed = 1,
|
|
6528
6530
|
color,
|
|
6529
6531
|
trackColor,
|
|
6530
6532
|
showTrack = "auto",
|
|
6531
6533
|
minProgress = DEFAULT_MIN_PROGRESS,
|
|
6532
6534
|
maxProgress = DEFAULT_MAX_PROGRESS,
|
|
6535
|
+
determinateAnimation = "md3",
|
|
6533
6536
|
amplitudeRange,
|
|
6534
6537
|
className,
|
|
6535
6538
|
"aria-label": ariaLabel
|
|
@@ -6538,15 +6541,18 @@ var CircularProgress = React37.forwardRef(
|
|
|
6538
6541
|
"size",
|
|
6539
6542
|
"trackHeight",
|
|
6540
6543
|
"shape",
|
|
6544
|
+
"trackShape",
|
|
6541
6545
|
"amplitude",
|
|
6542
6546
|
"wavelength",
|
|
6543
6547
|
"gapSize",
|
|
6548
|
+
"waveSpeed",
|
|
6544
6549
|
"crawlerSpeed",
|
|
6545
6550
|
"color",
|
|
6546
6551
|
"trackColor",
|
|
6547
6552
|
"showTrack",
|
|
6548
6553
|
"minProgress",
|
|
6549
6554
|
"maxProgress",
|
|
6555
|
+
"determinateAnimation",
|
|
6550
6556
|
"amplitudeRange",
|
|
6551
6557
|
"className",
|
|
6552
6558
|
"aria-label"
|
|
@@ -6559,6 +6565,7 @@ var CircularProgress = React37.forwardRef(
|
|
|
6559
6565
|
const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
|
|
6560
6566
|
const isWavy = shape === "wavy";
|
|
6561
6567
|
const shouldShowIndeterminateTrack = showTrack === "auto" ? isWavy : showTrack;
|
|
6568
|
+
const shouldShowDeterminateTrack = showTrack === "auto" ? true : showTrack;
|
|
6562
6569
|
const BASELINE_SIZE = 48;
|
|
6563
6570
|
const scaleFactor = size / BASELINE_SIZE;
|
|
6564
6571
|
const effectiveAmplitude = React37.useMemo(
|
|
@@ -6591,19 +6598,50 @@ var CircularProgress = React37.forwardRef(
|
|
|
6591
6598
|
const trackOffset = isDeterminate ? activeAngularFraction + gapForTrack : 0;
|
|
6592
6599
|
const trackLength = isDeterminate ? Math.max(1e-3, 1 - activeAngularFraction - 2 * gapForTrack) : 1;
|
|
6593
6600
|
const ActiveCircleElem = m.circle;
|
|
6594
|
-
const ActivePathElem = m.path;
|
|
6595
6601
|
const indeterminateSvgRef = React37.useRef(null);
|
|
6596
6602
|
const indeterminateTrackRef = React37.useRef(null);
|
|
6597
6603
|
const indeterminateActiveRef = React37.useRef(null);
|
|
6598
6604
|
const indeterminateWavyTrackPathRef = React37.useRef(null);
|
|
6599
6605
|
const indeterminateWavyActivePathRef = React37.useRef(null);
|
|
6606
|
+
const determinateWavyActivePathRef = React37.useRef(null);
|
|
6607
|
+
const determinateWavyTrackPathRef = React37.useRef(null);
|
|
6600
6608
|
const cachedPathLengthRef = React37.useRef(0);
|
|
6609
|
+
const fractionMV = useMotionValue(isDeterminate ? clampedValue / 100 : 0);
|
|
6610
|
+
const amplitudeMV = useMotionValue(isWavy ? effectiveAmplitude : 0);
|
|
6611
|
+
React37.useEffect(() => {
|
|
6612
|
+
if (isDeterminate) {
|
|
6613
|
+
animate(fractionMV, clampedValue / 100, {
|
|
6614
|
+
duration: 0.4,
|
|
6615
|
+
ease: [0.2, 0, 0, 1]
|
|
6616
|
+
});
|
|
6617
|
+
}
|
|
6618
|
+
}, [clampedValue, isDeterminate, fractionMV]);
|
|
6619
|
+
React37.useEffect(() => {
|
|
6620
|
+
if (!isDeterminate || !isWavy) return;
|
|
6621
|
+
const fraction = clampedValue / 100;
|
|
6622
|
+
let targetAmp = effectiveAmplitude;
|
|
6623
|
+
if (determinateAnimation === "md3") {
|
|
6624
|
+
targetAmp = fraction <= 0.1 || fraction >= 0.95 ? 0 : effectiveAmplitude;
|
|
6625
|
+
}
|
|
6626
|
+
animate(amplitudeMV, targetAmp, {
|
|
6627
|
+
type: "spring",
|
|
6628
|
+
bounce: 0,
|
|
6629
|
+
duration: 0.5
|
|
6630
|
+
});
|
|
6631
|
+
}, [
|
|
6632
|
+
clampedValue,
|
|
6633
|
+
isDeterminate,
|
|
6634
|
+
isWavy,
|
|
6635
|
+
effectiveAmplitude,
|
|
6636
|
+
amplitudeMV,
|
|
6637
|
+
determinateAnimation
|
|
6638
|
+
]);
|
|
6601
6639
|
React37.useLayoutEffect(() => {
|
|
6602
6640
|
if (!isWavy || !wavyActivePath) {
|
|
6603
6641
|
cachedPathLengthRef.current = circumference;
|
|
6604
6642
|
return;
|
|
6605
6643
|
}
|
|
6606
|
-
const el = indeterminateActiveRef.current;
|
|
6644
|
+
const el = indeterminateActiveRef.current || determinateWavyActivePathRef.current;
|
|
6607
6645
|
if (el && "getTotalLength" in el) {
|
|
6608
6646
|
try {
|
|
6609
6647
|
const len = el.getTotalLength();
|
|
@@ -6617,7 +6655,65 @@ var CircularProgress = React37.forwardRef(
|
|
|
6617
6655
|
cachedPathLengthRef.current = circumference;
|
|
6618
6656
|
}, [isWavy, circumference, wavyActivePath]);
|
|
6619
6657
|
useAnimationFrame((time) => {
|
|
6620
|
-
|
|
6658
|
+
const safeWaveSpeed = Math.max(0.1, waveSpeed);
|
|
6659
|
+
const wavePhase = time / 1e3 * safeWaveSpeed * 2 * Math.PI;
|
|
6660
|
+
if (isDeterminate) {
|
|
6661
|
+
if (isWavy) {
|
|
6662
|
+
const currentAmp = amplitudeMV.get();
|
|
6663
|
+
const dynamicPath = generateWavyCircularPath(
|
|
6664
|
+
center,
|
|
6665
|
+
radius,
|
|
6666
|
+
currentAmp,
|
|
6667
|
+
effectiveWavelength,
|
|
6668
|
+
wavePhase
|
|
6669
|
+
);
|
|
6670
|
+
if (determinateWavyActivePathRef.current) {
|
|
6671
|
+
determinateWavyActivePathRef.current.setAttribute("d", dynamicPath);
|
|
6672
|
+
}
|
|
6673
|
+
if (trackShape === "wavy" && determinateWavyTrackPathRef.current) {
|
|
6674
|
+
determinateWavyTrackPathRef.current.setAttribute("d", dynamicPath);
|
|
6675
|
+
}
|
|
6676
|
+
const pathEl = determinateWavyActivePathRef.current;
|
|
6677
|
+
let totalLen = cachedPathLengthRef.current || circumference;
|
|
6678
|
+
if (pathEl) {
|
|
6679
|
+
try {
|
|
6680
|
+
const len = pathEl.getTotalLength();
|
|
6681
|
+
if (len > 0) totalLen = len;
|
|
6682
|
+
} catch (e) {
|
|
6683
|
+
}
|
|
6684
|
+
}
|
|
6685
|
+
const activeFrac = Math.max(0, Math.min(1, fractionMV.get()));
|
|
6686
|
+
const activeLen = totalLen * activeFrac;
|
|
6687
|
+
if (determinateWavyActivePathRef.current) {
|
|
6688
|
+
determinateWavyActivePathRef.current.setAttribute(
|
|
6689
|
+
"stroke-dasharray",
|
|
6690
|
+
`${activeLen} ${totalLen}`
|
|
6691
|
+
);
|
|
6692
|
+
determinateWavyActivePathRef.current.setAttribute(
|
|
6693
|
+
"stroke-dashoffset",
|
|
6694
|
+
"0"
|
|
6695
|
+
);
|
|
6696
|
+
}
|
|
6697
|
+
if (shouldShowDeterminateTrack && trackShape === "wavy" && determinateWavyTrackPathRef.current) {
|
|
6698
|
+
const gapFrac = (gapSize + trackHeight) / totalLen;
|
|
6699
|
+
const trackStartFrac = activeFrac + gapFrac;
|
|
6700
|
+
const trackLen = Math.max(
|
|
6701
|
+
1e-3,
|
|
6702
|
+
totalLen * (1 - activeFrac - 2 * gapFrac)
|
|
6703
|
+
);
|
|
6704
|
+
const trackOff = -totalLen * trackStartFrac;
|
|
6705
|
+
determinateWavyTrackPathRef.current.setAttribute(
|
|
6706
|
+
"stroke-dasharray",
|
|
6707
|
+
`${trackLen} ${totalLen}`
|
|
6708
|
+
);
|
|
6709
|
+
determinateWavyTrackPathRef.current.setAttribute(
|
|
6710
|
+
"stroke-dashoffset",
|
|
6711
|
+
`${trackOff}`
|
|
6712
|
+
);
|
|
6713
|
+
}
|
|
6714
|
+
}
|
|
6715
|
+
return;
|
|
6716
|
+
}
|
|
6621
6717
|
const safeCrawlerSpeed = Math.max(0.1, crawlerSpeed);
|
|
6622
6718
|
const scaledTime = time * safeCrawlerSpeed;
|
|
6623
6719
|
const globalCycle = scaledTime % GLOBAL_ROTATION_DURATION;
|
|
@@ -6652,7 +6748,8 @@ var CircularProgress = React37.forwardRef(
|
|
|
6652
6748
|
center,
|
|
6653
6749
|
radius,
|
|
6654
6750
|
currentAmplitude,
|
|
6655
|
-
effectiveWavelength
|
|
6751
|
+
effectiveWavelength,
|
|
6752
|
+
wavePhase
|
|
6656
6753
|
);
|
|
6657
6754
|
if (indeterminateWavyActivePathRef.current) {
|
|
6658
6755
|
indeterminateWavyActivePathRef.current.setAttribute("d", dynamicPath);
|
|
@@ -6747,7 +6844,7 @@ var CircularProgress = React37.forwardRef(
|
|
|
6747
6844
|
style: { width: size, height: size }
|
|
6748
6845
|
}, restProps), {
|
|
6749
6846
|
children: /* @__PURE__ */ jsxs(LazyMotion, { features: domMax, strict: true, children: [
|
|
6750
|
-
/* @__PURE__ */
|
|
6847
|
+
/* @__PURE__ */ jsx(
|
|
6751
6848
|
"svg",
|
|
6752
6849
|
{
|
|
6753
6850
|
width: size,
|
|
@@ -6755,8 +6852,18 @@ var CircularProgress = React37.forwardRef(
|
|
|
6755
6852
|
viewBox: `0 0 ${size} ${size}`,
|
|
6756
6853
|
"aria-hidden": "true",
|
|
6757
6854
|
style: { transform: "rotate(-90deg)", overflow: "visible" },
|
|
6758
|
-
children: [
|
|
6759
|
-
|
|
6855
|
+
children: isDeterminate ? isWavy ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6856
|
+
shouldShowDeterminateTrack && (trackShape === "wavy" ? /* @__PURE__ */ jsx(
|
|
6857
|
+
"path",
|
|
6858
|
+
{
|
|
6859
|
+
ref: determinateWavyTrackPathRef,
|
|
6860
|
+
d: wavyActivePath != null ? wavyActivePath : "",
|
|
6861
|
+
fill: "none",
|
|
6862
|
+
stroke: bgTrackColor,
|
|
6863
|
+
strokeWidth: trackHeight,
|
|
6864
|
+
strokeLinecap: "round"
|
|
6865
|
+
}
|
|
6866
|
+
) : /* @__PURE__ */ jsx(
|
|
6760
6867
|
m.circle,
|
|
6761
6868
|
{
|
|
6762
6869
|
cx: center,
|
|
@@ -6765,28 +6872,52 @@ var CircularProgress = React37.forwardRef(
|
|
|
6765
6872
|
fill: "none",
|
|
6766
6873
|
stroke: bgTrackColor,
|
|
6767
6874
|
strokeWidth: trackHeight,
|
|
6768
|
-
initial: {
|
|
6769
|
-
|
|
6875
|
+
initial: {
|
|
6876
|
+
pathLength: trackLength,
|
|
6877
|
+
pathOffset: trackOffset
|
|
6878
|
+
},
|
|
6879
|
+
animate: {
|
|
6880
|
+
pathLength: trackLength,
|
|
6881
|
+
pathOffset: trackOffset
|
|
6882
|
+
},
|
|
6770
6883
|
transition: { duration: 0.4, ease: [0.2, 0, 0, 1] },
|
|
6771
6884
|
strokeLinecap: "round"
|
|
6772
6885
|
}
|
|
6773
|
-
)
|
|
6774
|
-
|
|
6775
|
-
|
|
6886
|
+
)),
|
|
6887
|
+
/* @__PURE__ */ jsx(
|
|
6888
|
+
"path",
|
|
6776
6889
|
{
|
|
6890
|
+
ref: determinateWavyActivePathRef,
|
|
6777
6891
|
d: wavyActivePath != null ? wavyActivePath : "",
|
|
6778
6892
|
fill: "none",
|
|
6779
6893
|
stroke: activeColor,
|
|
6780
6894
|
strokeWidth: trackHeight,
|
|
6781
|
-
strokeLinecap: "round"
|
|
6782
|
-
initial: { pathLength: 0 },
|
|
6783
|
-
animate: { pathLength: clampedValue / 100 },
|
|
6784
|
-
transition: {
|
|
6785
|
-
duration: 0.4,
|
|
6786
|
-
ease: [0.2, 0, 0, 1]
|
|
6787
|
-
}
|
|
6895
|
+
strokeLinecap: "round"
|
|
6788
6896
|
}
|
|
6789
|
-
)
|
|
6897
|
+
)
|
|
6898
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6899
|
+
/* @__PURE__ */ jsx(
|
|
6900
|
+
m.circle,
|
|
6901
|
+
{
|
|
6902
|
+
cx: center,
|
|
6903
|
+
cy: center,
|
|
6904
|
+
r: radius,
|
|
6905
|
+
fill: "none",
|
|
6906
|
+
stroke: bgTrackColor,
|
|
6907
|
+
strokeWidth: trackHeight,
|
|
6908
|
+
initial: {
|
|
6909
|
+
pathLength: trackLength,
|
|
6910
|
+
pathOffset: trackOffset
|
|
6911
|
+
},
|
|
6912
|
+
animate: {
|
|
6913
|
+
pathLength: trackLength,
|
|
6914
|
+
pathOffset: trackOffset
|
|
6915
|
+
},
|
|
6916
|
+
transition: { duration: 0.4, ease: [0.2, 0, 0, 1] },
|
|
6917
|
+
strokeLinecap: "round"
|
|
6918
|
+
}
|
|
6919
|
+
),
|
|
6920
|
+
/* @__PURE__ */ jsx(
|
|
6790
6921
|
ActiveCircleElem,
|
|
6791
6922
|
{
|
|
6792
6923
|
cx: center,
|
|
@@ -6803,8 +6934,8 @@ var CircularProgress = React37.forwardRef(
|
|
|
6803
6934
|
ease: [0.2, 0, 0, 1]
|
|
6804
6935
|
}
|
|
6805
6936
|
}
|
|
6806
|
-
)
|
|
6807
|
-
]
|
|
6937
|
+
)
|
|
6938
|
+
] }) : null
|
|
6808
6939
|
}
|
|
6809
6940
|
),
|
|
6810
6941
|
!isDeterminate && /* @__PURE__ */ jsx(
|