@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/layout.js
CHANGED
|
@@ -510,7 +510,7 @@ LoadingIndicator.displayName = "LoadingIndicator";
|
|
|
510
510
|
function easeInOutCubic(x) {
|
|
511
511
|
return x < 0.5 ? 4 * x * x * x : 1 - (-2 * x + 2) ** 3 / 2;
|
|
512
512
|
}
|
|
513
|
-
function generateWavyCircularPath(center, radius, amplitude, wavelength) {
|
|
513
|
+
function generateWavyCircularPath(center, radius, amplitude, wavelength, phase = 0) {
|
|
514
514
|
const circumference = 2 * Math.PI * radius;
|
|
515
515
|
const numWaves = Math.max(
|
|
516
516
|
3,
|
|
@@ -518,8 +518,8 @@ function generateWavyCircularPath(center, radius, amplitude, wavelength) {
|
|
|
518
518
|
);
|
|
519
519
|
const steps = numWaves * 4;
|
|
520
520
|
const dt = 2 * Math.PI / steps;
|
|
521
|
-
const rAt = (t) => radius + amplitude * Math.sin(numWaves * t);
|
|
522
|
-
const drAt = (t) => amplitude * numWaves * Math.cos(numWaves * t);
|
|
521
|
+
const rAt = (t) => radius + amplitude * Math.sin(numWaves * t + phase);
|
|
522
|
+
const drAt = (t) => amplitude * numWaves * Math.cos(numWaves * t + phase);
|
|
523
523
|
const xAt = (t) => center + rAt(t) * Math.cos(t);
|
|
524
524
|
const yAt = (t) => center + rAt(t) * Math.sin(t);
|
|
525
525
|
const dxAt = (t) => drAt(t) * Math.cos(t) - rAt(t) * Math.sin(t);
|
|
@@ -584,15 +584,18 @@ var CircularProgress = React18__namespace.forwardRef(
|
|
|
584
584
|
size = 48,
|
|
585
585
|
trackHeight = 4,
|
|
586
586
|
shape = "flat",
|
|
587
|
+
trackShape = "flat",
|
|
587
588
|
amplitude,
|
|
588
589
|
wavelength,
|
|
589
590
|
gapSize = 4,
|
|
591
|
+
waveSpeed = 1,
|
|
590
592
|
crawlerSpeed = 1,
|
|
591
593
|
color,
|
|
592
594
|
trackColor,
|
|
593
595
|
showTrack = "auto",
|
|
594
596
|
minProgress = DEFAULT_MIN_PROGRESS,
|
|
595
597
|
maxProgress = DEFAULT_MAX_PROGRESS,
|
|
598
|
+
determinateAnimation = "md3",
|
|
596
599
|
amplitudeRange,
|
|
597
600
|
className,
|
|
598
601
|
"aria-label": ariaLabel
|
|
@@ -601,15 +604,18 @@ var CircularProgress = React18__namespace.forwardRef(
|
|
|
601
604
|
"size",
|
|
602
605
|
"trackHeight",
|
|
603
606
|
"shape",
|
|
607
|
+
"trackShape",
|
|
604
608
|
"amplitude",
|
|
605
609
|
"wavelength",
|
|
606
610
|
"gapSize",
|
|
611
|
+
"waveSpeed",
|
|
607
612
|
"crawlerSpeed",
|
|
608
613
|
"color",
|
|
609
614
|
"trackColor",
|
|
610
615
|
"showTrack",
|
|
611
616
|
"minProgress",
|
|
612
617
|
"maxProgress",
|
|
618
|
+
"determinateAnimation",
|
|
613
619
|
"amplitudeRange",
|
|
614
620
|
"className",
|
|
615
621
|
"aria-label"
|
|
@@ -622,6 +628,7 @@ var CircularProgress = React18__namespace.forwardRef(
|
|
|
622
628
|
const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
|
|
623
629
|
const isWavy = shape === "wavy";
|
|
624
630
|
const shouldShowIndeterminateTrack = showTrack === "auto" ? isWavy : showTrack;
|
|
631
|
+
const shouldShowDeterminateTrack = showTrack === "auto" ? true : showTrack;
|
|
625
632
|
const BASELINE_SIZE = 48;
|
|
626
633
|
const scaleFactor = size / BASELINE_SIZE;
|
|
627
634
|
const effectiveAmplitude = React18__namespace.useMemo(
|
|
@@ -654,19 +661,50 @@ var CircularProgress = React18__namespace.forwardRef(
|
|
|
654
661
|
const trackOffset = isDeterminate ? activeAngularFraction + gapForTrack : 0;
|
|
655
662
|
const trackLength = isDeterminate ? Math.max(1e-3, 1 - activeAngularFraction - 2 * gapForTrack) : 1;
|
|
656
663
|
const ActiveCircleElem = react.m.circle;
|
|
657
|
-
const ActivePathElem = react.m.path;
|
|
658
664
|
const indeterminateSvgRef = React18__namespace.useRef(null);
|
|
659
665
|
const indeterminateTrackRef = React18__namespace.useRef(null);
|
|
660
666
|
const indeterminateActiveRef = React18__namespace.useRef(null);
|
|
661
667
|
const indeterminateWavyTrackPathRef = React18__namespace.useRef(null);
|
|
662
668
|
const indeterminateWavyActivePathRef = React18__namespace.useRef(null);
|
|
669
|
+
const determinateWavyActivePathRef = React18__namespace.useRef(null);
|
|
670
|
+
const determinateWavyTrackPathRef = React18__namespace.useRef(null);
|
|
663
671
|
const cachedPathLengthRef = React18__namespace.useRef(0);
|
|
672
|
+
const fractionMV = react.useMotionValue(isDeterminate ? clampedValue / 100 : 0);
|
|
673
|
+
const amplitudeMV = react.useMotionValue(isWavy ? effectiveAmplitude : 0);
|
|
674
|
+
React18__namespace.useEffect(() => {
|
|
675
|
+
if (isDeterminate) {
|
|
676
|
+
react.animate(fractionMV, clampedValue / 100, {
|
|
677
|
+
duration: 0.4,
|
|
678
|
+
ease: [0.2, 0, 0, 1]
|
|
679
|
+
});
|
|
680
|
+
}
|
|
681
|
+
}, [clampedValue, isDeterminate, fractionMV]);
|
|
682
|
+
React18__namespace.useEffect(() => {
|
|
683
|
+
if (!isDeterminate || !isWavy) return;
|
|
684
|
+
const fraction = clampedValue / 100;
|
|
685
|
+
let targetAmp = effectiveAmplitude;
|
|
686
|
+
if (determinateAnimation === "md3") {
|
|
687
|
+
targetAmp = fraction <= 0.1 || fraction >= 0.95 ? 0 : effectiveAmplitude;
|
|
688
|
+
}
|
|
689
|
+
react.animate(amplitudeMV, targetAmp, {
|
|
690
|
+
type: "spring",
|
|
691
|
+
bounce: 0,
|
|
692
|
+
duration: 0.5
|
|
693
|
+
});
|
|
694
|
+
}, [
|
|
695
|
+
clampedValue,
|
|
696
|
+
isDeterminate,
|
|
697
|
+
isWavy,
|
|
698
|
+
effectiveAmplitude,
|
|
699
|
+
amplitudeMV,
|
|
700
|
+
determinateAnimation
|
|
701
|
+
]);
|
|
664
702
|
React18__namespace.useLayoutEffect(() => {
|
|
665
703
|
if (!isWavy || !wavyActivePath) {
|
|
666
704
|
cachedPathLengthRef.current = circumference;
|
|
667
705
|
return;
|
|
668
706
|
}
|
|
669
|
-
const el = indeterminateActiveRef.current;
|
|
707
|
+
const el = indeterminateActiveRef.current || determinateWavyActivePathRef.current;
|
|
670
708
|
if (el && "getTotalLength" in el) {
|
|
671
709
|
try {
|
|
672
710
|
const len = el.getTotalLength();
|
|
@@ -680,7 +718,65 @@ var CircularProgress = React18__namespace.forwardRef(
|
|
|
680
718
|
cachedPathLengthRef.current = circumference;
|
|
681
719
|
}, [isWavy, circumference, wavyActivePath]);
|
|
682
720
|
react.useAnimationFrame((time) => {
|
|
683
|
-
|
|
721
|
+
const safeWaveSpeed = Math.max(0.1, waveSpeed);
|
|
722
|
+
const wavePhase = time / 1e3 * safeWaveSpeed * 2 * Math.PI;
|
|
723
|
+
if (isDeterminate) {
|
|
724
|
+
if (isWavy) {
|
|
725
|
+
const currentAmp = amplitudeMV.get();
|
|
726
|
+
const dynamicPath = generateWavyCircularPath(
|
|
727
|
+
center,
|
|
728
|
+
radius,
|
|
729
|
+
currentAmp,
|
|
730
|
+
effectiveWavelength,
|
|
731
|
+
wavePhase
|
|
732
|
+
);
|
|
733
|
+
if (determinateWavyActivePathRef.current) {
|
|
734
|
+
determinateWavyActivePathRef.current.setAttribute("d", dynamicPath);
|
|
735
|
+
}
|
|
736
|
+
if (trackShape === "wavy" && determinateWavyTrackPathRef.current) {
|
|
737
|
+
determinateWavyTrackPathRef.current.setAttribute("d", dynamicPath);
|
|
738
|
+
}
|
|
739
|
+
const pathEl = determinateWavyActivePathRef.current;
|
|
740
|
+
let totalLen = cachedPathLengthRef.current || circumference;
|
|
741
|
+
if (pathEl) {
|
|
742
|
+
try {
|
|
743
|
+
const len = pathEl.getTotalLength();
|
|
744
|
+
if (len > 0) totalLen = len;
|
|
745
|
+
} catch (e) {
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
const activeFrac = Math.max(0, Math.min(1, fractionMV.get()));
|
|
749
|
+
const activeLen = totalLen * activeFrac;
|
|
750
|
+
if (determinateWavyActivePathRef.current) {
|
|
751
|
+
determinateWavyActivePathRef.current.setAttribute(
|
|
752
|
+
"stroke-dasharray",
|
|
753
|
+
`${activeLen} ${totalLen}`
|
|
754
|
+
);
|
|
755
|
+
determinateWavyActivePathRef.current.setAttribute(
|
|
756
|
+
"stroke-dashoffset",
|
|
757
|
+
"0"
|
|
758
|
+
);
|
|
759
|
+
}
|
|
760
|
+
if (shouldShowDeterminateTrack && trackShape === "wavy" && determinateWavyTrackPathRef.current) {
|
|
761
|
+
const gapFrac = (gapSize + trackHeight) / totalLen;
|
|
762
|
+
const trackStartFrac = activeFrac + gapFrac;
|
|
763
|
+
const trackLen = Math.max(
|
|
764
|
+
1e-3,
|
|
765
|
+
totalLen * (1 - activeFrac - 2 * gapFrac)
|
|
766
|
+
);
|
|
767
|
+
const trackOff = -totalLen * trackStartFrac;
|
|
768
|
+
determinateWavyTrackPathRef.current.setAttribute(
|
|
769
|
+
"stroke-dasharray",
|
|
770
|
+
`${trackLen} ${totalLen}`
|
|
771
|
+
);
|
|
772
|
+
determinateWavyTrackPathRef.current.setAttribute(
|
|
773
|
+
"stroke-dashoffset",
|
|
774
|
+
`${trackOff}`
|
|
775
|
+
);
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
return;
|
|
779
|
+
}
|
|
684
780
|
const safeCrawlerSpeed = Math.max(0.1, crawlerSpeed);
|
|
685
781
|
const scaledTime = time * safeCrawlerSpeed;
|
|
686
782
|
const globalCycle = scaledTime % GLOBAL_ROTATION_DURATION;
|
|
@@ -715,7 +811,8 @@ var CircularProgress = React18__namespace.forwardRef(
|
|
|
715
811
|
center,
|
|
716
812
|
radius,
|
|
717
813
|
currentAmplitude,
|
|
718
|
-
effectiveWavelength
|
|
814
|
+
effectiveWavelength,
|
|
815
|
+
wavePhase
|
|
719
816
|
);
|
|
720
817
|
if (indeterminateWavyActivePathRef.current) {
|
|
721
818
|
indeterminateWavyActivePathRef.current.setAttribute("d", dynamicPath);
|
|
@@ -810,7 +907,7 @@ var CircularProgress = React18__namespace.forwardRef(
|
|
|
810
907
|
style: { width: size, height: size }
|
|
811
908
|
}, restProps), {
|
|
812
909
|
children: /* @__PURE__ */ jsxRuntime.jsxs(react.LazyMotion, { features: react.domMax, strict: true, children: [
|
|
813
|
-
/* @__PURE__ */ jsxRuntime.
|
|
910
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
814
911
|
"svg",
|
|
815
912
|
{
|
|
816
913
|
width: size,
|
|
@@ -818,8 +915,18 @@ var CircularProgress = React18__namespace.forwardRef(
|
|
|
818
915
|
viewBox: `0 0 ${size} ${size}`,
|
|
819
916
|
"aria-hidden": "true",
|
|
820
917
|
style: { transform: "rotate(-90deg)", overflow: "visible" },
|
|
821
|
-
children: [
|
|
822
|
-
|
|
918
|
+
children: isDeterminate ? isWavy ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
919
|
+
shouldShowDeterminateTrack && (trackShape === "wavy" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
920
|
+
"path",
|
|
921
|
+
{
|
|
922
|
+
ref: determinateWavyTrackPathRef,
|
|
923
|
+
d: wavyActivePath != null ? wavyActivePath : "",
|
|
924
|
+
fill: "none",
|
|
925
|
+
stroke: bgTrackColor,
|
|
926
|
+
strokeWidth: trackHeight,
|
|
927
|
+
strokeLinecap: "round"
|
|
928
|
+
}
|
|
929
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
823
930
|
react.m.circle,
|
|
824
931
|
{
|
|
825
932
|
cx: center,
|
|
@@ -828,28 +935,52 @@ var CircularProgress = React18__namespace.forwardRef(
|
|
|
828
935
|
fill: "none",
|
|
829
936
|
stroke: bgTrackColor,
|
|
830
937
|
strokeWidth: trackHeight,
|
|
831
|
-
initial: {
|
|
832
|
-
|
|
938
|
+
initial: {
|
|
939
|
+
pathLength: trackLength,
|
|
940
|
+
pathOffset: trackOffset
|
|
941
|
+
},
|
|
942
|
+
animate: {
|
|
943
|
+
pathLength: trackLength,
|
|
944
|
+
pathOffset: trackOffset
|
|
945
|
+
},
|
|
833
946
|
transition: { duration: 0.4, ease: [0.2, 0, 0, 1] },
|
|
834
947
|
strokeLinecap: "round"
|
|
835
948
|
}
|
|
836
|
-
)
|
|
837
|
-
|
|
838
|
-
|
|
949
|
+
)),
|
|
950
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
951
|
+
"path",
|
|
839
952
|
{
|
|
953
|
+
ref: determinateWavyActivePathRef,
|
|
840
954
|
d: wavyActivePath != null ? wavyActivePath : "",
|
|
841
955
|
fill: "none",
|
|
842
956
|
stroke: activeColor,
|
|
843
957
|
strokeWidth: trackHeight,
|
|
844
|
-
strokeLinecap: "round"
|
|
845
|
-
initial: { pathLength: 0 },
|
|
846
|
-
animate: { pathLength: clampedValue / 100 },
|
|
847
|
-
transition: {
|
|
848
|
-
duration: 0.4,
|
|
849
|
-
ease: [0.2, 0, 0, 1]
|
|
850
|
-
}
|
|
958
|
+
strokeLinecap: "round"
|
|
851
959
|
}
|
|
852
|
-
)
|
|
960
|
+
)
|
|
961
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
962
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
963
|
+
react.m.circle,
|
|
964
|
+
{
|
|
965
|
+
cx: center,
|
|
966
|
+
cy: center,
|
|
967
|
+
r: radius,
|
|
968
|
+
fill: "none",
|
|
969
|
+
stroke: bgTrackColor,
|
|
970
|
+
strokeWidth: trackHeight,
|
|
971
|
+
initial: {
|
|
972
|
+
pathLength: trackLength,
|
|
973
|
+
pathOffset: trackOffset
|
|
974
|
+
},
|
|
975
|
+
animate: {
|
|
976
|
+
pathLength: trackLength,
|
|
977
|
+
pathOffset: trackOffset
|
|
978
|
+
},
|
|
979
|
+
transition: { duration: 0.4, ease: [0.2, 0, 0, 1] },
|
|
980
|
+
strokeLinecap: "round"
|
|
981
|
+
}
|
|
982
|
+
),
|
|
983
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
853
984
|
ActiveCircleElem,
|
|
854
985
|
{
|
|
855
986
|
cx: center,
|
|
@@ -866,8 +997,8 @@ var CircularProgress = React18__namespace.forwardRef(
|
|
|
866
997
|
ease: [0.2, 0, 0, 1]
|
|
867
998
|
}
|
|
868
999
|
}
|
|
869
|
-
)
|
|
870
|
-
]
|
|
1000
|
+
)
|
|
1001
|
+
] }) : null
|
|
871
1002
|
}
|
|
872
1003
|
),
|
|
873
1004
|
!isDeterminate && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2304,7 +2435,7 @@ var DividerImpl = React18__namespace.forwardRef(
|
|
|
2304
2435
|
insetStart = "standard",
|
|
2305
2436
|
waveConfig,
|
|
2306
2437
|
decorative = false,
|
|
2307
|
-
animate:
|
|
2438
|
+
animate: animate4 = true,
|
|
2308
2439
|
className,
|
|
2309
2440
|
style
|
|
2310
2441
|
} = _b, props = __objRest(_b, [
|
|
@@ -2320,7 +2451,7 @@ var DividerImpl = React18__namespace.forwardRef(
|
|
|
2320
2451
|
]);
|
|
2321
2452
|
var _a2, _b2, _c;
|
|
2322
2453
|
const reducedMotion = react.useReducedMotion();
|
|
2323
|
-
const shouldAnimate =
|
|
2454
|
+
const shouldAnimate = animate4 && !reducedMotion;
|
|
2324
2455
|
const effectiveShape = shape === "wavy" && orientation === "vertical" ? "flat" : shape;
|
|
2325
2456
|
if (shape === "wavy" && orientation === "vertical") {
|
|
2326
2457
|
console.warn(
|